From 812d2b6d138263beb91683983bd1b1fe82bb40d5 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 27 Nov 2018 23:05:53 +0800 Subject: [PATCH 0001/4278] Translating 7 command-line tools for writers. --- ...line tools for writers - Opensource.com.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 translated/tech/20181119 7 command-line tools for writers - Opensource.com.md diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md new file mode 100644 index 0000000000..4d2edb8472 --- /dev/null +++ b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md @@ -0,0 +1,73 @@ +给写作者们的 7 个命令行工具 | Opensource.com +====== +扔掉你的打字机,然后使用这些开源工具在命令行上编辑吧。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE) + +对于大多数人(尤其是非技术人员),写作意味着在 LibreOffice Writer 或者其他带图形界面的文本编辑器上编辑文本。但是还有很多可行的方法可以让任何人通过文本传递他们的信息,尤其是越来越多的作者选择[拥抱纯文本][1]。 + +在使用图形界面写作的世界同样有命令行工具的一席之地。这些命令行工具可以帮助他们进行写作,检查他们的拼写等等——无论是在写一篇文章、博客或者故事;写一个 README 文件;或者准备一份技术文档的时候。 + +下面是一些在任何写作情况下都有用的命令行工具。 + +### 编辑器 + +Yes, you _can_ do actual writing at the command line. I know writers who do their work using editors like [Nano][2], [Vim][3], [Emacs][4], and [Jove][5] in a terminal window. And those editors [aren't the only games in town][6]. Text editors are great because they (at a basic level, anyway) are easy to use and distraction free. They're perfect for tapping out a first draft of anything or even completing a long and complicated writing project. + +If you want a more word processor-like experience at the command line, take a look at [WordGrinder][7] . WordGrinder is a bare-bones word processor, but it has more than enough features for writing and publishing your work. It supports basic formatting and styles, and you can export your writing to formats like Markdown, ODT, LaTeX, and HTML. + +### 拼写检查 + +Every writer does (or at least should do) a spelling check on their work at least once. Why? An immutable law of the writing universe states that, no matter how many times you look over your manuscript, a spelling mistake or typo will creep in. + +My favorite command-line spelling checker is [GNU Aspell][8], which I previously [looked at][9] in detail. Aspell checks plaintext documents interactively and not only highlights errors but often puts the best correction at the top of its list of suggestions. Aspell also ignores many markup languages while doing its thing. + +A much older but still useful alternative is [Ispell][10]. It's a bit slower than Aspell, but both utilities work the same way. As you interact with your text file, Ispell suggests corrections. Ispell also has good support for foreign languages. + +### Prose linters + +Software developers use [linters][11] to check their code for errors or bugs. There are also linters for prose that check for style and syntax errors; think of them as the _Elements of Style_ for the command line. While any writer can (and probably should) use one, a prose linter is especially useful for team documentation projects that require a consistent voice and style. + +[Proselint][12] is a comprehensive tool for checking what you're writing. It looks for jargon, hyperbole, incorrect date and time format, misused terms, and [much more][13]. It's also easy to run and ignores markup in a plaintext file. + +[Alex][14] is a simple yet powerful prose linter. Run it against a plaintext document or one formatted with Markdown or HTML. Alex pumps out warnings of "gender favouring, polarising, race related, religion inconsiderate, or other unequal phrasing in text." If you want to give Alex a test drive, there's an [online demo][15]. + +### 其他工具 + +Sometimes you just can't find the right synonym for a word. But you don't need to grab a "dead tree" thesaurus or go to a dedicated website to perfect your word choice. Just run [Aiksaurus][16] against the word you want to replace, and it does the work for you. This utility's main drawback, though, is that it supports English only. + +Even writers with few (if any) technical skills are embracing [Markdown][17] to quickly and easily format their work. Sometimes, though, you need to convert files formatted with Markdown to something else. That's where [Pandoc][18] comes in. You can use it to convert your documents to HTML, Word, LibreOffice Writer, LaTeX, EPUB, and other formats. You can even use Pandoc to produce books and [research papers][19]. + +Do you have a favorite command-line tool for writing? Share it with the Opensource.com community by leaving a comment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/command-line-tools-writers + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[校对者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://plaintextproject.online +[2]: https://www.nano-editor.org/ +[3]: https://www.vim.org +[4]: https://www.gnu.org/software/emacs/ +[5]: https://opensource.com/article/17/1/jove-lightweight-alternative-vim +[6]: https://en.wikipedia.org/wiki/List_of_text_editors#Text_user_interface +[7]: https://cowlark.com/wordgrinder/ +[8]: http://aspell.net/ +[9]: https://opensource.com/article/18/2/how-check-spelling-linux-command-line-aspell +[10]: https://www.cs.hmc.edu/~geoff/ispell.html +[11]: https://en.wikipedia.org/wiki/Lint_(software) +[12]: http://proselint.com/ +[13]: http://proselint.com/checks/ +[14]: https://github.com/get-alex/alex +[15]: https://alexjs.com/#demo +[16]: http://aiksaurus.sourceforge.net/ +[17]: https://en.wikipedia.org/wiki/Markdown +[18]: https://pandoc.org +[19]: https://opensource.com/article/18/9/pandoc-research-paper From 4addde62288e64711a8108ec17683b1061106afa Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 29 Nov 2018 13:32:03 +0800 Subject: [PATCH 0002/4278] Translating 7 command-line tools for writers. --- ...81119 7 command-line tools for writers - Opensource.com.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md index 4d2edb8472..74a03b9ab8 100644 --- a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md +++ b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md @@ -11,9 +11,9 @@ ### 编辑器 -Yes, you _can_ do actual writing at the command line. I know writers who do their work using editors like [Nano][2], [Vim][3], [Emacs][4], and [Jove][5] in a terminal window. And those editors [aren't the only games in town][6]. Text editors are great because they (at a basic level, anyway) are easy to use and distraction free. They're perfect for tapping out a first draft of anything or even completing a long and complicated writing project. +没错,你_可以_在命令行进行真正的写作。我知道一些写作者会使用 [Nano][2]、[Vim][3]、[Emacs][4]、以及 [Jove][5] 等编辑器在终端窗口中进行工作。而这些编辑器并不是[aren't the only games in town][6]。文本编辑器的优势在于它们简单易用和专注。它们非常适合于编辑任何文本的初稿甚至完成一个漫长而复杂的写作项目。 -If you want a more word processor-like experience at the command line, take a look at [WordGrinder][7] . WordGrinder is a bare-bones word processor, but it has more than enough features for writing and publishing your work. It supports basic formatting and styles, and you can export your writing to formats like Markdown, ODT, LaTeX, and HTML. +如果你想在命令行中获得更像文字编辑器的体验,不妨了解一下[WordGrinder][7]。WordGrinder 是一款简单但拥有足够的编写和发布功能的文字编辑器。它支持基本的格式和样式,并且你可以将你的文字以 Markdown, ODT, LaTeX, 以及 HTML等格式导出。 ### 拼写检查 From 63f6e041b4b70f85faa4d5bf91e4a04f40668ec0 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 30 Nov 2018 12:59:11 +0800 Subject: [PATCH 0003/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20The=20Top=20Com?= =?UTF-8?q?mand=20Tutorial=20With=20Examples=20For=20Beginners?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nd Tutorial With Examples For Beginners.md | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 sources/tech/20181129 The Top Command Tutorial With Examples For Beginners.md diff --git a/sources/tech/20181129 The Top Command Tutorial With Examples For Beginners.md b/sources/tech/20181129 The Top Command Tutorial With Examples For Beginners.md new file mode 100644 index 0000000000..df932ebb83 --- /dev/null +++ b/sources/tech/20181129 The Top Command Tutorial With Examples For Beginners.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (The Top Command Tutorial With Examples For Beginners) +[#]: via: (https://www.ostechnix.com/the-top-command-tutorial-with-examples-for-beginners/) +[#]: author: ([SK](https://www.ostechnix.com/author/sk/)) +[#]: url: ( ) + +The Top Command Tutorial With Examples For Beginners +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/11/top-command-720x340.png) + +As a Linux administrator, you may need to need to know some basic details of your Linux system, such as the currently running processes, average system load, cpu and memory usage etc., at some point. Thankfully, we have a command line utility called **“top”** to get such details. The top command is a well-known and most widely used utility to display dynamic real-time information about running processes in Unix-like operating systems. In this brief tutorial, we are going to see some common use cases of top command. + +### Top Command Examples + +**Monitor all processes** + +To start monitoring the running processes, simply run the top command without any options: + +``` +$ top +``` + +Sample output: + +![](https://www.ostechnix.com/wp-content/uploads/2018/11/top-command-1.png) + +As you see in the above screenshot, top command displays the list of processes in multiple columns. Each column displays details such as pid, user, cpu usage, memory usage. Apart from the list of processes, you will also see the brief stats about average system load, number of tasks, cpu usage, memory usage and swap usage on the top. + +Here is the explanation of the parameters mentioned above. + + * **PID** – Process id of the task. + * **USER** – Username of the the task’s owner. + * **PR** – Priority of the task. + * **NI** – Nice value of the task. If the nice value is negative, the process gets higher priority. If the nice value is positive, the priority is low. Refer [**this guide**][1] to know more about nice. + * **VIRT** – Total amount of virtual memory used by the task. + * **RES** – Resident Memory Size, the non-swapped physical memory a task is currently using. + * **SHR** – Shared Memory Size. The amount of shared memory used by a task. + * **S** – The status of the process (S=sleep R=running Z=zombie). + * **%CPU** – CPU usage. The task’s share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time. + * **%MEM** – Memory Usage. A task’s currently resident share of available physical memory. + * **TIME+** – Total CPU time used by the task since it has started, precise to the hundredths of a second. + * **COMMAND** – Name of the running program. + + + +**Display path of processes** + +If you want to see the absolute path of the running processes, just press **‘c’**. Now you will see the actual path of the programs under the COMMAND column in the below screenshot. + +![][3] + +**Monitor processes owned by a specific user** + +If you run top command without any options, it will list all running processes owned by all users. How about displaying processes owned by a specific user? It is easy! To show the processes owned by a given user, for example **sk** , simply run: + +``` +$ top -u sk +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/11/top-command-3.png) + +**Do not show idle/zombie processes** + +Instead of viewing all processes, you can simply ignore the idle or zombie processes. The following command will not show any idle or zombie processes: + +``` +$ top -i +``` + +**Monitor processes with PID** + +If you know the PID of any processes, for example 21180, you can monitor that process using **-p** flag. + +``` +$ top -p 21180 +``` + +You can specify multiple PIDs with comma-separated values. + +**Monitor processes with process name** + +I don’t know PID, but know only the process name. How to monitor it? Simple! + +``` +$ top -p $(pgrep -d ',' firefox) +``` + +Here, **firefox** is the process name and **‘pgrep -d’** picks the respective PID from the process name. + +**Display processes by CPU usage** + +Sometimes, you might want to display processes sorted by CPU usage. If so, use the following command: + +``` +$ top -o %CPU +``` + +![][4] + +The processes with higher CPU usage will be displayed on the top. Alternatively, you sort the processes by CPU usage by pressing **SHIFT+p**. + +**Display processes by Memory usage** + +Similarly, to order processes by memory usage, the command would be: + +``` +$ top -o %MEM +``` + +**Renice processes** + +You can change the priority of a process at any time using the option **‘r’**. Run the top command and press **r** and type the PID of a process to change its priority. + +![][5] + +Here, **‘r’** refers renice. + +**Set update interval** + +Top program has an option to specify the delay between screen updates. If want to change the delay-time, say 5 seconds, run: + +``` +$ top -d 5 +``` + +The default value is **3.0** seconds. + +If you already started the top command, just press **‘d’** and type delay-time and hit ENTER key. + +![][6] + +**Set number of iterations (repetition)** + +By default, top command will keep running until you press **q** to exit. However, you can set the number of iterations after which top will end. For instance, to exit top command automatically after 5 iterations, run: + +``` +$ top -n 5 +``` + +**Kill running processes** + +To kill a running process, simply press **‘k’** and type its PID and hit ENTER key. + +![][7] + +Top command supports few other options as well. For example, press **‘z’** to switch between mono and color output. It will help you to easily highlight running processes. + +![][8] + +Press **‘h’** to view all available keyboard shortcuts and help section. + +To quit top, just press **q**. + +At this stage, you will have a basic understanding of top command. For more details, refer man pages. + +``` +$ man top +``` + +As you can see, using Top command to monitor the running processes isn’t that hard. Top command is easy to learn and use! + +And, that’s all for now. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/the-top-command-tutorial-with-examples-for-beginners/ + +作者:[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/change-priority-process-linux/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2018/11/top-command-2.png +[4]: http://www.ostechnix.com/wp-content/uploads/2018/11/top-command-4.png +[5]: http://www.ostechnix.com/wp-content/uploads/2018/11/top-command-8.png +[6]: http://www.ostechnix.com/wp-content/uploads/2018/11/top-command-7.png +[7]: http://www.ostechnix.com/wp-content/uploads/2018/11/top-command-5.png +[8]: http://www.ostechnix.com/wp-content/uploads/2018/11/top-command-6.png From 94ad0cc124c723fd15d0ce57867f6cbbe098a70c Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 30 Nov 2018 13:36:22 +0800 Subject: [PATCH 0004/4278] Translating 7 command-line tools for writers. --- ...119 7 command-line tools for writers - Opensource.com.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md index 74a03b9ab8..ad76bc2d4e 100644 --- a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md +++ b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md @@ -17,11 +17,11 @@ ### 拼写检查 -Every writer does (or at least should do) a spelling check on their work at least once. Why? An immutable law of the writing universe states that, no matter how many times you look over your manuscript, a spelling mistake or typo will creep in. +每个写作者在完成他们的工作前至少要(或者说应该要)进行一次拼写检查。为什么呢?在写作的世界里有个永恒的定律,无论你检查了多少次手稿,拼写错误和错字依然会存在。 -My favorite command-line spelling checker is [GNU Aspell][8], which I previously [looked at][9] in detail. Aspell checks plaintext documents interactively and not only highlights errors but often puts the best correction at the top of its list of suggestions. Aspell also ignores many markup languages while doing its thing. +我曾经详细[介绍][9]过我最喜欢的命令行拼写检查工具 [GNU Aspell][8]。交互式检测文本文档的 Aspell 不仅能够高亮显示拼写错误还能在拼写错误的上方提供正确的拼写建议。Aspell 在进行拼写检查同样能够忽略许多标记语言文本。 -A much older but still useful alternative is [Ispell][10]. It's a bit slower than Aspell, but both utilities work the same way. As you interact with your text file, Ispell suggests corrections. Ispell also has good support for foreign languages. +另一个够老但仍然有用的代替品是 [Ispell][10]。虽然它比 Aspell 稍慢一点,但它们都以相同的方式工作。当你在你的文本文件上工作时,Ispell 将提供正确的建议。Ispell 同样也对英语以外的语言提供了良好的支持。 ### Prose linters From a8c0c02c6dd3bc23c4183b33ff76417938a36860 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 4 Dec 2018 12:59:18 +0800 Subject: [PATCH 0005/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20brin?= =?UTF-8?q?g=20good=20fortune=20to=20your=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ing good fortune to your Linux terminal.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20181203 How to bring good fortune to your Linux terminal.md diff --git a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md b/sources/tech/20181203 How to bring good fortune to your Linux terminal.md new file mode 100644 index 0000000000..7549dc0249 --- /dev/null +++ b/sources/tech/20181203 How to bring good fortune to your Linux terminal.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (How to bring good fortune to your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) +[#]: url: ( ) + +How to bring good fortune to your Linux terminal +====== +Bring quotes and quips to the command line with the fortune utility. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-fortune.png?itok=5PVVZVer) + +It's December, and if you haven't found a [tech advent calendar][1] that sparks your fancy yet, well, maybe this one will do the trick. Every day, from now to the 24th, we're bringing you a different Linux command-line toy. What's a command-line toy, you ask? It could be a game or any simple diversion to bring a little happiness to your terminal. + +You may have seen some of these before. We hope you'll find something new, too. Either way, we hope you have fun following along. + +Today's toy, **fortune** , is an old one. Versions of it date back to the 1980s when it was included with Unix. The version I installed in Fedora was available under a BSD license, and I grabbed it with the following. + +``` +$ sudo dnf install fortune-mod -y +``` + +Your distribution may be different. On some, you may need to install the fortunes separately from **fortune** itself (try searching your package manager for "fortunes*"). You can also check out the source code on [GitHub][2]. Then, just run **fortune** to get, well, a fortune. + +``` +$ fortune +"Time is an illusion.  Lunchtime doubly so." +-- Ford Prefect, _Hitchhiker's Guide to the Galaxy_ +``` + +So why do you need fortunes at the terminal? For fun, of course. Perhaps you'd like to add them to the message of the day on your system? + +Personally, I like using the **fortune** command as a built-in piece of dummy data when I'm using the terminal to parse text, particularly with [regular expressions][3], and want something simple to try it out on. + +For example, let's say I was testing our a transformation with the **tr** command to replace letter the letter e with a numeral 3. + +``` +$ fortune | tr 'eE' '3' +Unix 3xpr3ss: +All pass3ng3r bring a pi3c3 of th3 a3roplan3 and a box of tools with th3m to +th3 airport. Th3y gath3r on th3 tarmac, arguing constantly about what kind +of plan3 th3y want to build and how to put it tog3th3r. 3v3ntually, th3 +pass3ng3rs split into groups and build s3v3ral diff3r3nt aircraft, but giv3 +th3m all th3 sam3 nam3. Som3 pass3ng3rs actually r3ach th3ir d3stinations. +All pass3ng3rs b3li3v3 th3y got th3r3. +``` + +So what fortunes come with your distribution? Take a look in your **/usr/share/games/fortune** directory to find them all. Here are a few of my favorites. + +``` +Never laugh at live dragons. +                -- Bilbo Baggins [J.R.R. Tolkien, "The Hobbit"] + +I dunno, I dream in Perl sometimes... +             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> + +I have an existential map.  It has "You are here" written all over it. +                -- Steven Wright +``` + +Looking for more on **fortune**? You can, of course, always check out the man page to learn more about the options, or read a little bit more about the history of the command on [Wikipedia][4]. + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Drive a locomotive through your Linux terminal][5], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-fortune + +作者:[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/16/11/7-tech-advent-calendars-holiday-season +[2]: https://github.com/shlomif/fortune-mod +[3]: https://opensource.com/article/18/5/getting-started-regular-expressions +[4]: https://en.wikipedia.org/wiki/Fortune_%28Unix%29 +[5]: https://opensource.com/article/18/12/linux-toy-sl From c718a2e2f4f192fc1a3eb62ff8c6e57fbc25e9b2 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 4 Dec 2018 13:02:12 +0800 Subject: [PATCH 0006/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20ANGRYsearch=20?= =?UTF-8?q?=E2=80=93=20Quick=20Search=20GUI=20Tool=20for=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...earch - Quick Search GUI Tool for Linux.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20181203 ANGRYsearch - Quick Search GUI Tool for Linux.md diff --git a/sources/tech/20181203 ANGRYsearch - Quick Search GUI Tool for Linux.md b/sources/tech/20181203 ANGRYsearch - Quick Search GUI Tool for Linux.md new file mode 100644 index 0000000000..7c8952549f --- /dev/null +++ b/sources/tech/20181203 ANGRYsearch - Quick Search GUI Tool for Linux.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (ANGRYsearch – Quick Search GUI Tool for Linux) +[#]: via: (https://itsfoss.com/angrysearch/) +[#]: author: (John Paul https://itsfoss.com/author/john/) +[#]: url: ( ) + +ANGRYsearch – Quick Search GUI Tool for Linux +====== + +A search application is one of the most important tools you can have on your computer. Most are slow to indexes your system and find results. However, today we will be looking at an application that can display results as you type. Today, we will be looking at ANGRYsearch. + +### What is ANGRYsearch? + +![][1] +Newly installed ANGRYsearch + +[ANGRYsearch][2] is a Python-based application that delivers results as you type your search query. The overall idea and design of the application are both inspired by [Everything][3] a search tool for Windows. (I discovered Everything ad couple of years ago and install it wherever I use Windows.) + +ANGRYsearch is able to display the search results so quickly because it only indexes filenames. After you install ANGRYsearch, you create a database of filenames by indexing your system. ANGRYsearch then quickly filters filenames as you type your query. + +Even though there is not much to ANGRYsearch, there are several things you can do to customize the experience. First, ANGRYsearch has two different display modes: lite and full. Lite mode only shows the filename and path. Full mode displays filename, path, size, and date of the last modification. Full mode, obviously, takes longer to display. The default is lite mode. In order to switch to full mode, you need to edit the config file at `~/.config/angrysearch/angrysearch.conf`. In that file change the `angrysearch_lite` value to false. + +ANGRYsearch also has three different search modes: fast, slow, and regex. Fast mode displays filenames that start with your search term. For example, if you had a folder full of the latest releases of a bunch of Linux distros and you searched “Ubuntu”, ANGRYsearch would display Ubuntu, Ubuntu Mate, Ubuntu Budgie, but not Kubuntu, Xubuntu, or Lubuntu. Fast mode is on by default and can be turned off by unchecking the checkbox next to the “update” button. Slow mode is slightly slower (obviously), but it will display files that have your search term anywhere in their name. In the previous example, ANGRYsearch would show all Ubuntu distros. Regex mode is the slowest and most precise. It uses [regular expressions][4] and is case insensitive. Regex mode is activated by pressing F8. + +You can also tell ANGRYsearch to ignore certain folders when it indexes your system. Just click the “update” button and enter the names of the folders you want to be ignored in the space provided. You can also choose from several icon themes, though it doesn’t make that much difference. + +![][5]Fast mode results + +### Installing ANGRYsearch on Linux + +ANGRYsearch is available in the [Arch User Repository][6]. It has also been packaged for [Fedora and openSUSE][7]. + +To install on other distros, follow these instructions. Instructions are written for a Debian or Ubuntu based system. + +ANGRYsearch depends on `python3-pyqt5` and`xdg-utils` so you will need to install them first. Most distros have `xdg-utils`already installed. + +`sudo apt install python3-pyqt5` + +Next. download the latest version (1.0.1). + +`wget https://github.com/DoTheEvo/ANGRYsearch/archive/v1.0.1.zip` + +Now, unzip the archive file. + +`unzip v1.0.1.zip` + +Next, we will navigate to the new folder (ANGRYsearch-1.0.1) and run the installer. + +`cd ANGRYsearch-1.0.1` + +`chmod +x install.sh` + +`sudo ./install.sh` + +The installation process is very quick, so don’t be surprised when a new command line is displayed as soon as you hit `Enter`. + +The first time that you start ANGRYsearch, you will need to index your system. ANGRYsearch does not automatically keep its database updated. You can use `crontab` to schedule a system scan. + +To open a text editor to create a new cronjob, use `crontab -e`. To make sure that the ANGRYsearch database is updated every 6 hours, use this command `0 */6 选题模板.txt 中文排版指北.md core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LCTT翻译规范.md LICENSE published README.md scripts sources translated 选题模板.txt 中文排版指北.md core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LCTT翻译规范.md LICENSE published README.md scripts sources translated 选题模板.txt 中文排版指北.md core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LCTT翻译规范.md LICENSE published README.md scripts sources translated /usr/share/angrysearch/angrysearch_update_database.py`. `crontab` does not run the job if it is powered off when the timer does off. In some case, you may need to manually update the database, but it should not take long. + +![][8]ANGRYsearch update/options menu + +### Experience + +In the past, I was always frustrated by how painfully slow it was to search my computer. I knew that Windows had the Everything app, but I thought Linux out of luck. It didn’t even occur to me to look for something similar on Linux. I’m glad I accidentally stumbled upon ANGRYsearch. + +I know there will be quite a few people complaining that ANGRYsearch only searches filenames, but most of the time that is all I need. Thankfully, most of the time I only need to remember part of the name to find what I am looking for. + +The only thing that annoys me about ANGRYsearch is that fact that it does not automatically update its database. You’d think there would be a way for the installer to create a cron job when you install it. + +![][9]Slow mode results + +### Final Thoughts + +Since ANGRYsearch is basically a Linux port of one of my favorite Windows apps, I’m pretty happy with it. I plan to install it on all my systems going forward. + +I know that I have ragged on other Linux apps for not being packaged for easy install, but I can’t do the same for ANGRYsearch. The installation process is pretty easy. I would definitely recommend it for Linux noobs. + +Have you ever used [ANGRYsearch][2]? If not, what is your favorite Linux search application? 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/angrysearch/ + +作者:[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://i1.wp.com/itsfoss.com/wp-content/uploads/2018/11/angrysearch3.jpg?resize=800%2C627&ssl=1 +[2]: https://github.com/dotheevo/angrysearch/ +[3]: https://www.voidtools.com/ +[4]: http://www.aivosto.com/articles/regex.html +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/angrysearch1.jpg?resize=800%2C627&ssl=1 +[6]: https://aur.archlinux.org/packages/angrysearch/ +[7]: https://software.opensuse.org/package/angrysearch +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/angrysearch2.jpg?resize=800%2C626&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/angrysearch4.jpg?resize=800%2C627&ssl=1 +[10]: http://reddit.com/r/linuxusersgroup From d41d6a1487a308542e649918f50642a106c61f51 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 6 Dec 2018 09:07:11 +0800 Subject: [PATCH 0007/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Fix?= =?UTF-8?q?=20Broken=20Ubuntu=20OS=20Without=20Reinstalling=20It?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...roken Ubuntu OS Without Reinstalling It.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md diff --git a/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md b/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md new file mode 100644 index 0000000000..a00541b536 --- /dev/null +++ b/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (How To Fix Broken Ubuntu OS Without Reinstalling It) +[#]: via: (https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-it/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) +[#]: url: ( ) + +How To Fix Broken Ubuntu OS Without Reinstalling It +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Fix-Broken-Ubuntu-OS-720x340.jpg) + +Today, I was upgrading my Ubuntu 18.04 LTS system. Unfortunately, the power has gone in mid-way and the system powered off while updating Ubuntu OS. When the power is back, I boot the system again. Right after entering the password at the login screen, it’s gone blank and didn’t respond. Keyboard and mouse also didn’t work. All I see is just a blank screen! Thankfully, It’s just a test machine and there were no important data in it. I can simply wipe off the entire OS and install it again. But, I don’t want to do that. Since I have nothing to lose, I just wanted to repair my broken Ubuntu system without reinstalling it completely and it worked!!! If you ever find yourself in a situation like mine, don’t panic. This brief tutorial describes how to easily fix broken Ubuntu OS without losing data and without reinstalling it completely. + +### Fix Broken Ubuntu OS + +First of all, try to login with live cd and **backup your data** in an external drive. Just in case, if this method didn’t work, you can still have your data and reinstall everything! + +At the login screen, press **CTRL+ALT+F1** to switch to **tty1**. You can learn more about switching between TTYs [**here**][1]. + +Now, type the following commands one by one to fix the broken Ubuntu Linux. + +``` +$ sudo rm /var/lib/apt/lists/lock + +$ sudo rm /var/lib/dpkg/lock + +$ sudo rm /var/lib/dpkg/lock-frontend + +$ sudo dpkg --configure -a + +$ sudo apt clean + +$ sudo apt update --fix-missing + +$ sudo apt install -f + +$ sudo dpkg --configure -a + +$ sudo apt upgrade + +$ sudo apt dist-upgrade +``` + +Finally, reboot the system using command: + +``` +$ sudo reboot +``` + +You can now be able to login to your Ubuntu system as usual. + +After I followed these steps, all of my data in Ubuntu 18.04 test system was there and everything is the same as I left it. This method may not work for everyone. However, this small tip worked for me and saved a couple minutes from reinstalling. If you know any other better way, please let me know in the comment section. I will add them in this guide as well. + +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-fix-broken-ubuntu-os-without-reinstalling-it/ + +作者:[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-switch-between-ttys-without-using-function-keys-in-linux/ From b38cabaf2a6971e7e82cf21432b004a7e7a1001e Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 6 Dec 2018 09:08:23 +0800 Subject: [PATCH 0008/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20F-Words=20in=20?= =?UTF-8?q?Linux=20Kernel=20Code=20Replaced=20with=20"Hug"=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...in Linux Kernel Code Replaced with -Hug.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/talk/20181205 F-Words in Linux Kernel Code Replaced with -Hug.md diff --git a/sources/talk/20181205 F-Words in Linux Kernel Code Replaced with -Hug.md b/sources/talk/20181205 F-Words in Linux Kernel Code Replaced with -Hug.md new file mode 100644 index 0000000000..821b81d29e --- /dev/null +++ b/sources/talk/20181205 F-Words in Linux Kernel Code Replaced with -Hug.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (F-Words in Linux Kernel Code Replaced with "Hug"?) +[#]: via: (https://itsfoss.com/swear-words-linux-kernel/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) +[#]: url: ( ) + +F-Words in Linux Kernel Code Replaced with "Hug"? +====== + +**Brief: To comply with the new code of conduct, a developer from Intel proposes to replace F-words in the Linux kernel code with “hug”.** + +![Polite Linus Torvalds after Code of Conduct][1] + +Change is in air for the Linux Kernel Community. + +Ever since the introduction of the [Linux code of conduct][2], things are going in a ‘polite direction’. + +To refresh your memory, a few months back a new code of conduct was introduced for the Linux kernel developers. This code of conduct asks the developers to be nice and welcoming to other developers and be more open to diversity. + +The new code of conduct caused a huge controversy as many Linux users and developers saw it as a conspiracy by Social Justice Warriors (SJW) to infiltrate Linux. The rumors were especially boosted by the [controversial past of the Contributor Covenant creator Coraline Ada Ehmke][2]. The Linux code of conduct is based on the same Contributor Covenant. + +Right after signing the new code of conduct, Linux creator [Linus Torvalds took a month-long break to improve his behavior][3]. + +Torvalds who is known for being ruthless against poor code is a changed man now. After [coming back from the break][4], Torvalds controlled his rage and instead of lashing out against a developer, he replied nicely and pointed his mistake in a polite way. + +### No more F-words in the Linux Kernel code? + +There have been F-words in the Linux kernel code. To be clear, these F-words are in the code comments, not in the actual code. + +You might expect that there will be way too many F-words in the 15+ millions of lines of Linux kernel code but that’s not the case. + +Jarkko Sakkinen from Intel pushed [these patches][5] that replace the F-words 33 times in the 3.3 million lines of code comments. + +Interestingly, the patch email is titled “ **Zero ****s, hugload of hugs <3**“: + +> In order to comply with the CoC, replace 选题模板.txt 中文排版指北.md core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LCTT翻译规范.md LICENSE published README.md scripts sources translated with a hug. + +So now comments have become: + + * Only Sun can take such nice parts and **hug** up the programming interface like this + * IOC3 is **hugging** **hugged** beyond belief + * **Hug** , we are miserable poor guys… + + + +### Do you give a ‘hug’ about these changes? + +At this point, it’s not clear if this ‘hugging’ patch has been accepted or not. It’s more of an attempt to bring attention to profanity inside the kernel code. + +So, we have to wait and watch if this patch sets a trend for removing offensive words from the Linux kernel code. + +What do you think of it? Is using ‘hug’ a good choice or do you have a better word for replacing the F-words? + +And what do you think of these changes altogether. Do you think all these are unnecessary and futile exercises? + +And when you comment, please replace your F-words with hugs :) + +Story source: [Phoronix][6] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/swear-words-linux-kernel/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/hug-you-linus-torvalds.jpeg?resize=800%2C450&ssl=1 +[2]: https://itsfoss.com/linux-code-of-conduct/ +[3]: https://itsfoss.com/torvalds-takes-a-break-from-linux/ +[4]: https://itsfoss.com/torvalds-is-back/ +[5]: https://lists.freedesktop.org/archives/dri-devel/2018-November/198581.html +[6]: https://www.phoronix.com/scan.php?page=news_item&px=Linux-Kernel-Hugs From bba744b4260ccd5f815f064b137cd914605055ba Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 6 Dec 2018 09:10:21 +0800 Subject: [PATCH 0009/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20reasons=20t?= =?UTF-8?q?o=20give=20Linux=20for=20the=20holidays?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... reasons to give Linux for the holidays.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/talk/20181205 5 reasons to give Linux for the holidays.md 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 new file mode 100644 index 0000000000..2bcd6d642c --- /dev/null +++ b/sources/talk/20181205 5 reasons to give Linux for the holidays.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (5 reasons to give Linux for the holidays) +[#]: via: (https://opensource.com/article/18/12/reasons-give-linux-holidays) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) +[#]: url: ( ) + +5 reasons to give Linux for the holidays +====== +If a computer is on your gift-giving list, here's why it should be Linux. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY) + +Every year around this time, people ask me about the best computer to give (or get) for the holidays. I always give the same answer: Linux. After all, if you want your recipients to be happy, why wouldn't you give them the best operating system on the planet? + +Many people don't realize they have options when it comes to computer operating systems. Just recently, two friends (who didn't do their research) fell for the clever marketing and bought brand-new systems at premium prices. I'm willing to bet that within six months they'll be dissatisfied with those expensive computers. + +In contrast, I recently purchased a four-year-old computer with an i5 processor, 4GB of RAM, and a 128GB SSD drive, and I love it. It's fast and has all the applications I need to be successful and happy. That's because I'm running Linux. Whether I'm using Firefox or Chrome, all my websites load quickly and the video is great. In fact, the web is faster on Linux than it is on MacOS or Windows. + +So, if you're in the mood to give a computer for the holidays, here are five good reasons it should be Linux. + +### 1\. Linux is easy to use + +Linux distributions like [Fedora][1], [Ubuntu][2], [PopOS][3], [Linux Mint][4], and [Raspbian][5] come with loads of documentation and access to a user community eager to help. And desktop environments such as [GNOME][6], [KDE][7], and [LXDE][8] mean the Linux operating system is just plain easy. If you have a problem with a Linux operating system, you won't have to wait in a long telephone queue for an answer—you can tap into the community's knowledge. + +### 2\. Free applications for practically anything you need + +There are hundreds of high-quality, free software packages available for Linux. My favorites are [LibreOffice][9] and [GnuCash][10]. I cannot imagine any writing task that is beyond the scope of LibreOffice. I use it and recommend it to everyone I know. Why spend money on a name-brand productivity suite when LibreOffice, the best one out there, is free? (If you agree and you're able, you really ought to consider contributing to the project.) + +### 3\. Security + +Linux is secure, an important fact in an age when security tops most people's essential features list. On Linux, viruses and malware are minimal. I spend many days each year helping friends recover their Windows systems that have been hacked or infected with malware. That's rare on Linux, and if you want to be doubly sure no one gains improper access to your computer, there are plenty of open source solutions that can help prevent it. My favorites are [ClamAV][11] and [Rootkit Hunter][12]. Linux respects your privacy. It does not upload user data to Redmond or Cupertino. + +### 4\. Freedom + +Linux gives me the freedom to use my operating system however I choose, whether that is as a standalone workstation for personal productivity, a content server, a firewall for my home network, or something else. Unlike proprietary desktop operating systems, you don't have to purchase an upgrade or extension to expand your system's capabilities. There are no limitations. Best of all, I can give all of this knowledge away and encourage others to do the same. Isn't giving to others the spirit of holiday traditions? + +### 5\. Stability + +Linux is reliable and stable. The operating system does not crash. When you get updates, they don't require you to reboot while you're in the middle of doing something else. If you're using an older version of Fedora, Ubuntu, or Linux Mint and are happy with the status quo, you don't have to upgrade. Linux also offers more support for drivers of legacy printers and other peripherals than other operating systems. + +### How to give Linux + +Linux could be the best present your friends ever receive. Instead of buying holiday gifts from your favorite retailer, buy some 8GB or 16GB USB drives, download your favorite distribution, and [make some bootable USB][13] drives to give away. Volunteer your time (or include instructions) to help your friends to explore the "live" editions of these distributions before they install the operating system. Or, if you have an old, unused laptop or desktop, consider installing Linux and loaning it out for training purposes. Most of your friends will have no idea what a wonderful gift you are giving them—in the process, you will discover the joy of giving yourself to others. + +If you really want to buy a new computer, this year I recommend you look at [System 76][14] or Dell's [XPS Developer][15] edition. If you don't want a new model, there are plenty of great offerings on [eBay][16], [DellRefurbished.com][17], and other sites that sell good-quality older laptops that are great candidates for an easy Linux install. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/reasons-give-linux-holidays + +作者:[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://getfedora.org/ +[2]: https://www.ubuntu.com/ +[3]: https://system76.com/pop +[4]: https://linuxmint.com/ +[5]: https://www.raspbian.org/ +[6]: https://www.gnome.org/ +[7]: https://www.kde.org/ +[8]: https://lxde.org/ +[9]: https://www.libreoffice.org/ +[10]: https://www.gnucash.org/ +[11]: https://www.clamav.net/ +[12]: http://rkhunter.sourceforge.net/ +[13]: https://opensource.com/article/18/7/getting-started-etcherio +[14]: https://system76.com/ +[15]: https://www.dell.com/en-us/work/shop/dell-laptops-and-notebooks/xps-13-developer-edition/spd/xps-13-9370-laptop?appliedRefinements=302 +[16]: https://www.ebay.com/b/Computers-Tablets-Network-Hardware/58058/bn_1865247 +[17]: http://DellRefurbished.com From f3e363cffd009d0fe5060396e3dcb820cb2fb138 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 6 Dec 2018 13:36:55 +0800 Subject: [PATCH 0010/4278] Translating 7 command-line tools for writers. --- ...0181119 7 command-line tools for writers - Opensource.com.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md index ad76bc2d4e..04d6af4dfd 100644 --- a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md +++ b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md @@ -25,7 +25,7 @@ ### Prose linters -Software developers use [linters][11] to check their code for errors or bugs. There are also linters for prose that check for style and syntax errors; think of them as the _Elements of Style_ for the command line. While any writer can (and probably should) use one, a prose linter is especially useful for team documentation projects that require a consistent voice and style. +软件开发人员使用[linters][11]来检查他们的代码是否存在错误或者 bugs。同样也有用于检查文本样式或语法错误的linters;而命令行会认为这些错误是_样式元素_。任何写作者都可以(也应该)使用它,一个文本 linter 对于要求文档风格和样式一致的文档团队项目而言尤其有用。 [Proselint][12] is a comprehensive tool for checking what you're writing. It looks for jargon, hyperbole, incorrect date and time format, misused terms, and [much more][13]. It's also easy to run and ignores markup in a plaintext file. From dcbf6a5bb65d92ec31668813bcc214dd7773a56f Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 7 Dec 2018 12:56:18 +0800 Subject: [PATCH 0011/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Bring=20some=20?= =?UTF-8?q?color=20to=20your=20Linux=20terminal=20with=20lolcat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...olor to your Linux terminal with lolcat.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md diff --git a/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md b/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md new file mode 100644 index 0000000000..740e95c3bf --- /dev/null +++ b/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Bring some color to your Linux terminal with lolcat) +[#]: via: (https://opensource.com/article/18/12/linux-toy-lolcat) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) +[#]: url: ( ) + +Bring some color to your Linux terminal with lolcat +====== +With this simple utility, you can add a rainbow of color to the output of any program you want. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-lolcat.png?itok=Es6dYcph) + +Today marks the fifth day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal. + +It's quite possible that 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, **lolcat** , is the first utility I'm including that wasn't packaged for my Linux distribution, but it was still an easy install. It's a Ruby program that you ought to be able to easily add to your system with the following. + +``` +$ gem install lolcat +``` + +After that, simply pipe some text to it to see the output in the colors of the rainbow. For example, using a couple of utilities from earlier days in our advent calendar, try the following: + +``` +$ fortune | boxes -a c -d parchment | lolcat +``` + +Depending on what good fortune you have, you'll likely get something like this: +![](https://opensource.com/sites/default/files/uploads/linux-toy-lolcat-parchment.png) + +There are a few parameters you can pass to **lolcat** , and rather than repeat them all here, I'd suggest you either visit the **lolcat** [GitHub page][1] or just see them at the terminal by typing **lolcat --help**. But generally, they're helpful to set the spread and frequency of your rainbow, and my personal favorite, enabling animation. Who doesn't like animated rainbow printing at the terminal? Let's try the above again, with a different box (cat-themed, of course) and a cat-appropriate fortune that was in my fortunes list, with the following. + +``` +fortune -m "nine tails" | boxes -a c -d cat | lolcat -a +``` +![](https://opensource.com/sites/default/files/uploads/linux-toy-lolcat-animated.gif) +**lolcat** is open source under a BSD license. + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Have a cow at the Linux command line][2], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-lolcat + +作者:[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://github.com/busyloop/lolcat +[2]: https://opensource.com/article/18/12/linux-toy-cowsay From 4043edcf66401cd99d6e31afa73585eff01786c3 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 7 Dec 2018 12:57:50 +0800 Subject: [PATCH 0012/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Bash=20Variable?= =?UTF-8?q?s:=20Environmental=20and=20Otherwise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Variables- Environmental and Otherwise.md | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 sources/tech/20181205 Bash Variables- Environmental and Otherwise.md diff --git a/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md b/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md new file mode 100644 index 0000000000..11397f9b80 --- /dev/null +++ b/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md @@ -0,0 +1,222 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Bash Variables: Environmental and Otherwise) +[#]: via: (https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) +[#]: url: ( ) + +Bash Variables: Environmental and Otherwise +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/wynand-van-poortvliet-40467-unsplash.jpg?itok=tr6Eb4N0) + +Bash variables, including those pesky _environment variables_ , have been popped up several times in previous articles, and it’s high time you get to know them better and how they can help you. + +So, open your terminal window and let's get started. + +### Environment Variables + +Consider `HOME`. Apart from the cozy place where you lay down your hat, in Linux it is a variable that contains the path to the current user's home directory. Try this: + +``` +echo $HOME +``` + +This will show the path to your home directory, usually _/home/_. + +As the name indicates, variables can change according to the context. Indeed, each user on a Linux system will have a `HOME` variable containing a different value. You can also change the value of a variable by hand: + +``` +HOME=/home//Documents +``` + +will make `HOME` point to your _Documents/_ folder. + +There are three things to notice here: + + 1. There are no spaces between the name of the variable and the `=` or between the `=` and the value you are putting into the variable. Spaces have their own meaning in the shell and cannot be used any old way you want. + 2. If you want to put a value into a variable or manipulate it in any way, you just have to write the name of the variable. If you want to see or use the contents of a variable, you put a `$` in front of it. + 3. Changing `HOME` is risky! A lot programs rely on `HOME` to do stuff and changing it can have unforeseeable consequences. For example, just for laughs, change `HOME` as shown above and try typing `cd` and then [Enter]. As we have seen elsewhere in this series, you use `cd` to _c_ hange to another _d_ irectory. Without any parameters, `cd` takes you to your home directory. If you change the `HOME` variable, `cd` will take you to the new directory `HOME` points to. + + + +Changes to environment variables like the one described in point 3 above are not permanent. If you close your terminal and open it back up, or even open a new tab in your terminal window and move there, `echo $HOME` will show its original value. + +Before we go on to how you make changes permanent, let's look at another environment variable that it does make sense changing. + +### PATH + +The `PATH` variable lists directories that contain executable programs. If you ever wondered where your applications go when they are installed and how come the shell seems to magically know which programs it can run without you having to tell it where to look for them, `PATH` is the reason. + +Have a look inside `PATH` and you will see something like this: + +``` +$ echo $PATH +/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin +``` + +Each directory is separated by a colon (`:`) and if you want to run an application installed in any directory other than the ones listed in `PATH`, you will have to tell the shell where to find it: + +``` +/home//bin/my_program.sh +``` + +This will run a program calle _my_program.sh_ you have copied into a _bin/_ directory in your home directory. + +This is a common problem: you don't want to clutter up your system's _bin/_ directories, or you don't want other users running your own personal scripts, but you don't want to have to type out the complete path every time you need to run a script you use often. The solution is to create your own _bin/_ directory in your home directory: + +``` +mkdir $HOME/bin +``` + +And then tell `PATH` all about it: + +``` +PATH=$PATH:$HOME/bin +``` + +After that, your _/home//bin_ will show up in your `PATH` variable. But... Wait! We said that the changes you make in a given shell will not last and will lose effect when that shell is closed. + +To make changes permanent for your user, instead of running them directly in the shell, put them into a file that gets run every time a shell is started. That file already exists and lives in your home directory. It is called _.bashrc_ and the dot in front of the name makes it a hidden file -- a regular `ls` won't show it, but `ls -a` will. + +You can open it with a text editor like [kate][1], [gedit][2], [nano][3], or [vim][4] (NOT LibreOffice Writer -- that's a word processor. Different beast entirely). You will see that _.bashrc_ is full of shell commands the purpose of which are to set up the environment for your user. + +Scroll to the bottom and add the following on a new, empty line: + +``` +export PATH=$PATH:$HOME/bin +``` + +Save and close the file. You'll be seeing what `export` does presently. In the meantime, to make sure the changes take effect immediately, you need to `source` _.bashrc_ : + +``` +source .bashrc +``` + +What `source` does is execute _.bashrc_ for the current open shell, and all the ones that come after it. The alternative would be to log out and log back in again for the changes to take effect, and who has the time for that? + +From now on, your shell will find every program you dump in _/home//bin_ without you having to specify the whole path to the file. + +### DYI Variables + +You can, of course, make your own variables. All the ones we have seen have been written with ALL CAPS, but [you can call a variable more or less whatever you want][5]. + +Creating a new variables is straightforward: just set a value within it: + +``` +new_variable="Hello" +``` + +And you already know how to recover a value contained within a variable: + +``` +echo $new_variable +``` + +You often have a program that will require you set up a variable for things to work properly. The variable may set an option to "on", or help the program find a library it needs, and so on. When you run a program in Bash, the shell spawns a daughter process. This means it is not exactly the same shell that executes your program, but a related mini-shell that inherits some of the mother's characteristics. Unfortunately, variables, by default, are not one of them. This is because, by default again, variables are _local_. This means that, for security reasons, a variable set in one shell cannot be read in another, even if it is a daughter shell. + +To see what I mean, set a variable: + +``` +robots="R2D2 & C3PO" +``` + +... and run: + +``` +bash +``` + +You just ran a Bash shell program within a Bash shell program. + +Now see if you can read the contents of you variable with: + +``` +echo $robots +``` + +You should draw a blank. + +Still inside your bash-within-bash shell, set `robots` to something different: + +``` +robots="These aren't the ones you are looking for" +``` + +Check `robots`' value: + +``` +$ echo $robots +These aren't the ones you are looking for +``` + +Exit the bash-within-bash shell: + +``` +exit +``` + +And re-check the value of `robots`: + +``` +$ echo $robots +R2D2 & C3P0 +``` + +This is very useful to avoid all sorts of messed up configurations, but this presents a problem also: if a program requires you set up a variable, but the program can't access it because Bash will execute it in a daughter process, what can you do? That is exactly what `export` is for. + +Try doing the prior experiment, but, instead of just starting off by setting `robots="R2D2 & C3PO"`, export it at the same time: + +``` +export robots="R2D2 & C3PO" +``` + +You'll notice that, when you enter the bash-within-bash shell, `robots` still retains the same value it had at the outset. + +**Interesting fact:** While the daughter process will "inherit" the value of an exported variable, if the variable is changed within the daughter process, changes will not flow upwards to the mother process. In other words, changing the value of an exported variable in a daughter process does not change the value of the original variable in the mother process. + +You can see all exported variables by running + +``` +export -p +``` + +The variables you create should be at the end of the list. You will also notice some other interesting variables in the list: `USER`, for example, contains the current user's user name; `PWD` points to the current directory; and `OLDPWD` contains the path to the last directory you visited and since left. That's because, if you run: + +``` +cd - +``` + +You will go back to the last directory you visited and `cd` gets the information from `OLDPWD`. + +You can also see all the environment variables using the `env` command. + +To un-export a variable, use the `-n` option: + +``` +export -n robots +``` + +### Next Time + +You have now reached a level in which you are dangerous to yourself and others. It is time you learned how to protect yourself from yourself by making your environment safer and friendlier through the use of _aliases,_ and that is exactly what we'll be tackling in the next episode. See you then. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise + +作者:[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.kde.org/applications/utilities/kate/ +[2]: https://help.gnome.org/users/gedit/stable/ +[3]: https://www.nano-editor.org/ +[4]: https://www.vim.org/ +[5]: https://bash.cyberciti.biz/guide/Rules_for_Naming_variable_name From 6db45d39b42a786d6af0c65f95ff2254e4e5a64b Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 7 Dec 2018 12:59:35 +0800 Subject: [PATCH 0013/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Take=20a=20brea?= =?UTF-8?q?k=20at=20the=20Linux=20command=20line=20with=20Nyan=20Cat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...at the Linux command line with Nyan Cat.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md diff --git a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md new file mode 100644 index 0000000000..7f642b5496 --- /dev/null +++ b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Take a break at the Linux command line with Nyan Cat) +[#]: via: (https://opensource.com/article/18/12/linux-toy-nyancat) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) +[#]: url: ( ) + +Take a break at the Linux command line with Nyan Cat +====== +Rainbows, Pop-Tarts, and cats in space: What more could you want at your terminal? +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nyancat.png?itok=eg1aEmBw) + +We're now on day six of the Linux command-line toys advent calendar, where we explore some of the fun, entertaining, and in some cases, utterly useless toys available for your Linux terminal. All are available under an open source license. + +Will they all be unique? Yes. Will they all be unique to you? I don't know, but, chances are you'll find at least one new toy to play with by the time our advent calendar is done. + +Today's selection is a continuation on the [theme][1] we started yesterday: cats and rainbows. Wait, there's more cat-related rainbow fun to be had at the Linux command line? You bet there is. + +So let's make a throwback all the way to 2011's [Nyan Cat][2] with a command-line toy call, not surprisingly, **nyancat**. Did you miss the cultural phenomenon that was Nyan Cat? Watch the embed below, I'll wait. + + + +Now, let's recreate that amazing experience in your terminal. **Nyancat** is packaged for many distributions (Arch, Debian, Gentoo, Ubuntu, etc.) but not for mine (Fedora), but compiling from source was simple. In fact, I grabbed the source, built it, and launched it in one line: + +``` +git clone https://github.com/klange/nyancat.git && cd nyancat && make && cd src && ./nyancat +``` + +This launched straight into a **nyancat** experience complete with a counter of how long I had been enjoying the **nyancat** magic for. + +![](https://opensource.com/sites/default/files/uploads/linux-toy-nyancat-animated.gif) + +You can find the source for **nyancat** [on GitHub][3] under an [NCSA open source license][4]. + +The command-line version of Nyan Cat used to be [accessible by a public Telnet server][5] (or, for even more pun, with [netcat][6]) so that you didn't even have to install it, but sadly was shut down due to bandwidth limitations. Nevertheless, the [gallery][5] from the old Telnet server running Nyan Cat on a variety of old devices is well-worth checking out, and maybe you'd like to do the community a favor by launching your own public mirror and letting the author know so that they may share it with the public yet again? + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Bring some color to your Linux terminal with lolcat][1], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-nyancat + +作者:[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-lolcat +[2]: https://en.wikipedia.org/wiki/Nyan_Cat +[3]: https://github.com/klange/nyancat +[4]: http://en.wikipedia.org/wiki/University_of_Illinois/NCSA_Open_Source_License +[5]: http://nyancat.dakko.us/ +[6]: http://netcat.sourceforge.net/ From 98f5dcc5c6a8b55a570496f271869f8d4c3b8104 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 10 Dec 2018 09:43:03 +0800 Subject: [PATCH 0014/4278] translating --- ...1102 Create a containerized machine learning model.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sources/tech/20181102 Create a containerized machine learning model.md b/sources/tech/20181102 Create a containerized machine learning model.md index 3914bd4bee..d0a57d0b72 100644 --- a/sources/tech/20181102 Create a containerized machine learning model.md +++ b/sources/tech/20181102 Create a containerized machine learning model.md @@ -1,3 +1,12 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Create a containerized machine learning model) +[#]: via: (https://fedoramagazine.org/create-containerized-machine-learning-model/) +[#]: author: (Sven Bösiger) +[#]: url: ( ) + Create a containerized machine learning model ====== From ece861b0cb14814483bbb4be41793b281bb533e7 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 10 Dec 2018 10:06:43 +0800 Subject: [PATCH 0015/4278] Translating 7 command-line tools for writers. --- ...9 7 command-line tools for writers - Opensource.com.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md index 04d6af4dfd..8feec80f41 100644 --- a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md +++ b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md @@ -19,17 +19,17 @@ 每个写作者在完成他们的工作前至少要(或者说应该要)进行一次拼写检查。为什么呢?在写作的世界里有个永恒的定律,无论你检查了多少次手稿,拼写错误和错字依然会存在。 -我曾经详细[介绍][9]过我最喜欢的命令行拼写检查工具 [GNU Aspell][8]。交互式检测文本文档的 Aspell 不仅能够高亮显示拼写错误还能在拼写错误的上方提供正确的拼写建议。Aspell 在进行拼写检查同样能够忽略许多标记语言文本。 +我曾经详细[介绍][9]过我最喜欢的命令行拼写检查工具 [GNU Aspell][8]。交互式检测文本文档的 Aspell 不仅能够高亮显示拼写错误还能在拼写错误的上方提供正确的拼写建议。Aspell 在进行拼写检查时同样能够忽略许多语法标记。 另一个够老但仍然有用的代替品是 [Ispell][10]。虽然它比 Aspell 稍慢一点,但它们都以相同的方式工作。当你在你的文本文件上工作时,Ispell 将提供正确的建议。Ispell 同样也对英语以外的语言提供了良好的支持。 ### Prose linters -软件开发人员使用[linters][11]来检查他们的代码是否存在错误或者 bugs。同样也有用于检查文本样式或语法错误的linters;而命令行会认为这些错误是_样式元素_。任何写作者都可以(也应该)使用它,一个文本 linter 对于要求文档风格和样式一致的文档团队项目而言尤其有用。 +软件开发人员使用[linters][11]来检查他们的代码是否存在错误或者 bugs。同样也有用于检查文本样式或语法错误的linters;而命令行会认为这些错误是_样式元素_。任何写作者都可以(也应该)使用它,一个 prose linter 对于要求文档风格和样式一致的文档团队项目而言尤其有用。 -[Proselint][12] is a comprehensive tool for checking what you're writing. It looks for jargon, hyperbole, incorrect date and time format, misused terms, and [much more][13]. It's also easy to run and ignores markup in a plaintext file. +[Proselint][12]是一款全能的实时检查工具。它会找出行话,大话,不正确日期和时间格式,滥用的术语[等等][13]。它也很容易运行并忽略文本中的标记。 -[Alex][14] is a simple yet powerful prose linter. Run it against a plaintext document or one formatted with Markdown or HTML. Alex pumps out warnings of "gender favouring, polarising, race related, religion inconsiderate, or other unequal phrasing in text." If you want to give Alex a test drive, there's an [online demo][15]. +[Alex][14] 是一个简单但有用的 prose linter。 对明文文本或者格式为Markdown或HTML的文档使用它。 Alex 会对 “性别偏好,极端主义,种族相关,宗教,或者文章中其他不平等的措辞” 产生警告。 如果你想要试试看 Alex,这里有一个在线[demo][15]. ### 其他工具 From c7dddb2d3b92656b0403158e76da4db7a5945460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Mon, 10 Dec 2018 11:00:04 +0800 Subject: [PATCH 0016/4278] Update 20180419 Migrating to Linux- Network and System Settings.md --- .../20180419 Migrating to Linux- Network and System Settings.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180419 Migrating to Linux- Network and System Settings.md b/sources/tech/20180419 Migrating to Linux- Network and System Settings.md index f3930f1777..50141aedca 100644 --- a/sources/tech/20180419 Migrating to Linux- Network and System Settings.md +++ b/sources/tech/20180419 Migrating to Linux- Network and System Settings.md @@ -1,3 +1,5 @@ +ScarboroughCoral translating! + Migrating to Linux: Network and System Settings ====== From aa2ef6cc5606694e108c499ecf309229739b74c3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 10 Dec 2018 18:56:27 +0800 Subject: [PATCH 0017/4278] PRF:20180328 What NASA Has Been Doing About Open Science.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Valoniakim 翻译完之后,还需要自己审读一遍。 --- ... NASA Has Been Doing About Open Science.md | 64 +++++++++++-------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/translated/talk/20180328 What NASA Has Been Doing About Open Science.md b/translated/talk/20180328 What NASA Has Been Doing About Open Science.md index 6bc8f4204d..56628fed21 100644 --- a/translated/talk/20180328 What NASA Has Been Doing About Open Science.md +++ b/translated/talk/20180328 What NASA Has Been Doing About Open Science.md @@ -1,70 +1,78 @@ -当 NASA 开始应用开放科学 +NASA 在开放科学方面做了些什么 ====== + ![][1] -最近我们刚为 NASA 在它的自由开源软件上新开放了[科学][2]板块。其中发表的最新一篇文章名为:[开源手段是怎样影响科学的][3]。在这篇文章中我们主要讨论的是 [NASA][4] 在鼓励使用开源工具之后,是怎样在大量的科研机构潮流中保持自身的动态角色,实现快速发展的。 +最近我们刚为开设了一个新的“[科学类][2]”的文章分类。其中发表的最新一篇文章名为:[开源是怎样影响科学的][3]。在这篇文章中我们主要讨论了 [NASA][4] 的积极努力,这些努力包括他们通过开源实践来促进科学研究的积极作用。 ### NASA 是怎样使用开源手段促进科学研究的 -NASA 将他们的整个研究库对整个公共域开放,这是一项[壮举][5]。 +NASA 将他们的整个研究库对整个公共领域开放,这是一项[壮举][5]。 -没错!每个人都能访问他们的研究库,并能从他们的研究中获益。 +没错!每个人都能访问他们的整个研究库,并能从他们的研究中获益。 -他们现已开放的资料可以大致分为一下三类: +他们现已开放的资料可以大致分为以下三类: - * 开放的 NASA 资源 - * 开放的应用程序编程接口 - * 开放的资料 + * 开源 NASA + * 开放 API + * 开放数据 +### 1、开源 NASA +这里有一份 [GitHub][7] 的联合创始人之一和执行总裁 [Chris Wanstrath][6] 的采访,他向我们介绍道,一切都是从很多年前开始的。 -#### 1\.开放的 NASA 资源 +- [Chris Wanstrath on NASA, open source and Github](https://youtu.be/dUFzMe8GM3M) -采访 [GitHub][7] 的联合创始人之一和执行总裁 [Chris Wanstrath][6] 时,他向我们介绍道,一切都是从很多年前开始的。 +该项目名为 “[code.nasa.gov][8]”,截至本文发表为止,NASA 已经[通过 GitHub 开源][9]了 365 个科学软件(LCTT 译注:本文原文发表于 2018/3/28,截止至本译文发布,已经有 454 个项目了)。对于一位热爱程序的开发者来说,即使一天研究一个软件,想把 NASA 的这些软件全部研究过来也要整整一年的时间。 -NASA 的账号叫做 “[code.nasa.gov][8]“, 截至现在为止,NASA 已经[通过 GitHub 开放][9]了365个科学软件,对于一位热爱程序的开发者来说,即使一天研究一个软件,想把NASA的这些软件全部研究过来也要整整一年的时间。 +即使你不是一位开发者,你也可以在这个门户网站浏览这个壮观的软件合集。 -即使你不是一位开发者,你也可以在入口网站浏览这些壮观软件合集的统计列表。 +其中就有[阿波罗 11 号][10]的制导计算机的源代码。阿波罗 11 号空间飞行器[首次将两名人类带上月球][11],分别是 [Neil Armstrong][12] 和 [Edwin Aldrin][13] 。如果你对 Edwin Aldrin 感兴趣,可以点击[这里][14]了解更多。 -其中就有[阿波罗11号][10]的制导计算机的源代码。阿波罗11号空间飞行器[首次将两名人类带上月球][11],分别是 [Neil Armstrong][12] 和 [Edwin Aldrin][13] 。如果你对 Edwin Aldrin 感兴趣,可以点击[这里][14]了解更多。 +#### NASA 开源代码促进会使用的开源代码许可 -##### NASA 开源代码促进会使用的开源代码许可: +它们采用了几种[开源许可证][15],其分类如下: -这里有几种[开源代码许可][15],其分类如下: +- [Apache 许可证 2.0](https://www.apache.org/licenses/LICENSE-2.0) +- [Nasa 开源许可证 3.0](https://opensource.org/licenses/NASA-1.3) +- [GPL v3](https://www.gnu.org/licenses/gpl.html) +- [MIT 许可证](https://en.wikipedia.org/wiki/MIT_License) -#### 2\.开放的应用程序编程接口(API) +### 2、开放 API -开放的[应用程序设计接口][16]或者应用程序编程接口在推行开源技术中起到了很大作用。与[开源代码促进会][17]类似,开放的应用程序编程接口有它们的[开放平台促进会][18]。下面这张示意图可以告诉你 API 是怎样将应用程序和它的开发者连接起来的。 +开放 [API][16] 在推行开放科学中起到了很大作用。与[开源促进会][17]类似,对于 API,也有一个 [开放 API 促进会][18]。下面这张示意图可以告诉你 API 是怎样将应用程序和它的开发者连接起来的。 ![][19] -记得点击图片上面的链接看看。链接内的文章使用了简单易懂的方法解读 API ,文末将 API 总结为五种架构。 +记得点击这个[链接](https://sproutsocial.com/insights/what-is-an-api/)看看。链接内的文章使用了简单易懂的方法解读了 API ,文末总结了五大要点。 ![][20] -这让人忍不住想象由专有 API 变成开放 API 会有多么大的不同。 +这会让你感受到专有 API 和开放 API 会有多么大的不同。 ![][22] -[NASA 的开放 API][23] 主要针对应用程序开发者,大大提高了包括图片内容在内的数据可及性,这是前所未有的。网站设有活动编辑器,为需要查阅[每日天文一图][24]板块 [API][16] 的用户们授权。 +[NASA 的 Open API][23] 主要针对应用程序开发者,旨在显著改善数据的可访问性,也包括图片内容在内。该网站有一个实时编辑器,可供你调用[每日天文一图(APOD)][24] 的 API。 -#### 3\.开放的资料 +#### 3、开放数据 ![][25] -在[我们发布的第一篇科学文章][3]中,我们介绍了“开放科学”板块下提到的三个国家——法国,印度和美国的多种开放资料形式。NASA 有着类似的想法和行为。这种意识形态已经被[多个国家][26]所接受。 +在[我们发布的第一篇开放科学的文章][3]中,我们在“开放科学”段落下提到的三个国家 —— 法国、印度和美国的多种开放数据形式。NASA 有着类似的想法和行为。这种重要的意识形态已经被[多个国家][26]所接受。 -[NASA 的开放数据门户][27]致力于不断扩大的可供大众使用的开放数据目录。这个数据集的内容对于任何研究活动来说都是必要且重要的。NASA 还在他们的门户网站上征集各方的数据,以一同收录在他们的数据库中。这一行为不仅是领先的,创新的,还顺应了[数据科学][28]和 [AI 深度学习][29]的趋势。 +[NASA 的开放数据门户][27]致力于开放,拥有不断增长的可供大众自由使用的开放数据。将数据集纳入到这个数据集对于任何研究活动来说都是必要且重要的。NASA 还在他们的门户网站上征集各方的数据需求,以一同收录在他们的数据库中。这一举措不仅是领先的、创新的,还顺应了[数据科学][28]、[AI 和深度学习][29]的趋势。 -下面的视频讲的是学者和学生们是怎样通过大量研究得出对数据科学的定义的。这个过程十分的激动人心。瑞尔森大学罗杰斯商学院的 [Murtaza Haider 教授][30]在视频中提到了开源的出现对数据科学的改变,尤其让是旧有的封闭发展模式逐渐变得开放。而这也确实成为了现实。 +下面的视频讲的是学者和学生们是怎样通过大量研究得出对数据科学的定义的。这个过程十分的激动人心。瑞尔森大学罗杰斯商学院的 [Murtaza Haider 教授][30]在视频结尾中提到了开源的出现对数据科学的改变,尤其让是旧有的闭源方式逐渐变得开放。而这也确实成为了现实。 + +- [What is Data Science? Data Science 101](https://youtu.be/z1kPKBdYks4) ![][31] -现在任何人都能在 NASA 上提交数据。正如视频中所说, NASA 的领先方案很大程度上与征集和分析优化数据有关。 +现在任何人都能在 NASA 上征集数据。正如前面的视频中所说,NASA 的举措很大程度上与征集和分析优化数据有关。 ![][32] -你只需要进行免费注册。考虑到论坛上的公开讨论走向和在任何统计分析环境下都能运行的数据集,这个方案在未来会有非常积极的影响,对数据的统计分析当然也会大幅进展。在之后的文章中我们还会具体讨论这些细节,还有他们和开源模式之间的相关性。 +你只需要免费注册即可。考虑到论坛上的公开讨论以及数据集在可能存在的每一类分析领域中的重要性,这一举措在未来会有非常积极的影响,对数据的统计分析当然也会大幅进展。在之后的文章中我们还会具体讨论这些细节,还有它们和开源模式之间的相关性。 以上就是对 NASA 开放科学模式的一些探索成就,希望您能继续关注我们接下来的相关文章! @@ -73,9 +81,9 @@ NASA 的账号叫做 “[code.nasa.gov][8]“, 截至现在为止,NASA 已经[ via: https://itsfoss.com/nasa-open-science/ 作者:[Avimanyu Bandyopadhyay][a] -译者:[Valoniakim](https://github.com/Valoniakim) -校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) +译者:[Valoniakim](https://github.com/Valoniakim) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 70f9f312b99187103c67f017d45c89c46518187f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 10 Dec 2018 18:56:57 +0800 Subject: [PATCH 0018/4278] PUB:20180328 What NASA Has Been Doing About Open Science.md @Valoniakim https://linux.cn/article-10330-1.html --- .../20180328 What NASA Has Been Doing About Open Science.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180328 What NASA Has Been Doing About Open Science.md (100%) diff --git a/translated/talk/20180328 What NASA Has Been Doing About Open Science.md b/published/20180328 What NASA Has Been Doing About Open Science.md similarity index 100% rename from translated/talk/20180328 What NASA Has Been Doing About Open Science.md rename to published/20180328 What NASA Has Been Doing About Open Science.md From 710fc6ef7d353e9e8c8f06ef98a828bed08e1012 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 19:21:22 +0800 Subject: [PATCH 0019/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Powers=20of=20t?= =?UTF-8?q?wo,=20powers=20of=20Linux:=202048=20at=20the=20command=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...wers of Linux- 2048 at the command line.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md diff --git a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md new file mode 100644 index 0000000000..da1b241713 --- /dev/null +++ b/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Powers of two, powers of Linux: 2048 at the command line) +[#]: via: (https://opensource.com/article/18/12/linux-toy-2048) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Powers of two, powers of Linux: 2048 at the command line +====== +Looking for a terminal-based game to pass the time? Look no further than 2048-cli. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-2048.png?itok=3M6S-n1a) + +Hello and welcome to today's installment of the Linux command-line toys advent calendar. Every day, we look at a different toy for your terminal: it could be a game or any simple diversion that helps you have fun. + +Maybe you have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. + +Today's toy is a [command-line version][1] of one of my all-time favorite casual games, [2048][2] (which itself is a clone of another clone). + +To play, you just slide blocks up, down, left, and right to combine matching pairs and increment numbers, until you've made a block that is 2048 in size. The catch (and the challenge), is that you can't just move one block; instead, you move every block on the screen. + +It's simple, fun, and easy to get lost in it for hours. This 2048 clone, [2048-][1][cli][1], is by Marc Tiehuis and written in C, and made available as open source under an MIT license. You can find the source code [on GitHub][1], where you can also get installation instructions for your platform. Since it was packaged for Fedora, for me, installing it was as simple as: + +``` +$ sudo dnf install 2048-cli +``` + +That's it, have fun! + +![](https://opensource.com/sites/default/files/uploads/linux-toy-2048-animated_0.gif) + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Play Tetris at your Linux terminal][3], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-2048 + +作者:[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://github.com/tiehuis/2048-cli +[2]: https://github.com/gabrielecirulli/2048 +[3]: https://opensource.com/article/18/12/linux-toy-tetris From 7c5b28cc409917fd8a7580a8d1fc3434d127ff7f Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 19:25:02 +0800 Subject: [PATCH 0020/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Upda?= =?UTF-8?q?te=20Ubuntu=20[Terminal=20&=20GUI=20Methods]=20It's=20FOSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md diff --git a/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md new file mode 100644 index 0000000000..50ba70c073 --- /dev/null +++ b/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) +[#]: via: (https://itsfoss.com/update-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Update Ubuntu [Terminal & GUI Methods] It's FOSS +====== + +**This tutorial shows you how to update Ubuntu for both server and desktop versions. It also explains the difference between update and upgrade along with a few other things you should know about updates in Ubuntu Linux.** + +If you are a new user and have been using Ubuntu for a few days or weeks, you might be wondering how to update your [Ubuntu][1] system for security patches, bug fixes and application upgrades. + +Updating Ubuntu is absolutely simple. I am not exaggerating. It’s as simple as running two commands. Let me give you more details on it. + +Please note that the tutorial is valid for Ubuntu 18.04, 16.04 or any other version. The command line way is also valid for Ubuntu-based distributions like Linux Mint, Linux Lite, elementary OS etc. + +### Update Ubuntu via Command Line + +![How to Update Ubuntu][2] + +On the desktop, open the terminal. You can find it in the menu or use the Ctrl+Alt+T [keyboard shortcut][3]. If you are logged on to an [Ubuntu server][4], you already have access to a terminal. + +In the terminal, you just have to use the following command: + +``` +sudo apt update && sudo apt upgrade -y +``` + +It will ask for password and you can use your account’s password. You won’t see the anything on the screen while typing so keep on typing your password and hit enter. + +Now let me explain the above command. + +Actually, it’s not a single command. It’s a combination of two commands. The && is a way to combine two commands in a way that the second command runs only when the previous command ran successfully. + +The ‘-y’ in the end automatically enters yes when the command ‘apt upgrade’ ask for your confirmation before installing the updates. + +Note that you can also use the two commands separately, one by one: + +``` +sudo apt update +sudo apt upgrade +``` + +It will take a little longer because you have to wait for one command to finish and then enter the second command. + +#### Explanation: sudo apt update + +This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. + +This is why when you run the sudo apt update, you’ll see lots of URLs in the output. The command fetches the package information from the respective repositories (the URLs you see in the output). + +![Updating Ubuntu Linux][5] + +At the end of the command, it tells you how many packages can be upgraded. You can see these packages by running the following command: + +``` +apt list --upgradable +``` + +**Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. + +#### Explanation: sudo apt upgrade + +This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). + +![Update Ubuntu Linux via Command Line][7] + +You can type ‘yes’, ‘y’ or just press enter to confirm the installation of updates. + +So the bottom line is that the sudo apt update checks for the availability of new versions while as the sudo apt upgrade actually performs the update. + +The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. + +### Update Ubuntu via GUI [For Desktop Users] + +If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. + +In the menu, look for ‘Software Updater’ and run it. + +![Run Software Updater in Ubuntu][8] + +It will check if there are updates available for your system. + +![Checking if updates are available for Ubuntu][9] + +If there are updates available, it will give provide you with options to install the updates. + +![Install Updates via Update Manager in Ubuntu][10] + +Click on Install Now, it may ask for your password. + +![Installing Updates in Ubuntu Linux via GUI][11] + +Once you enter your password, it will start installing the updates. + +![Updating Ubuntu via GUI][12] + +In some cases, you may need to reboot the system for the installed updates to work properly. You’ll be notified at the end of the update if you need to restart the system. + +![Updating Ubuntu via GUI][12] + +You can choose to restart later if you don’t want to reboot your system straightaway. + +![Installing updates via GUI in Ubuntu][13] + +Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. + +### Few things to keep in mind abou updating Ubuntu + +You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. + +#### Clean up after an update + +Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: + +``` +sudo apt autoremove +``` + +#### Live patching kernel in Ubuntu Server to avoid rebooting + +In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. + +[Live patching][15] feature allows the patching of Linux kernel while the kernel is still running. In other words, you don’t have to reboot your system. + +If you manage servers, you may want to [enable live patching in Ubuntu][16]. + +#### Version upgrades are different + +The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). + +[Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. + +### Conclusion + +I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. + +If you have any questions, please fee free to ask. If you are an experienced Linux users and have some tip that can make this tutorial more useful, please share it with the rest of us. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/update-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://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/how-to-update-ubuntu.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/ubuntu-shortcuts/ +[4]: https://www.ubuntu.com/download/server +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-1.jpeg?resize=800%2C357&ssl=1 +[6]: https://itsfoss.com/apt-get-linux-guide/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-2.jpeg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-1.jpeg?resize=800%2C250&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-2.jpeg?resize=800%2C250&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-GUI-3.jpeg?resize=800%2C365&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/install-update-ubuntu-1.jpg?resize=800%2C450&ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu-2.jpeg?ssl=1 +[14]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[15]: https://www.ubuntu.com/livepatch +[16]: https://www.cyberciti.biz/faq/howto-live-patch-ubuntu-linux-server-kernel-without-rebooting/ +[17]: https://itsfoss.com/upgrade-ubuntu-version/ +[18]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ From 8277fd6d2cc840d76a7e455b42e1892e515a6de8 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 19:31:28 +0800 Subject: [PATCH 0021/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Play=20Tetris?= =?UTF-8?q?=20at=20your=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1208 Play Tetris at your Linux terminal.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/tech/20181208 Play Tetris at your Linux terminal.md diff --git a/sources/tech/20181208 Play Tetris at your Linux terminal.md b/sources/tech/20181208 Play Tetris at your Linux terminal.md new file mode 100644 index 0000000000..d3a94bcaf6 --- /dev/null +++ b/sources/tech/20181208 Play Tetris at your Linux terminal.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Play Tetris at your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-tetris) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Play Tetris at your Linux terminal +====== + +Recreate the magic of the 1980s with everyone's favorite tile-matching game, Tetris. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-tetris.png?itok=_UXtpgzN) + +Thanks for joining us for today's installment of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game or any simple diversion that helps you have fun at the terminal. + +It's quite possible that some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. + +I promised when I started this series I'd be including games, but so far I've neglected to, so let's fix that with today's selection: Tetris. + +Tetris and I are almost exactly the same age, having first come into the world in the summer of 1984. Instead of rural North Carolina, though, Tetris originated in Moscow in what was at the time the Soviet Union. + +After taking the world by storm, Tetris was cloned many, many times. I would suspect you could find a Tetris clone for just about any operating system in any language you looked for. Seriously, go look. There are some fun ones out there. + +The [version][1] I'm bringing you for today's command-line toy is [written in Haskell,][1] and it's one of the better-done versions I've seen, with on-screen preview, score, help, and a clean look. + +If you're willing to run a compiled binary from an untrusted source (I wouldn't recommend it), you can grab that directly, but for a safer approach, it's also easy to use a containerized version with [dex][2], or to install from source with [stack][3]. + +This particular Tetris clone is by Sam Tay and available under a BSD license. [Check it out][1]! + +![](https://opensource.com/sites/default/files/uploads/linux-toy-tetris-animated.gif) + +If you've got your own favorite Tetris clone (or maybe you've written your own?), let us know! + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Plan your own holiday calendar at the Linux command line][4], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-tetris + +作者:[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://github.com/samtay/tetris +[2]: https://github.com/dockerland/dex +[3]: https://docs.haskellstack.org/en/stable/README/#how-to-install +[4]: https://opensource.com/article/18/12/linux-toy-cal From e40e6ed915277a24f3aec68daf5c762087d0b846 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 19:40:16 +0800 Subject: [PATCH 0022/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=206=20steps=20to?= =?UTF-8?q?=20optimize=20software=20delivery=20with=20value=20stream=20map?= =?UTF-8?q?ping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ware delivery with value stream mapping.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sources/talk/20181206 6 steps to optimize software delivery with value stream mapping.md diff --git a/sources/talk/20181206 6 steps to optimize software delivery with value stream mapping.md b/sources/talk/20181206 6 steps to optimize software delivery with value stream mapping.md new file mode 100644 index 0000000000..29dc0ce63c --- /dev/null +++ b/sources/talk/20181206 6 steps to optimize software delivery with value stream mapping.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 steps to optimize software delivery with value stream mapping) +[#]: via: (https://opensource.com/article/18/12/optimizing-delivery-value-stream-mapping) +[#]: author: (Dominika Bula https://opensource.com/users/dominika) + +6 steps to optimize software delivery with value stream mapping +====== +Learn how VSM can help you streamline processes, boost efficiency, and better meet customer expectations. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk) + +Do your efforts to improve software development fall short due to confusion and too much debate? Does your organization have a clear picture of what is achievable, and are you sure you’re moving in the right direction? Can you determine how much business value you've delivered so far? Are the bottlenecks in your process known? Do you know how to optimize your current process? + +If you are looking for a tool that will help you answer these questions, consider integrating [value stream mapping][1] and [lean concepts][2] into the way you deliver software. + +### What is value stream mapping (VSM)? + +Popularized in the ‘90s by James Womack and Daniel Jones, value stream mapping is a lean enterprise technique that is currently used by many organizations. In short, the value stream is the sequence of activities that are performed by the organization to deliver customer requests. Value stream mapping helps determine what is valuable and what doesn’t bring value by identifying activities that matter to your customer. The ultimate benefit of using VSM is a better understanding of how to improve your current development process to generate more value and impact. + +### 6 steps to optimizing software delivery + + 1. **Select the process** + +Any process can be modeled as a sequence of activities. For example, a [system development life cycle][3] is a value stream consisting of product specification, design, development, deployment, operation and maintenance, and finally, disposition. In this example, product design can be viewed as a value stream segment. + + 2. **Identify the parties involved in the project** + +Select a project sponsor and team. Keep in mind that each area of the process should be represented. Holistic thinking helps identify and set expectations, which in turn reduces resistance to change. + + 3. **Create the current state map** + +Creating the current state map helps establish a better understanding of how work is currently done. Documenting your current process is key to success at this stage. The goal is to identify the specific items that flow through your value stream. + + 4. **Challenge the current thinking** + +Make sure that what you are doing adds value—if there are actions in your process that do not add value, stop doing them. Look at the [software development waste types][2] for ideas. Mary Poppendieck and Tom Poppendieck identify these and transfer them from manufacturing to software engineering in their book, [Lean Software Development: An Agile Toolkit][4]. The waste types are: + + * Partially done work + * Extra processes + * Extra features + * Task switching + * Waiting + * Motion + * Defects + * Management activities + + + 5. **Generate the future state map and execute improvements** + +Think of what can be done to reduce or ideally eliminate the identified wastes. + +While working on the future state map, follow the principle that humans should do only what they can do best, and the rest should be [automated][5]. The future state design should aim to eliminate hands-on work and deliver completed software projects in less time with higher quality. + +Talk about the changes, let people ask questions—this will help reduce resistance to change. As you start executing improvements, remember that value stream mapping is an evolutionary process, and you might need to adjust the original plan. The value stream should be continuously improved; it will not be perfect the first time. + + 6. ****Measure benefits**** + +Karen Martin and Mike Osterling identify key performance metrics for software delivery in their book, [Value Stream Mapping][6]: + + * Total lead time: the total time it takes to deliver on a customer request + + * Total process time: the total work effort required by all functions on the timeline critical path of the value stream + + * Activity ratio: the degree of flow in the value stream + + * Compounded effect: the quality of output across the value stream + + +Well-executed value stream mapping not only improves the way work gets delivered, but it also provides a transformational opportunity for your organization and a tool to facilitate a shift in mindsets and behaviors. + +### What to read next + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/optimizing-delivery-value-stream-mapping + +作者:[Dominika Bula][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dominika +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Value_stream_mapping +[2]: https://en.wikipedia.org/wiki/Lean_software_development +[3]: https://en.wikipedia.org/wiki/Systems_development_life_cycle +[4]: https://www.oreilly.com/library/view/lean-software-development/0321150783/ +[5]: https://xkcd.com/1205/ +[6]: https://mhebooklibrary.com/doi/book/10.1036/9780071828949 From 609f3bcf23d97598d714f113eb6723047041f2dd Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 19:48:46 +0800 Subject: [PATCH 0023/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Introduction=20?= =?UTF-8?q?to=20Clojure=20=E2=80=93=20Modern=20dialect=20of=20Lisp=20(Part?= =?UTF-8?q?=201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ojure - Modern dialect of Lisp (Part 1).md | 1784 +++++++++++++++++ 1 file changed, 1784 insertions(+) create mode 100644 sources/tech/20131228 Introduction to Clojure - Modern dialect of Lisp (Part 1).md diff --git a/sources/tech/20131228 Introduction to Clojure - Modern dialect of Lisp (Part 1).md b/sources/tech/20131228 Introduction to Clojure - Modern dialect of Lisp (Part 1).md new file mode 100644 index 0000000000..5e5f4df763 --- /dev/null +++ b/sources/tech/20131228 Introduction to Clojure - Modern dialect of Lisp (Part 1).md @@ -0,0 +1,1784 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to Clojure – Modern dialect of Lisp (Part 1)) +[#]: via: (https://www.creativeapplications.net/tutorials/introduction-to-clojure-part-1/) +[#]: author: (Karsten Schmidt and Ricardo Sanchez https://www.creativeapplications.net/author/karstenricardo/) + +Introduction to Clojure – Modern dialect of Lisp (Part 1) +====== + +![](https://www.creativeapplications.net/wp-content/uploads/2013/12/learnclojure10.jpg) + +### Foreword by [Ricardo Sanchez][1] + +Back in March I had the pleasure to attend Karsten’s workshop at the 2013 [Resonate][2] conference in Belgrade, in it we learned how to work with audio and music while coding live using the Clojure programming language. It was great! I got so addicted to this new way of programming that it made me work on a little tutorial so I can share my experience with newcomers. After I finished my first draft I asked Karsten to do a technical review of it and he very kindly accepted. A couple of weeks months later we managed to expand & transform it into a comprehensive introductory article to Clojure and functional programming with a few very cool examples I hope you’ll enjoy. Without Karsten’s input this tutorial would never have been what it is today – so for that a big THANKS is due to him and the Resonate team for putting together such an awesome event. + +### Foreword by [Karsten Schmidt][3] + +Getting (back) into the [magical world of Lisp][4] had been on my to-do list for a long while, though my first encounter with Clojure in 2011 was through sheer coincidence (if you believe in such things!). It took me only a few hours to realise how this encounter was impeccable timing since there was this nagging feeling that I had become too accustomed to the status quo of the languages I’d been using for the last decade. Most importantly, I instinctively knew, I wanted to learn & use this language for my own work, badly & ASAP. And indeed, I’ve been fortunate enough to be able to use Clojure on several large projects since, from cloud based server apps/renderfarms to OpenGL/CL desktop apps and a [festival identity][5]. What I wasn’t quite prepared for were the many doors (of perception and inquiry) Clojure has opened wide in terms of process, thinking & learning about code from outside the boxes of our so beloved, popular languages & frameworks. Now, having been using it almost daily for 2.5 years, this tutorial, this labour of love, is largely meant to share some findings of this journey so far (though admittedly this first part is more of a crash course) – all in the hope to inspire some like-minded souls from this community, keen to help realising the untapped potential this language & its philosophy bring to the creative drafting table… + +Since this tutorial has grown well beyond the scope of a single article and there’s no [TL;DR][6] version, we will be releasing it in stages over the coming weeks… + +### Introduction + +This tutorial aims at giving you a taste of functional programming with [Clojure][7], a modern dialect of [Lisp][8] designed to run as an hosted language on the Java Virtual Machine (and an increasing number of other host platforms). Based on the [lambda calculus][9] theory developed by [Alonzo Church][10] in 1930s, the family of functional languages has a long history and forms one of the major branches in the big tree of available programming languages today. Largely through developments in hardware and the increasing numbers of cores in CPU chip designs, as well as through the appearance of languages like [Erlang][11], [F#][12], [Haskell][13], [Scala][14] & Clojure, the [functional philosophy][15] has been re-gaining traction in recent years, since it offers a solid and plausible approach to writing safe & scalable code on these modern hardware architectures. Core functional ideas are also slowly infiltrating long established bastions of the [Kingdom of Nouns][16], i.e. through the inclusion of lambda expressions in both the latest versions of [Java 8][17] and [C++11][18]. However, Clojure goes much further and its combined features (e.g. [immutability][19], [laziness][20], [sequence abstractions][21], extensible [protocols][22], [multimethods][23], [macros][24], [async constructs][25], choice of [concurrency primitives][26]) make it an interesting choice for approaching data intensive or distributed applications with a fresh mindset around lightweight modelling. + +### Sections: +1\. Getting to know Clojure +2\. Setting up an environment +3\. Hello world, Hello REPL! +4\. Clojure syntax summarized +5\. Symbols +6\. Vars & namespaces +7\. Functions +8\. Metadata +9\. Truthiness, conditionals & predicates +10\. Data structures +11\. Common data manipulation functions +12\. Sequences +13\. Looping, iteration & recursive processing +14\. Common sequence processing functions +15\. Destructuring +16\. Further reading & references + +### Getting to know Clojure + +Clojure is a young (first release in 2007) and opinionated language whose philosophy challenges/contrasts (just as much as [Rich Hickey][27], Clojure’s author, does) some commonly accepted assumptions about programming and software design. It therefore requires some serious unlearning and rethinking for anyone who’s ever only programmed in Processing, Java, C++ etc. (JavaScript programmers will find some of the ideas more familiar though, since that language too was heavily influenced by older Lisp implementations). So even if after working through this tutorial series you decide Clojure isn’t for you, the new perspectives should provide you with some food for thought and useful knowledge to continue on your journey. + +[As a reward for taking on this learning curve][28], you’ll gain access to ideas and tools, which (not just in our opinion) should excite anyone interested in a more “creative” computing process: a truly interactive programming environment without a write/compile/run cycle and live coding & manipulation even of long running complex systems, a language, which by design, removes an entire class of possible bugs, a super active, helpful community of thousands of users/seekers – and at the very least it will give you some alternative insights to common programming problems, regardless your chosen language. With the JVM as its current main host platform and Clojure’s seamless Java interop features, you’ll have full access to that language’s humungous ecosystem of open source libraries, often in [an easier way than Java itself][29]. Clojure’s sister project [ClojureScript][30] is equally making headway in the JavaScript world and there’re a number of efforts underway to port Clojure to other platforms (incl. [Android][31] and [native compilation via LLVM][32]). + +Clojure’s (and Lisp’s) syntax is a bit like [Marmite][33]: There’re probably as many people who love it as there’re who hate it, though in this case the objections are usually just caused by unfamiliarity. The seemingly large amount of parantheses present is one of the most immediately obvious and eye-grabbing aspects to any novice looking at Clojure/Lisp code. However, being a programming language, this a) is obviously by design, b) not strictly true, and c) is the result of [stripping out most other syntax][34] and special characters known from other languages: I.e. there’re no semicolons, no operator overloading, no curly brackets for defining scope etc. – even commas are optional and considered whitespace! All this leads to some concise, yet readable code and is further enhanced by the number of powerful algorithmic constructs the language offers. + +Whereas in a C-like language a simple function/method definition looks like this: + +``` +// C +void greetings(char *fname, char *lname) { + printf("hello %s %s\n", fname, lname); +} + +// C++ +void greetings(const char *fname, const char *lname) { + std::cout << "hello " << fname << " " << lname << std::endl; +} + +// Java +public void greetings(String fname, String lname) { + System.out.println("hello " + name); +} +``` + +...in Clojure it is: + +``` +(defn greetings [fname lname] + (println "hello" fname lname)) +``` + +Calling this function then: + +``` +// C-style +greetings("Doctor", "Evil"); + +; Clojure +(greetings "Doctor" "Evil") +``` + +Clojure's philosophy to syntax is pure minimalism and boils down to the understanding that every piece of source code, as in any programming language, is merely a definition of an executable tree structure. Writing Clojure is literally defining the nested branches of that tree (identified by brackets, also called [S-expressions][35] or sexp, short for symbolic expressions). Even after a short while, you'll find these brackets seem to become automatic and mentally disappear (especially when using an appropriate text editor w/ support for [bracket matching][36], [rainbow brackets][37] and [structural editing features][38]). + +Also because this tutorial is more of a crash course and limited in scope, we can only provide you with a basic overview of core language features. Throughout the tutorial you will find lots of links for further reading and a list of Clojure related books at the end. Now, without much further ado, let's dive in... + +### Setting up an environment + +As with any programming language, we first need to ensure we've got some proper tooling in place, before we can begin our journey through unknown lands. Since Clojure is just a language and runtime environment, it doesn't have any specific requirements for editors and other useful tools. However, the Clojure community has developed and adopted a number of such tools, which make working with Clojure (even) more fun and the first one we introduce right away: + +### Leiningen + +These days most software projects are using a large number of open source libraries, which themselves often have further dependencies of their own. To anyone having ever worked with a language with an active community, life without a package manager seems like pure hell, trying to manage & install dependencies manually. [Leiningen][39] is the de-facto build tool used by the Clojure community, with its name being an [humorous take][40] on [Ant][41], the former de-facto build tool in the Java world. Lein calls itself a tool for "automating Clojure projects without setting your hair on fire". It's truly one of the easiest ways to get started with Clojure and is so much more than just a package manager, even though in this tutorial we'll be mainly using it as such. So please head over to the [Leiningen][39] website and follow the simple 3-step install procedure (or check your system package manager, e.g. [Homebrew][42] for OSX: `brew install leiningen`). **Regardless, you'll need to have an existing[Java installation][43] (Java 6 or newer) on your machine, before installing Leiningen...** + +> The Clojure community has developed integration plug-ins for several popular editors & IDEs and we will start working with one of them [Counterclockwise][44] in the next part of this tutorial. A list of other options can be found on the [Clojuredoc website][45]. + +### Hello world, Hello REPL! + +As briefly mentioned in the beginning, Clojure provides us with a fully dynamic programming environment, called the REPL: The **(R)**ead, **(E)**valuate, **(P)**rint, **(L)**oop. The REPL reads input from the user, executes it, prints the result of the process, then rinse & repeat... + +The "read" phase converts source code into a data structure (mostly a nested list of lists). During "evaluation" this data structure is first compiled into Java byte code and then executed by the JVM. So unlike some other dynamic languages running on the JVM (e.g. [JRuby][46], [Rhino][47]), Clojure is a compiled language and in many cases can have similar performance characteristics as Java. + +The REPL quickly becomes the main sketch pad and development tool for many Clojure users, a space in which complex code is slowly built up from small parts, which can be immediately tested and experimented with, providing an uninterrupted experience. + +To start a REPL with leiningen, simply type `lein repl` on your command line and after a few moments, you should see a prompt like this: + +``` +$ lein repl +nREPL server started on port 51443 +REPL-y 0.1.10 +Clojure 1.5.1 +Exit: Control+D or (exit) or (quit) +Commands: (user/help) + Docs: (doc function-name-here) + (find-doc "part-of-name-here") + Source: (source function-name-here) + (user/sourcery function-name-here) +Javadoc: (javadoc java-object-or-class-here) +Examples from clojuredocs.org: [clojuredocs or cdoc] + (user/clojuredocs name-here) + (user/clojuredocs "ns-here" "name-here") +user=> _ +``` + +> Btw. The first time `lein` is run, it will download Clojure and possibly a number of other files/libraries. This only happens once and all files are stored/cached in this folder `~/.m2/repository`. REPL startup time will always take a few seconds due to the JVM initializations needed, however a REPL usually doesn't need to be restarted often, so in practice isn't an huge issue. +> +> Should ever end up triggering an action which will make the REPL hang (e.g. trying to display an infinite sequence), you can press `Control+C` to cancel this action. +> +> **If you don't want to (or can't) install Clojure/Leiningen, you can try out all of the examples in this part of the tutorial using the online REPL at[Try Clojure][48].** + +As is traditional, our first piece of Clojure code should be `(println "Hello World")`. So please go ahead and type it at the prompt. Once you hit `Enter`, the **(R)**ead phase of the REPL begins, turning our entered text into a stream of symbols. Provided there're no errors, these symbols are then **(E)**valuated according to the rules of the language, followed by **(P)**rinting the result of that code and **(L)**oop giving us a new prompt for input. + +``` +user=> (println "Hello World") +Hello World +nil +user=> _ +``` + +> **Input - > Process -> Output** +> +> ...is one of the fundamental concepts in programming, especially in functional programming. If you look closely, you might be wondering where that `nil` came from? `nil` is Clojure's equivalent of `null` and here indicates that our `println` actually didn't produce any computational result. In fact, the display of "Hello World" was simply a side-effect of executing `println` (by pushing that string to your system's output stream), but the `println` function gave us no actual value back, which we might pass to another process. We will return to this important distinction later on when we'll talk about truthiness, predicates and pure functions. + +Some other brief examples: + +``` +(+ 1 2) +; 3 +(+ (+ 1 2) (+ 3 4)) +; 10 +(+ 1 2 3 4) +; 10 +``` + +Looks weird, huh? At least no more `nil` is to be seen (of course we expected some results from an addition), and maybe you can already spot a pattern: + + 1. Operations seem to come first (this is called [prefix notation][49]) and + 2. it seems the number of parameters/arguments doesn't matter... + + + +These are the kind of assumptions, you might make coming from an imperative programming background (Java/C etc.), where symbols like `+`, `-`, `/`, `*` or `=` actually are operators, basically symbols with pre-defined, hardcoded meanings and can only appear in certain places within the code. In Clojure however, there're no such operators and `+` is just defined as a standard function and that function accepts indeed a flexible number of params (as do all other basic math operators). + +### Clojure syntax summarized + +The syntax of Clojure/Lisp boils down to just this **one rule** and any Clojure form has this overall structure (no exceptions!): + +``` +(function param1 param2 ... paramN) +``` + +**Note:** Functions are processes and parameters (also called arguments) are their inputs. The number of params depends of course on the function, with some not requiring arguments at all. + +The parentheses define the scope of an S-expression (technically a list, but also a branch in the tree of our program), with its first element interpreted as a function to call. An important thing to consider at this stage is that all the elements (incl. the first) of such an expression can be (and often are) results of other function calls. + +Here we calculate the sum of two products, the [Pythagorean][50] (c2 = a2 + b2) of a fixed triangle with sides a = 4 and b = 8: + +``` +(+ (* 4 4) (* 8 8)) +; 80 +``` + +![AST visualized][51] + +The image shows a visualization of the encoded tree structure we've written. The tree needs to be evaluated from the bottom to the top: The inner forms `(* 4 4)` and `(* 8 8)` are evaluated first before their sum can be computed. Clojure is read inside out. At first this might seem alien, but really just takes getting used to and doesn't prove problematic in practice, since most Clojure functions are often less than 10 lines long. + +### Symbols + +Symbols are used to name things and are at the heart of Clojure. Clojure code is evaluated as a tree of symbols, each of which can be bound to a value, but doesn't need to be. Of course in practice, it mostly means a symbol must have a bound value in order to work with it. Yet there're situations in Clojure when a symbol must remain unevaluated (as is) and we'll describe some of these in more detail when we discuss the `list` data type further below. + +Imagine for a moment to be in Clojure's shoes and we have to evaluate the form `(+ 1 2)`. The Reader simply provides us with a list of 3 symbols `+`, `1` and `2`. The latter two are easily identified as numbers and need no further treatment. The `+` however is a symbol we don't know and therefore need to look up first to obtain its value. Since that symbol is part of the core language, we find out it's bound to a function and then can call it with `1` and `2` as its arguments. Once the function returns, we can replace the whole form `(+ 1 2)` with its result, the value `3`. If this form was part of a larger form/computation, this result is then inserted back into it and the whole process repeats until all remaining forms & symbols have been resolved and a final value has been computed. + +Symbols are conceptually similar to variables in that both provide reusable, named references to data (and code). Yet, variables don't really exist in Clojure. The biggest difference to variables in other languages, is that by default a symbol is bound to a fixed value once, after which it can't be changed. This concept is called... + +#### Immutability + +[Immutability][19] isn't a well known concept among the (imperative) languages, which readers of this blog might be more familiar with. In fact, these languages are mainly built around its opposite, mutability - the ability to define data, pass it around via references/pointers and then change it (usually impacting multiple places of the codebase). The fact, that immutable data is read-only once it's been defined, provides the key feature for truly enabling safe multi-threaded applications and simplifies other programming tasks (e.g. easy comparison of nested values, general testability and the ability to safely reason over a function's behaviour). The presence of immutable data also leads to fundamental questions about the actual need for key topics in object oriented programming, e.g. the need for hiding data through encapsulation and all the resulting complexity is only required if a language doesn't provide features protecting data from direct 3rd party (i.e. user code) manipulation. This problem simply doesn't exist in Clojure! On the other hand immutability too provides one of the most challenging unlearning tasks for people coming from a world of mutable state, since it seems paradoxical to work it into any realworld system requiring constant changes to our data. + +Since no real application can exist without changing its internal state, throughout the course of this tutorial we will show how a) Clojure makes the most of immutability using persistent data structures, b) how actual mutable behaviour can be achieved where it is beneficial and c) show how mutable state can be easily avoided in most parts of a Clojure program. But for now please remember: **Clojure data is immutable by default.** + +> As an aside, unlike other functional languages like [Haskell][52] or [Scheme][53] where all data is truly 100% immutable and changing state can only be achieved through [Closures][54] & [Monads][55], Clojure takes a more pragmatic route and provides a number of mutable data types. However, each of those is intended for certain usage scenarios and we will only discuss two of them (Vars and Atoms) further below. + +#### Symbol bindings + +In most programming languages variables are based on [lexical scope][56]: Depending on the level at which a variable has been declared in a program, its binding is either global or local (e.g. local within a function or class). Clojure also provides lexical scope binding using the `let` form, giving us local, symbolic value bindings only existing within its body. + +The [`let`][57] form has this general structure and the last (often only) expression of its body becomes the final result: + +``` +(let [symbol value + symbol value ...] + body-expressions) +``` + +> Btw. The name `let` comes from mathematical texts, where we often say things like: "Let C be the sum of A and B" etc. To anyone with a previous career in BASIC, this should be familiar too... + +Sticking with our pythagorean example from above, we could wrap the computation inside a `let` form and introduce two symbols `a` and `b`: + +``` +(let [a 4 ; bind symbol a to 4 + b 8] ; bind symbol b to 8 + (+ (* a a) (* b b))) ; use symbols +; 80 + +a ; outside the let form symbol a is undefined +CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context +``` + +We will deal with `let` several more times throughout this tutorial. + +### Vars & namespaces + +Being restricted to only lexical scoped symbols defined with `let` is of course a painstaking way of programming, but thankfully isn't the whole truth. The basis of programming is "[Don't repeat yourself][58]" and that implies we need some form of mechanism to refer to existing values/processes defined elsewhere. In Clojure, this mechanism is implemented using Vars, named storage containers holding our data. Vars are named using symbols and can keep any datatype. They're always global within a given namespace, meaning they're visible from anywhere within that namespace and possibly others too. + +Namespaces are an important concept (not only) in Clojure to manage modularity and avoid naming conflicts. They're conceptually similar to [namespaces in C++][59], [packages in Java][60] or [modules in Python][61], although in Clojure have additional dynamic features. All Clojure code is evaluated as namespaced symbols and the language provides a rich set of functions to create, link and manipulate them. You can read more about them on the [Clojure website][62]. In the REPL the prompt will always show which namespace we're currently working in (default `user`). + +Back to Vars now, they're the closest thing to "traditional" variables in other languages, though are not equal: Whereas in many other languages a variable is a direct mapping from a named symbol to a value, in Clojure, symbols are mapped to Var objects, and only the Vars themselves provide a reference to their current values. This is an additional level of indirection, important for working in the dynamic environment of the REPL and in multi-threaded scenarios. For the latter, Vars provide a mechanism to be dynamically rebound to a new value on a per-thread basis and is one of Clojure's concurrency features we will discuss in a future part of this tutorial. + +![Clojure Vars explained][63] + +[`def`][64] is the general form used to define Vars. It is a special form which takes two arguments, but doesn't evaluate the first one and instead takes it literally to create a new Var of that name, which then holds the given value (if any). Vars can also be defined without a value, which keeps them initially unbound and is less common, but is sometimes needed to declare a Var for future reference. + +We used Vars a couple of times already: the `+`, `*` and `let` symbols are all bound to Vars defined in the [`clojure.core`][65] namespace. But let's define two vars ourselves and then pass their values to a process: + +``` +(def a 4) +; #'user/a ; def returns the created var object +a ; just providing a Var's name will return its value +; 4 +(def b 8) +; #'user/b +b +; 8 +(+ (* a a) (* b b)) ; Vars used in a computation +; 80 +``` + +> If we want to refer to a Var itself, rather than its value, we can use the `#'` prefix or the `var` function. + +To explain some more how Vars are used in the light of immutability, let's look at another example: In imperative languages like C, Java, JS etc. we have the `++` operator to increment a variable by one. Clojure has the [`inc`][66] function: It too takes a value and returns the value + 1. So we can apply this to our `a` and see what happens: + +``` +(inc a) ; returns a + 1 +; 5 +``` + +Correct answer. But printing out `a` shows its value is still 4... + +``` +a +; 4 +``` + +This is because `inc` does not operate on the Var `a`, but only is given `a`'s current value `4`. The value returned by `inc` is entirely distinct and our `a` is never touched (apart from reading its value). + +**Vars should only be used to define values in the interactive programming context of the REPL or for pre-defined values in Clojure source files.** When we said that Vars are mutable, then this is only true in that they can be redefined with `def` (and some other advanced functions we won't cover here) to have new values, but practically, a Var should be considered unchangeable. Of course, one could write a function which uses `def` within its body to re-define a var with a new value, however this is considered non-idiomatic, generally bad form and is never seen in the wild. Just don't do it! If this is still confusing, we hope things will make more sense, once we've discussed Clojure's data structures and have seen how mutation of variables is actually not needed in practice. + +### Functions + +In stark contrast to object oriented languages like Java, where classes and objects are the primary unit of computation, Clojure is a functional language with functions at its heart. They're "first class", standalone entities in this language and should be considered equal to any other type of data/value. They're accepted as arguments to other functions and can also be constructed or returned as result from a function call. With functions playing such a key role in Clojure, they can be defined in different ways and be given a name, but don't need to. + +When defining a re-usable function, we most likely want to also give it a name so that we can easily refer to it again. To define a named function we use the built-in form [`defn`][67] (`def`'s sibling and short for "define function") and provide it with all the important things needed: a name, a list of inputs (parameters) and the body of the function (the actual code). In pseudo-code this then looks like this: + +``` +(defn name [parameters] body-expressions) +``` + +...applied to our above example this could be written like this: + +``` +(defn hypot + [a b] + (let [a (* a a) + b (* b b) + c (+ a b)] + (Math/sqrt c))) +``` + +This implementation is not the most concise, but shows how we can use `let` to split up a computation into smaller steps and temporarily redefine symbols. We also make use of [Java interop features][68] to refer to Java's built-in [`Math`][69] class and compute the square root of that expression. According to Pythogoras, this is the actual length of the third side (the [Hypotenuse][70]) of the right-angled triangle given by `a` and `b`. A shorter alternative would be just this: + +``` +(defn hypot [a b] (Math/sqrt (+ (* a a) (* b b)))) +``` + +If you're coming from a C-style language, you might wonder where we define the actual result (or return value) of this function. In Clojure this is implicitly given: **Just as with`let`, the result of the last expression in a function's path of execution is the result.** + +Now that we have defined our first function, we can call it like this: + +``` +(hypot 9 12) ; call fn with 9 & 12 +; 15.0 +(hypot a b) ; call fn with our Vars a=4 & b=8 +; 8.94427190999916 +``` + +#### Anonymous functions + +A function without a name is called an anonymous function. In this case they're defined via the special form [`fn`][71], like this: + +``` +(fn [params] body-expressions) +``` + +Just like `defn`, this form takes a number of parameter names and body expressions. So another alternative would be to use `def` and the `fn` form to achieve the same function definition as above (`defn` is really just a short form of this combo): + +``` +(def hypot (fn [a b] (Math/sqrt (+ (* a a) (* b b))))) +``` + +Anonymous functions are often used with Cloure's data processing features (see further below), for callbacks or if the result of a function is another function, e.g. to pre-configure functions as explained next (readers with a JS background should also find the following familiar): + +Let's take another brief look at the `greetings` function we showed at the beginning of this tutorial: + +``` +(defn greetings [name] (println "hello" name)) +``` + +Now, we assume such a greeting exists in other languages too, so we might want to define a German version as well: + +``` +(defn greetings-de [name] (println "hallo" name)) +``` + +The only difference between the two is the first part of the greeting, so a more reusable alternative would be to redefine `greeting` to use two arguments: + +``` +(defn greetings [hello name] (println hello name)) +; #'user/greetings +(greetings "hello" "toxi") +; hello toxi +``` + +This is one of the situations where anonymous functions come into play, since we could define a `make-greetings` function which takes a single parameter (a greeting) and returns an anonymous function which then only requires a name, instead of a greeting **and** a name. Instead of using `println` we make use of the [`str`][72] function to concatenate values into a single string and return it as result. + +``` +(defn make-greetings + [hello] + (fn [name] + (str hello " " name "!"))) ; str concatenates strings +``` + +With this in place, we can now define a couple of Vars holding such greeters for different languages and then use these directly: + +``` +(def greetings-es (make-greetings "Hola")) +(def greetings-de (make-greetings "Guten Tag,")) +``` + +The new Vars `greetings-es` & `greetings-de` now contain the pre-configured functions returned by `make-greetings` and we can use them like this: + +``` +(greetings-es "Ricardo") +; "Hola Ricardo!" +(greetings-de "Toxi") +; "Guten Tag, Toxi!" +``` + +> We call functions which consume or produce functions [Higher Order functions][73] (HOF) and they play a crucial role in the functional programming world. HOFs like the one above are used to achieve a concept called [Partial application][74] and the mechanism enabling it is called a [Closure][75], which should also explain Clojure's naming. We could also use the [`partial`][76] function to achieve what we've done here manually. + +#### Multiple arities & varargs + +Even though this isn't the place to go into details just yet, Clojure allows functions to provide multiple implementations based on the number of arguments/parameters given. This features enables a function to adjust itself to different usage contexts and also supports functions with a flexible number of parameters (also called varargs, discussed at the end of this article). + +#### Guards + +Errors are an intrinsic aspect of programming, but taking a defensive stance can help catching many of them early on during the design stage, also articulated through the "[Fail fast][77]" philosophy popular amongst software folk. Clojure supports this form of [Design-by-contract][78] approach, allowing us to specify arbitrary guard expressions for our functions and uses them to pre-validate inputs (parameters) and/or the output (post-validation). E.g. we might want to constrain the parameter to our `make-greetings` function to only allow strings with less than 10 characters and ensures the function returns a string... + +``` +(defn make-greetings + [hello] + {:pre [(string? hello) (< (count hello) 10)] ; pre-validation guards + :post [(string? %)]} ; result validation + (fn [name] + (str hello " " name "!"))) +``` + +Guards are given as a Clojure map (discussed further below) with `:pre`/`:post` keys, each containing a vector of boolean-valued expressions (also discussed further below; in our case it's a call to [`string?`][79], a so called predicate function, which only returns `true` if its argument is a string). Since the result of a function is an unnamed value, we use the `%` symbol to refer to it in the post-validatator. Attempting to call this guarded function with a non-string or too long greeting string will now result in an error even before the function executes: + +``` +(make-greetings nil) +; AssertionError Assert failed: (string? hello) ... +(make-greetings "Labas vakaras") ; apologies to Lithuanians... +; AssertionError Assert failed: (< (count hello) 10) +``` + +[Mr. Fogus][80] and [Ian Rumford][81] have some further examples... + +### Metadata + +Before moving on to more exciting topics, let's briefly mention some more optional features of functions: metadata, documentation & type hints. The following function is an extended version of our `make-greetings` fn with these all of these things included: + +``` +(defn make-greetings + "Takes a single argument (a greeting) and returns a fn which also + takes a single arg (a name). When the returned fn is + called, prints out a greeting message to stdout and returns nil." + [^String greeting] + (fn [^String name] + (str greeting " " name "!"))) +``` + +The string given between the function name and parameter list is a doc string and constitutes metadata added to the Var `make-greetings` defined by `defn`. Doc strings are defined for all built-in Clojure functions and generally can be read in the REPL using [`doc`][82]: + +``` +(doc make-greetings) +; ([greeting]) +; Takes a single argument (a greeting) and returns a fn which also +; takes a single arg (a name). When the returned fn is called, +; prints out a greeting message to stdout and returns nil. +``` + +Clojure allows arbitrary metadata to be added to any datatype and this data can be created, read and manipulated with functions like [`meta`][83], [`with-meta`][84] and [`alter-meta`][85]. Please see the [Clojure website][86] for more information. E.g. to show us the complete metadata map for our `make-greetings` Var we can use: + +``` +(meta (var make-greetings)) +; {:arglists ([greeting]), +; :ns #, +; :name make-greetings, +; :doc "Takes a single argument (a greeting)..." +; :line 1, +; :column 1, +; :file "/private/var/..."} +``` + +Type hints attached to the function parameters were the other addition (and form of compiler metadata) used above. By specifying `^String` we indicate to the compiler that the following argument is supposed to be a String. Specifying type hints is optional and is an advanced topic, but can be very important for performance critical code. Again, we will have to refer you to the [Clojure website][87] for further details. + +### Truthiness, conditionals & predicates + +The concept of branching is one of the fundamental aspects in programming. Branching is required whenever we must make a decision at runtime based on some given fact and respond accordingly. In many programming languages, we use the Boolean values `true` and `false` to indicate the success or general "truth" value of something. These values exist in Clojure too, of course. However, in many places **Clojure applies a more general term for what constitutes truth (or "success") and considers any value apart from`false` or `nil` as `true`.** This includes **any** datatype! + +As you might expect, the basic boolean logic operations in Clojure are [`and`][88], [`or`][89] and [`not`][90]. The first two can take any number of arguments and each will be either `truthy` or not: + +``` +(or nil false true) +; true +(or 1 false) ; `or` bails at the first truthy value encountered +; 1 + +(and true nil false) ; `and` bails at the first falsy value encountered +; nil +(and true "foo") ; if all arguments are truthy, `and` returns the last +; "foo" + +(not false) +; true +(not nil) +; true +(not 1) +; false +``` + +An important aspect of `and` & `or` is that both are lazy, i.e. their arguments are only evaluated if any preceeding ones were falsy. Combined with Clojure's definition of truthiness and `and`/`or` returning not just boolean values, it's often possible avoid traditional branching in our code. + +For the cases where we do need proper branching, we can use the `if` and `when` forms: + +[`if`][91] takes a test expression and one or two body expressions of which only one will be executed based on the test result, in pseudo code: + +``` +(if test true-body-expression false-body-expression) +``` + +...in real terms: + +``` +(def age 16) + +(if (>= age 21) + "beer" + "lemonade") +; "lemonade" +``` + +Being restricted to a single form for both the "truthy" and "falsy" branch is one important limitation of the `if` form, but is a reflection of Clojure's focus on using functions and an encouragement to limit side effects (i.e. I/O operations) to be only contained within functions. The second, falsy branch of `if` is also optional and if not needed, it is more idiomatic to use `when` instead. [`when`][92] is somewhat more flexible in these cases, since its body can contain any number of forms to be executed if the test succeeds: + +``` +(when (and (>= age 21) (< age 25)) + (println "Are you sure you're 21?") + (println "Okay, here's your beer. Cheers!")) +``` + +To achieve a similar effect using `if` we can either wrap these two `println`'s in a function or use the [`do`][93] form, which is used as an invisible container for grouping (often side-effecting) actions and it returns the result of its last expression: + +``` +(do + (expression-1) + (expression-2) + ...) +``` + +### Data structures + +Data lies at the heart of any application, big or small. Apart from dealing with primitive data like individual numbers, characters and strings, one of the biggest differences between programming languages (and therefore one of the most important factors for choosing one language over another) is in the ways complex data can be defined and manipulated. As we will see next, this aspect is one of Clojure's highlights, as the language not only provides a rich set of primitives (incl. ratios, big integers, arbitrary precision decimals, unicode characters, regular expressions), but also truly powerful approaches to model & process data, of which we can unfortunately only outline some in the scope of this tutorial. + +Before we discuss the various common data structures, we also need to point out once more that Clojure is an untyped, dynamic, yet compiled language. All of the following data structures can be fully recursive and contain any mixture of data types. + +For reference, a full list of Clojure data structures is available on the [Clojure Website][94] + +#### Lists + +Lists are sequential data containers of multiple values and form the heart of Clojure (and Lisp in general). In fact, the name "Lisp" is short for List Processing. We actually already know by now how lists are defined, having done so many times in the previous sections: Lists can take any number of elements and are defined with `(` and `)` or using the function [`list`][95]. We also know by now that lists are usually evaluated as a function calls, so trying to define a list of only numbers will not work as expected: + +``` +(1 2 3 4) +; ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn +``` + +Because the first element of our list is the number `1` (not a function!), Clojure will give us this error... Here's how & why: + +##### Homoiconicity + +Long story short: **In Clojure, code is data and data is (can be) code.** Languages using the same data structures for code and data are called homoiconic and all Lisps share this feature, as well as other languages like [R][96], [XSLT][97], [PostScript][98] etc. + +To treat code as data, we somehow need to circumvent the evaluation of our list as function call. To that purpose Clojure provides us with a `quote` mechanism to evaluate a data structure literally (as symbolic data). We can do this with any Clojure data structure to recursively stop evaluation of a form as code: + +``` +(quote (1 2 3 4)) +; (1 2 3 4) +'(1 2 3 4) ; the apostrophe is a shorthand for `quote` +; (1 2 3 4) +'(+ 1 2) +; (+ 1 2) +(println "the result is" (+ 1 2)) +; the result is 3 +(println "the result of" '(+ 1 2) "is" (+ 1 2)) +; the result of (+ 1 2) is 3 +``` + +The diagram below shows the impact of quoting and the difference of the resulting trees: + +![AST differences through quoting][99] + +We could also use the `list` function to programatically assemble a list/function (using our previously defined vars `a` and `b`) and then evaluate it with `eval`: + +``` +; first construct a function call using a list of individually quoted symbols +(def a-plus-b (list '+ 'a 'b)) +; #'user/a-plus-b + +a-plus-b ; show resulting list +; (+ a b) + +(eval a-plus-b) ; treat data as code: evaluate... +; 12 + +; treat code as data structure & look at the first item of that list +(first a-plus-b) +; # ; internal representation of `+` fn + +; next treat code as data: replace all occurrences of a & b w/ their square values +; the {...} structure is a map of key => value pairs (discussed below): +; any keys found in the original list are replaced with their values +; so `a` is replaced with (* a a) and `b` with (* b b) +; the map is also quoted to avoid the evaluation of its contents +(replace '{a (* a a) b (* b b)} a-plus-b) +; (+ (* a a) (* b b)) + +; btw. if the map would *not* be quoted, it would be evaluated as: +{a (* a a) b (* b b)} +; {4 16, 8 64} + +(eval (replace '{a (* a a) b (* b b)} a-plus-b)) ; data as code again... +; 80 +``` + +> We will discuss the `first` function in more detail below. + +Right now, you might wonder why this is all worth pointing out. The most dramatic implication of homoiconicity is the enabling of [metaprogramming][100], the programmatic generation & manipulation of code at run time and by doing this, being able to define our own language constructs. It also opens the door to lazy evaluation of code or skipping code entirely depending on context (e.g. what happens with `and`/`or`). Unlike C's pre-processor, which only operates on the original textual representation of the source code (before the compile step and hence is severely limited and potentially more error prone), Lisps give us full access to the actual data structures as they're consumed by the machine. For example this makes Clojure an ideal candidate for [genetic programming][101] or to implement your own [domain specific language][102]. The main forms responsible for these kinds of code transformations are [macros][24] and we will leave them for another tutorial... + +Clojure lists have another important detail to know about: Because they're implemented as independent, linked elements, they can only be efficiently accessed at their head (the beginning of the list) and they don't provide direct, random access to any other elements. This restriction makes them less flexible than the next data structure, but still has some concrete use cases where this limitation doesn't matter: e.g. to implement [stacks][103]. + +#### Vectors + +Since lists in Clojure are both limited in terms of access and are semantically overloaded (as containers of code), it's often more convenient to use another similar data type to store multiple values: vectors. Vectors are literally defined using `[` and `]` or the [`vector`][104] function and are, like lists, a sequential data structure. We already encountered vectors when defining the parameters for our functions above, but just for kicks, here we define a vector with each element using a different data type: number, string, character & keyword (the latter is explained in more detail in the next section) + +``` +[1 "2" \3 :4] +; [1 "2" \3 :4] +``` + +Like lists, vectors can contain any number of elements. Unlike lists, but very much like arrays and vectors in others languages, they can also be accessed randomly using an element index. This can be done in multiple ways: + +``` +(def v [1 2 3 4]) +; #user/v +(get v 0) ; using the `get` function with index 0 +; 1 +(get v 10 -1) ; using `get` with a default value -1 for missing items +; -1 +(v 0) ; using the vector itself as function with index 0 as param +; 1 +``` + +#### Maps & keywords + +Maps are one of the most powerful data structures in Clojure and provide an associative mapping of key/value pairs. They're similar to [HashMaps][105] in Java or some aspects of [JavaScript objects][106], however both keys and values can of course be of any data type (incl. `nil`, functions or maps themselves). The most common data type for map keys however, are keywords. + +Keywords are simply symbols which evaluate to themselves (i.e. they have no other value attached). Within a given namespace only a single instance exists for each defined keyword. They can be created by prefixing a name with `:` or with the [`keyword`][107] function. Keywords can contain almost any character, but no spaces! + +``` +:my-key +; :my-key +(keyword (str "my-" "key")) ; kw built programmatically +; :my-key +``` + +Back to maps now. They are defined with `{` and `}` or the [`hash-map`][108] function (plus a few other variations we will skip here). Here's a map with 3 keys (`:a :b :c`), each having a different data type as its value (also note that `:c`'s map uses strings as keys, much like [JSON][109] objects): + +``` +(def m {:a 23 :b [1 2 3] :c {"name" "toxi" "age" 38}}) +; {:a 23 :b [1 2 3] :c {"name" "toxi" "age" 38}} +``` + +Having defined a map structure, we can now lookup its values using keys. Once again many roads lead to Rome: + +``` +(m :a) ; use the map as function with :a as lookup key +; 23 +(:b m) ; use key :b as function applied to m +; [1 2 3] +(get m :c) ; use get function with :c as key +; {"name" "toxi", "age" 38} +(:foo m) ; lookup a missing key returns nil +; nil +(get m :foo "nada") ; use get with default value for missing keys +; "nada" +``` + +> Note, we can use both maps & keywords as functions, because both implement Clojure's mechanism for function calls. Depending on context, it's good to have both as an option. + +Since the values for `:b` and `:c` are nested data structures, we can continue this further... + +``` +((:b m) 2) +; 3 +((:c m) "name") +; "toxi" +``` + +Although this works, Clojure offers an alternative (nicer) approach, which becomes especially handy if our nesting increases: The [`get-in`][110] function allows us to specify a "path" (as vector) into our data structure to look up a nested value. As we saw already with `get`, this function can be applied to both vectors and maps (or a mixture of both): + +``` +(def db {:toxi {:name "Karsten" + :address {:city "London"} + :urls ["http://toxiclibs.org" "http://thi.ng"]} + :nardove {:name "Ricardo" + :urls ["http://nardove.com"]}}) + +(get-in db [:toxi :address :city]) +; "London" +(get-in db [:nardove :address :city] "I think Bournemouth") +; "I think Bournemouth" +(get-in db [:nardove :urls 0]) +; "http://nardove.com" +``` + +[`select-keys`][111] can be used to extract a sub-set of keys from a map. The new map only contains the keys listed as arguments (if present in the map): + +``` +(select-keys m [:a :b :foo]) ; :foo isn't present in `m` so won't be in result... +; {:a 23 :b [1 2 3]} +``` + +#### Sets + +Sets are incredibly useful whenever we must deal with unique values, but don't care about their ordering. The name comes from [Set theory][112] in Mathematics. A Clojure set is (usually) unordered and will never contain more than a single instance of a given value. We will exploit this fact in the next part of the tutorial to build up our first full example application. Sets are defined like this: + +``` +#{1 2 3 4} +; #{1 2 3 4} +#{1 1 2 3 4} +; IllegalArgumentException Duplicate key: 1 +``` + +Be aware, that the literal definition syntax of sets **doesn't allow duplicate values**. However we can use it's functional equivalent: + +``` +(hash-set 1 1 2 3 4) +; #{1 2 3 4} +``` + +...or we could use the [`set`][113] or [`into`][114] functions to convert another data structure into a set and hence filter out any duplicate values from the original (of course without destroying the original!): + +``` +(def lucky-numbers [1 2 3 4 4 2 1 3]) +; #user/my-vals +(set lucky-numbers) +; #{1 2 3 4} +(into #{} lucky-numbers) +; #{1 2 3 4} +lucky-numbers +; [1 2 3 4 4 2 1 3] +``` + +Since a set can be considered a special kind of map in which keys have no values, but are simply mapped to themselves, we can use the same lookup approaches to check if a value is present or not. + +``` +(get #{1 2 3 4} 3) +; 3 +(#{1 2 3 4} 5) +; nil +(get #{1 2 3 4} 5 :nope) +; :nope +``` + +As a slightly more practical example, let's define a nested set of sets to encode the following mini social graph: + +![Dummy undirected social graph][115] + +``` +(def g + #{#{:toxi :ricardo} + #{:mia :toxi} + #{:filip :toxi} + #{:filip :ricardo}}) +``` + +Let's also define a simple lookup function (a predicate) to check if two people know each other: + +``` +(defn knows? + "Takes a graph and two node names, returns true if the graph contains + a relationship between the nodes (ignoring direction)" + [graph a b] + (not (nil? (graph #{a b})))) +``` + +> The [`nil?`][116] function returns true if its given argument is `nil`. + +Now we can use this function to get some answers (the order of names doesn't matter): + +``` +(knows? g :toxi :filip) +; true +(knows? g :ricardo :toxi) +; true +(knows? g :filip :mia) +; false +``` + +### Common data manipulation functions + +Even in the face of immutability, what good is a data structure, if it can't be manipulated? One of the most often quoted and popular sayings amongst Clojurians is: + +> "It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures." +> \-- Alan J. Perlis + +It neatly sums up Clojure's approach to data processing and is achieved through a number of elegant abstraction mechanisms, allowing dozens of core language functions to work polymorphically with different types of data. [Polymorphism][117] allows for a very small, but powerful API and so reduces cognitive load for the programmer. Because each of the above mentioned data structures has its own peculiarities, the concrete behaviour of the functions discussed below slightly varies and adjusts to each data type. + +#### Adding elements + +Adding new data to existing collections is one of the most common programming tasks and in Clojure is usually done with [`conj`][118]. + +For vectors, new elements are added to the end/tail: + +``` +(conj [1 2 3] 4 5 6) +; [1 2 3 4 5 6] +``` + +For lists, new elements are added to the beginning/head (because it's most efficient), therefore resulting in the opposite value order: + +``` +(conj '(1 2 3) 4 5 6) +; (6 5 4 1 2 3) +``` + +Maps are unordered collections and consist of key/value pairs. To add new pairs to a map, we need to define each as vector: + +``` +(conj {:a 1 :b 2} [:c 3] [:d 4]) +; {:d 4, :c 3, :a 1, :b 2} +``` + +Sets are also unordered and don't allow duplicates, so adding duplicate values will have no effect: + +``` +(conj #{1 2 3} 1 2 4 5) ; only 4 and 5 are added +; #{1 2 3 4 5} +``` + +Another often used alternative exists for maps and vectors, both of which are associative collections: Maps associate keys with values. Vectors associate numeric indices with values. Therefore Clojure provides us with the [`assoc`][119] function to add new or replace existing associations (`assoc` too takes a flexible number of parameters so that more than one such association can be changed in one go): + +``` +(assoc {:a 23} :b 42 :a 88) ; override :a, add :b +; {:a 88 :b 42} +(assoc [1 2 3] 0 10, 3 40) ; override 1st element, add new one (comma is optional) +; [10 2 3 40] +``` + +**Important:** For vectors you can only add new indices directly at the tail position. I.e. if a vector has 3 elements we can add a new value at position 3 (with indices starting at 0, this is actually the 4th element, therefore growing the vector by one). Attempting to `assoc` a greater index will result in an error, be careful: + +``` +(assoc [1 2 3] 10 -1) +; IndexOutOfBoundsException... +``` + +##### Nested data manipulations + +When dealing with nested structures we can use [`assoc-in`][120] and [`update-in`][121] to manipulate elements at any level. E.g. we might want to add Ricardo's current home town to our above mini DB map: + +``` +(assoc-in db [:nardove :address :city] "Bournemouth") +; {:toxi ...... +; :nardove +; {:name "Ricardo", +; :urls ["http://nardove.com"], +; :address {:city "Bournemouth"}}} +``` + +Like `get-in`, `assoc-in` takes a path into the datastructure and adds (or replaces) the value for that key. Whilst doing that it also creates any missing nesting levels automatically (i.e. `:nardove`'s map did not even contain an `:address` key beforehand). + +`update-in` is similar to `assoc-in`, however instead of a fixed value to be inserted into the collection, it takes a function (incl. any additional params) which is being applied to the current value for the key and then uses the result of that function as the new value. E.g. here we use `update-in` and `conj` to add another URL to `:toxi`'s DB entry: + +``` +(update-in db [:toxi :urls] conj "http://toxi.co.uk") +; {:toxi +; {:name "Karsten", +; :urls ["http://toxiclibs.org" "http://thi.ng" "http://toxi.co.uk"], +; :address {:city "London"}} .... +``` + +#### Removing elements + +To remove items from a collection, we can use [`dissoc`][122] (for maps) or [`disj`][123] (disjoin) for sets. If a key to be removed isn't present, both functions have no effect. + +``` +(dissoc {:a 23 :b 42} :b) +; {:a 23} +(disj #{10 20 30} 20) +; #{10 30} +``` + +Lists and vectors only allow for the direct removal near the head or tail, but don't support removing random items: [`pop`][124] applied to a list removes the first item, for vectors the last item. If the collection is empty, `pop` will throw an exception. + +``` +(pop '(1 2 3)) +; (2 3) +(pop [1 2 3]) +; [1 2] +``` + +#### Immutability, one more time + +We've just seen how we can add & remove elements from collections, thus seemingly modifying them - which technically would make them mutable, not immutable. However, as we've seen earlier, **the modified results returned by these functions are not the original collections.** To clarify: + +``` +(def v [1 2 3 4]) +; #'user/v +(def v2 (conj v 5)) +; #'user/v2 +v2 +; [1 2 3 4 5] +v +; [1 2 3 4] +``` + +Our original `v` still exists even though we've added `5` to it! Under the hood Clojure has created a new data structure (bound to `v2`) which is the original collection `v` with `5` added. Thinking like a programmer, your next questions should be immediately: Isn't that incredibly inefficient? What happens if I want to add a value to a vector with 10 million elements? Doesn't it become super slow & memory hungry to copy all of them each time? The short answer is: No. And here's why: + +#### Persistent data structures + +All Clojure data structures are so called [persistent data structures][125] (largely based on the [paper by Chris Okasaki][126]). Internally they're implemented as a tree and therefore can easily provide structural sharing without the need to copy data, which would be the naive solution to achieve immutability. The following diagram illustrates what happens internally for the above example: + +![Structural sharing in persistent datastructures][127] + +Using trees as the internal data structure, our `v2` can share the original contents of `v` and simply add a new leaf to its tree, pointing to the added value `5`. This is very cheap and doesn't cause a huge loss of performance, regardless of the size of the collection. The same principle is applied to all of the mentioned data structures and it's this uniform approach which both enables & requires immutability. + +### Sequences + +This section discusses Clojure's uniform approach to data processing using sequence abstractions. A sequence is a logical view of a data structure. All Clojure data structures can be treated as sequences, but the concept is extended even further and Clojure sequences include Java collections, strings, streams, directory structures and XML trees etc. You can even build your own ones by implementing an interface. The name for sequences in Clojure is [`seq`][128] and any compatible data structure can be explicitly turned into a `seq` using the function with the same name. + +#### The sequence API + +The sequence API is a minimal, low level interface consisting largely of only these four functions: [`first`][129], [`next`][130] to read and [`cons`][131] & [`seq`][128] to create sequences. All of the following functions are built on top of these, but before we get there let's first illustrate their role using a vector and a hash map as an example: + +``` +(def my-vec ["1st" "2nd" "3rd"]) +(def my-map {:a "1st" :b "2nd" :c "3rd"}) +``` + +Any Clojure collection can be turned into a seq, using the `seq` function. If the original collection is empty, `seq` will return `nil`. + +``` +(seq my-vec) +; ("1st" "2nd" "3rd) +(seq my-map) +; ([:a "1st"] [:c "3rd"] [:b "2nd"]) +(seq "creativeapplications.net") ; a string's seq is its characters +; (\c \r \e \a \t \i \v \e \a \p \p \l \i \c \a \t \i \o \n \s \. \n \e \t) +(seq []) +; nil +``` + +Since a map consists of key/value pairs, a map's seq is a seq of its pairs (vectors of 2 elements). And since a map is an unordered collection, the order of elements in its seq is undefined... + +![Sequence API][132] + +##### first + +...returns the first element of a seq (or `nil` if the sequence is empty): + +``` +(first my-vec) +; "1st" +(first my-map) +; [:a "1st"] +(first "hello") ; a string can be turned into a seq as well... +; \h +(first []) ; first of an empty vector/seq returns nil +; nil +``` + +##### next & rest + +As you might have guessed already, `next` returns a seq of all the remaining elements, excluding the first one. Again, if there're no further elements in the seq, `next` also returns `nil`. + +``` +(next my-vec) +; ("2nd" "3rd") +(next my-map) +; ([:c "3rd"] [:b "2nd"]) +``` + +We could now also combine the use of `first` and `next` to retrieve other elements, e.g. the 2nd element is the first element of the seq returned by `next`: + +``` +(first (next my-vec)) +; "2nd" +(first (next (next my-vec))) +; "3rd" +``` + +`rest` is almost identical to `next`, however will always return a seq: If there're no more elements, it will simply return an empty seq instead of `nil`. + +##### cons + +This function is used to prepend elements to a seq. `cons` takes two arguments, a value and an existing seq (or seqable collection) and adds that value at the front. If `nil` is given as the 2nd argument, a new seq is produced: + +``` +(cons 1 nil) +; (1) +(cons 2 (cons 1 nil)) +; (2 1) +(cons \c "ab") +; (\c \a \b) +``` + +### Looping, iteration & recursive processing + +At this point you might be wondering what use these above functions have in practice. Since Clojure offers far more high-level approaches to work with data collections, direct use of these functions in Clojure is actually less common. Yet, before we discuss these higher level functions, please bear with us as we want to illustrate some other important core operations common to all programming languages, one to which Clojure adds its own twist (again): Iteration & recursion. Meet the `loop` construct. + +#### loop & recur + +[`loop`][133] defines a body of code which can be executed repeatedly, e.g. to iterate over the elements of a sequence. This is best illustrated by an example, a loop which takes a vector and produces a seq of the vector's elements in reverse order (Clojure actually provides the [`reverse`][134] function to do the same for us, but we're focussed on `loop` here): + +``` +(loop [result nil, coll [1 2 3 4]] + (if (seq coll) + (let [x (first coll)] + (recur (cons x result) (rest coll))) + ; no more elements, just return result... + result)) +; (4 3 2 1) +``` + +The vector following the `loop` keyword is a binding vector just as we know from `let` and it can be used to bind any number of symbols. In our case we only require two: the initially non-existing `result` sequence (set to `nil`) and `coll`, a vector of numbers to be processed. The other code is the loop's body which is executed repeatedly: At each iteration we first check if our `coll` contains any more elements by calling `seq` (remember, `seq` returns `nil` (and is therefore falsy) when given an empty collection). If there're any elements remaining, we bind `coll`'s `first` element to `x`. What follows next is a call to [`recur`][135], the actual mechanism to trigger the recursive re-execution of the loop, however each time with new values given for the loop's `result` and `coll` symbols. These new values are the updated result sequence (with `x` prepended) and the remainder of the current collection produced via `rest`. Once `rest` returns an empty seq, the loop is finished and `result` is "returned" as final value. + +The combined application of `loop` & `recur` is the most low-level and verbose construct to create iterative behavior in Clojure, but because of that is also the most flexible. The most important restriction however is that `recur` can only be used at the end (tail) of a `loop`'s execution path, meaning there can be no further expressions following `recur` (hence the concept is called [Tail recursion][136]. In the above example you might think the final occurance of `result` violates this restriction, but that is not true: `recur` is the last expression of the "truth branch" of the enclosing `if`, whereas the returned `result` is on its other branch and therefore independent. + +#### doseq + +A more concise way of completely iterating the elements of a collection is offered by [`doseq`][137], however this form is designed to work with/trigger side effects and only returns `nil`. The example iterates over a vector of hashmaps and displays each person's age with some extra formatting: + +``` +(doseq [p [{:name "Ben" :age 42} {:name "Alex"} {:name "Boris" :age 26}]] + (let [name (:name p) + suffix (if (#{\s \x} (last name)) "'" "'s") + age (or (:age p) "rather not say")] + (println (str name suffix " age: " age)))) +; Ben's age: 42 +; Alex' age: rather not say +; Boris' age: 26 +; nil +``` + +The value of `suffix` is based on the [`last`][138] letter of a person's name and is usually `'s` (unless the last letter is in the set `#{\s \x}`). We'd also like the `:age` to be optional and provide a default value if missing... + +#### dotimes + +[`dotimes`][139] is yet another looping construct used for side effects, this time just for simply binding a symbol to a number of iterations: + +``` +(dotimes [i 3] (println i)) +; 0 +; 1 +; 2 +``` + +### Common sequence processing functions + +Now that we've discussed some of the underlying forms and mechanisms, it's time to focus on the more commonly used features of Clojure's sequence processing. + +Loops and iterators are the de-facto tools/patterns to process collections in many imperative languages. This is where idiomatic Clojure probably differs the most, since its functional approach is more focused on the transformation of sequences using a combination of higher order functions and so called: + +#### Pure functions + +A pure function's does not depend on any other data than its inputs and causes no side effects (i.e. I/O operations). This makes them [referentially transparent][140], meaning a function could be replaced with its result without any impact, or in other words, a function is consistently providing the same value, given the same inputs. Pure functions can also be [idempotent][141], meaning a function, if applied multiple times, has no other effects than applying it once. E.g. `(Math/abs -1)` will always provide `1` as a result and `(Math/abs (Math/abs -1))` will not change it, nor will it cause any other effect. + +Pure functions play a key role in functional programming. Their characteristics allow us to compose small, primitive functions into more complex constructs with predictable behaviors. + +##### Memoization of pure functions + +The caching of results of previous calls to a function is called [memoization][142]. This technique is especially useful if these results are produced by a complex/slow process. Clojure provides the [`memoize`][143] HOF to allow any function be memoized, however safe memoization requires those functions to be pure. We can demonstrate this caching effect by simulating a slow function using Java interop and [`Thread/sleep`][144]: + +``` +; simulate long process by sleeping for x 选题模板.txt 中文排版指北.md core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LCTT翻译规范.md LICENSE published README.md scripts sources translated 1000 milliseconds +(defn slow-fn [x] (Thread/sleep (* x 1000)) x) + +(def not-so-slow-fn (memoize slow-fn)) + +(not-so-slow-fn 3) +; 3 +``` + +#### Map-Reduce + +Several years ago, Google published a [paper][145] about their use of the [Map-Reduce algorithm][146]. Whereas this paper was focused on the distributed application of that algorithm running in parallel on thousands of machines, the general approach itself has been around for decades and plays an important role in many functional languages, where it is the de-facto pattern to process data without the need for explicit loops. + +The idea of Map-Reduce is to first transform the elements of an input collection into an intermediate new collection of values, which is then passed to a reduction function, producing a single final result value. This result could be any data type, though, incl. a new collection. + +Even though Map-Reduce is a 2-phase process, each phase can also be applied on its own. I.e. sometimes there's no need for a later reduction or an initial mapping step. + +> Btw. Several modern "NoSQL" database systems (e.g. [CouchDB][147], [MongoDB][148], [Riak][149]) and distributed data processing platforms like [Hadoop][150] also heavily rely on Map-Reduce as underlying mechanism to process & create views of data. So if you ever intent to work with such, it's quite useful knowledge to work through this section, even if you have no further interest in Clojure... + +#### map + +In mathematical terms mapping is the transformation of values through the application of a function. In Clojure the [`map`][151] function is one of the most often used functions. It takes a transformation function and applies it to each element in a given collection/sequence. E.g. The example below takes the function `inc` and a seq of numbers. It then applies `inc` to each number individually and returns a new sequence of the results: + +``` +(map inc [1 2 3 4 5]) +; (2 3 4 5 6) +``` + +![map function visualized][152] + +The transformation function given to `map` can be anything and its also one of the situations where anonymous functions are often used. E.g. Here we produce a seq of square numbers: + +``` +(map (fn [x] (* x x)) [1 2 3 4 5]) +; (1 4 9 16 25) +``` + +As an aside, since anonymous functions are often very short, they can also be defined more concisely (though become less legible). The following is equivalent to the above expression: + +``` +(map #(* % %) [1 2 3 4 5]) +; (1 4 9 16 25) +``` + +Here we use the reader macro `#(..)` to define an anon fn and the symbol `%` to refer to the first (in this case only) argument. If such a function takes more than a single arg, then we can use `%2`, `%3` etc. to refer to these... + +``` +(#(* % %2) 10 2) ; call anon fn with args: 10, 2 +; 20 +``` + +`map` can also be applied to several collections at once. In this case the transformation function needs to accept as many parameters as there are collections. Let's use `map` to build a seq of hashmaps from two vectors of point coordinates and colors. Each time our transformation fn is given a single point (a vector) and a color keyword. The fn simply combines these values into a single map with keys `:pos` and `:color`: + +``` +(map + (fn [p c] {:pos p :color c}) ; transformation fn + [[100 0] [0 -100] [0 100] [200 100]] ; points + [:red :green :blue]) ; colors +; ({:pos [100 0], :color :red} +; {:pos [0 -100], :color :green} +; {:pos [0 100], :color :blue}) +``` + +![map builder][153] + +> **Important:** You might have noticed that our vector of points has one more element than there're colors. In that case, `map` will stop as soon as one of the input collections is exhausted / has no further values. In this case we only have 3 colors, so the last (4th) point is ignored. + +##### Laziness and lazy seqs + +One thing not immediately obvious when experimenting with `map` in the REPL, is that the seq returned by `map` is a so called `lazy-seq`, that is, **the transformation function is actually not applied to our original values until their results are needed**. In other words, `map` is more of a recipe for a computation, but the computation does not ever happen if we don't attempt to use its results. + +To illustrate this better, let's again simulate a slow transformation function which takes 1 second per value. With 5 values in the original collection, our entire processing should take approx. 5 seconds: + +``` +(def results + (map + (fn [x] + (Thread/sleep 1000) + (* x 10)) + [1 2 3 4 5])) +``` + +When this code executes, we can see the REPL **immediately** returned a result, the new Var `user/results`. It did not take 5 seconds, because at this stage we haven't yet attempted to do anything with that new Var - and hence no mapping did take place thus far. [It's plain lazy!][20]. + +Now trying to display the contents of `results` however will force the computation and therefore will take 5 seconds until we can see the mapped values: + +``` +results ; takes ~5secs, world's slowest multiply +; (20 30 40 50 60) +``` + +#### reduce + +[`reduce`][154] is Clojure's natural way of expressing an accumulation over a sequence of values. Like `map` it takes a function, an optional initial result and a sequence whose elements will be passed to the transformation function individually, for example: + +``` +(reduce + 0 [1 2 3 4 5 6 7 8 9 10]) +; 55 +``` + +In this case `reduce` uses the function `+` to combine all values of our seq into the accumulated result one by one. The transformation function must always take 2 arguments: the current result (reduced value) and the next item to be processed. If no initial result is given, the first iteration will consume the first 2 items from the sequence. + +In our case this happens: + +``` +(+ 0 1) ; 0 is the initial result, returns 1 + (+ 1 2) ; 1 is current result, returns 3 + (+ 3 3) ; returns 6 + ; and so on until the seq is exhausted... +``` + +Clojure also provides an alternative to `reduce`, called [`reductions`][155]. Instead of the just final reduction it returns a seq of all intermediate results (here we also use [`range`][156] to create a seq of numbers from 0-9): + +``` +(reduce + (range 10)) +; 45 +(reductions + (range 10)) +; (0 1 3 6 10 15 21 28 36 45) +``` + +![reduce vs. reductions][157] + +#### filter + +[`filter`][158] takes a function and a seq, then applies the function to each element and returns a lazyseq of only the elements the function returned a "truthy" value for. These kind of functions are also called "predicates". + +Clojure has a number of predicate functions which rely on truthiness and they can be easily recognized by their general naming convention, a function name suffixed with `?`. E.g. [`even?`][159] can be used to filter out all even numbers from the seq of numbers 0-9: + +``` +(filter even? (range 10)) +; (0 2 4 6 8) +``` + +![filter][160] + +Since the function needn't strictly return `true` or `false`, we can also use a set as predicate to filter out only values which are present in the set: + +``` +(filter #{1 2 4 8 16 32} (range 10)) +; (1 2 4 8) +``` + +Again we're using data as code, since vectors, maps & sets all can be used as functions and return `nil` if a value isn't present, therefore fulfilling the general contract of a predicate function... + +#### take / drop + +Sometimes we are only interested in a chunk of values from a larger collection. We can use [`take`][161] to retrieve the first `n` elements from a collection as a lazy sequence: + +``` +(take 3 '(a b c d e f)) +; (a b c) +``` + +In contrast, we can use [`drop`][162] to ignore the first `n` elements and give us a lazy sequence of all remaining elements: + +``` +(drop 3 '(a b c d e f)) +; (d e f) +``` + +Clojure has a few other variations on that theme, most notably [`take-last`][163], [`drop-last`][164], [`butlast`][165], [`take-nth`][166], [`take-while`][167] and [`drop-while`][168]. The latter two also take a predicate function and terminate as soon as the predicate returns a "falsy" result: + +``` +(take-while #(< % 5) (range 10)) +; (0 1 2 3 4) +``` + +#### concat & mapcat + +[`concat`][169] splices any number of seqs together into a single new lazy seq. The new `rotate-left` function shows how we can use `concat` with `take`/`drop` to rotate elements in a sequence: + +``` +(concat [1 2 3] '(a b c) {:a "aa" :b "bb}) +; (1 2 3 a b c [:a "aa"] [:b "bb"]) + +(defn rotate-left [n coll] (concat (drop n coll) (take n coll))) +; #'users/rotate-left + +(rotate-left 3 '(a b c d e f g h i)) +; (d e f g h i a b c) +``` + +[`mapcat`][170] is a combination of `map` & `concat`. Like `map` it accepts a transformation function and a (number of) seqs. The mapping function needs to produce a collection for each step which are then concatenated using `concat`: + +``` +; another social graph structure as from above (only w/ more people)... +(def g2 + #{#{:ricardo :toxi} + #{:filip :edu} + #{:filip :toxi} + #{:filip :ricardo} + #{:filip :marija} + #{:toxi :marija} + #{:marija :edu} + #{:edu :toxi}}) + +; step 1: produce a seq of all relations +(map seq g2) +; ((:marija :filip) (:toxi :marija) (:edu :filip) (:ricardo :filip) +; (:toxi :edu) (:toxi :ricardo) (:marija :edu) (:toxi :filip)) + +; step 2: combine rels into single seq +(mapcat seq g2) ; option #1: `seq` as transform fn +(mapcat identity g2) ; option #2: `identity` as transform (same result) +; (:marija :filip :toxi :marija :edu :filip :ricardo :filip :toxi :edu :toxi :ricardo :marija :edu :toxi :filip) + +; step 3: form a set of unique nodes in the graph +(set (mapcat identity g2)) +; #{:toxi :marija :edu :ricardo :filip} + +; step 4: build map of node valence/connectivity +(frequencies (mapcat identity g2)) +; {:marija 3, :filip 4, :toxi 4, :edu 3, :ricardo 2} +``` + +> There're two functions we haven't dealt with so far: [`identity`][171] simply returns the value given as argument. [`frequencies`][172] consumes a seq and returns a map with the seq's unique values as keys and their number of occurrences as values, basically a [histogram][173]. + +`take` & `drop` are also important with respect to one more (optional) property of lazy sequences we haven't mentioned so far: + +##### Infinite sequences + +The concept of infinite data in a non-lazy (i.e. eager) context is obviously unachievable on a machine with finite memory. Laziness, however does enable potential infinity, both in terms of generating and/or consuming. In fact, there're many Clojure functions which exactly do that and without the proper precautions (i.e. combined with `take`, `drop` and friends), they would bring a machine to its knees. So be careful! + +We already have used one of these potentially infinite sequence generators above: [`range`][156] when called without an argument produces a lazyseq of monotonically increasing numbers: `(0 1 2 3 4 ...)` **(Since the REPL always tries to print out the result, do not ever call one of these without guards in the REPL!)** + +Other useful infinite lazyseq generators are: + +[`cycle`][174] delivers a lazyseq by repeating a given seq ad infinitum: + +``` +(take 5 (cycle [1 2 3])) +; (1 2 3 1 2) +(take 10 (take-nth 3 (cycle (range 10)))) +; (0 3 6 9 2 5 8 1 4 7) +``` + +[`repeat`][175] produces a lazyseq of a given value: + +``` +(take 5 (repeat 42)) +; (42 42 42 42 42) +(repeat 5 42) +; (42 42 42 42 42) +``` + +[`repeatedly`][176] produces a lazyseq of the results of calling a function (without arguments) repeatedly: + +``` +(take 5 (repeatedly rand)) +; (0.07610618695828963 0.3862058886976354 0.9787365745813027 0.6499681207528709 0.5344143491834465) +``` + +[`iterate`][177] takes a function and a start argument and produces a lazyseq of values returned by applying the function to the previous result: so (f (f (f x)))... Here to generate powers of 2: + +``` +(take 5 (iterate #(* 2 %) 1)) +; (1 2 4 8 16) +(take 5 (drop 10 (iterate #(* 2 %) 1))) +; (1024 2048 4096 8192 16384) +``` + +Since infinite lazyseqs are values just like any other (but at the same time can't be exhausted) it sometimes it's helpful to think about them as high level recipes for changing program states or triggers of computations. Combined with the various sequence processing functions they provide a truly alternative approach to solving common programming problems. + +#### Sequence (re)combinators + +Here're some more core functions related to combining collections in different ways: + +[`interleave`][178] recombines two sequences in an alternating manner (also lazy): + +``` +(interleave [:clojure :lisp :scheme] [2007 1958 1970]) +; (:clojure 2007 :lisp 1958 :scheme 1970) +``` + +[`interpose`][179] inserts a separator between each element of the original seq: + +``` +(interpose "," #{"cyan" "black" "yellow" "magenta"}) +; ("cyan" "," "magenta" "," "yellow" "," "black") +``` + +[`zipmap`][180] combines two collections into a single hashmap, where the 1st collection is used for keys and the second as values. Let's have some [Roman Numerals][181]: + +``` +; first the individual pieces: +; powers of 10 +(take 10 (iterate #(* 10 %) 1)) +; (1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000) + +; apply powers to 1 & 5 +(take 5 (map (fn [x] [x (* x 5)]) (iterate #(* 10 %) 1))) ; using `map` +; ([1 5] [10 50] [100 500] [1000 5000] [10000 50000]) +(take 5 (mapcat (fn [x] [x (* x 5)]) (iterate #(* 10 %) 1))) ; using `mapcat` +; (1 5 10 50 100) + +; altogether now... +(zipmap + [:I :V :X :L :C :D :M] ; keys + (mapcat (fn [x] [x (* x 5)]) (iterate #(* 10 %) 1))) ; values +; {:M 1000, :D 500, :C 100, :L 50, :X 10, :V 5, :I 1} +``` + +#### for + +Since we've just discussed sequence generators, we also must briefly mention [`for`][182]. Unlike `for` loops in other languages, Clojure's `for` is a so called [List comprehension][183], just another generator of lazyseqs, though one on crack if we may say so... `for` combines the behavior of `map` with lexical binding as we know from `let` and conditional processing. It returns its results as lazyseq. Here we iterate over the seq returned by `(range 4)` and bind `i` to each value successively, then execute `for`'s body to tell us if that current value of `i` is even: + +``` +(for [i (range 4)] {:i i :even (even? i)}) +; ({:i 0, :even true} {:i 1, :even false} {:i 2, :even true} {:i 3, :even false}) +(into {} (for [i (range 4)] [i (even? i)])) +; {0 true, 1 false, 2 true, 3 false} +``` + +`for` can also be used to created nested seqs. This happens automatically when more than one symbol is bound, e.g. here we create positions in a 4x2 grid (the first symbol defines the outer loop, the next one(s) inner loops: + +``` +(for [y (range 2) ; outer loop + x (range 4)] ; inner loop + [x y]) ; result per iteration +; ([0 0] [1 0] [2 0] [3 0] [0 1] [1 1] [2 1] [3 1]) +``` + +The symbol binding part can be further customized with additional bindings to pre-compute values used in the body of `for` and/or we can specify a predicate to skip an iteration (therefore also achieving filtering a la `filter`) or cancel iteration (using `:while`). The next example creates points only along the border of a 4x4 grid (center points are skipped): + +``` +(for [y (range 4) + x (range 4) + :let [border? (or (= 0 x) (= 3 x) (= 0 y) (= 3 y))] + :when border?] ; skip iteration when border? is false + [x y]) +; ([0 0] [1 0] [2 0] [3 0] ; manually formatted to better visualize result... +; [0 1] [3 1] +; [0 2] [3 2] +; [0 3] [1 3] [2 3] [3 3]) +``` + +#### every? / some + +Sometimes we need to check if the values of a collection match certain criteria, e.g. to enforce a restriction. The [`every?`][184] function takes a validation function (predicate) and applies it to all elements of a collection. It only returns true, if the predicate returns a truthy value for all of them. Here we check if all elements in a seq have a `:name` key (remember, keywords can be used as functions!) + +``` +(every? :name [{:name "nardove"} {:name "toxi"} {:age 88}]) +; false +``` + +Or we could write our own predicate and check if all values are multiples of 3, that is a number for which the remainder, [`rem`][185], of a division by 3 is zero: + +``` +(every? #(zero? (rem % 3)) [666 42 99 12]) +; true +``` + +Alternatively, we can use [`some`][186] if we only want to ensure some of the values match a condition. `some` will return the first truthy value returned by the predicate (or `nil` if no items match). Again, we are using data (a set) as predicate fn: + +``` +(some #{3 6 9 12} [1 2 3 4 5 6]) +; 3 +``` + +...or ask if some names are longer than 4 characters: + +``` +(some #(> (count %) 4) ["mia" "nardove" "toxi"]) +; true +(some #(if (> (count %) 4) %) ["mia" "nardove" "toxi"]) +; "nardove" +``` + +#### apply + +So far we have used the phrase "applies a function to x" several times. In short it simply means that a function is called with `x` as its argument. Though, what should we do if we have a function accepting multiple arguments, but have our arguments only in a single collection (i.e. one built with `map` etc.)? + +To stick with some familiar constructs and add a concrete use case, our `hypot` function defined earlier, computes the length of the longest side in a triangle, given the lengths of the 2 other sides. At the same time we could interpret this as the calculation of the distance of a 2d point from the origin in a cartesian coordinate system: One side is the distance along the X-axis and the other the distance in Y. + +Imagine we have a collection of 2d points and we want to measure their distance from the origin (their [magnitude][187]): + +``` +(def points [[0 100] [200 100] [-300 50]]) +; #'user/points +``` + +Now we could use `map` and our `hypot` function to compute the distance/length for each point and produce a new sequence of the results. However, `hypot` so far requires 2 arguments `a` & `b`, but our points are defined as vectors of 2 elements and therefore each point is just a single value (the vector itself). For such situations, Clojure provides us with the `apply` function, allowing a function to accept a collection of values as individual arguments (with possibly additional ones given as well). So whereas the following will produce an error... + +``` +(hypot [200 100]) +; ArityException Wrong number of args (1) passed to: user$hypot +``` + +... using [`apply`][188] will unravel our vector into two individual arguments and call our function correctly: + +``` +(apply hypot [200 100]) +; 223.60679774997897 +``` + +With this in place, we can now plug this into a `map` form and process all our points: + +``` +(map #(apply hypot %) points) +; (100.0 223.60679774997897 304.138126514911) +``` + +To complete an earlier arc of our tutorial, we could also plug this into another `reduce` step to give us the longest distance (using `max` as the reduction function): + +``` +(reduce max (map #(apply hypot %) points)) +; 304.138126514911 +``` + +### Destructuring + +As we've just learned with `apply`, sometimes it is required to adapt our data to a function's specifics. But we can also achieve the opposite and adapt a function to expect a specific data structure and do so without having to jump through hoops painstakingly pulling out individual values from a given collection. Clojure make this very easy using destructuring. + +Destructuring is a way to bind symbols to values in a collection, by replicating the overall structure of the collection and placing the symbols to be bound at the points from which we intend to get a value from in the supplied data structure. A few lines of code will illustrate this much better... + +#### Sequential destructuring + +As we know a vector is just a sequence of values, each of which can be another nested data structure: + +``` +(def nested-data [10 20 [30 40] {:x 1 :y 2}]) ; some test data +``` + +To bind the first 3 items of that input vector to symbols `a`, `b` and `c`, a naive and inelegant solution would be to bind each symbol individually, like this: + +``` +(let [a (nested-data 0) + b (nested-data 1) + c (nested-data 2)] + (prn :a a :b b :c c)) +; :a 10 :b 20 :c [30 40] +``` + +Using sequential destructuring, this can be expressed much more concisely. All we need to do is telling Clojure the symbols' values are part of a sequence, by wrapping them in a vector themselves: + +``` +(let [[a b c] nested-data] (prn :a a :b b :c c)) +; :a 10 :b 20 :c [30 40] +``` + +Sometimes we might need values which are not successive in the collection e.g. say we only care about the 2nd and 4th value: + +``` +(let [[_ b _ d] nested-data] (prn :b b :d d)) +; :b 20 :d {:x 1 :y 2} +``` + +> It's idiomatic to use the `_` symbol to bind values we're not interested in (in this case the 1st and 3rd elements). + +The third element of `nested-data` is another vector. To also restructure its elements, we simply need to replicate the overall structure of `nested-data` and indicate that this 3rd element is a sequence itself. We combine this with another destructuring option, called `:as`, to bind the entire 3rd element to yet another symbol, `third`: + +``` +(let [[_ _ [c d :as third]] nested-data] + (prn third "contains:" c d)) +; [30 40] "contains:" 30 40 +``` + +When attempting to destructure sequences with more symbols than there are values, any symbols with missing values are bound to `nil`: + +``` +(let [[_ _ _ _ missing] nested-data] + (prn "missing?" (nil? missing))) +; "missing?" true +``` + +Likewise, if we're only interested in the first x elements of a seq, we don't need to specify any additional symbols/placeholders. Clojure doesn't care if there're more elements in a seq than destructuring symbols. However, in addition to the initial elements we're interested in, we might still want to hold on to the `rest` of the collection too. This can be done with `&`: + +``` +(let [[a b & more] nested-data] + (println (count more) "more elements:" more)) +; 2 more elements: ([30 40] {:x 1 :y 2}) +``` + +Destructuring can be used almost anywhere whenever Clojure expects a symbol binding form. E.g. in the symbol binding part of a `for` form or to specify the argument list(s) of a function. + +#### Map destructuring + +Maps too can be destructured, though because the lookup of values requires keys, their destructuring form needs to refer to keys as well. Since we used `[` and `]` to specify a sequential destructuring, it should also make sense that we use `{` and `}` for destructuring maps. In the following we destructure the 4th element of `nested-data` and bind this map's `:x` to symbol `a` and `:y` to `b`: + +``` +(let [{a :x b :y} (nested-data 4)] + (prn :a a :b b)) +; :a 1 :b 2 +``` + +If we wanted to use the same symbol names as the keys used in the original map, an alternative is: + +``` +(let [{:keys [x y] :as v} (nested-data 4)] + (prn :x x :y y :v v)) +; :x 1 :y 2 :v {:x 1 :y 2} +``` + +As with sequential destructuring we can use `:as` to also bind the entire map and of course can be done recursively. You can find more examples in [Jay Field's blog post][189] about this matter. + +#### Destructuring and function arities + +A function providing more than one implementation is called a "multi-arity" function and many core Clojure functions are implemented like this to provide maximum flexibility. So finally, let's extend our earlier `hypot` function and turn it into a multi-arity fn, accepting not only two numbers, but also a single seq (w/ minimum two elements) instead: + +``` +(defn hypot + ([[a b]] (hypot a b)) ; destructure the seq and then call itself with the 2 args + ([a b] (Math/sqrt (+ (* a a) (* b b))))) +; #'user/hypot + +(hypot [9 12]) ; no more need for `apply` +; 15.0 +(= (hypot [9 12]) (hypot 9 12)) ; testing other arity... +; true +``` + +> Remember to wrap each arity implementation in its own form, i.e. surround with `(` and `)`. + +### End of part 1 + +Congratulations!!! You made it through to here and we're truly proud of you! Even though we could only give you glimpses of The Clojure Way™ so far, we hope you're excited enough to try out more when we will be applying some of these basics to more practical & visual examples in the next part(s) of this tutorial. In the next part we will start building our first projects and introduce you to [Quil][190], a Clojure wrapper around [Processing][191]. + +In the meantime we recommend that you sharpen your Clojure Skillz by checking out some of the materials below, esp. the [4clojure][192] puzzles are a great way of learning. + +### Further reading & references + ++ Clojure mailing list - main community discussion (~8600 members) ++ clojure-doc.org - great community based collection of guides & tutorials aimed at all levels (incl. setup guides for various tools & platforms) ++ clojuredocs.org - community & example based reference for core Clojure namespaces & functions (learn by example) ++ Clojure cheatsheets - online & PDF versions, incl. ClojureScript ++ Stackoverflow - SO questions tagged w/ Clojure ++ Try Clojure - online playground REPL, no installation needed ++ 4clojure - online learning resource to solve Clojure puzzles of varying difficulties ++ Planet Clojure (Twitter) - Clojure blog aggregator ++ O'Reilly book - IMHO currently most comprehensive & accessible book ++ The Joy of Clojure - another great book, also touching more on the why & how of Clojure's philosophy ++ clojure-toolbox.com - curated list of Clojure projects, grouped by topic ++ clojuresphere.com - autogenerated list of Clojure projects on GitHub, incl. dependency info ++ clojars.org - community repository for open source Clojure libraries (main repo for Leiningen) ++ ClojureWerkz - growing collection of well maintained open source libraries (mainly DB centric projects) + + +-------------------------------------------------------------------------------- + +via: https://www.creativeapplications.net/tutorials/introduction-to-clojure-part-1/ + +作者:[Karsten Schmidt and Ricardo Sanchez][a] +选题:[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.creativeapplications.net/author/karstenricardo/ +[b]: https://github.com/lujun9972 +[1]: http://nardove.com/ +[2]: http://resonate.io/2013/education +[3]: http://postspectacular.com/ +[4]: http://www.lisperati.com/clojure-spels/casting.html +[5]: http://resonate.io/ +[6]: http://en.wiktionary.org/wiki/TLDR +[7]: http://clojure.org +[8]: http://en.wikipedia.org/wiki/Lisp_(programming_language) +[9]: http://en.wikipedia.org/wiki/Lambda_calculus +[10]: http://en.wikipedia.org/wiki/Alonzo_Church +[11]: http://www.erlang.org/ +[12]: http://fsharp.org/ +[13]: http://haskell.org +[14]: http://scala-lang.org +[15]: http://en.wikipedia.org/wiki/Functional_programming +[16]: http://steve-yegge.blogspot.co.uk/2006/03/execution-in-kingdom-of-nouns.html +[17]: http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html +[18]: http://en.wikipedia.org/wiki/Anonymous_function#C.2B.2B +[19]: http://en.wikipedia.org/wiki/Immutable_object +[20]: http://en.wikipedia.org/wiki/Lazy_evaluation +[21]: http://clojure.org/sequences +[22]: http://clojure.org/protocols +[23]: http://en.wikipedia.org/wiki/Multiple_dispatch +[24]: http://clojure.org/macros +[25]: http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html +[26]: http://clojure.org/concurrent_programming +[27]: http://thechangelog.com/rich-hickeys-greatest-hits/ +[28]: https://twitter.com/yoavrubin/status/226419931435130880 +[29]: http://thinkrelevance.com/blog/2009/10/19/the-case-for-clojure +[30]: https://github.com/clojure/clojurescript +[31]: https://github.com/clojure-android/lein-droid +[32]: https://github.com/halgari/mjolnir/ +[33]: http://en.wikipedia.org/wiki/Marmite +[34]: https://twitter.com/puredanger/status/313507982623268865 +[35]: http://en.wikipedia.org/wiki/S-expression +[36]: http://en.wikipedia.org/wiki/Brace_matching +[37]: https://github.com/jlr/rainbow-delimiters +[38]: https://www.youtube.com/watch?v=D6h5dFyyUX0 +[39]: http://leiningen.org +[40]: http://en.wikipedia.org/wiki/Leiningen_Versus_the_Ants +[41]: http://ant.apache.org +[42]: http://brew.sh/ +[43]: http://www.oracle.com/technetwork/java/javase/downloads/index.html +[44]: http://code.google.com/p/counterclockwise +[45]: http://clojure-doc.org +[46]: http://jruby.org/ +[47]: https://developer.mozilla.org/en/docs/Rhino +[48]: http://tryclj.com +[49]: http://en.wikipedia.org/wiki/Prefix_notation +[50]: http://en.wikipedia.org/wiki/Pythagorean_theorem +[51]: https://www.creativeapplications.net/wp-content/uploads/2013/12/hypot.png +[52]: http://www.haskell.org/ +[53]: http://en.wikipedia.org/wiki/Scheme_(programming_language) +[54]: http://en.wikipedia.org/wiki/Closure_(computer_science) +[55]: http://en.wikipedia.org/wiki/Monad_(functional_programming) +[56]: http://en.wikipedia.org/wiki/Scope_(computer_science#Lexical_scoping) +[57]: http://clojuredocs.org/clojure_core/clojure.core/let +[58]: http://en.wikipedia.org/wiki/Don't_Repeat_Yourself +[59]: http://www.cplusplus.com/doc/tutorial/namespaces/ +[60]: http://en.wikipedia.org/wiki/Java_package +[61]: http://docs.python.org/2/tutorial/modules.html +[62]: http://clojure.org/namespaces +[63]: https://www.creativeapplications.net/wp-content/uploads/2013/04/var.png +[64]: http://clojuredocs.org/clojure_core/clojure.core/def +[65]: http://clojure.github.io/clojure/clojure.core-api.html +[66]: http://clojuredocs.org/clojure_core/clojure.core/inc +[67]: http://clojuredocs.org/clojure_core/clojure.core/defn +[68]: http://clojure.org/java_interop +[69]: http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html +[70]: http://en.wikipedia.org/wiki/Hypotenuse +[71]: http://clojuredocs.org/clojure_core/clojure.core/fn +[72]: http://clojuredocs.org/clojure_core/clojure.core/str +[73]: http://en.wikipedia.org/wiki/Higher-order_function +[74]: http://rosettacode.org/wiki/Partial_function_application +[75]: http://en.wikipedia.org/wiki/Closure_(computer_programming) +[76]: http://clojuredocs.org/clojure_core/clojure.core/partial +[77]: http://en.wikipedia.org/wiki/Fail-fast +[78]: http://en.wikipedia.org/wiki/Design_by_contract +[79]: http://clojuredocs.org/clojure_core/clojure.core/string_q +[80]: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/ +[81]: http://ianrumford.github.io/blog/2012/11/17/first-take-on-contracts-in-clojure/ +[82]: http://clojuredocs.org/clojure_core/clojure.repl/doc +[83]: http://clojuredocs.org/clojure_core/clojure.core/meta +[84]: http://clojuredocs.org/clojure_core/clojure.core/with-meta +[85]: http://clojuredocs.org/clojure_core/clojure.core/alter-meta +[86]: http://clojure.org/metadata +[87]: http://clojure.org/java_interop#Java%20Interop-Type%20Hints +[88]: http://clojuredocs.org/clojure_core/clojure.core/and +[89]: http://clojuredocs.org/clojure_core/clojure.core/or +[90]: http://clojuredocs.org/clojure_core/clojure.core/not +[91]: http://clojuredocs.org/clojure_core/clojure.core/if +[92]: http://clojuredocs.org/clojure_core/clojure.core/when +[93]: http://clojuredocs.org/clojure_core/clojure.core/do +[94]: http://clojure.org/data_structures +[95]: http://clojuredocs.org/clojure_core/clojure.core/list +[96]: http://www.r-project.org/ +[97]: http://en.wikipedia.org/wiki/XSLT +[98]: http://en.wikipedia.org/wiki/PostScript +[99]: https://www.creativeapplications.net/wp-content/uploads/2013/12/quote.png +[100]: http://en.wikipedia.org/wiki/Metaprogramming +[101]: https://gist.github.com/stonegao/1335696 +[102]: http://www.packtpub.com/clojure-for-domain-specific-languages/book +[103]: http://en.wikipedia.org/wiki/Stack_(abstract_data_type) +[104]: http://clojuredocs.org/clojure_core/clojure.core/vector +[105]: http://en.wikipedia.org/wiki/Hash_table +[106]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects +[107]: http://clojuredocs.org/clojure_core/clojure.core/keyword +[108]: http://clojuredocs.org/clojure_core/clojure.core/hash-map +[109]: http://en.wikipedia.org/wiki/JSON +[110]: http://clojuredocs.org/clojure_core/clojure.core/get-in +[111]: http://clojuredocs.org/clojure_core/clojure.core/select-keys +[112]: http://en.wikipedia.org/wiki/Set_theory +[113]: http://clojuredocs.org/clojure_core/clojure.core/set +[114]: http://clojuredocs.org/clojure_core/clojure.core/into +[115]: https://www.creativeapplications.net/wp-content/uploads/2013/12/socialgraph.png +[116]: http://clojuredocs.org/clojure_core/clojure.core/nil_q +[117]: http://en.wikipedia.org/wiki/Polymorphism_(computer_science) +[118]: http://clojuredocs.org/clojure_core/clojure.core/conj +[119]: http://clojuredocs.org/clojure_core/clojure.core/assoc +[120]: http://clojuredocs.org/clojure_core/clojure.core/assoc-in +[121]: http://clojuredocs.org/clojure_core/clojure.core/update-in +[122]: http://clojuredocs.org/clojure_core/clojure.core/dissoc +[123]: http://clojuredocs.org/clojure_core/clojure.core/disj +[124]: http://clojuredocs.org/clojure_core/clojure.core/pop +[125]: http://en.wikipedia.org/wiki/Persistent_data_structure +[126]: http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf +[127]: https://www.creativeapplications.net/wp-content/uploads/2013/04/persistent.png +[128]: http://clojuredocs.org/clojure_core/clojure.core/seq +[129]: http://clojuredocs.org/clojure_core/clojure.core/first +[130]: http://clojuredocs.org/clojure_core/clojure.core/next +[131]: http://clojuredocs.org/clojure_core/clojure.core/cons +[132]: https://www.creativeapplications.net/wp-content/uploads/2013/12/first-rest.png +[133]: http://clojuredocs.org/clojure_core/clojure.core/loop +[134]: http://clojuredocs.org/clojure_core/clojure.core/reverse +[135]: http://clojuredocs.org/clojure_core/clojure.core/recur +[136]: http://en.wikipedia.org/wiki/Tail_recursion +[137]: http://clojuredocs.org/clojure_core/clojure.core/doseq +[138]: http://clojuredocs.org/clojure_core/clojure.core/last +[139]: http://clojuredocs.org/clojure_core/clojure.core/dotimes +[140]: http://en.wikipedia.org/wiki/Referential_transparency_(computer_science) +[141]: http://en.wikipedia.org/wiki/Idempotence +[142]: http://en.wikipedia.org/wiki/Memoization +[143]: http://clojuredocs.org/clojure_core/clojure.core/memoize +[144]: http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#sleep(long) +[145]: http://research.google.com/archive/mapreduce.html +[146]: http://en.wikipedia.org/wiki/Map_Reduce +[147]: http://couchdb.apache.org +[148]: http://www.mongodb.org/ +[149]: http://basho.com/riak/ +[150]: http://en.wikipedia.org/wiki/Apache_Hadoop +[151]: http://clojuredocs.org/clojure_core/clojure.core/map +[152]: https://www.creativeapplications.net/wp-content/uploads/2013/04/map.png +[153]: https://www.creativeapplications.net/wp-content/uploads/2013/12/map-builder-640x259.png +[154]: http://clojuredocs.org/clojure_core/clojure.core/reduce +[155]: http://clojuredocs.org/clojure_core/clojure.core/reductions +[156]: http://clojuredocs.org/clojure_core/clojure.core/range +[157]: https://www.creativeapplications.net/wp-content/uploads/2013/12/reduce-sum.png +[158]: http://clojuredocs.org/clojure_core/clojure.core/filter +[159]: http://clojuredocs.org/clojure_core/clojure.core/even_q +[160]: https://www.creativeapplications.net/wp-content/uploads/2013/12/filter-640x54.png +[161]: http://clojuredocs.org/clojure_core/clojure.core/take +[162]: http://clojuredocs.org/clojure_core/clojure.core/drop +[163]: http://clojuredocs.org/clojure_core/clojure.core/take-last +[164]: http://clojuredocs.org/clojure_core/clojure.core/drop-last +[165]: http://clojuredocs.org/clojure_core/clojure.core/butlast +[166]: http://clojuredocs.org/clojure_core/clojure.core/take-nth +[167]: http://clojuredocs.org/clojure_core/clojure.core/take-while +[168]: http://clojuredocs.org/clojure_core/clojure.core/drop-while +[169]: http://clojuredocs.org/clojure_core/clojure.core/concat +[170]: http://clojuredocs.org/clojure_core/clojure.core/mapcat +[171]: http://clojuredocs.org/clojure_core/clojure.core/identity +[172]: http://clojuredocs.org/clojure_core/clojure.core/frequencies +[173]: http://en.wikipedia.org/wiki/Histogram +[174]: http://clojuredocs.org/clojure_core/clojure.core/cycle +[175]: http://clojuredocs.org/clojure_core/clojure.core/repeat +[176]: http://clojuredocs.org/clojure_core/clojure.core/repeatedly +[177]: http://clojuredocs.org/clojure_core/clojure.core/iterate +[178]: http://clojuredocs.org/clojure_core/clojure.core/interleave +[179]: http://clojuredocs.org/clojure_core/clojure.core/interpose +[180]: http://clojuredocs.org/clojure_core/clojure.core/zipmap +[181]: http://en.wikipedia.org/wiki/Roman_numerals +[182]: http://clojuredocs.org/clojure_core/clojure.core/for +[183]: http://en.wikipedia.org/wiki/List_comprehension +[184]: http://clojuredocs.org/clojure_core/clojure.core/every_q +[185]: http://clojuredocs.org/clojure_core/clojure.core/rem +[186]: http://clojuredocs.org/clojure_core/clojure.core/some +[187]: http://en.wikipedia.org/wiki/Magnitude_(vector) +[188]: http://clojuredocs.org/clojure_core/clojure.core/apply +[189]: http://blog.jayfields.com/2010/07/clojure-destructuring.html +[190]: https://github.com/quil/quil +[191]: http://processing.org +[192]: http://www.4clojure.com/ From 0ee0364ad74cdfb2b04d0e6fadcf296c201040a8 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 19:52:21 +0800 Subject: [PATCH 0024/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20My=20Google-fre?= =?UTF-8?q?e=20Android=20life?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181108 My Google-free Android life.md | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 sources/tech/20181108 My Google-free Android life.md diff --git a/sources/tech/20181108 My Google-free Android life.md b/sources/tech/20181108 My Google-free Android life.md new file mode 100644 index 0000000000..4e94af0de8 --- /dev/null +++ b/sources/tech/20181108 My Google-free Android life.md @@ -0,0 +1,191 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Google-free Android life) +[#]: via: (https://lushka.al/my-android-setup/) +[#]: author: (Anxhelo Lushka https://lushka.al/) + +My Google-free Android life +====== + +People have been asking me a lot lately about my phone, my Android setup and how I manage to use my smartphone without Google Services. Well, this is a post that aims to address precisely that. I would like to make this article really beginner-friendly so I’ll try to go slow, going through things one by one and including screenshots so you can have a better view on how things happen and work like. + +At first I’ll start with why Google Services are (imo) bad for your device. I could cut it short and guide you to this [post][1] by [Richard Stallman][2], but I’m grabbing a few main points from it and adding them here. + + * Nonfree software required + * In general, most Google services require running nonfree Javascript code. Nowadays, nothing whatsoever appears if Javascript is disabled, even making a Google account requires running nonfree software (Javascript sent by the site), same thing for logging in. + * Surveillance + * Google quietly combines its ad-tracking profiles with its browsing profiles and stores a huge amount of data on each user. + * Terms of Service + * Google cuts off accounts for users that resell Pixel phones. They lose access to all of their mail and documents stored in Google servers under that account. + * Censorship + * Amazon and Google have cut off domain-fronting, a feature used to enable people in tyrannical countries to reach communication systems that are banned there. + * Google has agreed to perform special censorship of Youtube for the government of Pakistan, deleting views that the state opposes. This will help the illiberal Pakistani state suppress dissent. + * Youtube’s “content ID” automatically deletes posted videos in a way copyright law does not require. + + + +These are just a few reasons, but you can read the post by RMS I linked above in which he tries to explain these points in detail. Although it may look like a tinfoil hat reaction to you, all these actions already happen everyday in real life. + +### Next on the list, my setup and a tutorial on how I achieved it + +I own a **[Xiaomi Redmi Note 5 Pro][3]** smartphone (codename **whyred** ), produced in China by [Xiaomi][4], which I bought for around 185 EUR 4 months ago (from the time of writing this post). + +Now you might be thinking, ‘but why did you buy a Chinese brand, they are not reliable’. Yes, it is not made from the usuals as you would expect, such as Samsung (which people often associate with Android, which is plain wrong), OnePlus, Nokia etc, but you should know almost every phone is produced in China. + +There were a few reasons I chose this phone, first one of course being the price. It is a quite **budget-friendly** device, so most people are able to afford it. Next one would be the specs, which on paper (not only) are pretty decents for the price tag. With a 6 inch screen (Full HD resolution), a **4000 mAh battery** (superb battery life), 4GB of RAM, 64GB of storage, dual back cameras (12MP + 5MP), a front camera with flash (13MP) and a decent efficient Snapdragon 636, it was probably the best choice at that moment. + +The issue with it was that it came with [MIUI][5], the Android skin that Xiaomi ships with most of its devices (except the Android One project devices). Yes, it is not that horrible, it has some extra features, but the problems lie deeper within. One of the reasons these devices from Xiaomi are so cheap (afaik they only have 5-10% win margin from sales) is that **they include data mining and ads in the system altogether with MIUI**. In this way, the system apps requires extra unnecessary permissions that mine your data and bombard you with ads, from which Xiaomi earns money. + +Funnily enough, the Weather app included wanted access to my contacts and to make calls, why would it need that if it would just show the weather? Another case was with the Recorder app, it also required contacts and internet permissions, probably to send those recordings back to Xiaomi. + +To fix this, I’d have to format the phone and get rid of MIUI. This has become increasingly difficult with the latest phones in the market. + +The concept of formatting a phone is simple, you remove the existing system and install a new one of your preference (Android-only in this case). To do that, you have to have your [bootloader][6] unlocked. + +> A bootloader is a computer program that loads an operating system (OS) or runtime environment for the computer after completion of the self-tests. — [Wikipedia][7] + +The problem here is that Xiaomi has a specific policy about the bootloader unlocking. A few months ago, the process was like this. You would have to [make a request][8] to Xiaomi to obtain an unlock code for your phone, by giving a valid reason, but this would not always work, as they could just refuse your request without reason and explanation. + +Now, that process has changed. You’ll have to download a specific software from Xiaomi, called [Mi Unlock][9], install it in your Windows PC, [activate Debugging Settings in Developer Options][10] on your phone, reboot to the bootloader mode (by holding the Volume Down + Power button while the phone is off) and connect the phone to your computer to start a process called “Approval”. This process starts a timer on the Xiaomi servers that will allow you to **unlock the phone only after a period of 15 days** (or a month in some rare cases, totally random) goes by. + +![Mi Unlock app][11] + +After this period of 15 days has passed, you have to re-connect your phone and do the same procedure as above, then by pressing the Unlock button your bootloader will be unlocked and this will allow you to install other ROM-s (systems). **Careful, make sure to backup your data because unlocking the bootloader deletes everything in the phone**. + +The next step would be finding a system ([ROM][12]) that works for your device. I searched through the [XDA Developers Forum][13], which is a place where Android developers and users exchange ideas, apps etc. Fortunately, my phone is quite popular so it had [its own forum category][14]. There, I skimmed through some popular ROM-s for my device and decided to use the [AOSiP ROM][15] (AOSiP standing for Android Open Source illusion Project). + +**EDIT** : Someone emailed me to say that my article is exactly what [/e/][16] does and is targeted to. I wanted to say thank you for reaching out but that is not true at all. The reasoning behind my opinion about /e/ can also be found in this [website][17], but I’ll list a few of the reasons here. + +eelo is a “foundation” that got over 200K € in funding from Kickstarter and IndieGoGo, promising to create a mobile OS and web services that are open and secure and protect your privacy. + + 1. Their OS is based on LineageOS 14.1 (Android 7.1) with microG and other open source apps with it, which already exists for a long time now and it’s called [Lineage for microG][18]. + 2. Instead of building all apps from the source code, they download the APKs from [APKPure][19] and put them in the ROM, without knowing if those APKs contain proprietary code/malware in them. + 3. At one point, they were literally just removing the Lineage copyright header from their code and adding theirs. + 4. They love to delete negative feedback and censor their users’ opinions in their Telegram group chat. + + + +In conclusion, I **don’t recommend using /e/** ROM-s (at least until now). + +Another thing you would likely want to do is have [root access][20] to your phone, to make it truly yours and modify files in the system, such as use a system-wide adblocker etc. To do this, I decided to use [Magisk][21], a godsend app developed by a student to help you gain root access on your device and install what are called [modules][22], basically software. + +After downloading the ROM and Magisk, I had to install them on my phone. To do that, I moved the files to my SD card on the phone. Now, to install the system, I had to use something called a [recovery system][23]. The one I use is called [TWRP][24] (standing for TeamWin Recovery Project), a popular solution. + +To install the recovery system (sounds hard, I know), I had to [flash][20] the file on the phone. To do that, I connected my phone with the computer (Fedora Linux system) and with something called [ADB Tools][25] I issued a command that overwrites the system recovery with the custom one I had. + +> fastboot flash recovery twrp.img + +After this was done, I turned off the phone and kept Volume Up + Power button pressed until I saw the TWRP screen show up. That meant I was good to go and it was ready to receive my commands. + +![TWRP screen][26] + +Next step was to **issue a Wipe command** , necessary when you first install a custom ROM on your phone. As you can see from the image above, the Wipe command clears the Data, Cache and Dalvik (there is also an advanced option that allows us to tick a box to delete the System one too, as we don’t need the old one anymore). + +This takes a few moments and after that, your phone is basically clean. Now it’s time to **install the system**. By pressing the Install button on the main screen, we select the zip file we added there before (the ROM file) and swipe the screen to install it. Next, we have to install Magisk, which gives us root access to the device. + +**EDIT** : As some more experienced/power Android users might have noticed until now, there is no [GApps][27] (Google Apps) included. This is what we call GApps-less in the Android world, not having those packages installed at all. + +Note that one of the downsides of not having Google Services installed is that some of your apps might not work, for example their notifications might take longer to arrive or might not even work at all (this is what happens with Mattermost app for me). This happens because these apps use [Google Cloud Messaging][28] (now called [Firebase][29]) to wake the phone and push notifications to your phone. + +You can solve this (partially) by installing and using [microG][30] which provides some features of Google Services but allows for more control on your side. I don’t recommend using this because it still helps Google Services and you don’t really give up on them, but it’s a good start if you want to quit Google slowly and not go cold turkey on it. + +After successfully installing both, now we reboot the phone and **tada** 🎉, we are in the main screen. + +### Next part, installing the apps and configuring everything + +This is where things start to get easier. To install the apps, I use [F-Droid][31], an alternative app store that includes **only free and open source apps**. If you need apps that are not available there, you can use [Aurora Store][32], a client to download apps from the Play Store without using your Google account or getting tracked. + +F-Droid has what are called repos, a “storehouse” that contains apps you can install. I use the default ones and have added another one from [IzzyOnDroid][33], that contains some more apps not available from the default F-Droid repo and is updated more often. + +![My repos][34] + +Below you will find a list of the apps I have installed, what they replace and their use. + +This is pretty much **my list of the most useful F-Droid apps** I use, but unfortunately these are NOT the only apps I use. The proprietary apps I use (I know, I might sound a hypocrite, but not everything is replaceable, not yet at least) are as below: + + * AliExpress + * Boost for Reddit + * Google Camera (coupled with Camera API 2, this app allows me to take wonderful pictures with a 185 EUR phone, it’s just too impressive) + * Instagram + * MediaBox HD (allows me to stream movies) + * Mi Fit (an app that pairs with my Mi Band 2) + * MyVodafoneAL (the carrier app) + * ProtonMail (email app) + * Shazam Encore (to find those songs you usually listen in coffee shops) + * Snapseed (photo editing app, really simple, powerful and quite good) + * Spotify (music streaming) + * Titanium Backup (to backup my app data, wifi passwords, calls log etc.) + * ViPER4Android FX (music equalizer) + * VSCO (photo editing, never use it really) + * WhatsApp (E2E proprietary messaging app, almost everyone I know has it) + * WiFi Map (mapped hotspots that are available, handy when abroad) + + + +This is pretty much it, all the apps I use on my phone. **The configs are then pretty simple and straightforward and I can give a few tips**. + + 1. Read and check the permissions of apps carefully, don’t click ‘Install’ mindlessly. + 2. Try to use as many open source apps as possible, they both respect your privacy and are free (as in both free beer and freedom). + 3. Use a VPN as much as you can, find a reputable one and don’t use free ones, otherwise you get to be the product and you’ll get your data harvested. + 4. Don’t keep your WiFi/mobile data/location on all the time, it might be a security risk. + 5. Try not to rely on fingerprint unlock only, or better yet use only PIN/password/pattern unlock, as biometric data can be cloned and used against you, for example to unlock your phone and steal your data. + + + +And as a bonus for reading far down here, **a screenshot of my home screen** right now. + +![Screenshot][35] + + +-------------------------------------------------------------------------------- + +via: https://lushka.al/my-android-setup/ + +作者:[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://stallman.org/google.html +[2]: https://en.wikipedia.org/wiki/Richard_Stallman +[3]: https://www.gsmarena.com/xiaomi_redmi_note_5_pro-8893.php +[4]: https://en.wikipedia.org/wiki/Xiaomi +[5]: https://en.wikipedia.org/wiki/MIUI +[6]: https://forum.xda-developers.com/wiki/Bootloader +[7]: https://en.wikipedia.org/wiki/Booting +[8]: https://en.miui.com/unlock/ +[9]: http://www.miui.com/unlock/apply.php +[10]: https://www.youtube.com/watch?v=7zhEsJlivFA +[11]: https://lushka.al//assets/img/posts/mi-unlock.png +[12]: https://www.xda-developers.com/what-is-custom-rom-android/ +[13]: https://forum.xda-developers.com/ +[14]: https://forum.xda-developers.com/redmi-note-5-pro +[15]: https://forum.xda-developers.com/redmi-note-5-pro/development/rom-aosip-8-1-t3804473 +[16]: https://e.foundation +[17]: https://ewwlo.xyz/evil +[18]: https://lineage.microg.org/ +[19]: https://apkpure.com/ +[20]: https://lifehacker.com/5789397/the-always-up-to-date-guide-to-rooting-any-android-phone +[21]: https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445 +[22]: https://forum.xda-developers.com/apps/magisk +[23]: http://www.smartmobilephonesolutions.com/content/android-system-recovery +[24]: https://dl.twrp.me/whyred/ +[25]: https://developer.android.com/studio/command-line/adb +[26]: https://lushka.al//assets/img/posts/android-twrp.png +[27]: https://opengapps.org/ +[28]: https://developers.google.com/cloud-messaging/ +[29]: https://firebase.google.com/docs/cloud-messaging/ +[30]: https://microg.org/ +[31]: https://f-droid.org/ +[32]: https://f-droid.org/en/packages/com.dragons.aurora/ +[33]: https://android.izzysoft.de/repo +[34]: https://lushka.al//assets/img/posts/android-fdroid-repos.jpg +[35]: https://lushka.al//assets/img/posts/android-screenshot.jpg +[36]: https://creativecommons.org/licenses/by-nc-sa/4.0/ From 60b2a73f87f45ed094e37b26f55a0f4c65c5818c Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 20:11:20 +0800 Subject: [PATCH 0025/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Plan=20your=20o?= =?UTF-8?q?wn=20holiday=20calendar=20at=20the=20Linux=20command=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...iday calendar at the Linux command line.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md diff --git a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md new file mode 100644 index 0000000000..b4d6f58b32 --- /dev/null +++ b/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Plan your own holiday calendar at the Linux command line) +[#]: via: (https://opensource.com/article/18/12/linux-toy-cal) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Plan your own holiday calendar at the Linux command line +====== +Link commands together to build a colorful calendar, and then whisk it away in a snowstorm. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cal.png?itok=S0F8RY9k) + +Welcome to today's installment of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game or any simple diversion that helps you have fun at the terminal. + +It's quite possible that some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. + +We've somehow made it to the seventh day of our series without creating an actual calendar to celebrate with, so let's use a command-line tool to do that today: **cal**. By itself, **cal** is perhaps not the most amazing of tools, but we can use a few other utilities to spice it up a bit. + +Chances are, **cal** is installed on your system already. To use it in this instance, just type **cal**. + +``` +$ cal +    December 2018   +Su Mo Tu We Th Fr Sa +                   1 + 2  3  4  5  6  7  8 + 9 10 11 12 13 14 15 +16 17 18 19 20 21 22 +23 24 25 26 27 28 29 +30 31           +``` + +We aren't going to go into advanced usage in this article, so if you want to learn more about **cal** , go check out Opensource.com Community Moderator Don Watkin's excellent [overview of the date and cal commands][1]. + +Now, let's spice it up with a pretty box, as we covered in our previous Linux toy article. I'll use the diamonds box, and use a little bit of padding to get it nicely aligned. + +``` +$ cal | boxes -d diamonds -p a1l4t2  +       /\          /\          /\ +    /\//\\/\    /\//\\/\    /\//\\/\ + /\//\\\///\\/\//\\\///\\/\//\\\///\\/\ +//\\\//\/\\///\\\//\/\\///\\\//\/\\///\\ +\\//\/                            \/\\// + \/                                  \/ + /\           December 2018          /\ +//\\      Su Mo Tu We Th Fr Sa      //\\ +\\//                         1      \\// + \/        2  3  4  5  6  7  8       \/ + /\        9 10 11 12 13 14 15       /\ +//\\      16 17 18 19 20 21 22      //\\ +\\//      23 24 25 26 27 28 29      \\// + \/       30 31                      \/ + /\                                  /\ +//\\/\                            /\//\\ +\\///\\/\//\\\///\\/\//\\\///\\/\//\\\// + \/\\///\\\//\/\\///\\\//\/\\///\\\//\/ +    \/\\//\/    \/\\//\/    \/\\//\/ +       \/          \/          \/ +``` + +That looks nice, but for good measure, let's put the whole thing in a second box, just for fun. We'll use the scoll design this time. + +``` +cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll         + / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \ +|  /~~\                                              /~~\  | +|\ \   |         /\          /\          /\         |   / /| +| \   /|      /\//\\/\    /\//\\/\    /\//\\/\      |\   / | +|  ~~  |   /\//\\\///\\/\//\\\///\\/\//\\\///\\/\   |  ~~  | +|      |  //\\\//\/\\///\\\//\/\\///\\\//\/\\///\\  |      | +|      |  \\//\/                            \/\\//  |      | +|      |   \/                                  \/   |      | +|      |   /\          December 2018           /\   |      | +|      |  //\\     Su Mo Tu We Th Fr Sa       //\\  |      | +|      |  \\//                        1       \\//  |      | +|      |   \/       2  3  4  5  6  7  8        \/   |      | +|      |   /\       9 10 11 12 13 14 15        /\   |      | +|      |  //\\     16 17 18 19 20 21 22       //\\  |      | +|      |  \\//     23 24 25 26 27 28 29       \\//  |      | +|      |   \/      30 31                       \/   |      | +|      |   /\                                  /\   |      | +|      |  //\\/\                            /\//\\  |      | +|      |  \\///\\/\//\\\///\\/\//\\\///\\/\//\\\//  |      | +|      |   \/\\///\\\//\/\\///\\\//\/\\///\\\//\/   |      | +|      |      \/\\//\/    \/\\//\/    \/\\//\/      |      | +|      |         \/          \/          \/         |      | +|      |                                            |      | + \     |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|     / +  \   /                                              \   / +   ~~~                                                ~~~ +``` + +Perfect. Now, here's where things get a little crazy. I like our design, but, I'd like to go all out. So I'm going to colorize it. But here in the Raleigh, NC office where Opensource.com's staff are based, there's a good chance for snow this weekend. So let's enjoy our colorized advent calendar, and then wipe it out with snow. + +For the snow, I'm grabbing a nifty [snippet][2] of Bash and Gawk goodness I found over on CLIMagic. If you're not familiar with CLIMagic, go check out their [website][3] and follow them on [Twitter][4]. You'll be glad you did. + +So here we go. Let's clear the screen, throw up our boxy calendar, colorize it, wait a few seconds, then snowstorm it away. All here at the terminal, in one line. + +``` +$ clear;cal|boxes -d diamonds -p a1t2l3|boxes -a c -d scroll|lolcat;sleep 3;while :;do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS)) $(printf "\u2744\n");sleep 0.1;done|gawk '{a[$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH ",o,x;printf "\033[%s;%sH%s \033[0;0H",a[x],x,$4;}}' +``` + +And there we go. + +![](https://opensource.com/sites/default/files/uploads/linux-toy-cal-animated.gif) + +For this to work on your system, you'll need all of the referenced utilities (boxes, lolcat, cal, gawk, etc.), and you'll need to use a terminal emulator that supports Unicode. + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Take a break at the Linux command line with Nyan Cat][5], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-cal + +作者:[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/16/12/using-calendar-function-linux +[2]: http://climagic.org/coolstuff/let-it-snow.html +[3]: http://climagic.org/ +[4]: https://twitter.com/climagic +[5]: https://opensource.com/article/18/12/linux-toy-nyancat From ecc7245e561adf7b91a647b04a66bb5a27bab34b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 20:15:03 +0800 Subject: [PATCH 0026/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20YAML:=20probabl?= =?UTF-8?q?y=20not=20so=20great=20after=20all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7 YAML- probably not so great after all.md | 316 ++++++++++++++++++ 1 file changed, 316 insertions(+) create mode 100644 sources/tech/20171227 YAML- probably not so great after all.md diff --git a/sources/tech/20171227 YAML- probably not so great after all.md b/sources/tech/20171227 YAML- probably not so great after all.md new file mode 100644 index 0000000000..ed853ca697 --- /dev/null +++ b/sources/tech/20171227 YAML- probably not so great after all.md @@ -0,0 +1,316 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (YAML: probably not so great after all) +[#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +YAML: probably not so great after all +====== + + +I previously wrote [why using JSON for human-editable configuration files is a bad idea][1]. Today we’re going to look at some general problems with the YAML format. + +### Insecure by default + +YAML is insecure by default. Loading a user-provided (untrusted) YAML string needs careful consideration. + +``` +!!python/object/apply:os.system +args: ['ls /'] +``` + +Running it with `print(yaml.load(open('a.yaml')))` should give you something like: + +``` +bin etc lib lost+found opt root sbin tmp var sys +boot dev efi home lib64 mnt proc run srv usr +0 +``` + +Many other languages (including Ruby and PHP) are also unsafe by default. [Searching for `yaml.load` on GitHub][2] gives a whopping 2.8 million results. [`yaml.safe_load`][3] only gives 26,000 results. + +Mind you, many of those `yaml.load()`s are fine – loading in a config file with `yaml.load()` is often okay since it’s usually (though not always!) from a ‘trusted source’, and many are from test files with static YAML. But still, one can’t help but wonder how many exploits are hidden in those 2.8 million results. + +This is not a theoretical problem. In 2013 [every Ruby on Rails application ever written was found to be vulnerable][4] to remote code execution due to exactly this problem. + +One might argue this is not really the fault of the YAML format as such, but rather the fault of the libraries implementing it wrong, but it seems to be the case that the majority of libraries are unsafe by default (especially the dynamic languages), so de-facto it is a problem with YAML. + +One might also argue that fixing it is as easy as replacing `load()` with `safe_load()`, but many people are unaware of the problem, and even if you’re aware of it, it’s one of those things that can be easy to forget. It’s pretty bad API design. + +### Can be hard to edit, especially for large files + +YAML files can be hard to edit, and this difficulty grows fast as the file gets larger. + +A good example of this are Ruby on Rails’ translation files; for example: + +``` +en: + formtastic: + labels: + title: "Title" # Default global value + article: + body: "Article content" + post: + new: + title: "Choose a title..." + body: "Write something..." + edit: + title: "Edit title" + body: "Edit body" +``` + +This still looks okay, right? But what if this file has 100 lines? Or 1,000 lines? It is difficult to see “where” in the file you are because it may be off the screen. You’ll need to scroll up, but then you need to keep track of the indentation, which can be pretty hard even with indentation guides, especially since 2-space indentation is the norm and [tab indentation is forbidden][5]. + +And accidentally getting the indentation wrong often isn’t an error; it will often just deserialize to something you didn’t intend. Happy debugging! + +I’ve been happily programming Python for over a decade, so I’m used to significant whitespace, but sometimes I’m still struggling with YAML. In Python the drawbacks and loss of clarity are contained by not having functions that are several pages long, but data or configuration files have no such natural limits to their length. + +For small files this is not a problem; but it really doesn’t scale well to larger files, especially not if you want to edit them later on. + +### It’s pretty complex + +YAML may seem ‘simple’ and ‘obvious’ when glancing at a basic example, but turns out it’s not. The [YAML spec][6] is 23,449 words; for comparison, [TOML][7] is 3,339 words, [JSON][8] is 1,969 words, and [XML][9] is 20,603 words. + +Who among us have read all that? Who among us have read and understood all of that? Who among of have read, understood, and **remembered** all of that? + +For example did you know there are [nine ways to write a multi-line string in YAML][10] with subtly different behaviour? + +Yeah :-/ + +That post gets even more interesting if you look at [its revision history][11], as the author of the post discovers more and more ways to do this and more of the subtleties involved. + +It’s telling that the YAML spec starts with a preview, which states (emphases mine): + +> This section provides a quick glimpse into the expressive power of YAML. **It is not expected that the first-time reader grok all of the examples**. Rather, these selections are used as motivation for the remainder of the specification. + +#### Surprising behaviour + +What does this parse to (examples courtesy of [Colm O’Connor][12]): + +``` +- Don Corleone: Do you have faith in my judgment? +- Clemenza: Yes +- Don Corleone: Do I have your loyalty? +``` + +Yup! + +``` +[ + {'Don Corleone': 'Do you have faith in my judgment?'}, + {'Clemenza': True}, + {'Don Corleone': 'Do I have your loyalty?'} +] +``` + +Or what about: + +``` +python: 3.5.3 +postgres: 9.3 +``` + +`3.5.3` gets recognized as as string, but `9.3` gets recognized as a number instead of a string: + +``` +{'python': '3.5.3', 'postgres': 9.3} +``` + +Or what about: + +``` +Effenaar: Eindhoven +013: Tilburg +``` + +013 is a popular music Venue in Tilburg, but YAML will send you the wrong way since it’s parsed as an octal number: + +``` +{11: 'Tilburg', 'Effenaar': 'Eindhoven'} +``` + +All of this – and more – is why many experienced YAMLers will often quote all strings, even when it’s not strictly required. Many people don’t use quotes, and it can be easy to forget especially if the rest of the file – possibly written by other people – doesn’t use quotes. + +#### It’s not portable + +Because it’s so complex, its claims of portability have been greatly exaggerated. For example consider this example taken from the YAML spec: + +``` +? - Detroit Tigers + - Chicago cubs +: + - 2001-07-23 + +? [ New York Yankees, + Atlanta Braves ] +: [ 2001-07-02, 2001-08-12, + 2001-08-14 ] +``` + +Aside from the fact that most readers of this probably won’t even know what this does, try parsing it in Python with PyYAML: + +``` +yaml.constructor.ConstructorError: while constructing a mapping + in "a.yaml", line 1, column 1 +found unhashable key + in "a.yaml", line 1, column 3 +``` + +In Ruby it works: + +``` +{ + ["Detroit Tigers", "Chicago cubs"] => [ + # + ], + ["New York Yankees", "Atlanta Braves"] => [ + #, + #, + # + ] +} +``` + +The reason for this is because you can’t use a list as a dict key in Python: + +``` +>>> {['a']: 'zxc'} +Traceback (most recent call last): + File "", line 1, in + TypeError: unhashable type: 'list' +``` + +And this restriction is not unique to Python; common languages such as PHP, JavaScript, and Go all share this restriction. + +So use this in a YAML file, and you won’t be able to read it in most languages. + +Here’s another example again taken from the examples section of the YAML spec: + +``` +# Ranking of 1998 home runs +--- +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +# Team ranking +--- +- Chicago Cubs +- St Louis Cardinals +``` + +Python says: + +``` +yaml.composer.ComposerError: expected a single document in the stream + in "a.yaml", line 3, column 1 +but found another document + in "a.yaml", line 8, column 1 +``` + +While Ruby outputs: + +``` +["Mark McGwire", "Sammy Sosa", "Ken Griffey"] +``` + +The reason for this is that there are multiple YAML documents in a single file (`---` start the document). In Python there is the `load_all()` function to parse all documents. Ruby’s `load()` just loads the first document, and as near as I can tell, doesn’t have a way to load multiple documents. + +There are [many more incompatibilities between implementations][13]. + +### Goals achieved? + +The spec states: + +> The design goals for YAML are, in decreasing priority: +> +> 1. YAML is easily readable by humans. +> 2. YAML data is portable between programming languages. +> 3. YAML matches the native data structures of agile languages. +> 4. YAML has a consistent model to support generic tools. +> 5. YAML supports one-pass processing. +> 6. YAML is expressive and extensible. +> 7. YAML is easy to implement and use. +> + + +So how well does it do? + +> YAML is easily readable by humans. + +True only if you stick to a small subset. The full set is complex – much more so than XML or JSON. + +> YAML data is portable between programming languages. + +Not really true, as it’s too easy to create constructs that are not supported by common languages. + +> YAML matches the native data structures of agile languages. + +See above. Plus, why only support agile (or dynamic) languages? What about other languages? + +> YAML has a consistent model to support generic tools. + +I am not even sure what this means and I can’t find any elaboration. + +> YAML supports one-pass processing. + +I’ll take their word for it. + +> YAML is expressive and extensible. + +Well, it is, but it’s too expressive (e.g. too complex). + +> YAML is easy to implement and use. + +``` +$ cat `ls -1 ~/gocode/src/github.com/go-yaml/yaml/*.go | grep -v _test` | wc -l +9247 + +$ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l +5713 +``` + +### Conclusion + +Don’t get me wrong, it’s not like YAML is absolutely terrible – it’s certainly not as [problematic as using JSON][1] – but it’s not exactly great either. There are some drawbacks and surprises that are not at all obvious at first, and there are a number of better alternatives such as [TOML][7] and other more specialized formats. + +Personally, I’m not likely to use it again when I’ve got a choice. + +If you must use YAML then I recommend you use [StrictYAML][14], which removes some (though not all) of the more hairy parts. + +### Feedback + +You can mail me at [martin@arp242.net][15] or [create a GitHub issue][16] for feedback, questions, etc. + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/yaml_probably_not_so_great_after_all.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]: http://arp242.net/weblog/JSON_as_configuration_files-_please_dont.html +[2]: https://github.com/search?q=yaml.load&type=Code&utf8=%E2%9C%93 +[3]: https://github.com/search?q=yaml.safe_load&type=Code&utf8=%E2%9C%93 +[4]: https://www.sitepoint.com/anatomy-of-an-exploit-an-in-depth-look-at-the-rails-yaml-vulnerability/ +[5]: http://www.yaml.org/faq.html +[6]: http://yaml.org/spec/1.2/spec.pdf +[7]: https://github.com/toml-lang/toml +[8]: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf +[9]: https://www.w3.org/TR/REC-xml/ +[10]: http://stackoverflow.com/a/21699210/660921 +[11]: http://stackoverflow.com/posts/21699210/revisions +[12]: https://github.com/crdoconnor/strictyaml/blob/master/FAQ.rst#what-is-wrong-with-implicit-typing +[13]: https://github.com/cblp/yaml-sucks +[14]: https://github.com/crdoconnor/strictyaml +[15]: mailto:martin@arp242.net +[16]: https://github.com/Carpetsmoker/arp242.net/issues/new From dcfa796e87ce019f240efe2d3c48c07378e7dccf Mon Sep 17 00:00:00 2001 From: seriouszyx <674965440@qq.com> Date: Mon, 10 Dec 2018 20:22:22 +0800 Subject: [PATCH 0027/4278] seriouszyx translating --- .../talk/20181127 What the open source community means to me.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20181127 What the open source community means to me.md b/sources/talk/20181127 What the open source community means to me.md index bdb43bf20c..ec4d8f7a6d 100644 --- a/sources/talk/20181127 What the open source community means to me.md +++ b/sources/talk/20181127 What the open source community means to me.md @@ -1,3 +1,5 @@ +translating by seriouszyx + [#]: collector: (lujun9972) [#]: translator: ( ) [#]: reviewer: ( ) From 993416994a0eccd03db7b9a8d4d80d448aaaafba Mon Sep 17 00:00:00 2001 From: FelixYFZ <33593534+FelixYFZ@users.noreply.github.com> Date: Mon, 10 Dec 2018 20:41:47 +0800 Subject: [PATCH 0028/4278] Delete 20180326 Manage your workstation with Ansible- Automating configuration.md --- ... with Ansible- Automating configuration.md | 236 ------------------ 1 file changed, 236 deletions(-) delete mode 100644 sources/tech/20180326 Manage your workstation with Ansible- Automating configuration.md diff --git a/sources/tech/20180326 Manage your workstation with Ansible- Automating configuration.md b/sources/tech/20180326 Manage your workstation with Ansible- Automating configuration.md deleted file mode 100644 index b504b48ae0..0000000000 --- a/sources/tech/20180326 Manage your workstation with Ansible- Automating configuration.md +++ /dev/null @@ -1,236 +0,0 @@ -Manage your workstation with Ansible: Automating configuration Translating By FelixYFZ -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/robot_arm_artificial_ai.png?itok=8CUU3U_7) -Ansible is an amazing automation and configuration management tool. It is mainly used for servers and cloud deployments, and it gets far less attention for its use in workstations, both desktops and laptops, which is the focus of this series. - -In the [first part][1] of this series, I showed you basic usage of the `ansible-pull` command, and we created a playbook that installs a handful of packages. That wasn't extremely useful by itself, but it set the stage for further automation. - -In this article, everything comes together full circle, and by the end we will have a fully working solution for automating workstation configuration. This time, we'll set up our Ansible configuration such that future changes we make will automatically be applied to our workstations. At this point, I'm assuming you already worked through part one. If you haven't, feel free to do that now and then return to this article when you're done. You should already have a GitHub repository with the code from the first article inside it. We're going to build directly on what we did before. - -First, we need to do some reorganization because we're going to do more than just install packages. At this point, we currently have a playbook named `local.yml` with the following content: -``` -- hosts: localhost - -  become: true - -  tasks: - -  - name: Install packages - -    apt: name={{item}} - -    with_items: - -      - htop - -      - mc - -      - tmux - -``` - -That's all well and good if we only want to perform one task. As we add new things to our configuration, this file will become quite large and get very cluttered. It's better to organize our plays into individual files with each responsible for a different type of configuration. To achieve this, create what's called a taskbook, which is very much like a playbook but the contents are more streamlined. Let's create a directory for our taskbooks inside our Git repository: -``` -mkdir tasks - -``` - -The code inside our current `local.yml` playbook lends itself well to become a taskbook for installing packages. Let's move this file into the `tasks` directory we just created with a new name: -``` -mv local.yml tasks/packages.yml - -``` - -Now, we can edit our `packages.yml` taskbook and strip it down quite a bit. In fact, we can strip everything except for the individual task itself. Let's make `packages.yml` look like this: -``` -- name: Install packages - -  apt: name={{item}} - -  with_items: - -    - htop - -    - mc - -    - tmux - -``` - -As you can see, it uses the same syntax, but we stripped out everything that isn't necessary to the task it's performing. Now we have a dedicated taskbook for installing packages. However, we still need a file named `local.yml`, since `ansible-pull` still expects to find a file with that name. So we'll create a fresh one with this content in the root of our repository (not in the `tasks` directory): -``` -- hosts: localhost - -  become: true - -  pre_tasks: - -    - name: update repositories - -      apt: update_cache=yes - -      changed_when: False - - - -  tasks: - -    - include: tasks/packages.yml - -``` - -This new `local.yml` acts as an index that will import all our taskbooks. I've added a few new things to this file that you haven't seen yet in this series. First, at the beginning of the file, I added `pre_tasks`, which allows us to have Ansible perform a task before all the other tasks run. In this case, we're telling Ansible to update our distribution's repository index. This line does that for us: -``` -apt: update_cache=yes - -``` - -Normally the `apt` module allows us to install packages, but we can also tell it to update our repository index. The idea is that we want all our individual plays to work with a fresh index each time Ansible runs. This will help ensure we don't have an issue with a stale index while attempting to install a package. Note that the `apt` module works only with Debian, Ubuntu, and their derivatives. If you're running a different distribution, you'll want to use a module specific to your distribution rather than `apt`. See the documentation for Ansible if you need to use a different module. - -The following line is also worth further explanation: -``` -changed_when: False - -``` - -This line on an individual task stops Ansible from reporting the results of the play as changed even when it results in a change in the system. In this case, we don't care if the repository index contains new data; it almost always will, since repositories are always changing. We don't care about changes to `apt` repositories, as index changes are par for the course. If we omit this line, we'll see the summary at the end of the process report that something has changed, even if it was merely about the repository being updated. It's better to ignore these types of changes. - -Next is our normal tasks section, and we import the taskbook we created. Each time we add another taskbook, we add another line here: -``` -tasks: - -  - include: tasks/packages.yml - -``` - -If you were to run the `ansible-pull` command here, it should essentially do the same thing as it did in the last article. The difference is that we have improved our organization and we can more efficiently expand on it. The `ansible-pull` command syntax, to save you from finding the previous article, is this: -``` -sudo ansible-pull -U https://github.com//ansible.git - -``` - -If you recall, the `ansible-pull` command pulls down a Git repository and applies the configuration it contains. - -Now that our foundation is in place, we can expand upon our Ansible config and add features. Specifically, we'll add configuration to automate the deployment of future changes to our workstations. To support this goal, the first thing we should do is to create a user specifically to apply our Ansible configuration. This isn't required—we can continue to run our Ansible configuration under our own user. But using a separate user segregates this to a system process that will run in the background, without our involvement. - -We could create this user with the normal method, but since we're using Ansible, we should shy away from manual changes. Instead, we'll create a taskbook to handle user creation. This taskbook will create just one user for now, but you can always add additional plays to this taskbook to add additional users. I'll call this user `ansible`, but you can name it something else if you wish (if you do, make sure to update all occurrences). Let's create a taskbook named `users.yml` and place this code inside of it: -``` -- name: create ansible user - -  user: name=ansible uid=900 - -``` - -Next, we need to edit our `local.yml` file and append this new taskbook to the file, so it will look like this: -``` -- hosts: localhost - -  become: true - -  pre_tasks: - -    - name: update repositories - -      apt: update_cache=yes - -      changed_when: False - - - -  tasks: - -    - include: tasks/users.yml - -    - include: tasks/packages.yml - -``` - -Now when we run our `ansible-pull` command, a user named `ansible` will be created on the system. Note that I specifically declared `User ID 900` for this user by using the `UID` option. This isn't required, but it's recommended. The reason is that UIDs under 1,000 are typically not shown on the login screen, which is great because there's no reason we would need to log into a desktop session as our `ansible` user. UID 900 is arbitrary; it should be any number under 1,000 that's not already in use. You can find out if UID 900 is in use on your system with the following command: -``` -cat /etc/passwd |grep 900 - -``` - -However, you shouldn't run into a problem with this UID because I've never seen it used by default in any distribution I've used so far. - -Now, we have an `ansible` user that will later be used to apply our Ansible configuration automatically. Next, we can create the actual cron job that will be used to automate this. Rather than place this in the `users.yml` taskbook we just created, we should separate this into its own file. Create a taskbook named `cron.yml` in the tasks directory and place the following code inside: -``` -- name: install cron job (ansible-pull) - -  cron: user="ansible" name="ansible provision" minute="*/10" job="/usr/bin/ansible-pull -o -U https://github.com//ansible.git > /dev/null" - -``` - -The syntax for the cron module should be fairly self-explanatory. With this play, we're creating a cron job to be run as the `ansible` user. The job will execute every 10 minutes, and the command it will execute is this: -``` -/usr/bin/ansible-pull -o -U https://github.com//ansible.git > /dev/null - -``` - -Also, we can put additional cron jobs we want all our workstations to have into this one file. We just need to add additional plays to add new cron jobs. However, simply adding a new taskbook for cron isn't enough—we'll also need to add it to our `local.yml` file so it will be called. Place the following line with the other includes: -``` -- include: tasks/cron.yml - -``` - -Now when `ansible-pull` is run, it will set up a new cron job that will be run as the `ansible` user every 10 minutes. But, having an Ansible job running every 10 minutes isn't ideal because it will take considerable CPU power. It really doesn't make sense for Ansible to run every 10 minutes unless we've changed something in the Git repository. - -However, we've already solved this problem. Notice the `-o` option I added to the `ansible-pull` command in the cron job that we've never used before. This option tells Ansible to run only if the repository has changed since the last time `ansible-pull` was called. If the repository hasn't changed, it won't do anything. This way, you're not wasting valuable CPU for no reason. Sure, some CPU will be used when it pulls down the repository, but not nearly as much as it would use if it were applying your entire configuration all over again. When `ansible-pull` does run, it will go through all the tasks in the Playbook and taskbooks, but at least it won't run for no purpose. - -Although we've added all the required components to automate `ansible-pull`, it actually won't work properly yet. The `ansible-pull` command will run with `sudo`, which would give it access to perform system-level commands. However, our `ansible` user is not set up to perform tasks as `sudo`. Therefore, when the cron job triggers, it will fail. Normally we could just use `visudo` and manually set the `ansible` user up to have this access. However, we should do things the Ansible way from now on, and this is a great opportunity to show you how the `copy` module works. The `copy` module allows you to copy a file from your Ansible repository to somewhere else in the filesystem. In our case, we'll copy a config file for `sudo` to `/etc/sudoers.d/` so that the `ansible` user can perform administrative tasks. - -Open up the `users.yml` taskbook, and add the following play to the bottom: -``` -- name: copy sudoers_ansible - -  copy: src=files/sudoers_ansible dest=/etc/sudoers.d/ansible owner=root group=root mode=0440 - -``` - -The `copy` module, as we can see, copies a file from our repository to somewhere else. In this case, we're grabbing a file named `sudoers_ansible` (which we will create shortly) and copying it to `/etc/sudoers.d/ansible` with `root` as the owner. - -Next, we need to create the file that we'll be copying. In the root of your Ansible repository, create a `files` directory:​ -``` -mkdir files - -``` - -Then, in the `files` directory we just created, create the `sudoers_ansible` file with the following content: -``` -ansible ALL=(ALL) NOPASSWD: ALL - -``` - -Creating a file in `/etc/sudoers.d`, like we're doing here, allows us to configure `sudo` for a specific user. Here we're allowing the `ansible` user full access to the system via `sudo` without a password prompt. This will allow `ansible-pull` to run as a background task without us needing to run it manually. - -Now, you can run `ansible-pull` again to pull down the latest changes: -``` -sudo ansible-pull -U https://github.com//ansible.git - -``` - -From this point forward, the cron job for `ansible-pull` will run every 10 minutes in the background and check your repository for changes. If it finds changes, it will run your playbook and apply your taskbooks. - -So now we have a fully working solution. When you first set up a new laptop or desktop, you'll run the `ansible-pull` command manually, but only the first time. From that point forward, the `ansible` user will take care of subsequent runs in the background. When you want to make a change to your workstation machines, you simply pull down your Git repository, make the changes, then push those changes back to the repository. Then, the next time the cron job fires on each machine, it will pull down those changes and apply them. You now only have to make changes once, and all your workstations will follow suit. This method may be a bit unconventional though. Normally, you'd have an `inventory` file with your machines listed and several roles each machine could be a member of. However, the `ansible-pull` method, as described in this article, is a very efficient way of managing workstation configuration. - -I have updated the code in my [GitHub repository][2] for this article, so feel free to browse the code there and check your syntax against mine. Also, I moved the code from the previous article into its own directory in that repository. - -In part 3, we'll close out the series by using Ansible to configure GNOME desktop settings. I'll show you how to set your wallpaper and lock screen, apply a desktop theme, and more. - -In the meantime, it's time for a little homework assignment. Most of us have configuration files we like to maintain for various applications we use. This could be configuration files for Bash, Vim, or whatever tools you use. I challenge you now to automate copying these configuration files to your machines via the Ansible repository we've been working on. In this article, I've shown you how to copy a file, so take a look at that and see if you can apply that knowledge to your personal files. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/manage-your-workstation-configuration-ansible-part-2 - -作者:[Jay LaCroix][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/jlacroix -[1]:https://opensource.com/article/18/3/manage-workstation-ansible -[2]:https://github.com/jlacroix82/ansible_article.git From c0bada92bf30c06e21403792e0555e0c94366243 Mon Sep 17 00:00:00 2001 From: FelixYFZ <33593534+FelixYFZ@users.noreply.github.com> Date: Mon, 10 Dec 2018 20:43:07 +0800 Subject: [PATCH 0029/4278] Create 20180326 Manage your workstation with Ansible- Automating configuration.md Translation Finished --- ... with Ansible- Automating configuration.md | 231 ++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md diff --git a/translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md b/translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md new file mode 100644 index 0000000000..c464f4ea32 --- /dev/null +++ b/translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md @@ -0,0 +1,231 @@ +使用Ansible来管理你的工作站:配置自动化 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/robot_arm_artificial_ai.png?itok=8CUU3U_7) + +Ansible是一个令人惊讶的自动化的配置管理工具。主要应用在服务器和云部署上,但在工作站上的应用(无论是台式机还是笔记本)却得到了很少的关注,这就是本系列所要关注的。 + +在这个系列的第一部分,我会向你展示'ansible-pull'命令的基本用法,我们创建了一个安装了少量包的palybook.它本身是没有多大的用处的,但是它为后续的自动化做了准备。 + +在这篇文章中,所有的事件操作都是闭环的,而且在最后部分,我们将会有一个针对工作站自动配置的完整的工作解决方案。现在,我们将要设置Ansible的配置,这样未来将要做的改变将会自动的部署应用到我们的工作站上。现阶段,假设你已经完成了第一部分的工作。如果没有的话,当你完成的时候回到本文。你应该已经有一个包含第一篇文章中代码的Github库。我们将直接按照之前的方式创建。 + +首先,因为我们要做的不仅仅是安装包文件,所以我们要做一些重新的组织工作。现在,我们已经有一个名为'local.yml'并包含以下内容的playbook: +``` +- hosts: localhost + + become: true + + tasks: + + - name: Install packages + + apt: name={{item}} + + with_items: + + - htop + + - mc + + - tmux + +``` + +如果我们仅仅想实现一个任务那么上面的配置就足够了。随着向我们的配置中不断的添加内容,这个文件将会变的相当的庞大和杂乱。最好能够根据不同类型的配置将play文件分为独立的文件。为了达到这个要求,创建一个名为taskbook的文件,它和playbook很像但内容更加的流线型。让我们在Git库中为taskbook创建一个目录。 +``` +mkdir tasks + +``` + +在'local.yml'playbook中的代码使它很好过过渡到成为安装包文件的taskbook.让我们把这个文件移动到刚刚创建好并新命名的目录中。 + +``` +mv local.yml tasks/packages.yml + +``` +现在,我们编辑'packages.yml'文件将它进行大幅的瘦身,事实上,我们可以精简除了独立任务本身之外的所有内容。让我们把'packages.yml'编辑成如下的形式: +``` +- name: Install packages + + apt: name={{item}} + + with_items: + + - htop + + - mc + + - tmux + +``` + +正如你所看到的,它使用同样的语法,但我们去掉了对这个任务无用没有必要的所有内容。现在我们有了一个专门安装包文件的taskbook.然而我们仍然需要一个名为'local.yml'的文件,因为执行'ansible-pull'命令时仍然会去发现这个文件。所以我们将在我们库的根目录下(不是在'task'目录下)创建一个包含这些内容的全新文件: +``` +- hosts: localhost + + become: true + + pre_tasks: + + - name: update repositories + + apt: update_cache=yes + + changed_when: False + + + + tasks: + + - include: tasks/packages.yml + +``` + +这个新的'local.yml'扮演的是将要导入我们的taksbooks的主页的角色。我已经在这个文件中添加了一些你在这个系列中看不到的内容。首先,在这个文件的开头处,我添加了'pre——tasks',这个任务的作用是在其他所有任务运行之前先运行某个任务。在这种情况下,我们给Ansible的命令是让它去更新我们的分布存储库主页,下面的配置将执行这个任务要求: + +``` +apt: update_cache=yes + +``` +通常'apt'模块是用来安装包文件的,但我们也能够让它来更新库索引。这样做的目的是让我们的每个play在Ansible运行的时候能够以最新的索引工作。这将确保我们在使用一个老旧的索引安装一个包的时候不会出现问题。因为'apt'模块仅仅在Debian,Ubuntu和他们的衍生环境下工作。如果你运行的一个不同的环境,你期望在你的环境中使用一个特殊的模块而不是'apt'。如果你需要使用一个不同的模块请查看Ansible的相关文档。 + +下面这行值得以后解释: +``` +changed_when: False + +``` +在独立任务中的这行阻止了Ansible去报告play改变的结果即使是它本身在系统中导致的一个改变。在这中情况下,我们不会去在意库索引是否包含新的数据;它几乎总是会的,因为库总是在改变的。我们不会去在意'apt'库的改变,因为索引的改变是正常的过程。如果我们删除这行,我们将在过程保告的后面看到所有的变动,即使仅仅库的更新而已。最好能够去忽略这类的改变。 + +接下来是常规任务的阶段,我们将创建好的taskbook导入。我们每次添加另一个taskbook的时候,要添加下面这一行: +``` +tasks: + + - include: tasks/packages.yml + +``` + +如果你将要运行'ansible-pull'命令,他应该向上一篇文章中的那样做同样重要的事情。 不同的是我们已经提高了我们的组织并且能够更有效的扩展它。'ansible-pull'命令的语法,为了节省你到上一篇文章中去寻找,参考如下: +``` +sudo ansible-pull -U https://github.com//ansible.git + +``` +如果你还记得话,'ansible-pull'的命令拉取一个Git库并且应用了它所包含的配置。 + +既然我们的基础已经搭建好,我们现在可以扩展我们的Ansible并且添加功能。更特别的是,我们将添加配置来自动化的部署对工作站要做的改变。为了支撑这个要求,首先我们要创建一个特殊的账户来应用我们的Ansible配置。这个不是必要的,我们仍然能够在我们自己的用户下运行Ansible配置。但是使用一个隔离的用户能够将其隔离到不需要我们参与的在后台运行的一个系统进程中, + +我们可以使用常规的方式来创建这个用户,但是既然我们正在使用Ansible,我们应该尽量避开使用手动的改变。替代的是,我们将会创建一个taskbook来处理用户的创建任务。这个taskbook目前将会仅仅创建一个用户,但你可以在这个taskbook中添加额外的plays来创建更多的用户。我将这个用户命名为'ansible',你可以按照自己的想法来命名(如果你做了这个改变要确保更新所有的变动)。让我们来创建一个名为'user.yml'的taskbook并且将以下代码写进去: + +``` +- name: create ansible user + + user: name=ansible uid=900 + +``` +下一步,我们需要编辑'local.yml'文件,将这个新的taskbook添加进去,像如下这样写: + +``` +- hosts: localhost + + become: true + + pre_tasks: + + - name: update repositories + + apt: update_cache=yes + + changed_when: False + + + + tasks: + + - include: tasks/users.yml + + - include: tasks/packages.yml + +``` +现在当我们运行'ansible-pull'命令的时候,一个名为'ansible'的用户将会在系统中被创建。注意我特地通过参数'UID'为这个用户声明了用户ID为900。这个不是必须的,但建议直接创建好UID。因为在1000以下的UID在登陆界面是不会显示的,这样是很棒的因为我们根本没有需要去使用'ansibe'账户来登陆我们的桌面。UID 900是固定的;它应该是在1000以下没有被使用的任何一个数值。你可以使用以下命令在系统中去验证UID 900是否已经被使用了: + +``` +cat /etc/passwd |grep 900 + +``` +然而,你使用这个UID应该不会遇到什么问题,因为迄今为止在我使用的任何发行版中我还没遇到过它是被默认使用的。 + +现在,我们已经拥有了一个名为'ansible'的账户,它将会在之后的自动化配置中使用。接下来,我们可以创建实际的定时作业来自动操作它。而不是将其放置到我们刚刚创建的'users.yml'文件中,我们应该将其分开放到它自己的文件中。在任务目录中创建一个名为'cron.yml'的taskbook并且将以下的代买写进去: +``` +- name: install cron job (ansible-pull) + + cron: user="ansible" name="ansible provision" minute="*/10" job="/usr/bin/ansible-pull -o -U https://github.com//ansible.git > /dev/null" + +``` +定时模块的语法几乎是不需加以说明的。通过这个play,我们创建了一个通过用户'ansible'运行的定时作业。这个作业将每隔10分钟执行一次,下面是它将要执行的命令: + +``` +/usr/bin/ansible-pull -o -U https://github.com//ansible.git > /dev/null + +``` +同样,我们也可以添加想要我们的所有工作站部署的额外定时作业到这个文件中。我们只需要在新的定时作业中添加额外的palys即可。然而,仅仅是添加一个定时的taskbook是不够的,我们还需要将它添加到'local.yml'文件中以便它能够被调用。将下面的一行添加到末尾: +``` +- include: tasks/cron.yml + +``` +现在当'ansible-pull'命令执行的时候,它将会以通过用户'ansible'每个十分钟设置一个新的定时作业。但是,每个十分钟运行一个Ansible作业并不是一个好的方式因为这个将消耗很多的CPU资源。每隔十分钟来运行对于Ansible来说是毫无意义的除非欧文已经在Git库中改变一些东西。 + +然而,我们已经解决了这个问题。注意到我在定时作业中的命令'ansible-pill'添加的我们之前从未用到过的参数'-o'.这个参数告诉Ansible只有在从上次'ansible-pull'被调用以后库有了变化后才会运行。如果库没有任何变化,他将不会做任何事情。通过这个方法,你将不会无端的浪费CPU资源。当然,一些CPU资源将会在下来存储库的时候被使用,但不会像再一次应用整个配置的时候使用的那么多。当'ansible-pull'执行的时候,它将会遍历在playbooks和taskbooks中的所有任务,但至少它不会毫无目的的运行。 + +尽管我们已经添加了所有必须的配置要素来自动化'ansible-pull',它任然还不能正常的工作。'ansible-pull'命令需要sudo的权限来运行,这将允许它执行系统级的命令。然而我们创建的用户'ansible'并没有被设置为以'sudo'的权限来执行命令,因此当定时作业触发的时候,执行将会失败。通常沃恩可以使用命令'visudo'来手动的去设置用户'ansible'的拥有这个权限。然而我们现在应该以Ansible的方式来操作,而且这将会是一个向你展示'copy'模块是如何工作的机会。'copy'模块允许你从库复制一个文件到文件系统的任何位置。在这个案列中,我们将会复制'sudo'的一个配置文件到'/etc/sudoers.d/'以便用户'ansible'能够以管理员的权限执行任务。 + +打开'users.yml',将下面的play添加到文件末尾。 + +``` +- name: copy sudoers_ansible + + copy: src=files/sudoers_ansible dest=/etc/sudoers.d/ansible owner=root group=root mode=0440 + +``` +'copy'模块,正如我们看到的,从库复制一个文件到其他任何位置。在这个过程中,我们正在抓取一个名为'sudoers_ansible'(我们将在后续创建)的文件并将它复制到拥有者为'root'的'/etc/sudoers/ansible'中。 + +接下来,我们需要创建我们将要复制的文件。在你的库的根目录下,创建一个名为'files'的目录: + +``` +mkdir files + +``` +然后,在我们刚刚创建的'files'目录里,创建包含以下内容的名为'sudoers_ansible'的文件: +``` +ansible ALL=(ALL) NOPASSWD: ALL + +``` +在'/etc/sudoer.d'目录里创建一个文件,就像我们正在这样做的,允许我们为一个特殊的用户配置'sudo'权限。现在我们正在通过'sudo'允许用户'ansible'不需要密码拥有完全控制权限。这将允许'ansible-pull'以后台任务的形式运行而不需要手动去运行。 + +现在,你可以通过再次运行'ansible-pull'来拉取最新的变动: +``` +sudo ansible-pull -U https://github.com//ansible.git + +``` +从这个节点开始,'ansible-pull'的定时作业将会在后台每隔十分钟运行一次来检查你的库是否有变化,如果它发现有变化,将会运行你的palybook并且应用你的taskbooks. + +所以现在我们有了一个完整的工作方案。当你第一次设置一台新的笔记本或者台式机的时候,你要去手动的运行'ansible-pull'命令,但仅仅是在第一次的时候。从第一次之后,用户'ansible'将会在后台接手后续的运行任务。当你想对你的机器做变动的时候,你只需要简单的去拉取你的Git库来做变动,然后将这些变化回传到库中。接着,当定时作业下次在每台机器上运行的时候,它将会拉取变动的部分并应用它们。你现在只需要做一次变动,你的所有工作站将会跟着一起变动。这方法尽管有一点不方便,通常,你会有一个你的机器列表的文件和包含不同机器的规则。不管怎样,'ansible-pull'的方法,就像在文章中描述的,是管理工作站配置的非常有效的方法。 + +我已经在我的[Github repository]中更新了这篇文章中的代码,所以你可以随时去浏览来再一次检查你的语法。同时我将前一篇文章中的代码移到了它自己的目录中。 + +在第三部分,我们将通过介绍使用Ansible来配置GNOME桌面设置来结束这个系列。我将会告诉你如何设置你的墙纸和锁屏壁纸,应用一个桌面主题以及更多的东西。 + +同时,到了布置一些作业的时候了,大多数人有我们使用的各种应用的配置文件。可能是Bash,Vim或者其他你使用的工具的配置文件。现在你可以尝试通过我们在使用的Ansible库来自动复制这些配置到你的机器中。在这篇文章中,我已将想你展示了如何去复制文件,所以去尝试以下看看你是都已经能应用这些知识。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/3/manage-your-workstation-configuration-ansible-part-2 + +作者:[Jay LaCroix][a] +译者:[FelixYFZ](https://github.com/FelixYFZ) +校对:[校对者ID](https://github.com/校对者ID) +选题:[lujun9972](https://github.com/lujun9972) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jlacroix +[1]:https://opensource.com/article/18/3/manage-workstation-ansible +[2]:https://github.com/jlacroix82/ansible_article.git From 2c95b138ce3078ed548501de7504afaccb90fcc5 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 20:44:00 +0800 Subject: [PATCH 0030/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Manage=20NTP=20?= =?UTF-8?q?with=20Chrony?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20181003 Manage NTP with Chrony.md | 291 ++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 sources/tech/20181003 Manage NTP with Chrony.md diff --git a/sources/tech/20181003 Manage NTP with Chrony.md b/sources/tech/20181003 Manage NTP with Chrony.md new file mode 100644 index 0000000000..aaec88da26 --- /dev/null +++ b/sources/tech/20181003 Manage NTP with Chrony.md @@ -0,0 +1,291 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage NTP with Chrony) +[#]: via: (https://opensource.com/article/18/12/manage-ntp-chrony) +[#]: author: (David Both https://opensource.com/users/dboth) + +Manage NTP with Chrony +====== +Chronyd is a better choice for most networks than ntpd for keeping computers synchronized with the Network Time Protocol. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/clocks_time.png?itok=_ID09GDk) + +> "Does anybody really know what time it is? Does anybody really care?" +> – [Chicago][1], 1969 + +Perhaps that rock group didn't care what time it was, but our computers do need to know the exact time. Timekeeping is very important to computer networks. In banking, stock markets, and other financial businesses, transactions must be maintained in the proper order, and exact time sequences are critical for that. For sysadmins and DevOps professionals, it's easier to follow the trail of email through a series of servers or to determine the exact sequence of events using log files on geographically dispersed hosts when exact times are kept on the computers in question. + +I used to work at an organization that received over 20 million emails per day and had four servers just to accept and do a basic filter on the incoming flood of email. From there, emails were sent to one of four other servers to perform more complex anti-spam assessments, then they were delivered to one of several additional servers where the emails were placed in the correct inboxes. At each layer, the emails would be sent to one of the next-level servers, selected only by the randomness of round-robin DNS. Sometimes we had to trace a new message through the system until we could determine where it "got lost," according to the pointy-haired bosses. We had to do this with frightening regularity. + +Most of that email turned out to be spam. Some people actually complained that their [joke, cat pic, recipe, inspirational saying, or other-strange-email]-of-the-day was missing and asked us to find it. We did reject those opportunities. + +Our email and other transactional searches were aided by log entries with timestamps that—today—can resolve down to the nanosecond in even the slowest of modern Linux computers. In very high-volume transaction environments, even a few microseconds of difference in the system clocks can mean sorting thousands of transactions to find the correct one(s). + +### The NTP server hierarchy + +Computers worldwide use the [Network Time Protocol][2] (NTP) to synchronize their times with internet standard reference clocks via a hierarchy of NTP servers. The primary servers are at stratum 1, and they are connected directly to various national time services at stratum 0 via satellite, radio, or even modems over phone lines. The time service at stratum 0 may be an atomic clock, a radio receiver tuned to the signals broadcast by an atomic clock, or a GPS receiver using the highly accurate clock signals broadcast by GPS satellites. + +To prevent time requests from time servers lower in the hierarchy (i.e., with a higher stratum number) from overwhelming the primary reference servers, there are several thousand public NTP stratum 2 servers that are open and available for anyone to use. Many organizations with large numbers of hosts that need an NTP server will set up their own time servers so that only one local host accesses the stratum 2 time servers, then they configure the remaining network hosts to use the local time server which, in my case, is a stratum 3 server. + +### NTP choices + +The original NTP daemon, **ntpd** , has been joined by a newer one, **chronyd**. Both keep the local host's time synchronized with the time server. Both services are available, and I have seen nothing to indicate that this will change anytime soon. + +Chrony has features that make it the better choice for most environments for the following reasons: + + * Chrony can synchronize to the time server much faster than NTP. This is good for laptops or desktops that don't run constantly. + + * It can compensate for fluctuating clock frequencies, such as when a host hibernates or enters sleep mode, or when the clock speed varies due to frequency stepping that slows clock speeds when loads are low. + + * It handles intermittent network connections and bandwidth saturation. + + * It adjusts for network delays and latency. + + * After the initial time sync, Chrony never steps the clock. This ensures stable and consistent time intervals for system services and applications. + + * Chrony can work even without a network connection. In this case, the local host or server can be updated manually. + + + + +The NTP and Chrony RPM packages are available from standard Fedora repositories. You can install both and switch between them, but modern Fedora, CentOS, and RHEL releases have moved from NTP to Chrony as their default time-keeping implementation. I have found that Chrony works well, provides a better interface for the sysadmin, presents much more information, and increases control. + +Just to make it clear, NTP is a protocol that is implemented with either NTP or Chrony. If you'd like to know more, read this [comparison between NTP and Chrony][3] as implementations of the NTP protocol. + +This article explains how to configure Chrony clients and servers on a Fedora host, but the configuration for CentOS and RHEL current releases works the same. + +### Chrony structure + +The Chrony daemon, **chronyd** , runs in the background and monitors the time and status of the time server specified in the **chrony.conf** file. If the local time needs to be adjusted, **chronyd** does it smoothly without the programmatic trauma that would occur if the clock were instantly reset to a new time. + +Chrony's **chronyc** tool allows someone to monitor the current status of Chrony and make changes if necessary. The **chronyc** utility can be used as a command that accepts subcommands, or it can be used as an interactive text-mode program. This article will explain both uses. + +### Client configuration + +The NTP client configuration is simple and requires little or no intervention. The NTP server can be defined during the Linux installation or provided by the DHCP server at boot time. The default **/etc/chrony.conf** file (shown below in its entirety) requires no intervention to work properly as a client. For Fedora, Chrony uses the Fedora NTP pool, and CentOS and RHEL have their own NTP server pools. Like many Red Hat-based distributions, the configuration file is well commented. + +``` +# Use public servers from the pool.ntp.org project. +# Please consider joining the pool (http://www.pool.ntp.org/join.html). +pool 2.fedora.pool.ntp.org iburst + +# Record the rate at which the system clock gains/losses time. +driftfile /var/lib/chrony/drift + +# Allow the system clock to be stepped in the first three updates +# if its offset is larger than 1 second. +makestep 1.0 3 + +# Enable kernel synchronization of the real-time clock (RTC). + + +# Enable hardware timestamping on all interfaces that support it. +#hwtimestamp * + +# Increase the minimum number of selectable sources required to adjust +# the system clock. +#minsources 2 + +# Allow NTP client access from local network. +#allow 192.168.0.0/16 + +# Serve time even if not synchronized to a time source. +#local stratum 10 + +# Specify file containing keys for NTP authentication. +keyfile /etc/chrony.keys + +# Get TAI-UTC offset and leap seconds from the system tz database. +leapsectz right/UTC + +# Specify directory for log files. +logdir /var/log/chrony + +# Select which information is logged. +#log measurements statistics tracking +``` + +Let's look at the current status of NTP on a virtual machine I use for testing. The **chronyc** command, when used with the **tracking** subcommand, provides statistics that report how far off the local system is from the reference server. + +``` +[root@studentvm1 ~]# chronyc tracking +Reference ID    : 23ABED4D (ec2-35-171-237-77.compute-1.amazonaws.com) +Stratum         : 3 +Ref time (UTC)  : Fri Nov 16 16:21:30 2018 +System time     : 0.000645622 seconds slow of NTP time +Last offset     : -0.000308577 seconds +RMS offset      : 0.000786140 seconds +Frequency       : 0.147 ppm slow +Residual freq   : -0.073 ppm +Skew            : 0.062 ppm +Root delay      : 0.041452706 seconds +Root dispersion : 0.022665167 seconds +Update interval : 1044.2 seconds +Leap status     : Normal +[root@studentvm1 ~]# +``` + +The Reference ID in the first line of the result is the server the host is synchronized to—in this case, a stratum 3 reference server that was last contacted by the host at 16:21:30 2018. The other lines are described in the [chronyc(1) man page][4]. + +The **sources** subcommand is also useful because it provides information about the time source configured in **chrony.conf**. + +``` +[root@studentvm1 ~]# chronyc sources +210 Number of sources = 5 +MS Name/IP address         Stratum Poll Reach LastRx Last sample               +=============================================================================== +^+ 192.168.0.51                  3   6   377     0  -2613us[-2613us] +/-   63ms +^+ dev.smatwebdesign.com         3  10   377   28m  -2961us[-3534us] +/-  113ms +^+ propjet.latt.net              2  10   377   465  -1097us[-1085us] +/-   77ms +^* ec2-35-171-237-77.comput>     2  10   377    83  +2388us[+2395us] +/-   95ms +^+ PBX.cytranet.net              3  10   377   507  -1602us[-1589us] +/-   96ms +[root@studentvm1 ~]# +``` + +The first source in the list is the time server I set up for my personal network. The others were provided by the pool. Even though my NTP server doesn't appear in the Chrony configuration file above, my DHCP server provides its IP address for the NTP server. The "S" column—Source State—indicates with an asterisk ( ***** ) the server our host is synced to. This is consistent with the data from the **tracking** subcommand. + +The **-v** option provides a nice description of the fields in this output. + +``` +[root@studentvm1 ~]# chronyc sources -v +210 Number of sources = 5 + +  .-- Source mode  '^' = server, '=' = peer, '#' = local clock. + / .- Source state '*' = current synced, '+' = combined , '-' = not combined, +| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable. +||                                                 .- xxxx [ yyyy ] +/- zzzz +||      Reachability register (octal) -.           |  xxxx = adjusted offset, +||      Log2(Polling interval) --.      |          |  yyyy = measured offset, +||                                \     |          |  zzzz = estimated error. +||                                 |    |           \ +MS Name/IP address         Stratum Poll Reach LastRx Last sample               +=============================================================================== +^+ 192.168.0.51                  3   7   377    28  -2156us[-2156us] +/-   63ms +^+ triton.ellipse.net            2  10   377    24  +5716us[+5716us] +/-   62ms +^+ lithium.constant.com          2  10   377   351   -820us[ -820us] +/-   64ms +^* t2.time.bf1.yahoo.com         2  10   377   453   -992us[ -965us] +/-   46ms +^- ntp.idealab.com               2  10   377   799  +3653us[+3674us] +/-   87ms +[root@studentvm1 ~]# +``` + +If I wanted my server to be the preferred reference time source for this host, I would add the line below to the **/etc/chrony.conf** file. + +``` +server 192.168.0.51 iburst prefer +``` + +I usually place this line just above the first pool server statement near the top of the file. There is no special reason for this, except I like to keep the server statements together. It would work just as well at the bottom of the file, and I have done that on several hosts. This configuration file is not sequence-sensitive. + +The **prefer** option marks this as the preferred reference source. As such, this host will always be synchronized with this reference source (as long as it is available). We can also use the fully qualified hostname for a remote reference server or the hostname only (without the domain name) for a local reference time source as long as the search statement is set in the **/etc/resolv.conf** file. I prefer the IP address to ensure that the time source is accessible even if DNS is not working. In most environments, the server name is probably the better option, because NTP will continue to work even if the server's IP address changes. + +If you don't have a specific reference source you want to synchronize to, it is fine to use the defaults. + +### Configuring an NTP server with Chrony + +The nice thing about the Chrony configuration file is that this single file configures the host as both a client and a server. To add a server function to our host—it will always be a client, obtaining its time from a reference server—we just need to make a couple of changes to the Chrony configuration, then configure the host's firewall to accept NTP requests. + +Open the **/etc/ ** **chrony****.conf** file in your favorite text editor and uncomment the **local stratum 10** line. This enables the Chrony NTP server to continue to act as if it were connected to a remote reference server if the internet connection fails; this enables the host to continue to be an NTP server to other hosts on the local network. + +Let's restart **chronyd** and track how the service is working for a few minutes. Before we enable our host as an NTP server, we want to test a bit. + +``` +[root@studentvm1 ~]# systemctl restart chronyd ; watch chronyc tracking +``` + +The results should look like this. The **watch** command runs the **chronyc tracking** command every two seconds so we can watch changes occur over time. + +``` +Every 2.0s: chronyc tracking                                           studentvm1: Fri Nov 16 20:59:31 2018 + +Reference ID    : C0A80033 (192.168.0.51) +Stratum         : 4 +Ref time (UTC)  : Sat Nov 17 01:58:51 2018 +System time     : 0.001598277 seconds fast of NTP time +Last offset     : +0.001791533 seconds +RMS offset      : 0.001791533 seconds +Frequency       : 0.546 ppm slow +Residual freq   : -0.175 ppm +Skew            : 0.168 ppm +Root delay      : 0.094823152 seconds +Root dispersion : 0.021242738 seconds +Update interval : 65.0 seconds +Leap status     : Normal +``` + +Notice that my NTP server, the **studentvm1** host, synchronizes to the host at 192.168.0.51, which is my internal network NTP server, at stratum 4. Synchronizing directly to the Fedora pool machines would result in synchronization at stratum 3. Notice also that the amount of error decreases over time. Eventually, it should stabilize with a tiny variation around a fairly small range of error. The size of the error depends upon the stratum and other network factors. After a few minutes, use Ctrl+C to break out of the watch loop. + +To turn our host into an NTP server, we need to allow it to listen on the local network. Uncomment the following line to allow hosts on the local network to access our NTP server. + +``` +# Allow NTP client access from local network. +allow 192.168.0.0/16 +``` + +Note that the server can listen for requests on any local network it's attached to. The IP address in the "allow" line is just intended for illustrative purposes. Be sure to change the IP network and subnet mask in that line to match your local network's. + +Restart **chronyd**. + +``` +[root@studentvm1 ~]# systemctl restart chronyd +``` + +To allow other hosts on your network to access this server, configure the firewall to allow inbound UDP packets on port 123. Check your firewall's documentation to find out how to do that. + +### Testing + +Your host is now an NTP server. You can test it with another host or a VM that has access to the network on which the NTP server is listening. Configure the client to use the new NTP server as the preferred server in the **/etc/chrony.conf** file, then monitor that client using the **chronyc** tools we used above. + +### Chronyc as an interactive tool + +As I mentioned earlier, **chronyc** can be used as an interactive command tool. Simply run the command without a subcommand and you get a **chronyc** command prompt. + +``` +[root@studentvm1 ~]# chronyc +chrony version 3.4 +Copyright (C) 1997-2003, 2007, 2009-2018 Richard P. Curnow and others +chrony comes with ABSOLUTELY NO WARRANTY.  This is free software, and +you are welcome to redistribute it under certain conditions.  See the +GNU General Public License version 2 for details. + +chronyc> +``` + +You can enter just the subcommands at this prompt. Try using the **tracking** , **ntpdata** , and **sources** commands. The **chronyc** command line allows command recall and editing for **chronyc** subcommands. You can use the **help** subcommand to get a list of possible commands and their syntax. + +### Conclusion + +Chrony is a powerful tool for synchronizing the times of client hosts, whether they are all on the local network or scattered around the globe. It's easy to configure because, despite the large number of options available, only a few configurations are required for most circumstances. + +After my client computers have synchronized with the NTP server, I like to set the system hardware clock from the system (OS) time by using the following command: + +``` +/sbin/hwclock --systohc +``` + +This command can be added as a cron job or a script in **cron.daily** to keep the hardware clock synced with the system time. + +Chrony and NTP (the service) both use the same configuration, and the files' contents are interchangeable. The man pages for [chronyd][5], [chronyc][4], and [chrony.conf][6] contain an amazing amount of information that can help you get started or learn about esoteric configuration options. + +Do you run your own NTP server? Let us know in the comments and be sure to tell us which implementation you are using, NTP or Chrony. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/manage-ntp-chrony + +作者:[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://en.wikipedia.org/wiki/Does_Anybody_Really_Know_What_Time_It_Is%3F +[2]: https://en.wikipedia.org/wiki/Network_Time_Protocol +[3]: https://chrony.tuxfamily.org/comparison.html +[4]: https://linux.die.net/man/1/chronyc +[5]: https://linux.die.net/man/8/chronyd +[6]: https://linux.die.net/man/5/chrony.conf From a45991e64b224a9107ecd4dbf660183904c553c7 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 20:45:51 +0800 Subject: [PATCH 0031/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20Screen=20Re?= =?UTF-8?q?corders=20for=20the=20Linux=20Desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Screen Recorders for the Linux Desktop.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20181207 5 Screen Recorders for the Linux Desktop.md diff --git a/sources/tech/20181207 5 Screen Recorders for the Linux Desktop.md b/sources/tech/20181207 5 Screen Recorders for the Linux Desktop.md new file mode 100644 index 0000000000..4dd47e948a --- /dev/null +++ b/sources/tech/20181207 5 Screen Recorders for the Linux Desktop.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Screen Recorders for the Linux Desktop) +[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/12/5-screen-recorders-linux-desktop) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +5 Screen Recorders for the Linux Desktop +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/screen-record.png?itok=tKWx29k8) + +There are so many reasons why you might need to record your Linux desktop. The two most important are for training and for support. If you are training users, a video recording of the desktop can go a long way to help them understand what you are trying to impart. Conversely, if you’re having trouble with one aspect of your Linux desktop, recording a video of the shenanigans could mean the difference between solving the problem and not. But what tools are available for the task? Fortunately, for every Linux user (regardless of desktop), there are options available. I want to highlight five of my favorite screen recorders for the Linux desktop. Among these five, you are certain to find one that perfectly meets your needs. I will only be focusing on those screen recorders that save as video. What video format you prefer may or may not dictate which tool you select. + +And, without further ado, let’s get on with the list. + +### Simple Screen Recorder + +I’m starting out with my go-to screen recorder. I use [Simple Screen Recorder][1] on a daily basis, and it never lets me down. This particular take on the screen recorder is available for nearly every flavor of Linux and is, as the name implies, very simple to use. With Simple Screen Recorder you can select a single window, a portion of the screen, or the entire screen to record. One of the best features of Simple Screen Recorder is the ability to save profiles (Figure 1), which allows you to configure the input for a recording (including scaling, frame rate, width, height, left edge and top edge spacing, and more). By saving profiles, you can easily use a specific profile to meet a unique need, without having to go through the customization every time. This is handy for those who do a lot of screen recording, with different input variables for specific jobs. + +![Simple Screen Recorder ][3] + +Figure 1: Simple Screen Recorder input profile window. + +[Used with permission][4] + +Simple screen recorder also: + + * Records audio input + + * Allows you to pause and resume recording + + * Offers a preview during recording + + * Allows for the selection of video containers and codecs + + * Adds timestamp to file name (optional) + + * Includes hotkey recording and sound notifications + + * Works well on slower machines + + * And much more + + + + +Simple Screen Recorder is one of the most reliable screen recording tools I have found for the Linux desktop. Simple Screen Recorder can be installed from the standard repositories on many desktops, or via easy to follow instructions on the [application download page][5]. + +### Gtk-recordmydesktop + +The next entry, [gtk-recordmydesktop][6], doesn’t give you nearly the options found in Simple Screen Recorder, but it does offer a command line component (for those who prefer not working with a GUI). The simplicity that comes along with this tool also means you are limited to a specific video output format (.ogv). That doesn’t mean gtk-recordmydesktop isn’t without appeal. In fact, there are a few features that make this option in the genre fairly appealing. First and foremost, it’s very simple to use. Second, the record window automatically gets out of your way while you record (as opposed to Simple Screen Recorder, where you need to minimize the recording window when recording full screen). Another feature found in gtk-recordmydesktop is the ability to have the recording follow the mouse (Figure 2). + +![gtk-recordmydesktop][8] + +Figure 2: Some of the options for gtk-recordmydesktop. + +[Used with permission][4] + +Unfortunately, the follow the mouse feature doesn’t always work as expected, so chances are you’ll be using the tool without this interesting option. In fact, if you opt to go the gtk-recordmydesktop route, you should understand the GUI frontend isn’t nearly as reliable as is the command line version of the tool. From the command line, you could record a specific position of the screen like so: + +``` +recordmydesktop -x X_POS -y Y_POS --width WIDTH --height HEIGHT -o FILENAME.ogv +``` + +where: + + * X_POS is the offset on the X axis + + * Y_POS is the offset on the Y axis + + * WIDTH is the width of the screen to be recorded + + * HEIGHT is the height of the screen to be recorded + + * FILENAME is the name of the file to be saved + + + + +To find out more about the command line options, issue the command man recordmydesktop and read through the manual page. + +### Kazam + +If you’re looking for a bit more than just a recorded screencast, you might want to give Kazam a go. Not only can you record a standard screen video (with the usual—albeit limited amount of—bells and whistles), you can also take screenshots and even broadcast video to YouTube Live (Figure 3). + +![Kazam][10] + +Figure 3: Setting up YouTube Live broadcasting in Kazam. + +[Used with permission][4] + +Kazam falls in line with gtk-recordmydesktop, when it comes to features. In other words, it’s slightly limited in what it can do. However, that doesn’t mean you shouldn’t give Kazam a go. In fact, Kazam might be one of the best screen recorders out there for new Linux users, as this app is pretty much point and click all the way. But if you’re looking for serious bells and whistles, look away. + +The version of Kazam, with broadcast goodness, can be found in the following repository: + +``` +ppa:sylvain-pineau/kazam +``` + +For Ubuntu (and Ubuntu-based distributions), install with the following commands: + +``` +sudo apt-add-repository ppa:sylvain-pineau/kazam + +sudo apt-get update + +sudo apt-get install kazam -y +``` + +### Vokoscreen + +The [Vokoscreen][11] recording app is for new-ish users who need more options. Not only can you configure the output format and the video/audio codecs, you can also configure it to work with a webcam (Figure 4). + +![Vokoscreen][13] + +Figure 4: Configuring a web cam for a Vokoscreen screen recording. + +[Used with permission][4] + +As with most every screen recording tool, Vokoscreen allows you to specify what on your screen to record. You can record the full screen (even selecting which display on multi-display setups), window, or area. Vokoscreen also allows you to select a magnification level (200x200, 400x200, or 600x200). The magnification level makes for a great tool to highlight a specific section of the screen (the magnification window follows your mouse). + +Like all the other tools, Vokoscreen can be installed from the standard repositories or cloned from its [GitHub repository][14]. + +### OBS Studio + +For many, [OBS Studio][15] will be considered the mack daddy of all screen recording tools. Why? Because OBS Studio is as much a broadcasting tool as it is a desktop recording tool. With OBS Studio, you can broadcast to YouTube, Smashcast, Mixer.com, DailyMotion, Facebook Live, Restream.io, LiveEdu.tv, Twitter, and more. In fact, OBS Studio should seriously be considered the de facto standard for live broadcasting the Linux desktop. + +Upon installation (the software is only officially supported for Ubuntu Linux 14.04 and newer), you will be asked to walk through an auto-configuration wizard, where you setup your streaming service (Figure 5). This is, of course, optional; however, if you’re using OBS Studio, chances are this is exactly why, so you won’t want to skip out on configuring your default stream. + +![OBS Studio][17] + +Figure 5: Configuring your streaming service for OBS Studio. + +[Used with permission][4] + +I will warn you: OBS Studio isn’t exactly for the faint of heart. Plan on spending a good amount of time getting the streaming service up and running and getting up to speed with the tool. But for anyone needing such a solution for the Linux desktop, OBS Studio is what you want. Oh … it can also record your desktop screencast and save it locally. + +### There’s More Where That Came From + +This is a short list of screen recording solutions for Linux. Although there are plenty more where this came from, you should be able to fill all your desktop recording needs with one of these five apps. + +Learn more about Linux through the free ["Introduction to Linux" ][18]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/intro-to-linux/2018/12/5-screen-recorders-linux-desktop + +作者:[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://www.maartenbaert.be/simplescreenrecorder/ +[2]: /files/images/screenrecorder1jpg +[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/screenrecorder_1.jpg?itok=hZJ5xugI (Simple Screen Recorder ) +[4]: /licenses/category/used-permission +[5]: http://www.maartenbaert.be/simplescreenrecorder/#download +[6]: http://recordmydesktop.sourceforge.net/about.php +[7]: /files/images/screenrecorder2jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/screenrecorder_2.jpg?itok=TEGXaVYI (gtk-recordmydesktop) +[9]: /files/images/screenrecorder3jpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/screenrecorder_3.jpg?itok=cvtFjxen (Kazam) +[11]: https://github.com/vkohaupt/vokoscreen +[12]: /files/images/screenrecorder4jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/screenrecorder_4.jpg?itok=c3KVS954 (Vokoscreen) +[14]: https://github.com/vkohaupt/vokoscreen.git +[15]: https://obsproject.com/ +[16]: /files/images/desktoprecorder5jpg +[17]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/desktoprecorder_5.jpg?itok=xyM-dCa7 (OBS Studio) +[18]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 98d61d75f99db0ea69edd36f3294a2ba144c7ea3 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 21:05:03 +0800 Subject: [PATCH 0032/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Automatic=20con?= =?UTF-8?q?tinuous=20development=20and=20delivery=20of=20a=20hybrid=20mobi?= =?UTF-8?q?le=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ent and delivery of a hybrid mobile app.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20181207 Automatic continuous development and delivery of a hybrid mobile app.md diff --git a/sources/tech/20181207 Automatic continuous development and delivery of a hybrid mobile app.md b/sources/tech/20181207 Automatic continuous development and delivery of a hybrid mobile app.md new file mode 100644 index 0000000000..c513f36017 --- /dev/null +++ b/sources/tech/20181207 Automatic continuous development and delivery of a hybrid mobile app.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automatic continuous development and delivery of a hybrid mobile app) +[#]: via: (https://opensource.com/article/18/12/hybrid-mobile-app-development) +[#]: author: (Angelo Manganiello https://opensource.com/users/amanganiello90) + +Automatic continuous development and delivery of a hybrid mobile app +====== +Hybrid apps are a good middle ground between native and web apps. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd) + +Offering a mobile app is essentially a business requirement for organizations today. One of the first steps in developing an app is to understand the different types—native, hybrid (or cross-platform), and web—so you can decide which one will best meet your needs. + +### Native is better, right? + +**Native apps** represent the vast majority of applications that people download every day. Native applications are developed specifically for an operating system. Thus, a native iOS application will not work on an Android system and vice versa. To develop a native app, you need to know two things: + + 1. How to develop in a specific programming language (e.g., Swift for Apple devices; Java for Android) + 2. The app will not work for other platforms + + + +Even though native apps will work only on the platform they're developed for, they have several notable advantages over hybrid and web apps: + + * Increased speed, reliability, and responsiveness and higher resolution, all of which provide a better user experience + * May work offline/without internet service + * Easier access to all phone features (e.g., accelerometer, camera, microphone) + + + +### But my business is still linked to the web… + +Most companies have focused their resources on web development and now want to enter the mobile market. But many don't have the right technical resources to develop a native app for each platform. For these companies, **hybrid** development is the right choice. In this model, developers can use their existing frontend skills to develop a single, cross-platform mobile app. + +![Hybrid mobile apps][2] + +Hybrid apps are a good middle ground: they're faster and less expensive to develop than native apps, and they offer more possibilities than web apps. The tradeoffs are they don't perform as well as native apps and developers can't maintain their existing tight focus on web development (as they could with web apps). + +If you already are a fan of the [Angular][3] cross-platform development framework, I recommend trying the [Ionic][4] framework, which "lets web developers build, test, and deploy cross-platform hybrid mobile apps." I see Ionic as an extension of the [Apache Cordova][5] framework, which enables a normal web app (JS, HTML, or CSS) to run as a mobile app in a container. Ionic uses the base Cordova features that support the Angular development for its user interface. + +The advantage of this approach is simple: the Angular paradigm is maintained, so developers can continue writing [TypeScript][6] files but target a build for Android, iOS, and Windows by properly configuring the development environment. It also provides two important tools: + + * An appealing design and widget that are very similar to a native app's, so your hybrid app will look less "web" + * Cordova Plugins allow the app to communicate with all phone features + + + +### What about the Node.js backend? + +The programming world likes to standardize, which is why hybrid apps are so popular. Frontend developers' common skills are useful in the mobile world. But if we have a technology stack for the user interface, why not focus on a single backend with the same programming paradigm? + +This makes [Node.js][7] an appealing option. Node.js is a JavaScript runtime built on the Chrome V8 JavaScript engine. It can make the API development backend very fast and easy, and it integrates fully with web technologies. You can develop a Cordova plugin, using your Node.js backend, internally in your hybrid app, as I did with the [nodejs-cordova-plugin][8]. This plugin, following the Cordova guidelines, integrates a mobile-compatible version of the Node.js platform to provide a full-stack mobile app. + +If you need a simple CRUD Node.js backend, you can use my [API][9] [node generator][9] that generates an app using a [MongoDB][10] embedded database. + +![Cordova Full Stack application][12] + +### Deploying your app + +Open source offers everything you need to deploy your app in the best way. You just need a GitHub repository and a good continuous integration tool. I recommend [Travis-ci][13], an excellent tool that allows you to build and deploy your product for every commit. + +Travis-ci is a fork of the better known [Jenkins][14]. Like with Jenkins, you have to configure your pipeline through a configuration file (in this case a **.travis.yml** file) in your GitHub repo. See the [.travis.yml file][15] in my repository as an example. + +![](https://opensource.com/sites/default/files/uploads/3-travis-ci-process.png) + +In addition, this pipeline automatically delivers and installs your app on [Appetize.io][16], a web-based iOS simulator and Android emulator, for testing. + +You can learn more in the [Cordova Android][17] section of my GitHub repository. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/hybrid-mobile-app-development + +作者:[Angelo Manganiello][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/amanganiello90 +[b]: https://github.com/lujun9972 +[1]: /file/416441 +[2]: https://opensource.com/sites/default/files/uploads/1-title.png (Hybrid mobile apps) +[3]: https://angular.io/ +[4]: https://ionicframework.com/ +[5]: https://cordova.apache.org/ +[6]: https://www.typescriptlang.org/ +[7]: https://nodejs.org/ +[8]: https://github.com/fullStackApp/nodejs-cordova-plugin +[9]: https://github.com/fullStackApp/generator-full-stack-api +[10]: https://www.mongodb.com/ +[11]: /file/416351 +[12]: https://opensource.com/sites/default/files/uploads/2-cordova-full-stack-app.png (Cordova Full Stack application) +[13]: https://travis-ci.org/ +[14]: https://jenkins.io/ +[15]: https://github.com/amanganiello90/java-angular-web-app/blob/master/.travis.yml +[16]: https://appetize.io/ +[17]: https://github.com/amanganiello90/java-angular-web-app#cordova-android From 7b4c9a9b6c6f0caab0d8a01f9b372892ea844a86 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 21:07:13 +0800 Subject: [PATCH 0033/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Boot?= =?UTF-8?q?=20Into=20Rescue=20Mode=20Or=20Emergency=20Mode=20In=20Ubuntu?= =?UTF-8?q?=2018.04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Mode Or Emergency Mode In Ubuntu 18.04.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md diff --git a/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md new file mode 100644 index 0000000000..1b52121add --- /dev/null +++ b/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) +[#]: via: (https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04 +====== +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Rescue-Mode-Or-Emergency-Mode-720x340.png) + +As you might already know, **Runlevels** are replaced with **Systemd targets** in many recent Linux distributions like RHEL 7 and Ubuntu 16.04 LTS. For more details about runlevels and systemd target, refer [**this guide**][1]. In this brief tutorial, we are going to see how to boot into **rescue mode** and/or **emergency mode**. This guide is tested in Ubuntu 18.04 LTS, however the steps given below would work on most Linux distributions that uses Systemd as default service manager. Before going further, let me clarify what is rescue mode and emergency mode and what is the purpose of the both modes. + +### What is Rescue mode? + +The **rescue mode** is equivalent to **single user mode** in Linux distributions that uses **SysV** as the default service manager. In rescue mode, all local filesystems will be mounted, only some important services will be started. However, no normal services (E.g network services) won’t be started. The rescue mode is helpful in situations where the system can’t boot normally. Also, we can perform some important rescue operations, such as [**reset root password**][2], in rescue mode. + +### What is Emergency mode? + +In contrast to the rescue mode, nothing is started in the **emergency mode**. No services are started, no mount points mounted, no sockets established, nothing. All you will have is just a **raw shell**. Emergency mode is suitable for debugging purposes. + +### Boot Into Rescue Mode In Ubuntu 18.04 LTS + +Boot your Ubuntu system. When Grub menu appears, choose the first entry and press **e** to edit. + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png) + +If you don’t see the Grub menu, just hit ESC key right after the BIOS logo disappears. + +Find the line that starts with word **“linux”** and add the following line at the end of that line (To reach the end, just press **CTRL+e** or use END key or LEFT/RIGHT arrows in your keyboard): + +``` +systemd.unit=rescue.target +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png) + +Once you added the above line, just press **CTRL+x** or **F10** to continue to boot into rescue mode. After a few seconds, you will be ended up in the rescue mode (single user mode) as root user. Here is how rescue mode looks like in Ubuntu 18.04 LTS server: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png) + +Next, type the following command to mount root (/) file system into read/write mode. + +``` +mount -n -o remount,rw / +``` + +### Boot Into Emergency Mode + +Booting your Ubuntu into emergency is as same as above method. All you have to do is replace “systemd.unit=rescue.target” with “systemd.unit=emergency.target” when editing grub menu. + +[![emergency mode][3]][4] + +Once you added “systemd.unit=emergency.target”, press **Ctrl+x** or **F10** to continue booting into emergency mode. + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png) + +Finally, you can mount root filesystem into read/write mode with command: + +``` +mount -n -o remount,rw / +``` + +### Switch between Rescue to Emergency mode and vice versa + +If you are in rescue mode, you don’t have to edit the grub boot entry as I mentioned above. Instead, just type the following command to switch to emergency mode instantly: + +``` +systemctl emergency +``` + +Similarly, to switch from emergency to rescue mode, type: + +``` +systemctl rescue +``` + +You know now what is rescue and emergency modes and how to boot into those modes in Ubuntu 18.04. Like I already mentioned, the steps provided here will work on many recent Linux versions that uses Systemd. + +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-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ + +作者:[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/check-runlevel-linux/ +[2]: https://www.ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png From 1c816df2e5abdf43ea3f69e1352b2be6a08be427 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 10 Dec 2018 21:09:23 +0800 Subject: [PATCH 0034/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20view?= =?UTF-8?q?=20XML=20files=20in=20a=20web=20browser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... How to view XML files in a web browser.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20181206 How to view XML files in a web browser.md diff --git a/sources/tech/20181206 How to view XML files in a web browser.md b/sources/tech/20181206 How to view XML files in a web browser.md new file mode 100644 index 0000000000..6060c792e2 --- /dev/null +++ b/sources/tech/20181206 How to view XML files in a web browser.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to view XML files in a web browser) +[#]: via: (https://opensource.com/article/18/12/xml-browser) +[#]: author: (Greg Pittman https://opensource.com/users/greg-p) + +How to view XML files in a web browser +====== +Turn XML files into something more useful. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +Once you learn that HTML is a form of XML, you might wonder what would happen if you tried to view an XML file in a browser. The results are quite disappointing—Firefox shows you a banner at the top of the page that says, "This XML file does not appear to have any style information associated with it. The document tree is shown below." The document tree looks like the file would look in an editor: +![](https://opensource.com/sites/default/files/uploads/xml_menu.png) +This is the beginning of the **menu.xml** file for the online manual that comes with [Scribus][1], to which I'm a contributor. Although you see blue text, they are not clickable links. I wanted to be able to view this in a regular browser, since sometimes I need to go back and forth from the canvas in Scribus to the manual to figure out how to do something (maybe to see if I need to edit the manual to straighten out some misinformation or to add some missing information). + +The way to help a browser know what to do with these XML tags is by using XSLT—Extensible Stylesheet Language Transformations. In a broad sense, you could use XSLT to transform XML to a variety of outputs, or even HTML to XML. Here I want to use it to present the XML tags to a browser as suitable HTML. + +One slight modification needs to happen to the XML file: + +![](https://opensource.com/sites/default/files/uploads/xml_modified-menu.png) + +Adding this second line to the file tells the browser to look for a file named **scribus-manual.xsl** for the style information. The more important part is to create this XSL file. Here is the complete listing of **scribus-manual.xsl** for the Scribus manual: + +``` + + + +    +    Scribus Online Manual + + +        +                +                +        +
+ +    + +      +        +         

+          +           

+                +                 

    +                   
  • +                 

+               
+         
+        +         

+       
+       
+     
+    +    + 
+
+``` + +This looks a lot more like HTML, and you can see it contains a number of HTML tags. After some preliminary tags and some particulars about displaying H2, H3, and H4 tags, you see a Table tag. This adds a graphical heading at the top of the page and uses some images already in the documentation files. + +After this, you get into the process of dissecting the various **submenuitem** tags, trying to create the nested listing structure as it appears in Scribus when you view the manual. One feature I did not try to duplicate is the ability to collapse and expand **submenuitem** areas. As you can imagine, it takes some time to sort through the number of nested lists you need to create, but when I finished, here is how it looked: + +![](https://opensource.com/sites/default/files/uploads/xml_scribusmenuinbrowser.png) + +This minimal editing to **menu.xml** does not interfere with Scribus' ability to show the manual in its own browser. I put this modified **menu.xml** file and the **scribus-manual.xsl** in the English documentation folder for 1.5.x versions of Scribus, so anyone using these versions can simply point their browser to the **menu.xml** file and it should show up just like you see above. + +A much bigger chore I took on a few years ago was to create a version of the ICD10 (International Classification of Diseases, version 10) when it came out. Many changes were made from the previous version (ICD9) to 10. These are important since these codes must be used for diagnostic purposes in medical practice. You can easily download XML files from the US [Centers for Medicare and Medicaid][2] website since it is public information, but—just as with the Scribus manual—these files are hard to use. + +Here is the beginning of the tabular listing of diseases: + +![](https://opensource.com/sites/default/files/uploads/xml_tabular_begin.png) + +One of the features I created was the color coding used in the listing shown here: + +![](https://opensource.com/sites/default/files/uploads/xml_tabular_body.png) + +As with **menu.xml** , the only editing I did in this **Tabular.xml** file was to add **** as the second line of the file. I started this project with the 2014 version, and I was quite pleased to find that the original **tabular.xsl** stylesheet worked perfectly when the 2016 version came out, which is the last one I worked on. The** Tabular.xml** file is 8.4MB, quite large for a plaintext file. It takes a few seconds to load into a browser, but once it's loaded, navigation is fast. + +While you may not often have to deal with an XML file in this way, if you do, I hope this article shows that your file can easily be turned into something much more usable. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/xml-browser + +作者:[Greg Pittman][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://www.scribus.net/ +[2]: https://www.cms.gov/ From 4aa8c8b3ab82d775ebb54d0bf892ce8b0725de0d Mon Sep 17 00:00:00 2001 From: Yixiang Zhao <674965440@qq.com> Date: Mon, 10 Dec 2018 21:45:46 +0800 Subject: [PATCH 0035/4278] =?UTF-8?q?=E6=8C=89=E7=85=A7=E6=96=B0=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E7=9A=84=E6=A0=BC=E5=BC=8F=E8=BF=9B=E8=A1=8C=E4=BA=86?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181127 What the open source community means to me.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sources/talk/20181127 What the open source community means to me.md b/sources/talk/20181127 What the open source community means to me.md index ec4d8f7a6d..b092c1c33e 100644 --- a/sources/talk/20181127 What the open source community means to me.md +++ b/sources/talk/20181127 What the open source community means to me.md @@ -1,7 +1,5 @@ -translating by seriouszyx - [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (seriouszyx) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (What the open source community means to me) From 253f654fc962103f20e44a5422903e39a466209b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 10 Dec 2018 22:24:24 +0800 Subject: [PATCH 0036/4278] PRF:20181112 A Free, Secure And Cross-platform Password Manager.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @seriouszyx 翻译的很用心。 --- ...ure And Cross-platform Password Manager.md | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/translated/tech/20181112 A Free, Secure And Cross-platform Password Manager.md b/translated/tech/20181112 A Free, Secure And Cross-platform Password Manager.md index 35a1c44720..637bec8b63 100644 --- a/translated/tech/20181112 A Free, Secure And Cross-platform Password Manager.md +++ b/translated/tech/20181112 A Free, Secure And Cross-platform Password Manager.md @@ -1,5 +1,3 @@ -(本文共两处译注) - 一个免费、安全、跨平台的密码管理器 ====== @@ -7,17 +5,17 @@ 在这个现代化的互联网时代,你一定在许多网站上有多个账户,它可能是个人或官方邮箱账户、社交或专业网络账户、GitHub 账户和电子商务账户等。因此,对于不同的账户,你应该设置多个不同的密码。我相信你应该已经意识到为多个账户设置相同的密码是件疯狂又危险的事情。如果攻击者设法破解了你的一个账户,那么他/她很可能尝试使用相同的密码访问你的其他账户。所以,**强烈建议为不同的账户设置不同的密码**。 -不过,记住好几个密码是很困难的。你可以把它们写在纸上,但那也不是一个有效的方法,你可能会在一段时间后失去它们。这时密码管理器就派上用场了。密码管理器就像一个存储库,你可以在其中存储不同账户的所有密码,并用一个主密码将其锁定。这样,你需要记住的就只剩下主密码了。之前我们介绍过一个叫 [**KeeWeb**][1] 的开源密码管理器,今天,我们将介绍另外一款密码管理器———**Buttercup**。 +不过,记住好几个密码是很困难的。你可以把它们写在纸上,但那也不是一个有效的方法,你可能会在一段时间后失去它们。这时密码管理器就派上用场了。密码管理器就像一个存储库,你可以在其中存储不同账户的所有密码,并用一个主密码将其锁定。这样,你需要记住的就只剩下主密码了。之前我们介绍过一个叫 [KeeWeb][1] 的开源密码管理器,今天,我们将介绍另外一款密码管理器 ——— Buttercup。 ### 关于 Buttercup -Buttercup 是一个免费、开源、安全、跨平台的使用 **NodeJS** 编写的密码管理器。它可以帮助你将不同账户的所有登录凭证存储到加密存档中,该存档可以保存在本地系统或任何远程服务(如 DropBox、OwnCloud、NextCloud 和基于 WebDAV 的服务)中。它使用强大的 **256 位 AES 加密算法**,用主密码保存你的敏感数据。所以,除了拥有主密码的人以外,没有人可以访问你的登录信息。Buttercup 目前支持 Linux、Mac OS 和 Windows,还提供了一个浏览器扩展和移动应用程序。因此,你也可以在 Android 和 iOS 设备中的桌面应用程序和浏览器扩展程序中使用相同的存档。 +Buttercup 是一个自由、开源、安全、跨平台的密码管理器,使用 **NodeJS** 编写。它可以帮助你将不同账户的所有登录凭证存储到加密存档中,该存档可以保存在本地系统或任何远程服务(如 DropBox、OwnCloud、NextCloud 和基于 WebDAV 的服务)中。它使用强大的 **256 位 AES 加密算法**,用主密码保存你的敏感数据。所以,除了拥有主密码的人以外,没有人可以访问你的登录信息。Buttercup 目前支持 Linux、Mac OS 和 Windows,还提供了一个浏览器扩展和移动应用程序。因此,你也可以在 Android 和 iOS 设备中的桌面应用程序和浏览器扩展程序中使用相同的存档。 ### 安装 Buttercup 密码管理器 -(译注:此处没有找到合适的语言翻译)Buttercup 目前可作为 .deb、.rpm 软件包、便携式 AppImage 和用于 Linux 平台的 tar 归档文件使用。转到 [**releases pages**][2] 下载安装你想要的版本。 +Buttercup 目前在 Linux 平台上有 .deb、.rpm 软件包、可移植的 AppImage 和 tar 归档文件等安装包。转到其 [发布页][2] 下载安装你想要的版本。 -Buttercup 桌面应用程序在 [**AUR**][3] 中也可用,你可以使用 AUR 帮助程序(如 [**Yay**][4])在基于 Arch 的系统上安装,如下所示: +Buttercup 桌面应用程序在 [AUR][3] 中也可用,你可以使用 AUR 帮助程序(如 [Yay][4])在基于 Arch 的系统上安装,如下所示: ``` $ yay -S buttercup-desktop @@ -35,21 +33,23 @@ $ chmod +x buttercup-desktop-1.11.0-x86_64.AppImage $ ./buttercup-desktop-1.11.0-x86_64.AppImage ``` -运行此命令后,会提示是否要将 Buttercup AppImage 集成到你的系统中。如果选择“Yes”,则会将其添加到应用程序菜单并安装图标。如果不这样做,你仍然可以通过双击 AppImage 或在终端中使用上述命令启动应用程序。 +运行此命令后,会提示是否要将 Buttercup AppImage 集成到你的系统中。如果选择 “Yes”,则会将其添加到应用程序菜单并安装图标。如果不这样做,你仍然可以通过双击 AppImage 或在终端中使用上述命令启动应用程序。 ### 添加存档 第一次启动时,会看到下面的欢迎界面: + ![](https://www.ostechnix.com/wp-content/uploads/2018/11/buttercup-1.png) -我们还没有添加任何存档,所以让我们添加一个吧。单击“New Archive File”按钮,输入存档文件的名称,并选择它的保存位置。 +我们还没有添加任何存档,所以让我们添加一个吧。单击 “New Archive File” 按钮,输入存档文件的名称,并选择它的保存位置。 + ![](https://www.ostechnix.com/wp-content/uploads/2018/11/buttercup-2.png) -你可以随意命名。我把它命名为“mypass”,存档将以 **.bcup** 为扩展名保存在你选择的位置。 +你可以随意命名。我把它命名为 “mypass”,存档将以 .bcup 为扩展名保存在你选择的位置。 -如果你已经创建了一个,只需单击“Open Archive File”来选择它。 +如果你已经创建了一个,只需单击 “Open Archive File” 来选择它。 -接下来,buttercup 将提示你为新创建的存档输入主密码,建议提供一个强级别的密码,以保护存档不受未经授权的访问。 +接下来,Buttercup 将提示你为新创建的存档输入主密码,建议提供一个强级别的密码,以保护存档不会被未经授权访问。 ![](https://www.ostechnix.com/wp-content/uploads/2018/11/buttercup-3.png) @@ -57,7 +57,7 @@ $ ./buttercup-desktop-1.11.0-x86_64.AppImage 让我们继续在存档中添加账户的详细信息。 -### 在存档中添加条目(登陆凭证) +### 在存档中添加条目(登录凭证) 创建或打开存档后,你将看到下面的界面。 @@ -65,33 +65,33 @@ $ ./buttercup-desktop-1.11.0-x86_64.AppImage 它就像一个保险库,我们将保存不同账户的登录凭证。如你所见,我们并没有添加任何条目。让我们添加一些。 -点击右下角的“ADD ENTRY”按钮来添加新的条目,输入你想要保存的账户的信息。 +点击右下角的 “ADD ENTRY” 按钮来添加新的条目,输入你想要保存的账户的信息。 ![](https://www.ostechnix.com/wp-content/uploads/2018/11/buttercup-5-1.png) -在每个条目下面都有一个“ADD NEW FIELD”选项,可以用来添加其他的细节。只需点击它,然后添加要包含在条目中的字段。 +在每个条目下面都有一个 “ADD NEW FIELD” 选项,可以用来添加其他的细节。只需点击它,然后添加要包含在条目中的字段。 添加完所有条目后,你将在 Buttercup 界面的右侧窗格中看到它们。 ![][6] -### 添加新的群组 +### 添加新的分组 -你还可以将登陆的详细信息分组到不同的名称下,以便于识别。例如,你可以将所有邮箱账户分组到一个名为“my_mails”的名称下。默认情况下,你的登录详细信息将保存在“General”群组下。要创建新的群组,请点击“NEW GROUP”按钮并输入名称。在新的群组中创建新条目时,与上述的步骤相同,只需单击组名并开始添加条目。 +你还可以将登录的详细信息分组到不同的名称下,以便于识别。例如,你可以将所有邮箱账户分组到一个名为 “my_mails” 的名称下。默认情况下,你的登录详细信息将保存在 “General” 群组下。要创建新的群组,请点击 “NEW GROUP” 按钮并输入名称。在新的群组中创建新条目时,与上述的步骤相同,只需单击组名并开始添加条目。 -### 管理和访问登陆的详细信息 +### 管理和访问登录的详细信息 -存储在存档中的数据可以随时编辑、移动到其他组或彻底删除。例如,如果要将用户名或密码复制到剪切板,请右击该条目,然后选择“Copy to Clipboard”。 +存储在存档中的数据可以随时编辑、移动到其他组或彻底删除。例如,如果要将用户名或密码复制到剪切板,请右击该条目,然后选择 “Copy to Clipboard”。 ![][7] -(译注:没理解这个 in the future 的意思)要在将来编辑/修改数据,只需点击所选条目下的“Edit”按钮。 +要进一步编辑/修改数据,只需点击所选条目下的 “Edit” 按钮。 ### 在远程保存存档 默认情况下,Buttercup 会将数据保存在本地系统上。但是,你可以将它们保存在不同的远程服务(例如 Dropbox、OwnCloud、NextCloud 和基于 WebDAV 的服务)上。 -要连接这些服务,请点击 **File - > Connect Cloud Sources**。 +要连接这些服务,请点击 “File -> Connect Cloud Sources”。 ![](https://www.ostechnix.com/wp-content/uploads/2018/11/buttercup-8.png) @@ -107,13 +107,16 @@ Buttercup 允许你向其他密码管理器(例如 1Password、Lastpass 和 Ke ![][9] -Buttercup 是一个简单但成熟、功能齐全的密码管理器。多年来它一直在积极发展。如果你需要密码管理器,Buttercup 可能是个不错的选择。有关更多的详细信息,请参阅项目网站和 GitHub 页面。 +Buttercup 是一个简单但成熟、功能齐全的密码管理器。多年来它一直在积极开发。如果你需要密码管理器,Buttercup 可能是个不错的选择。有关更多的详细信息,请参阅项目网站和 GitHub 页面。 那就介绍到这里,希望它对你有用。更多的精彩内容即将到来,敬请关注! 谢谢! +### 资源 +- [Buttercup 网站](https://buttercup.pw/) +- [Buttercup GitHub 仓库](https://github.com/buttercup/buttercup-desktop) -------------------------------------------------------------------------------- @@ -122,13 +125,13 @@ via: https://www.ostechnix.com/buttercup-a-free-secure-and-cross-platform-passwo 作者:[SK][a] 选题:[lujun9972][b] 译者:[seriouszyx](https://github.com/seriouszyx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [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/keeweb-an-open-source-cross-platform-password-manager/ +[1]: https://linux.cn/article-10211-1.html [2]: https://github.com/buttercup/buttercup-desktop/releases/latest [3]: https://aur.archlinux.org/packages/buttercup-desktop/ [4]: https://www.ostechnix.com/yay-found-yet-another-reliable-aur-helper/ From b51ddad34e3b9f4655d3bc2ce5bc2ee4ac444bea Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 10 Dec 2018 22:26:04 +0800 Subject: [PATCH 0037/4278] PUB: 20181112 A Free, Secure And Cross-platform Password Manager.md @seriouszyx https://linux.cn/article-10331-1.html --- ...20181112 A Free, Secure And Cross-platform Password Manager.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181112 A Free, Secure And Cross-platform Password Manager.md (100%) diff --git a/translated/tech/20181112 A Free, Secure And Cross-platform Password Manager.md b/published/20181112 A Free, Secure And Cross-platform Password Manager.md similarity index 100% rename from translated/tech/20181112 A Free, Secure And Cross-platform Password Manager.md rename to published/20181112 A Free, Secure And Cross-platform Password Manager.md From 07a7d22341595b95d8c6ec203b05b591349c0055 Mon Sep 17 00:00:00 2001 From: alim0x Date: Mon, 10 Dec 2018 22:47:00 +0800 Subject: [PATCH 0038/4278] [translating]DevOps is for everyone --- sources/talk/20181121 DevOps is for everyone.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181121 DevOps is for everyone.md b/sources/talk/20181121 DevOps is for everyone.md index 075046f615..256a4e9fc3 100644 --- a/sources/talk/20181121 DevOps is for everyone.md +++ b/sources/talk/20181121 DevOps is for everyone.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (alim0x) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (DevOps is for everyone) From b71990694ae6cf5f3c85525c3d5fbeb0a1991cd1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 11 Dec 2018 08:59:51 +0800 Subject: [PATCH 0039/4278] translated --- ...le Formats with SoundConverter in Linux.md | 92 ------------------ ...le Formats with SoundConverter in Linux.md | 94 +++++++++++++++++++ 2 files changed, 94 insertions(+), 92 deletions(-) delete mode 100644 sources/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md create mode 100644 translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md diff --git a/sources/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md b/sources/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md deleted file mode 100644 index d77062526b..0000000000 --- a/sources/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Easily Convert Audio File Formats with SoundConverter in Linux) -[#]: via: (https://itsfoss.com/sound-converter-linux/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -[#]: url: ( ) - -Easily Convert Audio File Formats with SoundConverter in Linux -====== - -**If you are looking for converting audio file formats to wav, mp3, ogg or any other format, SoundConverter is the tool you need in Linux.** - -![Audio Converter in Linux][1] - -So recently I purchased some DRM-free music. I got it from [SaReGaMa][2], the oldest and the largest music labels in India. The downloaded files were in HD quality and in WAV format. - -Unfortunately, Rhythmbox doesn’t play the WAV files. On top of that, a single file was around 70 MB in size. Imagine transferring such large music files to smartphones. It would eat up a lot of space unnecessarily. - -So I thought it was time to convert the WAV files to MP3, the evergreen and the most popular music file format. - -And for this task, I needed an audio converter in Linux. In this quick tutorial, I’ll show you how can you convert your audio files from one format to another easily with a GUI tool called SoundCoverter. - -### Installing SoundConverter in Linux - -[SoundConverter][3] is a popular free and open source software. It should be available in the official repository of most Linux distributions. - -Ubuntu/Linux Mint users can simply search for SoundConverter in the software center and install it from there. - -![SoundConverter application in Software Center of Ubuntu][4]SoundConverter can be installed from Software Center - -Alternatively, you can use the command line way. In Debian and Ubuntu based systems, you can use the following command: - -``` -sudo apt install soundconverter -``` - -For Arch, Fedora and other non-Debian based distributions, you can use the software center or the package manager of your distribution. - -### Using SoundConverter to convert audio file formats in Linux - -Once you have installed SoundConverter, search for it in the menu and start it. - -The default interface looks like this and it cannot be more simple than this: - -![SoundConverter application interface in Linux][5]Simple Interface - -Converting audio file format is as easy as selecting the file and clicking on convert. - -However, I would advise you to check the default settings at least on the first run. By default it converts the audio file to OGG file format and you may not want that. - -![Preferences in SoundConverter][6]Default output settings can be changed in Preferences - -To change the default output settings, click on the Preferences icon visible on the interface. You’ll see plenty of options to change here. - -You can change the default output format, bitrate, quality etc. You can also choose if you want to keep the converted files in the same folder as the original or not. - -There is also an option of automatically deleting the original file after conversion. I don’t think you should use that option. - -You can also change the output file name. By default, it will just change the suffix but you can also choose to name it based on track number, title, artist etc. For that to happen, you should have proper metadata on the original file. - -Speaking of metadata, have you heard of [MusicBrainz Picard][7]? This tool helps you automatically updates the metadata of your local music files. - -### Conclusion - -I have discussed [recording audio in Linux][8] previously with a similar tiny application. Such nifty tools actually make life easier with their focused aim of completing a certain task. You may use full-fledged and a lot better audio editing tool like [Audacity][9] but that may be complicated to use for smaller tasks like converting audio file formats. - -I hope you like SoundConverter. If you use some other tool, do mention that in the comments and I may cover it here on It’s FOSS. Enjoy! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/sound-converter-linux/ - -作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/Convert-audio-file-format-linux.png?resize=800%2C450&ssl=1 -[2]: https://en.wikipedia.org/wiki/Saregama -[3]: http://soundconverter.org/ -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-software-center.png?ssl=1 -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-app-linux.jpeg?ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-app-linux-preferences.jpeg?resize=800%2C431&ssl=1 -[7]: https://itsfoss.com/musicbrainz-picard/ -[8]: https://itsfoss.com/record-streaming-audio/ -[9]: https://www.audacityteam.org/ diff --git a/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md b/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md new file mode 100644 index 0000000000..0ad348edb0 --- /dev/null +++ b/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Easily Convert Audio File Formats with SoundConverter in Linux) +[#]: via: (https://itsfoss.com/sound-converter-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) +[#]: url: ( ) + +在 Linux 中使用 SoundConverter 轻松转换音频文件格式 +====== + +**如果你正在寻找将音频文件格式转换为 wav、mp3、ogg 或任何其他格式,SoundConverter 是你在 Linux 中需要的工具。** + +![Audio Converter in Linux][1] + +最近我购买了一些没有 DRM 的音乐。我是从 [SaReGaMa][2] 那里买的,这是一家印度历史最悠久,规模最大的音乐品牌。下载的文件采用高清质量的 WAV 格式。 + +不幸的是,Rhythmbox 无法播放 WAV。最重要的是,单个文件大小约为 70MB。想象一下,将这么大的音乐传输到智能手机。它会不必要地占用大量空间。 + +所以我认为是时候将 WAV 文件转换为 MP3,这个长青且最流行的音乐文件格式。 + +为此,我需要一个在 Linux 中的音频转换器。在这个教程中,我将向你展示如何使用名为 SoundCoverter 的 GUI 工具轻松地将音频文件从一种格式转换为另一种格式。 + +### 在 Linux 中安装 SoundConverter + +[SoundConverter][3] 是一款流行的免费开源软件。它应该可以在大多数 Linux 发行版的官方仓库中找到。 + +Ubuntu/Linux Mint 用户只需在软件中心搜索 SoundConverter 并从那里安装即可。 + +![SoundConverter application in Software Center of Ubuntu][4] +SoundConverter 可以从软件中心安装 + +或者,你可以使用命令行方式。在基于 Debian 和 Ubuntu 的系统中,你可以使用以下命令: + +``` +sudo apt install soundconverter +``` + +在 Arch、Fedora 和其他非基于 Debian 的发行版中,你可以使用你的发行版的软件中心或软件包管理器。 + +### 在 Linux 中使用 SoundConverter 转换音频文件格式 + +安装完 SoundConverter 后,在菜单中搜索并启动它。 + +默认界面看起来像这样,它不能比这简单: + +![SoundConverter application interface in Linux][5]Simple Interface + +转换音频文件格式只要选择文件并单击转换。 + +但是,我建议你至少在第一次运行时检查下默认设置。默认情况下,它会将音频文件转换为 OGG 文件格式,你可能不希望这样。 + +![Preferences in SoundConverter][6] +可以在“首选项”中更改默认输出设置 + +要更改默认输出设置,请单击界面上的“首选项”图标。你会在这里看到很多可更改的选择。 + +你可以更改默认输出格式、比特率、质量等。你还可以选择是否要将转换后的文件保存在与原始文件相同的文件夹中。 + +转换后还可以选择自动删除原始文件。我不认为你应该使用那个选项。 + +你还可以更改输出文件名。默认情况下,它只会更改后缀,但你也可以选择根据曲目编号、标题、艺术家等进行命名。为此,原始文件中应包含适当的元数据。 + +说到元数据,你听说过 [MusicBrainz Picard][7]吗?此工具可帮助你自动更新本地音乐文件的元数据。 + +### 总结 + +我之前用讨论过用一个小程序[在 Linux 中录制音频][8]。这些很棒的工具通过专注某个特定的任务使得生活更轻松。你可以使用成熟和更好的音频编辑工具,如 [Audacity][9],但对于较小的任务,如转换音频文件格式,它可能用起来很复杂。 + +我希望你喜欢 SoundConverter。如果你使用其他工具,请在评论中提及,我会在 FOSS 中提及。使用开心! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/sound-converter-linux/ + +作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/Convert-audio-file-format-linux.png?resize=800%2C450&ssl=1 +[2]: https://en.wikipedia.org/wiki/Saregama +[3]: http://soundconverter.org/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-software-center.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-app-linux.jpeg?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-app-linux-preferences.jpeg?resize=800%2C431&ssl=1 +[7]: https://itsfoss.com/musicbrainz-picard/ +[8]: https://itsfoss.com/record-streaming-audio/ +[9]: https://www.audacityteam.org/ \ No newline at end of file From 0cc97d4d35429b73e226914ad0874e2d98edcccb Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 11 Dec 2018 09:02:11 +0800 Subject: [PATCH 0040/4278] translating --- ...81205 Bring some color to your Linux terminal with lolcat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md b/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md index 740e95c3bf..3e070414ae 100644 --- a/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md +++ b/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Bring some color to your Linux terminal with lolcat) From dad4389513a2bc7c0d212d38c74cfc63bb8f99f8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 11 Dec 2018 11:44:27 +0800 Subject: [PATCH 0041/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Snake=20your=20?= =?UTF-8?q?way=20across=20your=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ake your way across your Linux terminal.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/tech/20181210 Snake your way across your Linux terminal.md diff --git a/sources/tech/20181210 Snake your way across your Linux terminal.md b/sources/tech/20181210 Snake your way across your Linux terminal.md new file mode 100644 index 0000000000..5ae452dcf5 --- /dev/null +++ b/sources/tech/20181210 Snake your way across your Linux terminal.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Snake your way across your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-snake) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Snake your way across your Linux terminal +====== +Python isn't the only snake you'll find at the Linux command line with this classic 1970s game remake. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-snake.png?itok=oNhqUTDu) + +Welcome back to the 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. It's hard to say exactly, but my definition is anything that helps you have fun at the terminal. + +We've been on a roll with games over the weekend, and it was fun, so let's look at one more game today, Snake! + +Snake is an oldie but goodie; versions of it have been around seemingly forever. The first version I remember playing was one called [Nibbles][1] that came packaged with [QBasic][2] in the 1990s, and was probably pretty important to my understanding of what a programming language even was. Here I had the source code to a game that I could modify and just see what happens, and maybe learn something about what all of those funny little words that made up a programming language were all about. + +Today's [Snake][3] is written in Go, and while it's simple, it's just as much fun as the original. Like most simple old games, there are a ton of versions to choose from. In Snake's case, there's even a version in the classic [bsdgames][4] package that's almost certainly packaged for your distribution. + +But what I like about this version of Snake is that it's packaged for Docker so I can easily run it in one line from my terminal without worrying about anything disto-specific. That, and it makes use of 15 randomized food emojis for the snake to eat. I'm a sucker for food emojis. Anyway, give it a try using: + +``` +$ docker run -ti dyego/snake-game +``` + +This Snake is licensed as open source under an MIT license, and you can check out the source code [on GitHub][3]. +![](https://opensource.com/sites/default/files/uploads/linux-toy-snake-animated.gif) +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Powers of two, powers of Linux: 2048 at the command line][5], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-snake + +作者:[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://en.wikipedia.org/wiki/Nibbles_(video_game) +[2]: https://en.wikipedia.org/wiki/QBasic +[3]: https://github.com/DyegoCosta/snake-game +[4]: https://github.com/vattam/BSDGames +[5]: https://opensource.com/article/18/12/linux-toy-2048 From 95fe23b0b6775885bd206bc5f84816d4111d411c Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 11 Dec 2018 11:47:47 +0800 Subject: [PATCH 0042/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20get?= =?UTF-8?q?=20started=20in=20AI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20181210 How to get started in AI.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20181210 How to get started in AI.md diff --git a/sources/tech/20181210 How to get started in AI.md b/sources/tech/20181210 How to get started in AI.md new file mode 100644 index 0000000000..b0ac291557 --- /dev/null +++ b/sources/tech/20181210 How to get started in AI.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to get started in AI) +[#]: via: (https://opensource.com/article/18/12/how-get-started-ai) +[#]: author: (Gordon Haff https://opensource.com/users/ghaff) + +How to get started in AI +====== +Before you can begin working in artificial intelligence, you need to acquire some human intelligence. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain-think-ai-intelligence-ccby.png?itok=C-gK01E_) + +I've both asked and been asked about the best way to learn more about artificial intelligence (AI). What should I read? What should I watch? I'll get to that. But, first, it's useful to break down this question, given that AI covers a lot of territory. + +One important distinction to draw is between the research side of AI and the applied side. Cassie Kozyrkov of Google [drew this distinction][1] in a talk at the recent O'Reilly Artificial Intelligence Conference in London, and it's a good one. + +Research AI is rather academic in nature and requires a heavy dose of math across a variety of disciplines before you even get to those parts that are specific to AI. This aspect of AI focuses on the algorithms and tools that drive the state of AI forward. For example, what neural network structures might improve vision recognition results? How might we make unsupervised learning a more generally useful approach? Can we find ways to understand better how deep learning pipelines come up with the answers they do? + +Applied AI, on the other hand, is more about using existing tools to obtain useful results. Open source has played a big role here in providing free and often easy-to-use software in a variety of languages. Public cloud providers have also devoted a lot of attention to providing machine learning services, models, and datasets that make the onramp to getting started with AI much simpler than it would be otherwise. + +I'll add at this point that applied AI practitioners shouldn't treat their tools as some sort of black box that spits out answers for mysterious reasons. At a minimum, they need to understand the limits and potential biases of different techniques, models, and data collection approaches. It's just that they don't necessarily need to delve deeply into all the theory underpinning every part of their toolchain. + +Although it's probably less important for working in AI on a day-to-day basis, it's also useful to understand the broader context of AI. It goes beyond the narrow scope of deep learning on neural networks that have been so important to the gains made in reinforcement learning and supervised learning to date. For example, AI is often viewed as a way to augment (rather than replace) human judgment and decisions. But the handoff between machine and human has its own pitfalls. + +With that background, here are some study areas and resources you may find useful. + +### Research AI + +In a lot of respects, a list of resources for research AI mirror those in an undergraduate (or even graduate) computer science program that's focused on AI. The main difference is that the syllabus you draw up may be more interdisciplinary than more traditionally focused university curricula. + +Where you start will depend on your computer science and math background. + +If it's minimal or rusty, but you still want to develop a deep understanding of AI fundamentals, you'll benefit from taking some math courses to start. There are many options on massive online open courses (MOOCs) like the nonprofit [edX][2] platform and [Coursera][3]. (Both platforms charge for certifications, but edX makes all the content available for free to people just auditing the course.) + +Typical foundational courses could include: + ++ [MIT's Calculus courses][22], starting with differentiation ++ [Linear Algebra][23] (University of Texas) ++ Probability and statistics, such as MIT's [Probability—The Science of Uncertainty and Data][24] + + +To get deeper into AI from a research perspective, you'll probably want to get into all these areas of mathematics and more. But the above should give you an idea of the general branches of study that are probably most important before delving into machine learning and AI proper. + +In addition to MOOCs, resources such as [MIT OpenCourseWare][4] provide the syllabus and various supporting materials for a wide range of mathematics and computer science courses. + +With the foundations in place, you can move onto more specialized courses in AI proper. Andrew Ng's AI MOOC, from when he was teaching at Stanford, was one of the early courses to popularize the whole online course space. Today, his [Neural Networks and Deep Learning][5] is part of the Deep Learning specialization at Coursera. There are corresponding programs on edX. For example, Columbia offers an [Artificial Intelligence MicroMasters][6]. + +In addition to courses, a variety of textbooks and other learning material are also available online. These include: + + * [Neural Networks and Deep Learning][7] + * [Deep Learning][8] from MIT Press by Ian Goodfellow and Yoshua Bengio and Aaron Courville + +### Applied AI + +Applied AI is much more focused on using available tools than building new ones. Some appreciation of the mathematical underpinnings, especially statistics, is still useful—arguably even necessary—but you won't be majoring in that aspect of AI to the same degree you would in a research mode. + +Programming is a core skill here. While different programming languages can come into play, a lot of libraries and toolsets—such as [PyTorch][9]—rely on Python, so that's a good skill to have. Especially if you have some level of programming background, MIT's [Introduction to Computer Science and Programming Using Python][10], based on its on-campus 6.001 course, is a good primer. If you're truly new to programming, Charles Severance's [Programming for Everybody (Getting Started with Python)][11] from the University of Michigan doesn't toss you into the deep end of the pool the way the MIT course does. + +[The R programming language][12] is also a useful skill to add to your toolbox. While it's less used in machine learning (ML) per se, it's common for a variety of other data science tasks, and applied AI/ML and data science often blend in practice. For example, many tasks associated with organizing and cleaning data apply equally whatever analysis techniques you'll eventually use. A MOOC sequence like Harvard's [Data Science certificate][13] is an example of a set of courses that provide a good introduction to working with data. + +Another open source software library you're likely to encounter if you do any work with AI is [TensorFlow][14]. It was originally developed by researchers and engineers from the Google Brain team within Google's AI organization. [Google offers a variety of tutorials][15] to get started with TensorFlow using the high-level Keras API. You can run TensorFlow locally as well as online in Google Cloud. + +In general, all of the big public cloud providers offer online datasets and ML services that can be an easy way to get started. However, especially as you move beyond "play" datasets and applications, you need to start thinking seriously about the degree to which you want to be locked into a single provider. + +Datasets for your exploratory learning projects are available from many different sources. In addition to the public cloud providers, [Kaggle][16] is another popular source and also a good learning resource more broadly. Government data is also increasingly available in digital form. The US Federal Government's [Data.gov][17] claims over 300,000 datasets. State and local governments also publish data on everything from restaurant health ratings to dogs' names. + +### Miscellany + +I'll close by noting that AI is a broad topic that isn't just about math, programming, and data. AI as a whole touches many other fields, including cognitive psychology, linguistics, game theory, operations research, and control systems. Indeed, a concern among at least some AI researchers today is that the field has become too fixated on a small number of techniques that have become powerful and interesting only quite recently because of the intersection of processing power and big data. Many longstanding problems in understanding how humans learn and reason remain largely unsolved. Developing at least some appreciation for these broader problem spaces will better enable you to place AI within a broader context. + +One of my favorite examples is the [Humans and Autonomy Lab][18] at Duke. The work in this lab touches on all the challenges of humans working with machines, such as how autopilots can create ["Children of the Magenta"][19] who are unable to take control quickly if the automation fails. A basic brain-science course, such as MIT's [Introduction to Psychology][20], provides some useful context for the relationship between human intelligence and machine intelligence. Another course in a similar vein, but taught by the late Marvin Minsky from MIT's Electrical Engineering and Computer Science department, is [The Society of Mind][21]. + +If there's one key challenge to learning about AI, it's not that raw materials and tools aren't readily available. It's that there are so many of them. My objective hasn't been to give you a comprehensive set of pointers. Rather, it's been to both point out the different paths you can take and provide you with some possible starting points. Happy learning! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/how-get-started-ai + +作者:[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://www.youtube.com/watch?v=RLtI7r3QUyY +[2]: https://www.edx.org/ +[3]: https://www.coursera.org/ +[4]: https://ocw.mit.edu/index.htm +[5]: https://www.coursera.org/learn/neural-networks-deep-learning +[6]: https://www.edx.org/micromasters/columbiax-artificial-intelligence +[7]: http://neuralnetworksanddeeplearning.com/ +[8]: http://www.deeplearningbook.org/ +[9]: https://pytorch.org/ +[10]: https://www.edx.org/course/introduction-to-computer-science-and-programming-using-python +[11]: https://www.coursera.org/learn/python +[12]: https://www.r-project.org/about.html +[13]: https://www.edx.org/professional-certificate/harvardx-data-science +[14]: https://www.tensorflow.org/ +[15]: https://www.tensorflow.org/tutorials/ +[16]: https://www.kaggle.com/ +[17]: https://www.data.gov/ +[18]: https://hal.pratt.duke.edu/ +[19]: https://99percentinvisible.org/episode/children-of-the-magenta-automation-paradox-pt-1/ +[20]: https://ocw.mit.edu/courses/brain-and-cognitive-sciences/9-00sc-introduction-to-psychology-fall-2011/ +[21]: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-868j-the-society-of-mind-fall-2011/ +[22]: https://www.edx.org/course/calculus-1a-differentiation +[23]: https://www.edx.org/course/linear-algebra-foundations-to-frontiers +[24]: https://courses.edx.org/courses/course-v1:MITx+6.431x+3T2018/course/ From 7e96a46a1b62c2b7fb76166bd8e31187361a8ea1 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 11 Dec 2018 11:51:23 +0800 Subject: [PATCH 0043/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20McFly=20?= =?UTF-8?q?=E2=80=93=20A=20Replacement=20To=20=E2=80=98Ctrl+R=E2=80=99=20B?= =?UTF-8?q?ash=20History=20Search=20Feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To ‘Ctrl-R- Bash History Search Feature.md | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md diff --git a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md new file mode 100644 index 0000000000..4c1da08110 --- /dev/null +++ b/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -0,0 +1,160 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) +[#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature +====== +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png) +If you spend a lot of time on CLI mode, you should definitely used or heard about **reverse search** function in BASH. The keyboard shortcut to do reverse search in Bash is **Ctrl+r**. Using bash reverse search, we can bring up all commands which we used previously executed without having to re-type them every time. You can, of course, use UP/DOWN arrows to search your bash history. However, Ctrl+r will make this process much easier and faster. Today, I Stumbled upon a replacement to ‘Ctrl+r’ Bash history search feature. Meet **“McFly”** , a simple tool written in **Rust** programming language that replaces the default Ctrl+r Bash history search with an intelligent search engine. All command suggestions made by McFly are prioritized in real time with a small **neural network**. + +McFly rebinds Ctrl+r functionality to bring up all recently executed commands from your Bash history. It augments your shell history by tracking the following: + + * Command exit status, + * timestamp (When you run the command), + * and execution directory (Where you run the command). + + + +It saves all tracking details in a SQLite database. Since it tracks the command’s historical exit status, you can simply ignore the old failed commands. Cool, yeah? + +When suggesting a command, McFly considers the following facts: + + * On which directory you ran the command. You’re likely to repeat that command in the same directory in future. + * What commands you typed before the command. + * How often you run the command. + * When you last ran the command. + * If you’ve selected the command in McFly before. + * The command’s historical exit status. Because, you probably don’t want to run old failed commands, right? + + + +McFly maintains your default Bash history file, so you can stop using McFly at any time. McFly is not just for BASH, it is also extendable for other shells as well. + +### Installing McFly + +McFly can be installed using Linuxbrew on Linux. If you haven’t installed Linuxbrew yet, refer the following link. + +[Linuxbrew – A Common Package Manager For Linux And Mac OS X][1] + +Once Linuxbrew installed, run the following commands to install McFly: + +``` +$ brew tap cantino/mcfly https://github.com/cantino/mcfly + +$ brew install mcfly +``` + +After the installation is completed, you will see the following output. + +``` +==> Installing mcfly from cantino/mcfly +==> Downloading https://github.com/cantino/mcfly/releases/download/v0.2.5/mcfly-v0 +==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.c +######################################################################## 100.0% +==> ONE MORE STEP! Edit ~/.bashrc and add the following: + +if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then +. $(brew --prefix)/opt/mcfly/mcfly.bash +fi +🍺 /home/linuxbrew/.linuxbrew/Cellar/mcfly/v0.2.5: 4 files, 3.5MB, built in 33 seconds +``` +![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png) +As you can see, we need to do one more step before start using McFly. + +Add the following lines to your **~/.bashrc** file: + +``` +if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then +. $(brew --prefix)/opt/mcfly/mcfly.bash +fi +``` + +Finally, run the following command to take effects changes: + +``` +$ source ~/.bashrc +``` + +Your BASH history will be imported to McFly database when you run this command for the first time. It will take a few moments depending upon size of your bash history file. Once the import is done, you will see the following message. + +``` +McFly: Importing Bash history for the first time. This may take a minute or two...done. +``` + +You can now start using McFly. + + +### Usage + +To search through your command history, just type ‘mcfly search’ followed by the part of the command name and hit ENTER key. Mcfly will display the command suggestions based on the search query you just type. + +``` +$ mcfly search +``` + +For instance, I type the following command: + +``` +$ mcfly search mk +``` + +Here is the sample output from my Ubuntu machine: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png) + +As you can see, I have used ‘mkdir’ command two times. If you want to run a command from the list of suggestions, just use **UP/DOWN** arrows to select it and hit ENTER to run it immediately. If you want to edit a command, choose it and hit **TAB** key to bring it back to your Terminal and then edit before running it. To delete the selected command from the history, just press **F2**. + +Alternatively, type the following command to open the history search and then type any command or part of the command to view the suggestions from your history. + +``` +$ mcfly search +``` + +McFly will display the command suggestions as you type. + +Here is a short video demonstration of McFly: +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif) +View help: + +``` +$ mcfly --help +``` + + +### Remove McFly + +Don’t like McFly, no problem! Remove it using the following commands: + +``` +$ brew uninstall mcfly + +$ brew untap cantino/mcfly +``` + +Finally, remove the lines which we added earlier from **~/.bashrc** file. + +And, that’s all for now. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/ + +作者:[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/linuxbrew-common-package-manager-linux-mac-os-x/ From 8f8020834752d49289f78b3123a353439f3e3f2d Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 11 Dec 2018 12:13:30 +0800 Subject: [PATCH 0044/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Four=20Easy=20W?= =?UTF-8?q?ays=20to=20Search=20Or=20Find=20Files=20And=20Folders=20in=20Li?= =?UTF-8?q?nux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...arch Or Find Files And Folders in Linux.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md diff --git a/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md b/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md new file mode 100644 index 0000000000..8dde618420 --- /dev/null +++ b/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Four Easy Ways to Search Or Find Files And Folders in Linux) +[#]: via: (https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +Four Easy Ways to Search Or Find Files And Folders in Linux +====== + +Linux admins can’t able to leave a day without performing a file search as this one of the activity for their routine. + +It’s good to know all the file search stuffs because it would help you in many ways when you are working on headless server. + +These commands are not complicate to remember because these are using a standard syntax. + +This can be performed through Four Linux commands and each command has their own unique feature. + +### Method-1: Search Files And Folders in Linux Using find Command + +Find command is widely used and very famous command to search files and folders in Linux. It searches given files in the current directory and recursively through its sub-directories based on the search criteria. + +It allow users to perform all kind of file searches based on the criteria lie by size, name, owner, group, type, permissions, date, and other criteria. + +Run the following command to find a given file in system. + +``` +# find / -iname "sshd_config" +/etc/ssh/sshd_config +``` + +Run the following command to find a given folder in system. To search a folder in Linux we need to use `-type` parameter. + +``` +# find / -type d -iname "ssh" +/usr/lib/ssh +/usr/lib/go/src/cmd/vendor/golang.org/x/crypto/ssh +/usr/lib/go/pkg/linux_amd64/cmd/vendor/golang.org/x/crypto/ssh +/etc/ssh +``` + +Use wildcard option to search set of files on your system. We are going to search all files available in the system with `.config` extension. + +``` +# find / -name "*.config" +/usr/lib/mono/gac/avahi-sharp/1.0.0.0__4d116c78973743f5/avahi-sharp.dll.config +/usr/lib/mono/gac/avahi-ui-sharp/0.0.0.0__4d116c78973743f5/avahi-ui-sharp.dll.config +/usr/lib/python2.7/config/Setup.config +/usr/share/git/mw-to-git/t/test.config +/var/lib/lightdm/.config +/home/daygeek/.config +/root/.config +/etc/skel/.config +``` + +Use the following command format to find an empty files and folders in system. + +``` +# find / -empty +``` + +Use the following command combination to find all files containing specific text on Linux. + +``` +# find / -type f -exec grep "Port 22" '{}' \; -print +# find / -type f -print | xargs grep "Port 22" +# find / -type f | xargs grep 'Port 22' +# find / -type f -exec grep -H 'Port 22' {} \; +``` + +### Method-2: Search Files And Folders in Linux Using locate command + +locate command works faster than the find command because it uses updatedb database, whereas the find command searches in the real system. + +It uses a database rather than hunting individual directory paths to get a given file. + +locate command doesn’t pre-installed in most of the distributions so, use your distribution package manager to install it. + +The database is updated regularly through cron, however we can manually update it by running the following command. + +``` +$ sudo updatedb +``` + +Simply run the following command to list the given file or folder. There is no specific options need to be specified in locate command to print file or folder. + +To search `ssh` folder in system. + +``` +# locate --basename '\ssh' +/etc/ssh +/usr/bin/ssh +/usr/lib/ssh +/usr/lib/go/pkg/linux_amd64/cmd/vendor/golang.org/x/crypto/ssh +/usr/lib/go/src/cmd/go/testdata/failssh/ssh +/usr/lib/go/src/cmd/vendor/golang.org/x/crypto/ssh +``` + +To search `ssh_config` file in system. + +``` +# locate --basename '\sshd_config' +/etc/ssh/sshd_config +``` + +### Method-3: Search Files in Linux Using which command + +TThe which command returns the full path of the executable that would have been executed when the command had been entered in terminal. + +It’s very useful when you want to create a desktop shortcut or symbolic link for executable files. + +Which command searches the directories listed in the current user’s PATH environment variable not for all the users. I mean, when you are logged in your own account and you can’t able to search for root user file or directory. + +Run the following command to print the full path of the vim executable file location. + +``` +# which vi +/usr/bin/vi +``` + +Alternatively, it’s allowing user to perform multiple file search in one shot. + +``` +# which -a vi sudo +/usr/bin/vi +/bin/vi +/usr/bin/sudo +/bin/sudo +``` + +### Method-4: Search Files in Linux Using whereis command + +The whereis command used to search the binary, source, and man page files for a given command. + +``` +# whereis vi +vi: /usr/bin/vi /usr/share/man/man1/vi.1p.gz /usr/share/man/man1/vi.1.gz +``` +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/ + +作者:[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 From 512e039533da3e82b93ff6f58f596fd5a53256a1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 12:48:01 +0800 Subject: [PATCH 0045/4278] PRF:20181121 10 ways to give thanks to open source and free software maintainers.md @geekpi --- ...en source and free software maintainers.md | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/translated/talk/20181121 10 ways to give thanks to open source and free software maintainers.md b/translated/talk/20181121 10 ways to give thanks to open source and free software maintainers.md index 5dcda79b9e..9f3b5b970f 100644 --- a/translated/talk/20181121 10 ways to give thanks to open source and free software maintainers.md +++ b/translated/talk/20181121 10 ways to give thanks to open source and free software maintainers.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (10 ways to give thanks to open source and free software maintainers) [#]: via: (https://opensource.com/article/18/11/ways-give-thanks-open-source) @@ -8,39 +8,41 @@ [#]: url: ( ) 感谢开源和自由软件维护者的 10 种方法 -====== -如何表达你的感激之情。 -![](https://opensource.com/users/moshez) +======= -每天,我都使用高质量的软件,这些软件由没有要求付款的人开发和维护,他们尊重我的自由,并且慷慨地付出时间和精力。 +> 如何表达你的感激之情。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE) + +每天,我使用的那些高质量的软件 —— 开发和维护这些软件的人不需要我为之付款,他们尊重我的自由,并且慷慨地付出时间和精力。 在这个感恩的季节,我鼓励那些也使用和欣赏开源和自由软件维护者工作的人表达你的感激之情。以下是十种方法: ### 容易做到的 - 1. 发送电子邮件,感谢开发人员。具体点说,告诉他们你使用他们的什么软件以及你如何获益的。 - 2. 使用你最喜爱的社交媒体平台宣传它。 - 3. 写一篇关于你最喜欢的软件的博客文章。 +1、发送电子邮件感谢开发人员。具体点说,告诉他们你使用他们的什么软件以及它是如何帮助了你。 +2、使用你最喜爱的社交媒体平台宣传它。 +3、写一篇关于你最喜欢的软件的博客文章。 ### 捐款 - 4. 如果你最喜欢的开源项目接受捐款,请汇款。 - 5. 如果你受雇于使用开源软件的公司,看你是否可以说服管理层赞助某些项目。 - 6. 提供最高设置额度的捐款。社交动机能做的不可思议! +4、如果你最喜欢的开源项目接受捐款,请汇款。 +5、如果你受雇于使用开源软件的公司,看你是否可以说服管理层赞助某些项目。 +6、尽你所能地捐款。社交动机能做的不可思议! ### 花费时间 - 7. 帮助查看补丁。 - 8. 帮助分类 bug。 - 9. 回答 IRC、邮件列表或 [Stack Overflow][1] 中的问题。 +7、帮助审查补丁。 +8、帮助分类 bug。 +9、回答 IRC、邮件列表或 [Stack Overflow][1] 中的问题。 -**10. 额外的:**如果你像我一样,你在某个时候对开源社区的其他人说了一些严厉的话。承诺做得更好:用善良和开放沟通。感谢的最好方式是让开源社区成为人们能舒适沟通的地方。 +**10、额外的:**如果你像我一样,你在某个时候对开源社区的其他人说了一些严厉的话。承诺做得更好:用善良和开放沟通。感谢的最好方式是让开源社区成为人们能舒适沟通的地方。 -------------------------------------------------------------------------------- @@ -49,10 +51,10 @@ via: https://opensource.com/article/18/11/ways-give-thanks-open-source 作者:[Moshe Zadka][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/moshez [b]: https://github.com/lujun9972 -[1]: https://meta.stackoverflow.com/ \ No newline at end of file +[1]: https://meta.stackoverflow.com/ From b63e87093936d6aff9f034a5da6953458f467613 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 12:48:54 +0800 Subject: [PATCH 0046/4278] PUB:20181121 10 ways to give thanks to open source and free software maintainers.md @geekpi https://linux.cn/article-10333-1.html --- ...ive thanks to open source and free software maintainers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20181121 10 ways to give thanks to open source and free software maintainers.md (96%) diff --git a/translated/talk/20181121 10 ways to give thanks to open source and free software maintainers.md b/published/20181121 10 ways to give thanks to open source and free software maintainers.md similarity index 96% rename from translated/talk/20181121 10 ways to give thanks to open source and free software maintainers.md rename to published/20181121 10 ways to give thanks to open source and free software maintainers.md index 9f3b5b970f..4a70429555 100644 --- a/translated/talk/20181121 10 ways to give thanks to open source and free software maintainers.md +++ b/published/20181121 10 ways to give thanks to open source and free software maintainers.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (10 ways to give thanks to open source and free software maintainers) [#]: via: (https://opensource.com/article/18/11/ways-give-thanks-open-source) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10333-1.html) 感谢开源和自由软件维护者的 10 种方法 ======= From a0f1995061a808b012981aa58bde51737029454f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 13:05:22 +0800 Subject: [PATCH 0047/4278] PRF:20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md @oneforalone --- ...emails to org-mode and org-mode syncing.md | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/translated/tech/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md b/translated/tech/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md index 976979192f..f9e423899d 100644 --- a/translated/tech/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md +++ b/translated/tech/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md @@ -1,55 +1,56 @@ -Emacs #4:使用org-mode自动管理邮件及同步文档 +Emacs 系列(四):使用 Org 模式自动管理邮件及同步文档 ====== -这是 [Emacs 和 org-mode 系类][4]的第四篇。 -至今为止,你已经见识到了 org-mode 的强大和高效,如果你像我一样,你可能会想: +这是 [Emacs 和 Org 模式系列][4]的第四篇。 -“我真的很想让它在我所有的设备上同步。” +至今为止,你已经见识到了 Org 模式的强大和高效,如果你像我一样,你可能会想: + +> “我真的很想让它在我所有的设备上同步。” 或者是说: -“我能在 org-mode 中转发邮件吗?” +> “我能在 Org 模式中转发邮件吗?” 答案当然是肯定的,因为这就是 Emacs。 ### 同步 -由于 org-mode 只使用文本文件,所以使用任意工具都可以很容易地实现同步。我使用的是 git 的 git-remote-gcrypt。由于 git-remote-gcrypt 的一些限制,每台机器都倾向于推到自己的分支,并使用命令来控制。每台机子都会先合并其他所有的 branch 然后再将合并后的结果 push 到 master 上。cron 作业可以实现将机器上的 branch push 上去,而 elisp 会协调这一切--确保在同步之前保存缓冲区,在同步之后从磁盘刷新缓冲区,等等。 +由于 Org 模式只使用文本文件,所以使用任意工具都可以很容易地实现同步。我使用的是 git 的 `git-remote-gcrypt`。由于 `git-remote-gcrypt` 的一些限制,每台机器都倾向于推到自己的分支,并使用命令来控制。每台机器都会先合并其它所有的分支,然后再将合并后的结果推送到主干上。cron 作业可以实现将机器上的分支推送上去,而 elisp 会协调这一切 —— 确保在同步之前保存缓冲区,在同步之后从磁盘刷新缓冲区,等等。 这篇文章的代码有点多,所以我将把它链接到 github 上,而不是写在这里。 -我有一个用来存放我所有的 org-stuff 的目录 $HOME/org,在 ~/org 目录下有个 [Makefile][2] 文件来处理同步。该文件定义了一下目标: - * push: 添加,提交和 push 到以主机命名的 branch 上 - * fetch: 一个简单的 git fetch - * sync: 添加,提交和 pull 远程的修改,合并并将其 push 到以主机命名的 branch 和 master 上(假设合并成功) +我有一个用来存放我所有的 Org 模式的文件的目录 `$HOME/org`,在 `~/org` 目录下有个 [Makefile][2] 文件来处理同步。该文件定义了以下目标: + * `push`: 添加、提交和推送到以主机命名的分支上 + * `fetch`: 一个简单的 `git fetch` 操作 + * `sync`: 添加、提交和拉取远程的修改,合并,并(假设合并成功)将其推送到以主机命名的分支和主干上 现在,在我的用户 crontab 中有这个: -``` -*/15 * * * * make -C $HOME/org push fetch 2>&1 | logger --tag 'orgsync' ``` -[accompanying elisp code][3] 定义了一个快捷键(C-c s)来调用同步。多亏了 cronjob,只要文件被保存 -- 即使我没有在另一个 boxen 上同步 -- 它们也会被 pull 进来。 +*/15 * * * * make -C $HOME/org push fetch 2>&1 | logger --tag 'orgsync' +``` + +[与之相关的 elisp 代码][3] 定义了一个快捷键(`C-c s`)来调用同步。多亏了 cronjob,只要文件被保存 —— 即使我没有在另一个机器上同步 —— 它们也会被拉取进来。 我发现这个设置非常好用。 -### 用 org-mode 发邮件 +### 用 Org 模式发邮件 -在继续下去之前,首先要问自己一下:你真的需要它吗? 我用的是带有 [mu4e][4] 的 org-mode,而且它集成的也很好;任何组织任务都可以通过 message-id 链接到电子邮件,这很理想 -- 它可以让一个人做一些事情,比如提醒他在一周内回复一条消息。 +在继续下去之前,首先要问自己一下:你真的需要它吗? 我用的是带有 [mu4e][4] 的 Org 模式,而且它集成的也很好;任何 Org 模式的任务都可以通过 `Message-id` 链接到电子邮件,这很理想 —— 它可以让一个人做一些事情,比如提醒他在一周内回复一条消息。 -然而,org 不仅仅只有提醒。它还是一个知识库、创作系统等,但是并不是我所有的邮件客户端都使用 mu4e。(注意:像 MobileOrg 是存在于移动设备中)。我并没有像我想的那样经常使用它,但是它有它的用途,所以我认为我也应该在这里记录它。 +然而,Org 模式不仅仅只有提醒。它还是一个知识库、创作系统等,但是并不是我所有的邮件客户端都使用 mu4e。(注意:移动设备中有像 MobileOrg 这样的应用)。我并没有像我想的那样经常使用它,但是它有它的用途,所以我认为我也应该在这里记录它。 -现在我不仅想处理纯文本电子邮件。我希望能够处理附件、HTML 邮件等。这听起来很快就有问题了 -- 但是通过使用 ripmime 和 pandoc 这样的工具,情况还不错。 +现在我不仅想处理纯文本电子邮件。我希望能够处理附件、HTML 邮件等。这听起来很快就有问题了 —— 但是通过使用 ripmime 和 pandoc 这样的工具,情况还不错。 -第一步就是要用某些方法将获取到的邮件放入指定的文件夹下。扩展名,特殊用户等。然后我用 [fetchmail configuration][5] 来将它 pull 下来并运行我自己的 [insorgmail][6] 脚本。 +第一步就是要用某些方法将获取到的邮件放入指定的文件夹下。扩展名、特殊用户等。然后我用一个 [fetchmail 配置][5] 来将它拉取下来并运行我自己的 [insorgmail][6] 脚本。 -这个脚本就是处理所有有趣的部分了。它从 ripmime 开始处理消息,用 pandoc 将HTML 的部分转换为 org 格式。 org 的层次结构是用来尽可能最好地表示 email 的结构。使用HTML和其他工具时,email 可能会变得相当复杂,但我发现这对于我来说是可以接受的。 +这个脚本就是处理所有有趣的部分了。它开始用 ripmime 处理消息,用 pandoc 将 HTML 的部分转换为 Org 模式的格式。 Org 模式的层次结构是用来尽可能最好地表示 email 的结构。使用 HTML 和其他工具时,email 可能会变得相当复杂,但我发现这对于我来说是可以接受的。 ### 下一篇 -我最后一篇关于 org-mode 的文章将讨论如何使用它来编写文档和准备幻灯片 -- 我发现自己对 org-mode 的使用非常满意,但这需要一些调整。 - +我最后一篇关于 Org 模式的文章将讨论如何使用它来编写文档和准备幻灯片 —— 我发现自己对 Org 模式的使用非常满意,但这需要一些调整。 -------------------------------------------------------------------------------- @@ -58,7 +59,7 @@ via: http://changelog.complete.org/archives/9898-emacs-4-automated-emails-to-org 作者:[John Goerzen][a] 译者:[oneforalone](https://github.com/oneforalone) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2ae2ef44957c77ae0c7be98a6d00e9ee0a992960 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 13:05:54 +0800 Subject: [PATCH 0048/4278] PUB:20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md @oneforalone https://linux.cn/article-10334-1.html --- ...Emacs -4- Automated emails to org-mode and org-mode syncing.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md (100%) diff --git a/translated/tech/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md b/published/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md similarity index 100% rename from translated/tech/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md rename to published/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md From 9ac1bda1d33cffb7a66f24710793aad8895e6953 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Tue, 11 Dec 2018 13:07:38 +0800 Subject: [PATCH 0049/4278] Translating by qhwdw --- ...ction to Quantum Computing with Open Source Cirq Framework.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/sources/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md index 8cec20916d..ee35ef36ec 100644 --- a/sources/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md +++ b/sources/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @@ -1,3 +1,4 @@ +Translating by qhwdw An Introduction to Quantum Computing with Open Source Cirq Framework ====== As the title suggests what we are about to begin discussing, this article is an effort to understand how far we have come in Quantum Computing and where we are headed in the field in order to accelerate scientific and technological research, through an Open Source perspective with Cirq. From 8ec35df76d59af461f39a5dc01ba277d17c3d3ed Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 11 Dec 2018 15:02:29 +0800 Subject: [PATCH 0050/4278] hankchow translating --- .../20181205 Bash Variables- Environmental and Otherwise.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md b/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md index 11397f9b80..4df8c10143 100644 --- a/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md +++ b/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Bash Variables: Environmental and Otherwise) From e0f4674f9b120cb5f4c468db414864fb549aa89b Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Tue, 11 Dec 2018 17:02:12 +0800 Subject: [PATCH 0051/4278] translated --- ...04 Have a cow at the Linux command line.md | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) rename {sources => translated}/tech/20181204 Have a cow at the Linux command line.md (59%) diff --git a/sources/tech/20181204 Have a cow at the Linux command line.md b/translated/tech/20181204 Have a cow at the Linux command line.md similarity index 59% rename from sources/tech/20181204 Have a cow at the Linux command line.md rename to translated/tech/20181204 Have a cow at the Linux command line.md index a396c0ce14..ef08209828 100644 --- a/sources/tech/20181204 Have a cow at the Linux command line.md +++ b/translated/tech/20181204 Have a cow at the Linux command line.md @@ -1,5 +1,3 @@ -heguangzhi Translating - [#]: collector: (lujun9972) [#]: translator: (heguangzhi) [#]: reviewer: ( ) @@ -9,26 +7,28 @@ heguangzhi Translating [#]: author: (Jason Baker https://opensource.com/users/jason-baker) [#]: url: ( ) -Have a cow at the Linux command line + +在Linux命令行上拥有一头奶牛 ====== -Bring a bovine voice to your terminal output with the cowsay utility. + +使用 cowsay 实用程序将牛的声音带到你的终端输出。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cowsay.png?itok=RA4NDbrY) -Welcome to the fourth day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. 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. +欢迎来到 Linux 命令行玩具第四天。如果这是你第一次访问这个系列,你可能会问自己,什么是命令行玩具。我们也在考虑这一点,但是一般来说,这可能是一个游戏,或者任何简单的娱乐,可以帮助你在终端玩得开心。 -Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. Because just about everyone who I’ve mentioned this series to has asked me about it already, today’s selection is an obligatory one. +你们中的一些人以前会看过我们日历上的各种选项,但是我们希望每个人都至少有一个新的选项。因为几乎所有我提到这个系列的人都已经问过我了,今天的选项是必须的。 -You didn’t think we’d make it through this series without mentioning cowsay, did you? +你不认为我们会在不提及 cowsay 的情况下完成这个系列,是吗? -Cowsay is an udderly fantastic utility that takes text and outputs it as the spoken text of an ASCII-art bovine. +Cowsey 是一个神奇的实用程序,它将文本作为ASCII艺术牛的口语文本输出。 -You’ll likely find cowsay packaged in your default repositories, and perhaps even already installed. For me, in Fedora, all it took to install was: +你可能会发现 cowsey 打包在你的默认存储库中,甚至可能已经安装了。对我来说,在 Fedora,像这样安装: ``` $ sudo dnf install -y cowsay ``` - -Then, invoke it with cowsay followed by your message. Perhaps you’d like to pipe in the [fortune][1] [utility][1] we talked about yesterday. +然后,用 cowsey 调用它,然后是你的消息。也许你想到昨天我们谈到的 [幸运][1] [应用][1]。 ``` $ fortune | cowsay @@ -43,7 +43,7 @@ $ fortune | cowsay                 ||     || ``` -That’s it! **Cowsay** ships with few variations, called cow files, that can usually be found in **/usr/share/cowsay.** To see the cow file options available on your system, use **-l** flag after cowsay. Then, use the **-f** flag to try one out. +就这样!**CowSay** 几乎没有变化,称为 cow 文件,通常可以在 **/usr/share/cowsay** ,要查看系统上可用的 cow 文件选项,请在 cowsay 之后使用 **-l** 。然后,用 **-f** 试试其中之一。 ``` $ cowsay -f dragon "Run for cover, I feel a sneeze coming on." @@ -68,10 +68,10 @@ $ cowsay -f dragon "Run for cover, I feel a sneeze coming on."                ///-._ _ _ _ _ _ _}^ - - - - ~                     ~-- ,.-~                                                                   /.-~ ``` +我对 **cowsay** 的真正不满是,我今天没有足够的时间来为牛的挤奶。牛排太高了,我可能会开个玩笑。 -My real beef with **cowsay** is that I don’t have enough time today to really milk the cow puns for all they are worth. The steaks are just too high, and I might butcher the joke. +更严重的是,我已经完全忘记了 **cowsay** 直到我在学习可翻译的剧本时再次遇到它。如果你碰巧安装了 **cowyay**,当你运行脚本时,你会从一系列奶牛身上获得产出。例如,运行本脚本: -On a more serious note, I had completely forgotten about **cowsay** until I re-encountered it when learning Ansible playbooks. If you happen to have **cowsay** installed, when you run a playbook, you’ll get your output from a series of cows. For example, running this playbook: ``` - hosts: @@ -79,8 +79,7 @@ On a more serious note, I had completely forgotten about **cowsay** until I re-e   tasks:     - action: ping ``` - -Might give you the following: +可能会给你以下信息: ``` $ ansible-playbook playbook.yml @@ -124,14 +123,14 @@ ok: [localhost] localhost                  : ok=2    changed=0    unreachable=0    failed=0   ``` - -**Cowsay** is available under a GPLv3 license, and you can find the Perl [source code][2] on GitHub. I’ve also seen versions floating around in other languages, so take a look around for other variants; here’s [one in R][3], for example. Implementing your own version in your language of choice might even be a fun programming learning task. +**Cowsay** 在GPLV3许可证下可用,您可以在 GitHub 上找到 Perl [源代码][2]。我也见过其他语言的版本,所以看看其他变体;例如,这是 [R语言][3] 。用你选择的语言实现你自己的版本可能是一项有趣的编程学习任务。 Now that **cowsay** is out of the way, we can move on to greener pastures. +既然 **cowsay** 不碍事了,我们可以去更绿色的牧场了。 -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. +你有最喜欢的命令行玩具吗,你认为我应该对它进行分析?这个系列的日历大部分都填好了,但我还有一些地方。在下面的评论中让我知道,梦幻篮球来看看。如果有空间,梦幻篮球会尝试把它包括进去。如果没有,但是我收到了一些好的意见书,梦幻篮球在结尾做了一个荣誉提名的总结。 -Check out yesterday's toy, [How to bring good fortune to your Linux terminal][1], and check back tomorrow for another! +看看昨天的玩具,[如何给你的Linux终端带来好运][1],明天再来看看另一个! -------------------------------------------------------------------------------- @@ -139,7 +138,7 @@ via: https://opensource.com/article/18/12/linux-toy-cowsay 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 723eb145691c2ce7dcf081796f75af9b5fe69fa0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 17:56:43 +0800 Subject: [PATCH 0052/4278] PRF:20181112 The Source History of Cat.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @name1e5s 翻译的很棒!这个系列的文章值得字斟字酌地翻译。 --- .../20181112 The Source History of Cat.md | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/translated/talk/20181112 The Source History of Cat.md b/translated/talk/20181112 The Source History of Cat.md index 3644ce161e..155f5e928e 100644 --- a/translated/talk/20181112 The Source History of Cat.md +++ b/translated/talk/20181112 The Source History of Cat.md @@ -1,28 +1,29 @@ -The Source History of Cat +Cat 命令的源码历史 ====== -以前我和我的一些亲戚争论过计算机科学的学位值不值得读。当时我正在上大学,并要决定是不是该主修计算机。我姨和我一表姐觉得我不应该主修计算机。她们承认知道如何编程肯定是很有用且对自己有利的一件事,但是她们认为计算机科学现在发展的如此迅速以至于我学的东西几乎马上就过时了。建议我更好是把编程作为辅业,选择一个基础原理可以受用终身的领域主修,比如经济学或物理学。 -我知道我姨和我表姐说的不对,并决定主修计算机科学。(对不住啊!)平常人可能会觉得像计算机科学领域和软件工程专业每隔几年就完全和之前不一样了。其原因很容易理解。我们有了个人电脑,然后有了互联网,有了手机,之后还有了机器学习…… 科技总是在更新,支撑科技发展的原理和技能当然也在改变。当然,最惊人的是其实原理的改变竟然如此之小。我敢肯定,大多数人在知道了他们电脑里一些重要的软件的历史是多么久远时他们一定会深感震惊。当然我不是说那些刷版本号的浮夸软件 —— 我电脑上的 Firefox 浏览器副本,可能是我用的最多的软件,可能才更新不到两周。如果你看了比如 `grep` 的手册页,你就会发现他在 2010 年后就没有过更新了(至少在 MacOS 上如此)。初版 `grep` 是在 1974 年写就的,那时可以算是计算机世界的侏罗纪了。直到现在,人们(还有程序)仍然依赖 `grep` 来完成日常工作。 +以前我和我的一些亲戚争论过计算机科学的学位值不值得读。当时我正在上大学,并要决定是不是该主修计算机。我姨和我表姐觉得我不应该主修计算机。她们承认知道如何编程肯定是很有用且对自己有利的一件事,但是她们认为计算机科学现在发展的如此迅速以至于我学的东西几乎马上就过时了。建议我更好是把编程作为辅业,选择一个基础原理可以受用终身的领域主修,比如经济学或物理学。 -我姨和我表姐认为计算机技术就像一系列日渐精致的沙堡,在潮水抹净沙滩后新的沙堡完全取代旧的。但事实上,在很多领域上,我们都是不断积累能够解决问题的程序。我们可能不得不偶尔修改这些程序以避免软件无法使用,但大多数情况下我们都可以不修改。 `grep` 是一个简单的程序,可以解决一个仍然存在的问题,所以它能够存活下来。 大多数应用程序编程都是在非常高的级别上完成的,他们建立在解决了旧问题的程序的金字塔上。 30年或40年前的想法和概念,远非过时,在很多情况下他们依然在您的笔记本电脑上软件中存在着。 +我知道我姨和我表姐说的不对,并决定主修计算机科学。(对不住啊!)平常人可能会觉得像计算机科学领域和软件工程专业每隔几年就完全和之前不一样了。其原因很容易理解。我们有了个人电脑,然后有了互联网,有了手机,之后还有了机器学习…… 科技总是在更新,支撑科技发展的原理和技能当然也在改变。当然,最惊人的是其实原理的改变竟然如此之小。我敢肯定,大多数人在知道了他们电脑里一些重要的软件的历史是多么久远时他们一定会深感震惊。当然我不是说那些刷版本号的浮夸软件 —— 我电脑上的 Firefox 浏览器副本,可能是我用的最多的软件,可能两周前就更新过。如果你看了比如 `grep` 的手册页,你就会发现它在 2010 年后就没有过更新了(至少在 MacOS 上如此)。初版 `grep` 是在 1974 年写就的,那时可以算是计算机世界的侏罗纪了。直到现在,人们(还有程序)仍然依赖 `grep` 来完成日常工作。 -我想追溯这样的老程序自第一次写就以来改变了多少回很有趣。 `cat`可能是所有 Unix 实用程序中最简单的,因此我们以它为例。 Ken Thompson于 1969 年编写了 `cat` 的原始实现。如果我告诉别人我的电脑上安了个 1969 年的程序,这准确吗?我们电脑上的程序多大了? +我姨和我表姐认为计算机技术就像一系列日渐精致的沙堡,在潮水抹净沙滩后新的沙堡完全取代旧的。但事实上,在很多领域上,我们都是不断积累能够解决问题的程序。我们可能不得不偶尔修改这些程序以避免软件无法使用,但大多数情况下我们都可以不修改。`grep` 是一个简单的程序,可以解决一个仍然存在的需求,所以它能够存活下来。 大多数应用程序编程都是在非常高的级别上完成的,它们建立在解决了旧问题的旧程序的金字塔上。 30 年或 40 年前的思路和概念,远非过时,在很多情况下它们依然在您的笔记本电脑上软件中存在着。 + +我想追溯这样的老程序自第一次写就以来改变了多少回很有趣。 `cat` 可能是所有 Unix 实用程序中最简单的,因此我们以它为例。Ken Thompson 于 1969 年编写了 `cat` 的原始实现。如果我告诉别人我的电脑上安装了个来自 1969 年的程序,这准确吗?我们电脑上的程序多大了? 感谢这种[这种][1]仓库,我们可以完整的看到 `cat` 自 1969 年后是如何发展的。我会先聚焦于可以算得上是我的 MacBook 上的 `cat` 的祖先的 `cat` 实现。随着我们从 Unix 上的第一版 `cat` 追踪到现在 MacOS 上的 `cat`,你会发现,这个程序被重写的次数比你想的还要多 —— 但是直到现在它运行的方式和五十年前多少是完全一致的。 ### 研究 Unix -Ken Thompson 和 Dennis Ritchie 在 PDP 7 上开始写 Unix。那还是 1969 年,C 还没被发明出来,因此所有早期的 Unix 软件都是用 PDP 7 汇编实现的。他们使用的汇编种类是 Unix 特有的,Ken Thompson 在 DEC,也就是 PDP 7 的厂商提供的汇编器之上加了些特性,实现了自己的汇编器。Thompson 的更改在[最初的 Unix 程序员手册][2]的 `as`(也就是汇编器)条目下均有所记录。 +Ken Thompson 和 Dennis Ritchie 在 PDP 7 上开始写 Unix。那还是 1969 年,C 还没被发明出来,因此所有早期的 Unix 软件都是用 PDP 7 汇编实现的。他们使用的汇编种类是 Unix 特有的,Ken Thompson 在 DEC(PDP 7 的厂商)提供的汇编器之上加了些特性,实现了自己的汇编器。Thompson 的更改在[最初的 Unix 程序员手册][2]的 `as`(也就是汇编器)条目下均有所记录。 -因此,[最初的][3] `cat` 也是使用 PDP 7 汇编实现的。 我添加了一些注释,试图解释每条指令的作用,但除非你理解 Thompson 在编写汇编器时加的特性,否则程序仍然很难理解。在那些特性中有两个很重要:其一是 `;` 这个字符可以在一行中用来分隔多条语句,它多出现于在使用 `sys` 指令时将系统调用的多个参数放在同一行上。其二是, Thompson 的汇编器支持使用 0 到 9 作为“临时标签”,也就是在程序内可以重用的标签。因此。就如 Unix 程序员手册中所说:“对程序员的想象力和汇编程序的符号空间的要求都降低了”。在任何给定的指令内,你都可以使用 `nf` 和 `nb` 来引用下一个或最近的临时标签 `n`。 例如,如果存在标记为 `1:` 的代码块,你就可以使用指令 `jmp 1b` 从下游代码跳回该块。 (但是你不使用 `jmp 1f` 的话就没法从上面的代码跳到这里。) +因此,[最初的][3] `cat` 也是使用 PDP 7 汇编实现的。 我添加了一些注释,试图解释每条指令的作用,但除非你理解 Thompson 在编写汇编器时加的特性,否则程序仍然很难理解。在那些特性中有两个很重要:其一是 `;` 这个字符可以在一行中用来分隔多条语句,它多出现于在使用 `sys` 指令时将系统调用的多个参数放在同一行上。其二是, Thompson 的汇编器支持使用 0 到 9 作为“临时标签”,这是在程序内可以重用的标签。因此。就如 Unix 程序员手册中所说:“对程序员的想象力和汇编程序的符号空间的要求都降低了”。在任何给定的指令内,你都可以使用 `nf` 和 `nb` 来引用下一个或最近的临时标签 `n`。 例如,如果存在标记为 `1:` 的代码块,你就可以使用指令 `jmp 1b` 从下游代码跳回该块。 (但是你不使用 `jmp 1f` 的话就没法从上面的代码跳到这里。) -初版 `cat` 最有趣的就是它包含着我们应该认识的符号。有一块指令快标记为 `getc`,还有一个标记为 `putc`,可以看到这两个符号比 C 标准还古老。第一版的 `cat` 函数实际上已经包含了这两个函数的实现。这个 `cat` 实现做了缓存,这样他就不需要一次只读写一个字母。 +初版 `cat` 最有趣的就是它包含着我们应该认识的符号。有一块指令块标记为 `getc`,还有一个标记为 `putc`,可以看到这两个符号比 C 标准还古老。第一版的 `cat` 函数实际上已经包含了这两个函数的实现。该实现做了输入缓存,这样它就不需要一次只读写一个字母。 `cat` 的第一个版本并没有持续多久。 Ken Thompson 和 Dennis Ritchie 说服贝尔实验室购买了 PDP 11,这样他们就能够继续扩展和改进 Unix。 PDP 11 的指令集和之前不一样,因此必须重写 `cat`。 我也注释了[这个第二版][4] `cat`。 它为新的指令集使用新的汇编程序助记符,并利用了 PDP 11 的各种[寻址模式][5]。(如果你对源代码中的括号和美元符号感到困惑,那是因为这些符号用于指示不同的寻址模式。)但它也使用 `;` 字符和临时标签,和 `cat` 的第一个版本一样,这意味着当把 `as` 移植到 PDP 11 上时,必须要保留这些功能。 -`cat` 的第二个版本比第一个版本简单得多。 它也更有 Unix 味儿,它不只是依靠参数列表,一旦没给参数列表,它将从 `stdin` 读取数据,这也就是今天 `cat` 仍在做的事情。 你也也可以在此版本的 `cat` 中以 `-` 为参数,以表示它应该从`stdin`读取。 +`cat` 的第二个版本比第一个版本简单得多。 它也更有 Unix 味儿,它不只是依靠参数列表,一旦没给参数列表,它将从 `stdin` 读取数据,这也就是今天 `cat` 仍在做的事情。 你也可以在此版本的 `cat` 中以 `-` 为参数,以表示它应该从`stdin`读取。 -在 1973 年,为了准备发布第四版 Unix,大部分代码都用 C 语言重写了。但是 `cat` 似乎在之后一段时间内并没有使用 C 重写。 [`cat` 的第一个 C 语言实现][6]出现在第七版 Unix 中。 这个实现非常有趣,因为它很简单。 在所有要以后的实现中,这个实现和在 K&R 的 C语言教科书中用作教学示范的理想化 `cat` 最相似。这个程序的核心就是经典的两行: +在 1973 年,为了准备发布第四版 Unix,大部分代码都用 C 语言重写了。但是 `cat` 似乎在之后一段时间内并没有使用 C 重写。 [cat 的第一个 C 语言实现][6]出现在第七版 Unix 中。 这个实现非常有趣,因为它很简单。 在所有以后的实现中,这个实现和在 K&R 的 C 语言教科书中用作教学示范的理想化 `cat` 最相似。这个程序的核心就是经典的两行: ``` while ((c = getc(fi)) != EOF) @@ -33,33 +34,33 @@ while ((c = getc(fi)) != EOF) ### BSD -在第七版之后,Unix 出现了了各种衍生品和分支。 MacOS 建立于 Darwin 之上,而 Darwin 又源自 Berkeley Software Distribution(BSD),因此 BSD 是我们最感兴趣的Unix 分支。 BSD 最初只是 Unix 中的实用程序和附加组件的集合,但它最终成为了一个完整的操作系统。直到第四版 BSD,人称 4BSD,为一大堆新标志添加了支持之前,BSD 似乎还是依赖于最初的 `cat` 实现的。`cat` 的 [4BSD 实现][7] 显然是从原始实现中衍生出来的,尽管它添加了一个新函数来实现新标志触发的行为。按照已经在文件中使用由用于标记输入是从`stdin`还是文件读取的 `fflg` 变量指定的命名约定。被新添加的 `nflg`,`bflg`,`vflg`,`sflg`,`eflg`和`tflg` 保存了下来,这些变量记录了在调用程序时是否使用了这些新标志。这些是最后一批添加到 `cat` 的命令行标志。如今 `cat` 的手册页列出了这些标志,没有其他的标志了,至少在Mac OS上是如此。 4BSD 于1980年发布,因此这套标志已有 38 年历史。 +在第七版 Unix 之后,Unix 出现了各种衍生品和分支。 MacOS 建立于 Darwin 之上,而 Darwin 又源自伯克利软件分发版Berkeley Software Distribution(BSD),因此 BSD 是我们最感兴趣的 Unix 分支。 BSD 最初只是 Unix 中的实用程序和附加组件的集合,但它最终成为了一个完整的操作系统。直到第四版 BSD,人称 4BSD,为一大堆新标志添加了支持之前,BSD 似乎还是依赖于最初的 `cat` 实现的。`cat` 的 [4BSD 实现][7] 显然是从原始实现中衍生出来的,尽管它添加了一个新函数来实现由新标志触发的行为。已经在文件中使用的 `fflg` 变量(用于标记输入是从 `stdin` 还是文件读取的)的命名约定,被新添加的 `nflg`、`bflg`、`vflg`、`sflg`、`eflg` 和 `tflg` 沿袭了下来,这些变量记录了在调用程序时是否使用了这些新标志。这些是最后一批添加到 `cat` 的命令行标志。如今 `cat` 的手册页列出了这些标志,没有其他的标志了,至少在 Mac OS 上是如此。 4BSD 于 1980 年发布,因此这套标志已有 38 年历史。 -`cat` 最后一次被完全重写是在 BSD NET/2 上,其目的是通过替换全部 AT&T 发布的 Unix 源代码来规避许可证问题。BSD Net/2 在 1991 年发布。这一版本的 `cat` 是由 Kevin Fall 重写的。 Kevin Fall 于 1988 年毕业于加州大学伯克利分校并在下一年成为计算机系统研究组(CSRG)的组员,Fall 和我说当时使用 AT&T 代码的 Unix 工具被列在了 CSRG 的墙上,组员需要从中选出他们想要重写的工具; Fall 选了 `cat` 以及 `mknod`。 MacOS 系统内自带的 `cat` 实现源码的最上面还有着他的名字。他的这一版 `cat`,尽管平淡无奇,在今天还是被无数人使用着。 +`cat` 最后一次被完全重写是在 BSD NET/2 上,其目的是通过替换 AT&T 发布的全部 Unix 源代码来规避许可证问题。BSD Net/2 在 1991 年发布。这一版本的 `cat` 是由 Kevin Fall 重写的。 Kevin Fall 于 1988 年毕业于加州大学伯克利分校并在下一年成为计算机系统研究组Computer Systems Research Group(CSRG)的组员,Fall 和我说当时使用 AT&T 代码的 Unix 工具被列在了 CSRG 的墙上,组员需要从中选出他们想要重写的工具; Fall 选了 `cat` 以及 `mknod`。 MacOS 系统内自带的 `cat` 实现源码的最上面还有着他的名字。他的这一版 `cat`,尽管平淡无奇,在今天还是被无数人使用着。 -[Fall的原始 `cat `实现][8] 比我们迄今为止看到的程序都要长。 除了支持 `-?` 帮助标志外,它没有增加任何新功能。 从概念上讲,它与 4BSD 的实现非常相似。 它长是因为 Fall 将实现分为 “原始” 模式和 “熟” 模式。 “原始” 模式是 `cat ` 的经典实现; 它一个字符一个字符的打印文件。 “熟” 模式是带有所有 4BSD 命令行选项的 `cat`。 如此区别不无道理,但这么办也扩充了实现规模,因此乍一看其源码似乎比实际上更复杂。文件末尾还有一个奇特的错误处理函数,进一步地增加了实现的长度。 +[Fall 的原始 cat 实现][8] 比我们迄今为止看到的版本都要长。 除了支持 `-?` 帮助标志外,它没有增加任何新功能。 从概念上讲,它与 4BSD 的实现非常相似。 它长是因为 Fall 将实现分为 “原始” 模式和 “加工” 模式。 “原始” 模式是 `cat` 的经典实现;它一个字符一个字符的打印文件。 “加工” 模式是带有所有 4BSD 命令行选项的 `cat`。 如此区别不无道理,但这么办也扩充了实现规模,因此乍一看其源码似乎比实际上更复杂。文件末尾还有一个奇特的错误处理函数,进一步地增加了实现的长度。 ### MacOS -在 2001 年,苹果发布了 MacOS X。这一发布对苹果意义重大。因为苹果花了很多年时间来尝试并且取代现有的过时操作系统(经典的Mac OS),但是都失败了。 在 Mac OS X 之前苹果两次尝试在内部创建一个新的操作系统,但两者都无疾而终。 最后,苹果收购了史蒂夫 · 乔布斯的 NeXT 公司,后者开发了一个名为 NeXTSTEP 的操作系统和面向对象编程框架。 苹果将 NeXTSTEP 作为Mac OS X的基础。因为 NeXTSTEP 部分基于 BSD,使以 NeXTSTEP 为基础的 Mac OS X的自然就把 BSD 系的代码直接带入苹果宇宙的中心。 +在 2001 年,苹果发布了 MacOS X。这一发布对苹果意义重大。因为苹果用了多年的时间尝试以取代其现有的老旧操作系统(经典的 Mac OS),但是都失败了。 在 Mac OS X 之前苹果两次尝试在内部创建一个新的操作系统,但两者都无疾而终。 最后,苹果收购了史蒂夫·乔布斯的 NeXT 公司,后者开发了一个名为 NeXTSTEP 的操作系统和面向对象编程框架。 苹果将 NeXTSTEP 作为 Mac OS X 的基础。因为 NeXTSTEP 部分基于 BSD,使以 NeXTSTEP 为基础的 Mac OS X 的自然就把 BSD 系的代码直接带入苹果宇宙的中心。 -因此,Mac OS X的第一个版本包含了从 NetBSD 项目中提取的 `cat` 的[实现][9]。如今仍在开发中的 NetBSD 最初是 386BSD 的分支,而后者又直接基于 BSD Net/2。所以Mac OS X里面的第一个 `cat` 的实现就是 Kevin Fall的 `cat`。唯一改变的是,Fall 的错误处理函数 `err()` 被 `err.h` 提供的`err()` 函数取代了。 `err.h` 是 C 标准库的 BSD 扩展。 +因此,Mac OS X 的非常早期的第一个版本包含了从 NetBSD 项目中提取的 `cat` 的[实现][9]。如今仍保持开发的 NetBSD 最初是 386BSD 的分支,而后者又直接基于 BSD Net/2。所以 Mac OS X 里面的第一个 `cat` 的实现就是 Kevin Fall 的 `cat`。唯一改变的是,Fall 的错误处理函数 `err()` 被 `err.h` 提供的 `err()` 函数取代了。 `err.h` 是 C 标准库的 BSD 扩展。 -之后不久,`cat` 的 NetBSD 实现被换成了 FreeBSD 中的 `cat` 实现。 [根据维基百科][10],苹果在Mac OS X 10.3(Panther) 中开始使用 FreeBSD 的实现而不是 NetBSD 的实现。但根据苹果自己开源的版本,`cat` 的Mac OS X实现在2007年发布的 Mac OS X 10.5(Leopard) 之前没有被替换。苹果为 Leopard 替换的的 [FreeBSD 实现][11]与今天苹果计算机上的实现相同。截至 2018 年,此实现仍未被更新或修改。 +之后不久,这里的 `cat` 的 NetBSD 实现被换成了 FreeBSD 中的 `cat` 实现。 [根据维基百科][10],苹果在 Mac OS X 10.3(Panther)中开始使用 FreeBSD 的实现而不是 NetBSD 的实现。但根据苹果自己开源的版本,`cat` 的 Mac OS X 实现在 2007 年发布的 Mac OS X 10.5(Leopard)之前没有被替换。苹果为 Leopard 替换的的 [FreeBSD 实现][11]与今天苹果计算机上的实现相同。截至 2018 年,2007 年以来的这个实现仍未被更新或修改。 -所以Mac OS 上的 `cat` 已经很老了。实际上,这一实现在 2007 年在 MacOS X 上露面两年前就被发布了。 [这个 2005 年的修改][12] 在 FreeBSD 的 Github 镜像中可见,是在苹果将其合并入 Mac OS X 前对 FreeBSD 的 `cat` 实现进行的最后一次更改。所以 Mac OS X 的没有与 FreeBSD 的 `cat` 实现保持同步的 `cat`实现,如今 13 岁了。对于软件修改了多少代码才能仍是算是同一软件这一话题有着旷日持久的争论。不过,在这种情况下,源文件自 2005 年以来根本没有变化。 +所以 Mac OS 上的 `cat` 已经很老了。实际上,这一实现在 2007 年在 MacOS X 上露面两年前就被发布了。 [这个 2005 年的修改][12] 在 FreeBSD 的 Github 镜像中可见,是在苹果将其合并入 Mac OS X 前对 FreeBSD 的 `cat` 实现进行的最后一次更改。所以 Mac OS X 中的实现没有与 FreeBSD 的 `cat` 实现保持同步,它如今已经 13 岁了。对于软件修改了多少代码才能仍是算是同一软件这一话题有着旷日持久的争论。不过,在这种情况下,源文件自 2005 年以来根本没有变化。 -现在 Mac OS 使用的 `cat` 实现与 Fall 1991年为 BSD Net/2 版本编写的实现没有什么不同。最大的区别是添加了一个全新的功能来提供 Unix 域套接字支持。FreeBSD 开发人员似乎将 Fall 的 `raw_args()` 函数和 `cook_args()` 函数组合成一个名为`scanfiles()`的函数。要没有的话,程序的核心就仍是 Fall 的代码。 +现在 Mac OS 使用的 `cat` 实现与 Fall 1991 年为 BSD Net/2 版本编写的实现没有什么不同。最大的区别是添加了一个全新的功能来提供 Unix 域套接字支持。FreeBSD 开发人员似乎将 Fall 的 `raw_args()` 函数和 `cook_args()` 函数组合成一个名为`scanfiles()` 的函数。否则,程序的核心就仍是 Fall 的代码。 -我问过 Fall 对编写如今被数以百万计的苹果用户直接或者通过依赖 `cat` 的程序间接使用的 `cat` 实现有何感想。Fall,如今是最新版 TCP/IP 详解的顾问和合著者,说,当人们从了解他对 `cat` 所做的的工作中收获颇丰时,他感到很惊讶。 Fall 在计算机领域有着悠久的职业生涯,曾参与许多备受瞩目的项目,但似乎很多人仍对他在 1989 年重写 `cat` 的那六个月的工作感到最为兴奋。 +我问过 Fall 对编写了如今被数以百万计的苹果用户(直接或者间接通过依赖 `cat` 的某些程序)使用的 `cat` 实现有何感想。Fall,如今是一位顾问,也是最新版《TCP/IP 详解》的合著者,他说,当人们从了解他对 `cat` 所做的工作中收获颇丰时,他感到很惊讶。 Fall 在计算机领域有着悠久的职业生涯,曾参与许多备受瞩目的项目,但似乎很多人仍对他在 1989 年重写 `cat` 的那六个月的工作感到最为兴奋。 ### 百年老程序 -在宏伟的发明史中,计算机并不是一项古老的发明。我们已经习惯了百年的照片甚至是百年的视频短片。但是计算机程序不一样 - 它们代表着高科技和新技术。至少,他们是现代的技术造出来的。随着计算行业的成熟,我们有朝一日会发现自己正在使用有着接近百年历史的程序吗? +在宏伟的发明史中,计算机并不是一项古老的发明。我们已经习惯了百年的照片甚至是百年的视频短片。但是计算机程序不一样 —— 它们代表着高科技和新技术。至少,他们是现代的技术造出来的。随着计算行业的成熟,我们有朝一日会发现自己正在使用有着接近百年历史的程序吗? -计算机硬件可能会发生较大的变化,使得我们也许无法让现在编译的可执行文件在一个世纪后的硬件上运行。也许编程语言设计的进步让未来没有人能理解 C 语言,`cat` 将来也可能也被别的语言重写很久了。 (尽管 C已经存在了五十年了,而且它似乎不会很快就被替换掉。)但除此之外,为什么不永远使用我们现在的 `cat`? +计算机硬件可能会发生较大的变化,使得我们也许无法让现在编译的可执行文件在一个世纪后的硬件上运行。也许编程语言设计的进步让未来没有人能理解 C 语言,`cat` 将来也可能也被别的语言重写很久了。 (尽管 C 已经存在了五十年了,而且它似乎不会很快就被替换掉。)但除此之外,为什么不永远使用我们现在的 `cat`? -我认为 `cat` 的历史表明,计算机科学中的一些想法确实非常持久。事实上,对于 `cat`,这个想法和程序本身都很古老。不准确地说,我的电脑上的 `cat` 来自1969 年。但我也可以说我的计算机上的 `cat` 来自1989 年,当时 Fall 写了他的 `cat` 实现。许多其他软件也同样古老。因此,也许我们不应该把计算机科学和软件开发视为不断破坏现状和发明新事物的领域。我们的计算机系统是由诸多历史文物构建的。有时,我们可能会花费更多时间在理解和维护这些历史文物上,而不是花在编写新代码上。 +我认为 `cat` 的历史表明,计算机科学中的一些想法确实非常持久。事实上,对于 `cat`,这个想法和程序本身都很古老。不准确地说,我的电脑上的 `cat` 来自 1969 年。但我也可以说我的计算机上的 `cat` 来自1989 年,当时 Fall 写了他的 `cat` 实现。许多其他软件也同样古老。因此,也许我们不应该把计算机科学和软件开发视为不断破坏现状和发明新事物的领域。我们的计算机系统是由诸多历史文物构建的。有时,我们可能会花费更多时间在理解和维护这些历史文物上,而不是花在编写新代码上。 如果你喜欢本文,你可能更喜欢两周来一篇更新!在推特上关注 [@TwoBitHistory][13] 或者订阅这个 [RSS 源][14] 以保证接受到新的文章。 @@ -71,7 +72,7 @@ via: https://twobithistory.org/2018/11/12/cat.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] 译者:[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/) 荣誉推出 From 87ba3f9da6b69c80eb1d5af7da8b3d44f5ee8b37 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 21:37:48 +0800 Subject: [PATCH 0053/4278] PRF:20180226 -Getting to Done- on the Linux command line.md @guevaraya --- ...ting to Done- on the Linux command line.md | 88 +++++++++++-------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/translated/tech/20180226 -Getting to Done- on the Linux command line.md b/translated/tech/20180226 -Getting to Done- on the Linux command line.md index 2e06c51dce..61a0307055 100644 --- a/translated/tech/20180226 -Getting to Done- on the Linux command line.md +++ b/translated/tech/20180226 -Getting to Done- on the Linux command line.md @@ -1,103 +1,111 @@ -享受Linux下命令行全操作 +在 Linux 命令行下进行时间管理 ====== +> 学习如何在命令行下用这些方法自己组织待办事项。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_terminals.png?itok=CfBqYBah) -很多文章讨论关于命令行下如何做事情。有多少文章要么用晦涩的方式介绍 `ls` ,要么介绍关于 Sed 和 Awk 一些有意思的正则表达式,要么就是介绍一大堆的 perl 脚本是如何解析的?这些都不是命令行操作的重点。 -本文章是关于[享受命令行全操作][1],在我们不需要图形桌面,网络浏览器或网络连接情况下,用命令行操作能完成实际事务的跟踪。为了达到这一点,我们将介绍四个途径跟踪你的待办清单:纯文件文件,Todo.txt,TaskWarrior,Org-mode。 +关于如何在命令行下进行时间管理getting things done(GTD)有很多讨论。不知有多少文章在讲使用 ls 晦涩的选项、配合 Sed 和 Awk 的一些神奇的正则表达式,以及用 Perl 解析一大堆的文本。但这些都不是问题的重点。 -### 纯文本 +本文章是关于“[如何完成][1]”,在我们不需要图形桌面、网络浏览器或网络连接情况下,用命令行操作能实际完成事务的跟踪。为了达到这一点,我们将介绍四种跟踪待办事项的方式:纯文件文件、Todo.txt、TaskWarrior 和 Org 模式。 -![plaintext][3] +### 简单纯文本 -我喜欢用 Vim ,其实你也可以喜欢 Nano。 +![纯文本][3] -最直接管理管理你的待办清单的方式就是用纯文本文件来编辑。只需要打开一个空文件,每一行添加一个任务。当任务完成后,删除这一行,简单有效,不用再关心这一行之前干什么用的了。不过这个方法也有缺点,一点你删除一行并保存了文件,它就是永远消失了。如果你想知道本周或者上周都做了哪些事情,就成了问题。使用简单文本文件很方便却也容易导致混乱。 +*我喜欢用 Vim,其实你也可以用 Nano。* + +最直接管理你的待办事项的方式就是用纯文本文件来编辑。只需要打开一个空文件,每一行添加一个任务。当任务完成后,删除这一行。简单有效,无论你用它做什么都没关系。不过这个方法也有两个缺点,一但你删除一行并保存了文件,它就是永远消失了。如果你想知道本周或者上周都做了哪些事情,就成了问题。使用简单文本文件很方便却也容易导致混乱。 ### Todo.txt: 纯文件的升级版 +![todo.txt 截屏][5] -![todo.txt screen][5] +*整洁,有条理,易用* -整洁,有条理,易用 - -这就是我们要说的 [Todo.txt][6] 格式文件和应用程序。安装可从 GitHub [下载][7]最新的版本解压后并执行命令 `sudo make install` +这就是我们要说的 [Todo.txt][6] 文件格式和应用程序。安装很简单,可从 GitHub [下载][7]最新的版本解压后并执行命令 `sudo make install` 。 ![安装 todo.txt][9] -也可以从 Git 克隆一个。 +*也可以从 Git 克隆一个。* -Todo.txt 可以很容易的增加新任务,并能显示任务列表和已完成任务的标记: +Todo.txt 可以很容易的增加新任务,并能显示任务列表和已完成任务的标记: -||| +| 命令 | 说明 | | ------------- |:-------------| -| `todo.sh add "某任务"` | 增加 "某任务" 到你的待办列表 | +| `todo.sh add "某任务"` | 增加 “某任务” 到你的待办列表 | | `todo.sh ls` | 显示所有的任务 | | `todo.sh ls due:2018-02-15` | 显示2018-02-15之前的所有任务 | | `todo.sh do 3` | 标记任务3 为已完成任务 | -清单实际上仍然是纯文本,你可以用你喜欢的编辑器遵循[正确的格式][10]编辑它。 - -应用程序同时也内置了一个强大的帮助。 +这个清单实际上仍然是纯文本,你可以用你喜欢的编辑器遵循[正确的格式][10]编辑它。 +该应用程序同时也内置了一个强大的帮助系统。 ![在 todo.txt 中语法高亮][12] -你可以使用语法高亮的功能 - -此外,还有许多附加组件可供选择,以及编写自己的附件组件规范。甚至有浏览器组件,移动设备应用程序和桌面应用程序支持 Todo.txt 的格式。 +*你可以使用语法高亮的功能* +此外,还有许多附加组件可供选择,以及编写自己的附件组件规范。甚至有浏览器组件、移动设备应用程序和桌面应用程序支持 Todo.txt 的格式。 ![GNOME extensions in todo.txt][14] -GNOME的扩展组件 +*GNOME的扩展组件* -Todo.txt 最大的缺点是缺少自动或内置的同步机制。大多数(不是全部)的浏览器扩展程序和移动应用程序需要用 Dropbox 实现桌面系统和应用程序直接的数据同步。如果你想内置同步机制,我们也有…… +Todo.txt 最大的缺点是缺少自动或内置的同步机制。大多数(不是全部)的浏览器扩展程序和移动应用程序需要用 Dropbox 实现桌面系统和应用程序直接的数据同步。如果你想内置同步机制,我们有…… ### Taskwarrior: 现在我们用 Python 做事了 -[Taskwarrior][15] 是一个与Todo.txt 有许多相同功能的 Python 工具。但不同的是它的数据保存在数据库里并具有内置的数据同步功能。它还可以跟踪即将要做的任务,可以提醒某个任务持续了多久,可以提醒你一些重要的事情应该马上去做。 +![Taskwarrior][25] -[安装][16] Taskwarrior 可以通过通过发行版自带的包管理器,或通过 Python 命令 `pip`安装,或者用源码编译。用法也和 Todo.txt 的命令完全一样: +*花哨吗?* -||| +[Taskwarrior][15] 是一个与 Todo.txt 有许多相同功能的 Python 工具。但不同的是它的数据保存在数据库里并具有内置的数据同步功能。它还可以跟踪即将要做的任务,可以提醒某个任务持续了多久,可以提醒你一些重要的事情应该马上去做。 + +![][26] + +*看起来不错* + +[安装][16] Taskwarrior 可以通过通过发行版自带的包管理器,或通过 Python 命令 `pip` 安装,或者用源码编译。用法也和 Todo.txt 的命令完全一样: + +| 命令 | 说明 | | ------------- |:-------------| -| `task add "某任务"` | 增加 "某任务" 到任务清单 | +| `task add "某任务"` | 增加 “某任务” 到任务清单 | | `task list` | 列出所有任务 | -| `task list due ``:today` |列出截止今天的任务 | +| `task list due ``:today` | 列出截止今天的任务 | | `task do 3` | 标记编号是3的任务为完成状态 | Taskwarrior 还有漂亮的文本用户界面。 ![Taskwarrior in Vit][18] -我喜欢 Vit, 它的设计灵感来自 Vim. +*我喜欢 Vit, 它的设计灵感来自 Vim* -不同于 Todo.txt,Taskwarrior 可以和本地或远程服务器同步信息。如果你希望运行自己的同步服务器可以使用名为 `taskd` 的基础服务器,如果不使用自己的服务器也有好几个可用服务器。 +不同于 Todo.txt,Taskwarrior 可以和本地或远程服务器同步信息。如果你希望运行自己的同步服务器可以使用名为 `taskd` 的非常基本的服务器,如果不使用自己的服务器也有好几个可用服务器。 -Taskwarriot 还拥有一个蓬勃发展的插件和扩展生态系统,这和移动和桌面系统的应用生态类似。 +Taskwarriot 还拥有一个蓬勃发展的插件和扩展生态系统,以及移动和桌面系统的应用。 ![GNOME in Taskwarrior ][20] -在 GNOME 下的 Taskwarrior 看起来还是很漂亮的。 +*在 GNOME 下的 Taskwarrior 看起来还是很漂亮的。* Taskwarrior 有一个唯一的缺点,你是不能直接修改待办任务的,这和其他的工具不一样。你只能把任务清单按照格式导出,然后修改导出文件后,重新再导入,这样相对于编辑器直接编辑任务还是挺麻烦的。 -谁能给我们带来最大的希望呢...... +谁能给我们带来最大的希望呢…… -### Emacs Org-mode: 牛逼的任务收割机 +### Emacs Org 模式:牛X的任务收割机 ![Org-mode][22] -Emacs 具有所有优点。 +*Emacs 啥都有* -Emacs [Org-mode][23] 是目前为止最强大,最灵活的开源待办任务管理器。它支持多文件,使用纯文本,高度定制和自动识别日期,截止日期和任务计划。相对于我们这里介绍的其他工具,它的配置也更复杂一些。但是一旦配置好,她可以比其他工具完成更多功能。如果你是熟悉或者是 [Bullet Journals][24] 的粉丝,Org-mode 可能是在桌面程序里最像[Bullet Journals][24]的了。 +Emacs [Org 模式][23] 是目前为止最强大、最灵活的开源待办事项管理器。它支持多文件、使用纯文本、高度可定制、自动识别日期、截止日期和任务计划。相对于我们这里介绍的其他工具,它的配置也更复杂一些。但是一旦配置好,它可以比其他工具完成更多功能。如果你是熟悉或者是 [Bullet Journals][24] 的粉丝,Org 模式可能是在桌面程序里最像[Bullet Journals][24] 的了。 -Org-mode 可以运行在任何 Emacs 运行的地方,一些移动应用程序可以和它很好交互。但是不幸的是,目前没有桌面程序或浏览器插件支持Org-mode。尽管如此,Org-mode仍然是跟踪待办事项最好的应用程序之一,因为他确实很强大。 +Emacs 能运行,Org 模式就能运行,一些移动应用程序可以和它很好交互。但是不幸的是,目前没有桌面程序或浏览器插件支持 Org 模式。尽管如此,Org 模式仍然是跟踪待办事项最好的应用程序之一,因为它确实很强大。 ### 选择适合自己的工具 -最后,这些程序目的是帮助你跟踪待办事务并确保不会忘记做某个事情。这些程序的基础功能都大同小异,那一款适合你取决于多种因素。有的人需要自带同步功能,有的人需要一个移动客户端,有的人要必须支持插件。不管你选择什么,请记住程序本身不会让你更有调理,但是可以帮助你。 +最后,这些程序目的是帮助你跟踪待办事项,并确保不会忘记做某个事情。这些程序的基础功能都大同小异,那一款适合你取决于多种因素。有的人需要自带同步功能,有的人需要一个移动客户端,有的人要必须支持插件。不管你选择什么,请记住程序本身不会让你更有调理,但是可以帮助你。 -------------------------------------------------------------------------------- @@ -105,7 +113,7 @@ via: https://opensource.com/article/18/2/getting-to-done-agile-linux-command-lin 作者:[Kevin Sonney][a] 译者:[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/) 荣誉推出 @@ -126,3 +134,5 @@ via: https://opensource.com/article/18/2/getting-to-done-agile-linux-command-lin [22]:https://opensource.com/sites/default/files/u128651/emacs-org-mode.png (Org-mode) [23]:https://orgmode.org/ [24]:http://bulletjournal.com/ +[25]:https://opensource.com/sites/default/files/u128651/taskwarrior.png +[26]:https://opensource.com/sites/default/files/u128651/taskwarrior-complains.png From 2913f24c2d37091dcf73670762c142f8766c160a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 21:38:19 +0800 Subject: [PATCH 0054/4278] PUB:20180226 -Getting to Done- on the Linux command line.md @guevaraya https://linux.cn/article-10335-1.html --- .../20180226 -Getting to Done- on the Linux command line.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180226 -Getting to Done- on the Linux command line.md (100%) diff --git a/translated/tech/20180226 -Getting to Done- on the Linux command line.md b/published/20180226 -Getting to Done- on the Linux command line.md similarity index 100% rename from translated/tech/20180226 -Getting to Done- on the Linux command line.md rename to published/20180226 -Getting to Done- on the Linux command line.md From d29de3e5f41e4860dca355759f5c05de75ed9d4b Mon Sep 17 00:00:00 2001 From: GraveAccent Date: Tue, 11 Dec 2018 23:04:16 +0800 Subject: [PATCH 0055/4278] GraveAccent translated 20180422... --- ...icks For Data Scientists - kade killary.md | 526 ------------------ ...icks For Data Scientists - kade killary.md | 469 ++++++++++++++++ 2 files changed, 469 insertions(+), 526 deletions(-) delete mode 100644 sources/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md create mode 100644 translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md diff --git a/sources/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md b/sources/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md deleted file mode 100644 index 2e1abf248f..0000000000 --- a/sources/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md +++ /dev/null @@ -1,526 +0,0 @@ -GraveAccent翻译中 Command Line Tricks For Data Scientists • kade killary -====== - -![](https://i.imgur.com/0mzQMcB.png) - -For many data scientists, data manipulation begins and ends with Pandas or the Tidyverse. In theory, there is nothing wrong with this notion. It is, after all, why these tools exist in the first place. Yet, these options can often be overkill for simple tasks like delimiter conversion. - -Aspiring to master the command line should be on every developer’s list, especially data scientists. Learning the ins and outs of your shell will undeniably make you more productive. Beyond that, the command line serves as a great history lesson in computing. For instance, awk - a data-driven scripting language. Awk first appeared in 1977 with the help of [Brian Kernighan][1], the K in the legendary [K&R book][2]. Today, some near 50 years later, awk remains relevant with [new books][3] still appearing every year! Thus, it’s safe to assume that an investment in command line wizardry won’t depreciate any time soon. - -### What We’ll Cover - - * ICONV - * HEAD - * TR - * WC - * SPLIT - * SORT & UNIQ - * CUT - * PASTE - * JOIN - * GREP - * SED - * AWK - - - -### ICONV - -File encodings can be tricky. For the most part files these days are all UTF-8 encoded. To understand some of the magic behind UTF-8, check out this [excellent video][4]. Nonetheless, there are times where we receive a file that isn’t in this format. This can lead to some wonky attempts at swapping the encoding schema. Here, `iconv` is a life saver. Iconv is a simple program that will take text in one encoding and output the text in another. -``` -# Converting -f (from) latin1 (ISO-8859-1) -# -t (to) standard UTF_8 - -iconv -f ISO-8859-1 -t UTF-8 < input.txt > output.txt - -``` - - * Useful options: - - * `iconv -l` list all known encodings - * `iconv -c` silently discard characters that cannot be converted - - - -### HEAD - -If you are a frequent Pandas user then `head` will be familiar. Often when dealing with new data the first thing we want to do is get a sense of what exists. This leads to firing up Pandas, reading in the data and then calling `df.head()` \- strenuous, to say the least. Head, without any flags, will print out the first 10 lines of a file. The true power of `head` lies in testing out cleaning operations. For instance, if we wanted to change the delimiter of a file from commas to pipes. One quick test would be: `head mydata.csv | sed 's/,/|/g'`. -``` -# Prints out first 10 lines - -head filename.csv - -# Print first 3 lines - -head -n 3 filename.csv - -``` - - * Useful options: - - * `head -n` print a specific number of lines - * `head -c` print a specific number of bytes - - - -### TR - -Tr is analogous to translate. This powerful utility is a workhorse for basic file cleaning. An ideal use case is for swapping out the delimiters within a file. -``` -# Converting a tab delimited file into commas - -cat tab_delimited.txt | tr "\t" "," comma_delimited.csv - -``` - -Another feature of `tr` is all the built in `[:class:]` variables at your disposal. These include: -``` -[:alnum:] all letters and digits -[:alpha:] all letters -[:blank:] all horizontal whitespace -[:cntrl:] all control characters -[:digit:] all digits -[:graph:] all printable characters, not including space -[:lower:] all lower case letters -[:print:] all printable characters, including space -[:punct:] all punctuation characters -[:space:] all horizontal or vertical whitespace -[:upper:] all upper case letters -[:xdigit:] all hexadecimal digits - -``` - -You can chain a variety of these together to compose powerful programs. The following is a basic word count program you could use to check your READMEs for overuse. -``` -cat README.md | tr "[:punct:][:space:]" "\n" | tr "[:upper:]" "[:lower:]" | grep . | sort | uniq -c | sort -nr - -``` - -Another example using basic regex: -``` -# Converting all upper case letters to lower case - -cat filename.csv | tr '[A-Z]' '[a-z]' - -``` - - * Useful options: - - * `tr -d` delete characters - * `tr -s` squeeze characters - * `\b` backspace - * `\f` form feed - * `\v` vertical tab - * `\NNN` character with octal value NNN - - - -### WC - -Word count. Its value is primarily derived from the `-l` flag, which will give you the line count. -``` -# Will return number of lines in CSV - -wc -l gigantic_comma.csv - -``` - -This tool comes in handy to confirm the output of various commands. So, if we were to convert the delimiters within a file and then run `wc -l` we would expect the total lines to be the same. If not, then we know something went wrong. - - * Useful options: - - * `wc -c` print the byte counts - * `wc -m` print the character counts - * `wc -L` print length of longest line - * `wc -w` print word counts - - - -### SPLIT - -File sizes can range dramatically. And depending on the job, it could be beneficial to split up the file - thus `split`. The basic syntax for split is: -``` -# We will split our CSV into new_filename every 500 lines - -split -l 500 filename.csv new_filename_ - -# filename.csv -# ls output -# new_filename_aaa -# new_filename_aab -# new_filename_aac - -``` - -Two quirks are the naming convention and lack of file extensions. The suffix convention can be numeric via the `-d` flag. To add file extensions, you’ll need to run the following `find` command. It will change the names of ALL files within the current directory by appending `.csv`, so be careful. -``` -find . -type f -exec mv '{}' '{}'.csv \; - -# ls output -# filename.csv.csv -# new_filename_aaa.csv -# new_filename_aab.csv -# new_filename_aac.csv - -``` - - * Useful options: - - * `split -b` split by certain byte size - * `split -a` generate suffixes of length N - * `split -x` split using hex suffixes - - - -### SORT & UNIQ - -The preceding commands are obvious: they do what they say they do. These two provide the most punch in tandem (i.e. unique word counts). This is due to `uniq`, which only operates on duplicate adjacent lines. Thus, the reason to `sort` before piping the output through. One interesting note is that `sort -u` will achieve the same results as the typical `sort file.txt | uniq` pattern. - -Sort does have a sneakily useful ability for data scientists: the ability to sort an entire CSV based on a particular column. -``` -# Sorting a CSV file by the second column alphabetically - -sort -t"," -k2,2 filename.csv - -# Numerically - -sort -t"," -k2n,2 filename.csv - -# Reverse order - -sort -t"," -k2nr,2 filename.csv - -``` - -The `-t` option here is to specify the comma as our delimiter. More often than not spaces or tabs are assumed. Furthermore, the `-k` flag is for specifying our key. The syntax for this is `-km,n`, with `m` being the starting field and `n` being the last. - - * Useful options: - - * `sort -f` ignore case - * `sort -r` reverse sort order - * `sort -R` scramble order - * `uniq -c` count number of occurrences - * `uniq -d` only print duplicate lines - - - -### CUT - -Cut is for removing columns. To illustrate, if we only wanted the first and third columns. -``` -cut -d, -f 1,3 filename.csv - -``` - -To select every column other than the first. -``` -cut -d, -f 2- filename.csv - -``` - -In combination with other commands, `cut` serves as a filter. -``` -# Print first 10 lines of column 1 and 3, where "some_string_value" is present - -head filename.csv | grep "some_string_value" | cut -d, -f 1,3 - -``` - -Finding out the number of unique values within the second column. -``` -cat filename.csv | cut -d, -f 2 | sort | uniq | wc -l - -# Count occurences of unique values, limiting to first 10 results - -cat filename.csv | cut -d, -f 2 | sort | uniq -c | head - -``` - -### PASTE - -Paste is a niche command with an interesting function. If you have two files that you need merged, and they are already sorted, `paste` has you covered. -``` -# names.txt -adam -john -zach - -# jobs.txt -lawyer -youtuber -developer - -# Join the two into a CSV - -paste -d ',' names.txt jobs.txt > person_data.txt - -# Output -adam,lawyer -john,youtuber -zach,developer - -``` - -For a more SQL_-esque variant, see below. - -### JOIN - -Join is a simplistic, quasi-tangential, SQL. The largest differences being that `join` will return all columns and matches can only be on one field. By default, `join` will try and use the first column as the match key. For a different result, the following syntax is necessary: -``` -# Join the first file (-1) by the second column -# and the second file (-2) by the first - -join -t"," -1 2 -2 1 first_file.txt second_file.txt - -``` - -The standard join is an inner join. However, an outer join is also viable through the `-a` flag. Another noteworthy quirk is the `-e` flag, which can be used to substitute a value if a missing field is found. -``` -# Outer join, replace blanks with NULL in columns 1 and 2 -# -o which fields to substitute - 0 is key, 1.1 is first column, etc... - -join -t"," -1 2 -a 1 -a2 -e ' NULL' -o '0,1.1,2.2' first_file.txt second_file.txt - -``` - -Not the most user-friendly command, but desperate times, desperate measures. - - * Useful options: - - * `join -a` print unpairable lines - * `join -e` replace missing input fields - * `join -j` equivalent to `-1 FIELD -2 FIELD` - - - -### GREP - -Global search for a regular expression and print, or `grep`; likely, the most well known command, and with good reason. Grep has a lot of power, especially for finding your way around large codebases. Within the realm of data science, it acts as a refining mechanism for other commands. Although its standard usage is valuable as well. -``` -# Recursively search and list all files in directory containing 'word' - -grep -lr 'word' . - -# List number of files containing word - -grep -lr 'word' . | wc -l - -``` - -Count total number of lines containing word / pattern. -``` -grep -c 'some_value' filename.csv - -# Same thing, but in all files in current directory by file name - -grep -c 'some_value' * - -``` - -Grep for multiple values using the or operator - `\|`. -``` -grep "first_value\|second_value" filename.csv - -``` - - * Useful options - - * `alias grep="grep --color=auto"` make grep colorful - * `grep -E` use extended regexps - * `grep -w` only match whole words - * `grep -l` print name of files with match - * `grep -v` inverted matching - - - -### THE BIG GUNS - -Sed and Awk are the two most powerful commands in this article. For brevity, I’m not going to go into exhausting detail about either. Instead, I will cover a variety of commands that prove their impressive might. If you want to know more, [there is a book][5] just for that. - -### SED - -At its core `sed` is a stream editor. It excels at substitutions, but can also be leveraged for all out refactoring. - -The most basic `sed` command consists of `s/old/new/g`. This translates to search for old value, replace with new globally. Without the `/g` our command would terminate after the first occurrence. - -To get a quick taste of the power lets dive into an example. In this scenario you’ve been given the following file: -``` -balance,name -$1,000,john -$2,000,jack - -``` - -The first thing we may want to do is remove the dollar signs. The `-i` flag indicates in-place. The `''` is to indicate a zero-length file extension, thus overwriting our initial file. Ideally, you would test each of these individually and then output to a new file. -``` -sed -i '' 's/\$//g' data.txt - -# balance,name -# 1,000,john -# 2,000,jack - -``` - -Next up, the commas in our `balance` column values. -``` -sed -i '' 's/\([0-9]\),\([0-9]\)/\1\2/g' data.txt - -# balance,name -# 1000,john -# 2000,jack - -``` - -Lastly, Jack up and decided to quit one day. So, au revoir, mon ami. -``` -sed -i '' '/jack/d' data.txt - -# balance,name -# 1000,john - -``` - -As you can see, `sed` packs quite a punch, but the fun doesn’t stop there. - -### AWK - -The best for last. Awk is much more than a simple command: it is a full-blown language. Of everything covered in this article, `awk` is by far the coolest. If you find yourself impressed there are loads of great resources - see [here][6], [here][7] and [here][8]. - -Common use cases for `awk` include: - - * Text processing - * Formatted text reports - * Performing arithmetic operations - * Performing string operations - - - -Awk can parallel `grep` in its most nascent form. -``` -awk '/word/' filename.csv - -``` - -Or with a little more magic the combination of `grep` and `cut`. Here, `awk` prints the third and fourth column, tab separated, for all lines with our word. `-F,` merely changes our delimiter to a comma. -``` -awk -F, '/word/ { print $3 "\t" $4 }' filename.csv - -``` - -Awk comes with a lot of nifty variables built-in. For instance, `NF` \- number of fields - and `NR` \- number of records. To get the fifty-third record in a file: -``` -awk -F, 'NR == 53' filename.csv - -``` - -An added wrinkle is the ability to filter based off of one or more values. The first example, below, will print the line number and columns for records where the first column equals string. -``` -awk -F, ' $1 == "string" { print NR, $0 } ' filename.csv - -# Filter based off of numerical value in second column - -awk -F, ' $2 == 1000 { print NR, $0 } ' filename.csv - -``` - -Multiple numerical expressions: -``` -# Print line number and columns where column three greater -# than 2005 and column five less than one thousand - -awk -F, ' $3 >= 2005 && $5 <= 1000 { print NR, $0 } ' filename.csv - -``` - -Sum the third column: -``` -awk -F, '{ x+=$3 } END { print x }' filename.csv - -``` - -The sum of the third column, for values where the first column equals “something”. -``` -awk -F, '$1 == "something" { x+=$3 } END { print x }' filename.csv - -``` - -Get the dimensions of a file: -``` -awk -F, 'END { print NF, NR }' filename.csv - -# Prettier version - -awk -F, 'BEGIN { print "COLUMNS", "ROWS" }; END { print NF, NR }' filename.csv - -``` - -Print lines appearing twice: -``` -awk -F, '++seen[$0] == 2' filename.csv - -``` - -Remove duplicate lines: -``` -# Consecutive lines -awk 'a !~ $0; {a=$0}'] - -# Nonconsecutive lines -awk '! a[$0]++' filename.csv - -# More efficient -awk '!($0 in a) {a[$0];print} - -``` - -Substitute multiple values using built-in function `gsub()`. -``` -awk '{gsub(/scarlet|ruby|puce/, "red"); print}' - -``` - -This `awk` command will combine multiple CSV files, ignoring the header and then append it at the end. -``` -awk 'FNR==1 && NR!=1{next;}{print}' *.csv > final_file.csv - -``` - -Need to downsize a massive file? Welp, `awk` can handle that with help from `sed`. Specifically, this command breaks one big file into multiple smaller ones based on a line count. This one-liner will also add an extension. -``` -sed '1d;$d' filename.csv | awk 'NR%NUMBER_OF_LINES==1{x="filename-"++i".csv";}{print > x}' - -# Example: splitting big_data.csv into data_(n).csv every 100,000 lines - -sed '1d;$d' big_data.csv | awk 'NR%100000==1{x="data_"++i".csv";}{print > x}' - -``` - -### CLOSING - -The command line boasts endless power. The commands covered in this article are enough to elevate you from zero to hero in no time. Beyond those covered, there are many utilities to consider for daily data operations. [Csvkit][9], [xsv][10] and [q][11] are three of note. If you’re looking to take an even deeper dive into command line data science, then look no further than [this book][12]. It’s also available online [for free][13]! - --------------------------------------------------------------------------------- - -via: http://kadekillary.work/post/cli-4-ds/ - -作者:[Kade Killary][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]:http://kadekillary.work/authors/kadekillary -[1]:https://en.wikipedia.org/wiki/Brian_Kernighan -[2]:https://en.wikipedia.org/wiki/The_C_Programming_Language -[3]:https://www.amazon.com/Learning-AWK-Programming-cutting-edge-text-processing-ebook/dp/B07BT98HDS -[4]:https://www.youtube.com/watch?v=MijmeoH9LT4 -[5]:https://www.amazon.com/sed-awk-Dale-Dougherty/dp/1565922255/ref=sr_1_1?ie=UTF8&qid=1524381457&sr=8-1&keywords=sed+and+awk -[6]:https://www.amazon.com/AWK-Programming-Language-Alfred-Aho/dp/020107981X/ref=sr_1_1?ie=UTF8&qid=1524388936&sr=8-1&keywords=awk -[7]:http://www.grymoire.com/Unix/Awk.html -[8]:https://www.tutorialspoint.com/awk/index.htm -[9]:http://csvkit.readthedocs.io/en/1.0.3/ -[10]:https://github.com/BurntSushi/xsv -[11]:https://github.com/harelba/q -[12]:https://www.amazon.com/Data-Science-Command-Line-Time-Tested/dp/1491947853/ref=sr_1_1?ie=UTF8&qid=1524390894&sr=8-1&keywords=data+science+at+the+command+line -[13]:https://www.datascienceatthecommandline.com/ diff --git a/translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md b/translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md new file mode 100644 index 0000000000..a02057f65a --- /dev/null +++ b/translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md @@ -0,0 +1,469 @@ +数据科学家的命令行技巧 +====== + +![](https://i.imgur.com/0mzQMcB.png) + +对于许多数据科学家来说,数据操作始于和结束于 Pandas 或 Tidyverse。从理论上讲,这样做没有任何问题。毕竟,这就是这些工具存在的原因。然而,对于像分隔符转换这样的简单任务,这些工具是大材小用了。 + +立志掌握命令行应该在每个开发人员的清单上,特别是数据科学家。学习 shell 的来龙去脉将无可否认地提高你的生产力。除此之外,命令行还是计算领域的一个重要历史课程。例如,awk - 一种数据驱动的脚本语言。1977年,在传奇的 [K&R 书][2]中 K 即 [Brain Kernighan][1] 的帮助下,Awk 首次出现。今天,大约五十年过去了,awk 仍然和每年出现的[新书][3]相关。因此,可以安全地假设对命令行魔法的投资不会很快贬值。 + +### 我们将涵盖什么 + + * ICONV + * HEAD + * TR + * WC + * SPLIT + * SORT & UNIQ + * CUT + * PASTE + * JOIN + * GREP + * SED + * AWK + + + +### ICONV + +文件编码可能会很棘手。现在大部分文件都是 UTF-8 编码的。要了解 UTF-8 背后的一些魔力,请查看这个出色的[视频][4]。尽管如此,有时我们收到的文件不是这种格式。这可能引起对改变编码模式的一些不靠谱尝试。这里,iconv 是一个拯救者。Iconv 是一个简单的程序,它将获取采用一种编码的文本并输出采用另一种编码的文本。 +``` +# Converting -f (from) latin1 (ISO-8859-1) +# -t (to) standard UTF_8 + +iconv -f ISO-8859-1 -t UTF-8 < input.txt > output.txt +``` + + * 实用选项: + + * `iconv -l` 列出所有已知编码 + * `iconv -c` 默默丢弃无法转换的字符 + + + +### HEAD + +如果你是一个频繁的 Pandas 用户,那么会很熟悉 `head`。通常在处理新数据时,我们想做的第一件事就是了解其内容。这导致启动 Pandas,读取数据然后调用 `df.head()` \- 这至少是费劲的。没有任何标志的 Head 将打印出文件的前10行。`head` 的真正力量在于测试出来干净利落的操作。例如,如果我们想将文件的分隔符从逗号更改为管道。一个快速测试将是:`head mydata.csv | sed 's/,/|/g'`。 +```bash +# Prints out first 10 lines +head filename.csv + +# Print first 3 lines +head -n 3 filename.csv +``` + + * 实用选项: + + * `head -n` 打印特定行数 + * `head -c` 打印具体的字节数 + + + +### TR + +Tr 类似于翻译。这个功能强大的实用程序是基本文件清理的主力。理想的用例是交换文件中的分隔符。 +```bash +# Converting a tab delimited file into commas +cat tab_delimited.txt | tr "\t" "," comma_delimited.csv +``` + +`tr` 另一个功能是在你支配中的内建 `[:class:]` 变量(POSIX 字符类)。这些包括了: + +``` +[:alnum:] all letters and digits +[:alpha:] all letters +[:blank:] all horizontal whitespace +[:cntrl:] all control characters +[:digit:] all digits +[:graph:] all printable characters, not including space +[:lower:] all lower case letters +[:print:] all printable characters, including space +[:punct:] all punctuation characters +[:space:] all horizontal or vertical whitespace +[:upper:] all upper case letters +[:xdigit:] all hexadecimal digits +``` + +你可以将这些连接在一起以组成强大的程序。以下是一个基本的字数统计程序,可用于检查自述文件是否过度使用。 +``` +cat README.md | tr "[:punct:][:space:]" "\n" | tr "[:upper:]" "[:lower:]" | grep . | sort | uniq -c | sort -nr +``` + +另一个使用基本正则表达式的例子: +``` +# Converting all upper case letters to lower case +cat filename.csv | tr '[A-Z]' '[a-z]' +``` + + * 实用选项: + + * `tr -d` 删除字符 + * `tr -s` 压缩字符 + * `\b` 退格 + * `\f` 换页 + * `\v` 垂直制表符 + * `\NNN` 八进制字符 + + + +### WC + +单词数量。它的值主要来自 `-l` 标志,它会给你提供行数。 +``` +# Will return number of lines in CSV +wc -l gigantic_comma.csv +``` + +这个工具可以方便地确认各种命令的输出。所以,如果我们在转换文件中的分隔符之后运行 `wc -l`,我们会期待总行数是一样的,如果不一致,我们就知道有地方出错了。 + + * 实用选项: + + * `wc -c` 打印字节数 + * `wc -m` 打印字符数 + * `wc -L` 打印最长行的长度 + * `wc -w` 打印单词数量 + + + +### SPLIT + +文件大小的范围可以很广。取决于任务,拆分文件可以是有益的,所以使用 `split` 吧。split的基本语法是: +```bash +# We will split our CSV into new_filename every 500 lines +split -l 500 filename.csv new_filename_ +# filename.csv +# ls output +# new_filename_aaa +# new_filename_aab +# new_filename_aa +``` + +两个奇怪的地方是命名约定和缺少文件扩展名。后缀约定可以通过 `-d` 标志变为数字。要添加文件扩展名,你需要运行以下 `find` 命令。它将通过附加 `.csv`更改当前目录中所有文件的名称,所以小心了。 +```bash +find . -type f -exec mv '{}' '{}'.csv \; +# ls output +# filename.csv.csv +# new_filename_aaa.csv +# new_filename_aab.csv +# new_filename_aac.csv +``` + + * 实用选项: + + * `split -b` 按特定字节大小分割 + * `split -a` 生成长度为 N 的后缀 + * `split -x` 使用十六进制后缀分割 + + + +### SORT & UNIQ + +以上两个命令很明显:他们的作用就是字面意思。这两者结合起来可以提供最强大的冲击 (i.e. 单独单词数量)。这是由于 `uniq` 只作用于重复的相邻行。这也是在输出前 `sort` 的原因。一个有趣的纪录是 `sort -u` 会达到和典型的 `sort file.txt | uniq` 模式一样的结果。 + +Sort 对数据科学家来说确实具有潜在的有用能力:能够根据特定列对整个 CSV 进行排序。 +```bash +# Sorting a CSV file by the second column alphabetically +sort -t"," -k2,2 filename.csv + +# Numerically +sort -t"," -k2n,2 filename.csv + +# Reverse order +sort -t"," -k2nr,2 filename.csv +``` + +这里的 `-t` 选项将逗号指定为分隔符。通常假设分隔符是空格或制表符。此外,`-k` 标志是为了确定我们的 key。这里的语法是 `-km,n`,`m` 作为开始列,`n` 作为结束列。 + + * 实用选项: + + * `sort -f` 忽略大小写 + * `sort -r` 反向排序 + * `sort -R` 乱序 + * `uniq -c` 统计出现次数 + * `uniq -d` 只打印重复行 + + + +### CUT + +Cut 用于删除列。为了演示,如果我们只想删除第一和第三列。 +```bash +cut -d, -f 1,3 filename.csv +``` + +选择除了第一行外的所有行。 +```bash +cut -d, -f 2- filename.csv +``` + +结合其他命令,将`cut` 用作过滤器。 +```bash +# Print first 10 lines of column 1 and 3, where "some_string_value" is present +head filename.csv | grep "some_string_value" | cut -d, -f 1,3 +``` + +查出第二列中唯一值的数量。 +```bash +cat filename.csv | cut -d, -f 2 | sort | uniq | wc -l + +# Count occurences of unique values, limiting to first 10 results +cat filename.csv | cut -d, -f 2 | sort | uniq -c | head +``` + +### PASTE + +Paste 是一个带有趣味性功能的粘贴命令。如果你有两个需要合并的文件,并且它们已经排序了,`paste` 帮你解决了接下来的步骤。 +```bash +# names.txt +adam +john +zach + +# jobs.txt +lawyer +youtuber +developer + +# Join the two into a CSV +paste -d ',' names.txt jobs.txt > person_data.txt + +# Output +adam,lawyer +john,youtuber +zach,developer +``` + +查看更多 SQL_-esque 变种,见下文。 + +### JOIN + +Join 是一个简单准切向的 SQL。最大的区别是 `join` 将返回所有列以及只能在一个字段上匹配。默认情况下,`join` 将尝试使用第一列作为匹配键。为了获得不同结果,必须使用以下语法: +```bash +# Join the first file (-1) by the second column +# and the second file (-2) by the first +join -t "," -1 2 -2 1 first_file.txt second_file.txt +``` + +标准的 join 是内连接。然而,外连接通过 `-a` 标志也是可行的。另一个值得一提的技巧是 `-q` 标志,如果发现有缺失的字段,可用于替换值。 +```bash +# Outer join, replace blanks with NULL in columns 1 and 2 +# -o which fields to substitute - 0 is key, 1.1 is first column, etc... +join -t"," -1 2 -a 1 -a2 -e ' NULL' -o '0,1.1,2.2' first_file.txt second_file.txt +``` + +不是最用户友好的命令,而是绝望时刻的绝望措施。 + + * 实用选项: + + * `join -a` 打印不可配对的行 + * `join -e` 替换丢失的输入字段 + * `join -j` 相当于 `-1 FIELD -2 FIELD` + + + +### GREP + +用正则表达式全局搜索并且打印,或者 `grep`,可能是最有名的命令并且有充分的理由。Grep 很强大,特别适合在大型代码库中找到路径。在数据科学的王国里,它充当其他命令的提炼机制。虽然它的标准用途也很有价值。 +``` +# Recursively search and list all files in directory containing 'word' + +grep -lr 'word' . + +# List number of files containing word + +grep -lr 'word' . | wc -l + +``` + +计算包含单词或模式的总行数。 +``` +grep -c 'some_value' filename.csv + +# Same thing, but in all files in current directory by file name + +grep -c 'some_value' * +``` + +使用 or 运算符 - `\|` 为多个值 Grep。 +``` +grep "first_value\|second_value" filename.csv +``` + + * 实用选项: + + * `alias grep="grep --color=auto"` 使 grep 丰富多彩 + * `grep -E` 使用扩展的 regexp + * `grep -w` 只匹配整个单词 + * `grep -l` 打印匹配的文件名 + * `grep -v` 倒置匹配 + + + +### 大人物们 + +Sed 和 Awk 是本文中最强大的两个命令。为简介起见,我不打算详细讨论这两个命令。相反,我将介绍各种能证明其令人印象深刻的力量的命令。如果你想了解更多,[这儿就有一本书][5]是关于它们的。 + +### SED + +`sed` 本质上是一个流编辑器。它擅长替换,但也可以用于所有输出重构。 + +最基本的 `sed` 命令由 `s/old/new/g` 组成。这转换为搜索旧值,全局替换为新值。 如果没有 `/g`,我们的命令将在旧值第一次出现后终止。 + +为了快速了解它的功能,我们可以深入了解一个例子。 在以下情景中,你已获得以下文件: +``` +balance,name +$1,000,john +$2,000,jack +``` + +我们可能想要做的第一件事是删除美元符号。`-i` 标志表示原位。`''` 表示零长度文件扩展名,从而覆盖我们的初始文件。理想情况下,你可以单独测试每个,然后输出到新文件。 +``` +sed -i '' 's/\$//g' data.txt +# balance,name +# 1,000,john +# 2,000,jack +``` + +接下来, `blance` 列的逗号。 +``` +sed -i '' 's/\([0-9]\),\([0-9]\)/\1\2/g' data.txt +# balance,name +# 1000,john +# 2000,jack +``` + +最后杰克有一天决定退出。所以,再见了,我的朋友。 +``` +sed -i '' '/jack/d' data.txt +# balance,name +# 1000,john +``` + +正如你所看到的,`sed` 有很多强大的功能,但乐趣并不止于此。 + +### AWK + +最好的留在最后。Awk 不仅仅是一个简单的命令:它是一个成熟的语言。在本文中涉及的所有内容中,`awk` 是目前为止最酷的。如果你发现自己对其印象深刻,这里有很多很棒的资源 - 看 [这里][6], [这里][7] 和 [这里][8]。 + +`awk` 的常见用例包括: + + * 文字处理 + * 格式化文本报告 + * 执行算术运算 + * 执行字符串操作 + + + +Awk 可以以最原生的形式并行 `grep`。 +``` +awk '/word/' filename.csv +``` + +或者更加神奇:将 `grep` 和 `cut` 组合起来。在这里,`awk` 打印第三和第四列,用 tab 分隔,对于所有带我们指定单词的行。`-F,` 只是改变我们的分隔符为逗号。 +```bash +awk -F, '/word/ { print $3 "\t" $4 }' filename.csv +``` + +Awk 内置了许多精巧的变量。比如,`NF` \- 字段数 - 和 `NR` \- 记录数。要获取文件中的第53条记录: +```bash +awk -F, 'NR == 53' filename.csv +``` + +增加的代码是基于一个或多个值进行过滤的能力。下面的第一个示例将打印第一列等于给定字符串的记录的行号和列。 +```bash +awk -F, ' $1 == "string" { print NR, $0 } ' filename.csv + +# Filter based off of numerical value in second column +awk -F, ' $2 == 1000 { print NR, $0 } ' filename.csv +``` + +多个数值表达式: +```bash +# Print line number and columns where column three greater +# than 2005 and column five less than one thousand + +awk -F, ' $3 >= 2005 && $5 <= 1000 { print NR, $0 } ' filename.csv +``` + +求出第三列的总和: +```bash +awk -F, '{ x+=$3 } END { print x }' filename.csv +``` + +在第一列等于 “something”的那些行,求出第三列值的总和。 +```bash +awk -F, '$1 == "something" { x+=$3 } END { print x }' filename.csv +``` + +获取文件的尺寸: +```bash +awk -F, 'END { print NF, NR }' filename.csv + +# Prettier version +awk -F, 'BEGIN { print "COLUMNS", "ROWS" }; END { print NF, NR }' filename.csv +``` + +打印出现了两次的行: +```bash +awk -F, '++seen[$0] == 2' filename.csv +``` + +删除重复的行: +```bash +# Consecutive lines +awk 'a !~ $0; {a=$0}'] + +# Nonconsecutive lines +awk '! a[$0]++' filename.csv + +# More efficient +awk '!($0 in a) {a[$0];print} +``` + +使用内置函数 `gsub()` 替换多个值。 +```bash +awk '{gsub(/scarlet|ruby|puce/, "red"); print}' +``` + +这个 `awk` 命令将组合多个 CSV 文件,忽略标题,然后在最后附加它。 +```bash +awk 'FNR==1 && NR!=1{next;}{print}' *.csv > final_file.csv +``` + +需要缩小一个庞大的文件? `awk` 可以在 `sed` 的帮助下处理它。具体来说,该命令根据行数将一个大文件分成多个较小的文件。这个 one-liner 也将增加一个扩展。 +```bash +sed '1d;$d' filename.csv | awk 'NR%NUMBER_OF_LINES==1{x="filename-"++i".csv";}{print > x}' + +# Example: splitting big_data.csv into data_(n).csv every 100,000 lines +sed '1d;$d' big_data.csv | awk 'NR%100000==1{x="data_"++i".csv";}{print > x}' +``` + +### 结语 + +命令行拥有无穷无尽的力量。本文中介绍的命令足以将你从一无所知提升到英雄人物。除了涵盖的内容之外,还有许多实用程序需要考虑用于日常数据操作。[Csvkit][9], [xsv][10] 还有 [q][11] 是需要记住的三个。如果你希望更深入地了解命令行数据科学,查看[这本书][12]。它也可以[免费][13]在线获得! + +-------------------------------------------------------------------------------- + +via: http://kadekillary.work/post/cli-4-ds/ + +作者:[Kade Killary][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[GraveAccent](https://github.com/graveaccent) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://kadekillary.work/authors/kadekillary +[1]:https://en.wikipedia.org/wiki/Brian_Kernighan +[2]:https://en.wikipedia.org/wiki/The_C_Programming_Language +[3]:https://www.amazon.com/Learning-AWK-Programming-cutting-edge-text-processing-ebook/dp/B07BT98HDS +[4]:https://www.youtube.com/watch?v=MijmeoH9LT4 +[5]:https://www.amazon.com/sed-awk-Dale-Dougherty/dp/1565922255/ref=sr_1_1?ie=UTF8&qid=1524381457&sr=8-1&keywords=sed+and+awk +[6]:https://www.amazon.com/AWK-Programming-Language-Alfred-Aho/dp/020107981X/ref=sr_1_1?ie=UTF8&qid=1524388936&sr=8-1&keywords=awk +[7]:http://www.grymoire.com/Unix/Awk.html +[8]:https://www.tutorialspoint.com/awk/index.htm +[9]:http://csvkit.readthedocs.io/en/1.0.3/ +[10]:https://github.com/BurntSushi/xsv +[11]:https://github.com/harelba/q +[12]:https://www.amazon.com/Data-Science-Command-Line-Time-Tested/dp/1491947853/ref=sr_1_1?ie=UTF8&qid=1524390894&sr=8-1&keywords=data+science+at+the+command+line +[13]:https://www.datascienceatthecommandline.com/ From 5c307e68ac0a41dd69a486fa03a7853a7a4d261c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 23:10:44 +0800 Subject: [PATCH 0056/4278] PRF:20181204 3 implications of serverless.md @HankChow --- .../20181204 3 implications of serverless.md | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/translated/talk/20181204 3 implications of serverless.md b/translated/talk/20181204 3 implications of serverless.md index 866e48fdd7..d2a097f898 100644 --- a/translated/talk/20181204 3 implications of serverless.md +++ b/translated/talk/20181204 3 implications of serverless.md @@ -1,31 +1,30 @@ 无服务器架构的三个意义 ====== -对于无服务器Serverless架构,什么时候该用,什么时候不该用呢? + +> 以及,对于无服务器Serverless架构,什么时候该用,什么时候不该用呢? ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR) 如果将如今互联网体验中最方便实用的那一部分去掉,那么留下来的基本就是客户端-服务端client-server模式了。这一个模式在互联网建立初期就已经在使用了,直到目前都没有太大的变化,也就是说,这个模式仍然在为我们服务。 -那么,当人们谈论无服务器架构的时候,到底是指什么呢?其实,无服务器架构并不是说不使用服务器了。恰恰相反,客户端-服务端模式仍然在其中发挥着重要的作用。 +那么,当人们谈论无服务器Serverless架构的时候,到底是指什么呢?其实,无服务器架构并不是说不使用服务器了。恰恰相反,客户端-服务端模式仍然在其中发挥着重要的作用。 无服务器架构实际上指的是能够让开发者在不需要关心服务器上架、为操作系统打补丁、创建容器镜像这些工作的情况下,就能够完成编码、部署和创建应用这一整套流程的架构。 ### 无服务器架构的三个重要意义 - 1. 一些缺乏开发经验的人员现在要参与到开发工作中来了。无服务器架构能够让他们尽量只学习必要的工作内容,把更多的时间放在更具创造性的开发工作中。 - 2. 开发者不再需要重复造轮子。运行和维护服务器、为操作系统打补丁、创建容器等这一系列工作,都可以由更专业的无服务器架构提供商来完成。 - 3. 最现实的一点是,如果不使用无服务器架构,那么在服务器管理方面,总需要有一个作最终决策的人。当服务器发生崩溃时,或是需要在服务器上执行某些操作时,总是需要这样一个统领全局的人来作出决策。因此最佳的方案是使用无服务器架构。 - - +1. 一些缺乏开发经验的人员现在要参与到开发工作中来了。无服务器架构能够让他们尽量只学习必要的工作内容,把更多的时间放在更具创造性的开发工作中。 +2. 开发者不再需要重复造轮子。运行和维护服务器、为操作系统打补丁、创建容器等这一系列工作,都可以由更专业的无服务器架构提供商来完成。 +3. 最现实的一点是,如果不使用无服务器架构,那么在服务器管理方面,总需要有一个作最终决策的人。当服务器发生崩溃时,或是需要在服务器上执行某些操作时,总是需要这样一个统领全局的人来作出决策。因此最佳的方案是使用无服务器架构。 ### 什么时候该用或者不该用无服务器架构? 听起来无服务器架构是个好东西。但事实上,无服务器架构并不是万能的,在使用之前还需要考虑以下这些因素: - 1. 成本 - 2. 使用范围 - 3. 时间 - 4. 控制方式 +1. 成本 +2. 使用范围 +3. 时间 +4. 控制方式 其中值得注意的是控制方式。现在已经有一些项目为开发者提供了操作和控制无服务器架构计算环境的工具了,[Apache OpenWhisk][1] 就是其中之一。 @@ -40,7 +39,7 @@ via: https://opensource.com/article/18/12/serverless-podcast-command-line-heros 作者:[Jen Wike Huger][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 837b4d6256bbfc94b66ba34d0da675571de55e5f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 11 Dec 2018 23:11:36 +0800 Subject: [PATCH 0057/4278] PUB:20181204 3 implications of serverless.md @HankChow https://linux.cn/article-10336-1.html --- .../talk => published}/20181204 3 implications of serverless.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20181204 3 implications of serverless.md (100%) diff --git a/translated/talk/20181204 3 implications of serverless.md b/published/20181204 3 implications of serverless.md similarity index 100% rename from translated/talk/20181204 3 implications of serverless.md rename to published/20181204 3 implications of serverless.md From 86f0fbcdf31f22860b95fd340eadf58743e5d358 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 12 Dec 2018 09:28:28 +0800 Subject: [PATCH 0058/4278] translated --- ...ux- Features, Download and Installation.md | 86 ------------------- ...ux- Features, Download and Installation.md | 86 +++++++++++++++++++ 2 files changed, 86 insertions(+), 86 deletions(-) delete mode 100644 sources/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md create mode 100644 translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md diff --git a/sources/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md b/sources/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md deleted file mode 100644 index b21790181a..0000000000 --- a/sources/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (SMPlayer in Linux: Features, Download and Installation) -[#]: via: (https://itsfoss.com/smplayer/) -[#]: author: (Aquil Roshan;Abhishek Prakash https://itsfoss.com/author/aquil/) -[#]: url: ( ) - -SMPlayer in Linux: Features, Download and Installation -====== - -One of the [things you’ll notice after a fresh install of Ubuntu][1], or pretty much any other Linux distribution, is this message when you try to play certain video files. - -![][2] -Default media player is not good with codecs - -It means that the [codecs needed][3] to play the media are not installed on the system. Now, due to some copyright issues, some Linux based operating systems cannot pre-pack the codecs in the installation media. But they do allow you to download and install the codecs with just a click, or you could just install a media player which has all the multimedia codecs, to begin with. Checkout [SMPlayer][4]. - -### Meet SMPlayer: A Better Media Player for Linux - -SMPlayer is a free and open-source media player built on the powerful [MPlayer][5] media engine. SMPlayer is capable of playing avi, mp4, mkv, mpeg, mov, divx, h.264 and pretty much any other major media format out there. And the cherry on top is, it can play [YouTube][6] videos too, ad-free. - -![SMPlayer default interface][7] - -SMPlayer is a complete media solution. It is cross-platform, so available on all the operating systems. If you have a dual boot, you can install it on your Windows and Linux OS to get a uniform experience on both the systems. It also supports convertible laptops with touch support. - -You can play YouTube on SMPlayer too. I know it’s impractical to copy-paste the video URL and play on an external player every time. But SMPlayer is particularly useful when you are watching comparatively lengthy videos. SMPlayer plays YouTube videos in a very good quality and I felt the videos play out much better than the in-browser videos. And by playing the lengthier videos on SMPlayer, you can stay clear of the mid-roll ads that pop up on the lengthier videos. - -If you’re watching a movie which doesn’t have subtitles, You can directly download the subtitles through SMPlayer. It comes with [opensubtitles.org][8] integration. So none of that, open the browser, search for subtitles, download the appropriate ones, unzip, place them in the video folder and connect the subtitles to the movie. No Sir! SMPlayer at your service. - -![Automatic subtitle download in SMPlayer][9] - -SMPlayer is available in more than 30 languages and it is highly customizable. It has both applications theming and a ton of icon sets in it. - -If you feel that the default interface of SMPlayer doesn’t look good, in a few clicks you can make it look like this: - -![SMPlayer skin change][10] - -SMPlayer comes with a lot of tools and features for the power users. It has an equalizer, video speed controls, aspect ratio and zoom controls, video filters, screenshot ripping and lot more. - -All in all, I really liked SMPlayer. It has a lot to offer in a small and lightweight package. I think it is a must have video player on your Linux PC. Along with playing all the media formats easily it also provides a ton of power controls. - -### Installing SMPlayer on Linux - -SMPlayer should be available in the software center of all major Linux distributions. You can search for it and install it from there itself. - -On Ubuntu/ Linux Mint/ Elementary OS, you can also install SMPlayer by running the following command in the terminal - -``` -sudo apt install smplayer -``` - -Alternatively, you can download the package for Fedora, Arch Linux, OpenSUSE and Debian [here.][11] - -### Wrapping Up - -There are a good number of full-fledged media players out there like the VLC media player. SMPlayer is one of the best ones with a full functionality and great add-on benefits. I’ll consider it one of the [must-have applications for Linux][12]. - -Do give it a try and share your thoughts with us in the comments section below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/smplayer/ - -作者:[Aquil Roshan;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/aquil/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-warning.jpg?fit=800%2C450&ssl=1 -[3]: https://packages.ubuntu.com/trusty/ubuntu-restricted-extras -[4]: https://www.smplayer.info/ -[5]: http://www.mplayerhq.hu/design7/news.html -[6]: https://www.youtube.com/ -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-coco.jpg?fit=800%2C450&ssl=1 -[8]: https://www.opensubtitles.org/en/search -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-icon-packs.jpg?fit=800%2C450&ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-theme.jpg?fit=800%2C450&ssl=1 -[11]: https://software.opensuse.org/download.html?project=home%3Asmplayerdev&package=smplayer -[12]: https://itsfoss.com/essential-linux-applications/ diff --git a/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md b/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md new file mode 100644 index 0000000000..be826fc446 --- /dev/null +++ b/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (SMPlayer in Linux: Features, Download and Installation) +[#]: via: (https://itsfoss.com/smplayer/) +[#]: author: (Aquil Roshan;Abhishek Prakash https://itsfoss.com/author/aquil/) +[#]: url: ( ) + +Linux 中的 SMPlayer:功能,下载和安装 +====== + +当你要播放视频时,你会在[全新安装的 Ubuntu][1],或其他许多发行版中,会注意到一个消息: + +![][2] +默认媒体播放器没有适合的编解码器 + +这意味着系统上没有安装播放媒体的[所需编解码器][3]。现在,由于某些版权问题,某些基于 Linux 的操作系统无法在安装介质中预先打包编解码器。但是它们能让你只需点击即可下载和安装编解码器,或者你可以安装拥有所有媒体编解码器的媒体播放器。了解一下 [SMPlayer][4]。 + +### 认识 SMPlayer:适用于 Linux 的更好的媒体播放器 + +SMPlayer 是一款免费的开源媒体播放器,它基于强大的 [MPlayer][5] 媒体引擎。SMPlayer 能够播放 avi、mp4、mkv、mpeg、mov、divx、h.264 以及其他任何主要媒体格式。锦上添花的是,它也可以播放 [YouTube][6] 视频,并且无广告。 + +![SMPlayer default interface][7] + +SMPlayer 是一个完整的媒体解决方案。它是跨平台的,因此可在所有操作系统上使用。如果你是双启动,则可以将其安装在 Windows 和 Linux 操作系统上,以便在两个系统上获得统一的体验。它还支持带触摸的可变形笔记本。 + +你也可以在 SMPlayer 上播放 YouTube。我知道每次复制粘贴视频 URL 并在外部播放器上播放是不切实际的。但是当你观看相对较长的视频时,SMPlayer 特别有用。SMPlayer 以相当好的质量播放 YouTube 视频,我觉得比在浏览器中播放得更好。通过在 SMPlayer 上播放较长的视频,你可以远离视频中间弹出的插播广告。 + +如果你在观看没有字幕的电影,你可以直接通过 SMPlayer 下载字幕。它集成了 [opensubtitles.org][8]。所以,打开浏览器,搜索字幕,下载相应的字幕,解压缩,将它们放在视频文件夹中并将字幕连接到电影,这些都不需要!SMPlayer 会为你服务。 + +![Automatic subtitle download in SMPlayer][9] + +SMPlayer 支持 30 多种语言,并可高度自定义。它还有应用主题和大量的图标集。 + +如果你觉得 SMPlayer 的默认界面看起来不太好,只需点击几下,它就可以看起来像这样: + +![SMPlayer skin change][10] + +SMPlayer 为高级用户提供了许多工具和功能。它有均衡器、视频速度控制、宽高比和缩放控制、视频过滤器、屏幕截图等等。 + +总而言之,我真的很喜欢 SMPlayer。它在一个小巧轻量级的安装包中提供了很多功能。我认为它是 Linux PC 上必备的视频播放器。除了轻松播放所有媒体格式外,它还提供了大量的控制。 + +### 在 Linux 上安装 SMPlayer + +SMPlayer 应该可在所有主要 Linux 发行版的软件中心获取。你可以搜索它并从那里安装它。 + +在 Ubuntu/ Linux Mint/ Elementary OS 上,你还可以通过在终端中运行以下命令来安装 SMPlayer + +``` +sudo apt install smplayer +``` + +或者,你可以在[这里][11]下载 Fedora、Arch Linux、OpenSUSE 和 Debian 的软件包 + +### 总结 + +有很多像 VLC 媒体播放器那样成熟的播放器。SMPlayer 是拥有完整功能和插件优势的最佳产品之一。我认为它是[必备 Linux 应用][12]之一。 + +请尝试一下并在下面的评论栏与我们分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/smplayer/ + +作者:[Aquil Roshan;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/aquil/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-warning.jpg?fit=800%2C450&ssl=1 +[3]: https://packages.ubuntu.com/trusty/ubuntu-restricted-extras +[4]: https://www.smplayer.info/ +[5]: http://www.mplayerhq.hu/design7/news.html +[6]: https://www.youtube.com/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-coco.jpg?fit=800%2C450&ssl=1 +[8]: https://www.opensubtitles.org/en/search +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-icon-packs.jpg?fit=800%2C450&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-theme.jpg?fit=800%2C450&ssl=1 +[11]: https://software.opensuse.org/download.html?project=home%3Asmplayerdev&package=smplayer +[12]: https://itsfoss.com/essential-linux-applications/ \ No newline at end of file From e241040dd6c6aa7f2c1e52f8015e9383c15d102e Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 12 Dec 2018 09:32:00 +0800 Subject: [PATCH 0059/4278] translating --- ...ur Easy Ways to Search Or Find Files And Folders in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md b/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md index 8dde618420..f28649013b 100644 --- a/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md +++ b/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ab0558683312b3c62fedacc1b08127d90a6cbc25 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 13:03:09 +0800 Subject: [PATCH 0060/4278] PRF:20181128 OpenSnitch - an Application Firewall for Linux -Review.md @qhwdw --- ... Application Firewall for Linux -Review.md | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/translated/tech/20181128 OpenSnitch - an Application Firewall for Linux -Review.md b/translated/tech/20181128 OpenSnitch - an Application Firewall for Linux -Review.md index 229b5b89c1..9cfe0afa34 100644 --- a/translated/tech/20181128 OpenSnitch - an Application Firewall for Linux -Review.md +++ b/translated/tech/20181128 OpenSnitch - an Application Firewall for Linux -Review.md @@ -1,13 +1,13 @@ [#]: collector: "lujun9972" [#]: translator: "qhwdw" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: subject: "OpenSnitch – an Application Firewall for Linux [Review]" [#]: via: "https://itsfoss.com/opensnitch-firewall-linux/" -[#]: author: "[John Paul](https://itsfoss.com/author/john/)" +[#]: author: "John Paul https://itsfoss.com/author/john/" [#]: url: " " -OpenSnitch – 一个 Linux 上的应用程序防火墙 +OpenSnitch:一个 Linux 上的应用程序防火墙 ====== 不能因为 Linux 比 Windows 更安全,就可以在 Linux 上放松警惕。Linux 上可以使用的防火墙很多,它们可以让你的 Linux 系统更安全。今天,我们将带你了解一个这样的防火墙工具,它就是 OpenSnitch。 @@ -20,9 +20,11 @@ OpenSnitch – 一个 Linux 上的应用程序防火墙 OpenSnitch 所做的主要事情就是跟踪你机器上安装的应用程序所发起的互联网请求。OpenSnitch 允许你去创建规则以同意或阻止那个应用程序发起的互联网访问。当一个应用程序尝试去访问互联网而没有相应的访问规则存在时,就会出现一个对话框,这个对话框让你去选择允许还是阻止那个连接。 -你也可以决定这个新规则是应用到进程上、精确的 URL 上、域名上、单个实例上,以及本次会话还是永久有效。 +你也可以决定这个新规则是应用到进程上、具体的 URL 上、域名上、单个实例上,以及本次会话还是永久有效。 -![OpenSnitch firewall app in Linux][5]OpenSnatch 规则请求 +![OpenSnitch firewall app in Linux][5] + +*OpenSnatch 规则请求* 你创建的所有规则都保存为 [JSON 文件][6],如果以后需要修改它,就可以去修改这个文件。比如说,你错误地阻止了一个应用程序。 @@ -33,17 +35,17 @@ OpenSnitch 也有一个漂亮的、一目了然的图形用户界面: * 属主用户是谁 * 使用哪个端口 - - 如果你愿意,也可以将这些信息导出到一个 CSV 文件中。 OpenSnitch 遵循 GPL v3 许可证使用。 -![OpenSnitch firewall interface][7]OpenSnitch 进程标签页 +![OpenSnitch firewall interface][7] + +*OpenSnitch 进程标签页* ### 在 Linux 中安装 OpenSnitch -[OpenSnitch GitHub 页面][8] 上的安装介绍是针对 Ubuntu 用户的。如果你使用的是其它发行版,你需要调整一下相关的命令。据我所知,这个应用程序仅打包到 [Arch User Repository][9] 中。 +[OpenSnitch GitHub 页面][8] 上的安装介绍是针对 Ubuntu 用户的。如果你使用的是其它发行版,你需要调整一下相关的命令。据我所知,这个应用程序仅在 [Arch User Repository][9] 中打包了。 在你开始之前,你必须正确安装了 Go,并且已经定义好了 `$GOPATH` 环境变量。 @@ -67,7 +69,7 @@ go get github.com/evilsocket/opensnitch cd $GOPATH/src/github.com/evilsocket/opensnitch ``` -如果没有正确设置 `$GOPATH` 环境变量,运行上面的命令时将会出现一个 “no such folder found” 的错误信息。只需要进入到你刚才克隆仓库位置的 “evilsocket/opensnitch” 文件夹中即可。 +如果没有正确设置 `$GOPATH` 环境变量,运行上面的命令时将会出现一个 “no such folder found” 的错误信息。只需要进入到你刚才克隆仓库位置的 `evilsocket/opensnitch` 文件夹中即可。 现在,我们构建并安装它。 @@ -77,7 +79,7 @@ make sudo make install ``` -如果出现 “`dep` command could not be found” 的错误信息,在 `PATH` 中添加 `GOPATH/bin` 即可。 +如果出现 “dep command could not be found” 的错误信息,在 `$PATH` 中添加 `$GOPATH/bin` 即可。 安装完成后,我们将要启动它的守护程序和图形用户界面。 @@ -90,7 +92,8 @@ opensnitch-ui ``` ![OpenSnitch firewall interface][10] -运行在 Manjaro 上的 OpenSnitch + +*运行在 Manjaro 上的 OpenSnitch* ### 使用体验 @@ -98,7 +101,7 @@ opensnitch-ui 不幸的是,我安装之后,不能启动图形用户界面。因此,我手动去运行最后三个步骤。一切似乎很顺利。如果我想让 Firefox 去访问 Manjaro 的网站,对话框就会弹出来询问我。 -有趣的是,当我运行一个 [AUR 工具][11] `yay` 去更新我的系统时,弹出对话框要求了 `yay`、`pacman`、`pamac`、和 `git` 的访问规则。后来,我关闭并重启动 GUI,因为它是活动的。当我重启动它时,它不再要求我去创建规则了。我安装了 Falkon,而 OpenSnitch 并没有询问我去授予它任何权限。它甚至在 OpenSnitch 的 GUI 中没有列出 Falkon。我重新安装了 OpenSnitch 后,这个问题依旧存在。 +有趣的是,当我运行一个 [AUR 工具][11] `yay` 去更新我的系统时,弹出对话框要求了 `yay`、`pacman`、`pamac`、和 `git` 的访问规则。后来,我关闭并重启动 GUI,因为它当前是激活的。当我重启动它时,它不再要求我去创建规则了。我安装了 Falkon,而 OpenSnitch 并没有询问我去授予它任何权限。它甚至在 OpenSnitch 的 GUI 中没有列出 Falkon。我重新安装了 OpenSnitch 后,这个问题依旧存在。 然后,我转到 Ubuntu Mate 上安装 OpenSnitch,因为安装介绍就是针对 Ubuntu 所写的,进展很顺利。但是,我遇到了几个问题。我调整了一下上面介绍的安装过程以解决我遇到的问题。 @@ -106,7 +109,9 @@ opensnitch-ui GUI 也有一点需要去改进。由于某些原因,每次窗口都被放在顶部。而且不能通过设置来修改这个问题。如果能够从 GUI 中改变规则将是一个不错的选择。 -![][12]OpenSnitch 的 hosts 标签 +![][12] + +*OpenSnitch 的 hosts 标签* ### 对 OpenSnitch 的最后意见 @@ -125,7 +130,7 @@ via: https://itsfoss.com/opensnitch-firewall-linux/ 作者:[John Paul][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 d58835965df2e398c02e29d85babd8e1f7ac94d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 13:04:11 +0800 Subject: [PATCH 0061/4278] PUB:20181128 OpenSnitch - an Application Firewall for Linux -Review.md @qhwdw https://linux.cn/article-10337-1.html --- ... OpenSnitch - an Application Firewall for Linux -Review.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181128 OpenSnitch - an Application Firewall for Linux -Review.md (99%) diff --git a/translated/tech/20181128 OpenSnitch - an Application Firewall for Linux -Review.md b/published/20181128 OpenSnitch - an Application Firewall for Linux -Review.md similarity index 99% rename from translated/tech/20181128 OpenSnitch - an Application Firewall for Linux -Review.md rename to published/20181128 OpenSnitch - an Application Firewall for Linux -Review.md index 9cfe0afa34..996f905ddc 100644 --- a/translated/tech/20181128 OpenSnitch - an Application Firewall for Linux -Review.md +++ b/published/20181128 OpenSnitch - an Application Firewall for Linux -Review.md @@ -1,11 +1,11 @@ [#]: collector: "lujun9972" [#]: translator: "qhwdw" [#]: reviewer: "wxy" -[#]: publisher: " " +[#]: publisher: "wxy" [#]: subject: "OpenSnitch – an Application Firewall for Linux [Review]" [#]: via: "https://itsfoss.com/opensnitch-firewall-linux/" [#]: author: "John Paul https://itsfoss.com/author/john/" -[#]: url: " " +[#]: url: "https://linux.cn/article-10337-1.html" OpenSnitch:一个 Linux 上的应用程序防火墙 ====== From 390bdf2579df7a7ae2631ff5ba2ecf877af3d60b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 13:29:33 +0800 Subject: [PATCH 0062/4278] PRF:20180221 12 useful zypper command examples.md @cycoe --- ...80221 12 useful zypper command examples.md | 92 ++++++++++--------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/translated/tech/20180221 12 useful zypper command examples.md b/translated/tech/20180221 12 useful zypper command examples.md index 018c5da7c3..356c55becc 100644 --- a/translated/tech/20180221 12 useful zypper command examples.md +++ b/translated/tech/20180221 12 useful zypper command examples.md @@ -1,10 +1,11 @@ 12 条实用的 zypper 命令范例 ====== -zypper 是 Suse Linux 系统的包和补丁管理器,你可以根据下面的 12 条附带输出示例的实用范例来学习 zypper 命令的使用。 + +`zypper` 是 Suse Linux 系统的包和补丁管理器,你可以根据下面的 12 条附带输出示例的实用范例来学习 `zypper` 命令的使用。 ![zypper 命令示例][1] -Suse Linux 使用 zypper 进行包管理,其是一个由 [ZYpp 包管理引擎][2]提供技术支持的包管理系统。在此篇文章中我们将分享 12 条附带输出示例的实用 zypper 命令,能帮助你处理日常的系统管理任务。 +Suse Linux 使用 `zypper` 进行包管理,其是一个由 [ZYpp 包管理引擎][2]提供的包管理系统。在此篇文章中我们将分享 12 条附带输出示例的实用 `zypper` 命令,能帮助你处理日常的系统管理任务。 不带参数的 `zypper` 命令将列出所有可用的选项,这比参考详细的 man 手册要容易上手得多。 @@ -18,12 +19,12 @@ root@kerneltalks # zypper --help, -h 帮助 --version, -V 输出版本号 --promptids 输出 zypper 用户提示符列表 - --config, -c 使用制定的配置文件来替代默认的 + --config, -c 使用指定的配置文件来替代默认的 --userdata 在历史和插件中使用的用户自定义事务 id --quiet, -q 忽略正常输出,只打印错误信息 --verbose, -v 增加冗长程度 --color - --no-color 是否启用彩色模式如果 tty 支持 + --no-color 是否启用彩色模式,如果 tty 支持的话 --no-abbrev, -A 表格中的文字不使用缩写 --table-style, -s 表格样式(整型) --non-interactive, -n 不询问任何选项,自动使用默认答案 @@ -43,7 +44,7 @@ root@kerneltalks # zypper --gpg-auto-import-keys 自动信任并导入新仓库的签名密钥 --plus-repo, -p 使用附加仓库 --plus-content 另外使用禁用的仓库来提供特定的关键词 - 尝试 '--plus-content debug' 选项来启用仓库 + 尝试使用 '--plus-content debug' 选项来启用仓库 --disable-repositories 不从仓库中读取元数据 --no-refresh 不刷新仓库 --no-cd 忽略 CD/DVD 中的仓库 @@ -55,11 +56,11 @@ root@kerneltalks # zypper --disable-system-resolvables 不读取已安装包 - 命令: + 命令: help, ? 打印帮助 shell, sh 允许多命令 - 仓库管理: + 仓库管理: repos, lr 列出所有自定义仓库 addrepo, ar 添加一个新仓库 removerepo, rr 移除指定仓库 @@ -68,14 +69,14 @@ root@kerneltalks # zypper refresh, ref 刷新所有仓库 clean 清除本地缓存 - 服务管理: + 服务管理: services, ls 列出所有自定义服务 addservice, as 添加一个新服务 modifyservice, ms 修改指定服务 removeservice, rs 移除指定服务 refresh-services, refs 刷新所有服务 - 软件管理: + 软件管理: install, in 安装包 remove, rm 移除包 verify, ve 确认包依赖的完整性 @@ -83,7 +84,7 @@ root@kerneltalks # zypper install-new-recommends, inr 安装由已安装包建议一并安装的新包 - 更新管理: + 更新管理: update, up 更新已安装包至更新版本 list-updates, lu 列出可用更新 patch 安装必要的补丁 @@ -91,7 +92,7 @@ root@kerneltalks # zypper dist-upgrade, dup 进行发行版更新 patch-check, pchk 检查补丁 - 查询: + 查询: search, se 查找符合匹配模式的包 info, if 展示特定包的完全信息 patch-info 展示特定补丁的完全信息 @@ -103,27 +104,28 @@ root@kerneltalks # zypper products, pd 列出所有可用的产品 what-provides, wp 列出提供特定功能的包 - 包锁定: + 包锁定: addlock, al 添加一个包锁定 removelock, rl 移除一个包锁定 locks, ll 列出当前的包锁定 cleanlocks, cl 移除无用的锁定 - 其他命令: + 其他命令: versioncmp, vcmp 比较两个版本字符串 targetos, tos 打印目标操作系统 ID 字符串 licenses 打印已安装包的证书和 EULAs 报告 download 使用命令行下载指定 rpm 包到本地目录 source-download 下载所有已安装包的源码 rpm 包到本地目录 - 子命令: + 子命令: subcommand 列出可用子命令 输入 'zypper help ' 来获得特定命令的帮助。 ``` -##### 如何使用 zypper 安装包 -`zypper` 通过 `in` 或 `install` 开关来在你的系统上安装包。它的用法与 [yum package installation][3] 相同。你只需要提供包名作为参数,包管理器(此处是 zypper)就会处理所有的依赖并与你指定的包一并安装。 +### 如何使用 zypper 安装包 + +`zypper` 通过 `in` 或 `install` 子命令来在你的系统上安装包。它的用法与 [yum 软件包安装][3] 相同。你只需要提供包名作为参数,包管理器(此处是 `zypper`)就会处理所有的依赖并与你指定的包一并安装。 ``` # zypper install telnet @@ -147,11 +149,11 @@ Checking for file conflicts: ................................................... 以上是我们安装 `telnet` 包时的输出,供你参考。 -推荐阅读 : [在 YUM 和 APT 系统中安装包][3] +推荐阅读:[在 YUM 和 APT 系统中安装包][3] -##### 如何使用 zypper 移除包 +### 如何使用 zypper 移除包 -要在 Suse Linux 中擦除或移除包,使用 `zypper` 命令附带 `remove` 或 `rm` 开关。 +要在 Suse Linux 中擦除或移除包,使用 `zypper` 附带 `remove` 或 `rm` 子命令。 ``` root@kerneltalks # zypper rm telnet @@ -167,13 +169,14 @@ After the operation, 113.3 KiB will be freed. Continue? [y/n/...? shows all options] (y): y (1/1) Removing telnet-1.2-165.63.x86_64 ..........................................................................................................................[done] ``` + 我们在此处移除了先前安装的 telnet 包。 -##### 使用 zypper 检查依赖或者认证已安装包的完整性 +### 使用 zypper 检查依赖或者认证已安装包的完整性 有时可以通过强制忽略依赖关系来安装软件包。`zypper` 使你能够扫描所有已安装的软件包并检查其依赖性。如果缺少任何依赖项,它将提供你安装或重新安装它的机会,从而保持已安装软件包的完整性。 -使用附带 `verify` 或 `ve` 开关的 `zypper` 命令来检查已安装包的完整性。 +使用附带 `verify` 或 `ve` 子命令的 `zypper` 命令来检查已安装包的完整性。 ``` root@kerneltalks # zypper ve @@ -184,9 +187,10 @@ Reading installed packages... Dependencies of all installed packages are satisfied. ``` + 在上面的输出中,你能够看到最后一行说明已安装包的所有依赖都已安装完全,并且无需更多操作。 -##### 如何在 Suse Linux 中使用 zypper 下载包 +### 如何在 Suse Linux 中使用 zypper 下载包 `zypper` 提供了一种方法使得你能够将包下载到本地目录而不去安装它。你可以在其他具有同样配置的系统上使用这个已下载的软件包。包会被下载至 `/var/cache/zypp/packages///` 目录。 @@ -206,13 +210,14 @@ total 52 -rw-r--r-- 1 root root 53025 Feb 21 03:17 telnet-1.2-165.63.x86_64.rpm ``` + 你能看到我们使用 `zypper` 将 telnet 包下载到了本地。 -推荐阅读 : [在 YUM 和 APT 系统中只下载包而不安装][4] +推荐阅读:[在 YUM 和 APT 系统中只下载包而不安装][4] -##### 如何使用 zypper 列出可用包更新 +### 如何使用 zypper 列出可用包更新 -`zypper` 允许你浏览已安装包的所有可用更新,以便你可以提前计划更新活动。使用 `list-updates` 或 `lu` 开关来显示已安装包的所有可用更新。 +`zypper` 允许你浏览已安装包的所有可用更新,以便你可以提前计划更新活动。使用 `list-updates` 或 `lu` 子命令来显示已安装包的所有可用更新。 ``` root@kerneltalks # zypper lu @@ -229,11 +234,12 @@ v | SLE-Module-Containers12-Updates | containerd | 0.2.5+gitr6 v | SLES12-SP3-Updates | crash | 7.1.8-4.3.1 | 7.1.8-4.6.2 | x86_64 v | SLES12-SP3-Updates | rsync | 3.1.0-12.1 | 3.1.0-13.10.1 | x86_64 ``` + 输出特意被格式化以便于阅读。每一列分别代表包所属仓库名称、包名、已安装版本、可用的更新版本和架构。 -##### 在 Suse Linux 中列出和安装补丁 +### 在 Suse Linux 中列出和安装补丁 -使用 `list-patches` 或 `lp` 开关来显示你的 Suse Linux 系统需要被应用的所有可用补丁。 +使用 `list-patches` 或 `lp` 子命令来显示你的 Suse Linux 系统需要被应用的所有可用补丁。 ``` root@kerneltalks # zypper lp @@ -262,7 +268,7 @@ Found 37 applicable patches: ##### 如何使用 zypper 更新包 -要使用 zypper 更新包,使用 `update` 或 `up` 开关后接包名。在上述列出的更新命令中,我们知道在我们的服务器上 `rsync` 包更新可用。让我们现在来更新它吧! +要使用 `zypper` 更新包,使用 `update` 或 `up` 子命令后接包名。在上述列出的更新命令中,我们知道在我们的服务器上 `rsync` 包更新可用。让我们现在来更新它吧! ``` root@kerneltalks # zypper update rsync @@ -284,9 +290,9 @@ Checking for file conflicts: ................................................... (1/1) Installing: rsync-3.1.0-13.10.1.x86_64 .....................................................................................................................[done] ``` -##### 在 Suse Linux 上使用 zypper 查找包 +### 在 Suse Linux 上使用 zypper 查找包 -如果你不确定包的全名也不要担心。你可以使用 zypper 附带 `se` 或 `search` 开关并提供查找字符串来查找包。 +如果你不确定包的全名也不要担心。你可以使用 `zypper` 附带的 `se` 或 `search` 子命令并提供查找字符串来查找包。 ``` root@kerneltalks # zypper se lvm @@ -303,14 +309,15 @@ S | Name | Summary | Type | llvm-devel | Header Files for LLVM | package | lvm2 | Logical Volume Manager Tools | srcpackage i+ | lvm2 | Logical Volume Manager Tools | package - | lvm2-devel | Development files for LVM2 | package - + | lvm2-devel | Development files for LVM2 | package ``` -在上述示例中我们查找了 `lvm` 字符串并得到了如上输出列表。你能在 zypper install/remove/update 命令中使用 `Name` 字段的名字。 -##### 使用 zypper 检查已安装包信息 +在上述示例中我们查找了 `lvm` 字符串并得到了如上输出列表。你能在 `zypper install/remove/update` 命令中使用 `Name` 字段的名字。 + +### 使用 zypper 检查已安装包信息 + +你能够使用 `zypper` 检查已安装包的详细信息。`info` 或 `if` 子命令将列出已安装包的信息。它也可以显示未安装包的详细信息,在该情况下,`Installed` 参数将返回 `No` 值。 -你能够使用 zypper 检查已安装包的详细信息。`info` 或 `if` 开关将列出已安装包的信息。它也可以显示未安装包的详细信息,在该情况下,`Installed` 参数将返回 `No` 值。 ``` root@kerneltalks # zypper info rsync Refreshing service 'SMT-http_smt-ec2_susecloud_net'. @@ -343,9 +350,9 @@ Description : for backups and mirroring and as an improved copy command for everyday use. ``` -##### 使用 zypper 列出仓库 +### 使用 zypper 列出仓库 -使用 zypper 命令附带 `lr` 或 `repos` 开关列出仓库。 +使用 `zypper` 命令附带 `lr` 或 `repos` 子命令列出仓库。 ``` root@kerneltalks # zypper lr @@ -364,7 +371,7 @@ Repository priorities are without effect. All enabled repositories share the sam 此处你需要检查 `enabled` 列来确定哪些仓库是已被启用的而哪些没有。 -##### 在 Suse Linux 中使用 zypper 添加或移除仓库 +### 在 Suse Linux 中使用 zypper 添加或移除仓库 要添加仓库你需要仓库或 .repo 文件的 URI,否则你会遇到如下错误。 @@ -390,16 +397,17 @@ Priority : 99 (default priority) Repository priorities are without effect. All enabled repositories share the same priority. ``` -在 Suse 中使用附带 `addrepo` 或 `ar` 开关的 `zypper` 命令添加仓库,后接 URI 以及你需要提供一个别名。 +在 Suse 中使用附带 `addrepo` 或 `ar` 子命令的 `zypper` 命令添加仓库,后接 URI 以及你需要提供一个别名。 + +要在 Suse 中移除一个仓库,使用附带 `removerepo` 或 `rr` 子命令的 `zypper` 命令。 -要在 Suse 中移除一个仓库,使用附带 `removerepo` 或 `rr` 开关的 `zypper` 命令。 ``` root@kerneltalks # zypper removerepo nVidia-Driver-SLE12-SP3 Removing repository 'nVidia-Driver-SLE12-SP3' ....................................................................................................................[done] Repository 'nVidia-Driver-SLE12-SP3' has been removed. ``` -##### 清除 zypper 本地缓存 +### 清除 zypper 本地缓存 使用 `zypper clean` 命令清除 zypper 本地缓存。 @@ -414,7 +422,7 @@ via: https://kerneltalks.com/commands/12-useful-zypper-command-examples/ 作者:[KernelTalks][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 75a1fa3916397b14659ad58463dff7180b544507 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 13:29:57 +0800 Subject: [PATCH 0063/4278] PUB:20180221 12 useful zypper command examples.md @cycoe https://linux.cn/article-10338-1.html --- .../20180221 12 useful zypper command examples.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180221 12 useful zypper command examples.md (100%) diff --git a/translated/tech/20180221 12 useful zypper command examples.md b/published/20180221 12 useful zypper command examples.md similarity index 100% rename from translated/tech/20180221 12 useful zypper command examples.md rename to published/20180221 12 useful zypper command examples.md From 553d2fe37ed1e0912c83689382de3185187bbc8b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 13:31:01 +0800 Subject: [PATCH 0064/4278] PRF:20180221 12 useful zypper command examples.md --- published/20180221 12 useful zypper command examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180221 12 useful zypper command examples.md b/published/20180221 12 useful zypper command examples.md index 356c55becc..94397cd964 100644 --- a/published/20180221 12 useful zypper command examples.md +++ b/published/20180221 12 useful zypper command examples.md @@ -266,7 +266,7 @@ Found 37 applicable patches: 你可以通过发出 `zypper patch` 命令安装所有需要的补丁。 -##### 如何使用 zypper 更新包 +### 如何使用 zypper 更新包 要使用 `zypper` 更新包,使用 `update` 或 `up` 子命令后接包名。在上述列出的更新命令中,我们知道在我们的服务器上 `rsync` 包更新可用。让我们现在来更新它吧! From 33aa734db5ee947793bf10c3df19115dc3d4dfeb Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 12 Dec 2018 13:38:58 +0800 Subject: [PATCH 0065/4278] Translating 7 command-line tools for writers. --- ...119 7 command-line tools for writers - Opensource.com.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md index 8feec80f41..ead46909ff 100644 --- a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md +++ b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md @@ -33,11 +33,11 @@ ### 其他工具 -Sometimes you just can't find the right synonym for a word. But you don't need to grab a "dead tree" thesaurus or go to a dedicated website to perfect your word choice. Just run [Aiksaurus][16] against the word you want to replace, and it does the work for you. This utility's main drawback, though, is that it supports English only. +有时候你找不到一个单词的恰当的同义词。但你不需要去呆板的词库中抓取或者去专门的网站完善你的单词完整。仅仅需要对你想要替换的单词运行[Aiksaurus][16],然后它就会为你完成这个工作。但是,这个程序最大的缺点是它只支持英语。 -Even writers with few (if any) technical skills are embracing [Markdown][17] to quickly and easily format their work. Sometimes, though, you need to convert files formatted with Markdown to something else. That's where [Pandoc][18] comes in. You can use it to convert your documents to HTML, Word, LibreOffice Writer, LaTeX, EPUB, and other formats. You can even use Pandoc to produce books and [research papers][19]. +即使是只会很少(甚至只有一项)技术技能的写作者都能接受 [Markdown][17] 来快速而简单地格式化他们的作品。但是,有时候你也需要将使用Markdown格式的文件转换成其他格式。这就是[Pandoc][18]的用武之地。你可以用它来将你的文档转换成 HTML, Word, LibreOffice Writer, LaTeX, EPUB以及其他格式。你甚至可以用Pandoc来生成书籍和[研究论文][19]。 -Do you have a favorite command-line tool for writing? Share it with the Opensource.com community by leaving a comment. +你有一个最喜欢的命令行写作工具吗?在Opensource.com社区发表评论分享它。 -------------------------------------------------------------------------------- From 637b4c71b5870042ac3df0104aea6617f3c25e6c Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 12 Dec 2018 14:29:15 +0800 Subject: [PATCH 0066/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Open=20source?= =?UTF-8?q?=20DIY=20ethics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talk/20181209 Open source DIY ethics.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/talk/20181209 Open source DIY ethics.md diff --git a/sources/talk/20181209 Open source DIY ethics.md b/sources/talk/20181209 Open source DIY ethics.md new file mode 100644 index 0000000000..2c249d33af --- /dev/null +++ b/sources/talk/20181209 Open source DIY ethics.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source DIY ethics) +[#]: via: (https://arp242.net/weblog/diy.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +Open source DIY ethics +====== + +I moved to New Zealand last week, and as a proper Dutch person one of the first things I did after arriving was getting a bicycle. + +I was recommended [a great place][1] where they collect old bikes and provide people with the parts and tools to fix up the bikes. Want a bike? Choose one, fix it, and it’s yours. There are helpful and knowledgable volunteers who will gladly help you and explain how things work, but in the end you’ll have to fix your own bike; they’re not going to do it for you. + +I like this DIY attitude; I built my own fixie (which I unfortunately couldn’t bring) years ago and had been maintaining it myself ever since, but there are many different aspects I never touched on (different brake systems, gears, etc.) and fixing my bike with some help and explanation was a useful experience which taught me a thing or two that I’ll be sure to use in the future. + +My attitude to open source projects tends to be similar: I’ll gladly assist you or explain things, but you will have to do the work. This is especially true when it comes to feature requests or very specific scenarios. + +Open source software is fundamentally a [DIY ethic][2] for many – though not all – people who participate in it. It certainly is for me. I just fix stuff I want myself. Since I take some amount of pride in my work and want things to work well for others I’ll also gladly fix most bugs that are reported, but sometimes people will post an enhancement or feature request and just expect me to implement it. It’s sometimes even combined with a “but project X does it!”-comment. Well, feck off and use project X then (I don’t actually say this, just think it). + +I’ve seen more than a few people get frustrated by this attitude especially — though hardly exclusively — in the OpenBSD and suckless communities ([recent example that prompted this post][3]), partly because it’s not infrequently communicated in a somewhat unhelpful fashion (the OpenBSD saying is “shut up and hack”), but also because some people seem to misunderstand what it means to be a maintainer of an open source project. Open source software isn’t a service I provide to the world; it’s something I DIY’d myself and make available to the world because why not? + +Some open source software is supported by companies. Only about [14% of the contributions to the Linux kernel are not affiliated with a company][4]. I don’t think this matters: these are companies who are DIY-ing as well. + +Are there people who contribute to open source for other reasons? Sure. Some do because they really believe in [Free Software][5], or because they like programming as a hobby. But those are not the majority. + +Not all contributions that aren’t code are useless. Sometimes someone will have a great idea for an enhancement or feature that I hadn’t thought of myself and this can be a very valuable contribution. But those types of constructive contributions are usually easy to recognize: they consist of more than just a single paragraph, are respectful, show a clear understanding of what the project is supposed to do, if they don’t understand a certain aspect they’ll ask instead of bombastically claiming that it’s “broken”, and perhaps most importantly, they show a willingness to constructively contribute, rather than just trying to tell you how to run your project. + +This attitude isn’t limited to open source; to quote Neil Gaiman when talking about A Song of Ice and Fire fans demanding George R.R. Martin work harder on the next instalment of the series: “[George R.R. Martin is not your bitch][6]”. + +I can’t help George with his next book, but I can help with software projects, which is really neat. Not everyone is a computer programmer, but the vast majority of projects I’ve worked on are used exclusively by programmers. + +In the two months that it took me to finish this post (cleaning up drafts always takes forever) there have been a number of incidents in various communities that touched upon a mismatch in expectations between open source authors/maintainers and the users. “It’s not fun anymore, you get nothing from maintaining a popular package”, to quote one maintainer, or “I’m frustrated because I can’t handle the volume of emails” to quote another. + +The situation would be vastly improved if more people start seeing and treating open source more like the DIY that it is and assume responsibility for that bug you’ve encountered or enhancement you want, rather than offloading all responsibility to the maintainer. This won’t fix everything, but it’s a good start. Note that plenty of people — including myself — already do this. + +Both authors and users will benefit; authors will be frustrated less with “entitled” users, and users will be frustrated less by “rude” authors, and in the end the software will work better as users will be more willing to spend some time fixing stuff themselves, rather than just expecting other people to do it for them. + + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/diy.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://www.facebook.com/TheCrookedSpoke +[2]: https://en.wikipedia.org/wiki/DIY_ethic +[3]: https://www.reddit.com/r/suckless/comments/9mhwg8/why_does_sts_latency_suck_so_bad/e7fu9sj/ +[4]: https://www.linux.com/publications/linux-kernel-development-how-fast-it-going-who-doing-it-what-they-are-doing-and-who-0 +[5]: https://www.gnu.org/philosophy/free-sw.html +[6]: http://journal.neilgaiman.com/2009/05/entitlement-issues.html +[7]: mailto:martin@arp242.net +[8]: https://github.com/Carpetsmoker/arp242.net/issues/new From 031716bec70f3dac5ae989a7404c54c8f30ddab9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 12 Dec 2018 14:33:55 +0800 Subject: [PATCH 0067/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Winterize=20you?= =?UTF-8?q?r=20Bash=20prompt=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...211 Winterize your Bash prompt in Linux.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20181211 Winterize your Bash prompt in Linux.md diff --git a/sources/tech/20181211 Winterize your Bash prompt in Linux.md b/sources/tech/20181211 Winterize your Bash prompt in Linux.md new file mode 100644 index 0000000000..bae5837a2c --- /dev/null +++ b/sources/tech/20181211 Winterize your Bash prompt in Linux.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Winterize your Bash prompt in Linux) +[#]: via: (https://opensource.com/article/18/12/linux-toy-bash-prompt) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Winterize your Bash prompt in Linux +====== +Your Linux terminal probably supports Unicode, so why not take advantage of that and add a seasonal touch to your prompt? +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-bash-prompt.png?itok=HK_kVn37) + +Hello once again for another installment of the 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? Really, we're keeping it pretty open-ended: It's anything that's a fun diversion at the terminal, and we're giving bonus points for anything holiday-themed. + +Maybe you've seen some of these before, maybe you haven't. Either way, we hope you have fun. + +Today's toy is super-simple: It's your Bash prompt. Your Bash prompt? Yep! We've got a few more weeks of the holiday season left to stare at it, and even more weeks of winter here in the northern hemisphere, so why not have some fun with it. + +Your Bash prompt currently might be a simple dollar sign ( **$** ), or more likely, it's something a little longer. If you're not sure what makes up your Bash prompt right now, you can find it in an environment variable called $PS1. To see it, type: + +``` +echo $PS1 +``` + +For me, this returns: + +``` +[\u@\h \W]\$ +``` + +The **\u** , **\h** , and **\W** are special characters for username, hostname, and working directory. There are others you can use as well; for help building out your Bash prompt, you can use [EzPrompt][1], an online generator of PS1 configurations that includes lots of options including date and time, Git status, and more. + +You may have other variables that make up your Bash prompt set as well; **$PS2** for me contains the closing brace of my command prompt. See [this article][2] for more information. + +To change your prompt, simply set the environment variable in your terminal like this: + +``` +$ PS1='\u is cold: ' +jehb is cold: +``` + +To set it permanently, add the same code to your **/etc/bashrc **using your favorite text editor. + +So what does this have to do with winterization? Well, chances are on a modern machine, your terminal support Unicode, so you're not limited to the standard ASCII character set. You can use any emoji that's a part of the Unicode specification, including a snowflake ❄, a snowman ☃, or a pair of skis 🎿. You've got plenty of wintery options to choose from. + +``` +🎄 Christmas Tree +🧥 Coat +🦌 Deer +🧤 Gloves +🤶 Mrs. Claus +🎅 Santa Claus +🧣 Scarf +🎿 Skis +🏂 Snowboarder +❄ Snowflake +☃ Snowman +⛄ Snowman Without Snow +🎁 Wrapped Gift +``` + +Pick your favorite, and enjoy some winter cheer. Fun fact: modern filesystems also support Unicode characters in their filenames, meaning you can technically name your next program **"❄❄❄❄❄.py"**. That said, please don't. + +Do you have a favorite command-line toy that you think I ought to include? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Snake your way across your Linux terminal][3], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-bash-prompt + +作者:[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]: http://ezprompt.net/ +[2]: https://access.redhat.com/solutions/505983 +[3]: https://opensource.com/article/18/12/linux-toy-snake From af31f90e72396bd52ca3e62f0ad16b1f31a96fb5 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 12 Dec 2018 14:53:28 +0800 Subject: [PATCH 0068/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Inst?= =?UTF-8?q?all=20Putty=20on=20Ubuntu=20and=20Other=20Linux=20Distributions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...on Ubuntu and Other Linux Distributions.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md b/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..1b92a73645 --- /dev/null +++ b/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Putty on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/putty-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Install Putty on Ubuntu and Other Linux Distributions +====== + +If I am not wrong, [Putty][1] is perhaps the most popular SSH client for Windows. + +In IT companies, the development environment is usually on a remote Linux system while the developers use Windows as their local system. Putty is used for connecting to the remote Linux system from the Windows machine. + +Putty is not limited to Windows only. You can also use this open source software on Linux and macOS. + +But wait! Why would you use a separate SSH client on Linux when you already have the ‘real’ Linux terminal with you? There are several reasons why you would want to use Putty on Linux. + + * You have used Putty for so long on Windows that you are more comfortable with it. + * You find it difficult to manually edit SSH config file to save the various SSH sessions. You prefer Putty’s graphical way of storing SSH connection. + * You want to debug by connecting to raw sockets and serial ports. + + + +Whatever may be the reason, if you want to use Putty on Ubuntu or any other Linux, you can certainly do so. Let me show you how to do that. + +### Installing Putty on Ubuntu Linux + +![Installing Putty on Linux][2] + +The good news for the Ubuntu users is that Putty is available in the universe repository of Ubuntu. + +To install Putty on Ubuntu, you should first make sure that the universe repository is enabled. + +``` +sudo add-apt-repository universe +``` + +Once you have the universe repository enabled, you should update Ubuntu with this command: + +``` +sudo apt update +``` + +After this, you can install Putty with this command: + +``` +sudo apt install putty +``` + +Once installed, you can start Putty by finding it in the menu. + +As you can see in the screenshot below, the Linux version of Putty looks the same as the Windows version. That’s a relief because you won’t have to fiddle around trying to find your way through a new and changed settings. + +![Putty in Linux][3] + +When you enter the remote system’s [hostname][4] or IP address and connect to it, Putty will utilize the already saved SSH keys in your home directory. + +![Using Putty in Ubuntu Linux][5] + +### Installing Putty on other Linux distributions + +[Putty is available for Debian][6] so you just need to use apt-get or aptitude for installing it. + +``` +sudo apt-get install putty +``` + +Putty is also available for Fedora/Red Hat and can be installed using the default package manager. + +``` +sudo dnf install putty +``` + +You can also easily install Putty in Arch Linux based distributions. + +``` +sudo pacman -S putty +``` + +Remember that Putty is an open source software. You can also install it via source code if you really want to. You can get the source code of Putty from the link below. + +[Download Putty Source Code][8] + +I would always prefer the native Linux terminal over an SSH client like Putty. I feel more at home with the GNOME terminal or [Terminator][7]. However, it’s up to an individual’s choice to use the default terminal or Putty in Linux + +What do you use for managing multiple SSH connections on Linux? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/putty-linux/ + +作者:[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.putty.org/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/Putty-linux.png?resize=800%2C450&ssl=1 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/putty-interface-ubuntu.jpeg?resize=800%2C503&ssl=1 +[4]: https://itsfoss.com/change-hostname-ubuntu/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/putty-interface-ubuntu-1.jpeg?resize=800%2C430&ssl=1 +[6]: https://packages.debian.org/jessie/putty +[7]: https://launchpad.net/terminator +[8]: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html From cbd0d1640a89fcf704439c480f0fdd65feece0f4 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 12 Dec 2018 15:02:08 +0800 Subject: [PATCH 0069/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Benc?= =?UTF-8?q?hmark=20Linux=20Commands=20And=20Programs=20From=20Commandline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Commands And Programs From Commandline.md | 265 ++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 sources/tech/20181211 How To Benchmark Linux Commands And Programs From Commandline.md diff --git a/sources/tech/20181211 How To Benchmark Linux Commands And Programs From Commandline.md b/sources/tech/20181211 How To Benchmark Linux Commands And Programs From Commandline.md new file mode 100644 index 0000000000..3962e361f3 --- /dev/null +++ b/sources/tech/20181211 How To Benchmark Linux Commands And Programs From Commandline.md @@ -0,0 +1,265 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Benchmark Linux Commands And Programs From Commandline) +[#]: via: (https://www.ostechnix.com/how-to-benchmark-linux-commands-and-programs-from-commandline/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Benchmark Linux Commands And Programs From Commandline +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/benchmark-720x340.png) + +A while ago, I have written a guide about the [**alternatives to ‘top’, the command line utility**][1]. Some of the users asked me which one among those tools is best and on what basis (like features, contributors, years active, page requests etc.) I compared those tools. They also asked me to share the bench-marking results If I have any. Unfortunately, I didn’t even know how to benchmark programs at that time. While searching for some simple and easy to use bench-marking tools to compare the Linux programs, I stumbled upon two utilities named **‘Bench’** and **‘Hyperfine’**. These are simple and easy-to-use command line tools to benchmark Linux commands and programs on Unix-like systems. + +### 1\. Bench Tool + +The **‘Bench’** utility benchmarks one or more given commands/programs using **Haskell’s criterion** library and displays the output statistics in an easy-to-understandable format. This tool can be helpful where you need to compare similar programs based on the bench-marking result. We can also export the results to HTML format or CSV or templated output. + +#### Installing Bench Utility + +The bench utility can be installed in three methods. + +**1\. Using Linuxbrew** + +We can install Bench utility using Linuxbrew package manager. If you haven’t installed Linuxbrew yet, refer the following link. + +After installing Linuxbrew, run the following command to install Bench: + +``` +$ brew install bench +``` + +**2\. Using Haskell’s stack tool** + +First, install Haskell as described in the following link. + +And then, run the following commands to install Bench. + +``` +$ stack setup + +$ stack install bench +``` + +The ‘stack’ will install bench to **~/.local/bin** or something similar. Make sure that the installation directory is on your executable search path before using bench tool. You will be reminded to do this even if you forgot. + +**3\. Using Nix package manager** + +Another way to install Bench is using **Nix** package manager. Install Nix as shown in the below link. + +After installing Nix, install Bench tool using command: + +``` +$ nix-env -i bench +``` + +#### Benchmark Linux Commands And Programs Using Bench + +It is time to start benchmarking the programs. + +For instance, let me show you the benchmark result of ‘ls -al’ command. + +``` +$ bench 'ls -al' +``` + +**Sample output:** + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Benchmark-commands-1.png) + +You must quote the commands when you use flags/options with them. + +Similarly, you can benchmark any programs installed in your system. The following commands shows the benchmarking result of ‘htop’ and ‘ptop’ programs. + +``` +$ bench htop + +$ bench ptop +``` +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Benchmark-commands-2-1.png) +Bench tool can benchmark multiple programs at once as well. Here is the benchmarking result of ls, htop, ptop programs. + +``` +$ bench ls htop ptop +``` + +Sample output: +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Benchmark-commands-3.png) + +We can also export the benchmark result to a HTML like below. + +``` +$ bench htop --output example.html +``` + +To export the result to CSV, just run: + +``` +$ bench htop --csv FILE +``` + +View help section: + +``` +$ bench --help +``` + +### **2. Hyperfine Benchmark Tool + +** + +**Hyperfine** is yet another command line benchmarking tool inspired by the ‘Bench’ tool which we just discussed above. It is free, open source, cross-platform benchmarking program and written in **Rust** programming language. It has few additional features compared to the Bench tool as listed below. + + * Statistical analysis across multiple runs. + * Support for arbitrary shell commands. + * Constant feedback about the benchmark progress and current estimates. + * Perform warmup runs before the actual benchmark. + * Cache-clearing commands can be set up before each timing run. + * Statistical outlier detection. + * Export benchmark results to various formats, such as CSV, JSON, Markdown. + * Parameterized benchmarks. + + + +#### Installing Hyperfine + +We can install Hyperfine using any one of the following methods. + +**1\. Using Linuxbrew** + +``` +$ brew install hyperfine +``` + +**2\. Using Cargo** + +Make sure you have installed Rust as described in the following link. + +After installing Rust, run the following command to install Hyperfine via Cargo: + +``` +$ cargo install hyperfine +``` + +**3\. Using AUR helper programs** + +Hyperfine is available in [**AUR**][2]. So, you can install it on Arch-based systems using any helper programs, such as [**YaY**][3], like below. + +``` +$ yay -S hyperfine +``` + +**4\. Download and install the binaries** + +Hyperfine is available in binaries for Debian-based systems. Download the latest .deb binary file from the [**releases page**][4] and install it using ‘dpkg’ package manager. As of writing this guide, the latest version was **1.4.0**. + +``` +$ wget https://github.com/sharkdp/hyperfine/releases/download/v1.4.0/hyperfine_1.4.0_amd64.deb + +$ sudo dpkg -i hyperfine_1.4.0_amd64.deb + +$ sudo apt install -f +``` + +#### Benchmark Linux Commands And Programs Using Hyperfine + +To run a benchmark using Hyperfine, simply run it along with the program/command as shown below. + +``` +$ hyperfine 'ls -al' +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/hyperfine-1.png) + +Benchmark multiple commands/programs: + +``` +$ hyperfine htop ptop +``` + +Sample output: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/hyperfine-2.png) + +As you can see at the end of the output, Hyperfine mentiones – **‘htop ran 1.96 times faster than ptop’** , so we can immediately conclude htop performs better than Ptop. This will help you to quickly find which program performs better when benchmarking multiple programs. We don’t get this detailed output in Bench utility though. + +Hyperfine will automatically determine the number of runs to perform for each command. By default, it will perform at least **10 benchmarking runs**. If you want to set the **minimum number of runs** (E.g 5 runs), use the `-m` **/`--min-runs`** option like below: + +``` +$ hyperfine --min-runs 5 htop ptop +``` + +Or, + +``` +$ hyperfine -m 5 htop ptop +``` + +Similarly, to perform **maximum number of runs** for each command, the command would be: + +``` +$ hyperfine --max-runs 5 htop ptop +``` + +Or, + +``` +$ hyperfine -M 5 htop ptop +``` + +We can even perform **exact number of runs** for each command using the following command: + +``` +$ hyperfine -r 5 htop ptop +``` + +As you may know, if the program execution time is limited by disk I/O, the benchmarking results can be heavily influenced by disk caches and whether they are cold or warm. Luckily, Hyperfine has the options to perform a certain number of program executions before performing the actual benchmark. + +To perform NUM warmup runs (E.g 3) before the actual benchmark, use the **`-w`/**`--warmup` option like below: + +``` +$ hyperfine --warmup 3 htop +``` + +Just like Bench utility, Hyperfine also allows us to export the benchmark results to a given file. We can export the results to CSV, JSON, and Markdown formats. + +For instance, to export the results in Markdown format, use the following command: + +``` +$ hyperfine htop ptop --export-markdown +``` + +For more options and usage details, refer the help secion: + +``` +$ hyperfine --help +``` + +And, that’s all for now. If you ever be in a situation where you need to benchmark similar and alternative programs, these tools might help to compare how they performs and share the details with your peers and colleagues. + +More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-benchmark-linux-commands-and-programs-from-commandline/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/some-alternatives-to-top-command-line-utility-you-might-want-to-know/ +[2]: https://aur.archlinux.org/packages/hyperfine +[3]: https://www.ostechnix.com/yay-found-yet-another-reliable-aur-helper/ +[4]: https://github.com/sharkdp/hyperfine/releases From 86a7efd9b6c3c9bcdb86f8612d5bbc35eb3c6d13 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 16:41:41 +0800 Subject: [PATCH 0070/4278] PUB:20181112 The Source History of Cat.md @name1e5s https://linux.cn/article-10339-1.html --- .../talk => published}/20181112 The Source History of Cat.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20181112 The Source History of Cat.md (100%) diff --git a/translated/talk/20181112 The Source History of Cat.md b/published/20181112 The Source History of Cat.md similarity index 100% rename from translated/talk/20181112 The Source History of Cat.md rename to published/20181112 The Source History of Cat.md From 7b4f45a854945e41a86ad4080fd8d5382c0c8a37 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 12 Dec 2018 17:39:10 +0800 Subject: [PATCH 0071/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20Ways=20To?= =?UTF-8?q?=20Check=20Laptop=20Battery=20Status=20And=20Level=20From=20Lin?= =?UTF-8?q?ux=20Terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ry Status And Level From Linux Terminal.md | 257 ++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md diff --git a/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md b/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md new file mode 100644 index 0000000000..631efa91f9 --- /dev/null +++ b/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md @@ -0,0 +1,257 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Ways To Check Laptop Battery Status And Level From Linux Terminal) +[#]: via: (https://www.2daygeek.com/check-laptop-battery-status-and-charging-state-in-linux-terminal/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +5 Ways To Check Laptop Battery Status And Level From Linux Terminal +====== + +We can easily check the battery status through GUI such as current battery percentage, whether it’s charging or not charging and how long it will be usable without charging, but we can’t able to check the battery health and other related information. + +In this scenario what will be the solutions. + +Yes, we have few utilities available for this in Linux and it can be achieved through command line. + +We are going to discuss about this topic today through this article and i will try to cover possible information i can. + +Checking your battery health monthly once is something good. It will help you to identify whether we are facing any battery or charge related issues. + +Also, we can see battery model name, power source, vendor and battery technology, etc,. + +Power management is a feature that turns off the power or switches system’s components to a low-power state when inactive. + +### Following Utilities are available in Linux to Check Battery Status. + + * `upower`: upower is a command line tool which provides an interface to enumerate power sources on the system. + * `acpi`: acpi Shows information from the /proc or the /sys filesystem, such as battery status or thermal information. + * `batstat`: batstat is a command line tool to print battery status for linux. + * `tlp`: TLP brings you the benefits of advanced power management for Linux without changing any configuration. + * `class file`: The sysfs filesystem is a pseudo-filesystem which provides an interface to kernel data structures. + + + +### How to Check Laptop Battery Status Using upower Command? + +[upower][1] is a command line tool that provides an interface to enumerate power sources on the system. It control the latency of different operations on your computer, which enables you to save significant amounts of power. + +Just run the following command to get the battery and it’s related information on Linux. + +``` +$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 + native-path: BAT0 + vendor: SMP + model: L14M4P23 + serial: 756 + power supply: yes + updated: Monday 03 December 2018 07:56:18 PM IST (95 seconds ago) + has history: yes + has statistics: yes + battery + present: yes + rechargeable: yes + state: discharging + warning-level: none + energy: 28.23 Wh + energy-empty: 0 Wh + energy-full: 52.26 Wh + energy-full-design: 60 Wh + energy-rate: 10.714 W + voltage: 14.819 V + time to empty: 2.6 hours + percentage: 54% + capacity: 87.1% + technology: lithium-ion + icon-name: 'battery-good-symbolic' + History (charge): + 1543847178 54.000 discharging + History (rate): + 1543847178 10.714 discharging +``` + +To check the specific information about battery, use the following format. + +``` +$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty" + state: discharging + time to empty: 2.1 hours + percentage: 43% +``` + +It’s same as above, but it’s taken after power cable plugged in, that’s why the state showing charging. + +``` +$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty" + state: charging + percentage: 41% +``` + +### How to Check Laptop Battery Status Using TLP Command? + +TLP is a free opensource feature-rich command line tool which optimize laptop battery without making any configuration change. + +TLP brings you the benefits of advanced power management for Linux without the need to understand every technical detail. TLP comes with a default configuration already optimized for battery life, so you may just install and forget it. Nevertheless TLP is highly customizable to fulfil your specific requirements. + +TLP package is available in most of the Linux distribution official repository such as Arch, Debian, Fedora, Gentoo, openSUSE, etc. Use your distribution Package Manager to install the TLP utility. + +Just run the following command to get the battery and it’s related information on Linux. + +``` +$ sudo tlp-stat -b +--- TLP 1.1 -------------------------------------------- + ++++ Battery Status +/sys/class/power_supply/BAT0/manufacturer = SMP +/sys/class/power_supply/BAT0/model_name = L14M4P23 +/sys/class/power_supply/BAT0/cycle_count = (not supported) +/sys/class/power_supply/BAT0/energy_full_design = 60000 [mWh] +/sys/class/power_supply/BAT0/energy_full = 52260 [mWh] +/sys/class/power_supply/BAT0/energy_now = 21950 [mWh] +/sys/class/power_supply/BAT0/power_now = 10923 [mW] +/sys/class/power_supply/BAT0/status = Discharging + +Charge = 42.0 [%] +Capacity = 87.1 [%] +``` + +To see other information as well. + +``` +$ sudo tlp-stat -s +--- TLP 1.1 -------------------------------------------- + ++++ System Info +System = LENOVO Lenovo ideapad Y700-15ISK 80NV +BIOS = CDCN35WW +Release = "Manjaro Linux" +Kernel = 4.19.6-1-MANJARO #1 SMP PREEMPT Sat Dec 1 12:21:26 UTC 2018 x86_64 +/proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-4.19-x86_64 root=UUID=69d9dd18-36be-4631-9ebb-78f05fe3217f rw quiet resume=UUID=a2092b92-af29-4760-8e68-7a201922573b +Init system = systemd +Boot mode = BIOS (CSM, Legacy) + ++++ TLP Status +State = enabled +Last run = 07:16:12 IST, 4362 sec(s) ago +Mode = battery +Power source = battery +``` + +### How to Check Laptop Battery Status Using ACPI Command? + +ACPI stands for Advanced Configuration and Power Interface modules are kernel modules for different ACPI parts. They enable special ACPI functions or add information to /proc or /sys. These information can be parsed by acpid for events or other monitoring applications. + +``` +$ acpi +Battery 0: Charging, 43%, 01:05:11 until charged +``` + +To see battery capacity. + +``` +$ acpi -i +Battery 0: Charging, 43%, 01:05:07 until charged +Battery 0: design capacity 3817 mAh, last full capacity 3324 mAh = 87% +``` + +To see more details about battery and related information. + +``` +$ acpi -V +Battery 0: Charging, 43%, 01:05:07 until charged +Battery 0: design capacity 3815 mAh, last full capacity 3323 mAh = 87% +Adapter 0: on-line +Cooling 0: Processor 0 of 10 +Cooling 1: Processor 0 of 10 +Cooling 2: Processor 0 of 10 +Cooling 3: iwlwifi 0 of 19 +Cooling 4: Processor 0 of 10 +Cooling 5: iwlwifi no state information available +Cooling 6: Processor 0 of 10 +Cooling 7: Processor 0 of 10 +Cooling 8: Processor 0 of 10 +Cooling 9: intel_powerclamp no state information available +Cooling 10: x86_pkg_temp no state information available +Cooling 11: Processor 0 of 10 +``` + +### How to Check Laptop Battery Status Using Batstat Command? + +batstat is a command line tool to print battery status in linux terminal. + +``` +Status: Charging +Max energy: 50.00 Wh +Energy left: 24.50 Wh +Power Consumption: 26.40 W +Percentage left: 49.00% +Average power Consumption: 0.00 W +Time elapsed: 0: 0:12 since 49.00% += Time ======== Percent ============================================ + 0: 0: 0 49.00% +``` + +### How to Check Laptop Battery Status Using sysfs filesystem? + +The sysfs filesystem is a pseudo-filesystem which provides an interface to kernel data structures. The files under sysfs provide information about devices, kernel modules, filesystems, and other kernel components. + +The sysfs filesystem is commonly mounted at /sys. Typically, it is mounted automatically by the system, but it can also be mounted manually using a command such as `mount -t sysfs sysfs /sys` + +Many of the files in the sysfs filesystem are read-only, but some files are writable, allowing kernel variables to be changed. To avoid redundancy, symbolic links are heavily used to connect entries across the filesystem tree. + +``` +$ cat /sys/class/power_supply/BAT0/* +0 +51 +Normal +0 +cat: /sys/class/power_supply/BAT0/device: Is a directory +52260000 +60000000 +26660000 +SMP +L14M4P23 +cat: /sys/class/power_supply/BAT0/power: Is a directory +27656000 +1 + 756 +Charging +cat: /sys/class/power_supply/BAT0/subsystem: Is a directory +Li-ion +Battery +POWER_SUPPLY_NAME=BAT0 +POWER_SUPPLY_STATUS=Charging +POWER_SUPPLY_PRESENT=1 +POWER_SUPPLY_TECHNOLOGY=Li-ion +POWER_SUPPLY_CYCLE_COUNT=0 +POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000 +POWER_SUPPLY_VOLTAGE_NOW=15840000 +POWER_SUPPLY_POWER_NOW=27656000 +POWER_SUPPLY_ENERGY_FULL_DESIGN=60000000 +POWER_SUPPLY_ENERGY_FULL=52260000 +POWER_SUPPLY_ENERGY_NOW=26660000 +POWER_SUPPLY_CAPACITY=51 +POWER_SUPPLY_CAPACITY_LEVEL=Normal +POWER_SUPPLY_MODEL_NAME=L14M4P23 +POWER_SUPPLY_MANUFACTURER=SMP +POWER_SUPPLY_SERIAL_NUMBER= 756 +14800000 +15840000 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/check-laptop-battery-status-and-charging-state-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://upower.freedesktop.org/ From a18c3bd5362477bfd419a04a3fb46e2f04054b0d Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 12 Dec 2018 20:02:01 +0800 Subject: [PATCH 0072/4278] =?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/20180710 Users, Groups, and Other Linux Beasts.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180710 Users, Groups, and Other Linux Beasts.md b/sources/tech/20180710 Users, Groups, and Other Linux Beasts.md index 6083111a32..ad5be702d8 100644 --- a/sources/tech/20180710 Users, Groups, and Other Linux Beasts.md +++ b/sources/tech/20180710 Users, Groups, and Other Linux Beasts.md @@ -1,3 +1,5 @@ +Translating by MjSeven + Users, Groups, and Other Linux Beasts ====== From 17b9c0017c82f2ef1fad76789761b8574d328501 Mon Sep 17 00:00:00 2001 From: jlztan Date: Wed, 12 Dec 2018 20:50:13 +0800 Subject: [PATCH 0073/4278] Delete 20181121 How to swap Ctrl and Caps Lock keys in Linux.md --- ...o swap Ctrl and Caps Lock keys in Linux.md | 113 ------------------ 1 file changed, 113 deletions(-) delete mode 100644 sources/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md diff --git a/sources/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md b/sources/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md deleted file mode 100644 index c9f24938ff..0000000000 --- a/sources/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md +++ /dev/null @@ -1,113 +0,0 @@ -Translating by jlztan - -How to swap Ctrl and Caps Lock keys in Linux -====== -Linux desktop environments make it easy to set up your keyboard as you want it. Here's how. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/keyboard_numbers_letters_type_game.jpg?itok=fLlWGw1K) - -For many people who've been computer users for (let's just say) "quite some time now," the Ctrl and Caps Lock keys have been in the wrong place since shortly after the first PC keyboards rolled off the production line. For me, the correct positioning appears in this image of a vintage 1995 Sun Workstation keyboard. (Forgive me for the blurriness of the image; it was taken with a Minox spy camera in low light.) - -If you're interested, you can read about the [history of the Ctrl key location][1]. I'm not going to discuss the various rationales for placing the Ctrl key next to the "a" key versus below the Shift key; I'm not going to comment on the overall uselessness of the Caps Lock key (whoops); and I'm not going to argue with those who advocate using the heel of the hand to activate the Ctrl key, even though it's impossible to do on some laptop keyboards where the keys are inset below the level of the wrist rest (whoops). - -Rather, I'm going to assume I'm not the only one who prefers the Ctrl key next to the "a" and describe how to use the wonderful flexibility that comes with Linux to swap the Ctrl and Caps Lock keys on various desktop environments. Note that this kind of advice seems to have a limited shelf life, as tools for tweaking desktop settings change fairly often. But I hope this offers a good place for you to start. - -### With GNOME 3 - -[GNOME 3][2] desktop environment users can use the [Tweaks][3] tool to swap their Caps Lock and Ctrl keys, as you can see below. -![](https://opensource.com/sites/default/files/uploads/tweaks-tool.png) -Here's how to do it: - - 1. Install the Tweaks tool from your distribution's repositories. - 2. Start the Tweaks application. - 3. Select "Keyboard & Mouse" from the left-hand menu. - 4. Click "Additional Layout Options". - 5. Click "Ctrl position" on the window that opens and choose "Swap Ctrl and Caps Lock." - - - -That's it! By the way, you can do lots of cool stuff with the Tweaks tool. For example, I set my right Ctrl key to be a Compose key, which allows me to type all sorts of characters with keyboard shortcuts—such as ç, é, ô, and ñ and with the keystrokes Compose+c+Comma; Compose+e+Right quote; Compose+o+Circumflex; and Compose+n+Tilde. - -### With KDE - -I don't use [KDE][4], but item 5 in this article about [KDE tweaks that will change your life][5] by my colleague Seth Kenlon will show you how to remap your keys. - -### With Xfce - -As far as I can tell, the [Xfce][6] desktop environment doesn't have a handy tool for managing these kinds of settings. However, the **ctrl:swapcaps** option to the **setxkbmap** command will help you make these changes. This type of modification has two parts: - - 1. Figuring out the command's usage; - 2. Figuring out where to invoke the command so it is activated as the desktop comes up. - - - -The first part is pretty straightforward: the command is: - -``` -/usr/bin/setxkbmap -option "ctrl:nocaps" -``` - -It's worth executing this in a terminal window to make sure the results are what you expect. - -Assuming it works, where should you invoke the command? That requires some experimentation; one possibility is in the file **.profile** in the user's home directory. Another option is to add the command to the autostart facility in Xfce (look for "Session and Startup" in the Settings Manager). - -Another possibility is to use the same option in the file / **etc/default/keyboard** , which might end up looking like this: - -``` -# KEYBOARD CONFIGURATION FILE - -# Consult the keyboard(5) manual page. - -XKBMODEL="pc105" -XKBLAYOUT="us" -XKBVARIANT="" -XKBOPTIONS="ctrl:swapcaps" - -BACKSPACE="guess" -``` - -Note that this kind of change will affect all users, so if you share your computer, be prepared to do some explaining. Also, system updates may overwrite this file, so you'll need to edit it again if your setup stops working. Putting the same information in the file **.keyboard** in the user's home directory might accomplish the same task on the user's behalf. - -Finally, note that these kinds of changes require you to restart Xfce (except when running the command on the command line in the terminal window, but that won't stick past the end of the session). - -### With LXQt and other desktop environments - -I haven't tried [LXQt][7], but if my memory serves from [LXDE][8], I would try the same recipe used above for Xfce. I'd also expect that the Xfce recipe could work for other Linux desktop environments, but, of course, your favorite search engine is always your friend. - -### The console - -I haven't tried this, as I have very few opportunities to interact with the console (what you see on a server or when your window system doesn't come up properly). The recipes presented above affect the terminal window in the way one would hope, i.e., consistently with other applications. - -However, if the file **/etc/default/keyboard** or **~/.keyboard** has already been edited (as described above), the utility **setupcon** is intended to change the console keyboard setup so it functions the same way.** **This [StackExchange article][9], [this other one][10], and [this third one][11] give some ideas on how to effect these changes from both of these files. The third article also talks about using **dumpkeys** and **loadkeys**. It's also worthwhile to read [the setupcon man page][12] — it's short and to the point, and combined with the comments from the StackExchange articles, should be enough to get a solution in place. - -Finally, it's worth emphasizing here the point mentioned in the StackExchange articles - configuring the console IS NOT THE SAME as configuring terminal windows; the latter are configured through the desktop manager as described previously. - -### When all else fails - -The manual pages for **setxkbmap** , **xkeyboard-config** , **keyboard** , **console-setup** , and **setupcon** are all useful references. Or, if you don't like reading manual pages, there's [this great article][13]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/11/how-swap-ctrl-and-caps-lock-your-keyboard - -作者:[Chris Hermansen][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/clhermansen -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Control_key -[2]: https://www.gnome.org/gnome-3/ -[3]: https://wiki.gnome.org/Apps/Tweaks -[4]: https://www.kde.org/ -[5]: https://opensource.com/article/17/5/7-cool-kde-tweaks-will-improve-your-life -[6]: https://www.xfce.org/ -[7]: https://lxqt.org/ -[8]: https://lxde.org/ -[9]: https://askubuntu.com/questions/485454/how-to-remap-keys-on-a-user-level-both-with-and-without-x -[10]: https://unix.stackexchange.com/questions/198791/how-do-i-permanently-change-the-console-tty-font-type-so-it-holds-after-reboot -[11]: https://superuser.com/questions/290115/how-to-change-console-keymap-in-linux -[12]: http://man.he.net/man1/setupcon -[13]: http://www.noah.org/wiki/CapsLock_Remap_Howto From 9bbd1ddbee79db7f99933b4eb05f10f64c2fbcae Mon Sep 17 00:00:00 2001 From: jlztan Date: Wed, 12 Dec 2018 20:59:10 +0800 Subject: [PATCH 0074/4278] Create 20181121 How to swap Ctrl and Caps Lock keys in Linux.md --- ...o swap Ctrl and Caps Lock keys in Linux.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md diff --git a/translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md b/translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md new file mode 100644 index 0000000000..cf1c56e908 --- /dev/null +++ b/translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md @@ -0,0 +1,108 @@ +在 Linux 下交换 Ctrl 与 Caps Lock 键 +====== + +Linux 桌面环境使你可以根据需要轻松设置键盘。下面来演示如何去做。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/keyboard_numbers_letters_type_game.jpg?itok=fLlWGw1K) + +对于许多使用计算机很多年的用户来说,自从第一批 PC 键盘从生产线上下线后不久,Ctrl 和 Caps Lock 键就已经在错误的位置上了。对我来说,这张 1995 年 Sun 工作站的老式键盘照片上的两个键的位置才是正确的。(原谅我放了一张模糊的图片,它是在昏暗的光线下使用 Minox 间谍相机拍摄的。) + +感兴趣的话,可以读一下维基百科上对于 [Ctrl 键位置的历史][1] 的介绍。我不打算讨论将 Ctrl 键放在“a”旁边而不是 Shift 键下方的各种理由,不评论 Caps Lock 键的无用性,也没有打算与那些主张使用手掌根来触发 Ctrl 键的人争论,即使在一些笔记本电脑键盘上也不可能这样做,因为有的键会位于腕托以下。 + +相反,我将假设我不是唯一喜欢把 Ctrl 键放在“a”旁边的人,并说明如何使用 Linux 自带的灵活性在各种桌面环境中交换 Ctrl 和 Caps Lock 键的位置。请注意,下面的演示可能只有有限的有效期,因为调整桌面设置的方法经常发生变化,但我希望这为你开了一个好头。 + +### GNOME 3 + +[GNOME 3][2] 桌面环境用户可以使用 [Tweaks][3] 工具交换 Caps Lock 和 Ctrl 键,如下所示。![](https://opensource.com/sites/default/files/uploads/tweaks-tool.png) + +具体步骤如下: + + 1. 从你的 Linux 发行版的软件仓库安装 Tweaks 工具。 + 2. 启动 Tweaks 程序。 + 3. 从左侧菜单中选择“Keyboard & Mouse”。 + 4. 单击“Additional Layout Options”。 + 5. 在打开的窗口中单击“Ctrl position”,然后选择“Swap Ctrl and Caps Lock”。 + +完成!顺便说一句,你可以使用 Tweaks 工具做很多很酷的事情。例如,我将我的右 Ctrl 键设置为 Compose 键,这让我可以使用键盘快捷键打出各种字符,例如通过 `Compose+c+,`、`Compose+e+'`、`Compose+O+^` 以及 `Compose+n+~` 分别键入 ç、é、ô 和 ñ。 + +### KDE + +我不使用 [KDE][4],但我的同事 Seth Kenlon 写的 [KDE tweaks that will change your life][5] 这篇文章的第 5 项演示了如何重新映射按键。 + +### Xfce + +据我所知,[Xfce][6] 桌面环境没有一个方便的工具来管理这些(指交换按键)设置。 但是,`setxkbmap` 命令的 `ctrl:swapcaps` 选项可以帮助你完成交换按键的修改。这个修改包含两部分: + + 1. 弄清楚命令的用法; + 2. 找出调用命令的位置,以便在桌面启动时激活它。 + +第一部分非常简单,命令是: + +``` +/usr/bin/setxkbmap -option "ctrl:nocaps" +``` + +在终端窗口中执行此命令,以确保结果符合你的预期。 + +假设上述命令有效,应该在哪里调用此命令呢?这需要一些实验。一种可能是在用户主目录的 `.profile` 文件中;另一个可能是将命令添加到 Xfce 的自启动配置(在设置管理器中查找“Session and Startup”)里。 + +还有一种可能性是在文件 `/etc/default/keyboard` 中使用相同的选项,最终可能看起来像这样: + +``` +# KEYBOARD CONFIGURATION FILE + +# Consult the keyboard(5) manual page. + +XKBMODEL="pc105" +XKBLAYOUT="us" +XKBVARIANT="" +XKBOPTIONS="ctrl:swapcaps" + +BACKSPACE="guess" +``` + +注意,这个更改将影响所有用户,因此如果你和其他人共享计算机,请准备好进行一些说明。此外,系统更新可能会覆盖此文件,因此如果你的设置失效了,就需要再次编辑它。将相同的信息放在用户主目录中的 `.keyboard` 文件内,可以为每个用户进行设置。 + +最后请注意,这些更改需要重新启动 Xfce(除非在终端窗口中的命令行上运行,但这在会话结束之后便会失效)。 + +### LXQt 和其他桌面环境 + +我没有用过 [LXQt][7],但根据我使用 [LXDE][8] 的经验,我会尝试上面用于 Xfce 的方法。我也希望适用于 Xfce 的方法可以用于其他 Linux 桌面环境。当然了,在其他桌面环境上遇到问题的时候,可以通过你最喜欢的搜索引擎来查找解决办法。 + +### 控制台 + +我没有在控制台上进行过尝试,因为我很少有机会与控制台(你在服务器上看到的或你的窗口系统没有正确显示时出现的界面)进行交互。上面给出的方法以人们希望的方式(即与其他应用程序一致)调整终端窗口。 + +但是,如果像上面一样已经编辑了 `/etc/default/keyboard` 文件或 `〜/.keyboard`,则实用程序 `setupcon` 可以用于更改控制台的键盘设置,以便实现相同的功能。[链接 1][9]、[链接 2][10] 和 [链接 3][11] 给出了一些关于如何从这两个文件实现这些更改的想法。第三个链接还讨论了使用 `dumpkeys` 和 `loadkeys` 来实现想要的效果。[setupcon 的手册][12] 简短而重要,值得阅读,再结合上面 StackExchange 问题的一些评论,应该足以得到一个解决办法。 + +### 其他环境 + +最后,上面 StackExchange 的链接中提到的这一点值得强调--配置控制台与配置终端窗口不同;如前所述,后者是通过桌面管理器进行配置的。 + +`setxkbmap`、`xkeyboard-config`、`keyboard`、`console-setup` 和 `setupcon` 命令的手册都是有用的参考资料。或者,如果你不喜欢阅读手册,可以看一下 [这篇极好的文章][13]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/how-swap-ctrl-and-caps-lock-your-keyboard + +作者:[Chris Hermansen][a] +选题:[lujun9972][b] +译者:[jlztan](https://github.com/jlztan) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Control_key +[2]: https://www.gnome.org/gnome-3/ +[3]: https://wiki.gnome.org/Apps/Tweaks +[4]: https://www.kde.org/ +[5]: https://opensource.com/article/17/5/7-cool-kde-tweaks-will-improve-your-life +[6]: https://www.xfce.org/ +[7]: https://lxqt.org/ +[8]: https://lxde.org/ +[9]: https://askubuntu.com/questions/485454/how-to-remap-keys-on-a-user-level-both-with-and-without-x +[10]: https://unix.stackexchange.com/questions/198791/how-do-i-permanently-change-the-console-tty-font-type-so-it-holds-after-reboot +[11]: https://superuser.com/questions/290115/how-to-change-console-keymap-in-linux +[12]: http://man.he.net/man1/setupcon +[13]: http://www.noah.org/wiki/CapsLock_Remap_Howto From 7fe51f3b2e9ba1ea5d451aa245ca7df745116d44 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Wed, 12 Dec 2018 21:39:29 +0800 Subject: [PATCH 0075/4278] Translated by qhwdw --- ...mputing with Open Source Cirq Framework.md | 229 ------------------ ...mputing with Open Source Cirq Framework.md | 228 +++++++++++++++++ 2 files changed, 228 insertions(+), 229 deletions(-) delete mode 100644 sources/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md create mode 100644 translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md diff --git a/sources/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/sources/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md deleted file mode 100644 index ee35ef36ec..0000000000 --- a/sources/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md +++ /dev/null @@ -1,229 +0,0 @@ -Translating by qhwdw -An Introduction to Quantum Computing with Open Source Cirq Framework -====== -As the title suggests what we are about to begin discussing, this article is an effort to understand how far we have come in Quantum Computing and where we are headed in the field in order to accelerate scientific and technological research, through an Open Source perspective with Cirq. - -First, we will introduce you to the world of Quantum Computing. We will try our best to explain the basic idea behind the same before we look into how Cirq would be playing a significant role in the future of Quantum Computing. Cirq, as you might have heard of recently, has been breaking news in the field and in this Open Science article, we will try to find out why. - - - -Before we start with what Quantum Computing is, it is essential to get to know about the term Quantum, that is, a [subatomic particle][1] referring to the smallest known entity. The word [Quantum][2] is based on the Latin word Quantus, meaning, “how little”, as described in this short video: - - - -It will be easier for us to understand Quantum Computing by comparing it first to Classical Computing. Classical Computing refers to how today’s conventional computers are designed to work. The device with which you are reading this article right now, can also be referred to as a Classical Computing Device. - -### Classical Computing - -Classical Computing is just another way to describe how a conventional computer works. They work via a binary system, i.e, information is stored using either 1 or 0. Our Classical computers cannot understand any other form. - -In literal terms inside the computer, a transistor can be either on (1) or off (0). Whatever information we provide input to, is translated into 0s and 1s, so that the computer can understand and store that information. Everything is represented only with the help of a combination of 0s and 1s. - - - -### Quantum Computing - -Quantum Computing, on the other hand, does not follow an “on or off” model like Classical Computing. Instead, it can simultaneously handle multiple states of information with help of two phenomena called [superimposition and entanglement][3], thus accelerating computing at a much faster rate and also facilitating greater productivity in information storage. - -Please note that superposition and entanglement are [not the same phenomena][4]. - - - -![][5] - -So, if we have bits in Classical Computing, then in the case of Quantum Computing, we would have qubits (or Quantum bits) instead. To know more about the vast difference between the two, check this [page][6] from where the above pic was obtained for explanation. - -Quantum Computers are not going to replace our Classical Computers. But, there are certain humongous tasks that our Classical Computers will never be able to accomplish and that is when Quantum Computers would prove extremely resourceful. The following video describes the same in detail while also describing how Quantum Computers work: - - - -A comprehensive video on the progress in Quantum Computing so far: - - - -### Noisy Intermediate Scale Quantum - -According to the very recently updated research paper (31st July 2018), the term “Noisy” refers to inaccuracy because of producing an incorrect value caused by imperfect control over qubits. This inaccuracy is why there will be serious limitations on what Quantum devices can achieve in the near term. - -“Intermediate Scale” refers to the size of Quantum Computers which will be available in the next few years, where the number of qubits can range from 50 to a few hundred. 50 qubits is a significant milestone because that’s beyond what can be simulated by [brute force][7] using the most powerful existing digital [supercomputers][8]. Read more in the paper [here][9]. - -With the advent of Cirq, a lot is about to change. - -### What is Cirq? - -Cirq is a python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits that we just talked about. In other words, Cirq can address challenges to improve accuracy and reduce noise in Quantum Computing. - -Cirq does not necessarily require an actual Quantum Computer for execution. Cirq can also use a simulator-like interface to perform Quantum circuit simulations. - -Cirq is gradually grabbing a lot of pace, with one of its first users being [Zapata][10], formed last year by a [group of scientists][11] from Harvard University focused on Quantum Computing. - -### Getting started with Cirq on Linux - -The developers of the Open Source [Cirq library][12] recommend the installation in a [virtual python environment][13] like [virtualenv][14]. The developers’ installation guide for Linux can be found [here][15]. - -However, we successfully installed and tested Cirq directly for Python3 on an Ubuntu 16.04 system via the following steps: - -#### Installing Cirq on Ubuntu - -![Cirq Framework for Quantum Computing in Linux][16] - -First, we would require pip or pip3 to install Cirq. [Pip][17] is a tool recommended for installing and managing Python packages. - -For Python 3.x versions, Pip can be installed with: -``` -sudo apt-get install python3-pip - -``` - -Python3 packages can be installed via: -``` -pip3 install - -``` - -We went ahead and installed the Cirq library with Pip3 for Python3: -``` -pip3 install cirq - -``` - -#### Enabling Plot and PDF generation (optional) - -Optional system dependencies not install-able with pip can be installed with: -``` -sudo apt-get install python3-tk texlive-latex-base latexmk - -``` - - * python3-tk is Python’s own graphic library which enables plotting functionality. - * texlive-latex-base and latexmk enable PDF writing functionality. - - - -Later, we successfully tested Cirq with the following command and code: -``` -python3 -c 'import cirq; print(cirq.google.Foxtail)' - -``` - -We got the resulting output as: - -![][18] - -#### Configuring Pycharm IDE for Cirq - -We also configured a Python IDE [PyCharm on Ubuntu][19] to test the same results: - -Since we installed Cirq for Python3 on our Linux system, we set the path to the project interpreter in the IDE settings to be: -``` -/usr/bin/python3 - -``` - -![][20] - -In the output above, you can note that the path to the project interpreter that we just set, is shown along with the path to the test program file (test.py). An exit code of 0 shows that the program has finished executing successfully without errors. - -So, that’s a ready-to-use IDE environment where you can import the Cirq library to start programming with Python and simulate Quantum circuits. - -#### Get started with Cirq - -A good place to start are the [examples][21] that have been made available on Cirq’s Github page. - -The developers have included this [tutorial][22] on GitHub to get started with learning Cirq. If you are serious about learning Quantum Computing, they recommend an excellent book called [“Quantum Computation and Quantum Information” by Nielsen and Chuang][23]. - -#### OpenFermion-Cirq - -[OpenFermion][24] is an open source library for obtaining and manipulating representations of fermionic systems (including Quantum Chemistry) for simulation on Quantum Computers. Fermionic systems are related to the generation of [fermions][25], which according to [particle physics][26], follow [Fermi-Dirac statistics][27]. - -OpenFermion has been hailed as [a great practice tool][28] for chemists and researchers involved with [Quantum Chemistry][29]. The main focus of Quantum Chemistry is the application of [Quantum Mechanics][30] in physical models and experiments of chemical systems. Quantum Chemistry is also referred to as [Molecular Quantum Mechanics][31]. - -The advent of Cirq has now made it possible for OpenFermion to extend its functionality by providing routines and tools for using Cirq to compile and compose circuits for Quantum simulation algorithms. - -#### Google Bristlecone - -On March 5, 2018, Google presented [Bristlecone][32], their new Quantum processor, at the annual [American Physical Society meeting][33] in Los Angeles. The [gate-based superconducting system][34] provides a test platform for research into [system error rates][35] and [scalability][36] of Google’s [qubit technology][37], along-with applications in Quantum [simulation][38], [optimization][39], and [machine learning.][40] - -In the near future, Google wants to make its 72 qubit Bristlecone Quantum processor [cloud accessible][41]. Bristlecone will gradually become quite capable to perform a task that a Classical Supercomputer would not be able to complete in a reasonable amount of time. - -Cirq would make it easier for researchers to directly write programs for Bristlecone on the cloud, serving as a very convenient interface for real-time Quantum programming and testing. - -Cirq will allow us to: - - * Fine tune control over Quantum circuits, - * Specify [gate][42] behavior using native gates, - * Place gates appropriately on the device & - * Schedule the timing of these gates. - - - -### The Open Science Perspective on Cirq - -As we all know Cirq is Open Source on GitHub, its addition to the Open Source Scientific Communities, especially those which are focused on Quantum Research, can now efficiently collaborate to solve the current challenges in Quantum Computing today by developing new ways to reduce error rates and improve accuracy in the existing Quantum models. - -Had Cirq not followed an Open Source model, things would have definitely been a lot more challenging. A great initiative would have been missed out and we would not have been one step closer in the field of Quantum Computing. - -### Summary - -To summarize in the end, we first introduced you to the concept of Quantum Computing by comparing it to existing Classical Computing techniques followed by a very important video on recent developmental updates in Quantum Computing since last year. We then briefly discussed Noisy Intermediate Scale Quantum, which is what Cirq is specifically built for. - -We saw how we can install and test Cirq on an Ubuntu system. We also tested the installation for usability on an IDE environment with some resources to get started to learn the concept. - -Finally, we also saw two examples of how Cirq would be an essential advantage in the development of research in Quantum Computing, namely OpenFermion and Bristlecone. We concluded the discussion by highlighting some thoughts on Cirq with an Open Science Perspective. - -We hope we were able to introduce you to Quantum Computing with Cirq in an easy to understand manner. If you have any feedback related to the same, please let us know in the comments section. Thank you for reading and we look forward to see you in our next Open Science article. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/qunatum-computing-cirq-framework/ - -作者:[Avimanyu Bandyopadhyay][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/avimanyu/ -[1]:https://en.wikipedia.org/wiki/Subatomic_particle -[2]:https://en.wikipedia.org/wiki/Quantum -[3]:https://www.clerro.com/guide/491/quantum-superposition-and-entanglement-explained -[4]:https://physics.stackexchange.com/questions/148131/can-quantum-entanglement-and-quantum-superposition-be-considered-the-same-phenom -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/bit-vs-qubit.jpg -[6]:http://www.rfwireless-world.com/Terminology/Difference-between-Bit-and-Qubit.html -[7]:https://en.wikipedia.org/wiki/Proof_by_exhaustion -[8]:https://www.explainthatstuff.com/how-supercomputers-work.html -[9]:https://arxiv.org/abs/1801.00862 -[10]:https://www.xconomy.com/san-francisco/2018/07/19/google-partners-with-zapata-on-open-source-quantum-computing-effort/ -[11]:https://www.zapatacomputing.com/about/ -[12]:https://github.com/quantumlib/Cirq -[13]:https://itsfoss.com/python-setup-linux/ -[14]:https://virtualenv.pypa.io -[15]:https://cirq.readthedocs.io/en/latest/install.html#installing-on-linux -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-framework-linux.jpeg -[17]:https://pypi.org/project/pip/ -[18]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-test-output.jpg -[19]:https://itsfoss.com/install-pycharm-ubuntu/ -[20]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-tested-on-pycharm.jpg -[21]:https://github.com/quantumlib/Cirq/tree/master/examples -[22]:https://github.com/quantumlib/Cirq/blob/master/docs/tutorial.md -[23]:http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf -[24]:http://openfermion.org -[25]:https://en.wikipedia.org/wiki/Fermion -[26]:https://en.wikipedia.org/wiki/Particle_physics -[27]:https://en.wikipedia.org/wiki/Fermi-Dirac_statistics -[28]:https://phys.org/news/2018-03-openfermion-tool-quantum-coding.html -[29]:https://en.wikipedia.org/wiki/Quantum_chemistry -[30]:https://en.wikipedia.org/wiki/Quantum_mechanics -[31]:https://ocw.mit.edu/courses/chemical-engineering/10-675j-computational-quantum-mechanics-of-molecular-and-extended-systems-fall-2004/lecture-notes/ -[32]:https://techcrunch.com/2018/03/05/googles-new-bristlecone-processor-brings-it-one-step-closer-to-quantum-supremacy/ -[33]:http://meetings.aps.org/Meeting/MAR18/Content/3475 -[34]:https://en.wikipedia.org/wiki/Superconducting_quantum_computing -[35]:https://en.wikipedia.org/wiki/Quantum_error_correction -[36]:https://en.wikipedia.org/wiki/Scalability -[37]:https://research.googleblog.com/2015/03/a-step-closer-to-quantum-computation.html -[38]:https://research.googleblog.com/2017/10/announcing-openfermion-open-source.html -[39]:https://research.googleblog.com/2016/06/quantum-annealing-with-digital-twist.html -[40]:https://arxiv.org/abs/1802.06002 -[41]:https://www.computerworld.com.au/article/644051/google-launches-quantum-framework-cirq-plans-bristlecone-cloud-move/ -[42]:https://en.wikipedia.org/wiki/Logic_gate diff --git a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md new file mode 100644 index 0000000000..289a62de15 --- /dev/null +++ b/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @@ -0,0 +1,228 @@ +量子计算的开源框架 Cirq 介绍 +====== +我们即将讨论的内容正如标题所示,本文通过使用 Cirq 的一个开源视角,尝试去了解我们已经在量子计算领域取得多大的成就,和该领域的发展方向,以加快科学和技术研究。 + +首先,我们将引领你进入量子计算的世界。在我们深入了解 Cirq 在未来的量子计算中扮演什么样的重要角色之前,我们将尽量向你解释其背后的基本概念。Cirq,你最近可能听说过,在这个领域中已经发生了重大新闻,在 Open Science 上的文章中,我们将去尝试找出答案。 + + + +在我们开始了解量子计算之前,必须先去了解“量子”这个术语,量子是已知的 [亚原子粒子][1] 中最小的物质。[量子][2] 这个词来自拉丁语 Quantus,意思是 “非常小”,在下面的短视频链接中有描述: + + + +为了易于我们理解量子计算,我们将量子计算与传统计算Classical Computing(也译做经典计算)进行比较。传统计算是指设计用于工作的、我们正在使用的传统计算机,正如你现在用于阅读本文的设备,就是我们所谓的传统计算设备。 + +### 传统计算 + +传统计算是描述传统计算机如何工作的另一种方式。它们通过一个二进制系统工作,即信息使用 1 或 0 来存储。传统计算机不会理解除 1 或 0 之外的任何其它东西。 + +直白来说,在计算机内部一个晶体管只能是开(1)或关(0)。我们输入的任何信息都被转换为无数个 1 和 0,所以计算机只能理解和存储 1 和 0。所有的东西都只能用无数个 1 和 0 的组合来表示。 + + + +### 量子计算 + +然而,量子计算不再像传统计算那样遵循 “开或关” 的模式。而是,借助量子的名为 [叠加和纠缠][3] 的两个现象,能同时处理信息的多个状态,因此能以更快的速率加速计算,并且在信息存储方面效率更高。 + +请注意,叠加和纠缠 [不是同一个现象][4]。 + + + +![][5] + +就像在传统计算中,我们有比特bit,在量子计算中,我们相应也有量子比特qubits(或 Quantum bits)。想了解它们二者之间的巨大差异之处,请查看这个 [页面][6],从那里的图片中可以得到答案。 + +量子计算机并不是来替代我们的传统计算机的。但是,有一些非常巨大的任务用我们的传统计算机是无法完成的,而那些正是量子计算机大显身手的好机会。下面链接的视频详细描述了上述情况,同时也描述了量子计算机的原理。 + + + +下面的视频全面描述了量子计算领域到目前为止的最新进展: + + + +### 嘈杂中型量子 + +根据最新更新的(2018 年 7 月 31 日)研究论文,术语 “Noisy” 是指由于对量子比特未能完全控制所产生的不准确性。正是这种不准确性严重制约了量子设备短期内实现其目标。 + +“中型” 指的是在接下来的几年中,量子计算机将要实现的规模大小,届时,量子比特的数目将可能从 50 到几百个不等。50 个量子比特是一个重大的量程碑,因为它将超越现有的最强大的 [超级计算机][8] 的 [暴力][7] 模拟能力。更多信息请阅读 [这里的][9] 论文。 + +随着 Cirq 出现,许多事情将会发生变化。 + +### Cirq 是什么? + +Cirq 是一个 python 框架,它用于创建、编辑和调用我们前面讨论的嘈杂中型量子(NISQ)。换句话说,Cirq 能够解决挑战,去改善精确度和降低量子计算中的噪声。 + +Cirq 并不需要必须有一台真实的量子计算机。Cirq 能够使用一个类似模拟器的界面去执行量子电路模拟。 + +Cirq 的前进步伐越来越快了,[Zapata][10] 是使用它的首批用户之一,Zapata 是由来自哈佛大学的一群专注于量子计算的科学家在去年成立的。 + +### Linux 上使用 Cirq 入门 + +开源的 [Cirq 库][12] 开发者建议将它安装在像 [virtualenv][14] 这样的一个 [虚拟 python 环境][13] 中。在 Linux 上的开发者安装指南可以在 [这里][15] 找到。 + +但我们在 Ubuntu 16.04 的系统上成功地安装和测试了 Python3 的 Cirq 库,安装步骤如下: + +#### 在 Ubuntu 上安装 Cirq + +![Cirq Framework for Quantum Computing in Linux][16] + +首先,我们需要 pip 或 pip3 去安装 Cirq。[Pip][17] 是推荐用于安装和管理 Python 包的工具。 + +对于 Python 3.x 版本,Pip 能够用如下的命令来安装: +``` +sudo apt-get install python3-pip + +``` + +Python3 包能够通过如下的命令来安装: +``` +pip3 install + +``` + +我们继续去使用 Pip3 为 Python3 安装 Cirq 库: +``` +pip3 install cirq + +``` + +#### 启用 Plot 和 PDF 生成(可选) + +可选系统的依赖没有安装的,可以使用 pip 去安装它: +``` +sudo apt-get install python3-tk texlive-latex-base latexmk + +``` + + * python3-tk 是 Python 自有的启用了绘图功能的图形库 + * texlive-latex-base 和 latexmk 启动了 PDF 输出功能。 + + + +最后,我们使用如下的命令和代码成功测试了 Cirq: +``` +python3 -c 'import cirq; print(cirq.google.Foxtail)' + +``` + +我们得到的输出如下图: + +![][18] + +#### 为 Cirq 配置 Pycharm IDE + +我们也配置了一个 Python IDE [PyCharm][19] 去测试同样的结果: + +因为在我们的 Linux 系统上为 Python3 安装了 Cirq,我们在 IDE 中配置项目解释器路径: +``` +/usr/bin/python3 + +``` + +![][20] + +在上面的输出中,你可能注意到我们刚设置的项目解释器路径与测试程序文件(test.py)的路径显示在一起。退出代码 0 表示程序已经成功退出,没有错误。 + +因此,那是一个现成的 IDE 环境,你可以导入 Cirq 库去开始使用 Python 去编程和模拟量子电路。 + +#### Cirq 使用入门 + +Criq 入门的一个好的开端就是它 GitHub 页面上的 [示例][21]。 + +Cirq 的开发者在 GitHub 上已经放了学习 [教程][22]。如果你想认真地学习量子计算,他们推荐你去看一本非常好的书,它是[由 Nielsen 和 Chuang 写的名为 “量子计算和量子信息“][23]。 + +#### OpenFermion-Cirq + +[OpenFermion][24] 是一个开源库,它是为了在量子计算机上模拟获取和操纵表示费米系统(包含量子化学)。根据 [粒子物理学][26] 理论,按照 [费米— 狄拉克统计][27],费米系统与 [费米子][25] 的产生相关。 + +OpenFermion 被称为从事 [量子化学][29] 的化学家和研究人员的 [一个极好的实践工具][28]。量子化学主要专注于 [量子力学][30] 在物理模型和化学系统实验中的应用。量子化学也被称为 [分子量子力学][31]。 + +Cirq 的出现使 OpenFermion 通过提供程序和工具去扩展功能成为了可能,通过使用 Cirq 可以去编译和构造仿真量子电路。 + +#### Google Bristlecone + +2018 年 3 月 5 日,在洛杉矶举行的一年一度的 [美国物理学会会议][33] 上,Google 发布了 [Bristlecone][32],这是他们的最新的量子处理器。这个 [基于门的超导系统][34] 为 Google 提供了一个测试平台,用以研究 [量子比特技术][37] 的 [系统错误率][35] 和 [扩展性][36] ,以及在量子 [仿真][38]、[优化][39]、和 [机器学习][40] 方面的应用。 + +Google 希望在不久的将来,能够制造出它的 [云可访问][41] 的 72 个量子比特的 Bristlecone 量子处理器。Bristlecone 将越来越有能力完成一个传统超级计算机无法在合理时间内完成的任务。 + +Cirq 将让研究人员直接在云上为 Bristlecone 写程序变得很容易,它提供了一个非常方便的、实时的、量子编程和测试的接口。 + +Cirq 将允许我们去: + + * 量子电路的微调管理 + * 使用原生门去指定 [门][42] 行为 + * 在设备上放置适当的门 + * 并调度这个门的时刻 + + + +### Open Science 关于 Cirq 的观点 + +我们知道 Cirq 是在 GitHub 上开源的,它除了在 Open Science 社区之外,特别是那些专注于量子研究的人们,都可以高效率地合作,通过开发新方法,去降低现有量子模型中的错误率和提升精确度,以解决目前在量子计算中所面临的挑战。 + +如果 Cirq 不走开源模型的路线,事情可能变得更具挑战。一个伟大的创举可能就此错过,我们可能在量子计算领域止步不前。 + +### 总结 + +最后我们总结一下,我们首先通过与传统计算相比较,介绍了量子计算的概念,然后是一个非常重要的视频来介绍了自去年以来量子计算的最新发展。接着我们简单讨论了嘈杂中型量子,也就是为什么要特意构建 Cirq 的原因所在。 + +我们看了如何在一个 Ubuntu 系统上安装和测试 Cirq。我们也在一个更好用的 IDE 环境中做了安装测试,并使用一些资源去开始学习有关概念。 + +最后,我们看了两个示例 OpenFermion 和 Bristlecone,介绍了在量子计算中,Cirq 在开发研究中具有什么样的基本优势。最后我们以 Open Science 社区的视角对 Cirq 进行了一些精彩的思考,结束了我们的话题。 + +我们希望能以一种易于理解的方式向你介绍量子计算框架 Cirq 的使用。如果你有与此相关的任何反馈,请在下面的评论区告诉我们。感谢阅读,希望我们能在 Open Science 的下一篇文章中再见。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/qunatum-computing-cirq-framework/ + +作者:[Avimanyu Bandyopadhyay][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/avimanyu/ +[1]:https://en.wikipedia.org/wiki/Subatomic_particle +[2]:https://en.wikipedia.org/wiki/Quantum +[3]:https://www.clerro.com/guide/491/quantum-superposition-and-entanglement-explained +[4]:https://physics.stackexchange.com/questions/148131/can-quantum-entanglement-and-quantum-superposition-be-considered-the-same-phenom +[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/bit-vs-qubit.jpg +[6]:http://www.rfwireless-world.com/Terminology/Difference-between-Bit-and-Qubit.html +[7]:https://en.wikipedia.org/wiki/Proof_by_exhaustion +[8]:https://www.explainthatstuff.com/how-supercomputers-work.html +[9]:https://arxiv.org/abs/1801.00862 +[10]:https://www.xconomy.com/san-francisco/2018/07/19/google-partners-with-zapata-on-open-source-quantum-computing-effort/ +[11]:https://www.zapatacomputing.com/about/ +[12]:https://github.com/quantumlib/Cirq +[13]:https://itsfoss.com/python-setup-linux/ +[14]:https://virtualenv.pypa.io +[15]:https://cirq.readthedocs.io/en/latest/install.html#installing-on-linux +[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-framework-linux.jpeg +[17]:https://pypi.org/project/pip/ +[18]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-test-output.jpg +[19]:https://itsfoss.com/install-pycharm-ubuntu/ +[20]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-tested-on-pycharm.jpg +[21]:https://github.com/quantumlib/Cirq/tree/master/examples +[22]:https://github.com/quantumlib/Cirq/blob/master/docs/tutorial.md +[23]:http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf +[24]:http://openfermion.org +[25]:https://en.wikipedia.org/wiki/Fermion +[26]:https://en.wikipedia.org/wiki/Particle_physics +[27]:https://en.wikipedia.org/wiki/Fermi-Dirac_statistics +[28]:https://phys.org/news/2018-03-openfermion-tool-quantum-coding.html +[29]:https://en.wikipedia.org/wiki/Quantum_chemistry +[30]:https://en.wikipedia.org/wiki/Quantum_mechanics +[31]:https://ocw.mit.edu/courses/chemical-engineering/10-675j-computational-quantum-mechanics-of-molecular-and-extended-systems-fall-2004/lecture-notes/ +[32]:https://techcrunch.com/2018/03/05/googles-new-bristlecone-processor-brings-it-one-step-closer-to-quantum-supremacy/ +[33]:http://meetings.aps.org/Meeting/MAR18/Content/3475 +[34]:https://en.wikipedia.org/wiki/Superconducting_quantum_computing +[35]:https://en.wikipedia.org/wiki/Quantum_error_correction +[36]:https://en.wikipedia.org/wiki/Scalability +[37]:https://research.googleblog.com/2015/03/a-step-closer-to-quantum-computation.html +[38]:https://research.googleblog.com/2017/10/announcing-openfermion-open-source.html +[39]:https://research.googleblog.com/2016/06/quantum-annealing-with-digital-twist.html +[40]:https://arxiv.org/abs/1802.06002 +[41]:https://www.computerworld.com.au/article/644051/google-launches-quantum-framework-cirq-plans-bristlecone-cloud-move/ +[42]:https://en.wikipedia.org/wiki/Logic_gate From 3052a1e4400cb3d81cb9d16f616cf8dec0ea7e89 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 22:59:41 +0800 Subject: [PATCH 0076/4278] PRF:20180404 Emacs -5- Documents and Presentations with org-mode.md @oneforalone --- ...cuments and Presentations with org-mode.md | 79 ++++++++++--------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/translated/tech/20180404 Emacs -5- Documents and Presentations with org-mode.md b/translated/tech/20180404 Emacs -5- Documents and Presentations with org-mode.md index ad420da202..9ed04db2cb 100644 --- a/translated/tech/20180404 Emacs -5- Documents and Presentations with org-mode.md +++ b/translated/tech/20180404 Emacs -5- Documents and Presentations with org-mode.md @@ -1,59 +1,58 @@ -Emacs #5: org-mode 之文档与 Presentations +Emacs 系列(五):org 模式之文档与演示稿 ====== -### 1 org-mode 的输出 +这是 [Emacs 和 Org 模式系列][20]的第五篇。 + +这篇博文是由 Org 模式的源文件生成的,其有几种格式:[博客页面][21]、[演示稿][22] 和 [PDF 文档][23]。 + +### 1 Org 模式的输出 #### 1.1 背景 -org-mode 不仅仅只是一个议程生成程序, 它也能输出许多不同的格式: LaTeX,PDF,Beamer,iCalendar(议程),HTML,Markdown,ODT,普通文本,帮助页面(man pages)和其它更多的复杂的格式,比如说网页文件。 +Org 模式不仅仅只是一个议程生成程序,它也能输出许多不同的格式: LaTeX、PDF、Beamer、iCalendar(议程)、HTML、Markdown、ODT、普通文本、手册页和其它更多的复杂的格式,比如说网页文件。 -这也不只是一些事后的想法,这是 org-mode 的设计核心部分并且集成的很好。 +这也不只是一些事后的想法,这是 Org 模式的设计核心部分并且集成的很好。 -一个文件可以同时是源代码,自动生成的输出,任务列表,文档和 presentation。 +这一个文件可以同时是源代码、自动生成的输出、任务列表、文档和展示。 -有些人将 org-mode 作为他们首选的标记格式,甚至对于 LaTeX 文档也是如此。org-mode 手册中的 [section on exporting][13] 有更详细的介绍。 +有些人将 Org 模式作为他们首选的标记格式,甚至对于 LaTeX 文档也是如此。Org 模式手册中的 [输出一节][13] 有更详细的介绍。 #### 1.2 开始 -对于任意的 org-mode 的文档,只要按下 C-c C-e键,就会弹出一个让你选择多种输出格式和选项的菜单。这些选项通常是次键选择,所以很容易设置和执行。例如:要输出一个 PDF 文档,按 C-c C-e l p,要输出 HMTL 格式的, 按 C-c C-e h h。 +对于任意的 Org 模式的文档,只要按下 `C-c C-e` 键,就会弹出一个让你选择多种输出格式和选项的菜单。这些选项通常是次键选择,所以很容易设置和执行。例如:要输出一个 PDF 文档,按 `C-c C-e l p`,要输出 HMTL 格式的, 按 `C-c C-e h h`。 对于所有的输出选项,都有许多可用的设置;详情参见手册。事实上,使用 LaTeX 格式相当于同时使用 LaTeX 和 HTML 模式,在不同的模式中插入任意的前言和设置等。 #### 1.3 第三方插件 -[ELPA][19] 中也包含了许多额外的输出格式,详情参见 [ELPA][19]. +[ELPA][19] 中也包含了许多额外的输出格式,详情参见 [ELPA][19]。 -### 2 org-mode 的 Beamer 演示 +### 2 Org 模式的 Beamer 演示 #### 2.1 关于 Beamer -[Beamer][14] 是一个生成 presentation 的 LaTeX 环境. 它包括了一下特性: +[Beamer][14] 是一个生成演示稿的 LaTeX 环境. 它包括了以下特性: -* 在 presentation 中自动生成结构化的元素(例如 [the Marburg theme][1])。 在 presentation 时,这个特性可以为观众提供了视觉参考。 +* 在演示稿中自动生成结构化的元素(例如 [Marburg 主题][1])。 在演示稿中,这个特性可以为观众提供了视觉参考。 +* 对组织演示稿有很大的帮助。 +* 主题 +* 完全支持 LaTeX -* 对组织 presentation 有很大的帮助。 +#### 2.2 Org 模式中 Beamer 的优点 -* 主题 - -* 完全支持 LaTeX - -#### 2.2 org-mode 中 Beamer 的优点 - -在 org-mode 中用 Beamer 有很多好处,总的来说: - -* org-mode 很简单而且对可视化支持的很好,同时改变结构可以快速的重组你的材料。 +在 Org 模式中用 Beamer 有很多好处,总的来说: +* Org 模式很简单而且对可视化支持的很好,同时改变结构可以快速的重组你的材料。 * 与 org-babel 绑定在一起,实时语法高亮源码和内嵌结果。 - * 语法通常更容易使用。 -我已经完全用 org-mode 和 beamer 替换掉 LibreOffice/Powerpoint/GoogleDocs 的使用。事实上,当我必须使用其中一种工具时,这是相当令人沮丧的,因为它们在可视化表示结构方面远远比不上 org-mode。 +我已经完全用 Org 模式和 beamer 替换掉使用 LibreOffice/Powerpoint/GoogleDocs。事实上,当我必须使用其中一种工具时,这是相当令人沮丧的,因为它们在可视化表示演讲稿结构方面远远比不上 Org 模式。 #### 2.3 标题层次 -org-mode 的 Beamer 会将你文档中的部分(文中定义了标题的)转换成幻灯片。当然,问题是:哪些部分?这是由 H [export setting][15](org-export-headline-levels)决定的。 +Org 模式的 Beamer 会将你文档中的部分(文中定义了标题的)转换成幻灯片。当然,问题是:哪些部分?这是由 H [输出设置][15](`org-export-headline-levels`)决定的。 -针对不同的人,有许多不同的方法。我比较喜欢我的 presentation 这样: +针对不同的人,有许多不同的方法。我比较喜欢我的演示稿这样: ``` #+OPTIONS: H:2 @@ -64,7 +63,7 @@ org-mode 的 Beamer 会将你文档中的部分(文中定义了标题的)转 #### 2.4 主题和配置 -你可以在 org 文件的顶部来插入几行来配置 Beamer 和 LaTeX。在本文中,例如,你可以这样定义: +你可以在 Org 模式的文件顶部来插入几行来配置 Beamer 和 LaTeX。在本文中,例如,你可以这样定义: ``` #+TITLE: Documents and presentations with org-mode @@ -96,13 +95,13 @@ org-mode 的 Beamer 会将你文档中的部分(文中定义了标题的)转 #+BEAMER_HEADER: \setlength{\parskip}{\smallskipamount} ``` -在这里, aspectratio=169 将纵横比设为 16:9, 其它部分都是标准的 LaTeX/Beamer 配置。 +在这里,`aspectratio=169` 将纵横比设为 16:9, 其它部分都是标准的 LaTeX/Beamer 配置。 #### 2.6 缩小 (适应屏幕) 有时你会遇到一些非常大的代码示例,你可能更倾向与将幻灯片缩小以适应它们。 -只要按下 C-c C-c p 将 BEAMER_opt属性设为 shrink=15\.(或者设为更大的 shrink 值)。上一张幻灯片就用到了这个。 +只要按下 `C-c C-c p` 将 `BEAMER_opt` 属性设为 `shrink=15`\。(或者设为更大的 shrink 值)。上一张幻灯片就用到了这个。 #### 2.7 效果 @@ -114,28 +113,24 @@ org-mode 的 Beamer 会将你文档中的部分(文中定义了标题的)转 #### 3.1 交互式的 Emacs 幻灯片 -使用 [org-tree-slide package][17] 这个插件的话, 就可以在 Emacs 的右侧显示幻灯片了。 只要按下 M-x,然后输入 org-tree-slide-mode,回车,然后你就可以用 C-> 和 C-< 在幻灯片之间切换了。 +使用 [org-tree-slide][17] 这个插件的话,就可以在 Emacs 的右侧显示幻灯片了。 只要按下 `M-x`,然后输入 `org-tree-slide-mode`,回车,然后你就可以用 `C->` 和 `C-<` 在幻灯片之间切换了。 -你可能会发现 C-c C-x C-v (即 org-toggle-inline-images)有助于使系统显示内嵌的图像。 +你可能会发现 `C-c C-x C-v` (即 `org-toggle-inline-images`)有助于使系统显示内嵌的图像。 #### 3.2 HTML 幻灯片 -有许多方式可以将 org-mode 的 presentation 导出为 HTML,并有不同级别的 JavaScript 集成。有关详细信息,请参见 org-mode 的 wiki 中的 [non-beamer presentations section][18]。 +有许多方式可以将 Org 模式的演讲稿导出为 HTML,并有不同级别的 JavaScript 集成。有关详细信息,请参见 Org 模式的 wiki 中的 [非 beamer 演讲稿一节][18]。 ### 4 更多 #### 4.1 本文中的附加资源 * [orgmode.org beamer tutorial][2] - * [LaTeX wiki][3] - * [Generating section title slides][4] - * [Shrinking content to fit on slide][5] - -* 很棒的资源: refcard-org-beamer 详情参见其 [Github repo][6] 中的 PDF 和 .org 文件。 - +* 很棒的资源: refcard-org-beamer + * 详情参见其 [Github repo][6] 中的 PDF 和 .org 文件。 * 很漂亮的主题: [Theme matrix][7] #### 4.2 下一个 Emacs 系列 @@ -148,9 +143,9 @@ mu4e 邮件! via: http://changelog.complete.org/archives/9900-emacs-5-documents-and-presentations-with-org-mode 作者:[John Goerzen][a] -译者:[oneforalone](https://github.com/oneforalone) -校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) +译者:[oneforalone](https://github.com/oneforalone) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -174,3 +169,9 @@ via: http://changelog.complete.org/archives/9900-emacs-5-documents-and-presentat [17]:https://orgmode.org/worg/org-tutorials/non-beamer-presentations.html#org-tree-slide [18]:https://orgmode.org/worg/org-tutorials/non-beamer-presentations.html [19]:https://www.emacswiki.org/emacs/ELPA +[20]:https://changelog.complete.org/archives/tag/emacs2018 +[21]:https://github.com/jgoerzen/public-snippets/blob/master/emacs/emacs-org-beamer/emacs-org-beamer.org +[22]:http://changelog.complete.org/archives/9900-emacs-5-documents-and-presentations-with-org-mode +[23]:https://github.com/jgoerzen/public-snippets/raw/master/emacs/emacs-org-beamer/emacs-org-beamer.pdf +[24]:https://github.com/jgoerzen/public-snippets/raw/master/emacs/emacs-org-beamer/emacs-org-beamer-document.pdf + From 8b00b53b68563c53f5638f657a0928b5c9321a02 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 23:00:14 +0800 Subject: [PATCH 0077/4278] PUB:20180404 Emacs -5- Documents and Presentations with org-mode.md @oneforalone https://linux.cn/article-10340-1.html --- ...0180404 Emacs -5- Documents and Presentations with org-mode.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180404 Emacs -5- Documents and Presentations with org-mode.md (100%) diff --git a/translated/tech/20180404 Emacs -5- Documents and Presentations with org-mode.md b/published/20180404 Emacs -5- Documents and Presentations with org-mode.md similarity index 100% rename from translated/tech/20180404 Emacs -5- Documents and Presentations with org-mode.md rename to published/20180404 Emacs -5- Documents and Presentations with org-mode.md From 72e45075741d7dec39dff3c040df4d19295d82ca Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 12 Dec 2018 23:01:02 +0800 Subject: [PATCH 0078/4278] PRF:20180404 Emacs -5- Documents and Presentations with org-mode.md --- ...80404 Emacs -5- Documents and Presentations with org-mode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180404 Emacs -5- Documents and Presentations with org-mode.md b/published/20180404 Emacs -5- Documents and Presentations with org-mode.md index 9ed04db2cb..5082ec2fc9 100644 --- a/published/20180404 Emacs -5- Documents and Presentations with org-mode.md +++ b/published/20180404 Emacs -5- Documents and Presentations with org-mode.md @@ -1,4 +1,4 @@ -Emacs 系列(五):org 模式之文档与演示稿 +Emacs 系列(五):Org 模式之文档与演示稿 ====== 这是 [Emacs 和 Org 模式系列][20]的第五篇。 From 736866a3ca27f2edb8191feaf85029b086ca3e5d Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 13 Dec 2018 08:54:41 +0800 Subject: [PATCH 0079/4278] translated --- ... a containerized machine learning model.md | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) rename {sources => translated}/tech/20181102 Create a containerized machine learning model.md (59%) diff --git a/sources/tech/20181102 Create a containerized machine learning model.md b/translated/tech/20181102 Create a containerized machine learning model.md similarity index 59% rename from sources/tech/20181102 Create a containerized machine learning model.md rename to translated/tech/20181102 Create a containerized machine learning model.md index d0a57d0b72..7c48ba6af7 100644 --- a/sources/tech/20181102 Create a containerized machine learning model.md +++ b/translated/tech/20181102 Create a containerized machine learning model.md @@ -7,46 +7,46 @@ [#]: author: (Sven Bösiger) [#]: url: ( ) -Create a containerized machine learning model +创建一个容器化的机器学习模型 ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/10/machinelearning-816x345.jpg) -After data scientists have created a machine learning model, it has to be deployed into production. To run it on different infrastructures, using containers and exposing the model via a REST API is a common way to deploy a machine learning model. This article demonstrates how to roll out a [TensorFlow][1] machine learning model, with a REST API delivered by [Connexion][2] in a container with [Podman][3]. +数据科学家在创建机器学习模型后,必须将其部署到生产中。要在不同的基础架构上运行它,使用容器并通过 REST API 公开模型是部署机器学习模型的常用方法。本文演示了如何在 [Podman][3] 容器中使用 [Connexion][2] 推出使用 REST API 的 [TensorFlow][1] 机器学习模型。 -### Preparation +### 准备 -First, install Podman with the following command: +首先,使用以下命令安装 Podman: ``` sudo dnf -y install podman ``` -Next, create a new folder for the container and switch to that directory. +接下来,为容器创建一个新文件夹并切换到该目录。 ``` mkdir deployment_container && cd deployment_container ``` -### REST API for the TensorFlow model +### TensorFlow 模型的 REST API -The next step is to create the REST-API for the machine learning model. This [github repository][4] contains a pretrained model, and well as the setup already configured for getting the REST API working. +下一步是为机器学习模型创建 REST API。这个 [github 仓库][4]包含一个预训练模型,以及能让 REST API 工作的设置。 -Clone this in the deployment_container directory with the command: +使用以下命令在 deployment_container 目录中克隆它: ``` git clone https://github.com/svenboesiger/titanic_tf_ml_model.git ``` -#### prediction.py & ml_model/ +#### prediction.py 和 ml_model/ -The [prediction.py][5] file allows for a Tensorflow prediction, while the weights for the 20x20x20 neural network are located in folder [ml_model/][6]. +[prediction.py][5] 能进行 Tensorflow 预测,而 20x20x20 神经网络的权重位于文件夹 [ml_model/][6] 中。 #### swagger.yaml -The file swagger.yaml defines the API for the Connexion library using the [Swagger specification][7]. This file contains all of the information necessary to configure your server to provide input parameter validation, output response data validation, URL endpoint definition. +swagger.yaml 使用 [Swagger规范][7] 定义 Connexion 库的 API。此文件包含让你的服务器提供输入参数验证、输出响应数据验证、URL 端点定义所需的所有信息。 -As a bonus Connexion will provide you also with a simple but useful single page web application that demonstrates using the API with JavaScript and updating the DOM with it. +额外地,Connexion 还将给你提供一个简单但有用的单页 Web 应用,它演示了如何使用 Javascript 调用 API 和更新 DOM。 ``` swagger: "2.0" @@ -85,9 +85,9 @@ definitions: type: object ``` -#### server.py & requirements.txt +#### server.py 和 requirements.txt -[server.py][8] defines an entry point to start the Connexion server. +[server.py][8] 定义了启动 Connexion 服务器的入口点。 ``` import connexion @@ -100,7 +100,7 @@ if __name__ == '__main__': app.run(debug=True) ``` -[requirements.txt][9] defines the python requirements we need to run the program. +[requirements.txt][9] 定义了运行程序所需的 python 包。 ``` connexion @@ -108,9 +108,9 @@ tensorflow pandas ``` -### Containerize! +### 容器化! -For Podman to be able to build an image, create a new file called “Dockerfile” in the **deployment_container** directory created in the preparation step above: +为了让 Podman 构建映像,请在上面的准备步骤中创建的 **deployment_container** 目录中创建一个名为 “Dockerfile” 的新文件: ``` FROM fedora:28 @@ -143,25 +143,25 @@ WORKDIR /titanic_tf_ml_model CMD python3 server.py ``` -Next, build the container image with the command: +接下来,使用以下命令构建容器镜像: ``` podman build -t ml_deployment . ``` -### Run the container +### 运行容器 -With the Container image built and ready to go, you can run it locally with the command: +随着容器镜像的构建和准备就绪,你可以使用以下命令在本地运行它: ``` podman run -p 5000:5000 ml_deployment ``` -Navigate to [http://0.0.0.0:5000/ui][10] in your web browser to access the Swagger/Connexion UI and to test-drive the model: +在 Web 浏览器中输入 [http://0.0.0.0:5000/ui][10] 访问 Swagger/Connexion UI 并测试模型: ![][11] -Of course you can now also access the model with your application via the REST-API. +当然,你现在也可以在应用中通过 REST API 访问模型。 -------------------------------------------------------------------------------- @@ -170,7 +170,7 @@ via: https://fedoramagazine.org/create-containerized-machine-learning-model/ 作者:[Sven Bösiger][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/) 荣誉推出 @@ -187,4 +187,4 @@ via: https://fedoramagazine.org/create-containerized-machine-learning-model/ [8]: https://github.com/svenboesiger/titanic_tf_ml_model/blob/master/server.py [9]: https://github.com/svenboesiger/titanic_tf_ml_model/blob/master/requirements.txt [10]: http://0.0.0.0:5000/ -[11]: https://fedoramagazine.org/wp-content/uploads/2018/10/Screenshot-from-2018-10-27-14-46-56-682x1024.png +[11]: https://fedoramagazine.org/wp-content/uploads/2018/10/Screenshot-from-2018-10-27-14-46-56-682x1024.png \ No newline at end of file From b55ab150a61b9565351f2fe07954dae308e46c42 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 13 Dec 2018 08:57:51 +0800 Subject: [PATCH 0080/4278] translating --- ... to Install Putty on Ubuntu and Other Linux Distributions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md b/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md index 1b92a73645..2c7805cbf2 100644 --- a/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md +++ b/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f19890e1e5f4d31e7e206f08af46986a338bbd28 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 13 Dec 2018 12:09:12 +0800 Subject: [PATCH 0081/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Top=205=20confi?= =?UTF-8?q?guration=20management=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...12 Top 5 configuration management tools.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20181212 Top 5 configuration management tools.md diff --git a/sources/tech/20181212 Top 5 configuration management tools.md b/sources/tech/20181212 Top 5 configuration management tools.md new file mode 100644 index 0000000000..72aebb209a --- /dev/null +++ b/sources/tech/20181212 Top 5 configuration management tools.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 configuration management tools) +[#]: via: (https://opensource.com/article/18/12/configuration-management-tools) +[#]: author: (Marco Bravo https://opensource.com/users/marcobravo) + +Top 5 configuration management tools +====== +Learn about configuration management tools and figure out which will work best for your DevOps organization. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) + +DevOps is evolving and gaining traction as organizations discover how it enables them to produce better applications and reduce their software products' time to market. + +[DevOps' core values][1] are Culture, Automation, Measurement, and Sharing (CAMS), and an organization's adherence to them influences how successful it is. + + * **Culture** brings people and processes together; + * **Automation** creates a fabric for DevOps; + * **Measurement** permits improvements; and + * **Sharing** enables the feedback loop in the CAMS cycle. + + + +Another DevOps concept is the idea that almost everything can be managed in code: servers, databases, networks, log files, application configurations, documentation, automated tests, deployment processes, and more. + +In this article, I'll focus on one aspect of automation: Configuration management. As part of [Infrastructure as Code][2] (IaC), configuration management tools enable the use of tested and proven software development practices for managing and provisioning data centers through plaintext definition files. + +By manipulating simple configuration files, a DevOps team can use application development best practices, such as version control, testing, small deployments, and design patterns. In short, this means code can be written to provision and manage an infrastructure as well as automate processes. + +### Why use configuration management tools? + +Configuration management tools enable changes and deployments to be faster, repeatable, scalable, predictable, and able to maintain the desired state, which brings controlled assets into an expected state. + +Some advantages of using configuration management tools include: + + * Adherence to coding conventions that make it easier to navigate code + * Idempotency, which means that the end state remains the same, no matter how many times the code is executed + * Distribution design to improve managing large numbers of remote servers + + + +Some configuration management tools use a pull model, in which an agent installed on the servers runs periodically to pull the latest definitions from a central repository and apply them to the server. Other tools use a push model, where a central server triggers updates to managed servers. + +### Top 5 configuration management tools + +There are a variety of configuration management tools available, and each has specific features that make it better for some situations than others. Yet the top five configuration management tools, presented below in alphabetical order, have several things in common that I believe are essential for DevOps success: all have an open source license, use externalized configuration definition files, run unattended, and are scriptable. All of the descriptions are based on information from the tools' software repositories and websites. + +#### Ansible + +"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications—automate in a language that approaches plain English, using SSH, with no agents to install on remote systems." —[GitHub repository][3] + +Ansible is one of my favorite tools; I started using it several years ago and fell in love with it. You can use Ansible to execute the same command for a list of servers from the command line. You can also use it to automate tasks using "playbooks" written into a YAML file, which facilitate communication between teams and non-technical people. Its main advantages are that it is simple, agentless, and easy to read (especially for non-programmers). + +Because agents are not required, there is less overhead on servers. An SSH connection is necessary when running in push mode (which is the default), but pull mode is available if needed. [Playbooks][4] can be written with a minimal set of commands or they can be scaled for more elaborate automation tasks that could include roles, variables, and modules written by other people. + +You can combine Ansible with other tools to create a central console to control processes. Those tools include Ansible Works (AWX), Jenkins, RunDeck, and [ARA][5], which offers [traceability when running playbooks][6]. + +### CFEngine + +"CFEngine 3 is a popular open source configuration management system. Its primary function is to provide automated configuration and maintenance of large-scale computer systems." —[GitHub repository][7] + +CFEngine was introduced by Mark Burgess in 1993 as a scientific approach to automated configuration management. The goal was to deal with the entropy in computer systems' configuration and resolve it with end-state "convergence." Convergence means a desired end-state and elaborates on idempotence as a capacity to reach the desired end-state. Burgess' research evolved in 2004 when he proposed the [Promise theory][8] as a model of voluntary cooperation between agents. + +The current version of CFEngine incorporates Promise theory and uses agents running on each server that pull the configuration from a central repository. It requires some expert knowledge to deal with configurations, so it's best suited for technical people. + +### Chef + +"A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure." —[GitHub repository][9] + +Chef uses "recipes" written in Ruby to keep your infrastructure running up-to-date and compliant. The recipes describe a series of resources that should be in a particular state. Chef can run in client/server mode or in a standalone configuration named [chef-solo][10]. It has good integration with the major cloud providers to automatically provision and configure new machines. + +Chef has a solid user base and provides a full toolset to allow people with different technical backgrounds and skills to interact around the recipes. But, at its base, it is more technically oriented tool. + +### Puppet + +"Puppet, an automated administrative engine for your Linux, Unix, and Windows systems, performs administrative tasks (such as adding users, installing packages, and updating server configurations) based on a centralized specification." —[GitHub repository][11] + +Conceived as a tool oriented toward operations and sysadmins, Puppet has consolidated as a configuration management tool. It usually works in a client-server architecture, and an agent communicates with the server to fetch configuration instructions. + +Puppet uses a declarative language or Ruby to describe the system configuration. It is organized in modules, and manifest files contain the desired-state goals to keep everything as required. Puppet uses the push model by default, and the pull model can be configured. + +### Salt + +"Software to automate the management and configuration of any infrastructure or application at scale." — [GitHub repository][12] + +Salt was created for high-speed data collection and scale beyond tens of thousands of servers. It uses Python modules to handle configuration details and specific actions. These modules manage all of Salt's remote execution and state management behavior. Some level of technical skills are required to configure the modules. + +Salt uses a client-server topology (with the Salt master as server and Salt minions as clients). Configurations are kept in Salt state files, which describe everything required to keep a system in the desired state. + +### Conclusion + +The landscape of DevOps tools is evolving all the time, and it is important to keep an eye on the changes. I hope this article will encourage you to explore these concepts and tools further. If so, the Cloud Native Computing Foundation (CNCF) maintains a good reference in the [Cloud Native Landscape Project][13]. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/configuration-management-tools + +作者:[Marco Bravo][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://www.oreilly.com/learning/why-use-terraform +[2]: https://www.oreilly.com/library/view/infrastructure-as-code/9781491924334/ch04.html +[3]: https://github.com/ansible/ansible +[4]: https://opensource.com/article/18/8/ansible-playbooks-you-should-try +[5]: https://github.com/openstack/ara +[6]: https://opensource.com/article/18/5/analyzing-ansible-runs-using-ara +[7]: https://github.com/cfengine/core +[8]: https://en.wikipedia.org/wiki/Promise_theory +[9]: https://github.com/chef/chef +[10]: https://docs.chef.io/chef_solo.html +[11]: https://github.com/puppetlabs/puppet +[12]: https://github.com/saltstack/salt +[13]: https://github.com/cncf/landscape From 0aa789c045caa50a8d1ddf082c75098212df9a60 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 13 Dec 2018 12:10:55 +0800 Subject: [PATCH 0082/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Patch=20into=20?= =?UTF-8?q?The=20Matrix=20at=20the=20Linux=20command=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...to The Matrix at the Linux command line.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/tech/20181212 Patch into The Matrix at the Linux command line.md diff --git a/sources/tech/20181212 Patch into The Matrix at the Linux command line.md b/sources/tech/20181212 Patch into The Matrix at the Linux command line.md new file mode 100644 index 0000000000..c07e71fc28 --- /dev/null +++ b/sources/tech/20181212 Patch into The Matrix at the Linux command line.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Patch into The Matrix at the Linux command line) +[#]: via: (https://opensource.com/article/18/12/linux-toy-cmatrix) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Patch into The Matrix at the Linux command line +====== +Recreate the classic look and feel of everyone's favorite 1990s sci-fi movie code scroller with cmatrix. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cmatrix.png?itok=YlmbHVPr) + +You've found your way to today's entry from the Linux command-line toys advent calendar. If this is your first visit to the series, you might be wondering what a command-line toy even is? It's anything that's an entertaining diversion at the terminal, be it a game, a fun utility, or a simple distraction. + +Some of these are classics, and some are completely new (at least to me), but I hope all of you find something you enjoy in this series. + +As we come to the close of another year, it's a good time for looking back, and looking forward. What will 2019 hold for you? What does it mean to be 2019? + +I'm reminded that 2019 will mark the twentieth anniversary of one of my favorite science fiction movies from my teenage years, that at the time had me thinking a lot about what the future would hold: [The Matrix][1]. For a computer nerd kid like me, it was the ultimate story of a computer programmer rising up and becoming an action hero in a virtual universe by tapping into the power of his mind. + +At the time, there was no movie that seemed more futuristic to me; both in the story itself, and in the mesmerizing special effects. Realizing that it was filmed over twenty years ago doesn't change that in my mind. + +Bringing it back to our command-line toy for today, let's recreate the downward flowing code of the Matrix at our terminal with **cmatrix**. **cmatrix** was an easy install for me, packaged for Fedora, so installing it took simply: + +``` +$ dnf install cmatrix +``` + +Then, just type **cmatrix **at your terminal to run. +![](https://opensource.com/sites/default/files/uploads/linux-toy-cmatrix-animated.gif) +You can find the source code for **** **cmatrix** [on GitHub][2] under a GPL license. + +Do you have a favorite command-line toy that you think I ought to include? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Winterize your Bash prompt in Linux][3], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-cmatrix + +作者:[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://en.wikipedia.org/wiki/The_Matrix +[2]: https://github.com/abishekvashok/cmatrix +[3]: https://opensource.com/article/18/12/linux-toy-bash-prompt From 28f5cd2500dcdbba06bced3225f95d5fef3a2f61 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 13 Dec 2018 12:21:33 +0800 Subject: [PATCH 0083/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20What=20is=20PPA?= =?UTF-8?q?=3F=20Everything=20You=20Need=20to=20Know=20About=20PPA=20in=20?= =?UTF-8?q?Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ing You Need to Know About PPA in Linux.md | 315 ++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md diff --git a/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md new file mode 100644 index 0000000000..194dc31ef3 --- /dev/null +++ b/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @@ -0,0 +1,315 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is PPA? Everything You Need to Know About PPA in Linux) +[#]: via: (https://itsfoss.com/ppa-guide/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What is PPA? Everything You Need to Know About PPA in Linux +====== + +**Brief: An in-depth article that covers almost all the questions around using PPA in Ubuntu and other Linux distributions.** + +If you have been using Ubuntu or some other Linux distribution based on Ubuntu such as Linux Mint, Linux Lite, Zorin OS etc, you may have come across three magical lines of this sort: + +``` +sudo add-apt-repository ppa:dr-akulavich/lighttable +sudo apt-get update +sudo apt-get install lighttable-installer +``` + +A number of websites suggest these kind of lines to [install applications in Ubuntu][1]. This is what is called installing an application using PPA. + +But what is PPA? Why is it used? Is it safe to use PPA? How to properly use PPA? How to delete a PPA? + +I’ll answer all of the above questions in this detailed guide. Even if you already know a few things about PPAs, I am sure this article will still add to your knowledge. + +Do note that I am writing this article using Ubuntu. Therefore I’ll use the term Ubuntu almost everywhere but the explanations and steps are also applicable to other Debian/Ubuntu based distributions. + +### What is PPA? Why is it used? + +![Everything you need to know about PPA in Ubuntu Linux][2] + +PPA stands for Personal Package Archive. + +Does that make sense? Probably not. + +Before you understand PPA, you should know the concept of repositories in Linux. I won’t go into details here though. + +#### Concept of repositories and package management + +A repository is a collection of files that has information about various software, their versions and some other details like the checksum. Each Ubuntu version has its own official set of four repositories: + + * **Main** – Canonical-supported free and open-source software. + + * **Universe** – Community-maintained free and open-source software. + + * **Restricted** – Proprietary drivers for devices. + + * **Multiverse** – Software restricted by copyright or legal issues. + + + + +You can see such repositories for all Ubuntu versions [here][3]. You can browse through them and also go to the individual repositories. For example, Ubuntu 16.04 main repository can be found [here][4]. + +So basically it’s a web URL that has information about the software. How does your system know where are these repositories? + +This information is stored in the sources.list file in the directory /etc/apt. If you look at its content, you’ll see that it has the URL of the repositories. The lines with # at the beginning are ignored. + +Now when you run the command sudo apt update, your system uses [APT tool][5] to check against the repo and stores the information about the software and their version in a cache. When you use the command sudo apt install package_name, it uses the information to get that package from the URL where the actual software is stored. + +If the repository doesn’t have the information about a certain package, you’ll see an error like: + +``` +E: Unable to locate package +``` + +At this point, I recommend reading my [guide to using apt commands][6]. This will give you a much better understanding of apt commands, update etc. + +So this was about repositories. But what is PPA? How does it enter into the picture? + +#### Why is PPA used? + +As you can see, Ubuntu controls what software and more importantly which version of a software you get on your system. But imagine if a software developer releases a new version of the software. + +Ubuntu won’t make it available immediately. There is a procedure to check if the new version of the software is compatible with the system or not. This ensures the stability of the system. + +But this also means that it will be some weeks or in some cases, some months before it is made available by Ubuntu. Not everyone would want to wait that long to get their hands on the new version of their favorite software. + +Similarly, suppose someone develops a software and wants Ubuntu to include that software in the official repositories. It again will take months before Ubuntu makes a decision and includes it in the official repositories. + +Another case would be during beta testing. Even if a stable version of the software is available in the official repositories, a software developer may want some end users to test their upcoming release. How do they enable the end user to beta test the upcoming release? + +Enter PPA! + +### How to use PPA? How does PPA work? + +[PPA][7], as I already told you, means Personal Package Archive. Mind the word ‘Personal’ here. That gives the hint that this is something exclusive to a developer and is not officially endorsed by the distribution. + +Ubuntu provides a platform called Launchpad that enables software developers to create their own repositories. An end user i.e. you can add the PPA repository to your sources.list and when you update your system, your system would know about the availability of this new software and you can install it using the standard sudo apt install command like this. + +`sudo add-apt-repository ppa:dr-akulavich/lighttable` +`sudo apt-get update` +`sudo apt-get install lighttable-installer` + +To summarize: + + * sudo add-apt-repository <– This command adds the PPA repository to the list. + * sudo apt-get update <– This command updates the list of the packages that can be installed on the system. + * sudo apt-get install <– This command installs the package. + + + +You see that it is important to use the command sudo apt update or else your system will not know when a new package is available. + +Now let’s take a look at the first command in a bit more detail. + +``` +sudo add-apt-repository ppa:dr-akulavich/lighttable +``` + +You would notice that this command doesn’t have a URL to the repository. This is because the tool has been designed to abstract the information about URL from you. + +Just a small note. If you add ppa:dr-akulavich/lighttable, you get Light Table. But if you add ppa:dr-akulavich, you’ll get all the repository or packages mentioned in the ‘upper repository’. It’s hierarchical. + +Basically, when you add a PPA using add-apt-repository, it will do the same action as if you manually run these commands: + +``` +deb http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main +deb-src http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main +``` + +The above two lines are the traditional way to add any repositories to your sources.list. But PPA does it automatically for you, without wondering about the exact repository URL and operating system version. + +One important thing to not here is that when you use PPA, it doesn’t change your original sources.list. Instead, it creates two files in /etc/apt/sources.d directory, a list and a back up file with suffix ‘save’. + +![Using a PPA in Ubuntu][8]PPA create separate sources.list + +The files with suffix ‘list’ has the command that adds the information about the repository. + +![PPA add repository information][9]Content of source.list of a PPA + +This is a safety measure to ensure that adding PPAs don’t mess with the original sources.list. It also helps in removing the PPA. + +#### Why PPA? Why not DEB packages? + +You may ask why should you use PPA when it involves using command line which might not be preferred by everyone. Why not just distribute a DEB package that can be installed graphically? + +The answer lies in the update procedure. If you install a software using a DEB package, there is no guarantee that the installed software will be updated to a newer version when you run sudo apt update && sudo apt upgrade. + +It’s because the apt upgrade procedure relies on the sources.list. If there is no entry for a software, it doesn’t get the update via the standard software updater. + +So does it mean software installed using DEB never gets an update? No, not really. It depends on how the package was created. + +Some developers automatically add an entry to the sources.list and then it is updated like a regular software. Google Chrome is one such example. + +Some software would notify you of availability of a new version when you try to run it. You’ll have to download the new DEB package and run it again to update the current software to a newer version. Oracle Virtual Box is an example in this case. + +For the rest of the DEB packages, you’ll have to manually look for an update and this is not convenient, especially if your software is meant for beta testers. You need to add more updates frequently. This is where PPA come to the rescue. + +#### Offical PPA vs unofficial PPA + +You may also hear the term official PPA or unofficial PPA. What’s the difference? + +When developers create PPA for their software, it is called the official PPA. Quite obviously because it is coming from none other than the project developers. + +But at times, individuals create PPA of projects that were created by other developers. + +Why would someone do that? Because many developers just provide the source code of the software and you know that [installing software from source code in Linux][10] is a pain and not everyone could or would do that. + +This is why volunteers take it upon themselves to create a PPA from those source code so that other users can install the software easily. After all, using those 3 lines is a lot easier than battling the source code installation. + +#### Make sure that a PPA is available for your distribution version + +When it comes to using PPA in Ubuntu or any other Debian based distribution, there are a few things you should keep in mind. + +Not every PPA is available for your particular version. You should know [which Ubuntu version][11] you are using. The codename of the release is important because when you go to the webpage of a certain PPA, you can see which Ubuntu versions are supported by the PPA. + +For other Ubuntu-based distributions, you can check the content of /etc/os-release to [find out the Ubuntu version][11] information. + +![Verify PPA availability for Ubuntu version][12]Check if PPA is available for your Ubuntu version + +How to know the PPA url? Simply search on the internet with the PPA name like ppa:dr-akulavich/lighttable and you’ll get the first result from [Launchpad][13], the official platform for hosting PPA. You can also go to Launchpad and search for the required PPA directly there. + +If you don’t verify and add the PPA, you may see an error like this when you try to install a software not available for your version. + +``` +E: Unable to locate package +``` + +What’s worse is that since it has been added to your source.list, each time you run software updater, you’ll see an error “[Failed to download repository information][14]“. + +![Failed to download repository information Ubuntu 13.04][15] + +If you run sudo apt update in the terminal, the error will have more details about which repository is causing the trouble. You can see something like this in the end of the output of sudo apt update: + +``` +W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main/binary-i386/Packages  404  Not Found +E: Some index files failed to download. They have been ignored, or old ones used instead. +``` + +Which is self-explanatory because the system cannot find the repository for your version. Remember what we saw earlier about repository structure? APT will try to look for software information in the place /ubuntu/dists/Ubuntu_Version + +And if the PPA for the specific version is not available, it will never be able to open the URL and you get the famous 404 error. + +#### Why are PPAs not available for all the Ubuntu release versions? + +It is because someone has to compile the software and create a PPA out of it on the specific versions. Considering that a new Ubuntu version is released every six months, it’s a tiresome task to update the PPA for every Ubuntu release. Not all developers have time to do that. + +#### How to install the application if PPA is not available for your version? + +It is possible that though the PPA is not available for your Ubuntu version, you could still download the DEB file and install the application + +Let’s say that you go to the Light Table PPA. Using the knowledge about PPA you just learned, you realize that the PPA is not available for your specific Ubuntu release. + +What you can do is to click on the ‘View package details’. + +![Get DEB file from PPA][16] + +And in here, you can click on a package to reveal more details. You’ll also find the source code and the DEB file of the package here. + +![Download DEB file from PPA][17] + +I advise [using Gdebi to install these DEB files][18] instead of the Software Center because Gdebi is a lot better at handling dependencies. + +Do note that the package installed this way might not get any future updates. + +I think you have read enough about adding PPAs. How about removing a PPA and the software installed by it? + +### How to delete PPA? + +I have written about [deleting PPA][19] in the past. I am going to describe the same methods here as well. + +I advise deleting the software that you installed from a PPA before removing the PPA. If you just remove the PPA, the installed software remains in the system but it won’t get any updates. You wouldn’t want that, would you? + +So, the question comes, how to know which application was installed by which PPA? + +#### Find packages installed by a PPA and remove them + +Ubuntu Software Center doesn’t help here. You’ll have to use Synaptic package manager here which has more advanced features. + +You can install Synaptic from Software Center or use the command below: + +``` +sudo apt install synaptic +``` + +Once installed, start Synaptic package manager and select Origin. You’ll see various repositories added to the system. PPA entries will be labeled with prefix PPA. Click on them to see the packages that are available by the PPA. Installed software will have appropriate symbol before it. + +![Managing PPA with Synaptic package manager][20]Find packages installed via a PPA + +Once you have found the packages, you can delete them from Synaptic itself. Otherwise, you always have the option to use the command line: + +``` +sudo apt remove package_name +``` + +Once you have removed the packages installed by a PPA, you can continue to remove the PPA from your sources.list. + +#### Remove a PPA graphically + +Go to Software & Updates and then go to tab Other Software. Look for the PPA that you want to remove: + +![Delete a PPA from Software Source][21] + +You have two options here. Either you deselect the PPA or you choose the Remove option. + +The difference is that when you deselect a PPA entry, your system will comment out the repository entry in its ppa_name.list file in /etc/apt/sources.list.d but if you choose the Remove option, it will delete the repository entry from its ppa_name.list file in /etc/apt/sources.list.d directory. + +In both the cases, the files ppa_name.list remains in the said directory, even if it is empty. + +### Is it safe to use PPA? + +It is a subjective question. Purists abhor PPA because most of the time PPAs are from third-party developers. But at the same time, PPAs are popular in the Debian/Ubuntu world as they provide an easier installation option. + +As far as the security is concerned, it’s less likely that you use a PPA and your Linux system is hacked or injected with malware. I don’t recall such an incident ever happened so far. + +Official PPAs can be used without thinking twice. Using unofficial PPA is entirely your decision. + +As a rule of thumb, you should avoid installing a program via a third party PPA if it the program requires sudo access to run. + +### What do you think about using PPA? + +I know it’s a long read but I wanted to give you a better understanding of PPA. I hope this detailed guide answered most of your questions about using PPA. + +If you have more questions about PPA, please feel free to ask in the comment section. + +If you notice any technical or grammatical error or if you have suggestions for improving this article, please let me know. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ppa-guide/ + +作者:[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://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/what-is-ppa.png?resize=800%2C450&ssl=1 +[3]: http://archive.ubuntu.com/ubuntu/dists/ +[4]: http://archive.ubuntu.com/ubuntu/dists/xenial/main/ +[5]: https://wiki.debian.org/Apt +[6]: https://itsfoss.com/apt-command-guide/ +[7]: https://launchpad.net/ubuntu/+ppas +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-sources-list-files.png?resize=800%2C259&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/content-of-ppa-list.png?ssl=1 +[10]: https://itsfoss.com/install-software-from-source-code/ +[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/12/verify-ppa-availibility-version.jpg?resize=800%2C481&ssl=1 +[13]: https://launchpad.net/ +[14]: https://itsfoss.com/failed-to-download-repository-information-ubuntu-13-04/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/04/Failed-to-download-repository-information-Ubuntu-13.04.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa.jpg?resize=800%2C483&ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa-2.jpg?resize=800%2C477&ssl=1 +[18]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ +[19]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-synaptic-manager.jpeg?resize=800%2C394&ssl=1 +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2012/08/Delete-a-PPA.jpeg?ssl=1 From 13ff6637819c36727ddefbb0ce96c75599111d26 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Thu, 13 Dec 2018 12:38:47 +0800 Subject: [PATCH 0084/4278] Translating by qhwdw --- sources/tech/20180911 Know Your Storage- Block, File - Object.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180911 Know Your Storage- Block, File - Object.md b/sources/tech/20180911 Know Your Storage- Block, File - Object.md index 24f179d9d5..0b7c2cc338 100644 --- a/sources/tech/20180911 Know Your Storage- Block, File - Object.md +++ b/sources/tech/20180911 Know Your Storage- Block, File - Object.md @@ -1,3 +1,4 @@ +Translating by qhwdw Know Your Storage: Block, File & Object ====== From ccd64b8fa7072bde0c70959003aa18b5198046ed Mon Sep 17 00:00:00 2001 From: qhwdw Date: Thu, 13 Dec 2018 12:42:49 +0800 Subject: [PATCH 0085/4278] Translating by qhwdw --- sources/tech/20181210 How to get started in AI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181210 How to get started in AI.md b/sources/tech/20181210 How to get started in AI.md index b0ac291557..0dfb5761aa 100644 --- a/sources/tech/20181210 How to get started in AI.md +++ b/sources/tech/20181210 How to get started in AI.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f2dfbd01027a7b24d6e0d856d9fc21220b9d1cfa Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 13 Dec 2018 13:24:19 +0800 Subject: [PATCH 0086/4278] Check translation of 7 command-line tools for writers. --- ...line tools for writers - Opensource.com.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md index ead46909ff..2073fd9279 100644 --- a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md +++ b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md @@ -1,9 +1,9 @@ 给写作者们的 7 个命令行工具 | Opensource.com ====== -扔掉你的打字机,然后使用这些开源工具在命令行上编辑吧。 +扔掉你的打字机,然后使用这些开源工具在命令行上写作吧。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE) -对于大多数人(尤其是非技术人员),写作意味着在 LibreOffice Writer 或者其他带图形界面的文本编辑器上编辑文本。但是还有很多可行的方法可以让任何人通过文本传递他们的信息,尤其是越来越多的作者选择[拥抱纯文本][1]。 +对于大多数人(尤其是非技术人员),写作意味着在 LibreOffice Writer 或者其他带图形界面的文本编辑器上编辑文本。但是还有许多可行的方法可以让任何人通过文本传递他们的信息,尤其是越来越多的作者选择[拥抱纯文本][1]。 在使用图形界面写作的世界同样有命令行工具的一席之地。这些命令行工具可以帮助他们进行写作,检查他们的拼写等等——无论是在写一篇文章、博客或者故事;写一个 README 文件;或者准备一份技术文档的时候。 @@ -11,9 +11,9 @@ ### 编辑器 -没错,你_可以_在命令行进行真正的写作。我知道一些写作者会使用 [Nano][2]、[Vim][3]、[Emacs][4]、以及 [Jove][5] 等编辑器在终端窗口中进行工作。而这些编辑器并不是[aren't the only games in town][6]。文本编辑器的优势在于它们简单易用和专注。它们非常适合于编辑任何文本的初稿甚至完成一个漫长而复杂的写作项目。 +没错,你可以在命令行进行真正的写作。我知道一些写作者会使用 [Nano][2]、[Vim][3]、[Emacs][4]、以及 [Jove][5] 等编辑器在终端窗口中进行工作。而这些编辑器[并非屈指可数][6]。文本编辑器的优势在于它们简单易用以及更专注于文本。非常适合用于编辑任何文本的初稿甚至完成一个漫长而复杂的写作项目。 -如果你想在命令行中获得更像文字编辑器的体验,不妨了解一下[WordGrinder][7]。WordGrinder 是一款简单但拥有足够的编写和发布功能的文字编辑器。它支持基本的格式和样式,并且你可以将你的文字以 Markdown, ODT, LaTeX, 以及 HTML等格式导出。 +如果你想在命令行中获得更像文字编辑器的体验,不妨了解一下 [WordGrinder][7]。WordGrinder 是一款简单但拥有足够的编写和发布功能的文字编辑器。它支持基本的格式和样式,并且你可以将你的文字以 Markdown,ODT,LaTeX,或者 HTML 等格式导出。 ### 拼写检查 @@ -25,19 +25,19 @@ ### Prose linters -软件开发人员使用[linters][11]来检查他们的代码是否存在错误或者 bugs。同样也有用于检查文本样式或语法错误的linters;而命令行会认为这些错误是_样式元素_。任何写作者都可以(也应该)使用它,一个 prose linter 对于要求文档风格和样式一致的文档团队项目而言尤其有用。 +软件开发人员使用 [linters][11] 来检查他们的代码是否存在错误或者 bugs。同样也有用于检查文本样式或语法错误的 linters;而命令行会认为这些错误是样式元素。任何写作者都可以(也应该)使用它,一个 prose linter 对于要求文档风格和样式一致的文档团队项目而言尤其有用。 -[Proselint][12]是一款全能的实时检查工具。它会找出行话,大话,不正确日期和时间格式,滥用的术语[等等][13]。它也很容易运行并忽略文本中的标记。 +[Proselint][12] 是一款全能的实时检查工具。它会找出行话,大话,不正确日期和时间格式,滥用的术语[等等][13]。它也很容易运行并忽略文本中的标记。 -[Alex][14] 是一个简单但有用的 prose linter。 对明文文本或者格式为Markdown或HTML的文档使用它。 Alex 会对 “性别偏好,极端主义,种族相关,宗教,或者文章中其他不平等的措辞” 产生警告。 如果你想要试试看 Alex,这里有一个在线[demo][15]. +[Alex][14] 是一个简单但有用的 prose linter。 对明文文本或者格式为 Markdown 或 HTML 的文档使用它。Alex 会对“性别偏好,极端主义,种族相关,宗教,或者文章中其他不平等的措辞”产生警告。如果你想要试试看 Alex,这里有一个在线 [demo][15]。 ### 其他工具 -有时候你找不到一个单词的恰当的同义词。但你不需要去呆板的词库中抓取或者去专门的网站完善你的单词完整。仅仅需要对你想要替换的单词运行[Aiksaurus][16],然后它就会为你完成这个工作。但是,这个程序最大的缺点是它只支持英语。 +有时候你找不到一个单词的恰当的同义词。但你不需要去呆板的词库中抓取或者去专门的网站完善你的单词完整。仅仅需要对你想要替换的单词运行 [Aiksaurus][16],然后它就会为你完成这个工作。但是,这个程序最大的缺点是它只支持英语。 -即使是只会很少(甚至只有一项)技术技能的写作者都能接受 [Markdown][17] 来快速而简单地格式化他们的作品。但是,有时候你也需要将使用Markdown格式的文件转换成其他格式。这就是[Pandoc][18]的用武之地。你可以用它来将你的文档转换成 HTML, Word, LibreOffice Writer, LaTeX, EPUB以及其他格式。你甚至可以用Pandoc来生成书籍和[研究论文][19]。 +即使是只会很少(甚至只有一项)技术技能的写作者都能接受 [Markdown][17] 来快速而简单地格式化他们的作品。但是,有时候你也需要将使用 Markdown 格式的文件转换成其他格式。这就是 [Pandoc][18] 的用武之地。你可以用它来将你的文档转换成 HTML,Word,LibreOffice Writer,LaTeX,EPUB 以及其他格式。你甚至可以用 Pandoc 来生成书籍和[研究论文][19]。 -你有一个最喜欢的命令行写作工具吗?在Opensource.com社区发表评论分享它。 +你有最喜欢的命令行写作工具吗?在 Opensource.com 社区发表评论分享它吧。 -------------------------------------------------------------------------------- From 6f8d06190e07799f7ca0db0ff87587a3ff4de123 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 13 Dec 2018 16:34:57 +0800 Subject: [PATCH 0087/4278] PRF:20180208 Gathering project requirements using the Open Decision Framework.md @geekpi --- ...t requirements using the Open Decision Framework.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/translated/talk/20180208 Gathering project requirements using the Open Decision Framework.md b/translated/talk/20180208 Gathering project requirements using the Open Decision Framework.md index ea4dced8f8..41416d110a 100644 --- a/translated/talk/20180208 Gathering project requirements using the Open Decision Framework.md +++ b/translated/talk/20180208 Gathering project requirements using the Open Decision Framework.md @@ -1,9 +1,11 @@ -使用开放决策框架收集项目需求 +降低项目失败率的三个原则 ====== +> 透明和包容性的项目要求可以降低您的失败率。 以下是如何协作收集它们。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/suitcase_container_bag.png?itok=q40lKCBY) -众所周知,明确、简洁和可衡量的需求会带来更多成功的项目。一项关于[麦肯锡与牛津大学][1]的大型项目的研究表明:“平均而言,大型 IT 项目超出预算 45%,时间每推移 7%,价值就比预期低 56% “。该研究还表明,造成这种失败的一些原因是“模糊的业务目标,不同步的利益相关者以及过度的返工”。 +众所周知,明确、简洁和可衡量的需求会带来更多成功的项目。一项[麦肯锡与牛津大学][1]的关于大型项目的研究表明:“平均而言,大型 IT 项目超出预算 45%,时间每推移 7%,价值就比预期低 56% 。”该研究还表明,造成这种失败的一些原因是“模糊的业务目标,不同步的利益相关者以及过度的返工。” 业务分析师经常发现自己通过持续对话来构建这些需求。为此,他们必须吸引多个利益相关方,并确保参与者提供明确的业务目标。这样可以减少返工,提高更多项目的成功率。 @@ -29,7 +31,7 @@ via: https://opensource.com/open-organization/18/2/constructing-project-requirem 作者:[Tracy Buckner][a] 译者:[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/) 荣誉推出 @@ -37,4 +39,4 @@ via: https://opensource.com/open-organization/18/2/constructing-project-requirem [1]:http://calleam.com/WTPF/?page_id=1445 [2]:https://opensource.com/open-organization/resources/open-decision-framework [3]:https://opensource.com/open-organization/resources/open-org-definition -[4]:https://opensource.com/open-organization/16/6/introducing-open-decision-framework \ No newline at end of file +[4]:https://opensource.com/open-organization/16/6/introducing-open-decision-framework From 03eca5c9fb7de3093425aa711039bc7fb3980c48 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 13 Dec 2018 16:35:15 +0800 Subject: [PATCH 0088/4278] PUB:20180208 Gathering project requirements using the Open Decision Framework.md @geekpi https://linux.cn/article-10341-1.html --- ...ring project requirements using the Open Decision Framework.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180208 Gathering project requirements using the Open Decision Framework.md (100%) diff --git a/translated/talk/20180208 Gathering project requirements using the Open Decision Framework.md b/published/20180208 Gathering project requirements using the Open Decision Framework.md similarity index 100% rename from translated/talk/20180208 Gathering project requirements using the Open Decision Framework.md rename to published/20180208 Gathering project requirements using the Open Decision Framework.md From 92e61ae3bd4c223039482f569b01f822e6bd8cce Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 13 Dec 2018 16:59:36 +0800 Subject: [PATCH 0089/4278] Delete 20181119 7 command-line tools for writers - Opensource.com.md --- ...line tools for writers - Opensource.com.md | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 sources/tech/20181119 7 command-line tools for writers - Opensource.com.md diff --git a/sources/tech/20181119 7 command-line tools for writers - Opensource.com.md b/sources/tech/20181119 7 command-line tools for writers - Opensource.com.md deleted file mode 100644 index a222389079..0000000000 --- a/sources/tech/20181119 7 command-line tools for writers - Opensource.com.md +++ /dev/null @@ -1,75 +0,0 @@ -Translating by LazyWolfLin - -7 command-line tools for writers | Opensource.com -====== -Put away your word processor and start writing from the command line using these open source tools. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE) - -For most people (especially non-techies), the act of writing means tapping out words using LibreOffice Writer or another GUI word processing application. But there are many other options available to help anyone communicate their message in writing, especially for the growing number of writers [embracing plaintext][1]. - -There's also room in a GUI writer's world for command line tools that can help them write, check their writing, and more—regardless of whether they're banging out an article, blog post, or story; writing a README; or prepping technical documentation. - -Here's a look at some command-line tools that any writer will find useful. - -### Editors - -Yes, you _can_ do actual writing at the command line. I know writers who do their work using editors like [Nano][2], [Vim][3], [Emacs][4], and [Jove][5] in a terminal window. And those editors [aren't the only games in town][6]. Text editors are great because they (at a basic level, anyway) are easy to use and distraction free. They're perfect for tapping out a first draft of anything or even completing a long and complicated writing project. - -If you want a more word processor-like experience at the command line, take a look at [WordGrinder][7] . WordGrinder is a bare-bones word processor, but it has more than enough features for writing and publishing your work. It supports basic formatting and styles, and you can export your writing to formats like Markdown, ODT, LaTeX, and HTML. - -### Spell checkers - -Every writer does (or at least should do) a spelling check on their work at least once. Why? An immutable law of the writing universe states that, no matter how many times you look over your manuscript, a spelling mistake or typo will creep in. - -My favorite command-line spelling checker is [GNU Aspell][8], which I previously [looked at][9] in detail. Aspell checks plaintext documents interactively and not only highlights errors but often puts the best correction at the top of its list of suggestions. Aspell also ignores many markup languages while doing its thing. - -A much older but still useful alternative is [Ispell][10]. It's a bit slower than Aspell, but both utilities work the same way. As you interact with your text file, Ispell suggests corrections. Ispell also has good support for foreign languages. - -### Prose linters - -Software developers use [linters][11] to check their code for errors or bugs. There are also linters for prose that check for style and syntax errors; think of them as the _Elements of Style_ for the command line. While any writer can (and probably should) use one, a prose linter is especially useful for team documentation projects that require a consistent voice and style. - -[Proselint][12] is a comprehensive tool for checking what you're writing. It looks for jargon, hyperbole, incorrect date and time format, misused terms, and [much more][13]. It's also easy to run and ignores markup in a plaintext file. - -[Alex][14] is a simple yet powerful prose linter. Run it against a plaintext document or one formatted with Markdown or HTML. Alex pumps out warnings of "gender favouring, polarising, race related, religion inconsiderate, or other unequal phrasing in text." If you want to give Alex a test drive, there's an [online demo][15]. - -### Other tools - -Sometimes you just can't find the right synonym for a word. But you don't need to grab a "dead tree" thesaurus or go to a dedicated website to perfect your word choice. Just run [Aiksaurus][16] against the word you want to replace, and it does the work for you. This utility's main drawback, though, is that it supports English only. - -Even writers with few (if any) technical skills are embracing [Markdown][17] to quickly and easily format their work. Sometimes, though, you need to convert files formatted with Markdown to something else. That's where [Pandoc][18] comes in. You can use it to convert your documents to HTML, Word, LibreOffice Writer, LaTeX, EPUB, and other formats. You can even use Pandoc to produce books and [research papers][19]. - -Do you have a favorite command-line tool for writing? Share it with the Opensource.com community by leaving a comment. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/11/command-line-tools-writers - -作者:[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://plaintextproject.online -[2]: https://www.nano-editor.org/ -[3]: https://www.vim.org -[4]: https://www.gnu.org/software/emacs/ -[5]: https://opensource.com/article/17/1/jove-lightweight-alternative-vim -[6]: https://en.wikipedia.org/wiki/List_of_text_editors#Text_user_interface -[7]: https://cowlark.com/wordgrinder/ -[8]: http://aspell.net/ -[9]: https://opensource.com/article/18/2/how-check-spelling-linux-command-line-aspell -[10]: https://www.cs.hmc.edu/~geoff/ispell.html -[11]: https://en.wikipedia.org/wiki/Lint_(software) -[12]: http://proselint.com/ -[13]: http://proselint.com/checks/ -[14]: https://github.com/get-alex/alex -[15]: https://alexjs.com/#demo -[16]: http://aiksaurus.sourceforge.net/ -[17]: https://en.wikipedia.org/wiki/Markdown -[18]: https://pandoc.org -[19]: https://opensource.com/article/18/9/pandoc-research-paper From 29a89180632d396f32dfc9fcc217e19ceca64146 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Thu, 13 Dec 2018 21:54:51 +0800 Subject: [PATCH 0090/4278] Translated by qhwdw --- ...Know Your Storage- Block, File - Object.md | 63 ------------------- ...Know Your Storage- Block, File - Object.md | 60 ++++++++++++++++++ 2 files changed, 60 insertions(+), 63 deletions(-) delete mode 100644 sources/tech/20180911 Know Your Storage- Block, File - Object.md create mode 100644 translated/tech/20180911 Know Your Storage- Block, File - Object.md diff --git a/sources/tech/20180911 Know Your Storage- Block, File - Object.md b/sources/tech/20180911 Know Your Storage- Block, File - Object.md deleted file mode 100644 index 0b7c2cc338..0000000000 --- a/sources/tech/20180911 Know Your Storage- Block, File - Object.md +++ /dev/null @@ -1,63 +0,0 @@ -Translating by qhwdw -Know Your Storage: Block, File & Object -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/block2_1920.jpg?itok=s1y6RLhT) - -Dealing with the tremendous amount of data generated today presents a big challenge for companies who create or consume such data. It’s a challenge for tech companies that are dealing with related storage issues. - -“Data is growing exponentially each year, and we find that the majority of data growth is due to increased consumption and industries adopting transformational projects to expand value. Certainly, the Internet of Things (IoT) has contributed greatly to data growth, but the key challenge for software-defined storage is how to address the use cases associated with data growth,” said Michael St. Jean, principal product marketing manager, Red Hat Storage. - -Every challenge is an opportunity. “The deluge of data being generated by old and new sources today is certainly presenting us with opportunities to meet our customers escalating needs in the areas of scale, performance, resiliency, and governance,” said Tad Brockway, General Manager for Azure Storage, Media and Edge. - -### Trinity of modern software-defined storage - -There are three different kinds of storage solutions -- block, file, and object -- each serving a different purpose while working with the others. - -Block storage is the oldest form of data storage, where data is stored in fixed-length blocks or chunks of data. Block storage is used in enterprise storage environments and usually is accessed using Fibre Channel or iSCSI interface. “Block storage requires an application to map where the data is stored on the storage device,” according to SUSE’s Larry Morris, Sr. Product Manager, Software Defined Storage. - -Block storage is virtualized in storage area network and software defined storage systems, which are abstracted logical devices that reside on a shared hardware infrastructure and are created and presented to the host operating system of a server, virtual server, or hypervisor via protocols like SCSI, SATA, SAS, FCP, FCoE, or iSCSI. - -“Block storage splits a single storage volume (like a virtual or cloud storage node, or a good old fashioned hard disk) into individual instances known as blocks,” said St. Jean. - -Each block exists independently and can be formatted with its own data transfer protocol and operating system — giving users complete configuration autonomy. Because block storage systems aren’t burdened with the same investigative file-finding duties as the file storage systems, block storage is a faster storage system. Pairing that speed with configuration flexibility makes block storage ideal for raw server storage or rich media databases. - -Block storage can be used to host operating systems, applications, databases, entire virtual machines and containers. Traditionally, block storage can only be accessed by individual machine, or machines in a cluster, to which it has been presented. - -### File-based storage - -File-based storage uses a filesystem to map where the data is stored on the storage device. It’s a dominant technology used on direct- and networked-attached storage system, and it takes care of two things: organizing data and representing it to users. “With file storage, data is arranged on the server side in the exact same format as the clients see it. This allows the user to request a file by some unique identifier — like a name, location, or URL — which is communicated to the storage system using specific data transfer protocols,” said St. Jean. - -The result is a type of hierarchical file structure that can be navigated from top to bottom. File storage is layered on top of block storage, allowing users to see and access data as files and folders, but restricting access to the blocks that stand up those files and folders. - -“File storage is typically represented by shared filesystems like NFS and CIFS/SMB that can be accessed by many servers over an IP network. Access can be controlled at a file, directory, and export level via user and group permissions. File storage can be used to store files needed by multiple users and machines, application binaries, databases, virtual machines, and can be used by containers,” explained Brockway. - -### Object storage - -Object storage is the newest form of data storage, and it provides a repository for unstructured data which separates the content from the indexing and allows the concatenation of multiple files into an object. An object is a piece of data paired with any associated metadata that provides context about the bytes contained within the object (things like how old or big the data is). Those two things together — the data and metadata — make an object. - -One advantage of object storage is the unique identifier associated with each piece of data. Accessing the data involves using the unique identifier and does not require the application or user to know where the data is actually stored. Object data is accessed through APIs. - -“The data stored in objects is uncompressed and unencrypted, and the objects themselves are arranged in object stores (a central repository filled with many other objects) or containers (a package that contains all of the files an application needs to run). Objects, object stores, and containers are very flat in nature — compared to the hierarchical structure of file storage systems — which allow them to be accessed very quickly at huge scale,” explained St. Jean. - -Object stores can scale to many petabytes to accommodate the largest datasets and are a great choice for images, audio, video, logs, backups, and data used by analytics services. - -### Conclusion - -Now you know about the various types of storage and how they are used. Stay tuned to learn more about software-defined storage as we examine the topic in the future. - -Join us at [Open Source Summit + Embedded Linux Conference Europe][1] in Edinburgh, UK on October 22-24, 2018, for 100+ sessions on Linux, Cloud, Containers, AI, Community, and more. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/2018/9/know-your-storage-block-file-object - -作者:[Swapnil Bhartiya][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://www.linux.com/users/arnieswap -[1]: https://events.linuxfoundation.org/events/elc-openiot-europe-2018/ diff --git a/translated/tech/20180911 Know Your Storage- Block, File - Object.md b/translated/tech/20180911 Know Your Storage- Block, File - Object.md new file mode 100644 index 0000000000..3dc77ad8e3 --- /dev/null +++ b/translated/tech/20180911 Know Your Storage- Block, File - Object.md @@ -0,0 +1,60 @@ +认识存储:块、文件和对象 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/block2_1920.jpg?itok=s1y6RLhT) + +现在,对于那些创建或消费数据的公司来说,处理生成的数量巨大的数据是个非常大的挑战。而对于那些解决存储相关问题的科技公司来说,也是一个挑战。 + + Red Hat 存储首席产品营销经理 Michael St. Jean 说,“数据每年呈几何级增长,而我们发现数据大量增长的主要原因是由于消费增长和为拓展价值而进行的产业转型,毫无疑问,物联网对数据增长的贡献很大,但对软件定义存储来说最重要的挑战是,如何处理用户场景相关的数据增长。“ + +任何挑战都意味着机遇。Azure 存储、介质和边缘总经理 Tad Brockway 说,“今天,新旧数据源产生的海量数据为我们满足客户在规模、性能、灵活性、治理方面急剧增长的需求提供了一个机遇。” + +### 现代软件定义存储的三种类型 + +这里有三个不同类型的存储解决方案 — 块、文件、和对象 — 虽然它们每个都可以与其它的共同工作,但它们每个都有不同的用途。 + +块存储是数据存储的最古老形式,数据都存储在固定长度的块或多个块中。块存储适用于企业存储环境,并且通常使用光纤通道或 iSCSI 接口。根据 SUSE 软件定义存储高级产品经理 Larry Morris 的说法,“块存储要求一个应用去映射存储设备上存储数据块的位置”。 + +块存储在存储区域网和软件定义存储系统中是虚拟的,它是处于一个共享的硬件基础设施上的抽象逻辑设备,它创建和存在于服务器、虚拟服务器、或运行在基于像 SCSI、SATA、SAS、FCP、FCoE、或 iSCSI 这样的协议的系统管理程序上。 + +St. Jean 说“块存储将单个的存储卷(像一个虚拟或云存储节点、或一个老式硬盘)分割成单独的被称为块的实体。“ + +每个块独立存在,并且能够用它自己的数据传输协议和操作系统格式化 — 给用户完全的配置自主权。由于块存储系统并不负责像文件存储系统那样的文件查找职责,所以,块存储是一个非常快的存储系统。由于同时具备速度和配置灵活性,使得块存储非常适合原始服务器存储或富媒体数据库。 + +块存储适合于宿主机操作系统、应用程序、数据库、完整虚拟机和容器。传统上,块存储仅能够被独立的机器、或集群中呈现出的机器访问。 + +### 基于文件的存储 + +基于文件的存储使用一个文件系统去映射存储设备上数据的存储位置。这种技术在直接或网络附加存储系统应用领域中处于支配地位。它需要做两件事情:组织数据并呈现给用户。 St. Jean 说,”使用文件存储时,数据在服务器侧的排列格式与客户端用户所看到的是完全相同的。这就允许用户通过一些唯一标识符(像文件名、位置、或 URL)去请求一个文件,使用特定的数据传输协议与存储系统沟通。 + +最终成为了一种能够从上到下进行浏览的分层的文件结构。文件存储处于块存储之上,允许用户去查看和访问文件、文件夹这样的数据,但是限制访问处于这些文件和文件夹之下的数据块。 + +Brockway 解释说,“文件存储一般用于像 NFS 和 CIFS/SMB 这种很多服务器基于 IP 网络进行访问的共享文件系统上。访问控制通过用户和组的权限实现在文件、目录、和导出级别上。基于文件的存储可用于被多个用户和机器、二进制应用程序、数据库、虚拟机所需要的文件的存储上,以及容器上。“ + +### 对象存储 + +对象存储是最新的数据存储形式,它为非结构化数据提供一个库,它将内容从索引中分离出来,并允许多个文件连接到一个对象上。一个对象就是与任何相关元数据配对的一个数据块,这些元数据提供对象中包含的字节的上下文(比如数据创建时间和数据大小等)。也就是说这两样东西 — 数据和元数据 — 构成了一个对象。 + +对象存储的一个好处是每个数据块都关联了一个唯一标识符。访问数据需要唯一标识符,并且不需要应用程序或用户知道数据的真实存储位置。对象数据是通过 API 来访问的。 + +St. Jean 说,“对象中存储的数据是没有压缩和加密的,对象本身被安排在对象存储(一个填满其它对象的中心库)中或容器(包含应用程序运行所需要的所有文件的一个包)中。与文件存储系统的层次结构相比,对象、对象存储和容器在本质上是平面的 — 这使得它们在存储规模巨大时访问速度很快。” + +对象存储可以扩展到很多 PB 字节大小,以适应巨大的数据集,因此它是图像、音频、视频、日志、备份、和分析服务所使用的数据存储的最佳选择。 + +### 结论 + +现在你已经知道了各种类型的存储以及它们的用处。后面我们将继续研究这个主题的更多内容,敬请关注。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/2018/9/know-your-storage-block-file-object + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/arnieswap +[1]: https://events.linuxfoundation.org/events/elc-openiot-europe-2018/ From 690b6cc853497a5357a66e229d78746c99b63988 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 13 Dec 2018 22:12:13 +0800 Subject: [PATCH 0091/4278] PRF:20180422 Command Line Tricks For Data Scientists - kade killary.md @GraveAccent --- ...icks For Data Scientists - kade killary.md | 266 +++++++++--------- 1 file changed, 140 insertions(+), 126 deletions(-) diff --git a/translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md b/translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md index a02057f65a..e4190cf7dd 100644 --- a/translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md +++ b/translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md @@ -3,30 +3,29 @@ ![](https://i.imgur.com/0mzQMcB.png) -对于许多数据科学家来说,数据操作始于和结束于 Pandas 或 Tidyverse。从理论上讲,这样做没有任何问题。毕竟,这就是这些工具存在的原因。然而,对于像分隔符转换这样的简单任务,这些工具是大材小用了。 +对于许多数据科学家来说,数据操作从始至终就是 Pandas 或 Tidyverse。从理论上讲,这样做没有任何问题。毕竟,这就是这些工具存在的原因。然而,对于像分隔符转换这样的简单任务,这些工具是大材小用了。 -立志掌握命令行应该在每个开发人员的清单上,特别是数据科学家。学习 shell 的来龙去脉将无可否认地提高你的生产力。除此之外,命令行还是计算领域的一个重要历史课程。例如,awk - 一种数据驱动的脚本语言。1977年,在传奇的 [K&R 书][2]中 K 即 [Brain Kernighan][1] 的帮助下,Awk 首次出现。今天,大约五十年过去了,awk 仍然和每年出现的[新书][3]相关。因此,可以安全地假设对命令行魔法的投资不会很快贬值。 +立志掌握命令行应该在每个开发人员的学习清单上,特别是数据科学家。学习 shell 的来龙去脉将无可否认地提高你的生产力。除此之外,命令行还是计算领域的一个重要历史课程。例如,awk —— 一种数据驱动的脚本语言。1977 年,在 [Brain Kernighan][1](即传奇的 [K&R 书][2]中 K)的帮助下,awk 首次出现。今天,大约五十年过去了,awk 仍然活跃在每年[新出版的书][3]里面。因此,可以安全地假设对命令行魔法的付出不会很快贬值。 ### 我们将涵盖什么 - * ICONV - * HEAD - * TR - * WC - * SPLIT - * SORT & UNIQ - * CUT - * PASTE - * JOIN - * GREP - * SED - * AWK - - +* ICONV +* HEAD +* TR +* WC +* SPLIT +* SORT & UNIQ +* CUT +* PASTE +* JOIN +* GREP +* SED +* AWK ### ICONV -文件编码可能会很棘手。现在大部分文件都是 UTF-8 编码的。要了解 UTF-8 背后的一些魔力,请查看这个出色的[视频][4]。尽管如此,有时我们收到的文件不是这种格式。这可能引起对改变编码模式的一些不靠谱尝试。这里,iconv 是一个拯救者。Iconv 是一个简单的程序,它将获取采用一种编码的文本并输出采用另一种编码的文本。 +文件编码可能会很棘手。现在大部分文件都是 UTF-8 编码的。要了解 UTF-8 背后的一些魔力,请查看这个出色的[视频][4]。尽管如此,有时我们收到的文件不是这种编码。这可能引起对改变编码模式的一些胡乱尝试。这里,`iconv` 是一个拯救者。`iconv` 是一个简单的程序,它将获取采用一种编码的文本并输出采用另一种编码的文本。 + ``` # Converting -f (from) latin1 (ISO-8859-1) # -t (to) standard UTF_8 @@ -34,16 +33,15 @@ iconv -f ISO-8859-1 -t UTF-8 < input.txt > output.txt ``` - * 实用选项: - - * `iconv -l` 列出所有已知编码 - * `iconv -c` 默默丢弃无法转换的字符 - +实用选项: +* `iconv -l` 列出所有已知编码 +* `iconv -c` 默默丢弃无法转换的字符 ### HEAD -如果你是一个频繁的 Pandas 用户,那么会很熟悉 `head`。通常在处理新数据时,我们想做的第一件事就是了解其内容。这导致启动 Pandas,读取数据然后调用 `df.head()` \- 这至少是费劲的。没有任何标志的 Head 将打印出文件的前10行。`head` 的真正力量在于测试出来干净利落的操作。例如,如果我们想将文件的分隔符从逗号更改为管道。一个快速测试将是:`head mydata.csv | sed 's/,/|/g'`。 +如果你是一个 Pandas 重度用户,那么会很熟悉 `head`。通常在处理新数据时,我们想做的第一件事就是了解其内容。这就得启动 Pandas,读取数据然后调用 `df.head()` —— 要说这有点费劲。没有任何选项的 `head` 将打印出文件的前 10 行。`head` 的真正力量在于干净利落的测试操作。例如,如果我们想将文件的分隔符从逗号更改为管道。一个快速测试将是:`head mydata.csv | sed 's/,/|/g'`。 + ```bash # Prints out first 10 lines head filename.csv @@ -52,63 +50,61 @@ head filename.csv head -n 3 filename.csv ``` - * 实用选项: - - * `head -n` 打印特定行数 - * `head -c` 打印具体的字节数 - +实用选项: +* `head -n` 打印特定行数 +* `head -c` 打印特定字节数 ### TR -Tr 类似于翻译。这个功能强大的实用程序是基本文件清理的主力。理想的用例是交换文件中的分隔符。 +`tr` 类似于翻译。这个功能强大的实用程序是文件基础清理的主力。理想的用例是替换文件中的分隔符。 + ```bash # Converting a tab delimited file into commas cat tab_delimited.txt | tr "\t" "," comma_delimited.csv ``` -`tr` 另一个功能是在你支配中的内建 `[:class:]` 变量(POSIX 字符类)。这些包括了: +`tr` 另一个功能是你可以用内建 `[:class:]` 变量(POSIX 字符类)发挥威力。这些包括了: -``` -[:alnum:] all letters and digits -[:alpha:] all letters -[:blank:] all horizontal whitespace -[:cntrl:] all control characters -[:digit:] all digits -[:graph:] all printable characters, not including space -[:lower:] all lower case letters -[:print:] all printable characters, including space -[:punct:] all punctuation characters -[:space:] all horizontal or vertical whitespace -[:upper:] all upper case letters -[:xdigit:] all hexadecimal digits -``` +- `[:alnum:]` 所有字母和数字 +- `[:alpha:]` 所有字母 +- `[:blank:]` 所有水平空白 +- `[:cntrl:]` 所有控制字符 +- `[:digit:]` 所有数字 +- `[:graph:]` 所有可打印字符,但不包括空格 +- `[:lower:]` 所有小写字母 +- `[:print:]` 所有可打印字符,包括空格 +- `[:punct:]` 所有标点符号 +- `[:space:]` 所有水平或垂直空白 +- `[:upper:]` 所有大写字母 +- `[:xdigit:]` 所有 16 进制数字 + +你可以将这些连接在一起以组成强大的程序。以下是一个基本的字数统计程序,可用于检查 README 是否被滥用。 -你可以将这些连接在一起以组成强大的程序。以下是一个基本的字数统计程序,可用于检查自述文件是否过度使用。 ``` cat README.md | tr "[:punct:][:space:]" "\n" | tr "[:upper:]" "[:lower:]" | grep . | sort | uniq -c | sort -nr ``` 另一个使用基本正则表达式的例子: + ``` # Converting all upper case letters to lower case cat filename.csv | tr '[A-Z]' '[a-z]' ``` - * 实用选项: - - * `tr -d` 删除字符 - * `tr -s` 压缩字符 - * `\b` 退格 - * `\f` 换页 - * `\v` 垂直制表符 - * `\NNN` 八进制字符 - +实用选项: +* `tr -d` 删除字符 +* `tr -s` 压缩字符 +* `\b` 退格 +* `\f` 换页 +* `\v` 垂直制表符 +* `\NNN` 八进制字符 ### WC -单词数量。它的值主要来自 `-l` 标志,它会给你提供行数。 +单词计数。它的价值主要来自其 `-l` 选项,它会给你提供行数。 + ``` # Will return number of lines in CSV wc -l gigantic_comma.csv @@ -116,18 +112,17 @@ wc -l gigantic_comma.csv 这个工具可以方便地确认各种命令的输出。所以,如果我们在转换文件中的分隔符之后运行 `wc -l`,我们会期待总行数是一样的,如果不一致,我们就知道有地方出错了。 - * 实用选项: - - * `wc -c` 打印字节数 - * `wc -m` 打印字符数 - * `wc -L` 打印最长行的长度 - * `wc -w` 打印单词数量 - +实用选项: +* `wc -c` 打印字节数 +* `wc -m` 打印字符数 +* `wc -L` 打印最长行的长度 +* `wc -w` 打印单词数量 ### SPLIT -文件大小的范围可以很广。取决于任务,拆分文件可以是有益的,所以使用 `split` 吧。split的基本语法是: +文件大小的范围可以很广。对于有的任务,拆分文件或许是有好处的,所以使用 `split` 吧。`split` 的基本语法是: + ```bash # We will split our CSV into new_filename every 500 lines split -l 500 filename.csv new_filename_ @@ -138,7 +133,8 @@ split -l 500 filename.csv new_filename_ # new_filename_aa ``` -两个奇怪的地方是命名约定和缺少文件扩展名。后缀约定可以通过 `-d` 标志变为数字。要添加文件扩展名,你需要运行以下 `find` 命令。它将通过附加 `.csv`更改当前目录中所有文件的名称,所以小心了。 +它有两个奇怪的地方是命名约定和缺少文件扩展名。后缀约定可以通过 `-d` 标志变为数字。要添加文件扩展名,你需要运行以下 `find` 命令。它将通过附加 `.csv` 扩展名来更改当前目录中所有文件的名称,所以小心了。 + ```bash find . -type f -exec mv '{}' '{}'.csv \; # ls output @@ -148,19 +144,18 @@ find . -type f -exec mv '{}' '{}'.csv \; # new_filename_aac.csv ``` - * 实用选项: - - * `split -b` 按特定字节大小分割 - * `split -a` 生成长度为 N 的后缀 - * `split -x` 使用十六进制后缀分割 - +实用选项: +* `split -b N` 按特定字节大小分割 +* `split -a N` 生成长度为 N 的后缀 +* `split -x` 使用十六进制后缀 ### SORT & UNIQ -以上两个命令很明显:他们的作用就是字面意思。这两者结合起来可以提供最强大的冲击 (i.e. 单独单词数量)。这是由于 `uniq` 只作用于重复的相邻行。这也是在输出前 `sort` 的原因。一个有趣的纪录是 `sort -u` 会达到和典型的 `sort file.txt | uniq` 模式一样的结果。 +上面两个命令很明显:它们的作用就是字面意思。这两者结合起来可以提供最强大的冲击 (例如,唯一单词的数量)。这是由于 `uniq` 只作用于重复的相邻行。这也是在输出前进行 `sort` 的原因。一个有趣的事情是 `sort -u` 会达到和典型的 `sort file.txt | uniq` 模式一样的结果。 + +`sort` 对数据科学家来说确实具有潜在的有用能力:能够根据特定列对整个 CSV 进行排序。 -Sort 对数据科学家来说确实具有潜在的有用能力:能够根据特定列对整个 CSV 进行排序。 ```bash # Sorting a CSV file by the second column alphabetically sort -t"," -k2,2 filename.csv @@ -172,37 +167,39 @@ sort -t"," -k2n,2 filename.csv sort -t"," -k2nr,2 filename.csv ``` -这里的 `-t` 选项将逗号指定为分隔符。通常假设分隔符是空格或制表符。此外,`-k` 标志是为了确定我们的 key。这里的语法是 `-km,n`,`m` 作为开始列,`n` 作为结束列。 - - * 实用选项: - - * `sort -f` 忽略大小写 - * `sort -r` 反向排序 - * `sort -R` 乱序 - * `uniq -c` 统计出现次数 - * `uniq -d` 只打印重复行 +这里的 `-t` 选项将逗号指定为分隔符,通常假设分隔符是空格或制表符。此外,`-k` 选项是为了确定我们的键。这里的语法是 `-km,n`,`m` 作为开始列,`n` 作为结束列。 +实用选项: +* `sort -f` 忽略大小写 +* `sort -r` 反向排序 +* `sort -R` 乱序 +* `uniq -c` 统计出现次数 +* `uniq -d` 只打印重复行 ### CUT -Cut 用于删除列。为了演示,如果我们只想删除第一和第三列。 +`cut` 用于删除列。作为演示,如果我们只想删除第一和第三列。 + ```bash cut -d, -f 1,3 filename.csv ``` -选择除了第一行外的所有行。 +要选择除了第一行外的所有行。 + ```bash cut -d, -f 2- filename.csv ``` -结合其他命令,将`cut` 用作过滤器。 +结合其他命令,将 `cut` 用作过滤器。 + ```bash # Print first 10 lines of column 1 and 3, where "some_string_value" is present head filename.csv | grep "some_string_value" | cut -d, -f 1,3 ``` 查出第二列中唯一值的数量。 + ```bash cat filename.csv | cut -d, -f 2 | sort | uniq | wc -l @@ -212,7 +209,8 @@ cat filename.csv | cut -d, -f 2 | sort | uniq -c | head ### PASTE -Paste 是一个带有趣味性功能的粘贴命令。如果你有两个需要合并的文件,并且它们已经排序了,`paste` 帮你解决了接下来的步骤。 +`paste` 是一个带有趣味性功能的特定命令。如果你有两个需要合并的文件,并且它们已经排序好了,`paste` 帮你解决了接下来的步骤。 + ```bash # names.txt adam @@ -233,37 +231,38 @@ john,youtuber zach,developer ``` -查看更多 SQL_-esque 变种,见下文。 +更多 SQL 式变种,见下文。 ### JOIN -Join 是一个简单准切向的 SQL。最大的区别是 `join` 将返回所有列以及只能在一个字段上匹配。默认情况下,`join` 将尝试使用第一列作为匹配键。为了获得不同结果,必须使用以下语法: +`join` 是一个简单的、准切向的quasi-tangential SQL。最大的区别是 `join` 将返回所有列以及只能在一个字段上匹配。默认情况下,`join` 将尝试使用第一列作为匹配键。为了获得不同结果,必须使用以下语法: + ```bash # Join the first file (-1) by the second column # and the second file (-2) by the first join -t "," -1 2 -2 1 first_file.txt second_file.txt ``` -标准的 join 是内连接。然而,外连接通过 `-a` 标志也是可行的。另一个值得一提的技巧是 `-q` 标志,如果发现有缺失的字段,可用于替换值。 +标准的 `join` 是内连接。然而,外连接通过 `-a` 选项也是可行的。另一个值得一提的技巧是 `-q` 标志,如果发现有缺失的字段,可用于替换值。 + ```bash # Outer join, replace blanks with NULL in columns 1 and 2 # -o which fields to substitute - 0 is key, 1.1 is first column, etc... join -t"," -1 2 -a 1 -a2 -e ' NULL' -o '0,1.1,2.2' first_file.txt second_file.txt ``` -不是最用户友好的命令,而是绝望时刻的绝望措施。 - - * 实用选项: - - * `join -a` 打印不可配对的行 - * `join -e` 替换丢失的输入字段 - * `join -j` 相当于 `-1 FIELD -2 FIELD` +它不是最用户友好的命令,而是绝望时刻的绝望措施。 +实用选项: +* `join -a` 打印不可配对的行 +* `join -e` 替换丢失的输入字段 +* `join -j` 相当于 `-1 FIELD -2 FIELD` ### GREP -用正则表达式全局搜索并且打印,或者 `grep`,可能是最有名的命令并且有充分的理由。Grep 很强大,特别适合在大型代码库中找到路径。在数据科学的王国里,它充当其他命令的提炼机制。虽然它的标准用途也很有价值。 +`grep` 即 用正则表达式全局搜索并且打印Global search for a Regular Expression and Print,可能是最有名的命令,并且名副其实。`grep` 很强大,特别适合在大型代码库中查找。在数据科学的王国里,它充当其他命令的提炼机制。虽然它的标准用途也很有价值。 + ``` # Recursively search and list all files in directory containing 'word' @@ -276,6 +275,7 @@ grep -lr 'word' . | wc -l ``` 计算包含单词或模式的总行数。 + ``` grep -c 'some_value' filename.csv @@ -284,39 +284,40 @@ grep -c 'some_value' filename.csv grep -c 'some_value' * ``` -使用 or 运算符 - `\|` 为多个值 Grep。 +对多个值使用“或”运算符: `\|`。 + ``` grep "first_value\|second_value" filename.csv ``` - * 实用选项: - - * `alias grep="grep --color=auto"` 使 grep 丰富多彩 - * `grep -E` 使用扩展的 regexp - * `grep -w` 只匹配整个单词 - * `grep -l` 打印匹配的文件名 - * `grep -v` 倒置匹配 - +实用选项: +* `alias grep="grep --color=auto"` 使 grep 色彩丰富 +* `grep -E` 使用扩展正则表达式 +* `grep -w` 只匹配整个单词 +* `grep -l` 打印匹配的文件名 +* `grep -v` 非匹配 ### 大人物们 -Sed 和 Awk 是本文中最强大的两个命令。为简介起见,我不打算详细讨论这两个命令。相反,我将介绍各种能证明其令人印象深刻的力量的命令。如果你想了解更多,[这儿就有一本书][5]是关于它们的。 +`sed` 和 `awk` 是本文中最强大的两个命令。为简洁起见,我不打算详细讨论这两个命令。相反,我将介绍各种能证明其令人印象深刻的力量的命令。如果你想了解更多,[这儿就有一本书][5]是关于它们的。 ### SED `sed` 本质上是一个流编辑器。它擅长替换,但也可以用于所有输出重构。 -最基本的 `sed` 命令由 `s/old/new/g` 组成。这转换为搜索旧值,全局替换为新值。 如果没有 `/g`,我们的命令将在旧值第一次出现后终止。 +最基本的 `sed` 命令由 `s/old/new/g` 组成。它的意思是搜索 `old`,全局替换为 `new`。 如果没有 `/g`,我们的命令将在 `old` 第一次出现后终止。 + +为了快速了解它的功能,我们可以深入了解一个例子。 在以下情景中,你已有以下文件: -为了快速了解它的功能,我们可以深入了解一个例子。 在以下情景中,你已获得以下文件: ``` balance,name $1,000,john $2,000,jack ``` -我们可能想要做的第一件事是删除美元符号。`-i` 标志表示原位。`''` 表示零长度文件扩展名,从而覆盖我们的初始文件。理想情况下,你可以单独测试每个,然后输出到新文件。 +我们可能想要做的第一件事是删除美元符号。`-i` 标志表示原位。`''` 表示零长度文件扩展名,从而覆盖我们的初始文件。理想情况下,你可以单独测试,然后输出到新文件。 + ``` sed -i '' 's/\$//g' data.txt # balance,name @@ -324,7 +325,8 @@ sed -i '' 's/\$//g' data.txt # 2,000,jack ``` -接下来, `blance` 列的逗号。 +接下来,去除 `blance` 列的逗号。 + ``` sed -i '' 's/\([0-9]\),\([0-9]\)/\1\2/g' data.txt # balance,name @@ -332,7 +334,8 @@ sed -i '' 's/\([0-9]\),\([0-9]\)/\1\2/g' data.txt # 2000,jack ``` -最后杰克有一天决定退出。所以,再见了,我的朋友。 +最后 jack 有一天决定辞职。所以,再见了,我的朋友。 + ``` sed -i '' '/jack/d' data.txt # balance,name @@ -343,33 +346,35 @@ sed -i '' '/jack/d' data.txt ### AWK -最好的留在最后。Awk 不仅仅是一个简单的命令:它是一个成熟的语言。在本文中涉及的所有内容中,`awk` 是目前为止最酷的。如果你发现自己对其印象深刻,这里有很多很棒的资源 - 看 [这里][6], [这里][7] 和 [这里][8]。 +最好的留在最后。`awk` 不仅仅是一个简单的命令:它是一个成熟的语言。在本文中涉及的所有内容中,`awk` 是目前为止最酷的。如果你感兴趣,这里有很多很棒的资源 —— 看 [这里][6]、[这里][7] 和 [这里][8]。 `awk` 的常见用例包括: - * 文字处理 - * 格式化文本报告 - * 执行算术运算 - * 执行字符串操作 +* 文字处理 +* 格式化文本报告 +* 执行算术运算 +* 执行字符串操作 +`awk` 可以以最原生的形式并行 `grep`。 - -Awk 可以以最原生的形式并行 `grep`。 ``` awk '/word/' filename.csv ``` -或者更加神奇:将 `grep` 和 `cut` 组合起来。在这里,`awk` 打印第三和第四列,用 tab 分隔,对于所有带我们指定单词的行。`-F,` 只是改变我们的分隔符为逗号。 +或者更加神奇:将 `grep` 和 `cut` 组合起来。在这里,对于所有带我们指定单词 `word` 的行,`awk` 打印第三和第四列,用 `tab` 分隔。`-F,` 用于指定切分时的列分隔符为逗号。 + ```bash awk -F, '/word/ { print $3 "\t" $4 }' filename.csv ``` -Awk 内置了许多精巧的变量。比如,`NF` \- 字段数 - 和 `NR` \- 记录数。要获取文件中的第53条记录: +`awk` 内置了许多精巧的变量。比如,`NF` —— 字段数,和 `NR` —— 记录数。要获取文件中的第 53 条记录: + ```bash awk -F, 'NR == 53' filename.csv ``` -增加的代码是基于一个或多个值进行过滤的能力。下面的第一个示例将打印第一列等于给定字符串的记录的行号和列。 +更多的花招是其基于一个或多个值进行过滤的能力。下面的第一个示例将打印第一列等于给定字符串的行的行号和列。 + ```bash awk -F, ' $1 == "string" { print NR, $0 } ' filename.csv @@ -378,6 +383,7 @@ awk -F, ' $2 == 1000 { print NR, $0 } ' filename.csv ``` 多个数值表达式: + ```bash # Print line number and columns where column three greater # than 2005 and column five less than one thousand @@ -386,16 +392,19 @@ awk -F, ' $3 >= 2005 && $5 <= 1000 { print NR, $0 } ' filename.csv ``` 求出第三列的总和: + ```bash awk -F, '{ x+=$3 } END { print x }' filename.csv ``` -在第一列等于 “something”的那些行,求出第三列值的总和。 +在第一列等于 `something` 的那些行,求出第三列值的总和。 + ```bash awk -F, '$1 == "something" { x+=$3 } END { print x }' filename.csv ``` -获取文件的尺寸: +获取文件的行列数: + ```bash awk -F, 'END { print NF, NR }' filename.csv @@ -404,11 +413,13 @@ awk -F, 'BEGIN { print "COLUMNS", "ROWS" }; END { print NF, NR }' filename.csv ``` 打印出现了两次的行: + ```bash awk -F, '++seen[$0] == 2' filename.csv ``` 删除重复的行: + ```bash # Consecutive lines awk 'a !~ $0; {a=$0}'] @@ -421,16 +432,19 @@ awk '!($0 in a) {a[$0];print} ``` 使用内置函数 `gsub()` 替换多个值。 + ```bash awk '{gsub(/scarlet|ruby|puce/, "red"); print}' ``` 这个 `awk` 命令将组合多个 CSV 文件,忽略标题,然后在最后附加它。 + ```bash awk 'FNR==1 && NR!=1{next;}{print}' *.csv > final_file.csv ``` -需要缩小一个庞大的文件? `awk` 可以在 `sed` 的帮助下处理它。具体来说,该命令根据行数将一个大文件分成多个较小的文件。这个 one-liner 也将增加一个扩展。 +需要缩小一个庞大的文件? `awk` 可以在 `sed` 的帮助下处理它。具体来说,该命令根据行数将一个大文件分成多个较小的文件。这个一行脚本将增加一个扩展名。 + ```bash sed '1d;$d' filename.csv | awk 'NR%NUMBER_OF_LINES==1{x="filename-"++i".csv";}{print > x}' @@ -440,7 +454,7 @@ sed '1d;$d' big_data.csv | awk 'NR%100000==1{x="data_"++i".csv";}{print > x}' ### 结语 -命令行拥有无穷无尽的力量。本文中介绍的命令足以将你从一无所知提升到英雄人物。除了涵盖的内容之外,还有许多实用程序需要考虑用于日常数据操作。[Csvkit][9], [xsv][10] 还有 [q][11] 是需要记住的三个。如果你希望更深入地了解命令行数据科学,查看[这本书][12]。它也可以[免费][13]在线获得! +命令行拥有无穷无尽的力量。本文中介绍的命令足以将你从一无所知提升到英雄人物。除了涵盖的内容之外,还有许多实用程序可以考虑用于日常数据操作。[Csvkit][9]、[xsv][10] 还有 [q][11] 是需要记住的三个。如果你希望更深入地了解命令行数据科学,查看[这本书][12]。它也可以[免费][13]在线获得! -------------------------------------------------------------------------------- @@ -449,7 +463,7 @@ via: http://kadekillary.work/post/cli-4-ds/ 作者:[Kade Killary][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[GraveAccent](https://github.com/graveaccent) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f2ad49f85dc80284746c8fe2489e8b33a3cf55d7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 13 Dec 2018 22:12:43 +0800 Subject: [PATCH 0092/4278] PUB:20180422 Command Line Tricks For Data Scientists - kade killary.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @GraveAccent 翻译的不错 https://linux.cn/article-10342-1.html --- ...0422 Command Line Tricks For Data Scientists - kade killary.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180422 Command Line Tricks For Data Scientists - kade killary.md (100%) diff --git a/translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md b/published/20180422 Command Line Tricks For Data Scientists - kade killary.md similarity index 100% rename from translated/tech/20180422 Command Line Tricks For Data Scientists - kade killary.md rename to published/20180422 Command Line Tricks For Data Scientists - kade killary.md From 3e7ec97f2c434a2b52b04187dc5769bbbc4aa60d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 13 Dec 2018 22:43:57 +0800 Subject: [PATCH 0093/4278] PRF:20181119 7 command-line tools for writers - Opensource.com.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @LazyWolfLin 恭喜你,完成了第一篇翻译! --- ...line tools for writers - Opensource.com.md | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md index 2073fd9279..9d66c6a0fe 100644 --- a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md +++ b/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md @@ -1,11 +1,13 @@ -给写作者们的 7 个命令行工具 | Opensource.com +给写作者们的 7 个命令行工具 ====== -扔掉你的打字机,然后使用这些开源工具在命令行上写作吧。 + +> 扔掉你的文字编辑器,然后使用这些开源工具在命令行上写作吧。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE) -对于大多数人(尤其是非技术人员),写作意味着在 LibreOffice Writer 或者其他带图形界面的文本编辑器上编辑文本。但是还有许多可行的方法可以让任何人通过文本传递他们的信息,尤其是越来越多的作者选择[拥抱纯文本][1]。 +对于大多数人(尤其是非技术人员),写作意味着在 LibreOffice Writer 或者其他带图形界面的文字处理应用上编辑文本。但是还有许多可行的方法可以让任何人通过文本传递他们的信息,尤其是越来越多的作者选择[拥抱纯文本][1]。 -在使用图形界面写作的世界同样有命令行工具的一席之地。这些命令行工具可以帮助他们进行写作,检查他们的拼写等等——无论是在写一篇文章、博客或者故事;写一个 README 文件;或者准备一份技术文档的时候。 +在使用图形界面写作的世界同样有命令行工具的一席之地。这些命令行工具可以帮助他们进行写作,检查他们的拼写等等 —— 无论是在写一篇文章、博客或者故事;写一个 README 文件;或者准备一份技术文档的时候。 下面是一些在任何写作情况下都有用的命令行工具。 @@ -13,7 +15,7 @@ 没错,你可以在命令行进行真正的写作。我知道一些写作者会使用 [Nano][2]、[Vim][3]、[Emacs][4]、以及 [Jove][5] 等编辑器在终端窗口中进行工作。而这些编辑器[并非屈指可数][6]。文本编辑器的优势在于它们简单易用以及更专注于文本。非常适合用于编辑任何文本的初稿甚至完成一个漫长而复杂的写作项目。 -如果你想在命令行中获得更像文字编辑器的体验,不妨了解一下 [WordGrinder][7]。WordGrinder 是一款简单但拥有足够的编写和发布功能的文字编辑器。它支持基本的格式和样式,并且你可以将你的文字以 Markdown,ODT,LaTeX,或者 HTML 等格式导出。 +如果你想在命令行中获得更像文字编辑器的体验,不妨了解一下 [WordGrinder][7]。它是一款简单但拥有足够的编写和发布功能的文字编辑器。它支持基本的格式和样式,并且你可以将你的文字以 Markdown、ODT、LaTeX 或者 HTML 等格式导出。 ### 拼写检查 @@ -23,21 +25,21 @@ 另一个够老但仍然有用的代替品是 [Ispell][10]。虽然它比 Aspell 稍慢一点,但它们都以相同的方式工作。当你在你的文本文件上工作时,Ispell 将提供正确的建议。Ispell 同样也对英语以外的语言提供了良好的支持。 -### Prose linters +### 文章 linter -软件开发人员使用 [linters][11] 来检查他们的代码是否存在错误或者 bugs。同样也有用于检查文本样式或语法错误的 linters;而命令行会认为这些错误是样式元素。任何写作者都可以(也应该)使用它,一个 prose linter 对于要求文档风格和样式一致的文档团队项目而言尤其有用。 +软件开发人员使用 [linter][11] 来检查他们的代码是否存在错误或者 bug。同样也有用于检查文本样式或语法错误的 linter;而该命令行工具会认为这些错误是样式元素。任何写作者都可以(也应该)使用它,一个文章 linter 对于要求文档风格和样式一致的文档团队项目而言尤其有用。 -[Proselint][12] 是一款全能的实时检查工具。它会找出行话,大话,不正确日期和时间格式,滥用的术语[等等][13]。它也很容易运行并忽略文本中的标记。 +[Proselint][12] 是一款全能的实时检查工具。它会找出行话、大话、不正确日期和时间格式、滥用的术语[等等][13]。它也很容易运行并忽略文本中的标记。 -[Alex][14] 是一个简单但有用的 prose linter。 对明文文本或者格式为 Markdown 或 HTML 的文档使用它。Alex 会对“性别偏好,极端主义,种族相关,宗教,或者文章中其他不平等的措辞”产生警告。如果你想要试试看 Alex,这里有一个在线 [demo][15]。 +[Alex][14] 是一个简单但有用的文章 linter。 对明文文本或者格式为 Markdown 或 HTML 的文档使用它。Alex 会对“性别偏好、极端主义、种族相关、宗教,或者文章中其他不平等的措辞”产生警告。如果你想要试试看 Alex,这里有一个在线 [demo][15]。 ### 其他工具 有时候你找不到一个单词的恰当的同义词。但你不需要去呆板的词库中抓取或者去专门的网站完善你的单词完整。仅仅需要对你想要替换的单词运行 [Aiksaurus][16],然后它就会为你完成这个工作。但是,这个程序最大的缺点是它只支持英语。 -即使是只会很少(甚至只有一项)技术技能的写作者都能接受 [Markdown][17] 来快速而简单地格式化他们的作品。但是,有时候你也需要将使用 Markdown 格式的文件转换成其他格式。这就是 [Pandoc][18] 的用武之地。你可以用它来将你的文档转换成 HTML,Word,LibreOffice Writer,LaTeX,EPUB 以及其他格式。你甚至可以用 Pandoc 来生成书籍和[研究论文][19]。 +即使是只会很少(甚至只有一项)技术技能的写作者都能接受 [Markdown][17] 来快速而简单地格式化他们的作品。但是,有时候你也需要将使用 Markdown 格式的文件转换成其他格式。这就是 [Pandoc][18] 的用武之地。你可以用它来将你的文档转换成 HTML、Word、LibreOffice Writer、LaTeX、EPUB 以及其他格式。你甚至可以用 Pandoc 来生成书籍和[研究论文][19]。 -你有最喜欢的命令行写作工具吗?在 Opensource.com 社区发表评论分享它吧。 +你有最喜欢的命令行写作工具吗?在社区发表评论分享它吧。 -------------------------------------------------------------------------------- @@ -46,7 +48,7 @@ via: https://opensource.com/article/18/11/command-line-tools-writers 作者:[Scott Nesbitt][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 32d5ada6211bd3ee5b83694f373cd3afb3e63123 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 13 Dec 2018 22:45:13 +0800 Subject: [PATCH 0094/4278] PUB:20181119 7 command-line tools for writers - Opensource.com.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @LazyWolfLin 本文首发地址: https://linux.cn/article-10343-1.html 您的 LCTT 专页:https://linux.cn/lctt/LazyWolfLin 请注册领取 LCCN: https://lctt.linux.cn/ --- .../20181119 7 command-line tools for writers - Opensource.com.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181119 7 command-line tools for writers - Opensource.com.md (100%) diff --git a/translated/tech/20181119 7 command-line tools for writers - Opensource.com.md b/published/20181119 7 command-line tools for writers - Opensource.com.md similarity index 100% rename from translated/tech/20181119 7 command-line tools for writers - Opensource.com.md rename to published/20181119 7 command-line tools for writers - Opensource.com.md From 23a778d8f807667686a30f4e16a24ffc2a2aed55 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 13 Dec 2018 23:48:09 +0800 Subject: [PATCH 0095/4278] PRF:20181121 Coupled commands with control operators in Bash.md @Jamskr --- ...commands with control operators in Bash.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181121 Coupled commands with control operators in Bash.md b/translated/tech/20181121 Coupled commands with control operators in Bash.md index f5f388e763..e5d4dcb2c0 100644 --- a/translated/tech/20181121 Coupled commands with control operators in Bash.md +++ b/translated/tech/20181121 Coupled commands with control operators in Bash.md @@ -1,10 +1,11 @@ Bash 中使用控制运算符连接命令 ====== -在命令行中,使用控制运算符为复合命令添加逻辑。 + +> 在命令行中,使用控制运算符为复合命令添加逻辑。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-yearbook-best-couple.png?itok=a_99oCdE) -一些简单的复合指令——比如说在一个命令行中连接几个命令——是经常使用的。这些命令使用分号分隔,表示一个命令结束。为了在一个命令行中创建一系列简单的 shell 命令,只需要使用分号把每一条命令分隔开,就像下面这样: +经常会使用一些简单的复合指令,比如说在一个命令行中连接几个命令。这些命令使用分号分隔,表示一个命令结束。为了在一个命令行中创建一系列简单的 shell 命令,只需要使用分号把每一条命令分隔开,就像下面这样: ``` command1 ; command2 ; command3 ; command4 ; @@ -12,7 +13,7 @@ command1 ; command2 ; command3 ; command4 ; 最后一个分号你可以不用添加,因为当你按下回车键时就表示一个命令的结束,但是为了和其它的保持一致,还是建议加上比较好。 -所有的命令执行都没有什么问题——只要没有什么意外发生。但是当出问题时到底发生了什么呢?我们可以预测,并且通过 Bash 中内置的 `&&` 和 `||` 运算符跟踪这些错误。这两个控制运算符提供了一些流控制,可以让我们改变代码执行队列的顺序。分号和 **换行符** 也被认为是 Bash 的控制运算符。 +所有的命令执行都没有什么问题 —— 只要没有什么意外发生。但是当出问题时到底发生了什么呢?我们可以预测,并且通过 Bash 中内置的 `&&` 和 `||` 运算符跟踪这些错误。这两个控制运算符提供了一些流控制,可以让我们改变代码执行队列的顺序。分号和换行符也被认为是 Bash 的控制运算符。 `&&` 运算符意义简单来说就是“如果 `command1` 执行成功,就接着执行 `command2`。”如果 `command1` 因为任何原因执行失败,那么 `command2` 将不执行。这个语法看下来像这样: @@ -20,9 +21,9 @@ command1 ; command2 ; command3 ; command4 ; command1 && command2 ``` -这样写是允许的,因为每一个命令都会返回一个值给 shell 来表示这个命令在执行的过程中是否执行成功或者失败。通常,返回值是 0 表示成功,而一个正数值表示不同种类的错误。有一些系统管理工具仅仅返回一个 1 来表示所有的错误,但是也有很多工具使用其它的正数的返回值来表示各种类型错误。 +这样写是允许的,因为每一个命令都会返回一个值(RC)给 shell 来表示这个命令在执行的过程中是否执行成功或者失败。通常,返回值是 `0` 表示成功,而一个正数值表示不同种类的错误。有一些系统管理工具仅仅返回一个 `1` 来表示所有的错误,但是也有很多工具使用其它的正数的返回值来表示各种类型错误。 -我们可以很容易的使用脚本, 命令列表中的下一个命令,或者可以直接使用系统管理工具来检查 shell 变量 `$?` 。我们一起来看这些返回值。运行一个简单的命令然后立即检查它的返回值,这个返回值始终是属于最后一个运行的命令。 +我们可以很容易的使用脚本来检查 shell 变量 `$?`,可以通过命令列表中的下一个命令,或者可以直接使用系统管理工具检查。我们一起来看这些返回值。运行一个简单的命令然后立即检查它的返回值,这个返回值始终是属于最后一个运行的命令。 ``` [student@studentvm1 ~]$ ll ; echo "RC = $?" @@ -35,7 +36,7 @@ RC = 0 [student@studentvm1 ~]$ ``` -这个返回值是 0,表示这个命令执行成功了。现在尝试使用同样的命令在一些我们没有权限的目录上。 +这个返回值是 `0`,表示这个命令执行成功了。现在尝试使用同样的命令在一些我们没有权限的目录上。 ``` [student@studentvm1 ~]$ ll /root ; echo "RC = $?" @@ -44,7 +45,7 @@ RC = 2 [student@studentvm1 ~]$ ``` -这个返回值的含义可以在 [`ls` 命令的 man 页面][1] 中找到。 +这个返回值的含义可以在 [ls 命令的 man 页面][1] 中找到。 现在我们来试试 `&&` 这个控制运算符,因为它也可能会被用在一个命令行程序中。我们将从一个简单的示例开始:创建一个新目录,如果创建成功就在这个目录中创建一个文件。 @@ -54,7 +55,7 @@ RC = 2 [student@studentvm1 ~]$ cd ; mkdir testdir ``` -在 `~/testdir` 中新建一个目录,这也应该是一个空目录,因为是你刚刚创建的,然后创建一个新的,空文件在这个新目录中。下面的命令可以做这些事情。 +在 `~/testdir` 中新建一个目录,这也应该是一个空目录,因为是你刚刚创建的,然后创建一个新的空文件在这个新目录中。下面的命令可以做这些事情。 ``` [student@studentvm1 ~]$ mkdir ~/testdir/testdir2 && touch ~/testdir/testdir2/testfile1 @@ -64,7 +65,7 @@ total 0 [student@studentvm1 ~]$ ``` -我们看到一切都运行得很好,因为 `testdir` 目录是访问且可写的。然后我们改变 `testdir` 目录的权限,让用户 **student** 不再具有访问的权限。操作如下: +我们看到一切都运行得很好,因为 `testdir` 目录是访问且可写的。然后我们改变 `testdir` 目录的权限,让用户 `student` 不再具有访问的权限。操作如下: ``` [student@studentvm1 ~]$ chmod 076 testdir ; ll | grep testdir @@ -116,7 +117,7 @@ via: https://opensource.com/article/18/11/control-operators-bash-shell 作者:[David Both][a] 选题:[lujun9972][b] 译者:[Jamskr](https://github.com/Jamskr) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6796eac9f56f49d511213fbeea8dd30696ec64b1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 13 Dec 2018 23:48:28 +0800 Subject: [PATCH 0096/4278] PUB:20181121 Coupled commands with control operators in Bash.md @Jamskr https://linux.cn/article-10344-1.html --- .../20181121 Coupled commands with control operators in Bash.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181121 Coupled commands with control operators in Bash.md (100%) diff --git a/translated/tech/20181121 Coupled commands with control operators in Bash.md b/published/20181121 Coupled commands with control operators in Bash.md similarity index 100% rename from translated/tech/20181121 Coupled commands with control operators in Bash.md rename to published/20181121 Coupled commands with control operators in Bash.md From 5f91ccd934028f7fb62854b6a3f7171e350783a1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 14 Dec 2018 09:10:20 +0800 Subject: [PATCH 0097/4278] translated --- ...olor to your Linux terminal with lolcat.md | 60 ------------------- ...olor to your Linux terminal with lolcat.md | 60 +++++++++++++++++++ 2 files changed, 60 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md create mode 100644 translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md diff --git a/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md b/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md deleted file mode 100644 index 3e070414ae..0000000000 --- a/sources/tech/20181205 Bring some color to your Linux terminal with lolcat.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Bring some color to your Linux terminal with lolcat) -[#]: via: (https://opensource.com/article/18/12/linux-toy-lolcat) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) - -Bring some color to your Linux terminal with lolcat -====== -With this simple utility, you can add a rainbow of color to the output of any program you want. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-lolcat.png?itok=Es6dYcph) - -Today marks the fifth day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal. - -It's quite possible that 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, **lolcat** , is the first utility I'm including that wasn't packaged for my Linux distribution, but it was still an easy install. It's a Ruby program that you ought to be able to easily add to your system with the following. - -``` -$ gem install lolcat -``` - -After that, simply pipe some text to it to see the output in the colors of the rainbow. For example, using a couple of utilities from earlier days in our advent calendar, try the following: - -``` -$ fortune | boxes -a c -d parchment | lolcat -``` - -Depending on what good fortune you have, you'll likely get something like this: -![](https://opensource.com/sites/default/files/uploads/linux-toy-lolcat-parchment.png) - -There are a few parameters you can pass to **lolcat** , and rather than repeat them all here, I'd suggest you either visit the **lolcat** [GitHub page][1] or just see them at the terminal by typing **lolcat --help**. But generally, they're helpful to set the spread and frequency of your rainbow, and my personal favorite, enabling animation. Who doesn't like animated rainbow printing at the terminal? Let's try the above again, with a different box (cat-themed, of course) and a cat-appropriate fortune that was in my fortunes list, with the following. - -``` -fortune -m "nine tails" | boxes -a c -d cat | lolcat -a -``` -![](https://opensource.com/sites/default/files/uploads/linux-toy-lolcat-animated.gif) -**lolcat** is open source under a BSD license. - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Have a cow at the Linux command line][2], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-lolcat - -作者:[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://github.com/busyloop/lolcat -[2]: https://opensource.com/article/18/12/linux-toy-cowsay diff --git a/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md b/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md new file mode 100644 index 0000000000..eb23d85e36 --- /dev/null +++ b/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Bring some color to your Linux terminal with lolcat) +[#]: via: (https://opensource.com/article/18/12/linux-toy-lolcat) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) +[#]: url: ( ) + +使用 lolcat 为你的 Linux 终端带来一些颜色 +====== +使用这个简单的程序,你可以为所需的任何程序的输出添加彩色。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-lolcat.png?itok=Es6dYcph) + +今天是 Linux 命令行玩具日历的第五天。如果这是你第一次访问该系列,你可能会问自己,什么是命令行玩具。即使我不太确定,但一般来说,它可能是一个游戏,或任何简单的可以帮助你在终端玩得开心的东西。 + +很可能你们中的一些人之前已经看过我们日历中的各种选择,但我们希望每个人至少见到一件新事物。 + +今日的选择,**lolcat**,是我选择的第一个没有在我的 Linux 发行版中打包的程序,但它安装仍然很简单。它是一个 Ruby 程序,你应该可以使用下面的命令轻松地添加到系统中。 + +``` +$ gem install lolcat +``` + +之后,只需将一些文本传送给它,就可以看到彩色的输出。例如,尝试几个之前在我们的日历中出现的程序,使用以下命令: + +``` +$ fortune | boxes -a c -d parchment | lolcat +``` + +根据你的运气,你可能会看到这样: +![](https://opensource.com/sites/default/files/uploads/linux-toy-lolcat-parchment.png) + +你可以传递给 **lolcat** 一些参数而不必重复它们,我建议你访问 **lolcat** 的 [GitHub 页面][1] 或者在终端输入 **lolcat --help** 了解。但一般来说,它们能设置彩虹的传递和频率,以及我个人最喜欢的动画。谁不喜欢终端的彩色动画打印?让我们再试一次,用一个不同的边框(当然是以猫为主题)和一句在我的句子列表中的适合猫的句子。 + +``` +fortune -m "nine tails" | boxes -a c -d cat | lolcat -a +``` +![](https://opensource.com/sites/default/files/uploads/linux-toy-lolcat-animated.gif) +**lolcat** 是 BSD 许可下的开源软件。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +了解一下昨天的玩具,[在 Linux 命令行中拥有一头牛][2],还有记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-lolcat + +作者:[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://github.com/busyloop/lolcat +[2]: https://opensource.com/article/18/12/linux-toy-cowsay \ No newline at end of file From 9a64f2f248272e42575bf2bfea5e92617ac97731 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 14 Dec 2018 09:18:25 +0800 Subject: [PATCH 0098/4278] translating --- ...81205 How To Fix Broken Ubuntu OS Without Reinstalling It.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md b/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md index a00541b536..0d24e0d7c6 100644 --- a/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md +++ b/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (How To Fix Broken Ubuntu OS Without Reinstalling It) From 33ef858c9cc0afaa1d694b1848c2777e87d7f214 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 12:37:57 +0800 Subject: [PATCH 0099/4278] PRF:20180412 A new approach to security instrumentation.md @hopefully2333 --- ...ew approach to security instrumentation.md | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/translated/talk/20180412 A new approach to security instrumentation.md b/translated/talk/20180412 A new approach to security instrumentation.md index c177e8f5fe..1d11efb63f 100644 --- a/translated/talk/20180412 A new approach to security instrumentation.md +++ b/translated/talk/20180412 A new approach to security instrumentation.md @@ -1,11 +1,13 @@ -一种新的用于安全检测的方法 +一种新的安全检测的方法 ====== +> 不要只测试已有系统,强安全要求更积极主动的策略。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) 我们当中有多少人曾说出过下面这句话:“我希望这能起到作用!”? -毫无疑问,我们中的大多数人可能都不止一次地说过这句话。这句话不是用来激发信心的,相反它揭示了我们对自身能力和当前正在测试功能的怀疑。不幸的是,这句话非常好地描述了我们传统的安全模型。我们的运营基于这样的假设,并希望我们实施的控制措施——从 web 应用的漏扫到终端上的杀毒软件——防止恶意的病毒和软件进入我们的系统,损坏或偷取我们的信息。 +毫无疑问,我们中的大多数人可能都不止一次地说过这句话。这句话不是用来激发信心的,相反它揭示了我们对自身能力和当前正在测试的功能的怀疑。不幸的是,这句话非常好地描述了我们传统的安全模型。我们的运营基于这样的假设,并希望我们实施的控制措施 —— 从 web 应用的漏扫到终端上的杀毒软件 —— 防止恶意的病毒和软件进入我们的系统,损坏或偷取我们的信息。 渗透测试通过积极地尝试侵入网络、向 web 应用注入恶意代码或者通过发送钓鱼邮件来传播病毒等等这些步骤来避免我们对假设的依赖。由于我们在不同的安全层面上来发现和渗透漏洞,手动测试无法解决漏洞被主动打开的情况。在安全实验中,我们故意在受控的情形下创造混乱,模拟事故的情形,来客观地检测我们检测、阻止这类问题的能力。 @@ -13,15 +15,15 @@ 在分布式系统的安全性和复杂性方面,需要反复地重申混沌工程界的一句名言,“希望不是一种有效的策略”。我们多久会主动测试一次我们设计或构建的系统,来确定我们是否已失去对它的控制?大多数组织都不会发现他们的安全控制措施失效了,直到安全事件的发生。我们相信“安全事件不是侦察措施”,而且“希望不要出事也不是一个有效的策略”应该是 IT 专业人士执行有效安全实践的口号。 -工业在传统上强调预防性的安全措施和纵深防御,但我们的任务是通过侦探实验来驱动对安全工具链新的知识和见解。因为过于专注于预防机制,我们很少尝试一次以上地或者年度性地手动测试要求的安全措施,来验证这些控件是否按设计的那样执行。 +行业在传统上强调预防性的安全措施和纵深防御,但我们的任务是通过侦探实验来驱动对安全工具链的新知识和见解。因为过于专注于预防机制,我们很少尝试一次以上地或者年度性地手动测试要求的安全措施,来验证这些控件是否按设计的那样执行。 -随着现代分布式系统中的无状态变量的不断改变,人们很难充分理解他们的系统的行为,因为会随时变化。解决这个问题的一种途径是通过强大的系统性的设备进行检测,对于安全性检测,你可以将这个问题分成两个主要方面,测试,和我们称之为实验的部分。测试是对我们已知部分的验证和评估,简单来说,就是我们在开始找之前,要先弄清楚我们在找什么。另一方面,实验是去寻找获得我们之前并不清楚的见解和知识。虽然测试对于一个成熟的安全团队来说是一项重要实践,但以下示例会有助于进一步地阐述两者之间的差异,并对实验的附加价值提供一个更为贴切的描述。 +随着现代分布式系统中的无状态变量的不断改变,人们很难充分理解他们的系统的行为,因为会随时变化。解决这个问题的一种途径是通过强大的系统性的设备进行检测,对于安全性检测,你可以将这个问题分成两个主要方面:**测试**,和我们称之为**实验**的部分。测试是对我们已知部分的验证和评估,简单来说,就是我们在开始找之前,要先弄清楚我们在找什么。另一方面,实验是去寻找获得我们之前并不清楚的见解和知识。虽然测试对于一个成熟的安全团队来说是一项重要实践,但以下示例会有助于进一步地阐述两者之间的差异,并对实验的附加价值提供一个更为贴切的描述。 ### 示例场景:精酿啤酒 思考一个用于接收精酿啤酒订单的 web 服务或者 web 应用。 -这是这家精酿啤酒运输公司的一项重要服务,这些订单来自客户的移动设备,网页,和通过为这家公司精酿啤酒提供服务的餐厅的 API。这项重要服务运行在 AWS EC2 环境上,并且公司认为它是安全的。这家公司去年成功地通过了 PCI 规则,并且每年都会请第三方进行渗透测试,所以公司认为这个系统是安全的。 +这是这家精酿啤酒运输公司的一项重要服务,这些订单来自客户的移动设备、网页,和通过为这家公司精酿啤酒提供服务的餐厅的 API。这项重要服务运行在 AWS EC2 环境上,并且公司认为它是安全的。这家公司去年成功地通过了 PCI 规则,并且每年都会请第三方进行渗透测试,所以公司认为这个系统是安全的。 这家公司有时一天两次部署来进行 DevOps 和持续交付工作,公司为其感到自豪。 @@ -35,10 +37,8 @@ * 该配置会从已选择的目标中随机指定对象,同时端口的范围和数量也会被改变。 * 团队还会设置进行实验的时间并缩小爆破攻击的范围,来确保对业务的影响最小。 * 对于第一次测试,团队选择在他们的测试环境中运行实验并运行一个单独的测试。 - * 在真实的游戏日风格里,团队在预先计划好的两个小时的窗口期内,选择灾难大师来运行实验。在那段窗口期内,灾难大师会在 EC2 实例安全组中的一个上执行这次实验。 - * 一旦游戏日结束,团队就会开始进行一个彻底的、无可指责的事后练习。它的重点在于针对稳定状态和原始假设的实验结果。问题会类似于下面这些: - - + * 在真实的游戏日Game Day风格里,团队在预先计划好的两个小时的窗口期内,选择灾难大师Master of Disaster来运行实验。在那段窗口期内,灾难大师会在 EC2 实例安全组中的一个实例上执行这次实验。 + * 一旦游戏日结束,团队就会开始进行一个彻底的、免于指责的事后练习。它的重点在于针对稳定状态和原始假设的实验结果。问题会类似于下面这些: ### 事后验证问题 @@ -53,24 +53,22 @@ * 获得警报的 SOC 分析师是否能对警报采取措施,还是缺少必要的信息? * 如果 SOC 确定警报是真实的,那么安全事件响应是否能简单地从数据中进行分类活动? - - 我们系统中对失败的承认和预期已经开始揭示我们对系统工作的假设。我们的使命是利用我们所学到的,并更加广泛地应用它。以此来真正主动地解决安全问题,来超越当前传统主流的被动处理问题的安全模型。 随着我们继续在这个新领域内进行探索,我们一定会发布我们的研究成果。如果您有兴趣想了解更多有关研究的信息或是想参与进来,请随时联系 Aaron Rinehart 或者 Grayson Brewer。 特别感谢 Samuel Roden 对本文提供的见解和想法。 -**[看我们相关的文章,是否需要 DevSecOps 这个词?][3]]** +- [看我们相关的文章:是否需要 DevSecOps 这个词?][3] -------------------------------------------------------------------------------- via: https://opensource.com/article/18/4/new-approach-security-instrumentation 作者:[Aaron Rinehart][a] -译者:[hopefully2333](https://github.com/hopefully2333) -校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7c5916acf360265c794986ab1717a112afa72927 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 12:38:18 +0800 Subject: [PATCH 0100/4278] PUB:20180412 A new approach to security instrumentation.md @hopefully2333 https://linux.cn/article-10345-1.html --- .../20180412 A new approach to security instrumentation.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180412 A new approach to security instrumentation.md (100%) diff --git a/translated/talk/20180412 A new approach to security instrumentation.md b/published/20180412 A new approach to security instrumentation.md similarity index 100% rename from translated/talk/20180412 A new approach to security instrumentation.md rename to published/20180412 A new approach to security instrumentation.md From 16e2c4165820d030e759b31a99bd6d0d3c88d1ea Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 14 Dec 2018 12:58:38 +0800 Subject: [PATCH 0101/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Buil?= =?UTF-8?q?d=20a=20Netboot=20Server,=20Part=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2 How to Build a Netboot Server, Part 2.md | 454 ++++++++++++++++++ 1 file changed, 454 insertions(+) create mode 100644 sources/tech/20181212 How to Build a Netboot Server, Part 2.md diff --git a/sources/tech/20181212 How to Build a Netboot Server, Part 2.md b/sources/tech/20181212 How to Build a Netboot Server, Part 2.md new file mode 100644 index 0000000000..0301a34da5 --- /dev/null +++ b/sources/tech/20181212 How to Build a Netboot Server, Part 2.md @@ -0,0 +1,454 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Build a Netboot Server, Part 2) +[#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +How to Build a Netboot Server, Part 2 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot2-816x345.jpg) + +The article [How to Build a Netboot Server, Part 1][1] showed you how to create a netboot image with a “liveuser” account whose home directory lives in volatile memory. Most users probably want to preserve files and settings across reboots, though. So this second part of the netboot series shows how to reconfigure the netboot image from part one so that [Active Directory][2] user accounts can log in and their home directories can be automatically mounted from a NFS server. + +Part 3 of this series will show how to make an interactive and centrally-configurable iPXE boot menu for the netboot clients. + +### Setup NFS4 Home Directories with KRB5 Authentication + +Follow the directions from the previous post “[Share NFS Home Directories Securely with Kerberos][3],” then return here. + +### Remove the Liveuser Account + +Remove the “liveuser” account created in part one of this series: + +``` +$ sudo -i +# sed -i '/automaticlogin/Id' /fc28/etc/gdm/custom.conf +# rm -f /fc28/etc/sudoers.d/liveuser +# for i in passwd shadow group gshadow; do sed -i '/^liveuser:/d' /fc28/etc/$i; done +``` + +### Configure NTP, KRB5 and SSSD + +Next, we will need to duplicate the NTP, KRB5, and SSSD configuration that we set up on the server in the client image so that the same accounts will be available: + +``` +# MY_HOSTNAME=$(> /fc28/etc/$i; done +``` + +### Join Active Directory + +Next, you’ll perform a chroot to join the client image to Active Directory. Begin by deleting any pre-existing computer account with the same name your netboot image will use: + +``` +# MY_USERNAME=jsmith +# MY_CLIENT_HOSTNAME=$( /fc28/root/.bash_history +``` + +### Install and Configure PAM Mount + +We want our clients to automatically mount the user’s home directory when they log in. To accomplish this, we’ll use the “pam_mount” module. Install and configure pam_mount: + +``` +# dnf install -y --installroot=/fc28 pam_mount +# cat << END > /fc28/etc/security/pam_mount.conf.xml + + + + + + +Password: + +END +``` + +Reconfigure PAM to use pam_mount: + +``` +# dnf install -y patch +# cp -r /fc28/usr/share/authselect/default/sssd /fc28/etc/authselect/custom +# echo 'initgroups: files' >> /fc28/etc/authselect/custom/sssd/nsswitch.conf +# patch /fc28/etc/authselect/custom/sssd/system-auth << END +@@ -12 +12,2 @@ +-auth sufficient pam_sss.so forward_pass ++auth requisite pam_mount.so {include if "with-pammount"} ++auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} +@@ -35,2 +36,3 @@ + session required pam_unix.so ++session optional pam_mount.so {include if "with-pammount"} + session optional pam_sss.so +END +# patch /fc28/etc/authselect/custom/sssd/password-auth << END +@@ -9 +9,2 @@ +-auth sufficient pam_sss.so forward_pass ++auth requisite pam_mount.so {include if "with-pammount"} ++auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} +@@ -32,2 +33,3 @@ + session required pam_unix.so ++session optional pam_mount.so {include if "with-pammount"} + session optional pam_sss.so +END +# chroot /fc28 authselect select custom/sssd with-pammount --force +``` + +Also ensure the NFS server’s hostname is always resolvable from the client: + +``` +# MY_IP=$(host -t A $MY_HOSTNAME | awk '{print $4}') +# echo "$MY_IP $MY_HOSTNAME ${MY_HOSTNAME%%.*}" >> /fc28/etc/hosts +``` + +Optionally, allow all users to run sudo: + +``` +# echo '%users ALL=(ALL) NOPASSWD: ALL' > /fc28/etc/sudoers.d/users +``` + +### Convert the NFS Root to an iSCSI Backing-Store + +Current versions of nfs-utils may have difficulty establishing a second connection from the client back to the NFS server for home directories when an nfsroot connection is already established. The client hangs when attempting to access the home directory. So, we will work around the problem by using a different protocol (iSCSI) for sharing our netboot image. + +First chroot into the image to reconfigure its initramfs for booting from an iSCSI root: + +``` +# for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done +# chroot /fc28 /usr/bin/bash --login +# dnf install -y iscsi-initiator-utils +# sed -i 's/nfs/iscsi/' /etc/dracut.conf.d/netboot.conf +# echo 'omit_drivers+=" qedi "' > /etc/dracut.conf.d/omit-qedi.conf +# echo 'blacklist qedi' > /etc/modprobe.d/blacklist-qedi.conf +# KERNEL=$(ls -c /lib/modules | head -n 1) +# INITRD=$(find /boot -name 'init*' | grep -m 1 $KERNEL) +# dracut -f $INITRD $KERNEL +# logout +# for i in run sys proc dev/shm dev/pts dev; do umount /fc28/$i; done +# > /fc28/root/.bash_history +``` + +The qedi driver broke iscsi during testing, so it’s been disabled here. + +Next, create a fc28.img [sparse file][4]. This file serves as the iSCSI target’s backing store: + +``` +# FC28_SIZE=$(du -ms /fc28 | cut -f 1) +# dd if=/dev/zero of=/fc28.img bs=1MiB count=0 seek=$(($FC28_SIZE*2)) +``` + +(If you have one available, a separate partition or disk drive can be used instead of creating a file.) + +Next, format the image with a filesystem, mount it, and copy the netboot image into it: + +``` +# mkfs -t xfs -L NETROOT /fc28.img +# TEMP_MNT=$(mktemp -d) +# mount /fc28.img $TEMP_MNT +# cp -a /fc28/* $TEMP_MNT +# umount $TEMP_MNT +``` + +During testing using SquashFS, the client would occasionally stutter. It seems that SquashFS does not perform well when doing random I/O from a multiprocessor client. (See also [The curious case of stalled squashfs reads][5].) If you want to improve throughput performance with filesystem compression, [ZFS][6] is probably a better option. + +If you need extremely high throughput from the iSCSI server (say, for hundreds of clients), it might be possible to [load balance][7] a [Ceph][8] cluster. For more information, see [Load Balancing Ceph Object Gateway Servers with HAProxy and Keepalived][9]. + +### Install and Configure iSCSI + +Install the scsi-target-utils package which will provide the iSCSI daemon for serving our image out to our clients: + +``` +# dnf install -y scsi-target-utils +``` + +Configure the iSCSI daemon to serve the fc28.img file: + +``` +# MY_REVERSE_HOSTNAME=$(echo $MY_HOSTNAME | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_HOSTNAME}) +# cat << END > /etc/tgt/conf.d/fc28.conf + + backing-store /fc28.img + readonly 1 + +END +``` + +The leading iqn. is expected by /usr/lib/dracut/modules.d/40network/net-lib.sh. + +Add an exception to the firewall and enable and start the service: + +``` +# firewall-cmd --add-service=iscsi-target +# firewall-cmd --runtime-to-permanent +# systemctl enable tgtd.service +# systemctl start tgtd.service +``` + +You should now be able to see the image being shared with the tgtadm command: + +``` +# tgtadm --mode target --op show +``` + +The above command should output something similar to the following: + +``` +Target 1: iqn.edu.example.server-01:fc28 + System information: + Driver: iscsi + State: ready + I_T nexus information: + LUN information: + LUN: 0 + Type: controller + SCSI ID: IET 00010000 + SCSI SN: beaf10 + Size: 0 MB, Block size: 1 + Online: Yes + Removable media: No + Prevent removal: No + Readonly: No + SWP: No + Thin-provisioning: No + Backing store type: null + Backing store path: None + Backing store flags: +  LUN: 1 + Type: disk + SCSI ID: IET 00010001 + SCSI SN: beaf11 + Size: 10488 MB, Block size: 512 + Online: Yes + Removable media: No + Prevent removal: No + Readonly: Yes + SWP: No + Thin-provisioning: No + Backing store type: rdwr + Backing store path: /fc28.img + Backing store flags: + Account information: + ACL information: + ALL +``` + +We can now remove the NFS share that we created in part one of this series: + +``` +# rm -f /etc/exports.d/fc28.exports +# exportfs -rv +# umount /export/fc28 +# rmdir /export/fc28 +# sed -i '/^\/fc28 /d' /etc/fstab +``` + +You can also delete the /fc28 filesystem, but you may want to keep it for performing future updates. + +### Update the ESP to use the iSCSI Kernel + +Ipdate the ESP to contain the iSCSI-enabled initramfs: + +``` +$ rm -vf $HOME/esp/linux/*.fc28.* +$ MY_KRNL=$(ls -c /fc28/lib/modules | head -n 1) +$ cp $(find /fc28/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $MY_KRNL) $HOME/esp/linux/vmlinuz-$MY_KRNL +$ cp $(find /fc28/boot -name 'init*' | grep -m 1 $MY_KRNL) $HOME/esp/linux/initramfs-$MY_KRNL.img +``` + +Update the boot.cfg file to pass the new root and netroot parameters: + +``` +$ MY_NAME=server-01.example.edu +$ MY_EMAN=$(echo $MY_NAME | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_NAME}) +$ MY_ADDR=$(host -t A $MY_NAME | awk '{print $4}') +$ sed -i "s! root=[^ ]*! root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc28-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc28!" $HOME/esp/linux/boot.cfg +``` + +Now you just need to copy the updated files from your $HOME/esp/linux directory out to the ESPs of all your client systems. You should see results similar to what is shown in the below screenshot: + +![][10] + +### Upgrading the Image + +First, make a copy of the current image: + +``` +# cp -a /fc28 /fc29 +``` + +Chroot into the new copy of the image: + +``` +# for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc29/$i; done +# chroot /fc29 /usr/bin/bash --login +``` + +Allow updating the kernel: + +``` +# sed -i 's/^exclude=kernel-\*$/#exclude=kernel-*/' /etc/dnf/dnf.conf +``` + +Perform the upgrade: + +``` +# dnf distro-sync -y --releasever=29 +``` + +Prevent the kernel from being updated: + +``` +# sed -i 's/^#exclude=kernel-\*$/exclude=kernel-*/' /etc/dnf/dnf.conf +``` + +The above command is optional, but saves you from having to copy a new kernel out to the clients if you add or update a few packages in the image at some future time. + +Clean up dnf’s package cache: + +``` +# dnf clean all +``` + +Exit the chroot and clear root’s command history: + +``` +# logout +# for i in run sys proc dev/shm dev/pts dev; do umount /fc29/$i; done +# > /fc29/root/.bash_history +``` + +Create the iSCSI image: + +``` +# FC29_SIZE=$(du -ms /fc29 | cut -f 1) +# dd if=/dev/zero of=/fc29.img bs=1MiB count=0 seek=$(($FC29_SIZE*2)) +# mkfs -t xfs -L NETROOT /fc29.img +# TEMP_MNT=$(mktemp -d) +# mount /fc29.img $TEMP_MNT +# cp -a /fc29/* $TEMP_MNT +# umount $TEMP_MNT +``` + +Define a new iSCSI target that points to our new image and export it: + +``` +# MY_HOSTNAME=$( /etc/tgt/conf.d/fc29.conf + + backing-store /fc29.img + readonly 1 + +END +# tgt-admin --update ALL +``` + +Add the new kernel and initramfs to the ESP: + +``` +$ MY_KRNL=$(ls -c /fc29/lib/modules | head -n 1) +$ cp $(find /fc29/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $MY_KRNL) $HOME/esp/linux/vmlinuz-$MY_KRNL +$ cp $(find /fc29/boot -name 'init*' | grep -m 1 $MY_KRNL) $HOME/esp/linux/initramfs-$MY_KRNL.img +``` + +Update the boot.cfg in the ESP: + +``` +$ MY_DNS1=192.0.2.91 +$ MY_DNS2=192.0.2.92 +$ MY_NAME=server-01.example.edu +$ MY_EMAN=$(echo $MY_NAME | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_NAME}) +$ MY_ADDR=$(host -t A $MY_NAME | awk '{print $4}') +$ cat << END > $HOME/esp/linux/boot.cfg +#!ipxe + +kernel --name kernel.efi \${prefix}/vmlinuz-$MY_KRNL initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=$MY_DNS1 nameserver=$MY_DNS2 root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc29-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc29 console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img \${prefix}/initramfs-$MY_KRNL.img +boot || exit +END +``` + +Finally, copy the files from your $HOME/esp/linux directory out to the ESPs of all your client systems and enjoy! + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ +[2]: https://en.wikipedia.org/wiki/Active_Directory +[3]: https://fedoramagazine.org/secure-nfs-home-directories-kerberos +[4]: https://en.wikipedia.org/wiki/Sparse_file +[5]: https://chrisdown.name/2018/04/17/kernel-adventures-the-curious-case-of-squashfs-stalls.html +[6]: https://en.wikipedia.org/wiki/ZFS +[7]: https://en.wikipedia.org/wiki/Load_balancing_(computing) +[8]: http://docs.ceph.com/docs/mimic/rbd/iscsi-overview/ +[9]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/load_balancer_administration/ceph_example +[10]: https://fedoramagazine.org/wp-content/uploads/2018/12/netboot-screenshot-1024x819.png From c84fd905c61451cbda33612a1ece8d14876e0a59 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 14 Dec 2018 13:00:34 +0800 Subject: [PATCH 0102/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Aliases:=20DIY?= =?UTF-8?q?=20Shell=20Commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181212 Aliases- DIY Shell Commands.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20181212 Aliases- DIY Shell Commands.md diff --git a/sources/tech/20181212 Aliases- DIY Shell Commands.md b/sources/tech/20181212 Aliases- DIY Shell Commands.md new file mode 100644 index 0000000000..d81fb03bb0 --- /dev/null +++ b/sources/tech/20181212 Aliases- DIY Shell Commands.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Aliases: DIY Shell Commands) +[#]: via: (https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +Aliases: DIY Shell Commands +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jodi-mucha-540841-unsplash.jpg?itok=n1d1VDUV) + +Aliases, in the context of the Linux shell, are **commands you build yourself** by packing them with combinations of other instructions that are too long or too hard to remember. + +You create an alias by using the word `alias`, then the name of the command you want to create, an equal sign (`=`), and then the Bash command(s) you want your alias to run. For example, `ls` in its base form does not colorize its output, making it difficult to distinguish between directories, files, and links. You can build a new command that shows colors by making an alias like this: + +``` +alias lc='ls --color=auto' +``` + +where `lc` is the name you have picked for your new command. When creating aliases, be sure to check that the name you picked isn't already in use, or you may override an existing command. In this case, `lc` stands for "list (with) color". Notice there is no space in front of or behind the `=`. Finally, you have the regular Bash command(s) you want to run when `lc` is executed. In this case, the `ls` command with the `--color` option. + +After defining your alias, every time you type `lc`, the contents of the current directory will be shown in color. + +But, you may think, "my `ls` command already lists files in different colors!" That is because most Linux distros come with some aliases already set up for you. + +### Aliases you (probably) already have + +Indeed, you can use the `alias` instruction without any options to see what aliases you already have. These will vary by distro, but some typical preset aliases are: + + * `alias ls='ls --color=auto'`: You already saw this one above. The `auto` modifier of the `--color` option tells `ls` to use color when standard output is connected to a terminal. That is, the output of `ls` is going to show up in a terminal window or a text screen, instead of, say, being piped to a file. Other alternatives for `--color` are `always` and `never`. + * `alias cp='cp -i'`: The `-i` option stands for _interactive_. Sometimes, when you use `cp` you may inadvertently overwrite an existing file. By using the `-i`, `cp` will ask you before clobbering anything. + * `alias free='free -m'`: Using `-m` with `free`you can see how much free memory you have and how much your applications are using in megabytes instead of the default bytes. This makes the output of `free` easier to read for a human. + + + +There may be more (or less, or even none), but regardless of what your distribution comes with, you can always use the base form (vs. the aliased form) of a command with the `\` modifier. For example: + +``` +\free +``` + +will execute `free` without the `-m` option, and + +``` +\ls +``` + +will execute `ls` without the `--color=auto` option. + +If you want to get rid or modify the preset aliases forever, note that they live in the global _.bashrc_ file which hangs out in [our old haunt, the _/etc/skel_ directory][1]. + +### Aliases for muscle memory + +Distro designers try their best to predict which aliases are going to be useful for you. But every user is different and comes from a different background. If you are new to GNU+Linux, it may be because you are coming from another system, and the basic commands vary from shell to shell. If you come from a Windows/MS-DOS background, you may want to define an alias like + +``` +alias dir='ls' +``` + +to list files or directories. + +Likewise, + +``` +alias copy='cp' +alias move='mv' +``` + +may also come in handy, at least until you get used to Linux's new lexicon. + +The other problem occurs when mistakes become ingrained in your muscle memory, so you always mistype some words the same way. I, for instance, have great difficulty typing _admnis-_... _adminsi-_... _A-D-M-I-N-I-S-T-R-A-T-I-ON_ ( _phew!_ ) at speed. That is why some users create aliases like + +``` +alias sl='ls' +``` + +and + +``` +alias gerp='echo "You did it *again*!"; grep' +``` + +Although we haven't formally introduced `grep` yet, in its most basic form, it looks for a string of characters in a file or a set of files. It's one of those commands that you will tend to use A LOT once you get to grips with it, as those ingrained mistyping habits that force you to type the instruction twice every time get annoying really quickly. + +Another thing to note in the `gerp` example is that it is not a single instruction, but two. The first one (`echo "You did it *again*!"`) prints out a message reminding you that you misspelled the grep command, then there is a semicolon (`;`) that separates one instruction from the other. Finally, you've got the second command (`grep`) that does the actual grepping. + +Using `gerp` on my system to search for the lines containing the word " _alias_ " in _/etc/skel/.bashrc_ , the output looks like this: + +``` +$ gerp -R alias /etc/skel/.bashrc +You did it *again*! + alias ls='ls --color=auto' + alias grep='grep --colour=auto' + alias egrep='egrep --colour=auto' + alias fgrep='fgrep --colour=auto' +alias cp="cp -i" +alias df='df -h' +alias free='free -m' +alias np='nano -w PKGBUILD' +alias more=less +shopt -s expand_aliases +``` + +Running commands sequentially as part of an alias, or, even better, chaining commands so that one command can use the results coughed up by another, is getting us perilously close to Bash scripting. This has been in the making of this series for quite some time, and we'll start covering it in the very next article. + +For the time being, if you want to get rid of an alias you temporarily set up in a running terminal, use the `unalias` command: + +``` +unalias gerp +``` + +If you want to make your aliases permanent, you can drop them into the _.bashrc_ file you have in your home directory. This is the same thing we did with custom environment variables in [last week's article][2]. + +See you next time! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands + +作者:[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/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts +[2]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise From 44d97063b39449b536f2ec944b3dead5b77abd01 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 13:28:27 +0800 Subject: [PATCH 0103/4278] PRF:20181204 Have a cow at the Linux command line.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @heguangzhi 请在使用翻译工具后,自己读一遍是否通顺,是否有明显错误! --- ...04 Have a cow at the Linux command line.md | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/translated/tech/20181204 Have a cow at the Linux command line.md b/translated/tech/20181204 Have a cow at the Linux command line.md index ef08209828..3be26492fe 100644 --- a/translated/tech/20181204 Have a cow at the Linux command line.md +++ b/translated/tech/20181204 Have a cow at the Linux command line.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Have a cow at the Linux command line) [#]: via: (https://opensource.com/article/18/12/linux-toy-cowsay) @@ -8,27 +8,28 @@ [#]: url: ( ) -在Linux命令行上拥有一头奶牛 +在 Linux 命令行上拥有一头奶牛 ====== -使用 cowsay 实用程序将牛的声音带到你的终端输出。 +> 使用 cowsay 实用程序将牛的话语带到你的终端输出。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cowsay.png?itok=RA4NDbrY) 欢迎来到 Linux 命令行玩具第四天。如果这是你第一次访问这个系列,你可能会问自己,什么是命令行玩具。我们也在考虑这一点,但是一般来说,这可能是一个游戏,或者任何简单的娱乐,可以帮助你在终端玩得开心。 -你们中的一些人以前会看过我们日历上的各种选项,但是我们希望每个人都至少有一个新的选项。因为几乎所有我提到这个系列的人都已经问过我了,今天的选项是必须的。 +你们中的一些人会见过我们之前的选中的各种玩具,但是我们希望至少有一个对每个人来说都是新的。因为几乎所有我告诉他这个系列的人都已经问过它了,所以今天的选中的玩具是必须提及的。 -你不认为我们会在不提及 cowsay 的情况下完成这个系列,是吗? +你也不会认为我们会在不提及 `cowsay` 的情况下完成这个系列,对吧? -Cowsey 是一个神奇的实用程序,它将文本作为ASCII艺术牛的口语文本输出。 +`cowsay` 是一个神奇的实用程序,它将文本作为 ASCII 艺术牛的讲话文本输出。 -你可能会发现 cowsey 打包在你的默认存储库中,甚至可能已经安装了。对我来说,在 Fedora,像这样安装: +你可能会发现 `cowsey` 打包在你的默认存储库中,甚至可能已经安装了。对我来说,在 Fedora,像这样安装: ``` $ sudo dnf install -y cowsay ``` -然后,用 cowsey 调用它,然后是你的消息。也许你想到昨天我们谈到的 [幸运][1] [应用][1]。 + +然后,用 `cowsey` 调用它,然后是你的消息。也许你想到昨天我们谈到的 [fortune 应用][1] 连接起来。 ``` $ fortune | cowsay @@ -43,7 +44,7 @@ $ fortune | cowsay                 ||     || ``` -就这样!**CowSay** 几乎没有变化,称为 cow 文件,通常可以在 **/usr/share/cowsay** ,要查看系统上可用的 cow 文件选项,请在 cowsay 之后使用 **-l** 。然后,用 **-f** 试试其中之一。 +就这样!`cowsay` 还有点小变体,称为 cow 文件,通常可以在 `/usr/share/cowsay` 找到 ,要查看系统上可用的 cow 文件,请在 `cowsay` 之后使用 `-l` 。然后,用 `-f` 试试其中之一。 ``` $ cowsay -f dragon "Run for cover, I feel a sneeze coming on." @@ -68,10 +69,10 @@ $ cowsay -f dragon "Run for cover, I feel a sneeze coming on."                ///-._ _ _ _ _ _ _}^ - - - - ~                     ~-- ,.-~                                                                   /.-~ ``` -我对 **cowsay** 的真正不满是,我今天没有足够的时间来为牛的挤奶。牛排太高了,我可能会开个玩笑。 -更严重的是,我已经完全忘记了 **cowsay** 直到我在学习可翻译的剧本时再次遇到它。如果你碰巧安装了 **cowyay**,当你运行脚本时,你会从一系列奶牛身上获得产出。例如,运行本脚本: +我对 `cowsay` 的真正不满是,我今天没有足够的时间来为牛的挤奶 —— 一语双关。牛排价格太高了,我只是开个玩笑。 +更严重的是,我已经完全忘记了 `cowsay` 直到我在学习 Ansible 的剧本时再次遇到它。如果你碰巧安装了 `cowyay`,当你运行Ansible 的剧本时,你会从一队奶牛那里获得输出。例如,运行这个剧本: ``` - hosts: @@ -79,7 +80,8 @@ $ cowsay -f dragon "Run for cover, I feel a sneeze coming on."   tasks:     - action: ping ``` -可能会给你以下信息: + +可能会给你以下信息: ``` $ ansible-playbook playbook.yml @@ -123,14 +125,14 @@ ok: [localhost] localhost                  : ok=2    changed=0    unreachable=0    failed=0   ``` -**Cowsay** 在GPLV3许可证下可用,您可以在 GitHub 上找到 Perl [源代码][2]。我也见过其他语言的版本,所以看看其他变体;例如,这是 [R语言][3] 。用你选择的语言实现你自己的版本可能是一项有趣的编程学习任务。 -Now that **cowsay** is out of the way, we can move on to greener pastures. -既然 **cowsay** 不碍事了,我们可以去更绿色的牧场了。 +`cowsay` 在 GPLv3 许可证下可用,您可以在 GitHub 上找到 它的 Perl [源代码][2]。我也见过其他语言的版本,所以可以看看其他变体;例如,这是 [R 语言版][3]。用你选择的语言实现你自己的版本可能是一项有趣的编程学习任务。 -你有最喜欢的命令行玩具吗,你认为我应该对它进行分析?这个系列的日历大部分都填好了,但我还有一些地方。在下面的评论中让我知道,梦幻篮球来看看。如果有空间,梦幻篮球会尝试把它包括进去。如果没有,但是我收到了一些好的意见书,梦幻篮球在结尾做了一个荣誉提名的总结。 +既然讲完了 `cowsay`,我们可以去更绿色的牧场了。 -看看昨天的玩具,[如何给你的Linux终端带来好运][1],明天再来看看另一个! +你有希望我来介绍的喜欢的命令行玩具吗?这个系列的排期大部分都填好了,但我还有一些空位方。在下面的评论中让我知道,我会来看看。如果有空间,我会尝试把它包括进去。如果没有,但是我收到了一些好的意见,我在结尾提及。 + +看看昨天的玩具,[如何给你的 Linux 终端带来好运][1],明天再来看看另一个! -------------------------------------------------------------------------------- @@ -139,7 +141,7 @@ via: https://opensource.com/article/18/12/linux-toy-cowsay 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0edbad70ff8d58c20d658fb5ddd064fb8339e500 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 13:29:20 +0800 Subject: [PATCH 0104/4278] PUB:20181204 Have a cow at the Linux command line.md @heguangzhi https://linux.cn/article-10346-1.html --- .../20181204 Have a cow at the Linux command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181204 Have a cow at the Linux command line.md (98%) diff --git a/translated/tech/20181204 Have a cow at the Linux command line.md b/published/20181204 Have a cow at the Linux command line.md similarity index 98% rename from translated/tech/20181204 Have a cow at the Linux command line.md rename to published/20181204 Have a cow at the Linux command line.md index 3be26492fe..ad7b054d9a 100644 --- a/translated/tech/20181204 Have a cow at the Linux command line.md +++ b/published/20181204 Have a cow at the Linux command line.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Have a cow at the Linux command line) [#]: via: (https://opensource.com/article/18/12/linux-toy-cowsay) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10346-1.html) 在 Linux 命令行上拥有一头奶牛 From 570ff6a04195b65bd5410c4f5510ec37afa6dcbd Mon Sep 17 00:00:00 2001 From: qhwdw Date: Fri, 14 Dec 2018 14:16:16 +0800 Subject: [PATCH 0105/4278] fixed errors --- ...mputing with Open Source Cirq Framework.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md index 289a62de15..fcbc89e77c 100644 --- a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md +++ b/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @@ -6,15 +6,15 @@ -在我们开始了解量子计算之前,必须先去了解“量子”这个术语,量子是已知的 [亚原子粒子][1] 中最小的物质。[量子][2] 这个词来自拉丁语 Quantus,意思是 “非常小”,在下面的短视频链接中有描述: +在我们开始了解量子计算之前,必须先去了解“量子”这个术语,量子是已知的 [亚原子粒子][1] 中最小的物质。[量子][2] 这个词来自拉丁语 Quantus,意思是 “有多少”,在下面的短视频链接中有描述: -为了易于我们理解量子计算,我们将量子计算与传统计算Classical Computing(也译做经典计算)进行比较。传统计算是指设计用于工作的、我们正在使用的传统计算机,正如你现在用于阅读本文的设备,就是我们所谓的传统计算设备。 +为了易于我们理解量子计算,我们将量子计算与经典计算Classical Computing(也有译做传统计算)进行比较。经典计算是指设计用于工作的、正在使用的计算机,正如你现在用于阅读本文的设备,就是我们所谓的经典计算设备。 -### 传统计算 +### 经典计算 -传统计算是描述传统计算机如何工作的另一种方式。它们通过一个二进制系统工作,即信息使用 1 或 0 来存储。传统计算机不会理解除 1 或 0 之外的任何其它东西。 +经典计算是描述计算机如何工作的另一种方式。它们通过一个二进制系统工作,即信息使用 1 或 0 来存储。经典计算机不会理解除 1 或 0 之外的任何其它东西。 直白来说,在计算机内部一个晶体管只能是开(1)或关(0)。我们输入的任何信息都被转换为无数个 1 和 0,所以计算机只能理解和存储 1 和 0。所有的东西都只能用无数个 1 和 0 的组合来表示。 @@ -22,7 +22,7 @@ ### 量子计算 -然而,量子计算不再像传统计算那样遵循 “开或关” 的模式。而是,借助量子的名为 [叠加和纠缠][3] 的两个现象,能同时处理信息的多个状态,因此能以更快的速率加速计算,并且在信息存储方面效率更高。 +然而,量子计算不再像经典计算那样遵循 “开或关” 的模式。而是,借助量子的名为 [叠加和纠缠][3] 的两个现象,能同时处理信息的多个状态,因此能以更快的速率加速计算,并且在信息存储方面效率更高。 请注意,叠加和纠缠 [不是同一个现象][4]。 @@ -30,9 +30,9 @@ ![][5] -就像在传统计算中,我们有比特bit,在量子计算中,我们相应也有量子比特qubits(或 Quantum bits)。想了解它们二者之间的巨大差异之处,请查看这个 [页面][6],从那里的图片中可以得到答案。 +就像在经典计算中,我们有比特bit,在量子计算中,我们相应也有量子比特qubits(或 Quantum bits)。想了解它们二者之间的巨大差异之处,请查看这个 [页面][6],从那里的图片中可以得到答案。 -量子计算机并不是来替代我们的传统计算机的。但是,有一些非常巨大的任务用我们的传统计算机是无法完成的,而那些正是量子计算机大显身手的好机会。下面链接的视频详细描述了上述情况,同时也描述了量子计算机的原理。 +量子计算机并不是来替代我们的经典计算机的。但是,有一些非常巨大的任务用我们的经典计算机是无法完成的,而那些正是量子计算机大显身手的好机会。下面链接的视频详细描述了上述情况,同时也描述了量子计算机的原理。 @@ -44,7 +44,7 @@ 根据最新更新的(2018 年 7 月 31 日)研究论文,术语 “Noisy” 是指由于对量子比特未能完全控制所产生的不准确性。正是这种不准确性严重制约了量子设备短期内实现其目标。 -“中型” 指的是在接下来的几年中,量子计算机将要实现的规模大小,届时,量子比特的数目将可能从 50 到几百个不等。50 个量子比特是一个重大的量程碑,因为它将超越现有的最强大的 [超级计算机][8] 的 [暴力][7] 模拟能力。更多信息请阅读 [这里的][9] 论文。 +“中型” 指的是在接下来的几年中,量子计算机将要实现的量子规模大小,届时,量子比特的数目将可能从 50 到几百个不等。50 个量子比特是一个重大的量程碑,因为它将超越现有的最强大的 [超级计算机][8] 的 [暴力][7] 模拟能力。更多信息请阅读 [这里的][9] 论文。 随着 Cirq 出现,许多事情将会发生变化。 @@ -133,7 +133,7 @@ Cirq 的开发者在 GitHub 上已经放了学习 [教程][22]。如果你想认 #### OpenFermion-Cirq -[OpenFermion][24] 是一个开源库,它是为了在量子计算机上模拟获取和操纵表示费米系统(包含量子化学)。根据 [粒子物理学][26] 理论,按照 [费米— 狄拉克统计][27],费米系统与 [费米子][25] 的产生相关。 +[OpenFermion][24] 是一个开源库,它是为了在量子计算机上模拟获取和操纵代表的费米系统(包含量子化学)。根据 [粒子物理学][26] 理论,按照 [费米— 狄拉克统计][27],费米系统与 [费米子][25] 的产生相关。 OpenFermion 被称为从事 [量子化学][29] 的化学家和研究人员的 [一个极好的实践工具][28]。量子化学主要专注于 [量子力学][30] 在物理模型和化学系统实验中的应用。量子化学也被称为 [分子量子力学][31]。 @@ -143,7 +143,7 @@ Cirq 的出现使 OpenFermion 通过提供程序和工具去扩展功能成为 2018 年 3 月 5 日,在洛杉矶举行的一年一度的 [美国物理学会会议][33] 上,Google 发布了 [Bristlecone][32],这是他们的最新的量子处理器。这个 [基于门的超导系统][34] 为 Google 提供了一个测试平台,用以研究 [量子比特技术][37] 的 [系统错误率][35] 和 [扩展性][36] ,以及在量子 [仿真][38]、[优化][39]、和 [机器学习][40] 方面的应用。 -Google 希望在不久的将来,能够制造出它的 [云可访问][41] 的 72 个量子比特的 Bristlecone 量子处理器。Bristlecone 将越来越有能力完成一个传统超级计算机无法在合理时间内完成的任务。 +Google 希望在不久的将来,能够制造出它的 [云可访问][41] 的 72 个量子比特的 Bristlecone 量子处理器。Bristlecone 将越来越有能力完成一个经典超级计算机无法在合理时间内完成的任务。 Cirq 将让研究人员直接在云上为 Bristlecone 写程序变得很容易,它提供了一个非常方便的、实时的、量子编程和测试的接口。 @@ -164,7 +164,7 @@ Cirq 将允许我们去: ### 总结 -最后我们总结一下,我们首先通过与传统计算相比较,介绍了量子计算的概念,然后是一个非常重要的视频来介绍了自去年以来量子计算的最新发展。接着我们简单讨论了嘈杂中型量子,也就是为什么要特意构建 Cirq 的原因所在。 +最后我们总结一下,我们首先通过与经典计算相比较,介绍了量子计算的概念,然后是一个非常重要的视频来介绍了自去年以来量子计算的最新发展。接着我们简单讨论了嘈杂中型量子,也就是为什么要特意构建 Cirq 的原因所在。 我们看了如何在一个 Ubuntu 系统上安装和测试 Cirq。我们也在一个更好用的 IDE 环境中做了安装测试,并使用一些资源去开始学习有关概念。 From 6e8022ff249ef730a44c50a02a6c6f19e857bd8d Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 14 Dec 2018 13:46:21 +0800 Subject: [PATCH 0106/4278] Update 20181210 How to Update Ubuntu.md --- ... How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 50ba70c073..3a9036f403 100644 --- a/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -1,11 +1,12 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (LazyWolfLin) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) [#]: via: (https://itsfoss.com/update-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) +Translating by LazyWolfLin How to Update Ubuntu [Terminal & GUI Methods] It's FOSS ====== From a999ca5553f426d137f9c292f2d76468ff7aed40 Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 14 Dec 2018 16:19:54 +0800 Subject: [PATCH 0107/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20180623 The IBM 029 Card Punch.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/talk/20180623 The IBM 029 Card Punch.md b/sources/talk/20180623 The IBM 029 Card Punch.md index b8af5fb602..6b36845c2d 100644 --- a/sources/talk/20180623 The IBM 029 Card Punch.md +++ b/sources/talk/20180623 The IBM 029 Card Punch.md @@ -1,3 +1,6 @@ +Translating by wwhio + + The IBM 029 Card Punch ====== Lines of code longer than 80 characters drive me crazy. I appreciate that this is pedantic. I’ve seen people on the internet make good arguments for why the 80-character limit ought to be respected even on our modern Retina-display screens, but those arguments hardly justify the visceral hatred I feel for even that one protruding 81st character. From 1f801d3d030d0ff0a6675b0aa2c9c140919695b6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 16:38:54 +0800 Subject: [PATCH 0108/4278] PRF:20181102 Create a containerized machine learning model.md @geekpi --- ...Create a containerized machine learning model.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/translated/tech/20181102 Create a containerized machine learning model.md b/translated/tech/20181102 Create a containerized machine learning model.md index 7c48ba6af7..0bad5a3bc6 100644 --- a/translated/tech/20181102 Create a containerized machine learning model.md +++ b/translated/tech/20181102 Create a containerized machine learning model.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Create a containerized machine learning model) [#]: via: (https://fedoramagazine.org/create-containerized-machine-learning-model/) @@ -32,7 +32,7 @@ mkdir deployment_container && cd deployment_container 下一步是为机器学习模型创建 REST API。这个 [github 仓库][4]包含一个预训练模型,以及能让 REST API 工作的设置。 -使用以下命令在 deployment_container 目录中克隆它: +使用以下命令在 `deployment_container` 目录中克隆它: ``` git clone https://github.com/svenboesiger/titanic_tf_ml_model.git @@ -44,7 +44,7 @@ git clone https://github.com/svenboesiger/titanic_tf_ml_model.git #### swagger.yaml -swagger.yaml 使用 [Swagger规范][7] 定义 Connexion 库的 API。此文件包含让你的服务器提供输入参数验证、输出响应数据验证、URL 端点定义所需的所有信息。 +[swagger.yaml][12] 使用 [Swagger规范][7] 定义 Connexion 库的 API。此文件包含让你的服务器提供输入参数验证、输出响应数据验证、URL 端点定义所需的所有信息。 额外地,Connexion 还将给你提供一个简单但有用的单页 Web 应用,它演示了如何使用 Javascript 调用 API 和更新 DOM。 @@ -110,7 +110,7 @@ pandas ### 容器化! -为了让 Podman 构建映像,请在上面的准备步骤中创建的 **deployment_container** 目录中创建一个名为 “Dockerfile” 的新文件: +为了让 Podman 构建映像,请在上面的准备步骤中创建的 `deployment_container` 目录中创建一个名为 `Dockerfile` 的新文件: ``` FROM fedora:28 @@ -171,7 +171,7 @@ via: https://fedoramagazine.org/create-containerized-machine-learning-model/ 作者:[Sven Bösiger][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/) 荣誉推出 @@ -187,4 +187,5 @@ via: https://fedoramagazine.org/create-containerized-machine-learning-model/ [8]: https://github.com/svenboesiger/titanic_tf_ml_model/blob/master/server.py [9]: https://github.com/svenboesiger/titanic_tf_ml_model/blob/master/requirements.txt [10]: http://0.0.0.0:5000/ -[11]: https://fedoramagazine.org/wp-content/uploads/2018/10/Screenshot-from-2018-10-27-14-46-56-682x1024.png \ No newline at end of file +[11]: https://fedoramagazine.org/wp-content/uploads/2018/10/Screenshot-from-2018-10-27-14-46-56-682x1024.png +[12]: https://github.com/svenboesiger/titanic_tf_ml_model/blob/master/swagger.yaml From 5973f0ef5be151ca0023d5f2571d7c8a7c609242 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 16:40:28 +0800 Subject: [PATCH 0109/4278] REV:20181102 Create a containerized machine learning model.md @geekpi --- .../20181102 Create a containerized machine learning model.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => review}/20181102 Create a containerized machine learning model.md (100%) diff --git a/translated/tech/20181102 Create a containerized machine learning model.md b/review/20181102 Create a containerized machine learning model.md similarity index 100% rename from translated/tech/20181102 Create a containerized machine learning model.md rename to review/20181102 Create a containerized machine learning model.md From 517cd3c6f43fe63e90434c075f580ebfe2dd3c9a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 16:43:00 +0800 Subject: [PATCH 0110/4278] Revert "REV:20181102 Create a containerized machine learning model.md" This reverts commit 5973f0ef5be151ca0023d5f2571d7c8a7c609242. --- .../20181102 Create a containerized machine learning model.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {review => translated/tech}/20181102 Create a containerized machine learning model.md (100%) diff --git a/review/20181102 Create a containerized machine learning model.md b/translated/tech/20181102 Create a containerized machine learning model.md similarity index 100% rename from review/20181102 Create a containerized machine learning model.md rename to translated/tech/20181102 Create a containerized machine learning model.md From 9304ca0b08e70d1af725ebc7a37945561d6f5e16 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 17:30:41 +0800 Subject: [PATCH 0111/4278] PRF:20180814 HTTP request routing and validation with gorilla-mux.md @yongshouzhang --- ...routing and validation with gorilla-mux.md | 636 ++++++------------ 1 file changed, 214 insertions(+), 422 deletions(-) diff --git a/translated/tech/20180814 HTTP request routing and validation with gorilla-mux.md b/translated/tech/20180814 HTTP request routing and validation with gorilla-mux.md index 4699398bcc..4dcf7f7f52 100644 --- a/translated/tech/20180814 HTTP request routing and validation with gorilla-mux.md +++ b/translated/tech/20180814 HTTP request routing and validation with gorilla-mux.md @@ -1,68 +1,70 @@ -使用 gorilla/mux 进行HTTP请求路由和验证 +使用 gorilla/mux 进行 HTTP 请求路由和验证 ====== +> gorilla/mux 包以直观的 API 提供了 HTTP 请求路由、验证和其它服务。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) -Go 网络库包括 `http.ServeMux` 结构类型,它支持 HTTP 请求多路复用(路由):Web 服务器将托管资源的 HTTP 请求与诸如 sales4today 之类的 URI 路由到代码处理程序; 处理程序在发送 HTTP 响应(通常是 HTML 页面)之前执行适当的逻辑。 这是该体系的草图: +Go 网络库包括 `http.ServeMux` 结构类型,它支持 HTTP 请求多路复用(路由):Web 服务器将托管资源的 HTTP 请求与诸如 `/sales4today` 之类的 URI 路由到代码处理程序;处理程序在发送 HTTP 响应(通常是 HTML 页面)之前执行适当的逻辑。 这是该体系的草图: ``` -                 +------------+     +--------+     +---------+ -HTTP 请求---->| web 服务器 |---->| 路由 |---->| 处理程序| -                 +------------+     +--------+     +---------+ +             +-----------+     +--------+     +---------+ +HTTP 请求---->| web 服务器 |---->| 路由 |---->| 处理程序 | +             +-----------+     +--------+     +---------+ ``` -调用 `ListenAndServe` 方法后启动 HTTP 服务器 +调用 `ListenAndServe` 方法后启动 HTTP 服务器: ``` http.ListenAndServe(":8888", nil) // args: port & router ``` - 第二个参数 `nil` 意味着 `DefaultServeMux` 用于请求路由。 `gorilla/mux` 库包含 `mux.Router` 类型,可替代 `DefaultServeMux` 或自定义请求多路复用器。 在 `ListenAndServe` 调用中,`mux.Router` 实例将代替 `nil` 作为第二个参数。 下面的示例代码很好的说明了为什么 `mux.Router`如此吸引人: -### 1\. A sample crud web app +### 1、一个简单的 CRUD web 应用程序 + +crud web 应用程序(见下文)支持四种 CRUD(创建/读取/更新/删除)操作,它们分别对应四种 HTTP 请求方法:POST、GET、PUT 和 DELETE。 在这个 CRUD 应用程序中,所管理的资源是套话与反套话的列表,每个都是套话及其反面的的套话,例如这对: -crud web 应用程序(见下文)支持四种 CRUD(创建读取更新删除)操作,它们分别对应四种 HTTP 请求方法:POST,GET,PUT 和 DELETE。 在 crud 应用程序中,托管资源是陈词滥调对的列表,每个陈词滥调都是陈词滥调和冲突的陈词滥调,例如这对: ``` Out of sight, out of mind. Absence makes the heart grow fonder. - ``` -可以添加新的陈词滥调对,可以编辑或删除现有的陈词滥调对。 +可以添加新的套话对,可以编辑或删除现有的套话对。 + +CRUD web 应用程序: -**crud web 应用程序** ``` package main import ( -   "gorilla/mux" -   "net/http" -   "fmt" -   "strconv" + "gorilla/mux" + "net/http" + "fmt" + "strconv" ) const GETALL string = "GETALL" const GETONE string = "GETONE" -const POST string   = "POST" -const PUT string    = "PUT" +const POST string = "POST" +const PUT string = "PUT" const DELETE string = "DELETE" type clichePair struct { -   Id      int -   Cliche  string -   Counter string + Id int + Cliche string + Counter string } // Message sent to goroutine that accesses the requested resource. type crudRequest struct { -   verb     string -   cp       *clichePair -   id       int -   cliche   string -   counter  string -   confirm  chan string + verb string + cp *clichePair + id int + cliche string + counter string + confirm chan string } var clichesList = []*clichePair{} @@ -72,596 +74,386 @@ var crudRequests chan *crudRequest // GET / // GET /cliches func ClichesAll(res http.ResponseWriter, req *http.Request) { -   cr := &crudRequest{verb: GETALL, confirm: make(chan string)} -   completeRequest(cr, res, "read all") + cr := &crudRequest{verb: GETALL, confirm: make(chan string)} + completeRequest(cr, res, "read all") } // GET /cliches/id func ClichesOne(res http.ResponseWriter, req *http.Request) { -   id := getIdFromRequest(req) -   cr := &crudRequest{verb: GETONE, id: id, confirm: make(chan string)} -   completeRequest(cr, res, "read one") + id := getIdFromRequest(req) + cr := &crudRequest{verb: GETONE, id: id, confirm: make(chan string)} + completeRequest(cr, res, "read one") } // POST /cliches - func ClichesCreate(res http.ResponseWriter, req *http.Request) { - -   cliche, counter := getDataFromRequest(req) - -   cp := new(clichePair) - -   cp.Cliche = cliche - -   cp.Counter = counter - -   cr := &crudRequest{verb: POST, cp: cp, confirm: make(chan string)} - -   completeRequest(cr, res, "create") - + cliche, counter := getDataFromRequest(req) + cp := new(clichePair) + cp.Cliche = cliche + cp.Counter = counter + cr := &crudRequest{verb: POST, cp: cp, confirm: make(chan string)} + completeRequest(cr, res, "create") } - - // PUT /cliches/id - func ClichesEdit(res http.ResponseWriter, req *http.Request) { - -   id := getIdFromRequest(req) - -   cliche, counter := getDataFromRequest(req) - -   cr := &crudRequest{verb: PUT, id: id, cliche: cliche, counter: counter, confirm: make(chan string)} - -   completeRequest(cr, res, "edit") - + id := getIdFromRequest(req) + cliche, counter := getDataFromRequest(req) + cr := &crudRequest{verb: PUT, id: id, cliche: cliche, counter: counter, confirm: make(chan string)} + completeRequest(cr, res, "edit") } - - // DELETE /cliches/id - func ClichesDelete(res http.ResponseWriter, req *http.Request) { - -   id := getIdFromRequest(req) - -   cr := &crudRequest{verb: DELETE, id: id, confirm: make(chan string)} - -   completeRequest(cr, res, "delete") - + id := getIdFromRequest(req) + cr := &crudRequest{verb: DELETE, id: id, confirm: make(chan string)} + completeRequest(cr, res, "delete") } - - func completeRequest(cr *crudRequest, res http.ResponseWriter, logMsg string) { - -   crudRequests<-cr - -   msg := <-cr.confirm - -   res.Write([]byte(msg)) - -   logIt(logMsg) - + crudRequests<-cr + msg := <-cr.confirm + res.Write([]byte(msg)) + logIt(logMsg) } - - func main() { + populateClichesList() -   populateClichesList() - - - -   // From now on, this gorountine alone accesses the clichesList. - -   crudRequests = make(chan *crudRequest, 8) - -   go func() { // resource manager - -      for { - -         select { - -         case req := <-crudRequests: - -         if req.verb == GETALL { - -            req.confirm<-readAll() - -         } else if req.verb == GETONE { - -            req.confirm<-readOne(req.id) - -         } else if req.verb == POST { - -            req.confirm<-addPair(req.cp) - -         } else if req.verb == PUT { - -            req.confirm<-editPair(req.id, req.cliche, req.counter) - -         } else if req.verb == DELETE { - -            req.confirm<-deletePair(req.id) - -         } - -      } - -   }() - -   startServer() - + // From now on, this gorountine alone accesses the clichesList. + crudRequests = make(chan *crudRequest, 8) + go func() { // resource manager + for { + select { + case req := <-crudRequests: + if req.verb == GETALL { + req.confirm<-readAll() + } else if req.verb == GETONE { + req.confirm<-readOne(req.id) + } else if req.verb == POST { + req.confirm<-addPair(req.cp) + } else if req.verb == PUT { + req.confirm<-editPair(req.id, req.cliche, req.counter) + } else if req.verb == DELETE { + req.confirm<-deletePair(req.id) + } + } + }() + startServer() } - - func startServer() { + router := mux.NewRouter() -   router := mux.NewRouter() + // Dispatch map for CRUD operations. + router.HandleFunc("/", ClichesAll).Methods("GET") + router.HandleFunc("/cliches", ClichesAll).Methods("GET") + router.HandleFunc("/cliches/{id:[0-9]+}", ClichesOne).Methods("GET") + router.HandleFunc("/cliches", ClichesCreate).Methods("POST") + router.HandleFunc("/cliches/{id:[0-9]+}", ClichesEdit).Methods("PUT") + router.HandleFunc("/cliches/{id:[0-9]+}", ClichesDelete).Methods("DELETE") + http.Handle("/", router) // enable the router -   // Dispatch map for CRUD operations. - -   router.HandleFunc("/", ClichesAll).Methods("GET") - -   router.HandleFunc("/cliches", ClichesAll).Methods("GET") - -   router.HandleFunc("/cliches/{id:[0-9]+}", ClichesOne).Methods("GET") - - - -   router.HandleFunc("/cliches", ClichesCreate).Methods("POST") - -   router.HandleFunc("/cliches/{id:[0-9]+}", ClichesEdit).Methods("PUT") - -   router.HandleFunc("/cliches/{id:[0-9]+}", ClichesDelete).Methods("DELETE") - - - -   http.Handle("/", router) // enable the router - - - -   // Start the server. - -   port := ":8888" - -   fmt.Println("\nListening on port " + port) - -   http.ListenAndServe(port, router); // mux.Router now in play - + // Start the server. + port := ":8888" + fmt.Println("\nListening on port " + port) + http.ListenAndServe(port, router); // mux.Router now in play } - - // Return entire list to requester. - func readAll() string { - -   msg := "\n" - -   for _, cliche := range clichesList { - -      next := strconv.Itoa(cliche.Id) + ": " + cliche.Cliche + "  " + cliche.Counter + "\n" - -      msg += next - -   } - -   return msg - + msg := "\n" + for _, cliche := range clichesList { + next := strconv.Itoa(cliche.Id) + ": " + cliche.Cliche + " " + cliche.Counter + "\n" + msg += next + } + return msg } - - // Return specified clichePair to requester. - func readOne(id int) string { + msg := "\n" + "Bad Id: " + strconv.Itoa(id) + "\n" -   msg := "\n" + "Bad Id: " + strconv.Itoa(id) + "\n" - - - -   index := findCliche(id) - -   if index >= 0 { - -      cliche := clichesList[index] - -      msg = "\n" + strconv.Itoa(id) + ": " + cliche.Cliche + "  " + cliche.Counter + "\n" - -   } - -   return msg - + index := findCliche(id) + if index >= 0 { + cliche := clichesList[index] + msg = "\n" + strconv.Itoa(id) + ": " + cliche.Cliche + " " + cliche.Counter + "\n" + } + return msg } - - // Create a new clichePair and add to list - func addPair(cp *clichePair) string { - -   cp.Id = masterId - -   masterId++ - -   clichesList = append(clichesList, cp) - -   return "\nCreated: " + cp.Cliche + " " + cp.Counter + "\n" - + cp.Id = masterId + masterId++ + clichesList = append(clichesList, cp) + return "\nCreated: " + cp.Cliche + " " + cp.Counter + "\n" } - - // Edit an existing clichePair - func editPair(id int, cliche string, counter string) string { - -   msg := "\n" + "Bad Id: " + strconv.Itoa(id) + "\n" - -   index := findCliche(id) - -   if index >= 0 { - -      clichesList[index].Cliche = cliche - -      clichesList[index].Counter = counter - -      msg = "\nCliche edited: " + cliche + " " + counter + "\n" - -   } - -   return msg - + msg := "\n" + "Bad Id: " + strconv.Itoa(id) + "\n" + index := findCliche(id) + if index >= 0 { + clichesList[index].Cliche = cliche + clichesList[index].Counter = counter + msg = "\nCliche edited: " + cliche + " " + counter + "\n" + } + return msg } - - // Delete a clichePair - func deletePair(id int) string { - -   idStr := strconv.Itoa(id) - -   msg := "\n" + "Bad Id: " + idStr + "\n" - -   index := findCliche(id) - -   if index >= 0 { - -      clichesList = append(clichesList[:index], clichesList[index + 1:]...) - -      msg = "\nCliche " + idStr + " deleted\n" - -   } - -   return msg - + idStr := strconv.Itoa(id) + msg := "\n" + "Bad Id: " + idStr + "\n" + index := findCliche(id) + if index >= 0 { + clichesList = append(clichesList[:index], clichesList[index + 1:]...) + msg = "\nCliche " + idStr + " deleted\n" + } + return msg } - - //*** utility functions - func findCliche(id int) int { - -   for i := 0; i < len(clichesList); i++ { - -      if id == clichesList[i].Id { - -         return i; - -      } - -   } - -   return -1 // not found - + for i := 0; i < len(clichesList); i++ { + if id == clichesList[i].Id { + return i; + } + } + return -1 // not found } - - func getIdFromRequest(req *http.Request) int { - -   vars := mux.Vars(req) - -   id, _ := strconv.Atoi(vars["id"]) - -   return id - + vars := mux.Vars(req) + id, _ := strconv.Atoi(vars["id"]) + return id } - - func getDataFromRequest(req *http.Request) (string, string) { - -   // Extract the user-provided data for the new clichePair - -   req.ParseForm() - -   form := req.Form - -   cliche := form["cliche"][0]    // 1st and only member of a list - -   counter := form["counter"][0]  // ditto - -   return cliche, counter - + // Extract the user-provided data for the new clichePair + req.ParseForm() + form := req.Form + cliche := form["cliche"][0] // 1st and only member of a list + counter := form["counter"][0] // ditto + return cliche, counter } - - func logIt(msg string) { - -   fmt.Println(msg) - + fmt.Println(msg) } - - func populateClichesList() { + var cliches = []string { + "Out of sight, out of mind.", + "A penny saved is a penny earned.", + "He who hesitates is lost.", + } + var counterCliches = []string { + "Absence makes the heart grow fonder.", + "Penny-wise and dollar-foolish.", + "Look before you leap.", + } -   var cliches = []string { - -      "Out of sight, out of mind.", - -      "A penny saved is a penny earned.", - -      "He who hesitates is lost.", - -   } - -   var counterCliches = []string { - -      "Absence makes the heart grow fonder.", - -      "Penny-wise and dollar-foolish.", - -      "Look before you leap.", - -   } - - - -   for i := 0; i < len(cliches); i++ { - -      cp := new(clichePair) - -      cp.Id = masterId - -      masterId++ - -      cp.Cliche = cliches[i] - -      cp.Counter = counterCliches[i] - -      clichesList = append(clichesList, cp) - -   } - + for i := 0; i < len(cliches); i++ { + cp := new(clichePair) + cp.Id = masterId + masterId++ + cp.Cliche = cliches[i] + cp.Counter = counterCliches[i] + clichesList = append(clichesList, cp) + } } - ``` -为了专注于请求路由和验证,crud 应用程序不使用 HTML 页面作为请求响应。 相反,请求会产生明文响应消息:陈词滥调对的列表是对 GET 请求的响应,确认新的陈词滥调对已添加到列表中是对 POST 请求的响应,依此类推。 这种简化使得使用命令行实用程序(如 [curl] [1])可以轻松地测试应用程序,尤其是 `gorilla/mux` 组件。 +为了专注于请求路由和验证,CRUD 应用程序不使用 HTML 页面作为请求响应。 相反,请求会产生明文响应消息:套话对的列表是对 GET 请求的响应,确认新的套话对已添加到列表中是对 POST 请求的响应,依此类推。 这种简化使得使用命令行实用程序(如 [curl][1])可以轻松地测试应用程序,尤其是 `gorilla/mux` 组件。 -`gorilla/mux` 包可以从 [GitHub] [2] 安装。 crud app 无限期运行; 因此,应使用 Control-C 或同等命令终止。 crud 应用程序的代码,以及自述文件和简单的 curl 测试,可以在[我的网站] [3]上找到。 +`gorilla/mux` 包可以从 [GitHub][2] 安装。 CRUD app 无限期运行;因此,应使用 `Control-C` 或同等命令终止。 CRUD 应用程序的代码,以及自述文件和简单的 curl 测试,可以在[我的网站] [3]上找到。 -### 2\. 请求路由 +### 2、请求路由 -`mux.Router` 扩展了 REST 风格的路由,它赋给 HTTP 方法(例如,GET)和 URL 末尾的 URI 或路径(例如/cliches)相同的权重。 URI 用作 HTTP 动词(方法)的名词。 例如,在HTTP请求中有一个起始行,例如 +`mux.Router` 扩展了 REST 风格的路由,它赋给 HTTP 方法(例如,GET)和 URL 末尾的 URI 或路径(例如 `/cliches`)相同的权重。 URI 用作 HTTP 动词(方法)的名词。 例如,在HTTP请求中有一个起始行,例如: ``` GET /cliches - ``` -意味着得到所有的陈词滥调对,而一个起始线,如 +意味着得到所有的套话对,而一个起始线,如: ``` POST /cliches - ``` -意味着从HTTP正文中的数据创建一个陈词滥调对。 +意味着从 HTTP 正文中的数据创建一个套话对。 + +在 CRUD web 应用程序中,有五个函数充当 HTTP 请求的五种变体的请求处理程序: -在 crud web 应用程序中,有五个函数充当HTTP请求的五种变体的请求处理程序: ``` -ClichesAll(...)    # GET: 获取所有的陈词滥调对 - -ClichesOne(...)    # GET: 获取指定的陈词滥调对 - -ClichesCreate(...) # POST: 创建新的陈词滥调对 - -ClichesEdit(...)   # PUT: 编辑现有的陈词滥调对 - -ClichesDelete(...) # DELETE: 删除指定的陈词滥调对 - +ClichesAll(...)    # GET: 获取所有的套话对 +ClichesOne(...)    # GET: 获取指定的套话对 +ClichesCreate(...) # POST: 创建新的套话对 +ClichesEdit(...)   # PUT: 编辑现有的套话对 +ClichesDelete(...) # DELETE: 删除指定的套话对 ``` 每个函数都有两个参数:一个 `http.ResponseWriter` 用于向请求者发送一个响应,一个指向 `http.Request` 的指针,该指针封装了底层 HTTP 请求的信息。 使用 `gorilla/mux` 包可以轻松地将这些请求处理程序注册到Web服务器,并执行基于正则表达式的验证。 -crud 应用程序中的 `startServer` 函数注册请求处理程序。 考虑这对注册,`router` 作为 `mux.Router` 实例: +CRUD 应用程序中的 `startServer` 函数注册请求处理程序。 考虑这对注册,`router` 作为 `mux.Router` 实例: + ``` router.HandleFunc("/", ClichesAll).Methods("GET") - router.HandleFunc("/cliches", ClichesAll).Methods("GET") - ``` -这些语句意味着对单斜线/ 或 /cliches 的 GET 请求应该路由到 `ClichesAll` 函数,然后处理请求。 例如,curl 请求(使用%作为命令行提示符) +这些语句意味着对单斜线 `/` 或 `/cliches` 的 GET 请求应该路由到 `ClichesAll` 函数,然后处理请求。 例如,curl 请求(使用 `%` 作为命令行提示符): ``` % curl --request GET localhost:8888/ - ``` -会产生如下结果 +会产生如下结果: + ``` 1: Out of sight, out of mind.  Absence makes the heart grow fonder. - 2: A penny saved is a penny earned.  Penny-wise and dollar-foolish. - 3: He who hesitates is lost.  Look before you leap. - ``` -三个陈词滥调对是 crud 应用程序中的初始数据。 +这三个套话对是 CRUD 应用程序中的初始数据。 +在这句注册语句中: -在这句注册语句中 ``` router.HandleFunc("/cliches", ClichesAll).Methods("GET") - router.HandleFunc("/cliches", ClichesCreate).Methods("POST") - ``` -URI是相同的(/cliches),但动词不同:第一种情况下为 GET 请求,第二种情况下为 POST 请求。 此注册举例说明了 REST 样式的路由,因为仅动词的不同就足以将请求分派给两个不同的处理程序。 +URI 是相同的(`/cliches`),但动词不同:第一种情况下为 GET 请求,第二种情况下为 POST 请求。 此注册举例说明了 REST 样式的路由,因为仅动词的不同就足以将请求分派给两个不同的处理程序。 注册中允许多个 HTTP 方法,尽管这会影响 REST 风格路由的精髓: ``` router.HandleFunc("/cliches", DoItAll).Methods("POST", "GET") - ``` + 除了动词和 URI 之外,还可以在功能上路由 HTTP 请求。 例如,注册 ``` router.HandleFunc("/cliches", ClichesCreate).Schemes("https").Methods("POST") - ``` -要求对 POST 请求进行 HTTPS 访问以创建新的陈词滥调对。 以类似的方式,注册可能需要具有指定的 HTTP 头元素(例如,认证凭证)的请求。 -### 3\. Request validation +要求对 POST 请求进行 HTTPS 访问以创建新的套话对。以类似的方式,注册可能需要具有指定的 HTTP 头元素(例如,认证凭证)的请求。 + +### 3、 Request validation `gorilla/mux` 包采用简单,直观的方法通过正则表达式进行请求验证。 考虑此请求处理程序以获取一个操作: + ``` router.HandleFunc("/cliches/{id:[0-9]+}", ClichesOne).Methods("GET") - ``` -此注册排除了 HTTP 请求,例如 + +此注册排除了 HTTP 请求,例如: + ``` % curl --request GET localhost:8888/cliches/foo - ``` -因为 foo 不是十进制数字。 该请求导致熟悉的 404(未找到)状态码。 在此处理程序注册中包含正则表达式模式可确保仅在请求 URI 以十进制整数值结束时才调用 `ClichesOne` 函数来处理请求: +因为 foo 不是十进制数字。该请求导致熟悉的 404(未找到)状态码。 在此处理程序注册中包含正则表达式模式可确保仅在请求 URI 以十进制整数值结束时才调用 `ClichesOne` 函数来处理请求: ``` % curl --request GET localhost:8888/cliches/3  # ok - ``` -另一个例子,请求如下 +另一个例子,请求如下: + ``` % curl --request PUT --data "..." localhost:8888/cliches - ``` -此请求导致状态代码为 405(错误方法),因为 /cliches URI 在 crud 应用程序中仅在 GET 和 POST 请求中注册。 像 GET 请求一样,PUT 请求必须在 URI 的末尾包含一个数字id: + +此请求导致状态代码为 405(错误方法),因为 /cliches URI 在 CRUD 应用程序中仅在 GET 和 POST 请求中注册。 像 GET 请求一样,PUT 请求必须在 URI 的末尾包含一个数字 id: ``` router.HandleFunc("/cliches/{id:[0-9]+}", ClichesEdit).Methods("PUT") - ``` -### 4\. 并发问题 +### 4、并发问题 -`gorilla/mux` 路由器作为单独的 goroutine 执行对已注册的请求处理程序的每次调用,这意味着并发性被烘焙到包中。 例如,如果有十个同时发出的请求,例如 +`gorilla/mux` 路由器作为单独的 Go 协程执行对已注册的请求处理程序的每次调用,这意味着并发性被内置于包中。 例如,如果有十个同时发出的请求,例如 ``` % curl --request POST --data "..." localhost:8888/cliches - ``` -然后 `mux.Router` 启动十个 goroutines 来执行 `ClichesCreate` 处理程序。 +然后 `mux.Router` 启动十个 Go 协程来执行 `ClichesCreate` 处理程序。 -GET all,GET one,POST,PUT 和 DELETE 中的五个请求操作中,最后三个改变了所请求的资源,即包含陈词滥调对的共享 `clichesList`。 因此,crudapp 需要通过协调对`clichesList` 的访问来保证安全的并发性。 在不同但等效的术语中,crud app 必须防止 `clichesList` 上的竞争条件。 在生产环境中,可以使用数据库系统来存储诸如 `clichesList` 之类的资源,然后可以通过数据库事务来管理安全并发。 +GET all、GET one、POST、PUT 和 DELETE 中的五个请求操作中,最后三个改变了所请求的资源,即包含套话对的共享 `clichesList`。 因此,CRUD app 需要通过协调对 `clichesList` 的访问来保证安全的并发性。 在不同但等效的术语中,CRUD app 必须防止 `clichesList` 上的竞争条件。 在生产环境中,可以使用数据库系统来存储诸如 `clichesList` 之类的资源,然后可以通过数据库事务来管理安全并发。 -crud 应用程序采用推荐的Go方法来实现安全并发: +CRUD 应用程序采用推荐的Go方法来实现安全并发: -* 只有一个 goroutine,资源管理器在 crud app`startServer` 函数中启动,一旦 Web 服务器开始侦听请求,就可以访问 `clichesList`。 +* 只有一个 Go 协程,资源管理器在 CRUD app `startServer` 函数中启动,一旦 Web 服务器开始侦听请求,就可以访问 `clichesList`。 * 诸如 `ClichesCreate` 和 `ClichesAll` 之类的请求处理程序向 Go 通道发送(指向)`crudRequest` 实例(默认情况下是线程安全的),并且资源管理器单独从该通道读取。 然后,资源管理器对 `clichesList` 执行请求的操作。 安全并发体系结构绘制如下: ``` -                 crudRequest                   读/写 +           crudRequest                读/写 -请求处理程序 -------------> 资源托管者 ------------> 陈词滥调列表 +请求处理程序 -------------> 资源托管者 ------------> 套话列表 ``` -在这种架构中,不需要显式锁定 `clichesList`,因为一旦 CRUD 请求开始进入,只有一个 goroutine(资源管理器)访问 `clichesList`。 +在这种架构中,不需要显式锁定 `clichesList`,因为一旦 CRUD 请求开始进入,只有一个 Go 协程(资源管理器)访问 `clichesList`。 -为了使 crud 应用程序尽可能保持并发,在一方请求处理程序与另一方的单一资源管理器之间进行有效的分工至关重要。 在这里,为了审查,是 `ClichesCreate` 请求处理程序: +为了使 CRUD 应用程序尽可能保持并发,在一方请求处理程序与另一方的单一资源管理器之间进行有效的分工至关重要。 在这里,为了审查,是 `ClichesCreate` 请求处理程序: ``` func ClichesCreate(res http.ResponseWriter, req *http.Request) { - -   cliche, counter := getDataFromRequest(req) - -   cp := new(clichePair) - -   cp.Cliche = cliche - -   cp.Counter = counter - -   cr := &crudRequest{verb: POST, cp: cp, confirm: make(chan string)} - -   completeRequest(cr, res, "create") - -}ClichesCreateres httpResponseWriterreqclichecountergetDataFromRequestreqcpclichePaircpClicheclichecpCountercountercr&crudRequestverbPOSTcpcpconfirmcompleteRequestcrres - + cliche, counter := getDataFromRequest(req) + cp := new(clichePair) + cp.Cliche = cliche + cp.Counter = counter + cr := &crudRequest{verb: POST, cp: cp, confirm: make(chan string)} + completeRequest(cr, res, "create") +} ``` -`ClichesCreate` 调用实用函数 `getDataFromRequest`,它从 POST 请求中提取新的陈词滥调和反陈词滥调。 然后 `ClichesCreate` 函数创建一个新的 `ClichePair`,设置两个字段,并创建一个 `crudRequest` 发送给单个资源管理器。 此请求包括一个确认通道,资源管理器使用该通道将信息返回给请求处理程序。 所有设置工作都可以在不涉及资源管理器的情况下完成,因为尚未访问 `clichesList`。 -请求处理程序调用实用程序函数,该函数从 POST 请求中提取新的陈词滥调和反陈词滥调。 然后,该函数创建一个新的,设置两个字段,并创建 ato 发送到单个资源管理器。 此请求包括一个确认通道,资源管理器使用该通道将信息返回给请求处理程序。 所有设置工作都可以在不涉及资源管理器的情况下完成,因为尚未访问它。 +`ClichesCreate` 调用实用函数 `getDataFromRequest`,它从 POST 请求中提取新的套话和反套话。 然后 `ClichesCreate` 函数创建一个新的 `ClichePair`,设置两个字段,并创建一个 `crudRequest` 发送给单个资源管理器。 此请求包括一个确认通道,资源管理器使用该通道将信息返回给请求处理程序。 所有设置工作都可以在不涉及资源管理器的情况下完成,因为尚未访问 `clichesList`。 + +请求处理程序调用实用程序函数,该函数从 POST 请求中提取新的套话和反套话。 然后,该函数创建一个新的,设置两个字段,并创建一个 crudRequest 发送到单个资源管理器。 此请求包括一个确认通道,资源管理器使用该通道将信息返回给请求处理程序。 所有设置工作都可以在不涉及资源管理器的情况下完成,因为尚未访问它。 + +`completeRequest` 实用程序函数在 `ClichesCreate` 函数和其他请求处理程序的末尾调用: -`completeRequest` 实用程序函数在 `ClichesCreate` 函数和其他请求处理程序的末尾调用 ``` completeRequest(cr, res, "create") // shown above - ``` 通过将 `crudRequest` 放入 `crudRequests` 频道,使资源管理器发挥作用: + ``` func completeRequest(cr *crudRequest, res http.ResponseWriter, logMsg string) { -    crudRequests<-cr          // 向资源托管者发送请求 -    msg := <-cr.confirm       // 等待确认 -    res.Write([]byte(msg))    // 向请求方发送确认 -    logIt(logMsg)             // 打印到标准输出 - } - ``` + 对于 POST 请求,资源管理器调用实用程序函数 `addPair`,它会更改 `clichesList` 资源: + ``` func addPair(cp *clichePair) string { -    cp.Id = masterId  // 分配一个唯一的 ID -    masterId++        // 更新 ID 计数器 -    clichesList = append(clichesList, cp) // 更新列表 -    return "\nCreated: " + cp.Cliche + " " + cp.Counter + "\n" - } - ``` -资源管理器为其他CRUD操作调用类似的实用程序函数。 值得重复的是,一旦 Web 服务器开始接受请求,资源管理器就是唯一可以读取或写入 `clichesList` 的 goroutine。 +资源管理器为其他 CRUD 操作调用类似的实用程序函数。 值得重复的是,一旦 Web 服务器开始接受请求,资源管理器就是唯一可以读取或写入 `clichesList` 的 goroutine。 -对于任何类型的 Web 应用程序,`gorilla/mux` 包在简单直观的API中提供请求路由,请求验证和相关服务。 crud web 应用程序突出了软件包的主要功能。 给包裹一个测试驱动,你可能会成为买主。 +对于任何类型的 Web 应用程序,`gorilla/mux` 包在简单直观的 API 中提供请求路由、请求验证和相关服务。 CRUD web 应用程序突出了软件包的主要功能。 -------------------------------------------------------------------------------- @@ -670,7 +462,7 @@ via: https://opensource.com/article/18/8/http-request-routing-validation-gorilla 作者:[Marty Kalin][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[yongshouzhang](https://github.com/yongshouzhang) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 34b70e2c91e67a2b53c5988f9e383dd77b11549e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 18:28:47 +0800 Subject: [PATCH 0112/4278] PRF:20180104 How Creative Commons benefits artists and big business.md @Valoniakim --- ...mmons benefits artists and big business.md | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/translated/talk/20180104 How Creative Commons benefits artists and big business.md b/translated/talk/20180104 How Creative Commons benefits artists and big business.md index c04ed4c240..aefc804479 100644 --- a/translated/talk/20180104 How Creative Commons benefits artists and big business.md +++ b/translated/talk/20180104 How Creative Commons benefits artists and big business.md @@ -1,42 +1,49 @@ -知识共享是怎样造福艺术家和大企业的 +你所不知道的知识共享(CC) ====== + +> 知识共享为艺术家提供访问权限和原始素材。大公司也从中受益。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/CreativeCommons_ideas_520x292_1112JS.png?itok=otei0vKb) -我毕业于电影学院,毕业后在一所电影学校教书,之后进入一家主流电影工作室,我一直在从事电影相关的工作。创造业的方方面面面临着同一个问题:创造者需要原材料。有趣的是,自由文化运动提出了解决方案,具体来说是在自由文化运动中出现的知识共享组织。 +我毕业于电影学院,毕业后在一所电影学校教书,之后进入一家主流电影工作室,我一直在从事电影相关的工作。创意产业的方方面面面临着同一个问题:创作者需要原材料。有趣的是,自由文化运动提出了解决方案,具体来说是在自由文化运动中出现的知识共享Creative Commons组织。 -###知识共享能够为我们提供展示片段和小样 +### 知识共享能够为我们提供展示片段和小样 -和其他事情一样,创造力也需要反复练习。幸运的是,在我刚开始接触电脑时,就在一本渲染工场的专业杂志中接触到了开源这个存在。当时我并不理解所谓的“开源”是什么,但我知道只有开源工具能帮助我在领域内稳定发展。对我来说,知识共享也是如此。知识共享可以为艺术家们提供充满丰富艺术资源的工作室。 +和其他事情一样,创造力也需要反复练习。幸运的是,在我刚开始接触电脑时,就在一本关于渲染工场的专业杂志中接触到了开源这个存在。当时我并不理解所谓的“开源”是什么,但我知道只有开源工具能帮助我在领域内稳定发展。对我来说,知识共享也是如此。知识共享可以为艺术家们提供充满丰富艺术资源的工作室。 -我在电影学院任教时,经常需要给学生们准备练习编辑、录音、拟音、分级、评分的脚本。在 Jim Munroe 的独立作品 [Infest Wisely][1] 中和 [Vimeo][2] 上的知识共享里我总能找到我想要的。这些写实的脚本覆盖内容十分广泛,从独立影院出品到昂贵的高质的升降镜头(一般都会用无人机代替)都有。 +我在电影学院任教时,经常需要给学生们准备练习编辑、录音、拟音、分级、评分的示例录像。在 Jim Munroe 的独立作品 [Infest Wisely][1] 中和 [Vimeo][2] 上的知识共享内容里我总能找到我想要的。这些逼真的镜头覆盖内容十分广泛,从独立制作到昂贵的高品质的升降镜头(一般都会用无人机代替)都有。 -对实验艺术来说,确有无尽可能。知识共享提供了丰富的底片材料,这些材料可以用来整合,混剪等等,可以满足一位视觉先锋能够想到的任何用途。 +![](https://opensource.com/sites/default/files/u128651/bunny.png) -在接触知识共享之前,如果我想要使用写实脚本,我只能用之前的学生和老师拍摄的或者直接使用版权库里的脚本,但这些都有很多局限性。 +对实验主义艺术来说,确有无尽可能。知识共享提供了丰富的素材,这些材料可以用来整合、混剪等等,可以满足一位视觉先锋能够想到的任何用途。 -###坚守版权的底线很重要 +在接触知识共享之前,如果我想要使用写实镜头,如果在大学,只能用之前的学生和老师拍摄的或者直接使用版权库里的镜头,或者使用有受限的版权保护的镜头。 -知识共享同样能够创造经济效益。在某大型计算机公司的渲染工场工作时,我负责在某些硬件设施上测试渲染的运行情况,而这个测试时刻面临着被搁置的风险。做这些测试时,我用的都是[大雄兔][3]的资源,因为这个电影和它的组件都是可以免费使用和分享的。如果没有这个小短片,在接触写实资源之前我都没法完成我的实验,因为对于一个计算机公司来说,雇佣一只3D艺术家来应召布景是不太现实的。 +### 坚守版权的底线很重要 -令我震惊的是,与开源类似,知识共享已经用我们难以想象的方式支撑起了大公司。知识共享的使用或有或无地影响着公司的日常程序,但它填补了不足,让工作流程顺利进行。我没见到谁在他们的书中将流畅工作归功于知识共享的应用,但它确实无处不在。 +知识共享同样能够创造经济效益。在某大型计算机公司的渲染工场工作时,我负责在某些硬件设施上测试渲染的运行情况,而这个测试时刻面临着被搁置的风险。做这些测试时,我用的都是[大雄兔][3]的资源,因为这个电影和它的组件都是可以免费使用和分享的。如果没有这个小短片,在接触写实资源之前我都没法完成我的实验,因为对于一个计算机公司来说,雇佣一只 3D 艺术家来按需布景是不太现实的。 -我也见过一些开放版权的电影,比如[辛特尔][4],在最近的电视节目中播放了它的短片,那时的电视比现在的网络媒体要火得多。 +令我震惊的是,与开源类似,知识共享已经用我们难以想象的方式支撑起了大公司。知识共享的使用可能会也可能不会影响公司的日常流程,但它填补了不足,让工作流程顺利进行。我没见到谁在他们的书中将流畅工作归功于知识共享的应用,但它确实无处不在。 -###知识共享可以提供大量原材料 +![](https://opensource.com/sites/default/files/u128651/sintel.png) -艺术家需要原材料。画家需要颜料,画笔和画布。雕塑家需要陶土和工具。数字内容编辑师需要数字内容,无论它是剪贴画还是音效或者是电子游戏里的成品精灵。 +我也见过一些开放版权的电影,比如[辛特尔][4],在最近的电视节目中播放了它的短片,电视的分辨率已经超过了标准媒体。 + +### 知识共享可以提供大量原材料 + +艺术家需要原材料。画家需要颜料、画笔和画布。雕塑家需要陶土和工具。数字内容编辑师需要数字内容,无论它是剪贴画还是音效或者是电子游戏里的现成的精灵。 数字媒介赋予了人们超能力,让一个人就能完成需要一组人员才能完成的工作。事实上,我们大部分都好高骛远。我们想做高大上的项目,想让我们的成果不论是视觉上还是听觉上都无与伦比。我们想塑造的是宏大的世界,紧张的情节,能引起共鸣的作品,但我们所拥有的时间精力和技能与之都不匹配,达不到想要的效果。 -是知识共享再一次拯救了我们,用 [Freesound.org][5], [Openclipart.org][6], [OpenGameArt.org][7] 等等网站上那些细小的开放版权艺术材料。通过知识共享,艺术家可以使用各种他们自己没办法创造的原材料,来完成他们原本完不成的工作。 +是知识共享再一次拯救了我们,在 [Freesound.org][5]、 [Openclipart.org][6]、 [OpenGameArt.org][7] 等等网站上都有大量的开放版权艺术材料。通过知识共享,艺术家可以使用各种他们自己没办法创造的原材料,来完成他们原本完不成的工作。 -最神奇的是,不用自己投资,你放在网上给大家使用的原材料就能变成精美的作品,而这是你从没想过的。我在知识共享上面分享了很多音乐素材,它们现在用于无数的专辑和电子游戏里。有些人用了我的材料会通知我,有些是我自己发现的,所以这些材料的应用可能比我知道的还有多得多。有时我会偶然看到我亲手画的标志出现在我从没听说过的软件里。我见到过我为[开源网站][8]写的文章在别处发表,有的是论文的参考文献,白皮书或者参考资料中。 +最神奇的是,不用自己投资,你放在网上给大家使用的原材料就能变成精美的作品,而这是你从没想过的。我在知识共享上面分享了很多音乐素材,它们现在用于无数的专辑和电子游戏里。有些人用了我的材料会通知我,有些是我自己发现的,所以这些材料的应用可能比我知道的还有多得多。有时我会偶然看到我亲手画的标志出现在我从没听说过的软件里。我见到过我为 [Opensource.com][8] 写的文章在别处发表,有的是论文的参考文献,白皮书或者参考资料中。 -###知识共享所代表的自由文化也是一种文化 +### 知识共享所代表的自由文化也是一种文化 “自由文化”这个说法过于累赘,文化,从概念上来说,是一个有机的整体。在这种文化中社会逐渐成长发展,从一个人到另一个。它是人与人之间的互动和思想交流。自由文化是自由缺失的现代世界里的特殊产物。 -如果你也想对这样的局限进行反抗,想把你的思想、作品,你自己的文化分享给全世界的人,那么就来和我们一起,使用知识共享吧! +如果你也想对这样的局限进行反抗,想把你的思想、作品、你自己的文化分享给全世界的人,那么就来和我们一起,使用知识共享吧! -------------------------------------------------------------------------------- @@ -44,7 +51,7 @@ via: https://opensource.com/article/18/1/creative-commons-real-world 作者:[Seth Kenlon][a] 译者:[Valoniakim](https://github.com/Valoniakim) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1bdb61b88273c9c95a71b6150a591cf6cc0e787f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 14 Dec 2018 18:31:29 +0800 Subject: [PATCH 0113/4278] PUB:20180104 How Creative Commons benefits artists and big business.md @Valoniakim https://linux.cn/article-10347-1.html --- ...0104 How Creative Commons benefits artists and big business.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180104 How Creative Commons benefits artists and big business.md (100%) diff --git a/translated/talk/20180104 How Creative Commons benefits artists and big business.md b/published/20180104 How Creative Commons benefits artists and big business.md similarity index 100% rename from translated/talk/20180104 How Creative Commons benefits artists and big business.md rename to published/20180104 How Creative Commons benefits artists and big business.md From 4a5986dc8a11fb53aaa95123a3423ca660d0c172 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 15 Dec 2018 09:11:52 +0800 Subject: [PATCH 0114/4278] PUB:20180814 HTTP request routing and validation with gorilla-mux.md @yongshouzhang https://linux.cn/article-10348-1.html --- ...180814 HTTP request routing and validation with gorilla-mux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180814 HTTP request routing and validation with gorilla-mux.md (100%) diff --git a/translated/tech/20180814 HTTP request routing and validation with gorilla-mux.md b/published/20180814 HTTP request routing and validation with gorilla-mux.md similarity index 100% rename from translated/tech/20180814 HTTP request routing and validation with gorilla-mux.md rename to published/20180814 HTTP request routing and validation with gorilla-mux.md From e5fa1a19976943ee9d7a78fd4b9d8dc64f9320d2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 15 Dec 2018 09:18:45 +0800 Subject: [PATCH 0115/4278] PUB:20181102 Create a containerized machine learning model.md @geekpi https://linux.cn/article-10349-1.html --- .../20181102 Create a containerized machine learning model.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181102 Create a containerized machine learning model.md (98%) diff --git a/translated/tech/20181102 Create a containerized machine learning model.md b/published/20181102 Create a containerized machine learning model.md similarity index 98% rename from translated/tech/20181102 Create a containerized machine learning model.md rename to published/20181102 Create a containerized machine learning model.md index 0bad5a3bc6..a58b658398 100644 --- a/translated/tech/20181102 Create a containerized machine learning model.md +++ b/published/20181102 Create a containerized machine learning model.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Create a containerized machine learning model) [#]: via: (https://fedoramagazine.org/create-containerized-machine-learning-model/) [#]: author: (Sven Bösiger) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10349-1.html) 创建一个容器化的机器学习模型 ====== From 82e68c686fb9eed12811e758103c9a519f74b970 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sat, 15 Dec 2018 12:24:27 +0800 Subject: [PATCH 0116/4278] hankchow translated --- ... Variables- Environmental and Otherwise.md | 222 ------------------ ... Variables- Environmental and Otherwise.md | 212 +++++++++++++++++ 2 files changed, 212 insertions(+), 222 deletions(-) delete mode 100644 sources/tech/20181205 Bash Variables- Environmental and Otherwise.md create mode 100644 translated/tech/20181205 Bash Variables- Environmental and Otherwise.md diff --git a/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md b/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md deleted file mode 100644 index 4df8c10143..0000000000 --- a/sources/tech/20181205 Bash Variables- Environmental and Otherwise.md +++ /dev/null @@ -1,222 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Bash Variables: Environmental and Otherwise) -[#]: via: (https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) -[#]: url: ( ) - -Bash Variables: Environmental and Otherwise -====== -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/wynand-van-poortvliet-40467-unsplash.jpg?itok=tr6Eb4N0) - -Bash variables, including those pesky _environment variables_ , have been popped up several times in previous articles, and it’s high time you get to know them better and how they can help you. - -So, open your terminal window and let's get started. - -### Environment Variables - -Consider `HOME`. Apart from the cozy place where you lay down your hat, in Linux it is a variable that contains the path to the current user's home directory. Try this: - -``` -echo $HOME -``` - -This will show the path to your home directory, usually _/home/_. - -As the name indicates, variables can change according to the context. Indeed, each user on a Linux system will have a `HOME` variable containing a different value. You can also change the value of a variable by hand: - -``` -HOME=/home//Documents -``` - -will make `HOME` point to your _Documents/_ folder. - -There are three things to notice here: - - 1. There are no spaces between the name of the variable and the `=` or between the `=` and the value you are putting into the variable. Spaces have their own meaning in the shell and cannot be used any old way you want. - 2. If you want to put a value into a variable or manipulate it in any way, you just have to write the name of the variable. If you want to see or use the contents of a variable, you put a `$` in front of it. - 3. Changing `HOME` is risky! A lot programs rely on `HOME` to do stuff and changing it can have unforeseeable consequences. For example, just for laughs, change `HOME` as shown above and try typing `cd` and then [Enter]. As we have seen elsewhere in this series, you use `cd` to _c_ hange to another _d_ irectory. Without any parameters, `cd` takes you to your home directory. If you change the `HOME` variable, `cd` will take you to the new directory `HOME` points to. - - - -Changes to environment variables like the one described in point 3 above are not permanent. If you close your terminal and open it back up, or even open a new tab in your terminal window and move there, `echo $HOME` will show its original value. - -Before we go on to how you make changes permanent, let's look at another environment variable that it does make sense changing. - -### PATH - -The `PATH` variable lists directories that contain executable programs. If you ever wondered where your applications go when they are installed and how come the shell seems to magically know which programs it can run without you having to tell it where to look for them, `PATH` is the reason. - -Have a look inside `PATH` and you will see something like this: - -``` -$ echo $PATH -/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin -``` - -Each directory is separated by a colon (`:`) and if you want to run an application installed in any directory other than the ones listed in `PATH`, you will have to tell the shell where to find it: - -``` -/home//bin/my_program.sh -``` - -This will run a program calle _my_program.sh_ you have copied into a _bin/_ directory in your home directory. - -This is a common problem: you don't want to clutter up your system's _bin/_ directories, or you don't want other users running your own personal scripts, but you don't want to have to type out the complete path every time you need to run a script you use often. The solution is to create your own _bin/_ directory in your home directory: - -``` -mkdir $HOME/bin -``` - -And then tell `PATH` all about it: - -``` -PATH=$PATH:$HOME/bin -``` - -After that, your _/home//bin_ will show up in your `PATH` variable. But... Wait! We said that the changes you make in a given shell will not last and will lose effect when that shell is closed. - -To make changes permanent for your user, instead of running them directly in the shell, put them into a file that gets run every time a shell is started. That file already exists and lives in your home directory. It is called _.bashrc_ and the dot in front of the name makes it a hidden file -- a regular `ls` won't show it, but `ls -a` will. - -You can open it with a text editor like [kate][1], [gedit][2], [nano][3], or [vim][4] (NOT LibreOffice Writer -- that's a word processor. Different beast entirely). You will see that _.bashrc_ is full of shell commands the purpose of which are to set up the environment for your user. - -Scroll to the bottom and add the following on a new, empty line: - -``` -export PATH=$PATH:$HOME/bin -``` - -Save and close the file. You'll be seeing what `export` does presently. In the meantime, to make sure the changes take effect immediately, you need to `source` _.bashrc_ : - -``` -source .bashrc -``` - -What `source` does is execute _.bashrc_ for the current open shell, and all the ones that come after it. The alternative would be to log out and log back in again for the changes to take effect, and who has the time for that? - -From now on, your shell will find every program you dump in _/home//bin_ without you having to specify the whole path to the file. - -### DYI Variables - -You can, of course, make your own variables. All the ones we have seen have been written with ALL CAPS, but [you can call a variable more or less whatever you want][5]. - -Creating a new variables is straightforward: just set a value within it: - -``` -new_variable="Hello" -``` - -And you already know how to recover a value contained within a variable: - -``` -echo $new_variable -``` - -You often have a program that will require you set up a variable for things to work properly. The variable may set an option to "on", or help the program find a library it needs, and so on. When you run a program in Bash, the shell spawns a daughter process. This means it is not exactly the same shell that executes your program, but a related mini-shell that inherits some of the mother's characteristics. Unfortunately, variables, by default, are not one of them. This is because, by default again, variables are _local_. This means that, for security reasons, a variable set in one shell cannot be read in another, even if it is a daughter shell. - -To see what I mean, set a variable: - -``` -robots="R2D2 & C3PO" -``` - -... and run: - -``` -bash -``` - -You just ran a Bash shell program within a Bash shell program. - -Now see if you can read the contents of you variable with: - -``` -echo $robots -``` - -You should draw a blank. - -Still inside your bash-within-bash shell, set `robots` to something different: - -``` -robots="These aren't the ones you are looking for" -``` - -Check `robots`' value: - -``` -$ echo $robots -These aren't the ones you are looking for -``` - -Exit the bash-within-bash shell: - -``` -exit -``` - -And re-check the value of `robots`: - -``` -$ echo $robots -R2D2 & C3P0 -``` - -This is very useful to avoid all sorts of messed up configurations, but this presents a problem also: if a program requires you set up a variable, but the program can't access it because Bash will execute it in a daughter process, what can you do? That is exactly what `export` is for. - -Try doing the prior experiment, but, instead of just starting off by setting `robots="R2D2 & C3PO"`, export it at the same time: - -``` -export robots="R2D2 & C3PO" -``` - -You'll notice that, when you enter the bash-within-bash shell, `robots` still retains the same value it had at the outset. - -**Interesting fact:** While the daughter process will "inherit" the value of an exported variable, if the variable is changed within the daughter process, changes will not flow upwards to the mother process. In other words, changing the value of an exported variable in a daughter process does not change the value of the original variable in the mother process. - -You can see all exported variables by running - -``` -export -p -``` - -The variables you create should be at the end of the list. You will also notice some other interesting variables in the list: `USER`, for example, contains the current user's user name; `PWD` points to the current directory; and `OLDPWD` contains the path to the last directory you visited and since left. That's because, if you run: - -``` -cd - -``` - -You will go back to the last directory you visited and `cd` gets the information from `OLDPWD`. - -You can also see all the environment variables using the `env` command. - -To un-export a variable, use the `-n` option: - -``` -export -n robots -``` - -### Next Time - -You have now reached a level in which you are dangerous to yourself and others. It is time you learned how to protect yourself from yourself by making your environment safer and friendlier through the use of _aliases,_ and that is exactly what we'll be tackling in the next episode. See you then. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise - -作者:[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.kde.org/applications/utilities/kate/ -[2]: https://help.gnome.org/users/gedit/stable/ -[3]: https://www.nano-editor.org/ -[4]: https://www.vim.org/ -[5]: https://bash.cyberciti.biz/guide/Rules_for_Naming_variable_name diff --git a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md b/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md new file mode 100644 index 0000000000..d77cfd22aa --- /dev/null +++ b/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md @@ -0,0 +1,212 @@ +Bash 环境变量的那些事 +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/wynand-van-poortvliet-40467-unsplash.jpg?itok=tr6Eb4N0) + +bash 变量,尤其是讨厌的环境变量,已经是一个老生常谈的话题了。我们也更应该对它有一个详细的了解,让它为我们所用。 + +下面就打开终端,开始吧。 + +### 环境变量 + +`HOME` 除了是你脱下帽子惬意休息的地方,同时也是 Linux 中的一个变量,它是当前用户主目录的路径: + +``` +echo $HOME +``` + +以上这个命令会显示当前用户的主目录路径,通常都在 `/home/` 下。 + +顾名思义,一个变量的值并不是固定的。实际上,Linux 系统中每一个用户的 `HOME` 变量都是不一样的,当然你也可以这样自行更改 `HOME` 变量的值: + +``` +HOME=/home//Documents +``` + +以上这个命令将会把 `HOME` 变量设置为 `/home//Documents` 目录。 + +其中有三点需要留意: + + 1. `=` 符号和其两侧的内容之间不加空格。空格在 shell 中有专门的意义,不能随意地在任何地方添加空格。 + 2. 如果你需要对变量进行赋值,只需要使用变量名称就可以了。但如果需要读取或者使用变量的值,需要在变量前面加上一个 `$` 号。 + 3. 更改 `HOME` 变量具有一定的风险。有很多程序是依赖于 `HOME` 变量的,更改 `HOME` 变量可能会导致一些不可预见的结果。例如,如果按照上面的方式更改了 `HOME` 变量,然后执行不带有任何参数的 `cd` 命令,在通常情况下,会跳转到用户的主目录下,但在这个时候,会跳转到 `HOME` 变量指定的目录下。 + +上面第 3 点中环境变量的更改并不是持久有效的,在终端关闭后重新打开终端,又或者是新建一个终端,执行 `echo $HOME` 命令输出的仍然会是初始的值,而不是重新自定义的值。 + +在讨论如何持久地更改一个环境变量之前,我们先来看一下另一个比较重要的环境变量。 + +### PATH 变量 + +在 `PATH` 变量中存放了一系列目录,而且是放置了可执行程序的目录。正是由于 `PATH` 变量的存在,让你不需要知道应用程序具体安装到了什么目录,而 shell 却可以正确地找到这些应用程序。 + +如果你查看 `PATH` 变量的值,大概会是以下这样: + +``` +$ echo $PATH +/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin +``` + +每两个目录之间使用冒号(`:`)分隔。如果某个应用程序的所在目录不在 `PATH` 变量中,那么运行的时候就需要声明应用程序的目录让 shell 能够找到。 + +``` +/home//bin/my_program.sh +``` + +例如以上命令就会执行当前用户 `bin/` 目录下的 `my_program.sh` 文件。 + +有一个常见的问题:如果你不希望弄乱系统的 `bin/` 目录,同时也不希望你自己的文件被其它人运行,还不想每次运行的时候都要输入完整的路径,那么,你可以在你的主目录中创建一个独立的 `bin/` 目录: + +``` +mkdir $HOME/bin +``` + +然后将这个目录添加到 `PATH` 变量中: + +``` +PATH=$PATH:$HOME/bin +``` + +然后 `/home//bin/` 目录就会出现在 `PATH` 变量中了。但正如之前所说,这个变更只会在当前的 shell 生效,当前的 shell 一旦关闭,环境变量的值就又恢复原状了。 + +如果要让变更对当前用户持续生效,就不能在 shell 中直接执行对应的变更,而是应该将这些变更操作卸载每次启动 shell 时都会运行的文件当中。这个文件就是当前用户主目录中的 `.bashrc` 文件。文件名前面的点号表明这是一个隐藏文件,执行普通的 `ls` 命令是不会将这个文件显示出来的,但只要在 `ls` 命令中加入 `-a` 参数就可以看到这个文件了。 + +你可以使用诸如 [kate][1]、[gedit][2]、[nano][3] 或者 [vim][4] 这些文本编辑器来打开 `.bashrc` 文件(但不要用 LibreOffice Writer,它是一个文字处理软件,跟前面几个文字编辑器并不一个量级的东西)。打开 `.bashrc` 文件之后,你会看见里面放置了一些 shell 命令,是用于为当前用户设置环境的。 + +在文件的末尾添加新行并输入以下内容: + +``` +export PATH=$PATH:$HOME/bin +``` + +保存并关闭 `.bashrc` 文件,接下来你就会看到 `export` 语句的效果。执行以下的命令让刚才的修改立即生效: + +``` +source .bashrc +``` + +刚才执行的 `source` 命令让 `.bashrc` 文件在当前的 shell 立即生效,并且对于之后打开的 shell 都会有效。因此另一个等效的方法是退出并重新进入 shell,但这样也太麻烦了。 + +现在,你的 shell 就能自动寻找到 `/home//bin/` 下的程序了,执行这个目录下的程序也不需要完整地写出程序的路径。 + +### 自定义变量 + +当然,你也可以定义自己的变量。刚才我们看到的变量名称都是全大写的,实际上[变量名称的定义还是比较灵活的][5]。 + +定义新变量的过程非常直观,直接对它赋值就可以了: + +``` +new_variable="Hello" +``` + +然后可以用一下的方式读取到已定义变量的值: + +``` +echo $new_variable +``` + +程序的正常工作离不开各种变量,例如要将某个选项设置为 on,又或者让程序找到所需的代码库,都需要使用变量。在 bash 中运行程序的时候会生成一个子 shell,这个子 shell 和执行原程序的父 shell 并不是完全一样的,只是继承了父 shell 的部分内容,而且默认是不继承父 shell 中的变量的。因为变量默认情况下是局部变量,出于安全原因,一个 shell 中的局部变量不会被另一个 shell 读取到,即使是子 shell 也不可以。 + +下面举一个例子。首先定义一个变量: + +``` +robots="R2D2 & C3PO" +``` + +然后执行: + +``` +bash +``` + +现在是在 bash shell 中创建了一个子 shell。 + +执行这个命令看看还能不能读取到刚才定义的变量: + +``` +echo $robots +``` + +你会发现读取不到。 + +还是在这个子 shell 中,为 `robots` 变量赋一个不同的值: + +``` +robots="These aren't the ones you are looking for" +``` + +再读取一次: + +``` +$ echo $robots +These aren't the ones you are looking for +``` + +退出这个子 shell: + +``` +exit +``` + +然后再看一下现在 `robots` 变量的值: + +``` +$ echo $robots +R2D2 & C3P0 +``` + +这一个特性可以有效避免配置过程中产生混乱,同时也会导致一个问题:如果程序中需要设置变量,但却由于子 shell 的原因无法正常访问到这个变量,该如何解决呢?这个时候就需要用到 `export` 了。 + +重复一次刚才的过程,但这一次不是通过 `robots="R2D2 & C3PO"` 方式来设置变量,而是使用 `export` 命令: + +``` +export robots="R2D2 & C3PO" +``` + +现在你会发现,在进入子 shell 之后,`robots` 变量的值仍然是最初赋予的值。 + +要注意的是,尽管子 shell 会继承通过 `export` 导出的变量,但如果在子 shell 中对这个变量重新赋值,是不会影响到父 shell 中对应变量的。 + +如果要查看所有通过 `export` 导出的变量,可以执行以下命令: + +``` +export -p +``` + +自定义的变量会显示在这个列表的末尾。这个列表中还有一些常见的变量:例如 `USER` 的值是当前用户的用户名,`PWD` 的值是当前用户当前所在的目录,而 `OLDPWD` 的值则是当前用户上一个访问过的目录。因此如果执行: + +``` +cd - +``` + +就会切换到上一个访问过的目录,那是因为 `cd` 命令读取到了 `OLDPWD` 变量的值。 + +你也可以使用 `env` 命令查看所有环境变量。 + +如果要取消导出一个变量,可以加上 `-n` 参数: + +``` +export -n robots +``` + +### 接下来 + +了解过环境变量的知识之后,你已经到达了可能对自己和他人造成危险的水平,接下来就需要了解如何通过使用 `_aliases` 来让环境变得更安全、更友好以保护自己了。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise + +作者:[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.kde.org/applications/utilities/kate/ +[2]: https://help.gnome.org/users/gedit/stable/ +[3]: https://www.nano-editor.org/ +[4]: https://www.vim.org/ +[5]: https://bash.cyberciti.biz/guide/Rules_for_Naming_variable_name + From 5f3454c27ba96c29819ecb9c4220a82bcb7a85c0 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Sat, 15 Dec 2018 12:52:50 +0800 Subject: [PATCH 0117/4278] translating by hopefully2333 translating by hopefully2333 --- ...ove login security with challenge-response authentication.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20181022 Improve login security with challenge-response authentication.md b/sources/tech/20181022 Improve login security with challenge-response authentication.md index 66ed2534b0..ff5cdba354 100644 --- a/sources/tech/20181022 Improve login security with challenge-response authentication.md +++ b/sources/tech/20181022 Improve login security with challenge-response authentication.md @@ -1,3 +1,5 @@ +translating by hopefully2333 + Improve login security with challenge-response authentication ====== From 9a9757403e988a7c6b5e52073553d74484bd1ffb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 15 Dec 2018 15:06:31 +0800 Subject: [PATCH 0118/4278] PRF:20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md @geekpi --- ...le Formats with SoundConverter in Linux.md | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md b/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md index 0ad348edb0..30dd467e8f 100644 --- a/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md +++ b/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Easily Convert Audio File Formats with SoundConverter in Linux) [#]: via: (https://itsfoss.com/sound-converter-linux/) @@ -10,7 +10,7 @@ 在 Linux 中使用 SoundConverter 轻松转换音频文件格式 ====== -**如果你正在寻找将音频文件格式转换为 wav、mp3、ogg 或任何其他格式,SoundConverter 是你在 Linux 中需要的工具。** +> 如果你正在寻找将音频文件格式转换为 wav、mp3、ogg 或任何其他格式,SoundConverter 是你在 Linux 中需要的工具。 ![Audio Converter in Linux][1] @@ -18,18 +18,19 @@ 不幸的是,Rhythmbox 无法播放 WAV。最重要的是,单个文件大小约为 70MB。想象一下,将这么大的音乐传输到智能手机。它会不必要地占用大量空间。 -所以我认为是时候将 WAV 文件转换为 MP3,这个长青且最流行的音乐文件格式。 +所以我认为是时候将 WAV 文件转换为 MP3 —— 这个长青且最流行的音乐文件格式。 为此,我需要一个在 Linux 中的音频转换器。在这个教程中,我将向你展示如何使用名为 SoundCoverter 的 GUI 工具轻松地将音频文件从一种格式转换为另一种格式。 ### 在 Linux 中安装 SoundConverter -[SoundConverter][3] 是一款流行的免费开源软件。它应该可以在大多数 Linux 发行版的官方仓库中找到。 +[SoundConverter][3] 是一款流行的自由开源软件。它应该可以在大多数 Linux 发行版的官方仓库中找到。 Ubuntu/Linux Mint 用户只需在软件中心搜索 SoundConverter 并从那里安装即可。 ![SoundConverter application in Software Center of Ubuntu][4] -SoundConverter 可以从软件中心安装 + +*SoundConverter 可以从软件中心安装* 或者,你可以使用命令行方式。在基于 Debian 和 Ubuntu 的系统中,你可以使用以下命令: @@ -45,14 +46,17 @@ sudo apt install soundconverter 默认界面看起来像这样,它不能比这简单: -![SoundConverter application interface in Linux][5]Simple Interface +![SoundConverter application interface in Linux][5] + +*简单的界面* 转换音频文件格式只要选择文件并单击转换。 但是,我建议你至少在第一次运行时检查下默认设置。默认情况下,它会将音频文件转换为 OGG 文件格式,你可能不希望这样。 ![Preferences in SoundConverter][6] -可以在“首选项”中更改默认输出设置 + +*可以在“首选项”中更改默认输出设置* 要更改默认输出设置,请单击界面上的“首选项”图标。你会在这里看到很多可更改的选择。 @@ -62,11 +66,11 @@ sudo apt install soundconverter 你还可以更改输出文件名。默认情况下,它只会更改后缀,但你也可以选择根据曲目编号、标题、艺术家等进行命名。为此,原始文件中应包含适当的元数据。 -说到元数据,你听说过 [MusicBrainz Picard][7]吗?此工具可帮助你自动更新本地音乐文件的元数据。 +说到元数据,你听说过 [MusicBrainz Picard][7] 吗?此工具可帮助你自动更新本地音乐文件的元数据。 ### 总结 -我之前用讨论过用一个小程序[在 Linux 中录制音频][8]。这些很棒的工具通过专注某个特定的任务使得生活更轻松。你可以使用成熟和更好的音频编辑工具,如 [Audacity][9],但对于较小的任务,如转换音频文件格式,它可能用起来很复杂。 +我之前用讨论过用一个小程序 [在 Linux 中录制音频][8]。这些很棒的工具通过专注某个特定的任务使得生活更轻松。你可以使用成熟和更好的音频编辑工具,如 [Audacity][9],但对于较小的任务,如转换音频文件格式,它可能用起来很复杂。 我希望你喜欢 SoundConverter。如果你使用其他工具,请在评论中提及,我会在 FOSS 中提及。使用开心! @@ -77,7 +81,7 @@ via: https://itsfoss.com/sound-converter-linux/ 作者:[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/) 荣誉推出 @@ -91,4 +95,4 @@ via: https://itsfoss.com/sound-converter-linux/ [6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-app-linux-preferences.jpeg?resize=800%2C431&ssl=1 [7]: https://itsfoss.com/musicbrainz-picard/ [8]: https://itsfoss.com/record-streaming-audio/ -[9]: https://www.audacityteam.org/ \ No newline at end of file +[9]: https://www.audacityteam.org/ From 7c0f1d12f41b32e847d77cf46fab84c6ad87c20f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 15 Dec 2018 15:06:58 +0800 Subject: [PATCH 0119/4278] PUB:20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md @geekpi https://linux.cn/article-10350-1.html --- ...Convert Audio File Formats with SoundConverter in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md (98%) diff --git a/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md b/published/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md similarity index 98% rename from translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md rename to published/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md index 30dd467e8f..345dac8ac1 100644 --- a/translated/tech/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md +++ b/published/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Easily Convert Audio File Formats with SoundConverter in Linux) [#]: via: (https://itsfoss.com/sound-converter-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10350-1.html) 在 Linux 中使用 SoundConverter 轻松转换音频文件格式 ====== From bb8cd4ab169d8ed58c29a68d602bf255833dc2b6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 15 Dec 2018 15:14:08 +0800 Subject: [PATCH 0120/4278] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=88=B0=E6=96=B0=E7=9A=84=20Wiki=20?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LCTT翻译规范.md | 4 - 中文排版指北.md | 294 ------------------------------------------------ 选题模板.txt | 65 ----------- 3 files changed, 363 deletions(-) delete mode 100644 LCTT翻译规范.md delete mode 100644 中文排版指北.md delete mode 100644 选题模板.txt diff --git a/LCTT翻译规范.md b/LCTT翻译规范.md deleted file mode 100644 index b9a514f115..0000000000 --- a/LCTT翻译规范.md +++ /dev/null @@ -1,4 +0,0 @@ -# Linux中国翻译规范 -1. 翻译中出现的专有名词,可参见Dict.md中的翻译。 -2. 英文人名,如无中文对应译名,一般不译。 -2. 缩写词,一般不须翻译,可考虑旁注中文全名。 \ No newline at end of file diff --git a/中文排版指北.md b/中文排版指北.md deleted file mode 100644 index 9888b4dbc1..0000000000 --- a/中文排版指北.md +++ /dev/null @@ -1,294 +0,0 @@ -# 中文文案排版指北 -[![devDependency Status](https://david-dm.org/mzlogin/chinese-copywriting-guidelines/dev-status.svg)](https://david-dm.org/mzlogin/chinese-copywriting-guidelines#info=devDependencies) - -统一中文文案、排版的相关用法,降低团队成员之间的沟通成本,增强网站气质。 - -Other languages: - -- [English](https://github.com/mzlogin/chinese-copywriting-guidelines/blob/Simplified/README.en.md) -- [Chinese Traditional](https://github.com/sparanoid/chinese-copywriting-guidelines) -- [Chinese Simplified](README.md) - ------ - -## 目录 - -- [空格](#空格) - - [中英文之间需要增加空格](#中英文之间需要增加空格) - - [中文与数字之间需要增加空格](#中文与数字之间需要增加空格) - - [数字与单位之间需要增加空格](#数字与单位之间需要增加空格) - - [全角标点与其他字符之间不加空格](#全角标点与其他字符之间不加空格) - - [`-ms-text-autospace` to the rescue?](#-ms-text-autospace-to-the-rescue) -- [标点符号](#标点符号) - - [不重复使用标点符号](#不重复使用标点符号) -- [全角和半角](#全角和半角) - - [使用全角中文标点](#使用全角中文标点) - - [数字使用半角字符](#数字使用半角字符) - - [遇到完整的英文整句、特殊名词,其內容使用半角标点](#遇到完整的英文整句特殊名词其內容使用半角标点) -- [名词](#名词) - - [专有名词使用正确的大小写](#专有名词使用正确的大小写) - - [不要使用不地道的缩写](#不要使用不地道的缩写) -- [争议](#争议) - - [链接之间增加空格](#链接之间增加空格) -  - [简体中文不要使用直角引号](#简体中文不要使用直角引号) -- [工具](#工具) -- [谁在这样做?](#谁在这样做) -- [参考文献](#参考文献) - -## 空格 - -「有研究显示,打字的时候不喜欢在中文和英文之间加空格的人,感情路都走得很辛苦,有七成的比例会在 34 岁的时候跟自己不爱的人结婚,而其余三成的人最后只能把遗产留给自己的猫。毕竟爱情跟书写都需要适时地留白。 - -与大家共勉之。」——[vinta/paranoid-auto-spacing](https://github.com/vinta/pangu.js) - -### 中英文之间需要增加空格 - -正确: - -> 在 LeanCloud 上,数据存储是围绕 `AVObject` 进行的。 - -错误: - -> 在LeanCloud上,数据存储是围绕`AVObject`进行的。 - -> 在 LeanCloud上,数据存储是围绕`AVObject` 进行的。 - -完整的正确用法: - -> 在 LeanCloud 上,数据存储是围绕 `AVObject` 进行的。每个 `AVObject` 都包含了与 JSON 兼容的 key-value 对应的数据。数据是 schema-free 的,你不需要在每个 `AVObject` 上提前指定存在哪些键,只要直接设定对应的 key-value 即可。 - -例外:「豆瓣FM」等产品名词,按照官方所定义的格式书写。 - -### 中文与数字之间需要增加空格 - -正确: - -> 今天出去买菜花了 5000 元。 - -错误: - -> 今天出去买菜花了 5000元。 - -> 今天出去买菜花了5000元。 - -### 数字与单位之间需要增加空格 - -正确: - -> 我家的光纤入户宽带有 10 Gbps,SSD 一共有 20 TB。 - -错误: - -> 我家的光纤入户宽带有 10Gbps,SSD 一共有 10TB。 - -例外:度/百分比与数字之间不需要增加空格: - -正确: - -> 今天是 233° 的高温。 - -> 新 MacBook Pro 有 15% 的 CPU 性能提升。 - -错误: - -> 今天是 233 ° 的高温。 - -> 新 MacBook Pro 有 15 % 的 CPU 性能提升。 - -### 全角标点与其他字符之间不加空格 - -正确: - -> 刚刚买了一部 iPhone,好开心! - -错误: - -> 刚刚买了一部 iPhone ,好开心! - -### `-ms-text-autospace` to the rescue? - -Microsoft 有个 [`-ms-text-autospace`](http://msdn.microsoft.com/en-us/library/ie/ms531164(v=vs.85).aspx) 的 CSS 属性可以实现自动为中英文之间增加空白。不过目前并未普及,另外在其他应用场景,例如 OS X、iOS 的用户界面目前并不存在这个特性,所以请继续保持随手加空格的习惯。 - -## 标点符号 - -### 不重复使用标点符号 - -正确: - -> 德国队竟然战胜了巴西队! - -> 她竟然对你说“喵”?! - -错误: - -> 德国队竟然战胜了巴西队!! - -> 德国队竟然战胜了巴西队!!!!!!!! - -> 她竟然对你说「喵」??!! - -> 她竟然对你说「喵」?!?!??!! - -## 全角和半角 - -不明白什么是全角(全形)与半角(半形)符号?请查看维基百科词条『[全角和半角](http://zh.wikipedia.org/wiki/%E5%85%A8%E5%BD%A2%E5%92%8C%E5%8D%8A%E5%BD%A2)』。 - -### 使用全角中文标点 - -正确: - -> 嗨!你知道嘛?今天前台的小妹跟我说“喵”了哎! - -> 核磁共振成像(NMRI)是什么原理都不知道?JFGI! - -错误: - -> 嗨! 你知道嘛? 今天前台的小妹跟我说 "喵" 了哎! - -> 嗨!你知道嘛?今天前台的小妹跟我说"喵"了哎! - -> 核磁共振成像 (NMRI) 是什么原理都不知道? JFGI! - -> 核磁共振成像(NMRI)是什么原理都不知道?JFGI! - -### 数字使用半角字符 - -正确: - -> 这件蛋糕只卖 1000 元。 - -错误: - -> 这件蛋糕只卖 1000 元。 - -例外:在设计稿、宣传海报中如出现极少量数字的情形时,为方便文字对齐,是可以使用全角数字的。 - -### 遇到完整的英文整句、特殊名词,其內容使用半角标点 - -正确: - -> 乔布斯那句话是怎么说的?“Stay hungry, stay foolish.” - -> 推荐你阅读《Hackers & Painters: Big Ideas from the Computer Age》,非常的有趣。 - -错误: - -> 乔布斯那句话是怎么说的?「Stay hungry,stay foolish。」 - -> 推荐你阅读《Hackers&Painters:Big Ideas from the Computer Age》,非常的有趣。 - -## 名词 - -### 专有名词使用正确的大小写 - -大小写相关用法原属于英文书写范畴,不属于本 wiki 讨论內容,在这里只对部分易错用法进行简述。 - -正确: - -> 使用 GitHub 登录 - -> 我们的客户有 GitHub、Foursquare、Microsoft Corporation、Google、Facebook, Inc.。 - -错误: - -> 使用 github 登录 - -> 使用 GITHUB 登录 - -> 使用 Github 登录 - -> 使用 gitHub 登录 - -> 使用 gイんĤЦ8 登录 - -> 我们的客户有 github、foursquare、microsoft corporation、google、facebook, inc.。 - -> 我们的客户有 GITHUB、FOURSQUARE、MICROSOFT CORPORATION、GOOGLE、FACEBOOK, INC.。 - -> 我们的客户有 Github、FourSquare、MicroSoft Corporation、Google、FaceBook, Inc.。 - -> 我们的客户有 gitHub、fourSquare、microSoft Corporation、google、faceBook, Inc.。 - -> 我们的客户有 gイんĤЦ8、キouЯƧquムгє、๓เςг๏ร๏Ŧt ς๏гק๏гคtเ๏ภn、900913、ƒ4ᄃëв๏๏к, IПᄃ.。 - -注意:当网页中需要配合整体视觉风格而出现全部大写/小写的情形,HTML 中请使用标准的大小写规范进行书写;并通过 `text-transform: uppercase;`/`text-transform: lowercase;` 对表现形式进行定义。 - -### 不要使用不地道的缩写 - -正确: - -> 我们需要一位熟悉 JavaScript、HTML5,至少理解一种框架(如 Backbone.js、AngularJS、React 等)的前端开发者。 - -错误: - -> 我们需要一位熟悉 Js、h5,至少理解一种框架(如 backbone、angular、RJS 等)的 FED。 - -## 争议 - -以下用法略带有个人色彩,既:无论是否遵循下述规则,从语法的角度来讲都是**正确**的。 - -### 链接之间增加空格 - -用法: - -> 请 [提交一个 issue](#) 并分配给相关同事。 - -> 访问我们网站的最新动态,请 [点击这里](#) 进行订阅! - -对比用法: - -> 请[提交一个 issue](#) 并分配给相关同事。 - -> 访问我们网站的最新动态,请[点击这里](#)进行订阅! - -### 简体中文不要使用直角引号 - -不管中英文,如果没有特殊要求,**不要用直角引号**。 - -## 工具 - -仓库 | 语言 ---- | --- -[vinta/paranoid-auto-spacing](https://github.com/vinta/paranoid-auto-spacing) | JavaScript -[huei90/pangu.node](https://github.com/huei90/pangu.node) | Node.js -[huacnlee/auto-correct](https://github.com/huacnlee/auto-correct) | Ruby -[sparanoid/space-lover](https://github.com/sparanoid/space-lover) | PHP (WordPress) -[nauxliu/auto-correct](https://github.com/NauxLiu/auto-correct) | PHP -[hotoo/pangu.vim](https://github.com/hotoo/pangu.vim) | Vim -[sparanoid/grunt-auto-spacing](https://github.com/sparanoid/grunt-auto-spacing) | Node.js (Grunt) -[hjiang/scripts/add-space-between-latin-and-cjk](https://github.com/hjiang/scripts/blob/master/add-space-between-latin-and-cjk) | Python - -## 谁在这样做? - -网站 | 文案 | UGC ---- | --- | --- -[Apple 中国](http://www.apple.com/cn/) | Yes | N/A -[Apple 香港](http://www.apple.com/hk/) | Yes | N/A -[Apple 台湾](http://www.apple.com/tw/) | Yes | N/A -[Microsoft 中国](http://www.microsoft.com/zh-cn/) | Yes | N/A -[Microsoft 香港](http://www.microsoft.com/zh-hk/) | Yes | N/A -[Microsoft 台湾](http://www.microsoft.com/zh-tw/) | Yes | N/A -[LeanCloud](https://leancloud.cn/) | Yes | N/A -[知乎](https://www.zhihu.com/) | Yes | 部分用户达成 -[V2EX](https://www.v2ex.com/) | Yes | Yes -[SegmentFault](https://segmentfault.com/) | Yes | 部分用户达成 -[Apple4us](http://apple4us.com/) | Yes | N/A -[豌豆荚](https://www.wandoujia.com/) | Yes | N/A -[Ruby China](https://ruby-china.org/) | Yes | 标题达成 -[PHPHub](https://phphub.org/) | Yes | 标题达成 - -## 参考文献 - -- [Guidelines for Using Capital Letters](http://grammar.about.com/od/punctuationandmechanics/a/Guidelines-For-Using-Capital-Letters.htm) -- [Letter case - Wikipedia](http://en.wikipedia.org/wiki/Letter_case) -- [Punctuation - Oxford Dictionaries](http://www.oxforddictionaries.com/words/punctuation) -- [Punctuation - The Purdue OWL](https://owl.english.purdue.edu/owl/section/1/6/) -- [How to Use English Punctuation Corrently - wikiHow](http://www.wikihow.com/Use-English-Punctuation-Correctly) -- [格式 - openSUSE](https://zh.opensuse.org/index.php?title=Help:%E6%A0%BC%E5%BC%8F) -- [全角和半角 - 维基百科](http://zh.wikipedia.org/wiki/%E5%85%A8%E5%BD%A2%E5%92%8C%E5%8D%8A%E5%BD%A2) -- [引号 - 维基百科](http://zh.wikipedia.org/wiki/%E5%BC%95%E8%99%9F) -- [疑问惊叹号 - 维基百科](http://zh.wikipedia.org/wiki/%E7%96%91%E5%95%8F%E9%A9%9A%E5%98%86%E8%99%9F) - -## CopyRight - -[中文文案排版指北](https://github.com/sparanoid/chinese-copywriting-guidelines) diff --git a/选题模板.txt b/选题模板.txt deleted file mode 100644 index 4515fe78ab..0000000000 --- a/选题模板.txt +++ /dev/null @@ -1,65 +0,0 @@ -选题标题格式: - -``` -原文日期 标题.md -``` - -其中: - -- 原文日期为该文章发表时的日期,采用 8 位数字表示 -- 标题需去除特殊字符,使用 `_` 替换。 - -正文内容: - -``` -[#]: collector: (选题人 GitHub ID) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (文章标题) -[#]: via: (原文 URL) -[#]: author: (作者名 作者链接 URL) -[#]: url: ( ) - -标题 -======= - -### 子一级标题 - -正文 - -#### 子二级标题 - -正文内容 - -![][1] - -### 子一级标题 - -正文内容 : I have a [dream][2]。 - --------------------------------------------------------------------------------- - -via: 原文 链接 URL - -作者:[作者名][a] -译者:[选题 ID][b] -译者:[译者 ID](https://github.com/译者 ID) -校对:[校对 ID](https://github.com/校对 ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: 作者链接 URL -[b]: 选题链接 URL -[1]: 图片链接地址 -[2]: 文内链接地址 -``` - -说明: - -1. 标题层级很多时从 `##` 开始 -2. 图片链接和引文链接地址在下方集中写 -3. 因为 Windows 系统文件名有限制,所以文章名不要有特殊符号,如 `\/:*"<>|`,同时也不推荐全大写,或者其它不利阅读的格式 -4. 正文格式参照中文排版指北(https://github.com/LCTT/TranslateProject/blob/master/%E4%B8%AD%E6%96%87%E6%8E%92%E7%89%88%E6%8C%87%E5%8C%97.md) -5. 我们使用的 markdown 语法和 GitHub 一致。而实际中使用的都是基本语法,比如链接、包含图片、标题、列表、字体控制和代码高亮。 -6. 选题的内容分为两类: 干货和湿货。干货就是技术文章,比如针对某种技术、工具的介绍、讲解和讨论。湿货则是和技术、开发、计算机文化有关的文章。选题时主要就是根据这两条来选择文章,文章需要对大家有益处,篇幅不宜太短,可以是系列文章,也可以是长篇大论,但是文章要有内容,不能有严重的错误,最好不要选择已经有翻译的原文。 From 69e0f0ad82fa51c88e7e19726683cd938b18e841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Sat, 15 Dec 2018 19:52:34 +0800 Subject: [PATCH 0121/4278] Create 20180419 Migrating to Linux- Network and System Settings.md --- ...g to Linux- Network and System Settings.md | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 translated/tech/20180419 Migrating to Linux- Network and System Settings.md diff --git a/translated/tech/20180419 Migrating to Linux- Network and System Settings.md b/translated/tech/20180419 Migrating to Linux- Network and System Settings.md new file mode 100644 index 0000000000..480aa05239 --- /dev/null +++ b/translated/tech/20180419 Migrating to Linux- Network and System Settings.md @@ -0,0 +1,128 @@ +# 迁移到 Linux 工作环境: 网络和系统设置 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/animals-birds-flock-55832.jpg?itok=NUGAyhDO) + +在这个系列中,我们提供了基础知识的概述,以帮助您成功地从另一个操作系统过渡到Linux。如果你错过了以前的文章,可以从这访问: + +[Part 1 - 基本介绍][1] + +[Part 2 - 磁盘、文件和文件系统][2] + +[Part 3 - 图形界面环境][3] + +[Part 4 - 命令行][4] + +[Part 5 - 使用 sudo 命令][5] + +[Part 6 - 软件安装][6] + +Linux 提供了一系列网络和系统设置。在桌面上,Linux允许您调整系统上的任何内容。大多数这些设置都在/ etc目录下的纯文本文件中公开。这里我将介绍你使用桌面 Linux 操作系统的过程中最常用的设置。 + + + +大多数设置都能够在设置程序里面找到,这些设置可能对于不同的 Linux 发行版有所不同。通常来说,你可以修改背景、调整音量、连接打印机、进行显示设置等。对于这些设置尽管我不会全部谈论,但你可以自己探索。 + + + +### 连接因特网 + +在Linux中连接到Internet通常非常简单。如果您通过以太网电缆连接,Linux通常会在插入电缆时或启动时获得IP地址并自动连接(如果电缆已连接)。 + +如果您使用无线,则在大多数发行版中都有一个菜单,可以在指示器面板中或在设置中(取决于您的发行版),您可以在其中选择无线网络的SSID。如果网络受密码保护,它通常会提示您输入密码。 然后连接,这个过程相当顺利。 + +在图形界面您可以通过进入设置来调整网络设置。通常称为系统设置或者是设置。通常可以轻松找到设置程序,因为它的图标是齿轮或工具图片(图1)。 + +![Network Settings][8] + +图1: Gnome 桌面网络设置指示器图标. + +[经许可使用][9] + +### 网络接口名称 + +在 Linux 下,网络设备有名称。 从历史上看,它们的名称分别为 eth0 和 wlan0 - 或以太网和无线。 较新的 Linux 系统一直使用看起来更深奥的不同名称,如 enp4s0和 wlp5s0 。 如果名称以 en 开头,则它是有线以太网接口。 如果它以 wl 开头,那么它就是一个无线接口。 其余的字母和数字反映了设备如何连接到硬件。 + +### 通过命令行进行网络管理 + +如果您希望更好地控制网络设置,或者如果您在没有图形桌面的情况下管理网络连接,则还可以从命令行管理网络。 + +请注意,用于在图形桌面中管理网络的最常用服务是网络管理器,而网络管理器通常会覆盖在命令行上进行的设置更改。如果您正在使用网络管理器,最好在其界面中更改您的设置,以防止撤消您从命令行或其他位置所做的更改。 + +更改图形环境中的设置很可能与网络管理器交互,您还可以使用名为nmtui的工具从命令行更改网络管理器设置。nmtui工具提供了您在图形环境中找到的所有设置,但是在基于文本的半图形界面中提供了该设置,该界面可在命令行上运行(图2)。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-2_0.png?itok=1QVjDdbJ) + +图 2:nmtui 界面 + +[经许可使用][9] + +在命令行上,有一个名为 ifconfig 的旧工具来管理网络,还有一个名为 ip 的新工具。在某些发行版中,ifconfig 被认为是不推荐使用的,默认情况下甚至没有安装。在其他发行版上,ifconfig 仍可以使用。 + +以下是一些允许您显示和更改网络设置的命令: + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/screen_shot_2018-04-17_at_3.11.48_pm.png?itok=EZsjb-GQ) + +[经许可使用][9] + +### 进程和系统信息 + +在 Windows 系统中,你可以使用任务管理器来查看所有正在运行的程序和服务的列表。你可以停止运行中的程序,并且可以在其中显示的某些选项卡中查看系统性能.。 + +在 Linux 系统下你可以使用命令行或者图形界面中做同样的事情。Linux 系统中根据你的发行版本会有不同的几个可以使用的图形工具。大多数所共有的工具是 System Monitor 和 KSysGuard。在这些工具中,你可以查看系统性能,查看进程列表甚至是杀死进程(图 3)。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-3_2.png?itok=ePeXj9PA) + +图 3:NetHogs 截图 + +[经许可使用][9] + +在这些工具中,你也可以查看系统全局网络流量(图 4)。 + +![System Monitor][11] + +图4: Gnome System Monitor 的截图 + +[经许可使用][9] + +### 管理进程和系统使用 + +您还可以从命令行使用相当多的工具。使用 ps 命令可以查看系统中的进程列表。默认情况下,这个命令的结果是显示当前终端会话下的所有进程列表。但是你也可以通过使用各种命令行参数显示其他进程。如果 ps 命令不会使用可以使用命令 info ps 或者 man ps。 + +大多数人都希望得到一个进程列表,因为他们想要停止占用过多内存或CPU时间的进程。这种情况下有两个非常简单的命令,分别是 top 和 htop 命令(图 5)。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-5_0.png?itok=2nm5EmAl) + +top 和 htop 工具使用效果非常相似。两个命令每秒或者两秒会更新重新排序,这样会把占用 CPU 资源最多的放置在列表顶部。你也可以根据其他资源的使用情况比如内存使用情况来排序。 + +使用两个命令时 (top and htop),你可以输入 ”?“ 来获取使用帮助,输入 ”q“ 来退出程序。使用 top 命令你可以按”k“键然后输入进程 ID 来杀死某个进程。 + +使用 htop 命令时你可以使用 ↑↓ 键来将列表中的一条记录进行高亮显示,按下 F9 键会杀死进程(需要回车确认)。 + +本系列中提供的信息和工具将帮助您开始使用 Linux。 只需一点时间和耐心,您就会感到这非常舒服。 + +想学习更多 Linux 内容可访问免费的 ["Linux 简介" ][12]课程,此课程来自 Linux 基金会和 edx. + +------ + +via: https://www.linux.com/blog/learn/2018/4/migrating-linux-network-and-system-settings + +作者:[John Bonesio][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[ScarboroughCoral](https://github.com/ScarboroughCoral) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/johnbonesio +[1]: https://www.linux.com/blog/learn/intro-to-linux/2017/10/migrating-linux-introduction +[2]: https://www.linux.com/blog/learn/intro-to-linux/2017/11/migrating-linux-disks-files-and-filesystems +[3]: https://www.linux.com/blog/learn/2017/12/migrating-linux-graphical-environments +[4]: https://www.linux.com/blog/learn/2018/1/migrating-linux-command-line +[5]: https://www.linux.com/blog/learn/2018/3/migrating-linux-using-sudo +[6]: https://www.linux.com/blog/learn/2018/3/migrating-linux-installing-software +[7]: https://www.linux.com/files/images/figure-1png-2 +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-1_2.png?itok=J-C6q-t5 "Network Settings" +[9]: https://www.linux.com/licenses/category/used-permission +[10]: https://www.linux.com/files/images/figure-4png-1 +[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-4_1.png?itok=boI-L1mF "System Monitor" +[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From dadff90637d2d7bf81e1f449a8583fa9fc49d9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Sat, 15 Dec 2018 19:53:59 +0800 Subject: [PATCH 0122/4278] Delete 20180419 Migrating to Linux- Network and System Settings.md --- ...g to Linux- Network and System Settings.md | 118 ------------------ 1 file changed, 118 deletions(-) delete mode 100644 sources/tech/20180419 Migrating to Linux- Network and System Settings.md diff --git a/sources/tech/20180419 Migrating to Linux- Network and System Settings.md b/sources/tech/20180419 Migrating to Linux- Network and System Settings.md deleted file mode 100644 index 50141aedca..0000000000 --- a/sources/tech/20180419 Migrating to Linux- Network and System Settings.md +++ /dev/null @@ -1,118 +0,0 @@ -ScarboroughCoral translating! - -Migrating to Linux: Network and System Settings -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/animals-birds-flock-55832.jpg?itok=NUGAyhDO) -In this series, we provide an overview of fundamentals to help you successfully make the transition to Linux from another operating system. If you missed the earlier articles in the series, you can find them here: - -[Part 1 - An Introduction][1] - -[Part 2 - Disks, Files, and Filesystems][2] - -[Part 3 - Graphical Environments][3] - -[Part 4 - The Command Line][4] - -[Part 5 - Using sudo][5] - -[Part 6 - Installing Software][6] - -Linux gives you a lot of control over network and system settings. On your desktop, Linux lets you tweak just about anything on the system. Most of these settings are exposed in plain text files under the /etc directory. Here I describe some of the most common settings you’ll use on your desktop Linux system. - -A lot of settings can be found in the Settings program, and the available options will vary by Linux distribution. Usually, you can change the background, tweak sound volume, connect to printers, set up displays, and more. While I won't talk about all of the settings here, you can certainly explore what's in there. - -### Connect to the Internet - -Connecting to the Internet in Linux is often fairly straightforward. If you are wired through an Ethernet cable, Linux will usually get an IP address and connect automatically when the cable is plugged in or at startup if the cable is already connected. - -If you are using wireless, in most distributions there is a menu, either in the indicator panel or in settings (depending on your distribution), where you can select the SSID for your wireless network. If the network is password protected, it will usually prompt you for the password. Afterward, it connects, and the process is fairly smooth. - -You can adjust network settings in the graphical environment by going into settings. Sometimes this is called System Settings or just Settings. Often you can easily spot the settings program because its icon is a gear or a picture of tools (Figure 1). - - -![Network Settings][8] - -Figure 1: Gnome Desktop Network Settings Indicator Icon. - -[Used with permission][9] - -### Network Interface Names - -Under Linux, network devices have names. Historically, these are given names like eth0 and wlan0 -- or Ethernet and wireless, respectively. Newer Linux systems have been using different names that appear more esoteric, like enp4s0 and wlp5s0. If the name starts with en, it's a wired Ethernet interface. If it starts with wl, it's a wireless interface. The rest of the letters and numbers reflect how the device is connected to hardware. - -### Network Management from the Command Line - -If you want more control over your network settings, or if you are managing network connections without a graphical desktop, you can also manage the network from the command line. - -Note that the most common service used to manage networks in a graphical desktop is the Network Manager, and Network Manager will often override setting changes made on the command line. If you are using the Network Manager, it's best to change your settings in its interface so it doesn't undo the changes you make from the command line or someplace else. - -Changing settings in the graphical environment is very likely to be interacting with the Network Manager, and you can also change Network Manager settings from the command line using the tool called nmtui. The nmtui tool provides all the settings that you find in the graphical environment but gives it in a text-based semi-graphical interface that works on the command line (Figure 2). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-2_0.png?itok=1QVjDdbJ) - -On the command line, there is an older tool called ifconfig to manage networks and a newer one called ip. On some distributions, ifconfig is considered to be deprecated and is not even installed by default. On other distributions, ifconfig is still in use. - -Here are some commands that will allow you to display and change network settings: - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/screen_shot_2018-04-17_at_3.11.48_pm.png?itok=EZsjb-GQ) - -### Process and System Information - -In Windows, you can go into the Task Manager to see a list of the all the programs and services that are running. You can also stop programs from running. And you can view system performance in some of the tabs displayed there. - -You can do similar things in Linux both from the command line and from graphical tools. In Linux, there are a few graphical tools available depending on your distribution. The most common ones are System Monitor or KSysGuard. In these tools, you can see system performance, see a list of processes, and even kill processes (Figure 3). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-3_2.png?itok=ePeXj9PA) - -In these tools, you can also view global network traffic on your system (Figure 4). - - -![System Monitor][11] - -Figure 4: Screenshot of Gnome System Monitor. - -[Used with permission][9] - -### Managing Process and System Usage - -There are also quite a few tools you can use from the command line. The command ps can be used to list processes on your system. By default, it will list processes running in your current terminal session. But you can list other processes by giving it various command line options. You can get more help on ps with the commands info ps, or man ps. - -Most folks though want to get a list of processes because they would like to stop the one that is using up too much memory or CPU time. In this case, there are two commands that make this task much easier. These are top and htop (Figure 5). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-5_0.png?itok=2nm5EmAl) - -The top and htop tools work very similarly to each other. These commands update their list every second or two and re-sort the list so that the task using the most CPU is at the top. You can also change the sorting to sort by other resources as well such as memory usage. - -In either of these programs (top and htop), you can type '?' to get help, and 'q' to quit. With top, you can press 'k' to kill a process and then type in the unique PID number for the process to kill it. - -With htop, you can highlight a task by pressing down arrow or up arrow to move the highlight bar, and then press F9 to kill the task followed by Enter to confirm. - -The information and tools provided in this series will help you get started with Linux. With a little time and patience, you'll feel right at home. - -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/2018/4/migrating-linux-network-and-system-settings - -作者:[John Bonesio][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://www.linux.com/users/johnbonesio -[1]:https://www.linux.com/blog/learn/intro-to-linux/2017/10/migrating-linux-introduction -[2]:https://www.linux.com/blog/learn/intro-to-linux/2017/11/migrating-linux-disks-files-and-filesystems -[3]:https://www.linux.com/blog/learn/2017/12/migrating-linux-graphical-environments -[4]:https://www.linux.com/blog/learn/2018/1/migrating-linux-command-line -[5]:https://www.linux.com/blog/learn/2018/3/migrating-linux-using-sudo -[6]:https://www.linux.com/blog/learn/2018/3/migrating-linux-installing-software -[7]:https://www.linux.com/files/images/figure-1png-2 -[8]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-1_2.png?itok=J-C6q-t5 (Network Settings) -[9]:https://www.linux.com/licenses/category/used-permission -[10]:https://www.linux.com/files/images/figure-4png-1 -[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-4_1.png?itok=boI-L1mF (System Monitor) -[12]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 712d4fdc9836cbeae33772b3fef5c663d6f0ca7a Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Sat, 15 Dec 2018 21:21:54 +0800 Subject: [PATCH 0123/4278] translating --- ...Check Laptop Battery Status And Level From Linux Terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md b/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md index 631efa91f9..1f94cd1045 100644 --- a/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md +++ b/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 64cebbbd73ec258d74b9afc20211684aa5fe7a38 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sun, 16 Dec 2018 03:26:05 +0800 Subject: [PATCH 0124/4278] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E5=A4=84?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181205 Bash Variables- Environmental and Otherwise.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md b/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md index d77cfd22aa..c6786eef15 100644 --- a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md +++ b/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md @@ -189,7 +189,7 @@ export -n robots ### 接下来 -了解过环境变量的知识之后,你已经到达了可能对自己和他人造成危险的水平,接下来就需要了解如何通过使用 `_aliases` 来让环境变得更安全、更友好以保护自己了。 +了解过环境变量的知识之后,你已经到达了可能对自己和他人造成危险的水平,接下来就需要了解如何通过使用别名来让环境变得更安全、更友好以保护自己了。 -------------------------------------------------------------------------------- From b77746f0d6282e5584490eab2e0e5bb6df6eb3a2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 11:03:15 +0800 Subject: [PATCH 0125/4278] PRF:20181204 Have a cow at the Linux command line.md @heguangzhi --- published/20181204 Have a cow at the Linux command line.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/published/20181204 Have a cow at the Linux command line.md b/published/20181204 Have a cow at the Linux command line.md index ad7b054d9a..0d0f260bb8 100644 --- a/published/20181204 Have a cow at the Linux command line.md +++ b/published/20181204 Have a cow at the Linux command line.md @@ -23,13 +23,13 @@ `cowsay` 是一个神奇的实用程序,它将文本作为 ASCII 艺术牛的讲话文本输出。 -你可能会发现 `cowsey` 打包在你的默认存储库中,甚至可能已经安装了。对我来说,在 Fedora,像这样安装: +你可能会发现 `cowsay` 打包在你的默认存储库中,甚至可能已经安装了。对我来说,在 Fedora,像这样安装: ``` $ sudo dnf install -y cowsay ``` -然后,用 `cowsey` 调用它,然后是你的消息。也许你想到昨天我们谈到的 [fortune 应用][1] 连接起来。 +然后,用 `cowsay` 调用它,然后是你的消息。也许你想到昨天我们谈到的 [fortune 应用][1] 连接起来。 ``` $ fortune | cowsay @@ -72,7 +72,7 @@ $ cowsay -f dragon "Run for cover, I feel a sneeze coming on." 我对 `cowsay` 的真正不满是,我今天没有足够的时间来为牛的挤奶 —— 一语双关。牛排价格太高了,我只是开个玩笑。 -更严重的是,我已经完全忘记了 `cowsay` 直到我在学习 Ansible 的剧本时再次遇到它。如果你碰巧安装了 `cowyay`,当你运行Ansible 的剧本时,你会从一队奶牛那里获得输出。例如,运行这个剧本: +更严重的是,我已经完全忘记了 `cowsay` 直到我在学习 Ansible 的剧本时再次遇到它。如果你碰巧安装了 `cowsay`,当你运行 Ansible 的剧本时,你会从一队奶牛那里获得输出。例如,运行这个剧本: ``` - hosts: From 6c2e1a5d7fc7764a818a5616d9a42c8199593615 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Sun, 16 Dec 2018 12:45:22 +0800 Subject: [PATCH 0126/4278] translated --- ...ry Status And Level From Linux Terminal.md | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) rename {sources => translated}/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md (53%) diff --git a/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md b/translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md similarity index 53% rename from sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md rename to translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md index 1f94cd1045..7e4bff270a 100644 --- a/sources/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md +++ b/translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (dianbanjiu ) +[#]: translator: ( dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,38 +7,38 @@ [#]: via: (https://www.2daygeek.com/check-laptop-battery-status-and-charging-state-in-linux-terminal/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -5 Ways To Check Laptop Battery Status And Level From Linux Terminal +从 Linux 终端查看笔记本电池状态等级的 5 个方法 ====== -We can easily check the battery status through GUI such as current battery percentage, whether it’s charging or not charging and how long it will be usable without charging, but we can’t able to check the battery health and other related information. +我们可以轻松地通过图形化界面查看当前电量百分比、是否在充电以及当前电量还可以使用多长时间等电池状态,但是却无法查看电池健康度等相关信息。 -In this scenario what will be the solutions. +在这篇文章就是为了解决这些问题。 -Yes, we have few utilities available for this in Linux and it can be achieved through command line. +在 Linux 上有很多实用工具可以用命令行进行使用。 -We are going to discuss about this topic today through this article and i will try to cover possible information i can. +这篇文章今天就要探讨这个主题,我会尽我所能的覆盖尽可能多的信息。 -Checking your battery health monthly once is something good. It will help you to identify whether we are facing any battery or charge related issues. +每月检查一次你的电池健康度是一个很好的想法。它可以帮你检查你当前遇到的问题是否与电池或者充电相关。 -Also, we can see battery model name, power source, vendor and battery technology, etc,. +同时,我们也可以查看电池模组名称、电源、出售商以及电池规格等。 -Power management is a feature that turns off the power or switches system’s components to a low-power state when inactive. +电源管理是在非活跃状态时关闭电源或者切换系统的组件到低耗模式的一种功能。 -### Following Utilities are available in Linux to Check Battery Status. +### 几种在 Linux 下检查电池状态的实用工具 - * `upower`: upower is a command line tool which provides an interface to enumerate power sources on the system. - * `acpi`: acpi Shows information from the /proc or the /sys filesystem, such as battery status or thermal information. - * `batstat`: batstat is a command line tool to print battery status for linux. - * `tlp`: TLP brings you the benefits of advanced power management for Linux without changing any configuration. - * `class file`: The sysfs filesystem is a pseudo-filesystem which provides an interface to kernel data structures. + * `upower`: upower 是一个提供了接口来罗列系统中电源的命令行工具。 + * `acpi`: acpi显示来自 /proc 或者 /sys 文件中的一些信息,例如电池状态或者热量信息 + * `batstat`: batstat 是一个为 Linux 打印电池状态的命令行工具。 + * `tlp`: TLP 可以为你带来更高级的电源管理,而无需修改任何配置。 + * `class file`: 这个文件系统是一个提供了内核数据结构接口的伪文件系统。 -### How to Check Laptop Battery Status Using upower Command? +### 如何使用 upower 命令检查笔记本电池状态 -[upower][1] is a command line tool that provides an interface to enumerate power sources on the system. It control the latency of different operations on your computer, which enables you to save significant amounts of power. +[upower][1] 是一个提供了接口来罗列系统中电源的命令行工具。它在你的电脑上可以控制不同操作的延迟,这可以为你节省很大一部分电量。 -Just run the following command to get the battery and it’s related information on Linux. +只需要在 Linux 中运行以下命令获取电池以及它所依赖的其他信息。 ``` $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 @@ -72,7 +72,7 @@ $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 1543847178 10.714 discharging ``` -To check the specific information about battery, use the following format. +使用下面的格式检查电池的特定信息。 ``` $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty" @@ -81,7 +81,7 @@ $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|perce percentage: 43% ``` -It’s same as above, but it’s taken after power cable plugged in, that’s why the state showing charging. +这个类似于上面的那个,但是充电线缆的插入就相当于一个令牌,这也就是为什么下面会显示正在充电状态的原因。 ``` $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty" @@ -89,15 +89,15 @@ $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|perce percentage: 41% ``` -### How to Check Laptop Battery Status Using TLP Command? +### 如何使用 TLP 命令检查笔记本电池状态 -TLP is a free opensource feature-rich command line tool which optimize laptop battery without making any configuration change. +TLP 是一个自由开源多功能的命令行工具,它可以优化笔记本电池而无需修改任何配置。 -TLP brings you the benefits of advanced power management for Linux without the need to understand every technical detail. TLP comes with a default configuration already optimized for battery life, so you may just install and forget it. Nevertheless TLP is highly customizable to fulfil your specific requirements. +TLP 可以为你的 Linux 带来更高级的电源管理,而无需理解任何技术细节。TLP 默认附带了一个已经为你的电池优化好的配置,所以你可以安装好后就不再管它了。尽管 TLP 是一个可以根据你的需求高度可定制的工具。 -TLP package is available in most of the Linux distribution official repository such as Arch, Debian, Fedora, Gentoo, openSUSE, etc. Use your distribution Package Manager to install the TLP utility. +TLP 在绝大多数 Linux 发行版,例如 Arch、Debian、Fedora、Gentoo、openSUSE等的官方库中都可用。使用你的 Linux 发行版的包管理安装 TLP 即可。 -Just run the following command to get the battery and it’s related information on Linux. +只需要在 Linux 中运行以下命令获取电池以及其他所依赖的信息。 ``` $ sudo tlp-stat -b @@ -117,7 +117,7 @@ Charge = 42.0 [%] Capacity = 87.1 [%] ``` -To see other information as well. +也可以查看其他的信息。 ``` $ sudo tlp-stat -s @@ -139,16 +139,16 @@ Mode = battery Power source = battery ``` -### How to Check Laptop Battery Status Using ACPI Command? +### 如何使用 ACPI 命令检查电池状态 -ACPI stands for Advanced Configuration and Power Interface modules are kernel modules for different ACPI parts. They enable special ACPI functions or add information to /proc or /sys. These information can be parsed by acpid for events or other monitoring applications. +ACPI 代表高级配置和电源接口模块,它们是不同 ACPI 部件的内核模块。它们启用特殊的 ACPI 函数向 /proc 或者 /sys 中添加信息。这些信息可以通过事件或者其他监控程序的 acpid 进行解析。 ``` $ acpi Battery 0: Charging, 43%, 01:05:11 until charged ``` -To see battery capacity. +查看电池容量。 ``` $ acpi -i @@ -156,7 +156,7 @@ Battery 0: Charging, 43%, 01:05:07 until charged Battery 0: design capacity 3817 mAh, last full capacity 3324 mAh = 87% ``` -To see more details about battery and related information. +查看更多有关电池及其相关的信息。 ``` $ acpi -V @@ -177,9 +177,9 @@ Cooling 10: x86_pkg_temp no state information available Cooling 11: Processor 0 of 10 ``` -### How to Check Laptop Battery Status Using Batstat Command? +### 如何使用 Batstat 命令查看笔记本电池状态 -batstat is a command line tool to print battery status in linux terminal. +batstat 是一个在 Linux 终端打印电池信息的命令行工具。 ``` Status: Charging @@ -193,13 +193,13 @@ Time elapsed: 0: 0:12 since 49.00% 0: 0: 0 49.00% ``` -### How to Check Laptop Battery Status Using sysfs filesystem? +### 如何使用 sysfs 文件系统查看笔记本电池状态 -The sysfs filesystem is a pseudo-filesystem which provides an interface to kernel data structures. The files under sysfs provide information about devices, kernel modules, filesystems, and other kernel components. +sysfs 文件系统是一个提供了内核数据结构接口的伪文件系统。sysfs 下的文件提供有关设备、内核模块、文件系统和其他内核组件的信息。 -The sysfs filesystem is commonly mounted at /sys. Typically, it is mounted automatically by the system, but it can also be mounted manually using a command such as `mount -t sysfs sysfs /sys` +sysfs 文件系统通常挂载在 /sys。通常来说,它会被系统自动挂载,但是也可以使用例如 `mount -t sysfs sysfs /sys` 命令进行手动挂载。 -Many of the files in the sysfs filesystem are read-only, but some files are writable, allowing kernel variables to be changed. To avoid redundancy, symbolic links are heavily used to connect entries across the filesystem tree. +在 sysfs 文件系统中的很多文件都是只读的,但也有一些是可写的,允许更改内核变量。为了避免冗余,符号链接被大量用于连接文件系统数中的条目。 ``` $ cat /sys/class/power_supply/BAT0/* @@ -247,7 +247,7 @@ via: https://www.2daygeek.com/check-laptop-battery-status-and-charging-state-in- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[dianbanjiu](https://github.com/dianbanjiu) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8a9e2985aa5ecfed2ece687677feeb1a1464f0d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 12:58:38 +0800 Subject: [PATCH 0127/4278] PRF:20181016 Lab 4- Preemptive Multitasking.md @qhwdw --- ...20181016 Lab 4- Preemptive Multitasking.md | 381 ++++++++---------- 1 file changed, 173 insertions(+), 208 deletions(-) diff --git a/translated/tech/20181016 Lab 4- Preemptive Multitasking.md b/translated/tech/20181016 Lab 4- Preemptive Multitasking.md index 9302b7288a..4023b0b2e9 100644 --- a/translated/tech/20181016 Lab 4- Preemptive Multitasking.md +++ b/translated/tech/20181016 Lab 4- Preemptive Multitasking.md @@ -1,10 +1,9 @@ -实验 4:抢占式多任务处理 +Caffeinated 6.828:实验 4:抢占式多任务处理 ====== -### 实验 4:抢占式多任务处理 -#### 简介 +### 简介 -在本实验中,你将在多个同时活动的用户模式中的环境之间实现抢占式多任务处理。 +在本实验中,你将在多个同时活动的用户模式环境之间实现抢占式多任务处理。 在 Part A 中,你将在 JOS 中添加对多处理器的支持,以实现循环调度。并且添加基本的环境管理方面的系统调用(创建和销毁环境的系统调用、以及分配/映射内存)。 @@ -12,7 +11,7 @@ 最后,在 Part C 中,你将在 JOS 中添加对进程间通讯(IPC)的支持,以允许不同用户模式环境之间进行显式通讯和同步。你也将要去添加对硬件时钟中断和优先权的支持。 -##### 预备知识 +#### 预备知识 使用 git 去提交你的实验 3 的源代码,并获取课程仓库的最新版本,然后创建一个名为 `lab4` 的本地分支,它跟踪我们的名为 `origin/lab4` 的远程 `lab4` 分支: @@ -31,6 +30,7 @@ ``` 实验 4 包含了一些新的源文件,在开始之前你应该去浏览一遍: + ```markdown kern/cpu.h Kernel-private definitions for multiprocessor support kern/mpconfig.c Code to read the multiprocessor configuration @@ -41,19 +41,19 @@ kern/spinlock.c Kernel code implementing spin locks kern/sched.c Code skeleton of the scheduler that you are about to implement ``` -##### 实验要求 +#### 实验要求 -本实验分为三部分:Part A、Part B、和 Part C。我们计划为每个部分分配一周的时间。 +本实验分为三部分:Part A、Part B 和 Part C。我们计划为每个部分分配一周的时间。 和以前一样,你需要完成实验中出现的、所有常规练习和至少一个挑战问题。(不是每个部分做一个挑战问题,是整个实验做一个挑战问题即可。)另外,你还要写出你实现的挑战问题的详细描述。如果你实现了多个挑战问题,你只需写出其中一个即可,虽然我们的课程欢迎你完成越多的挑战越好。在动手实验之前,请将你的挑战问题的答案写在一个名为 `answers-lab4.txt` 的文件中,并把它放在你的 `lab` 目录的根下。 -#### Part A:多处理器支持和协调多任务处理 +### Part A:多处理器支持和协调多任务处理 在本实验的第一部分,将去扩展你的 JOS 内核,以便于它能够在一个多处理器的系统上运行,并且要在 JOS 内核中实现一些新的系统调用,以便于它允许用户级环境创建附加的新环境。你也要去实现协调的循环调度,在当前的环境自愿放弃 CPU(或退出)时,允许内核将一个环境切换到另一个环境。稍后在 Part C 中,你将要实现抢占调度,它允许内核在环境占有 CPU 一段时间后,从这个环境上重新取回对 CPU 的控制,那怕是在那个环境不配合的情况下。 -##### 多处理器支持 +#### 多处理器支持 -我们继续去让 JOS 支持 “对称多处理器”(SMP),在一个多处理器的模型中,所有 CPU 们都有平等访问系统资源(如内存和 I/O 总线)的权利。虽然在 SMP 中所有 CPU 们都有相同的功能,但是在引导进程的过程中,它们被分成两种类型:引导程序处理器(BSP)负责初始化系统和引导操作系统;而在操作系统启动并正常运行后,应用程序处理器(AP)将被 BSP 激活。哪个处理器做 BSP 是由硬件和 BIOS 来决定的。到目前为止,你所有的已存在的 JOS 代码都是运行在 BSP 上的。 +我们继续去让 JOS 支持 “对称多处理器”(SMP),在一个多处理器的模型中,所有 CPU 们都有平等访问系统资源(如内存和 I/O 总线)的权力。虽然在 SMP 中所有 CPU 们都有相同的功能,但是在引导进程的过程中,它们被分成两种类型:引导程序处理器(BSP)负责初始化系统和引导操作系统;而在操作系统启动并正常运行后,应用程序处理器(AP)将被 BSP 激活。哪个处理器做 BSP 是由硬件和 BIOS 来决定的。到目前为止,你所有的已存在的 JOS 代码都是运行在 BSP 上的。 在一个 SMP 系统上,每个 CPU 都伴有一个本地 APIC(LAPIC)单元。这个 LAPIC 单元负责传递系统中的中断。LAPIC 还为它所连接的 CPU 提供一个唯一的标识符。在本实验中,我们将使用 LAPIC 单元(它在 `kern/lapic.c` 中)中的下列基本功能: @@ -61,15 +61,11 @@ kern/sched.c Code skeleton of the scheduler that you are about to implement * 从 BSP 到 AP 之间发送处理器间中断(IPI) `STARTUP`,以启动其它 CPU(查看 `lapic_startap()`)。 * 在 Part C 中,我们设置 LAPIC 的内置定时器去触发时钟中断,以便于支持抢占式多任务处理(查看 `apic_init()`)。 +一个处理器使用内存映射的 I/O(MMIO)来访问它的 LAPIC。在 MMIO 中,一部分物理内存是硬编码到一些 I/O 设备的寄存器中,因此,访问内存时一般可以使用相同的 `load/store` 指令去访问设备的寄存器。正如你所看到的,在物理地址 `0xA0000` 处就是一个 IO 入口(就是我们写入 VGA 缓冲区的入口)。LAPIC 就在那里,它从物理地址 `0xFE000000` 处(4GB 减去 32MB 处)开始,这个地址对于我们在 KERNBASE 处使用直接映射访问来说太高了。JOS 虚拟内存映射在 `MMIOBASE` 处,留下一个 4MB 的空隙,以便于我们有一个地方,能像这样去映射设备。由于在后面的实验中,我们将介绍更多的 MMIO 区域,你将要写一个简单的函数,从这个区域中去分配空间,并将设备的内存映射到那里。 +> **练习 1**、实现 `kern/pmap.c` 中的 `mmio_map_region`。去看一下它是如何使用的,从 `kern/lapic.c` 中的 `lapic_init` 开始看起。在 `mmio_map_region` 的测试运行之前,你还要做下一个练习。 -一个处理器使用内存映射的 I/O(MMIO)来访问它的 LAPIC。在 MMIO 中,一部分物理内存是硬编码到一些 I/O 设备的寄存器中,因此,访问内存时一般可以使用相同的 `load/store` 指令去访问设备的寄存器。正如你所看到的,在物理地址 `0xA0000` 处就是一个 IO 入口(就是我们写入 VGA 缓冲区的入口)。LAPIC 就在那里,它从物理地址 `0xFE000000` 处(4GB 减去 32MB 处)开始,这个地址对于我们在 KERNBASE 处使用直接映射访问来说太高了。JOS 虚拟内存映射在 `MMIOBASE` 处,留下一个 4MB 的空隙,以便于我们有一个地方,能像这样去映射设备。由于在后面的实验中,我们将介绍更多的 MMIO 区域,你将要写一个简单的函数,从这个区域中去分配空间,并将设备的内存映射到那里。 - -```markdown -练习 1、实现 `kern/pmap.c` 中的 `mmio_map_region`。去看一下它是如何使用的,从 `kern/lapic.c` 中的 `lapic_init` 开始看起。在 `mmio_map_region` 的测试运行之前,你还要做下一个练习。 -``` - -###### 引导应用程序处理器 +##### 引导应用程序处理器 在引导应用程序处理器之前,引导程序处理器应该会首先去收集关于多处理器系统的信息,比如总的 CPU 数、它们的 APIC ID 以及 LAPIC 单元的 MMIO 地址。在 `kern/mpconfig.c` 中的 `mp_init()` 函数,通过读取内存中位于 BIOS 区域里的 MP 配置表来获得这些信息。 @@ -77,46 +73,42 @@ kern/sched.c Code skeleton of the scheduler that you are about to implement 在那之后,通过发送 IPI `STARTUP` 到相关 AP 的 LAPIC 单元,以及一个初始的 `CS:IP` 地址(AP 将从那儿开始运行它的入口代码,在我们的案例中是 `MPENTRY_PADDR` ),`boot_aps()` 将一个接一个地激活 AP。在 `kern/mpentry.S` 中的入口代码非常类似于 `boot/boot.S`。在一些简短的设置之后,它启用分页,使 AP 进入保护模式,然后调用 C 设置程序 `mp_main()`(它也在 `kern/init.c` 中)。在继续唤醒下一个 AP 之前, `boot_aps()` 将等待这个 AP 去传递一个 `CPU_STARTED` 标志到它的 `struct CpuInfo` 中的 `cpu_status` 字段中。 -```markdown -练习 2、阅读 `kern/init.c` 中的 `boot_aps()` 和 `mp_main()`,以及在 `kern/mpentry.S` 中的汇编代码。确保你理解了在 AP 引导过程中的控制流转移。然后修改在 `kern/pmap.c` 中的、你自己的 `page_init()`,实现避免在 `MPENTRY_PADDR` 处添加页到空闲列表上,以便于我们能够在物理地址上安全地复制和运行 AP 引导程序代码。你的代码应该会通过更新后的 `check_page_free_list()` 的测试(但可能会在更新后的 `check_kern_pgdir()` 上测试失败,我们在后面会修复它)。 -``` +> **练习 2**、阅读 `kern/init.c` 中的 `boot_aps()` 和 `mp_main()`,以及在 `kern/mpentry.S` 中的汇编代码。确保你理解了在 AP 引导过程中的控制流转移。然后修改在 `kern/pmap.c` 中的、你自己的 `page_init()`,实现避免在 `MPENTRY_PADDR` 处添加页到空闲列表上,以便于我们能够在物理地址上安全地复制和运行 AP 引导程序代码。你的代码应该会通过更新后的 `check_page_free_list()` 的测试(但可能会在更新后的 `check_kern_pgdir()` 上测试失败,我们在后面会修复它)。 -```markdown -问题 - 1、比较 `kern/mpentry.S` 和 `boot/boot.S`。记住,那个 `kern/mpentry.S` 是编译和链接后的,运行在 `KERNBASE` 上面的,就像内核中的其它程序一样,宏 `MPBOOTPHYS` 的作用是什么?为什么它需要在 `kern/mpentry.S` 中,而不是在 `boot/boot.S` 中?换句话说,如果在 `kern/mpentry.S` 中删掉它,会发生什么错误? +. + +> **问题 1**、比较 `kern/mpentry.S` 和 `boot/boot.S`。记住,那个 `kern/mpentry.S` 是编译和链接后的,运行在 `KERNBASE` 上面的,就像内核中的其它程序一样,宏 `MPBOOTPHYS` 的作用是什么?为什么它需要在 `kern/mpentry.S` 中,而不是在 `boot/boot.S` 中?换句话说,如果在 `kern/mpentry.S` 中删掉它,会发生什么错误? 提示:回顾链接地址和加载地址的区别,我们在实验 1 中讨论过它们。 -``` - -###### 每个 CPU 的状态和初始化 +##### 每个 CPU 的状态和初始化 当写一个多处理器操作系统时,区分每个 CPU 的状态是非常重要的,而每个 CPU 的状态对其它处理器是不公开的,而全局状态是整个系统共享的。`kern/cpu.h` 定义了大部分每个 CPU 的状态,包括 `struct CpuInfo`,它保存了每个 CPU 的变量。`cpunum()` 总是返回调用它的那个 CPU 的 ID,它可以被用作是数组的索引,比如 `cpus`。或者,宏 `thiscpu` 是当前 CPU 的 `struct CpuInfo` 缩略表示。 下面是你应该知道的每个 CPU 的状态: - * **每个 CPU 的内核栈** -因为内核能够同时捕获多个 CPU,因此,我们需要为每个 CPU 准备一个单独的内核栈,以防止它们运行的程序之间产生相互干扰。数组 `percpu_kstacks[NCPU][KSTKSIZE]` 为 NCPU 的内核栈资产保留了空间。 +* **每个 CPU 的内核栈** -在实验 2 中,你映射的 `bootstack` 所引用的物理内存,就作为 `KSTACKTOP` 以下的 BSP 的内核栈。同样,在本实验中,你将每个 CPU 的内核栈映射到这个区域,而使用保护页做为它们之间的缓冲区。CPU 0 的栈将从 `KSTACKTOP` 处向下增长;CPU 1 的栈将从 CPU 0 的栈底部的 `KSTKGAP` 字节处开始,依次类推。在 `inc/memlayout.h` 中展示了这个映射布局。 + 因为内核能够同时捕获多个 CPU,因此,我们需要为每个 CPU 准备一个单独的内核栈,以防止它们运行的程序之间产生相互干扰。数组 `percpu_kstacks[NCPU][KSTKSIZE]` 为 NCPU 的内核栈资产保留了空间。 - * **每个 CPU 的 TSS 和 TSS 描述符** -为了指定每个 CPU 的内核栈在哪里,也需要有一个每个 CPU 的任务状态描述符(TSS)。CPU _i_ 的任务状态描述符是保存在 `cpus[i].cpu_ts` 中,而对应的 TSS 描述符是定义在 GDT 条目 `gdt[(GD_TSS0 >> 3) + i]` 中。在 `kern/trap.c` 中定义的全局变量 `ts` 将不再被使用。 + 在实验 2 中,你映射的 `bootstack` 所引用的物理内存,就作为 `KSTACKTOP` 以下的 BSP 的内核栈。同样,在本实验中,你将每个 CPU 的内核栈映射到这个区域,而使用保护页做为它们之间的缓冲区。CPU 0 的栈将从 `KSTACKTOP` 处向下增长;CPU 1 的栈将从 CPU 0 的栈底部的 `KSTKGAP` 字节处开始,依次类推。在 `inc/memlayout.h` 中展示了这个映射布局。 - * **每个 CPU 当前的环境指针** -由于每个 CPU 都能同时运行不同的用户进程,所以我们重新定义了符号 `curenv`,让它指向到 `cpus[cpunum()].cpu_env`(或 `thiscpu->cpu_env`),它指向到当前 CPU(代码正在运行的那个 CPU)上当前正在运行的环境上。 +* **每个 CPU 的 TSS 和 TSS 描述符** - * **每个 CPU 的系统寄存器** -所有的寄存器,包括系统寄存器,都是一个 CPU 私有的。所以,初始化这些寄存器的指令,比如 `lcr3()`、`ltr()`、`lgdt()`、`lidt()`、等待,必须在每个 CPU 上运行一次。函数 `env_init_percpu()` 和 `trap_init_percpu()` 就是为此目的而定义的。 + 为了指定每个 CPU 的内核栈在哪里,也需要有一个每个 CPU 的任务状态描述符(TSS)。CPU _i_ 的任务状态描述符是保存在 `cpus[i].cpu_ts` 中,而对应的 TSS 描述符是定义在 GDT 条目 `gdt[(GD_TSS0 >> 3) + i]` 中。在 `kern/trap.c` 中定义的全局变量 `ts` 将不再被使用。 +* **每个 CPU 当前的环境指针** + 由于每个 CPU 都能同时运行不同的用户进程,所以我们重新定义了符号 `curenv`,让它指向到 `cpus[cpunum()].cpu_env`(或 `thiscpu->cpu_env`),它指向到当前 CPU(代码正在运行的那个 CPU)上当前正在运行的环境上。 -```markdown -练习 3、修改 `mem_init_mp()`(在 `kern/pmap.c` 中)去映射每个 CPU 的栈从 `KSTACKTOP` 处开始,就像在 `inc/memlayout.h` 中展示的那样。每个栈的大小是 `KSTKSIZE` 字节加上未映射的保护页 `KSTKGAP` 的字节。你的代码应该会通过在 `check_kern_pgdir()` 中的新的检查。 -``` +* **每个 CPU 的系统寄存器** -```markdown -练习 4、在 `trap_init_percpu()`(在 `kern/trap.c` 文件中)的代码为 BSP 初始化 TSS 和 TSS 描述符。在实验 3 中它就运行过,但是当它运行在其它的 CPU 上就会出错。修改这些代码以便它能在所有 CPU 上都正常运行。(注意:你的新代码应该还不能使用全局变量 `ts`) -``` + 所有的寄存器,包括系统寄存器,都是一个 CPU 私有的。所以,初始化这些寄存器的指令,比如 `lcr3()`、`ltr()`、`lgdt()`、`lidt()`、等待,必须在每个 CPU 上运行一次。函数 `env_init_percpu()` 和 `trap_init_percpu()` 就是为此目的而定义的。 + +> **练习 3**、修改 `mem_init_mp()`(在 `kern/pmap.c` 中)去映射每个 CPU 的栈从 `KSTACKTOP` 处开始,就像在 `inc/memlayout.h` 中展示的那样。每个栈的大小是 `KSTKSIZE` 字节加上未映射的保护页 `KSTKGAP` 的字节。你的代码应该会通过在 `check_kern_pgdir()` 中的新的检查。 + +. + +> **练习 4**、在 `trap_init_percpu()`(在 `kern/trap.c` 文件中)的代码为 BSP 初始化 TSS 和 TSS 描述符。在实验 3 中它就运行过,但是当它运行在其它的 CPU 上就会出错。修改这些代码以便它能在所有 CPU 上都正常运行。(注意:你的新代码应该还不能使用全局变量 `ts`) 在你完成上述练习后,在 QEMU 中使用 4 个 CPU(使用 `make qemu CPUS=4` 或 `make qemu-nox CPUS=4`)来运行 JOS,你应该看到类似下面的输出: @@ -134,94 +126,87 @@ kern/sched.c Code skeleton of the scheduler that you are about to implement SMP: CPU 3 starting ``` -###### 锁定 +##### 锁定 在 `mp_main()` 中初始化 AP 后我们的代码快速运行起来。在你更进一步增强 AP 之前,我们需要首先去处理多个 CPU 同时运行内核代码的争用状况。达到这一目标的最简单的方法是使用大内核锁。大内核锁是一个单个的全局锁,当一个环境进入内核模式时,它将被加锁,而这个环境返回到用户模式时它将释放锁。在这种模型中,在用户模式中运行的环境可以同时运行在任何可用的 CPU 上,但是只有一个环境能够运行在内核模式中;而任何尝试进入内核模式的其它环境都被强制等待。 `kern/spinlock.h` 中声明大内核锁,即 `kernel_lock`。它也提供 `lock_kernel()` 和 `unlock_kernel()`,快捷地去获取/释放锁。你应该在以下的四个位置应用大内核锁: - * 在 `i386_init()` 时,在 BSP 唤醒其它 CPU 之前获取锁。 - * 在 `mp_main()` 时,在初始化 AP 之后获取锁,然后调用 `sched_yield()` 在这个 AP 上开始运行环境。 - * 在 `trap()` 时,当从用户模式中捕获一个陷阱trap时获取锁。在检查 `tf_cs` 的低位比特,以确定一个陷阱是发生在用户模式还是内核模式时。 - * 在 `env_run()` 中,在切换到用户模式之前释放锁。不能太早也不能太晚,否则你将可能会产生争用或死锁。 +* 在 `i386_init()` 时,在 BSP 唤醒其它 CPU 之前获取锁。 +* 在 `mp_main()` 时,在初始化 AP 之后获取锁,然后调用 `sched_yield()` 在这个 AP 上开始运行环境。 +* 在 `trap()` 时,当从用户模式中捕获一个陷阱trap时获取锁。在检查 `tf_cs` 的低位比特,以确定一个陷阱是发生在用户模式还是内核模式时。 +* 在 `env_run()` 中,在切换到用户模式之前释放锁。不能太早也不能太晚,否则你将可能会产生争用或死锁。 +> **练习 5**、在上面所描述的情况中,通过在合适的位置调用 `lock_kernel()` 和 `unlock_kernel()` 应用大内核锁。 -```markdown -练习 5、在上面所描述的情况中,通过在合适的位置调用 `lock_kernel()` 和 `unlock_kernel()` 应用大内核锁。 -``` +> 如果你的锁定是正确的,如何去测试它?实际上,到目前为止,还无法测试!但是在下一个练习中,你实现了调度之后,就可以测试了。 -如果你的锁定是正确的,如何去测试它?实际上,到目前为止,还无法测试!但是在下一个练习中,你实现了调度之后,就可以测试了。 +. -``` -问题 - 2、看上去使用一个大内核锁,可以保证在一个时间中只有一个 CPU 能够运行内核代码。为什么每个 CPU 仍然需要单独的内核栈?描述一下使用一个共享内核栈出现错误的场景,即便是在它使用了大内核锁保护的情况下。 -``` +> **问题 2**、看上去使用一个大内核锁,可以保证在一个时间中只有一个 CPU 能够运行内核代码。为什么每个 CPU 仍然需要单独的内核栈?描述一下使用一个共享内核栈出现错误的场景,即便是在它使用了大内核锁保护的情况下。 -``` -小挑战!大内核锁很简单,也易于使用。尽管如此,它消除了内核模式的所有并发。大多数现代操作系统使用不同的锁,一种称之为细粒度锁定的方法,去保护它们的共享的栈的不同部分。细粒度锁能够大幅提升性能,但是实现起来更困难并且易出错。如果你有足够的勇气,在 JOS 中删除大内核锁,去拥抱并发吧! +> **小挑战!**大内核锁很简单,也易于使用。尽管如此,它消除了内核模式的所有并发。大多数现代操作系统使用不同的锁,一种称之为细粒度锁定的方法,去保护它们的共享的栈的不同部分。细粒度锁能够大幅提升性能,但是实现起来更困难并且易出错。如果你有足够的勇气,在 JOS 中删除大内核锁,去拥抱并发吧! -由你来决定锁的粒度(一个锁保护的数据量)。给你一个提示,你可以考虑在 JOS 内核中使用一个自旋锁去确保你独占访问这些共享的组件: +> 由你来决定锁的粒度(一个锁保护的数据量)。给你一个提示,你可以考虑在 JOS 内核中使用一个自旋锁去确保你独占访问这些共享的组件: - * 页分配器 - * 控制台驱动 - * 调度器 - * 你将在 Part C 中实现的进程间通讯(IPC)的状态 -``` +> * 页分配器 +* 控制台驱动 +* 调度器 +* 你将在 Part C 中实现的进程间通讯(IPC)的状态 - -##### 循环调度 +#### 循环调度 本实验中,你的下一个任务是去修改 JOS 内核,以使它能够在多个环境之间以“循环”的方式去交替。JOS 中的循环调度工作方式如下: - * 在新的 `kern/sched.c` 中的 `sched_yield()` 函数负责去选择一个新环境来运行。它按顺序以循环的方式在数组 `envs[]` 中进行搜索,在前一个运行的环境之后开始(或如果之前没有运行的环境,就从数组起点开始),选择状态为 `ENV_RUNNABLE` 的第一个环境(查看 `inc/env.h`),并调用 `env_run()` 去跳转到那个环境。 - * `sched_yield()` 必须做到,同一个时间在两个 CPU 上绝对不能运行相同的环境。它可以判断出一个环境正运行在一些 CPU(可能是当前 CPU)上,因为,那个正在运行的环境的状态将是 `ENV_RUNNING`。 - * 我们已经为你实现了一个新的系统调用 `sys_yield()`,用户环境调用它去调用内核的 `sched_yield()` 函数,并因此将自愿把对 CPU 的控制禅让给另外的一个环境。 +* 在新的 `kern/sched.c` 中的 `sched_yield()` 函数负责去选择一个新环境来运行。它按顺序以循环的方式在数组 `envs[]` 中进行搜索,在前一个运行的环境之后开始(或如果之前没有运行的环境,就从数组起点开始),选择状态为 `ENV_RUNNABLE` 的第一个环境(查看 `inc/env.h`),并调用 `env_run()` 去跳转到那个环境。 +* `sched_yield()` 必须做到,同一个时间在两个 CPU 上绝对不能运行相同的环境。它可以判断出一个环境正运行在一些 CPU(可能是当前 CPU)上,因为,那个正在运行的环境的状态将是 `ENV_RUNNING`。 +* 我们已经为你实现了一个新的系统调用 `sys_yield()`,用户环境调用它去调用内核的 `sched_yield()` 函数,并因此将自愿把对 CPU 的控制禅让给另外的一个环境。 +> **练习 6**、像上面描述的那样,在 `sched_yield()` 中实现循环调度。不要忘了去修改 `syscall()` 以派发 `sys_yield()`。 -```c -练习 6、像上面描述的那样,在 `sched_yield()` 中实现循环调度。不要忘了去修改 `syscall()` 以派发 `sys_yield()`。 +> 确保在 `mp_main` 中调用了 `sched_yield()`。 -确保在 `mp_main` 中调用了 `sched_yield()`。 +> 修改 `kern/init.c` 去创建三个(或更多个!)运行程序 `user/yield.c`的环境。 -修改 `kern/init.c` 去创建三个(或更多个!)运行程序 `user/yield.c`的环境。 +> 运行 `make qemu`。在它终止之前,你应该会看到像下面这样,在环境之间来回切换了五次。 -运行 `make qemu`。在它终止之前,你应该会看到像下面这样,在环境之间来回切换了五次。 +> 也可以使用几个 CPU 来测试:`make qemu CPUS=2`。 -也可以使用几个 CPU 来测试:make qemu CPUS=2。 - - ... - Hello, I am environment 00001000. - Hello, I am environment 00001001. - Hello, I am environment 00001002. - Back in environment 00001000, iteration 0. - Back in environment 00001001, iteration 0. - Back in environment 00001002, iteration 0. - Back in environment 00001000, iteration 1. - Back in environment 00001001, iteration 1. - Back in environment 00001002, iteration 1. - ... - -在程序 `yield` 退出之后,系统中将没有可运行的环境,调度器应该会调用 JOS 内核监视器。如果它什么也没有发生,那么你应该在继续之前修复你的代码。 +>``` +... +Hello, I am environment 00001000. +Hello, I am environment 00001001. +Hello, I am environment 00001002. +Back in environment 00001000, iteration 0. +Back in environment 00001001, iteration 0. +Back in environment 00001002, iteration 0. +Back in environment 00001000, iteration 1. +Back in environment 00001001, iteration 1. +Back in environment 00001002, iteration 1. +... ``` -```c -问题 - 3、在你实现的 `env_run()` 中,你应该会调用 `lcr3()`。在调用 `lcr3()` 的之前和之后,你的代码引用(至少它应该会)变量 `e`,它是 `env_run` 的参数。在加载 `%cr3` 寄存器时,MMU 使用的地址上下文将马上被改变。但一个虚拟地址(即 `e`)相对一个给定的地址上下文是有意义的 —— 地址上下文指定了物理地址到那个虚拟地址的映射。为什么指针 `e` 在地址切换之前和之后被解除引用? - 4、无论何时,内核从一个环境切换到另一个环境,它必须要确保旧环境的寄存器内容已经被保存,以便于它们稍后能够正确地还原。为什么?这种事件发生在什么地方? -``` +> 在程序 `yield` 退出之后,系统中将没有可运行的环境,调度器应该会调用 JOS 内核监视器。如果它什么也没有发生,那么你应该在继续之前修复你的代码。 -```c -小挑战!给内核添加一个小小的调度策略,比如一个固定优先级的调度器,它将会给每个环境分配一个优先级,并且在执行中,较高优先级的环境总是比低优先级的环境优先被选定。如果你想去冒险一下,尝试实现一个类 Unix 的、优先级可调整的调度器,或者甚至是一个彩票调度器或跨步调度器。(可以在 Google 中查找“彩票调度”和“跨步调度”的相关资料) -写一个或两个测试程序,去测试你的调度算法是否工作正常(即,正确的算法能够按正确的次序运行)。如果你实现了本实验的 Part B 和 Part C 部分的 `fork()` 和 IPC,写这些测试程序可能会更容易。 -``` +> **问题 3**、在你实现的 `env_run()` 中,你应该会调用 `lcr3()`。在调用 `lcr3()` 的之前和之后,你的代码引用(至少它应该会)变量 `e`,它是 `env_run` 的参数。在加载 `%cr3` 寄存器时,MMU 使用的地址上下文将马上被改变。但一个虚拟地址(即 `e`)相对一个给定的地址上下文是有意义的 —— 地址上下文指定了物理地址到那个虚拟地址的映射。为什么指针 `e` 在地址切换之前和之后被解除引用? -```markdown -小挑战!目前的 JOS 内核还不能应用到使用了 x87 协处理器、MMX 指令集、或流式 SIMD 扩展(SSE)的 x86 处理器上。扩展数据结构 `Env` 去提供一个能够保存处理器的浮点状态的地方,并且扩展上下文切换代码,当从一个环境切换到另一个环境时,能够保存和还原正确的状态。`FXSAVE` 和 `FXRSTOR` 指令或许对你有帮助,但是需要注意的是,这些指令在旧的 x86 用户手册上没有,因为它是在较新的处理器上引入的。写一个用户级的测试程序,让它使用浮点做一些很酷的事情。 -``` +. -##### 创建环境的系统调用 +> **问题 4**、无论何时,内核从一个环境切换到另一个环境,它必须要确保旧环境的寄存器内容已经被保存,以便于它们稍后能够正确地还原。为什么?这种事件发生在什么地方? + +. + +> 小挑战!给内核添加一个小小的调度策略,比如一个固定优先级的调度器,它将会给每个环境分配一个优先级,并且在执行中,较高优先级的环境总是比低优先级的环境优先被选定。如果你想去冒险一下,尝试实现一个类 Unix 的、优先级可调整的调度器,或者甚至是一个彩票调度器或跨步调度器。(可以在 Google 中查找“彩票调度”和“跨步调度”的相关资料) + +> 写一个或两个测试程序,去测试你的调度算法是否工作正常(即,正确的算法能够按正确的次序运行)。如果你实现了本实验的 Part B 和 Part C 部分的 `fork()` 和 IPC,写这些测试程序可能会更容易。 + +. + +> 小挑战!目前的 JOS 内核还不能应用到使用了 x87 协处理器、MMX 指令集、或流式 SIMD 扩展(SSE)的 x86 处理器上。扩展数据结构 `Env` 去提供一个能够保存处理器的浮点状态的地方,并且扩展上下文切换代码,当从一个环境切换到另一个环境时,能够保存和还原正确的状态。`FXSAVE` 和 `FXRSTOR` 指令或许对你有帮助,但是需要注意的是,这些指令在旧的 x86 用户手册上没有,因为它是在较新的处理器上引入的。写一个用户级的测试程序,让它使用浮点做一些很酷的事情。 + +#### 创建环境的系统调用 虽然你的内核现在已经有了在多个用户级环境之间切换的功能,但是由于内核初始化设置的原因,它在运行环境时仍然是受限的。现在,你需要去实现必需的 JOS 系统调用,以允许用户环境去创建和启动其它的新用户环境。 @@ -229,34 +214,35 @@ Unix 提供了 `fork()` 系统调用作为它的进程创建原语。Unix 的 `f 为创建一个用户模式下的新的环境,你将要提供一个不同的、更原始的 JOS 系统调用集。使用这些系统调用,除了其它类型的环境创建之外,你可以在用户空间中实现一个完整的类 Unix 的 `fork()`。你将要为 JOS 编写的新的系统调用如下: - * `sys_exofork`: -这个系统调用创建一个新的空白的环境:在它的地址空间的用户部分什么都没有映射,并且它也不能运行。这个新的环境与 `sys_exofork` 调用时创建它的父环境的寄存器状态完全相同。在父进程中,`sys_exofork` 将返回新创建进程的 `envid_t`(如果环境分配失败的话,返回的是一个负的错误代码)。在子进程中,它将返回 0。(因为子进程从一开始就被标记为不可运行,在子进程中,`sys_exofork` 将并不真的返回,直到它的父进程使用 .... 显式地将子进程标记为可运行之前。) - * `sys_env_set_status`: -设置指定的环境状态为 `ENV_RUNNABLE` 或 `ENV_NOT_RUNNABLE`。这个系统调用一般是在,一个新环境的地址空间和寄存器状态已经完全初始化完成之后,用于去标记一个准备去运行的新环境。 - * `sys_page_alloc`: -分配一个物理内存页,并映射它到一个给定的环境地址空间中、给定的一个虚拟地址上。 - * `sys_page_map`: -从一个环境的地址空间中复制一个页映射(不是页内容!)到另一个环境的地址空间中,保持一个内存共享,以便于新的和旧的映射共同指向到同一个物理内存页。 - * `sys_page_unmap`: -在一个给定的环境中,取消映射一个给定的已映射的虚拟地址。 +* `sys_exofork`: + 这个系统调用创建一个新的空白的环境:在它的地址空间的用户部分什么都没有映射,并且它也不能运行。这个新的环境与 `sys_exofork` 调用时创建它的父环境的寄存器状态完全相同。在父进程中,`sys_exofork` 将返回新创建进程的 `envid_t`(如果环境分配失败的话,返回的是一个负的错误代码)。在子进程中,它将返回 0。(因为子进程从一开始就被标记为不可运行,在子进程中,`sys_exofork` 将并不真的返回,直到它的父进程使用 .... 显式地将子进程标记为可运行之前。) +* `sys_env_set_status`: + 设置指定的环境状态为 `ENV_RUNNABLE` 或 `ENV_NOT_RUNNABLE`。这个系统调用一般是在,一个新环境的地址空间和寄存器状态已经完全初始化完成之后,用于去标记一个准备去运行的新环境。 +* `sys_page_alloc`: + + 分配一个物理内存页,并映射它到一个给定的环境地址空间中、给定的一个虚拟地址上。 +* `sys_page_map`: + + 从一个环境的地址空间中复制一个页映射(不是页内容!)到另一个环境的地址空间中,保持一个内存共享,以便于新的和旧的映射共同指向到同一个物理内存页。 +* `sys_page_unmap`: + + 在一个给定的环境中,取消映射一个给定的已映射的虚拟地址。 上面所有的系统调用都接受环境 ID 作为参数,JOS 内核支持一个约定,那就是用值 “0” 来表示“当前环境”。这个约定在 `kern/env.c` 中的 `envid2env()` 中实现的。 在我们的 `user/dumbfork.c` 中的测试程序里,提供了一个类 Unix 的 `fork()` 的非常原始的实现。这个测试程序使用了上面的系统调用,去创建和运行一个复制了它自己地址空间的子环境。然后,这两个环境像前面的练习那样使用 `sys_yield` 来回切换,父进程在迭代 10 次后退出,而子进程在迭代 20 次后退出。 -```c -练习 7、在 `kern/syscall.c` 中实现上面描述的系统调用,并确保 `syscall()` 能调用它们。你将需要使用 `kern/pmap.c` 和 `kern/env.c` 中的多个函数,尤其是要用到 `envid2env()`。目前,每当你调用 `envid2env()` 时,在 `checkperm` 中传递参数 1。你务必要做检查任何无效的系统调用参数,在那个案例中,就返回了 `-E_INVAL`。使用 `user/dumbfork` 测试你的 JOS 内核,并在继续之前确保它运行正常。 -``` +> **练习 7**、在 `kern/syscall.c` 中实现上面描述的系统调用,并确保 `syscall()` 能调用它们。你将需要使用 `kern/pmap.c` 和 `kern/env.c` 中的多个函数,尤其是要用到 `envid2env()`。目前,每当你调用 `envid2env()` 时,在 `checkperm` 中传递参数 1。你务必要做检查任何无效的系统调用参数,在那个案例中,就返回了 `-E_INVAL`。使用 `user/dumbfork` 测试你的 JOS 内核,并在继续之前确保它运行正常。 -```c -小挑战!添加另外的系统调用,必须能够读取已存在的、所有的、环境的重要状态,以及设置它们。然后实现一个能够 fork 出子环境的用户模式程序,运行它一小会(即,迭代几次 `sys_yield()`),然后取得几张屏幕截图或子环境的检查点,然后运行子环境一段时间,然后还原子环境到检查点时的状态,然后从这里继续开始。这样,你就可以有效地从一个中间状态“回放”了子环境的运行。确保子环境与用户使用 `sys_cgetc()` 或 `readline()` 执行了一些交互,这样,那个用户就能够查看和突变它的内部状态,并且你可以通过给子环境给定一个选择性遗忘的状况,来验证你的检查点/重启动的有效性,使它“遗忘”了在某些点之前发生的事情。 -``` +. + +> **小挑战!**添加另外的系统调用,必须能够读取已存在的、所有的、环境的重要状态,以及设置它们。然后实现一个能够 fork 出子环境的用户模式程序,运行它一小会(即,迭代几次 `sys_yield()`),然后取得几张屏幕截图或子环境的检查点,然后运行子环境一段时间,然后还原子环境到检查点时的状态,然后从这里继续开始。这样,你就可以有效地从一个中间状态“回放”了子环境的运行。确保子环境与用户使用 `sys_cgetc()` 或 `readline()` 执行了一些交互,这样,那个用户就能够查看和突变它的内部状态,并且你可以通过给子环境给定一个选择性遗忘的状况,来验证你的检查点/重启动的有效性,使它“遗忘”了在某些点之前发生的事情。 到此为止,已经完成了本实验的 Part A 部分;在你运行 `make grade` 之前确保它通过了所有的 Part A 的测试,并且和以往一样,使用 `make handin` 去提交它。如果你想尝试找出为什么一些特定的测试是失败的,可以运行 `run ./grade-lab4 -v`,它将向你展示内核构建的输出,和测试失败时的 QEMU 运行情况。当测试失败时,这个脚本将停止运行,然后你可以去检查 `jos.out` 的内容,去查看内核真实的输出内容。 -#### Part B:写时复制 Fork +### Part B:写时复制 Fork 正如在前面提到过的,Unix 提供 `fork()` 系统调用作为它主要的进程创建原语。`fork()` 系统调用通过复制调用进程(父进程)的地址空间来创建一个新进程(子进程)。 @@ -264,11 +250,11 @@ xv6 Unix 的 `fork()` 从父进程的页上复制所有数据,然后将它分 但是,一个对 `fork()` 的调用后,经常是紧接着几乎立即在子进程中有一个到 `exec()` 的调用,它使用一个新程序来替换子进程的内存。这是 shell 默认去做的事,在这种情况下,在复制父进程地址空间上花费的时间是非常浪费的,因为在调用 `exec()` 之前,子进程使用的内存非常少。 -基于这个原因,Unix 的最新版本利用了虚拟内存硬件的优势,允许父进程和子进程去共享映射到它们各自地址空间上的内存,直到其中一个进程真实地修改了它们为止。这个技术就是众所周知的“写时复制”。为实现这一点,在 `fork()` 时,内核将复制从父进程到子进程的地址空间的映射,而不是所映射的页的内容,并且同时设置正在共享中的页为只读。当两个进程中的其中一个尝试去写入到它们共享的页上时,进程将产生一个页故障。在这时,Unix 内核才意识到那个页实际上是“虚拟的”或“写时复制”的副本,然后它生成一个新的、私有的、那个发生页故障的进程可写的、页的副本。在这种方式中,个人的页的内容并不进行真实地复制,直到它们真正进行写入时才进行复制。这种优化使得一个`fork()` 后在子进程中跟随一个 `exec()` 变得代价很低了:子进程在调用 `exec()` 时或许仅需要复制一个页(它的栈的当前页)。 +基于这个原因,Unix 的最新版本利用了虚拟内存硬件的优势,允许父进程和子进程去共享映射到它们各自地址空间上的内存,直到其中一个进程真实地修改了它们为止。这个技术就是众所周知的“写时复制”。为实现这一点,在 `fork()` 时,内核将复制从父进程到子进程的地址空间的映射,而不是所映射的页的内容,并且同时设置正在共享中的页为只读。当两个进程中的其中一个尝试去写入到它们共享的页上时,进程将产生一个页故障。在这时,Unix 内核才意识到那个页实际上是“虚拟的”或“写时复制”的副本,然后它生成一个新的、私有的、那个发生页故障的进程可写的、页的副本。在这种方式中,个人的页的内容并不进行真实地复制,直到它们真正进行写入时才进行复制。这种优化使得一个`fork()` 后在子进程中跟随一个 `exec()` 变得代价很低了:子进程在调用 `exec()` 时或许仅需要复制一个页(它的栈的当前页)。 在本实验的下一段中,你将实现一个带有“写时复制”的“真正的”类 Unix 的 `fork()`,来作为一个常规的用户空间库。在用户空间中实现 `fork()` 和写时复制有一个好处就是,让内核始终保持简单,并且因此更不易出错。它也让个别的用户模式程序在 `fork()` 上定义了它们自己的语义。一个有略微不同实现的程序(例如,代价昂贵的、总是复制的 `dumbfork()` 版本,或父子进程真实共享内存的后面的那一个),它自己可以很容易提供。 -##### 用户级页故障处理 +#### 用户级页故障处理 一个用户级写时复制 `fork()` 需要知道关于在写保护页上的页故障相关的信息,因此,这是你首先需要去实现的东西。对用户级页故障处理来说,写时复制仅是众多可能的用途之一。 @@ -276,15 +262,14 @@ xv6 Unix 的 `fork()` 从父进程的页上复制所有数据,然后将它分 内核跟踪有大量的信息,与传统的 Unix 方法不同,你将决定在每个用户空间中关于每个页故障应该做的事。用户空间中的 bug 危害都较小。这种设计带来了额外的好处,那就是允许程序员在定义它们的内存区域时,会有很好的灵活性;对于映射和访问基于磁盘文件系统上的文件时,你应该使用后面的用户级页故障处理。 -###### 设置页故障服务程序 +##### 设置页故障服务程序 为了处理它自己的页故障,一个用户环境将需要在 JOS 内核上注册一个页故障服务程序入口。用户环境通过新的 `sys_env_set_pgfault_upcall` 系统调用来注册它的页故障入口。我们给结构 `Env` 增加了一个新的成员 `env_pgfault_upcall`,让它去记录这个信息。 -```markdown -练习 8、实现 `sys_env_set_pgfault_upcall` 系统调用。当查找目标环境的环境 ID 时,一定要确认启用了权限检查,因为这是一个“危险的”系统调用。 +> **练习 8**、实现 `sys_env_set_pgfault_upcall` 系统调用。当查找目标环境的环境 ID 时,一定要确认启用了权限检查,因为这是一个“危险的”系统调用。 ``` -###### 在用户环境中的正常和异常栈 +##### 在用户环境中的正常和异常栈 在正常运行期间,JOS 中的一个用户环境运行在正常的用户栈上:它的 `ESP` 寄存器开始指向到 `USTACKTOP`,而它所推送的栈数据将驻留在 `USTACKTOP-PGSIZE` 和 `USTACKTOP-1`(含)之间的页上。但是,当在用户模式中发生页故障时,内核将在一个不同的栈上重新启动用户环境,运行一个用户级页故障指定的服务程序,即用户异常栈。其它,我们将让 JOS 内核为用户环境实现自动的“栈切换”,当从用户模式转换到内核模式时,x86 处理器就以大致相同的方式为 JOS 实现了栈切换。 @@ -292,7 +277,7 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 每个想去支持用户级页故障处理的用户环境,都需要为它自己的异常栈使用在 Part A 中介绍的 `sys_page_alloc()` 系统调用去分配内存。 -###### 调用用户页故障服务程序 +##### 调用用户页故障服务程序 现在,你需要去修改 `kern/trap.c` 中的页故障处理代码,以能够处理接下来在用户模式中发生的页故障。我们将故障发生时用户环境的状态称之为捕获时状态。 @@ -322,25 +307,20 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 去测试 `tf->tf_esp` 是否已经在用户异常栈上准备好,可以去检查它是否在 `UXSTACKTOP-PGSIZE` 和 `UXSTACKTOP-1`(含)的范围内。 -```markdown -练习 9、实现在 `kern/trap.c` 中的 `page_fault_handler` 的代码,要求派发页故障到用户模式故障服务程序上。在写入到异常栈时,一定要采取适当的预防措施。(如果用户环境运行时溢出了异常栈,会发生什么事情?) -``` +> **练习 9**、实现在 `kern/trap.c` 中的 `page_fault_handler` 的代码,要求派发页故障到用户模式故障服务程序上。在写入到异常栈时,一定要采取适当的预防措施。(如果用户环境运行时溢出了异常栈,会发生什么事情?) -###### 用户模式页故障入口点 +##### 用户模式页故障入口点 接下来,你需要去实现汇编程序,它将调用 C 页故障服务程序,并在原始的故障指令处恢复程序运行。这个汇编程序是一个故障服务程序,它由内核使用 `sys_env_set_pgfault_upcall()` 来注册。 -```markdown -练习 10、实现在 `lib/pfentry.S` 中的 `_pgfault_upcall` 程序。最有趣的部分是返回到用户代码中产生页故障的原始位置。你将要直接返回到那里,不能通过内核返回。最难的部分是同时切换栈和重新加载 EIP。 -``` +> **练习 10**、实现在 `lib/pfentry.S` 中的 `_pgfault_upcall` 程序。最有趣的部分是返回到用户代码中产生页故障的原始位置。你将要直接返回到那里,不能通过内核返回。最难的部分是同时切换栈和重新加载 EIP。 最后,你需要去实现用户级页故障处理机制的 C 用户库。 -```c -练习 11、完成 `lib/pgfault.c` 中的 `set_pgfault_handler()`。 +> **练习 11**、完成 `lib/pgfault.c` 中的 `set_pgfault_handler()`。 ``` -###### 测试 +##### 测试 运行 `user/faultread`(make run-faultread)你应该会看到: @@ -376,7 +356,7 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 [00001000] free env 00001000 ``` -如果你只看到第一个 "this string” 行,意味着你没有正确地处理递归页故障。 +如果你只看到第一个 “this string” 行,意味着你没有正确地处理递归页故障。 运行 `user/faultallocbad` 你应该会看到: @@ -389,11 +369,9 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 确保你理解了为什么 `user/faultalloc` 和 `user/faultallocbad` 的行为是不一样的。 -```markdown -小挑战!扩展你的内核,让它不仅是页故障,而是在用户空间中运行的代码能够产生的所有类型的处理器异常,都能够被重定向到一个用户模式中的异常服务程序上。写出用户模式测试程序,去测试各种各样的用户模式异常处理,比如除零错误、一般保护故障、以及非法操作码。 -``` +> **小挑战!**扩展你的内核,让它不仅是页故障,而是在用户空间中运行的代码能够产生的所有类型的处理器异常,都能够被重定向到一个用户模式中的异常服务程序上。写出用户模式测试程序,去测试各种各样的用户模式异常处理,比如除零错误、一般保护故障、以及非法操作码。 -##### 实现写时复制 Fork +#### 实现写时复制 Fork 现在,你有个内核功能要去实现,那就是在用户空间中完整地实现写时复制 `fork()`。 @@ -401,38 +379,29 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 `fork()` 的基本控制流如下: - 1. 父环境使用你在上面实现的 `set_pgfault_handler()` 函数,安装 `pgfault()` 作为 C 级页故障服务程序。 - - 2. 父环境调用 `sys_exofork()` 去创建一个子环境。 - - 3. 在它的地址空间中,低于 UTOP 位置的、每个可写入页、或写时复制页上,父环境调用 `duppage` 后,它应该会映射页写时复制到子环境的地址空间中,然后在它自己的地址空间中重新映射页写时复制。[ 注意:这里的顺序很重要(即,在父环境中标记之前,先在子环境中标记该页为 COW)!你能明白是为什么吗?尝试去想一个具体的案例,将顺序颠倒一下会发生什么样的问题。] `duppage` 把两个 PTE 都设置了,致使那个页不可写入,并且在 "avail” 字段中通过包含 `PTE_COW` 来从真正的只读页中区分写时复制页。 - -然而异常栈是不能通过这种方式重映射的。对于异常栈,你需要在子环境中分配一个新页。因为页故障服务程序不能做真实的复制,并且页故障服务程序是运行在异常栈上的,异常栈不能进行写时复制:那么谁来复制它呢? - -`fork()` 也需要去处理存在的页,但不能写入或写时复制。 - - 4. 父环境为子环境设置了用户页故障入口点,让它看起来像它自己的一样。 - - 5. 现在,子环境准备去运行,所以父环境标记它为可运行。 - +1. 父环境使用你在上面实现的 `set_pgfault_handler()` 函数,安装 `pgfault()` 作为 C 级页故障服务程序。 +2. 父环境调用 `sys_exofork()` 去创建一个子环境。 +3. 在它的地址空间中,低于 UTOP 位置的、每个可写入页、或写时复制页上,父环境调用 `duppage` 后,它应该会映射页写时复制到子环境的地址空间中,然后在它自己的地址空间中重新映射页写时复制。[ 注意:这里的顺序很重要(即,在父环境中标记之前,先在子环境中标记该页为 COW)!你能明白是为什么吗?尝试去想一个具体的案例,将顺序颠倒一下会发生什么样的问题。] `duppage` 把两个 PTE 都设置了,致使那个页不可写入,并且在 "avail” 字段中通过包含 `PTE_COW` 来从真正的只读页中区分写时复制页。 + 然而异常栈是不能通过这种方式重映射的。对于异常栈,你需要在子环境中分配一个新页。因为页故障服务程序不能做真实的复制,并且页故障服务程序是运行在异常栈上的,异常栈不能进行写时复制:那么谁来复制它呢? + `fork()` 也需要去处理存在的页,但不能写入或写时复制。 +4. 父环境为子环境设置了用户页故障入口点,让它看起来像它自己的一样。 +5. 现在,子环境准备去运行,所以父环境标记它为可运行。 每次其中一个环境写一个还没有写入的写时复制页时,它将产生一个页故障。下面是用户页故障服务程序的控制流: - 1. 内核传递页故障到 `_pgfault_upcall`,它调用 `fork()` 的 `pgfault()` 服务程序。 - 2. `pgfault()` 检测到那个故障是一个写入(在错误代码中检查 `FEC_WR`),然后将那个页的 PTE 标记为 `PTE_COW`。如果不是一个写入,则崩溃。 - 3. `pgfault()` 在一个临时位置分配一个映射的新页,并将故障页的内容复制进去。然后,故障服务程序以读取/写入权限映射新页到合适的地址,替换旧的只读映射。 - - +1. 内核传递页故障到 `_pgfault_upcall`,它调用 `fork()` 的 `pgfault()` 服务程序。 +2. `pgfault()` 检测到那个故障是一个写入(在错误代码中检查 `FEC_WR`),然后将那个页的 PTE 标记为 `PTE_COW`。如果不是一个写入,则崩溃。 +3. `pgfault()` 在一个临时位置分配一个映射的新页,并将故障页的内容复制进去。然后,故障服务程序以读取/写入权限映射新页到合适的地址,替换旧的只读映射。 对于上面的几个操作,用户级 `lib/fork.c` 代码必须查询环境的页表(即,那个页的 PTE 是否标记为 `PET_COW`)。为此,内核在 `UVPT` 位置精确地映射环境的页表。它使用一个 [聪明的映射技巧][1] 去标记它,以使用户代码查找 PTE 时更容易。`lib/entry.S` 设置 `uvpt` 和 `uvpd`,以便于你能够在 `lib/fork.c` 中轻松查找页表信息。 -```c -练习 12、在 `lib/fork.c` 中实现 `fork`、`duppage` 和 `pgfault`。 +> **练习 12**、在 `lib/fork.c` 中实现 `fork`、`duppage` 和 `pgfault`。 -使用 `forktree` 程序测试你的代码。它应该会产生下列的信息,在信息中会有 'new env'、'free env'、和 'exiting gracefully' 这样的字眼。信息可能不是按如下的顺序出现的,并且环境 ID 也可能不一样。 +> 使用 `forktree` 程序测试你的代码。它应该会产生下列的信息,在信息中会有 'new env'、'free env'、和 'exiting gracefully' 这样的字眼。信息可能不是按如下的顺序出现的,并且环境 ID 也可能不一样。 +>``` 1000: I am '' 1001: I am '0' 2000: I am '00' @@ -450,31 +419,32 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 1006: I am '101' ``` -```c -小挑战!实现一个名为 `sfork()` 的共享内存的 `fork()`。这个版本的 `sfork()` 中,父子环境共享所有的内存页(因此,一个环境中对内存写入,就会改变另一个环境数据),除了在栈区域中的页以外,它应该使用写时复制来处理这些页。修改 `user/forktree.c` 去使用 `sfork()` 而是不常见的 `fork()`。另外,你在 Part C 中实现了 IPC 之后,使用你的 `sfork()` 去运行 `user/pingpongs`。你将找到提供全局指针 `thisenv` 功能的一个新方式。 -``` +. -```markdown -小挑战!你实现的 `fork` 将产生大量的系统调用。在 x86 上,使用中断切换到内核模式将产生较高的代价。增加系统调用接口,以便于它能够一次发送批量的系统调用。然后修改 `fork` 去使用这个接口。 -你的新的 `fork` 有多快? +> **小挑战!**实现一个名为 `sfork()` 的共享内存的 `fork()`。这个版本的 `sfork()` 中,父子环境共享所有的内存页(因此,一个环境中对内存写入,就会改变另一个环境数据),除了在栈区域中的页以外,它应该使用写时复制来处理这些页。修改 `user/forktree.c` 去使用 `sfork()` 而是不常见的 `fork()`。另外,你在 Part C 中实现了 IPC 之后,使用你的 `sfork()` 去运行 `user/pingpongs`。你将找到提供全局指针 `thisenv` 功能的一个新方式。 -你可以用一个分析来论证,批量提交对你的 `fork` 的性能改变,以它来(粗略地)回答这个问题:使用一个 `int 0x30` 指令的代价有多高?在你的 `fork` 中运行了多少次 `int 0x30` 指令?访问 `TSS` 栈切换的代价高吗?等待 ... +. -或者,你可以在真实的硬件上引导你的内核,并且真实地对你的代码做基准测试。查看 `RDTSC`(读取时间戳计数器)指令,它的定义在 IA32 手册中,它计数自上一次处理器重置以来流逝的时钟周期数。QEMU 并不能真实地模拟这个指令(它能够计数运行的虚拟指令数量,或使用主机的 TSC,但是这两种方式都不能反映真实的 CPU 周期数)。 -``` +> **小挑战!**你实现的 `fork` 将产生大量的系统调用。在 x86 上,使用中断切换到内核模式将产生较高的代价。增加系统调用接口,以便于它能够一次发送批量的系统调用。然后修改 `fork` 去使用这个接口。 + +> 你的新的 `fork` 有多快? + +> 你可以用一个分析来论证,批量提交对你的 `fork` 的性能改变,以它来(粗略地)回答这个问题:使用一个 `int 0x30` 指令的代价有多高?在你的 `fork` 中运行了多少次 `int 0x30` 指令?访问 `TSS` 栈切换的代价高吗?等待 ... + +> 或者,你可以在真实的硬件上引导你的内核,并且真实地对你的代码做基准测试。查看 `RDTSC`(读取时间戳计数器)指令,它的定义在 IA32 手册中,它计数自上一次处理器重置以来流逝的时钟周期数。QEMU 并不能真实地模拟这个指令(它能够计数运行的虚拟指令数量,或使用主机的 TSC,但是这两种方式都不能反映真实的 CPU 周期数)。 到此为止,Part B 部分结束了。在你运行 `make grade` 之前,确保你通过了所有的 Part B 部分的测试。和以前一样,你可以使用 `make handin` 去提交你的实验。 -#### Part C:抢占式多任务处理和进程间通讯(IPC) +### Part C:抢占式多任务处理和进程间通讯(IPC) 在实验 4 的最后部分,你将修改内核去抢占不配合的环境,并允许环境之间显式地传递消息。 -##### 时钟中断和抢占 +#### 时钟中断和抢占 运行测试程序 `user/spin`。这个测试程序 fork 出一个子环境,它控制了 CPU 之后,就永不停歇地运转起来。无论是父环境还是内核都不能回收对 CPU 的控制。从用户模式环境中保护系统免受 bug 或恶意代码攻击的角度来看,这显然不是个理想的状态,因为任何用户模式环境都能够通过简单的无限循环,并永不归还 CPU 控制权的方式,让整个系统处于暂停状态。为了允许内核去抢占一个运行中的环境,从其中夺回对 CPU 的控制权,我们必须去扩展 JOS 内核,以支持来自硬件时钟的外部硬件中断。 -###### 中断规则 +##### 中断规则 外部中断(即:设备中断)被称为 IRQ。现在有 16 个可能出现的 IRQ,编号 0 到 15。从 IRQ 号到 IDT 条目的映射是不固定的。在 `picirq.c` 中的 `pic_init` 映射 IRQ 0 - 15 到 IDT 条目 `IRQ_OFFSET` 到 `IRQ_OFFSET+15`。 @@ -484,31 +454,27 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 处于用户环境中时,你将要确保 `FL_IF` 标志被设置,以便于出现一个中断时,它能够通过处理器来传递,让你的中断代码来处理。否则,中断将被屏蔽或忽略,直到中断被重新打开后。我们使用引导加载程序的第一个指令去屏蔽中断,并且到目前为止,还没有去重新打开它们。 -```markdown -练习 13、修改 `kern/trapentry.S` 和 `kern/trap.c` 去初始化 IDT 中的相关条目,并为 IRQ 0 到 15 提供服务程序。然后修改 `kern/env.c` 中的 `env_alloc()` 的代码,以确保在用户环境中,中断总是打开的。 +> **练习 13**、修改 `kern/trapentry.S` 和 `kern/trap.c` 去初始化 IDT 中的相关条目,并为 IRQ 0 到 15 提供服务程序。然后修改 `kern/env.c` 中的 `env_alloc()` 的代码,以确保在用户环境中,中断总是打开的。 -另外,在 `sched_halt()` 中取消注释 `sti` 指令,以便于空闲的 CPU 取消屏蔽中断。 +> 另外,在 `sched_halt()` 中取消注释 `sti` 指令,以便于空闲的 CPU 取消屏蔽中断。 -当调用一个硬件中断服务程序时,处理器不会推送一个错误代码。在这个时候,你可能需要重新阅读 [80386 参考手册][2] 的 9.2 节,或 [IA-32 Intel 架构软件开发者手册 卷 3][3] 的 5.8 节。 +> 当调用一个硬件中断服务程序时,处理器不会推送一个错误代码。在这个时候,你可能需要重新阅读 [80386 参考手册][2] 的 9.2 节,或 [IA-32 Intel 架构软件开发者手册 卷 3][3] 的 5.8 节。 -在完成这个练习后,如果你在你的内核上使用任意的测试程序去持续运行(即:`spin`),你应该会看到内核输出中捕获的硬件中断的捕获帧。虽然在处理器上已经打开了中断,但是 JOS 并不能处理它们,因此,你应该会看到在当前运行的用户环境中每个中断的错误属性并被销毁,最终环境会被销毁并进入到监视器中。 -``` +> 在完成这个练习后,如果你在你的内核上使用任意的测试程序去持续运行(即:`spin`),你应该会看到内核输出中捕获的硬件中断的捕获帧。虽然在处理器上已经打开了中断,但是 JOS 并不能处理它们,因此,你应该会看到在当前运行的用户环境中每个中断的错误属性并被销毁,最终环境会被销毁并进入到监视器中。 -###### 处理时钟中断 +##### 处理时钟中断 在 `user/spin` 程序中,子环境首先运行之后,它只是进入一个高速循环中,并且内核再无法取得 CPU 控制权。我们需要对硬件编程,定期产生时钟中断,它将强制将 CPU 控制权返还给内核,在内核中,我们就能够将控制权切换到另外的用户环境中。 我们已经为你写好了对 `lapic_init` 和 `pic_init`(来自 `init.c` 中的 `i386_init`)的调用,它将设置时钟和中断控制器去产生中断。现在,你需要去写代码来处理这些中断。 -```markdown -练习 14、修改内核的 `trap_dispatch()` 函数,以便于在时钟中断发生时,它能够调用 `sched_yield()` 去查找和运行一个另外的环境。 +> **练习 14**、修改内核的 `trap_dispatch()` 函数,以便于在时钟中断发生时,它能够调用 `sched_yield()` 去查找和运行一个另外的环境。 -现在,你应该能够用 `user/spin` 去做测试了:父环境应该会 fork 出子环境,`sys_yield()` 到它许多次,但每次切换之后,将重新获得对 CPU 的控制权,最后杀死子环境后优雅地终止。 -``` +> 现在,你应该能够用 `user/spin` 去做测试了:父环境应该会 fork 出子环境,`sys_yield()` 到它许多次,但每次切换之后,将重新获得对 CPU 的控制权,最后杀死子环境后优雅地终止。 这是做回归测试的好机会。确保你没有弄坏本实验的前面部分,确保打开中断能够正常工作(即: `forktree`)。另外,尝试使用 ` make CPUS=2 target` 在多个 CPU 上运行它。现在,你应该能够通过 `stresssched` 测试。可以运行 `make grade` 去确认。现在,你的得分应该是 65 分了(总分为 80)。 -##### 进程间通讯(IPC) +#### 进程间通讯(IPC) (严格来说,在 JOS 中这是“环境间通讯” 或 “IEC”,但所有人都称它为 IPC,因此我们使用标准的术语。) @@ -516,13 +482,13 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 进程间通讯有许多模型。关于哪个模型最好的争论从来没有停止过。我们不去参与这种争论。相反,我们将要实现一个简单的 IPC 机制,然后尝试使用它。 -###### JOS 中的 IPC +##### JOS 中的 IPC 你将要去实现另外几个 JOS 内核的系统调用,由它们共同来提供一个简单的进程间通讯机制。你将要实现两个系统调用,`sys_ipc_recv` 和 `sys_ipc_try_send`。然后你将要实现两个库去封装 `ipc_recv` 和 `ipc_send`。 用户环境可以使用 JOS 的 IPC 机制相互之间发送 “消息” 到每个其它环境,这些消息有两部分组成:一个单个的 32 位值,和可选的一个单个页映射。允许环境在消息中传递页映射,提供了一个高效的方式,传输比一个仅适合单个的 32 位整数更多的数据,并且也允许环境去轻松地设置安排共享内存。 -###### 发送和接收消息 +##### 发送和接收消息 一个环境通过调用 `sys_ipc_recv` 去接收消息。这个系统调用将取消对当前环境的调度,并且不会再次去运行它,直到消息被接收为止。当一个环境正在等待接收一个消息时,任何其它环境都能够给它发送一个消息 — 而不仅是一个特定的环境,而且不仅是与接收环境有父子关系的环境。换句话说,你在 Part A 中实现的权限检查将不会应用到 IPC 上,因为 IPC 系统调用是经过慎重设计的,因此可以认为它是“安全的”:一个环境并不能通过给它发送消息导致另一个环境发生故障(除非目标环境也存在 Bug)。 @@ -532,7 +498,7 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 同样,一个库函数 `ipc_send` 将去不停地调用 `sys_ipc_try_send` 来发送消息,直到发送成功为止。 -###### 转移页 +##### 转移页 当一个环境使用一个有效的 `dstva` 参数(低于 `UTOP`)去调用 `sys_ipc_recv` 时,环境将声明愿意去接收一个页映射。如果发送方发送一个页,那么那个页应该会被映射到接收者地址空间的 `dstva` 处。如果接收者在 `dstva` 已经有了一个页映射,那么已存在的那个页映射将被取消映射。 @@ -540,31 +506,30 @@ JOS 用户异常栈也是一个页的大小,并且它的顶部被定义在虚 如果发送方和接收方都没有表示要转移这个页,那么就不会有页被转移。在任何 IPC 之后,内核将在接收方的 `Env` 结构上设置新的 `env_ipc_perm` 字段,以允许接收页,或者将它设置为 0,表示不再接收。 -###### 实现 IPC +##### 实现 IPC -```markdown -练习 15、实现 `kern/syscall.c` 中的 `sys_ipc_recv` 和 `sys_ipc_try_send`。在实现它们之前一起阅读它们的注释信息,因为它们要一起工作。当你在这些程序中调用 `envid2env` 时,你应该去设置 `checkperm` 的标志为 0,这意味着允许任何环境去发送 IPC 消息到另外的环境,并且内核除了验证目标 envid 是否有效外,不做特别的权限检查。 +> **练习 15**、实现 `kern/syscall.c` 中的 `sys_ipc_recv` 和 `sys_ipc_try_send`。在实现它们之前一起阅读它们的注释信息,因为它们要一起工作。当你在这些程序中调用 `envid2env` 时,你应该去设置 `checkperm` 的标志为 0,这意味着允许任何环境去发送 IPC 消息到另外的环境,并且内核除了验证目标 envid 是否有效外,不做特别的权限检查。 -接着实现 `lib/ipc.c` 中的 `ipc_recv` 和 `ipc_send` 函数。 +> 接着实现 `lib/ipc.c` 中的 `ipc_recv` 和 `ipc_send` 函数。 -使用 `user/pingpong` 和 `user/primes` 函数去测试你的 IPC 机制。`user/primes` 将为每个质数生成一个新环境,直到 JOS 耗尽环境为止。你可能会发现,阅读 `user/primes.c` 非常有趣,你将看到所有的 fork 和 IPC 都是在幕后进行。 -``` +> 使用 `user/pingpong` 和 `user/primes` 函数去测试你的 IPC 机制。`user/primes` 将为每个质数生成一个新环境,直到 JOS 耗尽环境为止。你可能会发现,阅读 `user/primes.c` 非常有趣,你将看到所有的 fork 和 IPC 都是在幕后进行。 -``` -小挑战!为什么 `ipc_send` 要循环调用?修改系统调用接口,让它不去循环。确保你能处理多个环境尝试同时发送消息到一个环境上的情况。 -``` +. -```markdown -小挑战!质数筛选是在大规模并发程序中传递消息的一个很巧妙的用法。阅读 C. A. R. Hoare 写的 《Communicating Sequential Processes》,Communications of the ACM_ 21(8) (August 1978), 666-667,并去实现矩阵乘法示例。 -``` -```markdown -小挑战!控制消息传递的最令人印象深刻的一个例子是,Doug McIlroy 的幂序列计算器,它在 [M. Douglas McIlroy,《Squinting at Power Series》,Software--Practice and Experience, 20(7) (July 1990),661-683][4] 中做了详细描述。实现了它的幂序列计算器,并且计算了 _sin_ ( _x_ + _x_ ^3) 的幂序列。 -``` +> **小挑战!**为什么 `ipc_send` 要循环调用?修改系统调用接口,让它不去循环。确保你能处理多个环境尝试同时发送消息到一个环境上的情况。 -```markdown -小挑战!通过应用 Liedtke 的论文([通过内核设计改善 IPC 性能][5])中的一些技术、或你可以想到的其它技巧,来让 JOS 的 IPC 机制更高效。为此,你可以随意修改内核的系统调用 API,只要你的代码向后兼容我们的评级脚本就行。 -``` +. + +> **小挑战!**质数筛选是在大规模并发程序中传递消息的一个很巧妙的用法。阅读 C. A. R. Hoare 写的 《Communicating Sequential Processes》,Communications of the ACM_ 21(8) (August 1978), 666-667,并去实现矩阵乘法示例。 + +. + +> **小挑战!**控制消息传递的最令人印象深刻的一个例子是,Doug McIlroy 的幂序列计算器,它在 [M. Douglas McIlroy,《Squinting at Power Series》,Software--Practice and Experience, 20(7) (July 1990),661-683][4] 中做了详细描述。实现了它的幂序列计算器,并且计算了 _sin_ ( _x_ + _x_ ^3) 的幂序列。 + +. + +> **小挑战!**通过应用 Liedtke 的论文([通过内核设计改善 IPC 性能][5])中的一些技术、或你可以想到的其它技巧,来让 JOS 的 IPC 机制更高效。为此,你可以随意修改内核的系统调用 API,只要你的代码向后兼容我们的评级脚本就行。 **Part C 到此结束了。**确保你通过了所有的评级测试,并且不要忘了将你的小挑战的答案写入到 `answers-lab4.txt` 中。 @@ -577,7 +542,7 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab4/ 作者:[csail.mit][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/) 荣誉推出 @@ -587,4 +552,4 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab4/ [2]: https://pdos.csail.mit.edu/6.828/2018/labs/readings/i386/toc.htm [3]: https://pdos.csail.mit.edu/6.828/2018/labs/readings/ia32/IA32-3A.pdf [4]: https://swtch.com/~rsc/thread/squint.pdf -[5]: http://dl.acm.org/citation.cfm?id=168633 \ No newline at end of file +[5]: http://dl.acm.org/citation.cfm?id=168633 From 78a05676f08c4405280bb437333d5ec3e4fbd4ab Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 13:00:50 +0800 Subject: [PATCH 0128/4278] PUB:20181016 Lab 4- Preemptive Multitasking.md @qhwdw https://linux.cn/article-10351-1.html --- .../tech => published}/20181016 Lab 4- Preemptive Multitasking.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181016 Lab 4- Preemptive Multitasking.md (100%) diff --git a/translated/tech/20181016 Lab 4- Preemptive Multitasking.md b/published/20181016 Lab 4- Preemptive Multitasking.md similarity index 100% rename from translated/tech/20181016 Lab 4- Preemptive Multitasking.md rename to published/20181016 Lab 4- Preemptive Multitasking.md From 8bee3af9f203bf3c0b6d2a09b0a8132b1d4774f9 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sun, 16 Dec 2018 13:31:33 +0800 Subject: [PATCH 0129/4278] hankchow translating --- sources/tech/20181212 Aliases- DIY Shell Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181212 Aliases- DIY Shell Commands.md b/sources/tech/20181212 Aliases- DIY Shell Commands.md index d81fb03bb0..81dce2efe7 100644 --- a/sources/tech/20181212 Aliases- DIY Shell Commands.md +++ b/sources/tech/20181212 Aliases- DIY Shell Commands.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6231a212de89cab2144103573af4dbbcff25dfb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Sun, 16 Dec 2018 14:47:50 +0800 Subject: [PATCH 0130/4278] Update 20180912 How to turn on an LED with Fedora IoT.md --- sources/tech/20180912 How to turn on an LED with Fedora IoT.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180912 How to turn on an LED with Fedora IoT.md b/sources/tech/20180912 How to turn on an LED with Fedora IoT.md index 007cfc27ab..5f1843fc83 100644 --- a/sources/tech/20180912 How to turn on an LED with Fedora IoT.md +++ b/sources/tech/20180912 How to turn on an LED with Fedora IoT.md @@ -1,3 +1,4 @@ +Translating by ScarboroughCoral How to turn on an LED with Fedora IoT ====== From 608359fff4f1b0a49091e3a4259d3e4ef6975de2 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sun, 16 Dec 2018 17:12:33 +0800 Subject: [PATCH 0131/4278] Translated by qhwdw --- .../tech/20181210 How to get started in AI.md | 113 ------------------ .../tech/20181210 How to get started in AI.md | 113 ++++++++++++++++++ 2 files changed, 113 insertions(+), 113 deletions(-) delete mode 100644 sources/tech/20181210 How to get started in AI.md create mode 100644 translated/tech/20181210 How to get started in AI.md diff --git a/sources/tech/20181210 How to get started in AI.md b/sources/tech/20181210 How to get started in AI.md deleted file mode 100644 index 0dfb5761aa..0000000000 --- a/sources/tech/20181210 How to get started in AI.md +++ /dev/null @@ -1,113 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to get started in AI) -[#]: via: (https://opensource.com/article/18/12/how-get-started-ai) -[#]: author: (Gordon Haff https://opensource.com/users/ghaff) - -How to get started in AI -====== -Before you can begin working in artificial intelligence, you need to acquire some human intelligence. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain-think-ai-intelligence-ccby.png?itok=C-gK01E_) - -I've both asked and been asked about the best way to learn more about artificial intelligence (AI). What should I read? What should I watch? I'll get to that. But, first, it's useful to break down this question, given that AI covers a lot of territory. - -One important distinction to draw is between the research side of AI and the applied side. Cassie Kozyrkov of Google [drew this distinction][1] in a talk at the recent O'Reilly Artificial Intelligence Conference in London, and it's a good one. - -Research AI is rather academic in nature and requires a heavy dose of math across a variety of disciplines before you even get to those parts that are specific to AI. This aspect of AI focuses on the algorithms and tools that drive the state of AI forward. For example, what neural network structures might improve vision recognition results? How might we make unsupervised learning a more generally useful approach? Can we find ways to understand better how deep learning pipelines come up with the answers they do? - -Applied AI, on the other hand, is more about using existing tools to obtain useful results. Open source has played a big role here in providing free and often easy-to-use software in a variety of languages. Public cloud providers have also devoted a lot of attention to providing machine learning services, models, and datasets that make the onramp to getting started with AI much simpler than it would be otherwise. - -I'll add at this point that applied AI practitioners shouldn't treat their tools as some sort of black box that spits out answers for mysterious reasons. At a minimum, they need to understand the limits and potential biases of different techniques, models, and data collection approaches. It's just that they don't necessarily need to delve deeply into all the theory underpinning every part of their toolchain. - -Although it's probably less important for working in AI on a day-to-day basis, it's also useful to understand the broader context of AI. It goes beyond the narrow scope of deep learning on neural networks that have been so important to the gains made in reinforcement learning and supervised learning to date. For example, AI is often viewed as a way to augment (rather than replace) human judgment and decisions. But the handoff between machine and human has its own pitfalls. - -With that background, here are some study areas and resources you may find useful. - -### Research AI - -In a lot of respects, a list of resources for research AI mirror those in an undergraduate (or even graduate) computer science program that's focused on AI. The main difference is that the syllabus you draw up may be more interdisciplinary than more traditionally focused university curricula. - -Where you start will depend on your computer science and math background. - -If it's minimal or rusty, but you still want to develop a deep understanding of AI fundamentals, you'll benefit from taking some math courses to start. There are many options on massive online open courses (MOOCs) like the nonprofit [edX][2] platform and [Coursera][3]. (Both platforms charge for certifications, but edX makes all the content available for free to people just auditing the course.) - -Typical foundational courses could include: - -+ [MIT's Calculus courses][22], starting with differentiation -+ [Linear Algebra][23] (University of Texas) -+ Probability and statistics, such as MIT's [Probability—The Science of Uncertainty and Data][24] - - -To get deeper into AI from a research perspective, you'll probably want to get into all these areas of mathematics and more. But the above should give you an idea of the general branches of study that are probably most important before delving into machine learning and AI proper. - -In addition to MOOCs, resources such as [MIT OpenCourseWare][4] provide the syllabus and various supporting materials for a wide range of mathematics and computer science courses. - -With the foundations in place, you can move onto more specialized courses in AI proper. Andrew Ng's AI MOOC, from when he was teaching at Stanford, was one of the early courses to popularize the whole online course space. Today, his [Neural Networks and Deep Learning][5] is part of the Deep Learning specialization at Coursera. There are corresponding programs on edX. For example, Columbia offers an [Artificial Intelligence MicroMasters][6]. - -In addition to courses, a variety of textbooks and other learning material are also available online. These include: - - * [Neural Networks and Deep Learning][7] - * [Deep Learning][8] from MIT Press by Ian Goodfellow and Yoshua Bengio and Aaron Courville - -### Applied AI - -Applied AI is much more focused on using available tools than building new ones. Some appreciation of the mathematical underpinnings, especially statistics, is still useful—arguably even necessary—but you won't be majoring in that aspect of AI to the same degree you would in a research mode. - -Programming is a core skill here. While different programming languages can come into play, a lot of libraries and toolsets—such as [PyTorch][9]—rely on Python, so that's a good skill to have. Especially if you have some level of programming background, MIT's [Introduction to Computer Science and Programming Using Python][10], based on its on-campus 6.001 course, is a good primer. If you're truly new to programming, Charles Severance's [Programming for Everybody (Getting Started with Python)][11] from the University of Michigan doesn't toss you into the deep end of the pool the way the MIT course does. - -[The R programming language][12] is also a useful skill to add to your toolbox. While it's less used in machine learning (ML) per se, it's common for a variety of other data science tasks, and applied AI/ML and data science often blend in practice. For example, many tasks associated with organizing and cleaning data apply equally whatever analysis techniques you'll eventually use. A MOOC sequence like Harvard's [Data Science certificate][13] is an example of a set of courses that provide a good introduction to working with data. - -Another open source software library you're likely to encounter if you do any work with AI is [TensorFlow][14]. It was originally developed by researchers and engineers from the Google Brain team within Google's AI organization. [Google offers a variety of tutorials][15] to get started with TensorFlow using the high-level Keras API. You can run TensorFlow locally as well as online in Google Cloud. - -In general, all of the big public cloud providers offer online datasets and ML services that can be an easy way to get started. However, especially as you move beyond "play" datasets and applications, you need to start thinking seriously about the degree to which you want to be locked into a single provider. - -Datasets for your exploratory learning projects are available from many different sources. In addition to the public cloud providers, [Kaggle][16] is another popular source and also a good learning resource more broadly. Government data is also increasingly available in digital form. The US Federal Government's [Data.gov][17] claims over 300,000 datasets. State and local governments also publish data on everything from restaurant health ratings to dogs' names. - -### Miscellany - -I'll close by noting that AI is a broad topic that isn't just about math, programming, and data. AI as a whole touches many other fields, including cognitive psychology, linguistics, game theory, operations research, and control systems. Indeed, a concern among at least some AI researchers today is that the field has become too fixated on a small number of techniques that have become powerful and interesting only quite recently because of the intersection of processing power and big data. Many longstanding problems in understanding how humans learn and reason remain largely unsolved. Developing at least some appreciation for these broader problem spaces will better enable you to place AI within a broader context. - -One of my favorite examples is the [Humans and Autonomy Lab][18] at Duke. The work in this lab touches on all the challenges of humans working with machines, such as how autopilots can create ["Children of the Magenta"][19] who are unable to take control quickly if the automation fails. A basic brain-science course, such as MIT's [Introduction to Psychology][20], provides some useful context for the relationship between human intelligence and machine intelligence. Another course in a similar vein, but taught by the late Marvin Minsky from MIT's Electrical Engineering and Computer Science department, is [The Society of Mind][21]. - -If there's one key challenge to learning about AI, it's not that raw materials and tools aren't readily available. It's that there are so many of them. My objective hasn't been to give you a comprehensive set of pointers. Rather, it's been to both point out the different paths you can take and provide you with some possible starting points. Happy learning! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/how-get-started-ai - -作者:[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://www.youtube.com/watch?v=RLtI7r3QUyY -[2]: https://www.edx.org/ -[3]: https://www.coursera.org/ -[4]: https://ocw.mit.edu/index.htm -[5]: https://www.coursera.org/learn/neural-networks-deep-learning -[6]: https://www.edx.org/micromasters/columbiax-artificial-intelligence -[7]: http://neuralnetworksanddeeplearning.com/ -[8]: http://www.deeplearningbook.org/ -[9]: https://pytorch.org/ -[10]: https://www.edx.org/course/introduction-to-computer-science-and-programming-using-python -[11]: https://www.coursera.org/learn/python -[12]: https://www.r-project.org/about.html -[13]: https://www.edx.org/professional-certificate/harvardx-data-science -[14]: https://www.tensorflow.org/ -[15]: https://www.tensorflow.org/tutorials/ -[16]: https://www.kaggle.com/ -[17]: https://www.data.gov/ -[18]: https://hal.pratt.duke.edu/ -[19]: https://99percentinvisible.org/episode/children-of-the-magenta-automation-paradox-pt-1/ -[20]: https://ocw.mit.edu/courses/brain-and-cognitive-sciences/9-00sc-introduction-to-psychology-fall-2011/ -[21]: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-868j-the-society-of-mind-fall-2011/ -[22]: https://www.edx.org/course/calculus-1a-differentiation -[23]: https://www.edx.org/course/linear-algebra-foundations-to-frontiers -[24]: https://courses.edx.org/courses/course-v1:MITx+6.431x+3T2018/course/ diff --git a/translated/tech/20181210 How to get started in AI.md b/translated/tech/20181210 How to get started in AI.md new file mode 100644 index 0000000000..ee88bb6961 --- /dev/null +++ b/translated/tech/20181210 How to get started in AI.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () +[#]: subject: (How to get started in AI) +[#]: via: (https://opensource.com/article/18/12/how-get-started-ai) +[#]: author: (Gordon Haff https://opensource.com/users/ghaff) + +学习人工智能如何起步 +====== +在你开始从事人工智能之前,你需要先了解人类的智能。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain-think-ai-intelligence-ccby.png?itok=C-gK01E_) + +我曾经问过别人也被别人问过关于学习人工智能最好的方式是什么?我应该去阅读什么?我应该去关注什么?后面我将讲到这些,但是,考虑到人工智能涉及很多领域,我把这个问题分开来讲可能更好理解。 + +学习人工智能很重要的一点是区别开研究方面和应用方面。Google 的 Cassie Kozyrkov 在近日于伦敦举行的 O’Reilly 人工智能会议的一个演讲中 [描述了这个区别][1],并且这是一个很好的区别。 + +研究人工智能在本质上是学术性的,在你能够获得人工智能的某些细节之前,需要大量的跨各类学科的数学知识。这部分人工智能关注于算法和驱动人工智能发展的工具。比如,什么样的神经网络结构能够改善视觉识别的结果?我们如何使无监督学习成为更有用的方法?我们能否找到一个更好的方法,去理解深度学习流水线是如何得出答案的? + +另一方面,人工智能应用更多是关于使用现有工具去获取有用的结果。开源在这里发挥了一个重要的作用,那就是免费提供了易于使用的、各种语言的软件。公有云提供商也致力于提供大量的机器学习、模型、以及数据集,这使得人工智能入门比其它的要简单的多。 + +在这个问题上我想补充一点,那就是人工智能的从业者不应该为了故弄玄虚而将它们的工具搞成只输出答案的黑匣子。至少,他们应该去了解不同技术、模型、和数据采集方法的限制和潜在偏差。但不需要去深入研究他们工具链中每个部分的理论。 + +虽然在日常工作中人工智能可能并不那么重要,但理解人工智能的大量的背景知识还是很有用的。人工智能已经超越了神经网络上深度学习的狭窄范围,目前神经网络上的强化学习和监督学习已经取得重要成就。例如,人工智能经常被视为是增强(而不是替代)人类判断和决策的一种方法。但是在机器和人类之间切换还有它自己的缺陷。 + +有了这些背景知识,下面是的一些研究领域和资源,你可能发现会很有用。 + +### 研究人工智能 + +在很多方面,用于人工智能研究的一个资源清单,可以反映出本科(甚至是研究生)的计算机科学项目都是专注于人工智能。最主要的区别是,你起草的教学大纲比起传统的大纲更关注于跨学科。 + +你的计算机科学和数学背景知识决定了你的起点。 + +如果你的计算机科学和数据背景知识很差或已经荒芜了,但你还希望能够深入了解人工智能的基本原理,那么从一些数学课程开始将会让你受益。MOOCs 上像非盈利的 [edX][2] 平台和 [Coursera][3] 上都有许多可供你选择的课程(这两个平台都对认证收费,但 edX 上所有的课程,对旁听者是全免费的)。 + +典型的基础课程包括: + ++ [MIT 的微积分课程][22],从微分开始学习 ++ [线性代数][23] (德克萨斯大学) ++ 概率与统计,比如 MIT 的 [概率 — 不确定性与数据科学][24] + + +从一个研究的角度去深入人工智能,你可能需要深入所有的这些数据领域,甚至更多。在深入研究机器学习和人工智能之前,上述的内容应该会让你得到一些常见研究分支的大致概念。 + +除了 MOOCs 之外,像 [MIT OpenCourseWare][4] 这样的资源也提供了大量的数学和计算机科学课程的大纲和各种支持材料。 + +有了这些基础,你就可以学习更专业的人工智能课程了。Andrew Ng 在斯坦福大学教的 “AI MOOC” 就是整个在线课程中最早流行起来的课程之一。今天,他的 [神经网络和深度学习][5] 也是 Coursera 深度学习专业的一部分。在 edX 上也有相关的一些项目,比如,哥伦比亚大学提供的一个 [人工智能 MicroMasters][6]。 + +除了课程之外,也可以在网上找到各种范例和其它学习材料。这些包括: + + * [神经网络和深度学习][7] + * MIT 的 Ian Goodfellow、Yoshua Bengio、Aaron Courville 出版的 [深度学习][8] + +### 应用人工智能 + +人工智能应用更关注于使用可用的工具,而不是去构建新工具。对一些底层的数学,尤其是统计学的了解仍然是非常有用的 — 甚至可以说是必需的 — 但对这些知识的了解程度不像研究人工智能的要求那么高。 + +在这里编程是核心技能。虽然可以使用不同的编程语言去做,但是一些库和工具集 — 比如 Python 的 [PyTorch][9],在这方面有很好的专长。尤其是,如果你有一些编程方面的背景知识,MIT 的 [计算机科学入门和使用 Python 编程][10],它是基于 MIT 的 6.001 课程,是一个非常好的启蒙课程。如果你编程零基础,来自密歇根大学的 Charles Severance 的 [人人学编程(Python 使用入门)][11] 是个很好的开端,它不会像 MIT 的课程那样,把你一下子扔进代码的汪洋大海。 + +[R 编程语言][12] 也是一个应该增加到你的技能库中的很有用的技能。虽然它在机器学习(ML)中使用的很少,但它在其它数据科学任务中很常见,并且经常与人工智能/机器学习和数据科学的应用实践结合在一起。比如,许多使用原始和数据清洗相关的应用任务,此外还有你最终要使用的诸如此类的分析技术,都将使用到它。一个 MOOC 系列,像 Harvard 的 [数据科学认证][13] 就是一整套课程的一个例子,这些课程介绍了如何去很好地处理数据。 + +如果你从事人工智能方面的工作,那么你很可能会遇到的另一个开源软件库就是 [TensorFlow][14]。它最初是由 Google 人工智能团队中的 Google 智慧团队的研发工程师开发的。[Google 提供了许多教程][15] 让你通过高级 Keras API 去开始使用 TensorFlow。你既可以在 Google 云上也可以在本地运行 TensorFlow。 + +通常,大的公有云提供商都提供在线数据集和易于使用的机器学习服务。但是,在你开始去 “玩” 数据集和应用之前,你需要考虑清楚,一旦开始选定一个提供商,你将被它们 “锁定” 的程度。 + +你的探索学习项目所需的数据集可以从许多不同的源获得。除了公有云提供商之外,[Kaggle][16] 是另一个受欢迎的源,总体来看,它也是一个比较好的学习源。以数字形式提供的政府数据也越来越多了。美国联邦政府的 [Data.gov][17] 声称它提供超过 300,000 的数据集。州和地方政府也发布从餐馆健康评级到狗的名字的所有数据。 + +### 研究和应用人工智能兼而有之 + +最后我想说明的一点是,人工智能不仅是与数学、编程、和数据有关的一个宽泛的主题。人工智能作为一个综合体涉及到了许多其它的领域,包括心理学、语言学、博弈论、运筹学和控制系统。确实,现在有一些人工智能研究者担心,由于处理能力和大数据的结合,使得该领域过于关注最近才变得强大和有趣的少数几个技术。在了解人类如何学习和推理方面,许多长期存在的问题仍未解决。不管怎样,对这些广泛存在的问题有一个了解,将更好地让你在更广泛的背景中评估人工智能。 + +我比较喜欢的其中一个示例是杜克大学的 [人类和自治实验室][18]。这个实验室的工作涉及人类与机器工作所面临的全部挑战,比如,如果自动化设备失效,自动驾驶仪如何设计才能让那些[“洋红色的孩子“][19] 快速取得对飞机的控制。一个基础的大脑科学课程,比如 MIT 的 [心理学导论][20],它提供了关于人类智能和机器智能之间关系的一些很有用的内容。另一个类似的课程是,MIT 电子工程与计算机科学系已故教授 Marvin Minsky 的 [心灵的社会][21]。 + +关于学习人工智能,假如说有一个最重要的挑战,那它不是原材料和工具不易获得,而是它们只有这么多。我的目标并不是给你一个全面的指导,相反,而是指出了你可以去学习的不同路径,以及为你提供一些可能的起点。祝你学习愉快! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/how-get-started-ai + +作者:[Gordon Haff][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/ghaff +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/watch?v=RLtI7r3QUyY +[2]: https://www.edx.org/ +[3]: https://www.coursera.org/ +[4]: https://ocw.mit.edu/index.htm +[5]: https://www.coursera.org/learn/neural-networks-deep-learning +[6]: https://www.edx.org/micromasters/columbiax-artificial-intelligence +[7]: http://neuralnetworksanddeeplearning.com/ +[8]: http://www.deeplearningbook.org/ +[9]: https://pytorch.org/ +[10]: https://www.edx.org/course/introduction-to-computer-science-and-programming-using-python +[11]: https://www.coursera.org/learn/python +[12]: https://www.r-project.org/about.html +[13]: https://www.edx.org/professional-certificate/harvardx-data-science +[14]: https://www.tensorflow.org/ +[15]: https://www.tensorflow.org/tutorials/ +[16]: https://www.kaggle.com/ +[17]: https://www.data.gov/ +[18]: https://hal.pratt.duke.edu/ +[19]: https://99percentinvisible.org/episode/children-of-the-magenta-automation-paradox-pt-1/ +[20]: https://ocw.mit.edu/courses/brain-and-cognitive-sciences/9-00sc-introduction-to-psychology-fall-2011/ +[21]: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-868j-the-society-of-mind-fall-2011/ +[22]: https://www.edx.org/course/calculus-1a-differentiation +[23]: https://www.edx.org/course/linear-algebra-foundations-to-frontiers +[24]: https://courses.edx.org/courses/course-v1:MITx+6.431x+3T2018/course/ From b2f28aadec871b2a3ff46672e27e005d57cc92d2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 19:36:53 +0800 Subject: [PATCH 0132/4278] PRF:20181201 Boxing yourself in on the Linux command line.md @jrglinux --- ...g yourself in on the Linux command line.md | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181201 Boxing yourself in on the Linux command line.md b/translated/tech/20181201 Boxing yourself in on the Linux command line.md index 56575b1f5b..1680a7ded8 100644 --- a/translated/tech/20181201 Boxing yourself in on the Linux command line.md +++ b/translated/tech/20181201 Boxing yourself in on the Linux command line.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) -[#]: translator: (jrglinux ) -[#]: reviewer: ( ) +[#]: translator: (jrglinux) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Boxing yourself in on the Linux command line) [#]: via: (https://opensource.com/article/18/12/linux-toy-boxes) @@ -9,24 +9,26 @@ 神奇的 Linux 命令行字符形状工具 boxes ====== -本文将教你如何在 Linux 命令行终端中使用 boxes 工具绘制字符形状图形来包装你的文字让其更突出。 + +> 本文将教你如何在 Linux 命令行终端中使用 boxes 工具绘制字符形状图形来包装你的文字让其更突出。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-boxes.png?itok=Rii6nT5P) 现在正值假期,每个 Linux 终端用户都该得到一点礼物。无论你是庆祝圣诞节还是庆祝其他节日,或者什么节日也没有,都没有关系。我将在接下来的几周内介绍 24 个 Linux 命令行小玩具,供你把玩或者与朋友分享。让我们享受乐趣,让这个月过得快乐一点,因为对于北半球来说,这个月有点冷并且沉闷。 对于我要讲述的内容,可能你之前就有些了解。但是,我还是希望我们都有机会学到一些新的东西(我做了一点研究,确保可以分享 24 个小玩具)。 -24 个 Linux 终端小玩具中的第一个是叫做 boxes 的小程序。为何从 boxes 说起呢?因为在没有它的情况下很难将所有其他命令礼物包装起来! +24 个 Linux 终端小玩具中的第一个是叫做 `boxes` 的小程序。为何从 `boxes` 说起呢?因为在没有它的情况下很难将所有其他命令礼物包装起来! -在我的 Fedora 机器上,默认没有安装 boxes 程序,但它在我的普通仓库中可以获取到,所以用如下命令就可安装: +在我的 Fedora 机器上,默认没有安装 `boxes` 程序,但它在我的普通仓库中可以获取到,所以用如下命令就可安装: ``` $ sudo dnf install boxes -y ``` -如果你在使用其他 Linux 发行版,一般也都可以在默认仓库中找到 boxes。 +如果你在使用其他 Linux 发行版,一般也都可以在默认仓库中找到 `boxes`。 -Boxes 是我真正希望在高中和大学计算机课程中就使用的实用程序,因为善意的老师要求我在每个源文件、函数、代码块等开头添加一些具体的评论信息。 +`boxes` 是我真正希望在高中和大学计算机课程中就使用的实用程序,因为善意的老师要求我在每个源文件、函数、代码块等开头添加一些特定外观的备注信息。 ``` /***************/ @@ -34,7 +36,7 @@ Boxes 是我真正希望在高中和大学计算机课程中就使用的实用 /***************/ ``` -事实证明,一旦你需要在框内添加几行文字,并且格式化的将它们统一风格就会变得很乏味。而 boxes 是一个简单实用程序,它使用 ASCII 艺术风格的字符形状框来包围文本。其字符形状默认风格是源代码注释风格,但也提供了一些其他选项。 +事实证明,一旦你需要在框内添加几行文字,并且格式化的将它们统一风格就会变得很乏味。而 `boxes` 是一个简单实用程序,它使用 ASCII 艺术风格的字符形状框来包围文本。其字符形状默认风格是源代码注释风格,但也提供了一些其他选项。 它真的很容易使用。使用管道,便可以将一个简短问候语塞进字符形状盒子里。 @@ -86,7 +88,7 @@ echo "I am a dog" | boxes -d dog -a c '---------------------------------------' ``` -Boxes 程序提供了[很多选项][1] 用于填充、定位甚至处理正则表达式。你可以在其 [项目主页][2] 上了解更多有关 boxes 的信息,或者转到 [GitHub][3] 去下载源代码或者贡献你自己的盒子形状。说到此,如果你正在寻找贡献的好点子,我已经有了一个想法:为什么不贡献一个节日礼物盒子? +`boxes` 程序提供了[很多选项][1] 用于填充、定位甚至处理正则表达式。你可以在其 [项目主页][2] 上了解更多有关 `boxes` 的信息,或者转到 [GitHub][3] 去下载源代码或者贡献你自己的盒子形状。说到此,如果你想给你的提交找个好点子,我已经有了一个想法:为什么不能是一个节日礼物盒子? ```          _  _ @@ -100,11 +102,11 @@ Boxes 程序提供了[很多选项][1] 用于填充、定位甚至处理正则 |____________________| ``` -Boxes 是基于 GPLv2 许可证的开源项目。 +`boxes` 是基于 GPLv2 许可证的开源项目。 -你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。即使要介绍的小玩具已经有 24 个了,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。即使要介绍的小玩具已经有 24 个了,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 -你可以通过[ Drive a locomotive through your Linux terminal][4] 来查看明天会介绍的命令行小玩具。 +你可以通过 [Drive a locomotive through your Linux terminal][4] 来查看明天会介绍的命令行小玩具。 -------------------------------------------------------------------------------- @@ -113,7 +115,7 @@ via: https://opensource.com/article/18/12/linux-toy-boxes 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[jrg](https://github.com/jrglinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 069ed6a2ae9b85f090b2d083320a815b23b955a0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 19:37:50 +0800 Subject: [PATCH 0133/4278] PUB:20181201 Boxing yourself in on the Linux command line.md @jrglinux https://linux.cn/article-10352-1.html --- .../20181201 Boxing yourself in on the Linux command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181201 Boxing yourself in on the Linux command line.md (98%) diff --git a/translated/tech/20181201 Boxing yourself in on the Linux command line.md b/published/20181201 Boxing yourself in on the Linux command line.md similarity index 98% rename from translated/tech/20181201 Boxing yourself in on the Linux command line.md rename to published/20181201 Boxing yourself in on the Linux command line.md index 1680a7ded8..657d7b8a31 100644 --- a/translated/tech/20181201 Boxing yourself in on the Linux command line.md +++ b/published/20181201 Boxing yourself in on the Linux command line.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (jrglinux) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Boxing yourself in on the Linux command line) [#]: via: (https://opensource.com/article/18/12/linux-toy-boxes) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10352-1.html) 神奇的 Linux 命令行字符形状工具 boxes ====== From 5165e663676f019cb539c3756264fc0b0679b7b2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 20:13:11 +0800 Subject: [PATCH 0134/4278] PRF:20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md @dianbanjiu --- ...ry Status And Level From Linux Terminal.md | 171 +++++++++--------- 1 file changed, 84 insertions(+), 87 deletions(-) diff --git a/translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md b/translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md index 7e4bff270a..52767b97d4 100644 --- a/translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md +++ b/translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md @@ -1,101 +1,99 @@ [#]: collector: (lujun9972) -[#]: translator: ( dianbanjiu ) -[#]: reviewer: ( ) +[#]: translator: (dianbanjiu) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 Ways To Check Laptop Battery Status And Level From Linux Terminal) [#]: via: (https://www.2daygeek.com/check-laptop-battery-status-and-charging-state-in-linux-terminal/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -从 Linux 终端查看笔记本电池状态等级的 5 个方法 +从 Linux 终端查看笔记本电池状态和等级的 5 个方法 ====== 我们可以轻松地通过图形化界面查看当前电量百分比、是否在充电以及当前电量还可以使用多长时间等电池状态,但是却无法查看电池健康度等相关信息。 在这篇文章就是为了解决这些问题。 -在 Linux 上有很多实用工具可以用命令行进行使用。 +在 Linux 上有很多这样的实用工具,而且可以在命令行使用。 这篇文章今天就要探讨这个主题,我会尽我所能的覆盖尽可能多的信息。 每月检查一次你的电池健康度是一个很好的想法。它可以帮你检查你当前遇到的问题是否与电池或者充电相关。 -同时,我们也可以查看电池模组名称、电源、出售商以及电池规格等。 +同时,我们也可以查看电池模组名称、电源、厂商以及电池规格等。 -电源管理是在非活跃状态时关闭电源或者切换系统的组件到低耗模式的一种功能。 +电源管理是在不使用时关闭电源或者切换系统的组件到低耗模式的一种功能。 ### 几种在 Linux 下检查电池状态的实用工具 - * `upower`: upower 是一个提供了接口来罗列系统中电源的命令行工具。 - * `acpi`: acpi显示来自 /proc 或者 /sys 文件中的一些信息,例如电池状态或者热量信息 - * `batstat`: batstat 是一个为 Linux 打印电池状态的命令行工具。 - * `tlp`: TLP 可以为你带来更高级的电源管理,而无需修改任何配置。 - * `class file`: 这个文件系统是一个提供了内核数据结构接口的伪文件系统。 - - +* `upower`:是一个命令行工具,其提供了罗列系统中电源的接口。 +* `acpi`:显示来自 `/proc` 或者 `/sys` 文件系统中的一些信息,例如电池状态或者热量信息。 +* `batstat`:是一个为 Linux 打印电池状态的命令行工具。 +* `tlp`:可以为你带来更高级的电源管理,而无需修改任何配置。 +* `class file`:这个 sysfs 文件系统是一个提供了内核数据结构接口的伪文件系统。 ### 如何使用 upower 命令检查笔记本电池状态 -[upower][1] 是一个提供了接口来罗列系统中电源的命令行工具。它在你的电脑上可以控制不同操作的延迟,这可以为你节省很大一部分电量。 +[upower][1] 是一个命令行工具,其提供了罗列系统中电源的接口。它在你的电脑上可以控制不同操作的延迟,这可以为你节省很大一部分电量。 只需要在 Linux 中运行以下命令获取电池以及它所依赖的其他信息。 ``` $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 - native-path: BAT0 - vendor: SMP - model: L14M4P23 - serial: 756 - power supply: yes - updated: Monday 03 December 2018 07:56:18 PM IST (95 seconds ago) - has history: yes - has statistics: yes - battery - present: yes - rechargeable: yes - state: discharging - warning-level: none - energy: 28.23 Wh - energy-empty: 0 Wh - energy-full: 52.26 Wh - energy-full-design: 60 Wh - energy-rate: 10.714 W - voltage: 14.819 V - time to empty: 2.6 hours - percentage: 54% - capacity: 87.1% - technology: lithium-ion - icon-name: 'battery-good-symbolic' - History (charge): - 1543847178 54.000 discharging - History (rate): - 1543847178 10.714 discharging + native-path: BAT0 + vendor: SMP + model: L14M4P23 + serial: 756 + power supply: yes + updated: Monday 03 December 2018 07:56:18 PM IST (95 seconds ago) + has history: yes + has statistics: yes + battery + present: yes + rechargeable: yes + state: discharging + warning-level: none + energy: 28.23 Wh + energy-empty: 0 Wh + energy-full: 52.26 Wh + energy-full-design: 60 Wh + energy-rate: 10.714 W + voltage: 14.819 V + time to empty: 2.6 hours + percentage: 54% + capacity: 87.1% + technology: lithium-ion + icon-name: 'battery-good-symbolic' + History (charge): + 1543847178 54.000 discharging + History (rate): + 1543847178 10.714 discharging ``` 使用下面的格式检查电池的特定信息。 ``` $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty" - state: discharging - time to empty: 2.1 hours - percentage: 43% + state: discharging + time to empty: 2.1 hours + percentage: 43% ``` -这个类似于上面的那个,但是充电线缆的插入就相当于一个令牌,这也就是为什么下面会显示正在充电状态的原因。 +这个类似于上面的那个,但是是在充电线缆的插入后运行,这也就是为什么下面会显示正在充电状态的原因。 ``` $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty" - state: charging - percentage: 41% + state: charging + percentage: 41% ``` ### 如何使用 TLP 命令检查笔记本电池状态 -TLP 是一个自由开源多功能的命令行工具,它可以优化笔记本电池而无需修改任何配置。 +TLP 是一个自由开源的多功能的命令行工具,它可以优化笔记本电池而无需修改任何配置。 TLP 可以为你的 Linux 带来更高级的电源管理,而无需理解任何技术细节。TLP 默认附带了一个已经为你的电池优化好的配置,所以你可以安装好后就不再管它了。尽管 TLP 是一个可以根据你的需求高度可定制的工具。 -TLP 在绝大多数 Linux 发行版,例如 Arch、Debian、Fedora、Gentoo、openSUSE等的官方库中都可用。使用你的 Linux 发行版的包管理安装 TLP 即可。 +TLP 在绝大多数 Linux 发行版,例如 Arch、Debian、Fedora、Gentoo、openSUSE 等的官方库中都可用。使用你的 Linux 发行版的包管理安装 TLP 即可。 只需要在 Linux 中运行以下命令获取电池以及其他所依赖的信息。 @@ -104,17 +102,17 @@ $ sudo tlp-stat -b --- TLP 1.1 -------------------------------------------- +++ Battery Status -/sys/class/power_supply/BAT0/manufacturer = SMP -/sys/class/power_supply/BAT0/model_name = L14M4P23 -/sys/class/power_supply/BAT0/cycle_count = (not supported) -/sys/class/power_supply/BAT0/energy_full_design = 60000 [mWh] -/sys/class/power_supply/BAT0/energy_full = 52260 [mWh] -/sys/class/power_supply/BAT0/energy_now = 21950 [mWh] -/sys/class/power_supply/BAT0/power_now = 10923 [mW] -/sys/class/power_supply/BAT0/status = Discharging +/sys/class/power_supply/BAT0/manufacturer = SMP +/sys/class/power_supply/BAT0/model_name = L14M4P23 +/sys/class/power_supply/BAT0/cycle_count = (not supported) +/sys/class/power_supply/BAT0/energy_full_design = 60000 [mWh] +/sys/class/power_supply/BAT0/energy_full = 52260 [mWh] +/sys/class/power_supply/BAT0/energy_now = 21950 [mWh] +/sys/class/power_supply/BAT0/power_now = 10923 [mW] +/sys/class/power_supply/BAT0/status = Discharging -Charge = 42.0 [%] -Capacity = 87.1 [%] +Charge = 42.0 [%] +Capacity = 87.1 [%] ``` 也可以查看其他的信息。 @@ -124,24 +122,23 @@ $ sudo tlp-stat -s --- TLP 1.1 -------------------------------------------- +++ System Info -System = LENOVO Lenovo ideapad Y700-15ISK 80NV -BIOS = CDCN35WW -Release = "Manjaro Linux" -Kernel = 4.19.6-1-MANJARO #1 SMP PREEMPT Sat Dec 1 12:21:26 UTC 2018 x86_64 -/proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-4.19-x86_64 root=UUID=69d9dd18-36be-4631-9ebb-78f05fe3217f rw quiet resume=UUID=a2092b92-af29-4760-8e68-7a201922573b -Init system = systemd -Boot mode = BIOS (CSM, Legacy) +System = LENOVO Lenovo ideapad Y700-15ISK 80NV +BIOS = CDCN35WW +Release = "Manjaro Linux" +Kernel = 4.19.6-1-MANJARO #1 SMP PREEMPT Sat Dec 1 12:21:26 UTC 2018 x86_64 +/proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-4.19-x86_64 root=UUID=69d9dd18-36be-4631-9ebb-78f05fe3217f rw quiet resume=UUID=a2092b92-af29-4760-8e68-7a201922573b +Init system = systemd +Boot mode = BIOS (CSM, Legacy) +++ TLP Status -State = enabled -Last run = 07:16:12 IST, 4362 sec(s) ago -Mode = battery -Power source = battery -``` +State = enabled +Last run = 07:16:12 IST, 4362 sec(s) ago +Mode = battery +Power source = battery``` ### 如何使用 ACPI 命令检查电池状态 -ACPI 代表高级配置和电源接口模块,它们是不同 ACPI 部件的内核模块。它们启用特殊的 ACPI 函数向 /proc 或者 /sys 中添加信息。这些信息可以通过事件或者其他监控程序的 acpid 进行解析。 +ACPI 代表高级配置和电源接口Advanced Configuration and Power Interface模块,它们是不同 ACPI 部件的内核模块。它们启用特殊的 ACPI 函数向 `/proc` 或者 `/sys` 中添加信息。这些信息可以通过事件或者其他监控程序的 acpid 进行解析。 ``` $ acpi @@ -179,25 +176,25 @@ Cooling 11: Processor 0 of 10 ### 如何使用 Batstat 命令查看笔记本电池状态 -batstat 是一个在 Linux 终端打印电池信息的命令行工具。 +`batstat` 是一个在 Linux 终端打印电池信息的命令行工具。 ``` -Status: Charging -Max energy: 50.00 Wh -Energy left: 24.50 Wh -Power Consumption: 26.40 W -Percentage left: 49.00% -Average power Consumption: 0.00 W -Time elapsed: 0: 0:12 since 49.00% -= Time ======== Percent ============================================ - 0: 0: 0 49.00% +Status: Charging +Max energy: 50.00 Wh +Energy left: 24.50 Wh +Power Consumption: 26.40 W +Percentage left: 49.00% +Average power Consumption: 0.00 W +Time elapsed: 0: 0:12 since 49.00% += Time ======== Percent ============================================ + 0: 0: 0 49.00% ``` ### 如何使用 sysfs 文件系统查看笔记本电池状态 sysfs 文件系统是一个提供了内核数据结构接口的伪文件系统。sysfs 下的文件提供有关设备、内核模块、文件系统和其他内核组件的信息。 -sysfs 文件系统通常挂载在 /sys。通常来说,它会被系统自动挂载,但是也可以使用例如 `mount -t sysfs sysfs /sys` 命令进行手动挂载。 +sysfs 文件系统通常挂载在 `/sys`。通常来说,它会被系统自动挂载,但是也可以使用例如 `mount -t sysfs sysfs /sys` 命令进行手动挂载。 在 sysfs 文件系统中的很多文件都是只读的,但也有一些是可写的,允许更改内核变量。为了避免冗余,符号链接被大量用于连接文件系统数中的条目。 @@ -216,7 +213,7 @@ L14M4P23 cat: /sys/class/power_supply/BAT0/power: Is a directory 27656000 1 - 756 + 756 Charging cat: /sys/class/power_supply/BAT0/subsystem: Is a directory Li-ion @@ -236,7 +233,7 @@ POWER_SUPPLY_CAPACITY=51 POWER_SUPPLY_CAPACITY_LEVEL=Normal POWER_SUPPLY_MODEL_NAME=L14M4P23 POWER_SUPPLY_MANUFACTURER=SMP -POWER_SUPPLY_SERIAL_NUMBER= 756 +POWER_SUPPLY_SERIAL_NUMBER= 756 14800000 15840000 ``` @@ -248,7 +245,7 @@ via: https://www.2daygeek.com/check-laptop-battery-status-and-charging-state-in- 作者:[Magesh Maruthamuthu][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 f8a8ed65781dcd4faf53247e767d27e9f55a6381 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 20:13:53 +0800 Subject: [PATCH 0135/4278] PUB:20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md @dianbanjiu https://linux.cn/article-10353-1.html --- ...eck Laptop Battery Status And Level From Linux Terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md (99%) diff --git a/translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md b/published/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md similarity index 99% rename from translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md rename to published/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md index 52767b97d4..dc7866eb07 100644 --- a/translated/tech/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md +++ b/published/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (dianbanjiu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10353-1.html) [#]: subject: (5 Ways To Check Laptop Battery Status And Level From Linux Terminal) [#]: via: (https://www.2daygeek.com/check-laptop-battery-status-and-charging-state-in-linux-terminal/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From e497d34784159ce9fd1eb8046f80724c2adce535 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 20:38:22 +0800 Subject: [PATCH 0136/4278] PRF:20181112 A Free Guide for Setting Your Open Source Strategy.md @geekpi --- ...e for Setting Your Open Source Strategy.md | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/translated/talk/20181112 A Free Guide for Setting Your Open Source Strategy.md b/translated/talk/20181112 A Free Guide for Setting Your Open Source Strategy.md index 16216c8a46..8647eea005 100644 --- a/translated/talk/20181112 A Free Guide for Setting Your Open Source Strategy.md +++ b/translated/talk/20181112 A Free Guide for Setting Your Open Source Strategy.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (A Free Guide for Setting Your Open Source Strategy) [#]: via: (https://www.linux.com/blog/2018/11/free-guide-setting-your-open-source-strategy) @@ -10,13 +10,15 @@ 制定开源战略的免费指南 ====== +> 了解如何使用 TODO Group 的成熟实践,使您的组织的开源软件目标与您的业务目标保持一致。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/os-strategy.jpg?itok=hSmtdJdK) -大多数使用开源的公司都了解其商业价值,但他们可能缺乏战略性地实施开源计划和获得全部回报的工具。根据 [The New Stack][1] 最近的一项调查,“开源计划的三大好处是1)提高了对开源的认识,2)提高了开发周期的速度和灵活性,以及 3)更好的许可证合规性“。 +大多数使用开源的公司都了解其商业价值,但他们可能缺乏战略性地实施开源计划和获得全部回报的工具。根据 [The New Stack][1] 最近的一项调查,“开源计划的三大好处是 1)提高了对开源的认识,2)提高了开发周期的速度和灵活性,以及 3)更好的许可证合规性。” -运营开源计划办公点涉及创建策略来帮助你定义和实施你的方法,并衡量你的进度。由 Linux 基金会与 TODO 集团合作开发的[企业开源指南][2]基于多年的经验和实践提供了专业开源知识。 +运作一个开源计划办公室涉及到创建策略来帮助你定义和实施你的方法,并衡量你的进度。由 Linux 基金会与 TODO Group 合作开发的[企业开源指南][2]基于多年的经验和实践提供了专业开源知识。 -最新的指南中,[设置开源战略][3]详细介绍了制定战略和确保成功之路的基本步骤。根据该指南,“你的开源战略将管理、参与和创建开源软件的计划与计划所服务的业务目标联系起来。这可以开辟许多机会并促进创新。“该指南涵盖以下主题: +最新的指南中,[设置开源战略][3]详细介绍了制定战略和确保成功之路的基本步骤。根据该指南,“你的开源战略将管理、参与和创建开源软件的计划与计划所服务的业务目标联系起来。这可以开辟许多机会并促进创新。”该指南涵盖以下主题: 1. 为什么制定战略? 2. 你的战略文件 @@ -26,9 +28,7 @@ 6. 确定投资回报率 7. 投资目标 - - -这里关键的第一步是创建和记录你的开源策略,该策略将“帮助你最大限度地提高组织从开源中获得的利益。”同时,你详细的策略可以帮助你避免因错误而导致的困难,例如:选择错误的许可证或不正确地维护代码。根据指南,该文件还可以: +这里关键的第一步是创建和将你的开源策略形成文字,该策略将“帮助你最大限度地提高组织从开源中获得的利益。”同时,你详细的策略可以帮助你避免因错误而导致的困难,例如:选择错误的许可证或不正确地维护代码。根据指南,该文件还可以: * 让领导者感到兴奋并参与 * 帮助在公司内获得支持 @@ -37,15 +37,13 @@ * 解释贵公司的开源方式和对其使用的支持 * 明确贵公司在社区驱动的外部研发中投资的地方,以及贵公司将重点放在增值差异化的地方 +Salesforce 的软件架构师兼本指南的撰稿人 Ian Varley 说:“在 Salesforce 内,我们有内部文件,我们将这些围绕开源战略指导和鼓励的文件分发给我们的工程团队。其中鼓励创建和使用开源,这让他们毫不含糊地知道公司的战略领导者完全支持它。此外,如果有某些我们不希望工程师使用的许可证或有其他开源指南,我们的内部文档需要明确。” - -Salesforce 的软件架构师兼指南的撰稿人 Ian Varley 说:“在 Salesforce 内,我们有内部文件,我们将这些围绕开源战略指导和鼓励的文件分发给我们的工程团队。其中鼓励创建和使用开源,这让他们毫不含糊地知道公司的战略领导者完全支持它。此外,如果有某些我们不希望工程师使用的许可证或有其他开源指南,我们的内部文档需要明确。“ - -开源计划有助于促进企业文化,使企业更高效,并且根据指南,强有力的战略文档可以“帮助你的团队了解开源计划背后的业务目标,确保更好的决策,并最大限度地降低风险“。 +开源计划有助于促进企业文化,使企业更高效,并且根据指南,强有力的战略文档可以“帮助你的团队了解开源计划背后的业务目标,确保更好的决策,并最大限度地降低风险。” 了解如何使用[设置开源策略][3]新指南中的提示和经过验证的实践,将管理和创建开源软件的目标与组织的业务目标保持一致。然后,查看所有 12 个[企业开源指南][2],了解有关使用开源获得成功的更多信息。 -本文最初发表在 [Linux基金会][4] +本文最初发表在 [Linux基金会][4]。 -------------------------------------------------------------------------------- @@ -54,7 +52,7 @@ via: https://www.linux.com/blog/2018/11/free-guide-setting-your-open-source-stra 作者:[Amber Ankerholz][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/) 荣誉推出 @@ -63,4 +61,4 @@ via: https://www.linux.com/blog/2018/11/free-guide-setting-your-open-source-stra [1]: https://thenewstack.io/open-source-culture-starts-with-programs-and-policies/ [2]: https://www.linuxfoundation.org/resources/open-source-guides/ [3]: https://www.linuxfoundation.org/resources/open-source-guides/setting-an-open-source-strategy/ -[4]: https://www.linuxfoundation.org/blog/2018/11/a-free-guide-for-setting-your-open-source-strategy/ \ No newline at end of file +[4]: https://www.linuxfoundation.org/blog/2018/11/a-free-guide-for-setting-your-open-source-strategy/ From 387752f580cd3f2c74756306dc2e67ca65a02364 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 16 Dec 2018 20:39:09 +0800 Subject: [PATCH 0137/4278] PUB:20181112 A Free Guide for Setting Your Open Source Strategy.md @geekpi https://linux.cn/article-10354-1.html --- ...1112 A Free Guide for Setting Your Open Source Strategy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20181112 A Free Guide for Setting Your Open Source Strategy.md (98%) diff --git a/translated/talk/20181112 A Free Guide for Setting Your Open Source Strategy.md b/published/20181112 A Free Guide for Setting Your Open Source Strategy.md similarity index 98% rename from translated/talk/20181112 A Free Guide for Setting Your Open Source Strategy.md rename to published/20181112 A Free Guide for Setting Your Open Source Strategy.md index 8647eea005..6e203f72a1 100644 --- a/translated/talk/20181112 A Free Guide for Setting Your Open Source Strategy.md +++ b/published/20181112 A Free Guide for Setting Your Open Source Strategy.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (A Free Guide for Setting Your Open Source Strategy) [#]: via: (https://www.linux.com/blog/2018/11/free-guide-setting-your-open-source-strategy) [#]: author: ([Amber Ankerholz](https://www.linux.com/users/aankerholz) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10354-1.html) 制定开源战略的免费指南 ====== From 5e3f99e481760a3087feb930074e0b2ac65c9227 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 16 Dec 2018 20:46:12 +0800 Subject: [PATCH 0138/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=902?= =?UTF-8?q?0180710=20Users,=20Groups,=20and=20Other=20Linux=20Beasts.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 Users, Groups, and Other Linux Beasts.md | 155 ------------------ ...0 Users, Groups, and Other Linux Beasts.md | 139 ++++++++++++++++ 2 files changed, 139 insertions(+), 155 deletions(-) delete mode 100644 sources/tech/20180710 Users, Groups, and Other Linux Beasts.md create mode 100644 translated/tech/20180710 Users, Groups, and Other Linux Beasts.md diff --git a/sources/tech/20180710 Users, Groups, and Other Linux Beasts.md b/sources/tech/20180710 Users, Groups, and Other Linux Beasts.md deleted file mode 100644 index ad5be702d8..0000000000 --- a/sources/tech/20180710 Users, Groups, and Other Linux Beasts.md +++ /dev/null @@ -1,155 +0,0 @@ -Translating by MjSeven - -Users, Groups, and Other Linux Beasts -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/flamingo-2458782_1920.jpg?itok=_gkzGGx5) - -Having reached this stage, [after seeing how to manipulate folders/directories][1], but before flinging ourselves headlong into fiddling with files, we have to brush up on the matter of _permissions_ , _users_ and _groups_. Luckily, [there is already an excellent and comprehensive tutorial on this site that covers permissions][2], so you should go and read that right now. In a nutshell: you use permissions to establish who can do stuff to files and directories and what they can do with each file and directory -- read from it, write to it, move it, erase it, etc. - -To try everything this tutorial covers, you'll need to create a new user on your system. Let's be practical and make a user for anybody who needs to borrow your computer, that is, what we call a _guest account_. - -**WARNING:** _Creating and especially deleting users, along with home directories, can seriously damage your system if, for example, you remove your own user and files by mistake. You may want to practice on another machine which is not your main work machine or on a virtual machine. Regardless of whether you want to play it safe, or not, it is always a good idea to back up your stuff frequently, check the backups have worked correctly, and save yourself a lot of gnashing of teeth later on._ - -### A New User - -You can create a new user with the `useradd` command. Run `useradd` with superuser/root privileges, that is using `sudo` or `su`, depending on your system, you can do: -``` -sudo useradd -m guest - -``` - -... and input your password. Or do: -``` -su -c "useradd -m guest" - -``` - -... and input the password of root/the superuser. - -( _For the sake of brevity, we'll assume from now on that you get superuser/root privileges by using`sudo`_ ). - -By including the `-m` argument, `useradd` will create a home directory for the new user. You can see its contents by listing _/home/guest_. - -Next you can set up a password for the new user with -``` -sudo passwd guest - -``` - -Or you could also use `adduser`, which is interactive and asks you a bunch of questions, including what shell you want to assign the user (yes, there are more than one), where you want their home directory to be, what groups you want them to belong to (more about that in a second) and so on. At the end of running `adduser`, you get to set the password. Note that `adduser` is not installed by default on many distributions, while `useradd` is. - -Incidentally, you can get rid of a user with `userdel`: -``` -sudo userdel -r guest - -``` - -With the `-r` option, `userdel` not only removes the _guest_ user, but also deletes their home directory and removes their entry in the mailing spool, if they had one. - -### Skeletons at Home - -Talking of users' home directories, depending on what distro you're on, you may have noticed that when you use the `-m` option, `useradd` populates a user's directory with subdirectories for music, documents, and whatnot as well as an assortment of hidden files. To see everything in you guest's home directory run `sudo ls -la /home/guest`. - -What goes into a new user's directory is determined by a skeleton directory which is usually _/etc/skel_. Sometimes it may be a different directory, though. To check which directory is being used, run: -``` -useradd -D -GROUP=100 -HOME=/home -INACTIVE=-1 -EXPIRE= -SHELL=/bin/bash -SKEL=/etc/skel -CREATE_MAIL_SPOOL=no - -``` - -This gives you some extra interesting information, but what you're interested in right now is the `SKEL=/etc/skel` line. In this case, and as is customary, it is pointing to _/etc/skel/_. - -As everything is customizable in Linux, you can, of course, change what gets put into a newly created user directory. Try this: Create a new directory in _/etc/skel/_ : -``` -sudo mkdir /etc/skel/Documents - -``` - -And create a file containing a welcome text and copy it over: -``` -sudo cp welcome.txt /etc/skel/Documents - -``` - -Now delete the guest account: -``` -sudo userdel -r guest - -``` - -And create it again: -``` -sudo useradd -m guest - -``` - -Hey presto! Your _Documents/_ directory and _welcome.txt_ file magically appear in the guest's home directory. - -You can also modify other things when you create a user by editing _/etc/default/useradd_. Mine looks like this: -``` -GROUP=users -HOME=/home -INACTIVE=-1 -EXPIRE= -SHELL=/bin/bash -SKEL=/etc/skel -CREATE_MAIL_SPOOL=no - -``` - -Most of these options are self-explanatory, but let's take a closer look at the `GROUP` option. - -### Herd Mentality - -Instead of assigning permissions and privileges to users one by one, Linux and other Unix-like operating systems rely on _groups_. A group is a what you imagine it to be: a bunch of users that are related in some way. On your system you may have a group of users that are allowed to use the printer. They would belong to the _lp_ (for " _line printer_ ") group. The members of the _wheel_ group were traditionally the only ones who could become superuser/root by using _su_. The _network_ group of users can bring up and power down the network. And so on and so forth. - -Different distributions have different groups and groups with the same or similar names have different privileges also depending on the distribution you are using. So don't be surprised if what you read in the prior paragraph doesn't match what is going on in your system. - -Either way, to see which groups are on your system you can use: -``` -getent group - -``` - -The `getent` command lists the contents of some of the system's databases. - -To find out which groups your current user belongs to, try: -``` -groups - -``` - -When you create a new user with `useradd`, unless you specify otherwise, the user will only belong to one group: their own. A _guest_ user will belong to a _guest_ group and the group gives the user the power to administer their own stuff and that is about it. - -You can create new groups and then add users to them at will with the `groupadd` command: -``` -sudo groupadd photos - -``` - -will create the _photos_ group, for example. Next time, we’ll use this to build a shared directory all members of the group can read from and write to, and we'll learn even more about permissions and privileges. Stay tuned! - -Learn more about Linux through the free ["Introduction to Linux" ][3]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts - -作者:[Paul Brown][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://www.linux.com/users/bro66 -[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux -[2]:https://www.linux.com/learn/understanding-linux-file-permissions -[3]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20180710 Users, Groups, and Other Linux Beasts.md b/translated/tech/20180710 Users, Groups, and Other Linux Beasts.md new file mode 100644 index 0000000000..477d317d9f --- /dev/null +++ b/translated/tech/20180710 Users, Groups, and Other Linux Beasts.md @@ -0,0 +1,139 @@ +用户,组和其他 Linux 用户 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/flamingo-2458782_1920.jpg?itok=_gkzGGx5) + +到这个阶段,[在看到如何操作目录或文件夹之后][1],但在让自己一头扎进文件之前,我们必须重新审视 _权限_, _users_ 和 _group_。幸运的是,[有一个网站上已经有了一个优秀而全面的教程,包括了权限][2],所以你应该去立刻阅读它。简而言之,你使用权限来确定谁可以对文件和目录执行操作,以及他们可以对每个文件和目录执行什么操作 -- 从中读取,写入,擦除等等。 + +要尝试本教程涵盖的所有内容,你需要在系统上创建新用户。让我们实践起来,为每一个需要借用你电脑的人创建一个用户,我们称之为 _guest 账户_。 + +**警告:** _例如,如果你错误地删除了自己的用户和目录,那么创建,特别是删除用户以及主目录会严重损坏系统。你可能不想在你日常的工作机中练习,那么请在另一台机器或者虚拟机上练习。无论你是否想要安全地练习,经常备份你的东西总是一个好主意。检查备份是否正常工作,为你自己以后避免很多咬牙切齿的事情。_ + +### 一个新用户 + +你可以使用 `useradd` 命令来创建一个新用户。使用超级用户或 root 权限运行 `useradd`,即使用 `sudo` 或 `su`,这具体取决于你的系统,你可以: +``` +sudo useradd -m guest +``` + +然后输入你的密码。或者也可以这样: +``` +su -c "useradd -m guest" +``` + +然后输入 root 或超级用户的密码。 + +(_为了简洁起见,我们将从现在开始假设你使用 `sudo` 获得超级用户或 root 权限。_) + +通过使用 `-m` 参数,`useradd` 将为新用户创建一个主目录。你可以通过列出 _/home/guest_ 来查看其内容。 + +然后你可以使用以下命令来为新用户设置密码: +``` +sudo passwd guest +``` + +或者你也可以使用 `adduser`,这是一个交互式的命令,它会询问你一些问题,包括你要为用户分配的 shell(是的,不止一个),你希望其主目录在哪里,你希望他们属于哪些组(有关这点稍后会讲到)等等。在运行 `adduser` 结束时,你可以设置密码。注意,默认情况下,在许多发行版中都没有安装 `adduser`,但安装了 `useradd`。 + +顺便说一下,你可以使用 `userdel` 来移除一个用户: +``` +sudo userdel -r guest +``` + +使用 `-r` 选项,`userdel` 不仅删除了 _guest_ 用户,还删除了他们的主目录和邮件中的条目(如果有的话)。 + +### home 中的内容 + +谈到用户的主目录,它依赖于你所使用的发行版。你可能已经注意到,当你使用 `-m` 选项时,`useradd` 使用子目录填充用户的目录,包括音乐,文档和诸如此类的内容以及各种各样的隐藏文件。要查看 guest 主目录中的所有内容,运行 `sudo ls -la /home/guest`。 + +进入新用户目录的内容通常是由 _/etc/skel_ 架构目录确定的。有时它可能是一个不同的目录。要检查正在使用的目录,运行: +``` +useradd -D +GROUP=100 +HOME=/home +INACTIVE=-1 +EXPIRE= +SHELL=/bin/bash +SKEL=/etc/skel +CREATE_MAIL_SPOOL=no +``` + +这给你一些额外的有趣信息,但你现在感兴趣的是 `SKEL=/etc/skel` 这一行,在这种情况下,按照惯例,它指向 _/etc/skel/_。 + +由于 Linux 中的所有东西都是可定制的,因此你可以更改那些放入新创建的用户目录的内容。试试这样做:在 _/etc/skel/_ 中创建一个新目录: +``` +sudo mkdir /etc/skel/Documents +``` + +然后创建一个包含欢迎消息的文件,并将其复制过来: +``` +sudo cp welcome.txt /etc/skel/Documents +``` + +现在删除 guest 账户: +``` +sudo userdel -r guest +``` + +再次创建: +``` +sudo useradd -m guest +``` + +嘿 presto!(to 校正:这个 presto 是什么?)你的 _Documents/_ 目录和 _welcome.txt_ 文件神奇地出现在了 guest 的主目录中。 + +你还可以在创建用户时通过编辑 _/etc/default/useradd_ 来修改其他内容。我的看起来像这样: +``` +GROUP=users +HOME=/home +INACTIVE=-1 +EXPIRE= +SHELL=/bin/bash +SKEL=/etc/skel +CREATE_MAIL_SPOOL=no +``` + +这些选项大多数都是不言自明的,但让我们仔细看看 `GROUP` 选项。 + +### 群组心态 + +Linux 和其他类 Unix 操作系统依赖于 _groups_,而不是逐个为用户分配权限和特权。一个组就是你想象的那样:一群在某种程度上相关的用户。在你的系统上可能有一组允许使用打印机的用户,他们属于 _lp_(即 "_line printer_")组。传统上 _wheel_ 组的成员是唯一可以通过使用 _su_ 成为超级用户或 root 的成员。_network_ 用户组可以启动或关闭网络。还有许多诸如此类的。 + +不同的发行版有不同的组,具有相同或相似名称的组具有不同的权限,这也取决于你使用的发行版。因此,如果你在前一段中读到的内容与你系统中的内容不匹配,不要感到惊讶。 + +不管怎样g,要查看系统中有哪些组,你可以使用: +``` +getent group +``` + +`getent` 命令列出了某些系统数据库的内容。 + +要查找当前用户所属的组,尝试: +``` +groups +``` + +当你使用 `useradd` 创建新用户时,除非你另行指定,否则用户讲只属于一个组:他们自己。一个 _guest_ 用户属于 _guest_ 组。组使用户有权管理自己的东西,仅此而已。 + +你可以使用 `groupadd` 命令创建新组,然后添加用户: +``` +sudo groupadd photos +``` + +例如,这将创建 _photos_ 组。下一次,我们将使用它来构建一个共享目录,该组的所有成员都可以读取和写入,我们将更多地了解权限和特权。敬请关注! + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts + +作者:[Paul Brown][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/bro66 +[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux +[2]:https://www.linux.com/learn/understanding-linux-file-permissions +[3]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 65332a0e14804a34eacaea874afc64506ce0ec3b Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 17 Dec 2018 08:59:20 +0800 Subject: [PATCH 0139/4278] translated --- ...arch Or Find Files And Folders in Linux.md | 153 ------------------ ...arch Or Find Files And Folders in Linux.md | 153 ++++++++++++++++++ 2 files changed, 153 insertions(+), 153 deletions(-) delete mode 100644 sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md create mode 100644 translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md diff --git a/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md b/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md deleted file mode 100644 index f28649013b..0000000000 --- a/sources/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md +++ /dev/null @@ -1,153 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Four Easy Ways to Search Or Find Files And Folders in Linux) -[#]: via: (https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/) -[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) - -Four Easy Ways to Search Or Find Files And Folders in Linux -====== - -Linux admins can’t able to leave a day without performing a file search as this one of the activity for their routine. - -It’s good to know all the file search stuffs because it would help you in many ways when you are working on headless server. - -These commands are not complicate to remember because these are using a standard syntax. - -This can be performed through Four Linux commands and each command has their own unique feature. - -### Method-1: Search Files And Folders in Linux Using find Command - -Find command is widely used and very famous command to search files and folders in Linux. It searches given files in the current directory and recursively through its sub-directories based on the search criteria. - -It allow users to perform all kind of file searches based on the criteria lie by size, name, owner, group, type, permissions, date, and other criteria. - -Run the following command to find a given file in system. - -``` -# find / -iname "sshd_config" -/etc/ssh/sshd_config -``` - -Run the following command to find a given folder in system. To search a folder in Linux we need to use `-type` parameter. - -``` -# find / -type d -iname "ssh" -/usr/lib/ssh -/usr/lib/go/src/cmd/vendor/golang.org/x/crypto/ssh -/usr/lib/go/pkg/linux_amd64/cmd/vendor/golang.org/x/crypto/ssh -/etc/ssh -``` - -Use wildcard option to search set of files on your system. We are going to search all files available in the system with `.config` extension. - -``` -# find / -name "*.config" -/usr/lib/mono/gac/avahi-sharp/1.0.0.0__4d116c78973743f5/avahi-sharp.dll.config -/usr/lib/mono/gac/avahi-ui-sharp/0.0.0.0__4d116c78973743f5/avahi-ui-sharp.dll.config -/usr/lib/python2.7/config/Setup.config -/usr/share/git/mw-to-git/t/test.config -/var/lib/lightdm/.config -/home/daygeek/.config -/root/.config -/etc/skel/.config -``` - -Use the following command format to find an empty files and folders in system. - -``` -# find / -empty -``` - -Use the following command combination to find all files containing specific text on Linux. - -``` -# find / -type f -exec grep "Port 22" '{}' \; -print -# find / -type f -print | xargs grep "Port 22" -# find / -type f | xargs grep 'Port 22' -# find / -type f -exec grep -H 'Port 22' {} \; -``` - -### Method-2: Search Files And Folders in Linux Using locate command - -locate command works faster than the find command because it uses updatedb database, whereas the find command searches in the real system. - -It uses a database rather than hunting individual directory paths to get a given file. - -locate command doesn’t pre-installed in most of the distributions so, use your distribution package manager to install it. - -The database is updated regularly through cron, however we can manually update it by running the following command. - -``` -$ sudo updatedb -``` - -Simply run the following command to list the given file or folder. There is no specific options need to be specified in locate command to print file or folder. - -To search `ssh` folder in system. - -``` -# locate --basename '\ssh' -/etc/ssh -/usr/bin/ssh -/usr/lib/ssh -/usr/lib/go/pkg/linux_amd64/cmd/vendor/golang.org/x/crypto/ssh -/usr/lib/go/src/cmd/go/testdata/failssh/ssh -/usr/lib/go/src/cmd/vendor/golang.org/x/crypto/ssh -``` - -To search `ssh_config` file in system. - -``` -# locate --basename '\sshd_config' -/etc/ssh/sshd_config -``` - -### Method-3: Search Files in Linux Using which command - -TThe which command returns the full path of the executable that would have been executed when the command had been entered in terminal. - -It’s very useful when you want to create a desktop shortcut or symbolic link for executable files. - -Which command searches the directories listed in the current user’s PATH environment variable not for all the users. I mean, when you are logged in your own account and you can’t able to search for root user file or directory. - -Run the following command to print the full path of the vim executable file location. - -``` -# which vi -/usr/bin/vi -``` - -Alternatively, it’s allowing user to perform multiple file search in one shot. - -``` -# which -a vi sudo -/usr/bin/vi -/bin/vi -/usr/bin/sudo -/bin/sudo -``` - -### Method-4: Search Files in Linux Using whereis command - -The whereis command used to search the binary, source, and man page files for a given command. - -``` -# whereis vi -vi: /usr/bin/vi /usr/share/man/man1/vi.1p.gz /usr/share/man/man1/vi.1.gz -``` --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/ - -作者:[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/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md b/translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md new file mode 100644 index 0000000000..a95aef6e7d --- /dev/null +++ b/translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Four Easy Ways to Search Or Find Files And Folders in Linux) +[#]: via: (https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +四种简单的方法来搜索或查找 Linux 中的文件和文件夹 +====== + +Linux 管理员一天都不能离开搜索文件,因为这是他们的日常活动。 + +了解一些搜索的东西是不错的,因为这能帮助你在命令行服务器中工作。 + +这些命令记忆起来不复杂,因为它们使用的是标准语法。 + +这里执行四个 Linux 命令,每个命令都有自己独特的功能。 + +### 方法 1:使用 find 命令在 Linux 中搜索文件和文件夹 + +find 命令被广泛使用,并且是非常著名的在 Linux 中搜索文件和文件夹的命令。它搜索当前目录中的给定文件,并根据搜索条件递归遍历其子目录。 + +它允许用户根据大小、名称、所有者、组、类型、权限、日期和其他条件执行所有类型的文件搜索。 + +运行以下命令以在系统中查找给定文件。 + +``` +# find / -iname "sshd_config" +/etc/ssh/sshd_config +``` + +运行以下命令以查找系统中的给定文件夹。要在 Linux 中搜索文件夹,我们需要使用 `-type` 参数。 + +``` +# find / -type d -iname "ssh" +/usr/lib/ssh +/usr/lib/go/src/cmd/vendor/golang.org/x/crypto/ssh +/usr/lib/go/pkg/linux_amd64/cmd/vendor/golang.org/x/crypto/ssh +/etc/ssh +``` + +使用通配符搜索系统上的所有文件。我们将搜索系统中所有以 `.config` 为扩展名的文件。 + +``` +# find / -name "*.config" +/usr/lib/mono/gac/avahi-sharp/1.0.0.0__4d116c78973743f5/avahi-sharp.dll.config +/usr/lib/mono/gac/avahi-ui-sharp/0.0.0.0__4d116c78973743f5/avahi-ui-sharp.dll.config +/usr/lib/python2.7/config/Setup.config +/usr/share/git/mw-to-git/t/test.config +/var/lib/lightdm/.config +/home/daygeek/.config +/root/.config +/etc/skel/.config +``` + +使用以下命令格式在系统中查找空文件和文件夹。 + +``` +# find / -empty +``` + +使用以下命令组合查找 Linux 上包含特定文本的所有文件。 + +``` +# find / -type f -exec grep "Port 22" '{}' \; -print +# find / -type f -print | xargs grep "Port 22" +# find / -type f | xargs grep 'Port 22' +# find / -type f -exec grep -H 'Port 22' {} \; +``` + +### 方法 2:使用 locate 命令在 Linux 中搜索文件和文件夹 + +locate 命令比 find 命令运行得更快,因为它使用 updatedb 数据库,而 find 命令在真实系统中搜索。 + +它使用数据库而不是搜索单个目录路径来获取给定文件。 + +locate 命令未在大多数发行版中预安装,因此,请使用你的包管理器进行安装。 + +数据库通过 cron 定期更新,但我们可以通过运行以下命令手动更新它。 + +``` +$ sudo updatedb +``` + +只需运行以下命令即可列出给定的文件或文件夹。在 locate 命令中不需要指定特定选项来打印文件或文件夹。 + +在系统中搜索 `ssh` 文件夹。 + +``` +# locate --basename '\ssh' +/etc/ssh +/usr/bin/ssh +/usr/lib/ssh +/usr/lib/go/pkg/linux_amd64/cmd/vendor/golang.org/x/crypto/ssh +/usr/lib/go/src/cmd/go/testdata/failssh/ssh +/usr/lib/go/src/cmd/vendor/golang.org/x/crypto/ssh +``` + +在系统中搜索 `ssh_config` 文件。 + +``` +# locate --basename '\sshd_config' +/etc/ssh/sshd_config +``` + +### 方法 3:在 Linux 中搜索文件使用 which 命令 + +which 返回在终端输入命令时执行的可执行文件的完整路径。 + +当你想要为可执行文件创建桌面快捷方式或符号链接时,它非常有用。 + +which 命令搜索当前用户而不是所有用户的 PATH 环境变量中列出的目录。我的意思是,当你登录自己的帐户时,你无法搜索 root 用户文件或目录。 + +运行以下命令以打印 vim 可执行文件的完整路径。 + +``` +# which vi +/usr/bin/vi +``` + +或者,它允许用户一次执行多个文件搜索。 + +``` +# which -a vi sudo +/usr/bin/vi +/bin/vi +/usr/bin/sudo +/bin/sudo +``` + +### 方法 4:使用 whereis 命令在 Linux 中搜索文件 + +whereis 命令用于搜索给定命令的二进制、源码和手册页文件。 + +``` +# whereis vi +vi: /usr/bin/vi /usr/share/man/man1/vi.1p.gz /usr/share/man/man1/vi.1.gz +``` +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/ + +作者:[Prakash Subramanian][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/prakash/ +[b]: https://github.com/lujun9972 \ No newline at end of file From 2e26f45a24fd7fb8f1bd689660bcf1f7d2197e7e Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 17 Dec 2018 09:09:27 +0800 Subject: [PATCH 0140/4278] translating --- .../20181212 Patch into The Matrix at the Linux command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181212 Patch into The Matrix at the Linux command line.md b/sources/tech/20181212 Patch into The Matrix at the Linux command line.md index c07e71fc28..108fb7c97d 100644 --- a/sources/tech/20181212 Patch into The Matrix at the Linux command line.md +++ b/sources/tech/20181212 Patch into The Matrix at the Linux command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 909d8ba98d018e2b1ae0b33d07037af119ba6d30 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 10:22:00 +0800 Subject: [PATCH 0141/4278] Update README.md --- README.md | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f1e0cec6c1..6590da83cb 100644 --- a/README.md +++ b/README.md @@ -15,30 +15,26 @@ LCTT 已经拥有几百名活跃成员,并欢迎更多的 Linux 志愿者加入我们的团队。 -![logo](https://linux.cn/static/image/common/lctt_logo.png) +![LCTT](https://lctt.github.io/wiki/images/lctt_logo.png) -LCTT 的组成 -------------------------------- - -**选题**,负责选择合适的内容,并将原文转换为 markdown 格式,提交到 LCTT 的 [TranslateProject](https://github.com/LCTT/TranslateProject) 库中。 - -**译者**,负责从选题中选择内容进行翻译。 - -**校对**,负责将初译的文章进行文字润色、技术校对等工作。 - -**发布**,负责将校对后的文章,排版进行发布。 +- LCTT 官网: [https://linux.cn/lctt/](https://linux.cn/lctt/) +- LCTT 状态: [https://lctt.github.io/](https://lctt.github.io/) 加入我们 ------------------------------- -请首先加入翻译组的 QQ 群,群号是:**198889102**,加群时请说明是“*志愿者*”。加入后记得修改您的群名片为您的 GitHub 的 ID。 +请首先加入翻译组的 QQ 群,群号是:**198889102**,加群时请说明是“*志愿者*”。 -加入的成员,请先阅读 [WIKI 如何开始](https://github.com/LCTT/TranslateProject/wiki/01-如何开始)。 +加入的成员,请: + +1. 修改你的 QQ 群名片为“译者-您的_GitHub_ID”。 +2. 阅读 [WIKI](http://lctt.github.io/wiki) 了解如何开始。 +3. 遇到不解之处,请在群内发问。 如何开始 ------------------------------- -请阅读 [WIKI](https://github.com/LCTT/TranslateProject/wiki)。如需要协助,请在群内发问。 +请阅读 [WIKI](http://lctt.github.io/wiki)。如需要协助,请在群内发问。 历史 ------------------------------- From 6e2fd557f6c412e021bc476ec8326faaeeb4a2cc Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 17 Dec 2018 13:37:28 +0800 Subject: [PATCH 0142/4278] Translating How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md new file mode 100644 index 0000000000..3a4332c365 --- /dev/null +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) +[#]: via: (https://itsfoss.com/update-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何更新Ubuntu [终端及GUI方式] It's FOSS +====== + +**这篇教程将向你展示如何更新服务器版本或者桌面版本的Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于Ubuntu Linux中的更新的一些其他内容。** + +如果你是一个新手并已经体验Ubuntu数天或几周,你可能想知道如何更新你的[Ubuntu][1]系统以获取安全补丁,错误修复和应用升级。 + +更新 Ubuntu 非常简单。我并不夸张的说。它简单得只要运行两个命令。让我来告诉你更多更新细节。 + +Please note that the tutorial is valid for Ubuntu 18.04, 16.04 or any other version. The command line way is also valid for Ubuntu-based distributions like Linux Mint, Linux Lite, elementary OS etc. + +### Update Ubuntu via Command Line + +![How to Update Ubuntu][2] + +On the desktop, open the terminal. You can find it in the menu or use the Ctrl+Alt+T [keyboard shortcut][3]. If you are logged on to an [Ubuntu server][4], you already have access to a terminal. + +In the terminal, you just have to use the following command: + +``` +sudo apt update && sudo apt upgrade -y +``` + +It will ask for password and you can use your account’s password. You won’t see the anything on the screen while typing so keep on typing your password and hit enter. + +Now let me explain the above command. + +Actually, it’s not a single command. It’s a combination of two commands. The && is a way to combine two commands in a way that the second command runs only when the previous command ran successfully. + +The ‘-y’ in the end automatically enters yes when the command ‘apt upgrade’ ask for your confirmation before installing the updates. + +Note that you can also use the two commands separately, one by one: + +``` +sudo apt update +sudo apt upgrade +``` + +It will take a little longer because you have to wait for one command to finish and then enter the second command. + +#### Explanation: sudo apt update + +This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. + +This is why when you run the sudo apt update, you’ll see lots of URLs in the output. The command fetches the package information from the respective repositories (the URLs you see in the output). + +![Updating Ubuntu Linux][5] + +At the end of the command, it tells you how many packages can be upgraded. You can see these packages by running the following command: + +``` +apt list --upgradable +``` + +**Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. + +#### Explanation: sudo apt upgrade + +This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). + +![Update Ubuntu Linux via Command Line][7] + +You can type ‘yes’, ‘y’ or just press enter to confirm the installation of updates. + +So the bottom line is that the sudo apt update checks for the availability of new versions while as the sudo apt upgrade actually performs the update. + +The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. + +### Update Ubuntu via GUI [For Desktop Users] + +If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. + +In the menu, look for ‘Software Updater’ and run it. + +![Run Software Updater in Ubuntu][8] + +It will check if there are updates available for your system. + +![Checking if updates are available for Ubuntu][9] + +If there are updates available, it will give provide you with options to install the updates. + +![Install Updates via Update Manager in Ubuntu][10] + +Click on Install Now, it may ask for your password. + +![Installing Updates in Ubuntu Linux via GUI][11] + +Once you enter your password, it will start installing the updates. + +![Updating Ubuntu via GUI][12] + +In some cases, you may need to reboot the system for the installed updates to work properly. You’ll be notified at the end of the update if you need to restart the system. + +![Updating Ubuntu via GUI][12] + +You can choose to restart later if you don’t want to reboot your system straightaway. + +![Installing updates via GUI in Ubuntu][13] + +Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. + +### Few things to keep in mind abou updating Ubuntu + +You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. + +#### Clean up after an update + +Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: + +``` +sudo apt autoremove +``` + +#### Live patching kernel in Ubuntu Server to avoid rebooting + +In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. + +[Live patching][15] feature allows the patching of Linux kernel while the kernel is still running. In other words, you don’t have to reboot your system. + +If you manage servers, you may want to [enable live patching in Ubuntu][16]. + +#### Version upgrades are different + +The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). + +[Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. + +### Conclusion + +I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. + +If you have any questions, please fee free to ask. If you are an experienced Linux users and have some tip that can make this tutorial more useful, please share it with the rest of us. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/update-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://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/how-to-update-ubuntu.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/ubuntu-shortcuts/ +[4]: https://www.ubuntu.com/download/server +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-1.jpeg?resize=800%2C357&ssl=1 +[6]: https://itsfoss.com/apt-get-linux-guide/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-2.jpeg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-1.jpeg?resize=800%2C250&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-2.jpeg?resize=800%2C250&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-GUI-3.jpeg?resize=800%2C365&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/install-update-ubuntu-1.jpg?resize=800%2C450&ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu-2.jpeg?ssl=1 +[14]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[15]: https://www.ubuntu.com/livepatch +[16]: https://www.cyberciti.biz/faq/howto-live-patch-ubuntu-linux-server-kernel-without-rebooting/ +[17]: https://itsfoss.com/upgrade-ubuntu-version/ +[18]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ From 133c99a824e911cad0a304b298687ad76d72b28a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 13:44:18 +0800 Subject: [PATCH 0143/4278] Update 20171129 TLDR pages Simplified Alternative To Linux Man Pages.md --- ...71129 TLDR pages Simplified Alternative To Linux Man Pages.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md index afa981df46..749f2647dc 100644 --- a/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md +++ b/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md @@ -1,3 +1,4 @@ +wxy is translating TLDR pages: Simplified Alternative To Linux Man Pages ============================================================ From da9c6f228a5347e1257997bd07548d2b99df18b8 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Mon, 17 Dec 2018 14:20:48 +0800 Subject: [PATCH 0144/4278] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=20=2020180826=20How=20to=20Install=20and=20Use=20FreeDOS=20on?= =?UTF-8?q?=20VirtualBox.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 20180826 How to Install and Use FreeDOS on VirtualBox.md --- .../20180826 How to Install and Use FreeDOS on VirtualBox.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md index 8ba7db5139..f6d36e718b 100644 --- a/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md +++ b/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md @@ -1,3 +1,5 @@ +WangYueScream Tanslating +--------------- How to Install and Use FreeDOS on VirtualBox ====== This step-by-step guide shows you how to install FreeDOS on VirtualBox in Linux. From 30c0fdd0aded2040b298a06839573fdaec6f03c0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 15:05:10 +0800 Subject: [PATCH 0145/4278] Update 20171129 TLDR pages Simplified Alternative To Linux Man Pages.md --- ...mplified Alternative To Linux Man Pages.md | 74 ++++++++----------- 1 file changed, 31 insertions(+), 43 deletions(-) diff --git a/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md index 749f2647dc..fe9d2cdd6a 100644 --- a/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md +++ b/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md @@ -1,93 +1,81 @@ -wxy is translating -TLDR pages: Simplified Alternative To Linux Man Pages -============================================================ +TLDR 页:Linux 手册页的简化替代品 +============== - [![](https://fossbytes.com/wp-content/uploads/2017/11/tldr-page-ubuntu-640x360.jpg "tldr page ubuntu")][22] - - Working on the terminal and using various commands to carry out important tasks is an indispensable part of a Linux desktop experience. This open-source operating system possesses an [abundance of commands][23] that **makes** it impossible for any user to remember all of them. To make things more complex, each command has its own set of options to bring a wider set of functionality. +[![](https://fossbytes.com/wp-content/uploads/2017/11/tldr-page-ubuntu-640x360.jpg "tldr page ubuntu")][22] -To solve this problem, [Man Pages][12], short for manual pages, were created. First written in English, it contains tons of in-depth information about different commands. Sometimes, when you’re looking for just basic information on a command, it can also become overwhelming. To solve this issue,[ TLDR pages][13] was created. +在终端上使用各种命令执行重要任务是 Linux 桌面体验中不可或缺的一部分。Linux 这个开源操作系统拥有[丰富的命令][23],使得任何用户都无法记住所有这些命令。而使事情变得更复杂的是,每个命令都有自己的一组带来丰富的功能的选项。 - _Before going ahead and knowing more about it, don’t forget to check a few more terminal tricks:_ +为了解决这个问题,人们创建了[手册页][12],(手册 —— man 是 manual 的缩写)。首先,它是用英文写成的,包含了大量关于不同命令的深入信息。有时候,当你在寻找命令的基本信息时,它就会显得有点庞杂。 为了解决这个问题,人们创建了[TLDR 页][13]。 -* _**[Watch Star Wars in terminal ][1]**_ +### 什么是 TLDR 页? -* _**[Use StackOverflow in terminal][2]**_ +用于 Linux / Unix 的 TLDR 页的 GitHub 仓库将其描述为简化的、社区驱动的手册页的集合。在实际示例的帮助下,努力让使用手册页的体验变得更简单。如果还不知道,TLDR 取自互联网的常见俚语:太长没读Too Long Didn’t Read。 -* _**[Get Weather report in terminal][3]**_ +如果你想比较一下,让我们以 `tar` 命令为例。 通常,手册页会超过 1000 行。它是一个归档实用程序,经常与 `bzip` 或 `gzip` 等压缩方法结合使用。看一下它的手册页: -* _**[Access Google through terminal][4]**_ +[![tar man page](https://fossbytes.com/wp-content/uploads/2017/11/tar-man-page.jpg)][14] -* [**_Use Wikipedia from command line_**][7] +而另一方面,TLDR 页面让你只是浏览一下命令,看看它是如何工作的。 `tar` 的 TLDR 页面看起来像这样,并带有一些方便的例子——你可以使用此实用程序完成的最常见任务: -* _**[Check Cryptocurrency Prices From Terminal][5]**_ +[![tar tldr page](https://fossbytes.com/wp-content/uploads/2017/11/tar-tldr-page.jpg)][15] -* _**[Search and download torrent in terminal][6]**_ +让我们再举一个例子,向你展示 TLDR 页面为 `apt` 提供的内容: -### What are TLDR pages? +[![tldr-page-of-apt](https://fossbytes.com/wp-content/uploads/2017/11/tldr-page-of-apt.jpg)][16] -The GitHub page of TLDR pages for Linux/Unix describes it as a collection of simplified and community-driven man pages. It’s an effort to make the experience of using man pages simpler with the help of practical examples. For those who don’t know, TLDR is taken from common internet slang _ Too Long Didn’t Read_ . +如上向你展示了 TLDR 如何工作并使你的生活更轻松,下面让我们告诉你如何在基于 Linux 的操作系统上安装它。 -In case you wish to compare, let’s take the example of tar command. The usual man page extends over 1,000 lines. It’s an archiving utility that’s often combined with a compression method like bzip or gzip. Take a look at its man page: +### 如何在 Linux 上安装和使用 TLDR 页? - [![tar man page](https://fossbytes.com/wp-content/uploads/2017/11/tar-man-page.jpg)][14] On the other hand, TLDR pages lets you simply take a glance at the command and see how it works. Tar’s TLDR page simply looks like this and comes with some handy examples of the most common tasks you can complete with this utility: - - [![tar tldr page](https://fossbytes.com/wp-content/uploads/2017/11/tar-tldr-page.jpg)][15] Let’s take another example and show you what TLDR pages has to offer when it comes to apt: - - [![tldr-page-of-apt](https://fossbytes.com/wp-content/uploads/2017/11/tldr-page-of-apt.jpg)][16] Having shown you how TLDR works and makes your life easier, let’s tell you how to install it on your Linux-based operating system. - -### How to install and use TLDR pages on Linux? - -The most mature TLDR client is based on Node.js and you can install it easily using NPM package manager. In case Node and NPM are not available on your system, run the following command: +最成熟的 TLDR 客户端基于 Node.js,你可以使用 NPM 包管理器轻松安装它。如果你的系统上没有 Node 和 NPM,请运行以下命令: ``` sudo apt-get install nodejs - sudo apt-get install npm ``` -In case you’re using an OS other than Debian, Ubuntu, or Ubuntu’s derivatives, you can use yum, dnf, or pacman package manager as per your convenience. +如果你使用的是 Debian、Ubuntu 或 Ubuntu 衍生产品以外的操作系统,你可以根据自己的情况使用`yum`、`dnf` 或 `pacman`包管理器。 -Now, by running the following command in terminal, install TLDR client on your Linux machine: +现在,通过在终端中运行以下命令,在 Linux 机器上安装 TLDR 客户端: ``` -sudo npm install -g tldr +sudo npm install -g tldr ``` -Once you’ve installed this terminal utility, it would be a good idea to update its cache before trying it out. To do so, run the following command: +一旦安装了此终端实用程序,最好在尝试之前更新其缓存。 为此,请运行以下命令: ``` tldr --update ``` -After doing this, feel free to read the TLDR page of any Linux command. To do so, simply type: +执行此操作后,就可以阅读任何 Linux 命令的 TLDR 页面了。 为此,只需键入: ``` tldr ``` - [![tldr kill command](https://fossbytes.com/wp-content/uploads/2017/11/tldr-kill-command.jpg)][17] +[![tldr kill command](https://fossbytes.com/wp-content/uploads/2017/11/tldr-kill-command.jpg)][17] -You can also run the following help command to see all different parameters that can be used with TLDR to get the desired output. As usual, this help page is also accompanied with examples. +你还可以运行其[帮助命令](https://github.com/tldr-pages/tldr-node-client),以查看可与 TLDR 一起使用的各种参数,以获取所需输出。 像往常一样,这个帮助页面也附有例子。 -### TLDR web, Android, and iOS versions +### TLDR 的 web、Android 和 iOS 版本 -You would be pleasantly surprised to know that TLDR pages isn’t limited to your Linux desktop. Instead, it can also be used in your web browser, which can be accessed from any machine. +你会惊喜地发现 TLDR 页不仅限于你的 Linux 桌面。 相反,它也可以在你的 Web 浏览器中使用,可以从任何计算机访问。 -To use TLDR web version, visit [tldr.ostera.io][18] and perform the required search operation. +要使用 TLDR Web 版本,请访问 [tldr.ostera.io][18] 并执行所需的搜索操作。 -Alternatively, you can also download the [iOS][19] and [Android][20] apps and keep learning new commands on the go. +或者,你也可以下载 [iOS][19] 和 [Android][20] 应用程序,并随时随地学习新命令。 - [![tldr app ios](https://fossbytes.com/wp-content/uploads/2017/11/tldr-app-ios.jpg)][21] +[![tldr app ios](https://fossbytes.com/wp-content/uploads/2017/11/tldr-app-ios.jpg)][21] -Did you find this cool Linux terminal trick interesting? Do give it a try and let us know your feedback. +你觉得这个很酷的 Linux 终端技巧很有意思吗? 请尝试一下,让我们知道您的反馈。 -------------------------------------------------------------------------------- via: https://fossbytes.com/tldr-pages-linux-man-pages-alternative/ -作者:[Adarsh Verma ][a] -译者:[译者ID](https://github.com/译者ID) +作者:[Adarsh Verma][a] +译者:[wxy](https://github.com/wxy) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 788010ea5e8aa93456e137f3ff9e01ce9ff0f9b3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 15:09:17 +0800 Subject: [PATCH 0146/4278] Rename sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md to translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md --- ...171129 TLDR pages Simplified Alternative To Linux Man Pages.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md (100%) diff --git a/sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md similarity index 100% rename from sources/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md rename to translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md From 25bc7ad4d7142da74c2645f1cd4adfa6387a20de Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 15:25:14 +0800 Subject: [PATCH 0147/4278] Rename translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md to translated/tech20171129 TLDR pages Simplified Alternative To Linux Man Pages.md --- ...71129 TLDR pages Simplified Alternative To Linux Man Pages.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/{tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md => tech20171129 TLDR pages Simplified Alternative To Linux Man Pages.md} (100%) diff --git a/translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/translated/tech20171129 TLDR pages Simplified Alternative To Linux Man Pages.md similarity index 100% rename from translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md rename to translated/tech20171129 TLDR pages Simplified Alternative To Linux Man Pages.md From f4effae7c02eb56b6f80d5954c227255c8a08ead Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 15:32:40 +0800 Subject: [PATCH 0148/4278] Rename translated/tech20171129 TLDR pages Simplified Alternative To Linux Man Pages.md to translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md --- ...71129 TLDR pages Simplified Alternative To Linux Man Pages.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/{tech20171129 TLDR pages Simplified Alternative To Linux Man Pages.md => tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md} (100%) diff --git a/translated/tech20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md similarity index 100% rename from translated/tech20171129 TLDR pages Simplified Alternative To Linux Man Pages.md rename to translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md From 2c150fd3a75a2dcc560698dff7c82b276211a573 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 17 Dec 2018 16:13:19 +0800 Subject: [PATCH 0149/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Linux=20on=20th?= =?UTF-8?q?e=20Desktop:=20Are=20We=20Nearly=20There=20Yet=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...on the Desktop- Are We Nearly There Yet.md | 344 ++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 sources/talk/20181209 Linux on the Desktop- Are We Nearly There Yet.md diff --git a/sources/talk/20181209 Linux on the Desktop- Are We Nearly There Yet.md b/sources/talk/20181209 Linux on the Desktop- Are We Nearly There Yet.md new file mode 100644 index 0000000000..2f3b046362 --- /dev/null +++ b/sources/talk/20181209 Linux on the Desktop- Are We Nearly There Yet.md @@ -0,0 +1,344 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux on the Desktop: Are We Nearly There Yet?) +[#]: via: (https://blog.dxmtechsupport.com.au/linux-on-the-desktop-are-we-nearly-there-yet/) +[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) + +Linux on the Desktop: Are We Nearly There Yet? +====== + +![][1] + +The numbers are pretty stark: Linux might be the backbone of everything from embedded devices to mainframes and super computers. But it has just a 2% share of desktops and laptops. + +It seems the only way to get most people to even touch it is to rip away everything you recognise as Linux to rebuild it as Android. + +Until recently, I was in the 98%. I honestly wasn’t even conflicted. I used Linux most days both for work and for hobbies – but always in the cloud or on one of those handy little project boards that are everywhere now. For my daily driver, it was Windows all the way. + +I guess what’s kept me with Windows so long is really that it’s just been good enough as a default option that I haven’t been prompted to even think about it. Which, to be fair, is a great quality in an operating system. + +The last time I tried a dual boot Linux/Windows setup was about 15 years ago. I was using Unix at university, and was quite attracted to the idea of free and open source software, so I decided to give it a go. + +This was back when, if you wanted to install Linux, you went to the newsagent and bought a magazine that had a CD-ROM on the front cover. I don’t exactly remember what distro it was – probably something like Slackware or Red Hat. + +I got it running, poked around a bit and played some of the included games, which were relatively primitive but still quite a lot of fun. After that, I wasn’t sure what I was supposed to do with it. I never managed to connect it to the internet. + +For a number of years, I had no say in my operating system: work was buying my computer for me. I was a junior developer at a small software company that wrote for Windows machines, so it made sense that it would be a Windows laptop. That was easy to arrange because that’s how they came anyway. + +When I left this role to work for myself, I kept doing the laptop thing; they’re so convenient when you’re renting and it’s great to work outside on a lovely day. Whenever I bought a new one, it would come with Windows on it, which was great because that’s what I used. + +I’ve managed to avoid most of the security headaches in Windows. I got a nasty rootkit about 7 years ago and it’s all been smooth sailing since. + +### I Only Want the Command Line When I Want it + +A big misgiving about Linux as a main OS is that it never really seemed like it was a total GUI operating system. Whatever desktop environment you used, it was just a nice little place to run your web browser, media player, and maybe an IDE or something. As soon as it’s time to install or configure anything, you opened a terminal window. + +I’m okay with the command line – up to a point. You definitely want it for “nerd stuff” like server configuration or deploying a website. + +But when I’m doing “normie stuff”, I’m like most people: I’d really rather just point and click. I want my mind to be on the actual task, not on what command I need to make it happen. + +Using a Windows laptop felt like I could have the best of both worlds. Whenever I needed a bash shell, I’d just ssh into a Linux machine and do it from there. + +Even when I started doing web tasks that required a bash shell on my local machine, that was no problem. Microsoft [had sorted one out for me][2] and it just worked. + +In the end, what made me install [Ubuntu Studio][3] was not any intent of replacing Windows. I had just started messing around with Linux synthesizers on my home theatre rig and was curious to see what I could do with these on an x86 machine. + +### Linux Very Quickly Became My Daily Driver + +The first thing to really hit me was just how fast this is. It boots quick and programs just open. This makes it so much nicer as a place to get things done. + +So it made sense to do my web browsing and word processing here as well. Booting back into the Windows partition for that would just be a drag. + +I guess, up until this point, I’ve just taken it for granted as an immutable fact of life that laptops gradually slow down as they age and every few years it will be time for a new one. Every time Microsoft pushes out an update, it gets a little slower. + +So it was that my cheap 4GB machine from 2015 felt like it was nearing the end. In my head, I was already pondering firewood and a longboat. + +I suppose when you have a monopoly operating system, nudging your customers toward buying that new machine a little bit earlier might even help move a few more licenses. + +I accepted that for a long time. I now thoroughly resent it. + +I mean, given what I’m doing – web browsing, word processing, editing text files, opening ssh terminals, some very light image editing – I honestly reckon a 3 year old machine should be able to keep up. These are all tasks you could do in the 90s. It’s not like I’m playing the latest Battlefield while rendering the next Star Wars. + +With Windows 10, my laptop was struggling with simple tasks. There seemed to be no way of avoiding the expense and hassle of getting a new one. After switching to Linux, I instead spent a pittance on another 4GB memory module for the spare slot. + +I reckon I can at least get another year of use out of this machine now. This in itself has made changing worthwhile. + +#### A Seamless Desktop Experience + +Ubuntu studio comes with the [xfce][4] desktop. The default design is intuitive and beautifully styled with kind of a cyberpunk motif. I haven’t felt any desire to mess with the default theme, except to change the background image. + +I love how simple the interface is. All your programs and settings are there in the menu where you might look for them. By comparison, the Windows 10 desktop seems to always grow more elaborate and crammed with obscurities. + +I can’t really say how much of my enthusiasm for this desktop is the ease of use and how much is simply down to how much more snappy and responsive it is – you experience these things together. + +#### A GUI You Can Set Your Watch to (Literally) + +So far, it seems like you could actually do a lot with this without ever going near the command line. They’ve actually gotten it to a point where you don’t need to edit text files to connect to wi-fi or set your timezone. + +I’d be lying if I said I wasn’t using the command line a bit more. But that’s only because an Ubuntu terminal window is also a great ssh client. For a couple of weeks I was using nano as my main text editor, but I decided that a mouse is actually pretty handy for navigating and selecting text. + +For the great mass of people who aren’t that into nerd stuff, I don’t think you would need the terminal at all. + +#### The Same Software, Only Better + +One thing that I think will help open Linux up to a much larger audience is the graphical front end for the package manager. It’s honestly not much different to browsing apps on my Android phone. + +I’ve found myself using both the graphical interface and the command line to install software. The graphical interface is great for browsing, while the command line makes it super simple when you already know what you want to install. + +That’s just me though. Most people don’t know how to run a package manager from the command line because they’ve never had to learn. The good news for them is that they’re not obliged to – you can get by fine with just the graphical interface. + +I guess it helps that I was already using so much open source software on Windows: [Firefox][5] for web browsing, [GIMP][6] to format images for web use, [OpenOffice][7] for word processing and the occasional spreadsheet. Moving to Linux has meant still using much the same software. I’ve switched from OpenOffice to [LibreOffice][8] and have barely noticed the difference. + +Installing software from the repositories means that it’s actually easier than on Windows, because I’m not having to look up a bunch of websites. Closed source applications like [Dropbox][9] and [Slack][10] were no hassle to install and work the same as always. + +Thanks to the package manager, updates and patches are now automated too. On Windows, Firefox knew to update itself, but other software expected you to download and install new versions manually, and I inevitably couldn’t be bothered + +#### Smooth Operating System Updates + +Every so often, when you boot Ubuntu Studio, there’s a little window that politely tells you that you have some updates to install. If you decide you want to install them right now, it will take a matter of minutes. You totally get on with other things in the meantime. Of course, if you absolutely need all your system resources, you’re not forced to run it at all until you’re ready. + +It’s a nice change. Windows updates, by contrast, show up out of nowhere like a bank robber, yelling, waving an Uzi and marching you to a big blue update screen for as long as it has to take. + +Having not booted into my Windows partition for about a month now, I’m dreading how much of it would have piled up and how long they will take to get through. And the longer I leave it, the worse it’s going to get. So maybe I’ll just never go back. + +All in all, I’m very happy to now use Linux as my main OS. I could almost become a Linux evangelist. + +Except for one thing: + +### This Was an Absolute Pig to Install + +I’m used to an easy install with Linux. You flash an SD card or buy a VPS, you’re up and running in minutes. Running a virtual machine on your own metal can take a little longer. But not a lot. + +Installing Linux on a partition of my laptop was a Biblical effort. It took 6 days to get it to boot. + +How could it take so long? Well, it starts with super slow download links: 7 to 13 hours for an image. Then there was the hardware support. Most time consuming of all were the mystery problems and all the time sunk trying to diagnose and fix them. + +What had got me interested was playing around with a bit of audio. [KXStudio][11] and [AVLinux][12] seemed to be the popular choices. Both belong to the Ubuntu/Debian family, which is the style of Linux I know. + +KXStudio booted fine from the USB stick. But it didn’t like my wireless adapter. The fix for this seemed to involve compiling something from github. This was a bother; I needed a working wireless adapter to connect to the internet. + +I figured it might be possible to download either a binary or the source to my Windows partition so I could install it without an internet connection. But after much searching and no clear instructions, I was stuck. + +So I downloaded AVLinux and flashed it to a USB stick. The installer connected to the internet fine, so I installed the damn thing, only to find that the partition wouldn’t boot and then neither would the USB stick. Also, I was locked out of the UEFI. + +I did the only logical thing you can do when you brick your work machine: panic. Then I remembered that I had a live boot restoration utility on a USB stick stashed away somewhere for precisely this occasion. + +I then tried Ubuntu Studio 18.10. The Live Boot worked fine and even connected to the internet. So I installed it. This seemed to go off without a hitch. + +When I tried to boot into it though, I just got a blank screen. I spent a while trying various kernel parameters like “nomodeset”, but with no luck. + +A helpful chap on Reddit recommended I try just bog standard Ubuntu, explaining to me that it’s easy enough to swap in a low-latency kernel once it’s installed. + +So it was that I tried Ubuntu 18.04 and 18.10, then Ubuntu Studio 18.04.. then again and again, trying slightly different settings on the installer, all in vain. + +Having made so many attempts and spent so much time trying to get these things to work, I was – reluctantly – having to face the possibility that perhaps a distribution based on Debian just wasn’t going to work on my machine. + +#### Fedora Jam Worked First Time + +I had no trouble installing this distribution. The installer was super simple and it just worked on my first try. + +It didn’t boot much faster than Windows 10, but once you were in the desktop it was quite snappy and responsive. + +Like Ubuntu Studio, this also has a graphical front end for the package manager. It doesn’t quite have the same smooth “app store” experience though. If you’re already familiar with command line package managers, it’s pretty easy, but I’m not sure how intuitive it would be for everyone else. + +I quickly came to discover that Fedora doesn’t have anything like the kind of software library that Ubuntu and Debian has. Or at least, that’s how it was for the software I was interested. I know that it’s often still possible to install things that aren’t in the repositories – but we’re talking ease of use here. Having to compile it yourself is not an ease of use. + +For web browsing and word processing, this was a great operating system. But when it came to tinkering with audio, I couldn’t even get [JACK][13] to start. + +So, after a few days, it was time to move on. + +All in all, even though I decided Fedora wasn’t really from me, I still rate it somewhat. There’s a very good workstation there for ordinary office work. And I can well believe the claims that it’s a great development environment – especially having the entire Red Hat ecosystem downstream of your OS. + +Still, the hunt was back on. A friend told me how much he liked using [Linux Mint][14]. I’d heard of it before, but knew little about it. I was intrigued when my friend explained it was based on Ubuntu because I’d really missed those repositories. I decided to give it a go. + +#### Linux Mint Was Excellent + +As near as I can tell, Linux Mint is basically just Ubuntu with a few tweaks to make it really user friendly right out of the box. + +The big one is the desktop environment Cinnamon. This is clearly very influenced by Windows XP – a fine OS to pay tribute to in my opinion. It’s probably even more beginner-friendly than the default desktop on Ubuntu Studio. + +I liked Linux Mint and decided to install it. The fly in the ointment though was that the dreaded wireless adapter problem had reemerged. This was a showstopper for me earlier. But by this point I was willing to consider building a temporary wireless bridge from bits and pieces I had lying around so that I could have an internet connection to try to get the right driver. + +I never got that far though. When I tried to, the installer kept aborting when it couldn’t install the boot loader. I tried it again and again and the same thing kept happening. + +#### Back to Ubuntu Studio + +I decided to go back to Ubuntu Studio 18.10. I’d at least gotten this to install before, even if it booted to a blank screen. I figured that there’d be some answer to this problem somewhere, if I only looked hard enough. + +I went and installed it again, expecting to be faced with the same problem. But this time it just worked. + +I’m pretty glad that it worked in the end. But I still have absolutely no idea what was going wrong or what I did differently to get it to work that one last time. + +### Should it Really Be This Difficult Even for Nerds? + +I admit it’s the other dudes in [DXM Tech Support team][15] who really know drivers and hardware. My own skills are mostly with web stuff. + +But still, I’d like to think I can hold my own a bit. I wrote my first code at the age of 7, I’ve worked as a software developer before, I can use a bash shell a bit, and installing weird operating systems to play 30 year old video games is my idea of a fun Sunday afternoon. + +And I reckon the things I was juggling a few things here that might be a bit beyond any kind of mass audience: things like kernel parameters, endlessly using Gparted and efibootmgr to clean up failed installs, or building my own wireless bridge. + +Which is all just a longer way of saying that, while I’m not exactly Linus Torvalds, I can do a thing or two here and there with a computer. + +But what if you actually are Linus Torvalds? + +It turns out you also think the install is disgusting: + + + +My favourite bit here is in the middle where the Debian fan approaches the microphone for what’s meant to be a question. It was totally within her power to just ask him what the difficulty was. Instead she completely dismisses his experience and tells him he should use her favourite Linux instead. + +I doubt that she actually meant to be that much of a dick. It’d be more that she’s such a fan of the software that it’s difficult for her to see any complaint as a genuine area for improvement. For her, it has to be a user education problem. + +You can literally have the whole damn thing named after you and still have to put up with that crap. No wonder he can be a bit cranky. + +### It’s the Little Things Too + +To install Linux, you have to first run all sorts of errands to prepare your machine. + +You need the Windows 10 Disk Management tool to resize your C partition, delve into the UEFI to change some settings, install an image writer to burn the installer image to a USB stick, that sort of thing. Often you’re presented with multiple alternatives for each of these steps. + +My suspicion is that each of these things feels so trivial to most Linux users that it just doesn’t occur to them that it’s a real point of friction for most people. + +Using a different tool for each task is very much in keeping with the [UNIX Philosophy][16]: any one thing should do just one thing and do it well. + +That’s actually excellent for anyone who uses a computer to build things. You have all these lego bricks that you can arrange however makes sense. You can totally just run a Python script, grep the most relevant bits, then make the output presentable by piping it to [cowsay][17]. + +But not everyone’s ready for cowsay. Joe Average has never even heard of UEFI or partitioning and he honestly shouldn’t have to. + +So this might be the wrong place for a rigid application of the UNIX philosophy. It greatly adds to the number of steps and that’s always going to cut down on the number of people who make it to the end. + +Even if you’ve always been amazing at computers, I think you can probably think of something else that once seemed too difficult. For me, that was cooking Indian recipes. + +That’s been my favourite thing to eat ever since I was a kid. But every time I looked at a recipe, it was just line after line of ingredients I didn’t really understand. So I made do with the jars and recipe kits. + +When I finally decided to actually give it a go, I realised the ingredients list was so long because of all the spices I’d never cooked with before. It turned out that the most difficult part of using them was bringing them home from the Indian grocers. Putting them in the pan added mere seconds to the actual cooking. + +Pretty easy, right? And yet, until I knew that, it was enough to stop me even trying, literally for years. + +That’s how this stuff works. Every unfamiliar step you add to a process brings people closer to thinking “hmm, that’s actually a bit too involved for me” – even if those extra steps are, individually, trivial. + +Linux does this to potential new users every day. + +The worst thing about adding this to the installation is that it’s all front loaded right at the start of someone’s decision to try Linux. If they don’t make it through the install, then none of the rest of it comes into play. + +### What the Install Should Look Like + +A big part of what sucks about an unsuccessful Linux install is the amount of time you spend and the number steps you take to reach a point of failure. + +So what would be cool is a lightweight installation tool that began with a hardware scan to give you meaningful feedback on what’s supported, what’s unsupported, and what needs further attention. + +Then, if it’s all good to go, it could download the live boot image, burn it to a USB stick, take care of the UEFI settings and so on. Then, when you decide you want to install it, it could also take care of defragmenting and resizing the C partition. + +It’s a thought anyway. + +### It’s Part of a Bigger Picture + +Addressing the install nightmare won’t make anyone who wasn’t. It’s more about boosting the [conversion rate][18] of those already interested to actual users. + +Off the top of my head, here are some of the other big things that stop people switching: + + * **Gaming:** A lot of the people who are most comfortable tinkering with drivers and the UEFI became that way because they’re really into playing the latest games. + +Linux is more than ok for casual gamers. For console gamers, like me, it’s an irrelevance. But if playing the best and latest games on PC is hugely important to you, there’s no contest which platform has the best library. + +There is an interesting push by the guys behind Steam to turn this around. There’s really no reason why Linux couldn’t be a major platform for gaming – not everyone realises that [the world’s best-selling console runs FreeBSD][19], a close cousin of Linux. + +But even if this starts to take off, it will be a while before hardcore gamers start moving away from Windows. + + * **Business Realities:** The difficult installation matters much less in a professionally managed IT environment. But these are also the places where a need to preserve existing systems, configurations and procedures can complicate any change. Even just migrating from one version of Windows to another has pain points. + +On top of this, the business owners and senior managers with the final say tend to be very busy and preoccupied with a dozen other challenges, and fairly reluctant to consider anything that seems weird and unfamiliar. This makes inertia hard to shift. + +The IT staff who might lobby for such a move would be understandably wary of blame for any difficulties that arise with Linux, in a way they won’t be for difficulties with Windows. + + * **Home Networking:** This is one spot where Windows still is much more user friendly. Your Windows machines are generally pretty good at detecting each other on the LAN and then appearing in Windows Explorer. From there it’s pretty easy to decide what to make public using a GUI interface. + +To do the same thing on Linux, you’re installing servers for various protocols and configuring them from the command line or in a text editor. Which is actually a lot less difficult than it first looks if you’re willing to roll your sleeves up. But, if we’re talking about going mainstream, then realistically most people will be repelled by this at a glance. + +Compared to the difficulty of the install, I think this is a relatively minor pain point. For the average home user, so long as they can run their software and connect to the internet, they’re pretty happy. And from what I’ve both seen and heard of DIY Windows networking jobs in the workplace, part of me thinks it’s a bad idea to democratise this too far. + +But it’s fairly normal for home users to want to copy things across a network to, say, a home theatre machine and they should be able to. + + * **Social Proof and Branding:** Properly covering all the social proof and branding problems Linux has with ordinary people would be a lengthy article in its own right. + +The basic idea of [social proof][20] is that humans, as social animals, are highly influenced by what everyone. That’s a highly rational instinct in a paleolithic environment, where there is an obvious drawback to A/B testing all the things that might kill you. It also suits us in our modern world that throws vastly more decisions at us than anyone has the time or mental resources. + +But being on the wrong side of it means you’re significantly penalised simply for not already being popular. + +On top of this, to the extent that people are aware of Linux, it’s mostly as an operating system for a technical elite. + + + + +If you think about it, the difficulty of the install feeds back into most of these. Definitely, a larger user base would make games developers care more about the platform. Hypothetically, big titles that are properly optimised for a lighter weight operating system might run better. This is a huge drawcard for hardcore gamers. + +Because of the legacy system issues of even fairly small businesses, one easier path into the workplace would be to get the business owner while it’s still a one person show. + +A large number of new businesses are started by parents of young children, who are often struggling to afford everything. And a great many freelancers and solo entrepreneurs go through feast and famine periods often enough that they’ve learned to be protective of their cash buffers. + +These are all people who’d rather get a couple more years out of a machine than be made to buy a new one. It’s a good use case for Linux. So long as they can actually install it. + +And creating social proof means building a visibly larger use base. That will happen easier if more interested new users can install successfully. + +### Is it Time for a Branded Linux Machine? + +The easiest installation is one that’s already done. So perhaps it’s time for off-the-shelf Linux desktops and laptops. + +These exist already of course. Big PC makers like Dell have a Linux lineup, while some boutique outfits are exclusively Linux in their product offering. + +I’m picturing something kinda different though: an officially branded consumer product by one of the more user friendly distributions, pitched not tech professionals but to a mass market audience. Something that could be reviewed next to Apple and Samsung products. + +The desktop environment is ready for a broader audience. The software library is quite excellent for anyone with ordinary computing needs – and with a good graphical front end, it’s pretty easy to find and install software. And because Linux is so much gentler on hardware requirements, there’s some real scope to offer some solid bang for back here. + +I expect most open source developers have had no experience of and even less interest in. So what they could do is license the brand and a subdomain on their website for a given time period to someone already in the business of making and selling computers. + +For the sake of the brand, it’d be important to license this to someone you could trust to do a good job of building a decent machine. That would take care and attention, but I don’t think it’s impossible. + +As well as providing a small income stream to developers, and growing the user base through direct sales, the ordinary publicity effort to promote these products would help make Linux visible as a thing that the mass market could use. + +I’m just spitballin’ really. But if anyone likes this idea, they’re welcome to it. + +### It’s More a Matter of When than If + +Maybe it seems like I spent a lot of this article talking down Linux on the desktop. The wider truth though is that I’ve voted with my feet. If I don’t stick with Ubuntu Studio forever, it will be because I went to a different flavour of Linux. + +I really don’t want to go back to Windows if I can avoid it. + +There are certainly still big obstacles to bringing Linux to a wider audience. But I can’t see why they wouldn’t be overcome. + +-------------------------------------------------------------------------------- + +via: https://blog.dxmtechsupport.com.au/linux-on-the-desktop-are-we-nearly-there-yet/ + +作者:[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/2018/11/Ubuntu-Desktop-1024x576.png +[2]: https://docs.microsoft.com/en-us/windows/wsl/about +[3]: https://ubuntustudio.org/ +[4]: https://www.xfce.org/ +[5]: https://www.mozilla.org/en-US/firefox/ +[6]: https://www.gimp.org/ +[7]: https://www.openoffice.org/ +[8]: https://www.libreoffice.org/ +[9]: https://www.dropbox.com/ +[10]: https://slack.com/ +[11]: https://kxstudio.linuxaudio.org/ +[12]: http://www.bandshed.net/avlinux/ +[13]: http://jackaudio.org/ +[14]: https://linuxmint.com/ +[15]: https://dxmtechsupport.com.au/about +[16]: https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch01s06.html +[17]: https://medium.com/@jasonrigden/cowsay-is-the-most-important-unix-like-command-ever-35abdbc22b7f +[18]: https://www.wordstream.com/conversion-rate +[19]: http://www.extremetech.com/gaming/159476-ps4-runs-orbis-os-a-modified-version-of-freebsd-thats-similar-to-linux +[20]: https://conversionxl.com/blog/is-social-proof-really-that-important/ From 27ff4e67e416504fa819f1fad53016e8fedc937f Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 17 Dec 2018 16:23:28 +0800 Subject: [PATCH 0150/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20Things=20In?= =?UTF-8?q?fluenza=20Taught=20Me=20About=20the=20Evolution=20of=20the=20De?= =?UTF-8?q?sktop=20Computer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...t the Evolution of the Desktop Computer.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/talk/20180817 5 Things Influenza Taught Me About the Evolution of the Desktop Computer.md diff --git a/sources/talk/20180817 5 Things Influenza Taught Me About the Evolution of the Desktop Computer.md b/sources/talk/20180817 5 Things Influenza Taught Me About the Evolution of the Desktop Computer.md new file mode 100644 index 0000000000..c1e7f98200 --- /dev/null +++ b/sources/talk/20180817 5 Things Influenza Taught Me About the Evolution of the Desktop Computer.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Things Influenza Taught Me About the Evolution of the Desktop Computer) +[#]: via: (https://blog.dxmtechsupport.com.au/5-things-influenza-taught-me-about-the-evolution-of-the-desktop-computer/) +[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) + +5 Things Influenza Taught Me About the Evolution of the Desktop Computer +====== + +The flu took me completely out of action recently. It hit me pretty hard. + +And, as tends to happen with these things, I ended up binge watching more TV and movies in two weeks hidden under a blanket than in 2 years as a member of wider society. + +In the most delirious moments, the vicious conspiracy of fever and painkillers gave me no choice but to stick to bad 80s action movies. + +When I was a little more lucid, though, I got really stuck into some documentaries around the early days of desktop computing: Computerphile episodes, Silicon Cowboys, Micro Men, Youtube interviews, all sorts of stuff. + +Here are the big things that have stuck with me from it: + +### The Modern Computing Industry was Almost Entirely Built by Young Hobbyists + +There was an established computing industry in the 1970s – but these companies played very little direct role in what was to come. + +Xerox’s Palo Alto Research Centre had an important role to play in developing desktop technologies – with absolutely zero intention of ever commercialising anything. The entire thing was funded entirely from Xerox’s publicity budget. + +But for the most part, computers were sold to universities and enterprises. These were large, expensive machines guarded by a priesthood. + +The smallest and most affordable machines in use here were minicomputers like the DEC PDP-11. “Mini” is, of course, a relative term. These were the size of several fridges and cost several years worth of the average wage. + +So what if you wanted a computer of your own? Were you totally stranded? Not quite. You could always buy a bunch of chips and build and program the whole damn thing yourself. + +This had become increasingly accessible, thanks to the development of the microprocessor, which condensed the separate components of a CPU into a single chip. As the homebrew computer scene grew, hobby electronics companies started offering kits. + +It was out of this scene that desktop computing industry actually grew – both Apple and Acorn computers were founded by hobbyists. Their first commercial products evolved from what they’d built at home. + +Businesses that catered to the electronics hobbyist market, like Tandy and Radio Shack, were also some of the earliest to enter the market. + +### Things Changed More Radically from ’77 – ’87 than the Next 3 Decades Combined + +The first desktop computers were a massive leap forward in terms of bringing computing to ordinary people, they were still fairly primitive. We’re talking beeps, monochrome graphics, and a 30 minute wait to load your software from cassette tape. + +And the only way to steer it was from the command line. It’s definitely much more accessible than building and programming your own computer from scratch, but it’s still very much in nerd territory. + +By 1987, you’ve got most of what we’re familiar with: point and click interfaces, full colour graphics, word processors, spreadsheets, desktop publishing, music production, 3D gaming. The floppy drives had made loading times insignificant – and some machines even had hard drives. + +Your mum could use it. + +Things still got invented after that. The internet has obviously been a game changer. Screens are completely different. And there are any number of new languages. + +For the most part, though, desktop computers came together in a decade. Since then, we’ve just been making better and better versions of the same thing. + +### Bill Gates Really Was Kind of a James Bond Villain + +Back in the ’90s, it seemed a fairly ubiquitous part of computer geek culture that Bill Gates was kind of a dick. In magazines, on bulletin boards and the early internet, it was just taken for granted that Microsoft dominated the market not with a superior product but with sharp business practices. + +I was too young to really know if that was true, but I was happy to go along with it. It turns out that there was actually plenty of truth in that. An MS-DOS PC was hardly the best computer of the 1980s. + +The [Acorn Archimedes][1], for instance, had the world’s fastest processor in a desktop computer, many times faster than the 386, and an operating system so far ahead of its time that Microsoft shamelessly plagiarised it 8 years for Windows 95. + +And the Motorola 68000 series of CPUs used in many machines such as the Apple Macintosh and Commodore Amiga was also faster, and were vastly better for input/output intensive work such as graphics and sound. + +So how did Microsoft win? + +Well they had a head start piggybacking with IBM, who very successfully marketed the PC as a general purpose business computer. At this point, the PC was already one of the first platforms that many software developers would write for. + +Then, as what was then known as the “IBM clone” market began and grew, Bill Gates was very aggressive about getting MS-DOS onto as many machines as possible by licensing it on very generous terms to companies like Compaq and Amstrad. This was a short term sacrifice of profits in pursuit of market share. It also helped the PC to become the affordable choice for families. + +As this market share grew, the PC became the more obvious platform to first release your software on. This created a snowball effect, where more software support made the PC the more obvious computer to buy, increasing market share and attracting more software development. + +In the end, it didn’t matter how much better your computer was when all the programs ran on MS-DOS. + +### That’s Actually Totally Awesome Though + +On first glance, Gates looks like the consummate monopolist. Actually, he did a lot more open up access to new players and foster innovation and competition. + +In the early days of desktop computing, every manufacturer more or less maintained its own proprietary platform, with its own hardware, operating system and software support. That meant if you wanted a certain kind of computer, there was one company who built it so you bought it from them. + +By opening the PC market to new entrants, selling the operating systems to anyone who wanted them, and setting industry standards that anyone could build to, PC makers had to compete directly on price and performance. + +Apple still have the old model of a closed, proprietary platform, and you’ll pay vastly more for an equivalent machine – or perhaps one whose specs haven’t improved in 3 years. + +It was also great for software developers not to have to port their software across so many platforms. I had first hand experience of this growing up – when I was really young, there were more than a dozen computers scattered around the house, because Dad was running his software business from home, and when he needed to port a program to a new machine, he needed the machine. But by the time I was finishing primary school, it was just the mac and the PC. + +Handling the compatibility problem, throwing Windows on top of it, and offering it on machines at all price points did so much to bring computing to ordinary people. + +At this point, I’m pretty sure someone in the audience is saying “yeah, but we could have done that open source”. Look, I like Linux for what it’s good for, but let’s be real here. Linux doesn’t really have a GUI environment – it has dozens of them, each with different quirks to learn. + +One thing that they all have in common though is that they’re not really proper operating system environments, more just nice little boxes to stick your web browser and word processor. The moment you need to install or configure anything, guess what? It’s terminal time. Which is rather excellent if you’re that way inclined, but realistically, that’s a small fraction of humanity. + +If Bill Gates never came up with an everyman operating system that you could run on an affordable machine, would someone else have? Probably. But he’s the guy that actually did it. + +### Sheer Conceit Will Make Fools of Even the Most Brilliant and Powerful + +The deal that really made Microsoft is also the deal that eventually cost IBM their entire market share of the PC platform they created and of the desktop computer market as a whole. + +IBM were in a hurry to bring their PC to market, they built almost all of it from off-the-shelf components. Bill Gates got the meeting to talk operating systems because his mother sat on a board with. IBM offered to buy the rights to the operating system, but Gates offered instead to license it. + +There was really no reason that IBM had to take that deal. There was nothing all that special about MS-DOS. They could have bought a similar operating system from someone else. I mean, that’s exactly what Gates did: he went to another guy in Seattle, bought the rights to a rip off of CP/M that worked on the Intel 8086, and tweaked it a bit. + +To be fair to IBM, in 1980, it wasn’t obvious yet how crucial it would be to hold a dominant operating system. That came later. At that point, the OS was kind of just a bit of code to run the hardware – a component. It was normal for every computer manufacturer to have its own . It was normal for developers to port their products across them. + +But it’s also just weren’t inclined to take a skinny twenty-something seriously. + +Compaq famously reverse engineered the BIOS, and other manufacturers followed them into the market. IBM now had competition, but were still considered the market leaders and standard setters – it was their platform and everyone else was a “clone”. + +They were still cocky. + +So when the 386, IBM decided they weren’t in any hurry to do anything with it. The logic was that they already held the manufacturing rights to the 286, so they might as well get as much value out of that as they could. This was crazy: the 386 was more than twice as fast at the same clock speed, and it could go to much higher clock speeds. + +Compaq jumped on it. Suddenly IBM were the slowpokes in their own market. + +Having totally lost all control and leadership in the PC market, they fought back with a new, totally proprietary platform: the PS/2. But it was way too late. The genie was out of the bottle. This was up against the same third party support issues working against everyone other company with a closed, proprietary platform. It didn’t last. + +-------------------------------------------------------------------------------- + +via: https://blog.dxmtechsupport.com.au/5-things-influenza-taught-me-about-the-evolution-of-the-desktop-computer/ + +作者:[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/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/ From e41fbbc9bec2709d8f7ea1f008ccf4b9f458eb9b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 17 Dec 2018 16:25:44 +0800 Subject: [PATCH 0151/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2011=20Uses=20for?= =?UTF-8?q?=20a=20Raspberry=20Pi=20Around=20the=20Office?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...es for a Raspberry Pi Around the Office.md | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md diff --git a/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md b/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md new file mode 100644 index 0000000000..c1a9e1a165 --- /dev/null +++ b/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (11 Uses for a Raspberry Pi Around the Office) +[#]: via: (https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-office/) +[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) + +11 Uses for a Raspberry Pi Around the Office +====== + +Look, I know what you’re thinking: a Raspberry Pi is really just for tinkering, prototyping and hobby use. It’s not actually meant for running a business on. + +And it’s definitely true that this computer’s relatively low processing power, corruptible SD card, lack of battery backup and the DIY nature of the support means it’s not going to be a viable replacement for a [professionally installed and configured business server][1] for your most mission-critical operations any time soon. + +But the board is affordable, incredibly frugal with power, small enough to fit just about anywhere and endlessly flexible – it’s actually a pretty great way to handle some basic tasks around the office. + +And, even better, there’s a whole world of people out there who have done these projects before and are happy to share how they did it. + +### DNS Server + +Every time you type a website address or click a link in your browser, it needs to convert the domain name into a numeric IP address before it can show you anything. + +Normally this means a request to a DNS server somewhere on the internet – but you can speed up your browsing by handling this locally. + +You can also assign your own subdomains for local access to machines around the office. + +[Here’s how to get this working.][2] + +### Toilet Occupied Sign + +Ever get queues at the loos? + +That’s annoying for those left waiting and the time spent dealing with it is a drain on your whole office’s productivity. + +I guess you could always hang those signs they have on airplanes all through your office. + +[Occu-pi][3] is a much simpler solution, using a magnetic switch and a Raspberry Pi to tell when the bolt is closed and update a Slack channel as to when it’s in use – meaning that the whole office can tell at a glance of their computer or mobile device whether there’s a cubicle free. + +### Honeypot Trap for Hackers + +It should scare most business owners just a little bit that their first clue that a hacker’s breached the network is when something goes badly wrong. + +That’s where it can help to have a honeypot: a computer that serves no purpose except to sit on your network with certain ports open to masquerade as a juicy target to hackers. + +Security researchers often deploy honeypots on the exterior of a network, to collect data on what attackers are doing. + +But for the average small business, these are more usefully deployed in the interior, to serve as kind of a tripwire. Because no ordinary user has any real reason to want to connect to the honeypot, any login attempts that occur are a very good indicator that mischief is afoot. + +This can provide early warning of outsider intrusion, and of trusted insiders up to no good. + +In larger, client/server networks, it might be more practical to run something like this as a virtual machine. But in small-office/home-office situations with a peer-to-peer network running on a wireless router, something like [HoneyPi][4] is a great little burglar alarm. + +### Print Server + +Network-attached printers are so much more convenient. + +But it can be expensive to replace all your printers- especially if you’re otherwise happy with them. + +It might make a lot more sense to [set up a Raspberry Pi as a print server][5]. + +### Network Attached Storage + +Turning simple hard drives into network attached storage was one of the earliest practical uses for a Raspberry Pi, and it’s still one of the best. + +[Here’s how to create a NAS with your Raspberry Pi.][6] + +### Ticketing Server + +Looking for a way to manage the support tickets for your help desk on a shoestring budget? + +There’s a totally open source ticketing program called osTicket that you can install on your Pi, and it’s even available as [a ready-to-go SD card image][7]. + +### Digital Signage + +Whether it’s for events, advertising, a menu, or something else entirely, a lot of businesses need a way to display digital signage – and the Pi’s affordability and frugal electricity needs make it a very attractive choice. + +[There are a wealth of options to choose from here.][8] + +### Directories and Kiosks + +[FullPageOS][9] is a Linux distribution based on Raspbian that boots straight into a full screen version of Chromium – ideal for shopping directoriers, library catalogues and so on. + +### Basic Intranet Web Server + +For hosting a public-facing website, you’re really much better off just getting a hosting account. A Raspberry Pi is not really built to serve any real volume of web traffic. + +But for small offices, it can host an internal business wiki or basic company intranet. It can also work as a sandbox environment for experimenting with code and server configurations. + +[Here’s how to get Apache, MySQL and PHP running on a Pi.][10] + +### Penetration Tester + +Kali Linux is an operating system built specifically to probe networks for security vulnerabilities. By installing it on a Pi, you’ve got a super portable penetration tester with more than 600 tools included. + +[You can find a torrent link for the Raspberry Pi image here.][11] + +Be absolutely scrupulous to only use this on your own network or networks you’ve got permission to perform a security audit on – using this to hack other networks is a serious crime. + +### VPN Server + +When you’re out on the road, relying on public wireless internet, you’ve not really any say in who else might be on the network, snooping on all your traffic. That’s why it can be reassuring to encrypt everything with a VPN connection. + +There are any number of commercial VPN services you can subscribe to – and you can install your own in the cloud – but by running one from your office, you can also access the local network from anywhere. + +For light use – say, the occasional bit of business travel – a Raspberry Pi is a great, power-efficient way to set up a VPN server. (It’s also worth checking first that your router doesn’t offer this functionality already – very many do.) + +[Here’s how to install OpenVPN on a Raspberry Pi.][12] + +### Wireless Coffee Machine + +Ahh, ambrosia: sweet nectar of the gods and the backbone of all productive enterprise. + +So why not [hack the office coffee machine into a smart coffee machine][13] for precision temperature control and wireless network connectivity? + +-------------------------------------------------------------------------------- + +via: https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-office/ + +作者:[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://dxmtechsupport.com.au/server-configuration +[2]: https://www.1and1.com/digitalguide/server/configuration/how-to-make-your-raspberry-pi-into-a-dns-server/ +[3]: https://blog.usejournal.com/occu-pi-the-bathroom-of-the-future-ed69b84e21d5 +[4]: https://trustfoundry.net/honeypi-easy-honeypot-raspberry-pi/ +[5]: https://opensource.com/article/18/3/print-server-raspberry-pi +[6]: https://howtoraspberrypi.com/create-a-nas-with-your-raspberry-pi-and-samba/ +[7]: https://everyday-tech.com/a-raspberry-pi-ticketing-system-image-with-osticket/ +[8]: https://blog.capterra.com/7-free-and-open-source-digital-signage-software-options-for-your-next-event/ +[9]: https://github.com/guysoft/FullPageOS +[10]: https://maker.pro/raspberry-pi/projects/raspberry-pi-web-server +[11]: https://www.offensive-security.com/kali-linux-arm-images/ +[12]: https://medium.freecodecamp.org/running-your-own-openvpn-server-on-a-raspberry-pi-8b78043ccdea +[13]: https://www.techradar.com/au/how-to/how-to-build-your-own-smart-coffee-machine From 22890f2a5d822b56f584d299dd67eff459dcd3da Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 18:23:19 +0800 Subject: [PATCH 0152/4278] PRF:20171129 TLDR pages Simplified Alternative To Linux Man Pages.md @wxy --- ...implified Alternative To Linux Man Pages.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md index fe9d2cdd6a..bca48001bf 100644 --- a/translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md +++ b/translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md @@ -3,19 +3,19 @@ TLDR 页:Linux 手册页的简化替代品 [![](https://fossbytes.com/wp-content/uploads/2017/11/tldr-page-ubuntu-640x360.jpg "tldr page ubuntu")][22] -在终端上使用各种命令执行重要任务是 Linux 桌面体验中不可或缺的一部分。Linux 这个开源操作系统拥有[丰富的命令][23],使得任何用户都无法记住所有这些命令。而使事情变得更复杂的是,每个命令都有自己的一组带来丰富的功能的选项。 +在终端上使用各种命令执行重要任务是 Linux 桌面体验中不可或缺的一部分。Linux 这个开源操作系统拥有[丰富的命令][23],任何用户都无法全部记住所有这些命令。而使事情变得更复杂的是,每个命令都有自己的一组带来丰富的功能的选项。 -为了解决这个问题,人们创建了[手册页][12],(手册 —— man 是 manual 的缩写)。首先,它是用英文写成的,包含了大量关于不同命令的深入信息。有时候,当你在寻找命令的基本信息时,它就会显得有点庞杂。 为了解决这个问题,人们创建了[TLDR 页][13]。 +为了解决这个问题,人们创建了[手册页][12]man page,(手册 —— man 是 manual 的缩写)。首先,它是用英文写成的,包含了大量关于不同命令的深入信息。有时候,当你在寻找命令的基本信息时,它就会显得有点庞杂。为了解决这个问题,人们创建了[TLDR 页][13]。 ### 什么是 TLDR 页? -用于 Linux / Unix 的 TLDR 页的 GitHub 仓库将其描述为简化的、社区驱动的手册页的集合。在实际示例的帮助下,努力让使用手册页的体验变得更简单。如果还不知道,TLDR 取自互联网的常见俚语:太长没读Too Long Didn’t Read。 +TLDR 页的 GitHub 仓库将其描述为简化的、社区驱动的手册页集合。在实际示例的帮助下,努力让使用手册页的体验变得更简单。如果还不知道,TLDR 取自互联网的常见俚语:太长没读Too Long Didn’t Read。 -如果你想比较一下,让我们以 `tar` 命令为例。 通常,手册页会超过 1000 行。它是一个归档实用程序,经常与 `bzip` 或 `gzip` 等压缩方法结合使用。看一下它的手册页: +如果你想比较一下,让我们以 `tar` 命令为例。 通常,手册页的篇幅会超过 1000 行。`tar` 是一个归档实用程序,经常与 `bzip` 或 `gzip` 等压缩方法结合使用。看一下它的手册页: [![tar man page](https://fossbytes.com/wp-content/uploads/2017/11/tar-man-page.jpg)][14] -而另一方面,TLDR 页面让你只是浏览一下命令,看看它是如何工作的。 `tar` 的 TLDR 页面看起来像这样,并带有一些方便的例子——你可以使用此实用程序完成的最常见任务: +而另一方面,TLDR 页面让你只是浏览一下命令,看看它是如何工作的。 `tar` 的 TLDR 页面看起来像这样,并带有一些方便的例子 —— 你可以使用此实用程序完成的最常见任务: [![tar tldr page](https://fossbytes.com/wp-content/uploads/2017/11/tar-tldr-page.jpg)][15] @@ -23,18 +23,18 @@ TLDR 页:Linux 手册页的简化替代品 [![tldr-page-of-apt](https://fossbytes.com/wp-content/uploads/2017/11/tldr-page-of-apt.jpg)][16] -如上向你展示了 TLDR 如何工作并使你的生活更轻松,下面让我们告诉你如何在基于 Linux 的操作系统上安装它。 +如上,它向你展示了 TLDR 如何工作并使你的生活更轻松,下面让我们告诉你如何在基于 Linux 的操作系统上安装它。 ### 如何在 Linux 上安装和使用 TLDR 页? -最成熟的 TLDR 客户端基于 Node.js,你可以使用 NPM 包管理器轻松安装它。如果你的系统上没有 Node 和 NPM,请运行以下命令: +最成熟的 TLDR 客户端是基于 Node.js 的,你可以使用 NPM 包管理器轻松安装它。如果你的系统上没有 Node 和 NPM,请运行以下命令: ``` sudo apt-get install nodejs sudo apt-get install npm ``` -如果你使用的是 Debian、Ubuntu 或 Ubuntu 衍生产品以外的操作系统,你可以根据自己的情况使用`yum`、`dnf` 或 `pacman`包管理器。 +如果你使用的是 Debian、Ubuntu 或 Ubuntu 衍生发行版以外的操作系统,你可以根据自己的情况使用`yum`、`dnf` 或 `pacman`包管理器。 现在,通过在终端中运行以下命令,在 Linux 机器上安装 TLDR 客户端: @@ -76,7 +76,7 @@ via: https://fossbytes.com/tldr-pages-linux-man-pages-alternative/ 作者:[Adarsh Verma][a] 译者:[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 cfa2c44454ae16a474a5dde715f647320cf2f8e8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 18:24:45 +0800 Subject: [PATCH 0153/4278] PUB:20171129 TLDR pages Simplified Alternative To Linux Man Pages.md @wxy https://linux.cn/article-10355-1.html --- ...171129 TLDR pages Simplified Alternative To Linux Man Pages.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md (100%) diff --git a/translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/published/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md similarity index 100% rename from translated/tech/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md rename to published/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md From b1676eb2250b917922d780a75eabd7f8c7a20f49 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 17 Dec 2018 19:18:53 +0800 Subject: [PATCH 0154/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Playing=20Badas?= =?UTF-8?q?s=20Acorn=20Archimedes=20Games=20on=20a=20Raspberry=20Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...corn Archimedes Games on a Raspberry Pi.md | 539 ++++++++++++++++++ 1 file changed, 539 insertions(+) create mode 100644 sources/tech/20180626 Playing Badass Acorn Archimedes Games on a Raspberry Pi.md diff --git a/sources/tech/20180626 Playing Badass Acorn Archimedes Games on a Raspberry Pi.md b/sources/tech/20180626 Playing Badass Acorn Archimedes Games on a Raspberry Pi.md new file mode 100644 index 0000000000..b1f8d97305 --- /dev/null +++ b/sources/tech/20180626 Playing Badass Acorn Archimedes Games on a Raspberry Pi.md @@ -0,0 +1,539 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Playing Badass Acorn Archimedes Games on a Raspberry Pi) +[#]: via: (https://blog.dxmtechsupport.com.au/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/) +[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) + +Playing Badass Acorn Archimedes Games on a Raspberry Pi +====== + +![Cannon Fodder on the Raspberry Pi][1] + +The Acorn Archimedes was an excellent machine and years ahead of its time. + +Debuting in 1987, it featured a point and click graphic interface not so different to Windows 95, 32 bit processing, and enough 3D graphics power to portal you to a new decade. + +These days, it’s best remembered for launching the Acorn RISC Machines processor. ARM processors went on to rule the world. You almost certainly keep one in your pocket. + +What’s less well appreciated is that the Archimedes was rad for games. For a few years, it was the most powerful desktop in the world and developers were eager to show what they could do with it. + +But with such power came a great price tag. The Archimedes was never going to be in as many homes to make as many memories as Sega or Nintendo. + +But now, the Raspberry Pi’s ARM chip makes it cheap and easy to play these games on the same operating system and CPU architecture they were written for. + +Even better, the rights holders to much of this machine’s gaming catalogue have been generous enough to allow hobbyists to legally download their work for free. + +This is a cheap and easy project. In fact, if you already run a Raspberry Pi home theatre or retro gaming rig, all you really need is a spare SD card. + +### Introduction + +None of this will be on the exam, so if you already know the story of the Acorn Archimedes – or just want to get straight into gaming – feel free to skip ahead to the next section. + +But if you’re wondering what we’re even talking about, here it is: + +#### What on Earth is an Acorn Archimedes? + +Me and Acorn computers go way back. + +For the earliest part of my life that I can remember, Dad ran his business from home, writing timetabling software for schools. This was the early 80s, before the desktop computer market had been whittled down to Mac and PC. There were Amstrad CPCs, Sinclairs, Commodores, Ataris, TRSs, the list goes on. + +They all had their operating systems and ran their own software. If you wanted to port your software over to a new platform, you had to buy it. + +So, at a time when it was somewhat novel for a family to have even one computer, we had about a dozen, many of them already quite antique. There was a Microbee, an Apple IIc, an IBM XT, all sorts of stuff. + +The ones Dad liked most though were the BBC machines by [Acorn Computers][2]. He had several. There was a Model B, a Master 128 and a Master Compact. + +They were named that way because the British Broadcasting Corporation were developing a course to teach children how to program and they needed. Because of this educational focus, they’d found their way into a lot of schools – exactly the market he was selling to. + +At some point, I figured out you could play games on these things. I was straight away hooked like it was crack. All I cared about was games games games. It must have taken me several years to figure out that computers had a different use, because I can vividly recall how annoyed I was to be starting school while Dad got to stay home and play games all day. + +On my 7th birthday I got a second hand BBC Master Compact all of my own. This was probably as much to keep me away from his work computers as it was to introduce me to computing. I started learning to program in BASIC and Logo. I also played epic amounts of space shooters, 2D platformers and adventure games. + +Being obsessed with these things, I tagged along to the local BBC Users Group. This was a monthly get-together where enthusiasts would discuss what was new, bring their machines to show off what they’re doing and engage in some casual software piracy. Back before internet forums and torrents, people did this in person. + +This was where I first saw an Archimedes. I can’t really remember the exact year or the exact model – I just remember my jaw dropping to the floor at the 3D graphics and the 8 channel stereo sound. It would be about a decade before I saw anything similar on a gaming console. + + + +#### The Birth of a Legend + +Looking back, this has very good claim to be the first modern desktop computer. It was a 32-bit machine, an interface that looks more like what we use today than anything built in the 1980s, a palette of 4096 colours, and more horsepower than a lot of people knew what to do with. + +Now, don’t get me wrong: the 8-bit BBC machines were loads of fun and great for what they were – but what they were was fairly primitive. It was basically just a big box you typed commands on to make it beep and stuff. In theory it had 8 colours, but when you saw one in the wild it was usually hooked up to a monochrome screen and you didn’t feel like you were missing out on too much because of it. + +In 1984, Apple launched their Macintosh, featuring the first Graphical User Interface available on the mass market. Acorn knew they’d need a point and click graphic interface to stay in the game. And they knew the aging MOS 6502 they’d used in all their machines so far was just not going to be the CPU of the future. + +So, what to replace it with? + +The Acorn engineers looked at the available processors and found that none of them could quite do what they want. They decided to build their own – and it would be radically different. + +Up until that point, chip makers took a bit of a Swiss Army Knife approach to processor design – to compete, you added more and more useful stuff to the instruction set. + +There was a certain logic to this – hardware could be mass produced, while good software engineers were expensive. It made sense to handle as much as possible in the hardware. For device manufacturers with bills to pay, it was a real selling point. + +But this came at a cost – more and more complex instructions required more and more clock cycles to complete. Often there was a whole extra layer of processing to convert the complex machine code instructions into smaller instructions. As RAM became bigger and faster, CPUs were struggling to keep pace with the available memory bandwidth. + +Acorn turned this idea on its head, with a stripped-back approach in the great British tradition of the [de Havilland Mosquito][3]: Every instruction could be completed in a single cycle. + +While testing the prototype CPU, the engineers noticed something weird: they’d disconnected the power and yet the chip was running. What they’d built was so power-efficient that it kept running on residual power from nearby components. + +It was also 25 times faster than the 6502 CPU they used in the old BBC machines. Even better, it was several times more powerful than the Motorola 68000 found in the Apple Macintosh, Atari ST and Commodore Amiga – and several time more powerful than the 386 in the new Compaq too. + +With such radically new hardware, they needed a new operating system. What they come up with was Risc OS, and it was operated entirely through a graphic point-and-click desktop interface with a pinboard and an icon bar. This was pretty much Windows 95, 8 years before it happened. + +In a single step, Acorn had gone from producing some perfectly serviceable 8-bit box that kids could learn to code one, to having the most powerful desktop computer in the world. I mean, it was technically possible to get something more powerful – but it would have been some kind of server or mainframe. As far as something that could sit on your desk, this was top of the pile. + +It sold well in Acorn’s traditional education market in the UK. The sheer grunt also made it popular for certain power-hungry business tasks, like desktop publishing. + +#### The Crucifixion + +It wasn’t too long before Dad got an Archimedes – I can’t remember exactly which model. By this time, he’d moved his business out of home to an office. When school holidays rolled around, I’d sometimes have to spend the day at his work, where I had all the time in the world to fiddle around on it. + +The software it came with was enough to keep a child entertained for a while. It came with a demo game called Lander – this was more about showing off the machine’s 3D graphics power than providing any lasting value. There was a card game, and also some drawing programs. + + + +I played with the demo disc until I got bored – which I think was the most use that this particular machine ever got. For all the power under the hood, all the applications Dad used to actually run his business ran on DOS and Windows. + +He’d spent more than $4000 in today’s money for the most sophisticated and advanced piece of computing technology for a mile in any direction and it just sat there. + +He might have at least salvaged some beneficial utility out of it if he’d followed my advice of getting some games for it and letting me take it home. + +He never got around to writing any software on it. The Archimedes was apparently a big hit with British schools, but never really got popular enough with his Australian customer base to be worth coding for. + +Which I guess is kind of sums up where it all ultimately went wrong for the Acorn desktop. + +As the 80s wore on to the ’90s, Compaq reverse engineered the BIOS on the IBM PC to release their own fully compatible PC, and big players like Amstrad left their proprietary platforms to produce their own compatible MS-DOS machines. It was also became increasingly easy for just about anyone with a slight technical bunt to build their own PC-compatible clone from off-the-shelf parts – and to upgrade old PCs with new hard drives, sound cards, and the latest 386 and 486 processors. + +Small, independent computer shops and other local businesses started building their owns PCs and hardware manufacturers competed to sell parts to them. This was a computing platform that could serve all price points. + +With so much of the user base now on MS-DOS, software developers followed. Which only reinforced the idea that this was the obvious system to buy, which in turn reinforced that it was the system to code for. + +The days when just any computer maker could make a go of it with their own proprietary hardware and operating system had passed. Third-party support was everything. It didn’t actually matter how good your technology was if nothing would run on it. Even Apple nearly went to the wall. + +Acorn hung on through the 90s, and there was even a successor to the Archimedes called the [RiscPC][4]. But while the technology itself was again very good, these things were relatively marginal affairs in the marketplace. The era of the Acorn desktop had passed. + +#### The Resurrection + +It was definitely good for our family business when the market consolidated to Mac and PC. We didn’t need to maintain so many versions of the same software. + +But the Acorn machines had so much sentimental value. We both liked them and were sad to see them go. I’ve never been that into sport, but watching them slowly disappear might have been a bit like watching your football team lose match after match before finally going broke. + +We totally had no idea that they were, very quietly, on a path to total domination. + +The ARM was originally only built to go in the Archimedes. But it turned out that having a massively powerful processor with a simple instruction set and very little heat emission was useful for all sorts of stuff: DVD players, set top boxes, photocopiers, televisions, vending machines, home and small business routers, you name it. + +The ARM’s low power consumption made it especially useful for portable devices like PDAs, digital cameras, GPS navigators and – eventually – tablets and smartphones. Intel tried to compete in the smartphone market, but was [eventually forced to admit that this technology was just better for phones][5]. + +So in the end, Dad’s old BBC machines went on to conquer the world. + +### The Acorn Archimedes as a Gaming Platform + +While Microsoft operating systems were ultimately to become the only real choice for the serious desktop gamer, for a while the Archimedes was the most powerful desktop computer in the world. This attracted a lot of games developers, eager to show what they could do with it. + +This would have been about more than just selling to a well moneyed section of the desktop computer market that was clearly quite willing to throw cash at shiny things. It would have been a chance to make your reputation in the industry with a flagship product that just wasn’t possible on lesser hardware. + +So it is that you see Star Fighter 3000, Chocks Away and Zarch all charting new territory in what was possible on a desktop computer. + +But while the 3D graphics power was this system’s headline feature, the late 80s and early 90s were really the era of Sonic and Mario: the heyday of 2D platform games. Here, the Archimedes also excels, with offerings like Mad Professor Mariarti, Bug Hunter, F.R.E.D. and Hamsters, all of which are massively playable, have vibrant graphics and a boatload of personality. + +As you dig further into the library, you also find a few games that show that not every developer really knew what to do with this machine. Some games – like Repton 3 – are just old BBC micro games given the most meagre of facelifts. + +Many of the games in the Archimedes catalogue you’ll recognise from other platforms: Populous, Lemmings, James Pond, Battle Chess, the list goes on. + +Here, the massive hardware advantage of the Archimedes means that it usually had the best version of the game to play. You’re not getting a whole new game here: but it’s noticeably smoother graphics and gameplay, especially compared to the console releases. + +All in all, the Archimedes never had a catalogue as expansive as MS-DOS, the Commodore Amiga, or the Sega and Nintendo consoles. But there are enough truly excellent games to make it worth an SD card. + +### Configuring Your Raspberry Pi + +This is a bit different to other retro gaming options on the Raspberry Pi – we’re not running an emulator. The ARM chip in the Pi is a direct descendant of the one in the Archimedes, and there’s an [open source version of Risc OS][6] we can install on it. + +For the most hardcore retro gaming purist, nothing less than using the hardware will do. For everyone else, using the same operating system from back in the day to load up your games means that your retro gaming rig becomes just that little bit more of a time machine. + +But even with all these similarities, there’s still going to be a few things that change in 30 years of computing. + +The most visible difference is that our Raspberry Pi doesn’t come with an internal 3.5″ floppy disk drive. You might be able to hook up a USB one, but most of us don’t have this lying around and don’t really want one. So we’re going to need a different way to boot floppy images. + +The more major difference is how much RAM the operating system is written to handle. The earliest versions of Risc OS made efficient use of the ARM’s 32-bit register by using 26 bits for the memory address and the remaining 6 bits for status flags. A 26-bit scheme gives you enough addressing space for up to 64 megabytes of RAM. + +When this was first devised, the fact that an Archimedes came with a whole megabyte of RAM was considered incredibly luxurious by the standards of the day. By contrast, the first Commodore Amiga had 256kb of RAM. The Sega Mega Drive had 72kb. + +But as time wore on, and later versions of Risc OS moved to a 32-bit addressing scheme. This is what we have on our Raspberry Pi. A few games have been [recompiled to run on 32 bit addressing][7], but most have not. + +The Archimedes also used different display drivers for different screens. These days, our GPU can handle all of this for us. We just need to install a patch to get that working. + +There are free utilities you can download to handle all of these things. + +#### Hardware Requirements + +I’ve tested this to work with a Raspberry Pi Model 3 B, but I expect that any Pi from the Model A onwards should manage this. The ARM processor on the slowest Pi is a great many times more powerful than the on the fastest Archimedes. + +The lack of ports on a Raspberry Pi Zero means it’s probably not the most convenient choice, but if you can navigate around this, then it should be powerful enough. + +In addition to the board, you’ll need something to put it in, a micro SD card, a USB SD card adapter, a power supply, a screen with an HDMI input, a USB keyboard and a 3 button mouse – a clickable scroll wheel works fine for your middle button. + +If you already have a Raspberry Pi home theatre or retro gaming rig, then you’ve already got all this, so all you really need is a new micro SD card to swap in for Risc OS. + +#### Installing Risc OS Open + +When I first wrote this guide, Risc OS wasn’t an available option for the Raspberry Pi 3 on the NOOBS and PINN installers. That meant you had to download the image from the [Risc OS Open downloads page][8] and burn it to a new micro SD card. + +You can still do this if you like, and if you can’t connect your Raspberry Pi to the internet via Wi-Fi or Ethernet then that’s still your best option. If you’re not sure how to write an image to an SD card, here’s some good guides for [Windows][9] and for [Mac][10]. + +For everyone else, now that Risc OS is available in the [NOOBS installer][11] again, I recommend using that. What’s really cool about NOOBS is that it makes it super simple to dual boot with something like [Retropie][12] or [Recalbox][13] for the ultimate all-in-one retro gaming device. + +Risc OS is as an extremely good option for a dual boot machine because it only uses a few gigabytes – a small fraction of even the smallest SD cards around these days. This leaves most of it available for other operating systems and saves you having to swap cards, which can be a right pain if you have to unscrew the case. The games themselves vary from about 300kb to about 5 megabytes at the very largest, so don’t worry about that. + +This image requires a card with at least 2 gigabytes, which for what we’re doing is plenty. Don’t worry about tracking down the largest SD card you can find. The operating system is extremely lightweight and the games themselves vary from about 300kb to about 5 megabytes at the very largest. Even a very small card offers enough space for hundreds of games – more than you will ever play. + +If you’re unsure how to use the NOOBS installer, please [click here for instructions][14]. + +#### Navigating Risc OS + +Compared to your first Linux experience, using Risc OS for the first time is, in my opinion, far more gentle. This is in large part thanks to a graphical interface that’s both fairly intuitive and actually very useful for configuring things. + +The command line is there if you want it, but we won’t need it just to play some games. You can kind of tell that this was first built with a mass-market audience in mind. + +So let’s jump right in. + +Insert your card into your Pi, hook it up to your screen, keyboard, mouse and power supply. It shouldn’t take all that long before you’re at the desktop. + +###### The Risc OS Mouse + +Risc OS uses a three button mouse. + +You use the left button – or “Select” button – in much the same way as you’re already used to: one click to select icons and a double click to open folders and execute programs. + +The middle button – ie, your scroll wheel – is used to open menus in much the same way as the right mouse button is used in Windows. We’ll be using this a lot. + +The right button – or “Adjust” button – has behaviours that vary between applications. + +###### Browsing Directories + +Ok, so let’s start taking a look around. At the bottom of the screen you’ll see an icon bar. In the bottom left are icons for storage devices. + +Click once with the left mouse button on the SD card and a window will open to show you what’s on it. You can take a look inside the directories by double clicking. + +###### The Pling + +As you start to browse Risc OS, you’ll notice that a lot of what you see inside the directories has exclamation marks at the beginning. This is said out aloud as a “pling”, and it’s used to mark an application that you can execute. + +One of the quirks of Risc OS is that these executables aren’t really files – they’re directories. If you hold shift while double clicking, you can open them and start looking inside, same as any other directory – but be careful with this, it’s a good way to break stuff. + +Risc OS comes with some applications installed – including a web browser called !NetSurf. We’ll be using that soon to download our games and some small utilities we need to get them running. + +###### Creating Directories + +Risc OS comes with a basic directory structure, but you’ll probably want to create some new ones to put your floppy images and .zip files. + +To do this, click with the middle button inside the folder where you want to place your new directory. This will open up a menu. Move your mouse over the arrow next to “New Directory” and a prompt will open where you can name it and press OK. + +###### Copying Files and Directories + +To copy a file or directory somewhere else, just drag and drop it with the left mouse button to the new location. + +###### Forcing Applications to Quit + +Sometimes, if you haven’t configured something right, if you’ve downloaded something that just doesn’t work, or if you plain forgot to look up the controls in the manual, you might find yourself stuck inside an application that has a blank screen or isn’t responding. + +Here, you can press Ctrl-Shift-F12 to quit back to the desktop. + +###### Shutting Down and Rebooting + +If you want to power down or reboot your Pi, just click the middle button on the raspberry icon in the bottom right corner and select “Shutdown”. This will give you an option to reboot the Pi or you can just remove the power cable. + +#### Connecting to the Internet + +Okay, so I’ve got good news and bad news. I’ll get the bad news right out of the way first: + +Risc OS Open doesn’t yet support wireless networking through either the onboard wireless or a wireless dongle in the USB port. It’s on the [to-do list][15]. + +In the meantime, if you can a way to connect to the internet through the Ethernet port, it makes the rest of this project a lot easier. If you were going to use an Ethernet cable anyway, this will be no big deal. And if you have a wireless bridge handy, you can just use that. + +If you don’t have a wireless bridge, but do have a second Raspberry Pi board lying around (hey, who doesn’t these days :p), you can [set it up as a wireless bridge][16]. This is what I did and it’s actually pretty easy if you just follow the steps. + +Another option might be to set up a temporary tinkering area next to your router so that you can plug straight in to get everything in configured. + +Ok, so what’s the good news? + +It’s this: once you’ve got the internet in your front hole, the rest is rather easy. In fact, the only bit that’s not done for your is configuring name servers. + +So let’s get to it. + +Double-click on !Configure, click once on Network, click on Internet and then on Host Names. Then enter the IPs of your name servers in the name server fields. If you’re not sure what IP to put in here, just use Google’s publicly available name servers – 8.8.8.8 and 8.8.4.4. + +When you click Set, it will ask you if you want to reboot. Click yes. + +Now double-click on !NetSurf. You’ll see the logo is now added to the bottom right corner. Click on this to open a new browser window. + +Compared to Chrome, Firefox, et al, !NetSurf is a primitive web browser. I do not recommend it as a daily driver. But to download Risc OS software directly to the Pi, it’s actually pretty damn convenient. + +###### Short Link to This Guide + +As you go through the rest of this guide, it’s going to get annoying copying by hand all the URLs you’ll want to visit. + +To save you this trouble, type bit.do/riscpi into the browser bar to load this page. With this loaded, you can follow the links. + +###### If You’re Still Getting Host Name Error Messages + +One little quirk of Risc OS is that it seems to check for name servers as part of the boot process. If it doesn’t find them then, it assumes they’re not there for the rest of the session. + +This means that if you connect your Pi to the internet when it’s already booted, you will get an error message when you try to browse the internet with !NetSurf. + +To fix this, just double check that your wireless bridge is switched on or that your Pi is plugged into the router, reboot, and the OS should find the name servers. + +###### If You Can’t Connect to the Internet + +If this is all too hard and you absolutely can’t connect to the internet, there’s always sneakernet – downloading files to another machine and then transferring by USB stick. + +This is what I tried at first; It does work, but I found it terribly annoying. + +One frustration is that using a Windows 10 machine to download Risc OS software seems to strip out the filetype information – even when you aren’t unzipping the archives. It’s not that difficult to repair this, it’s just tedious when you have to do it all the time. + +The other problem is that running USB sticks from computer to computer all the time just got a bit old. + +Still, if you have to do it, it’s an option. + +#### Unzipping Compressed Files + +Most of the files we’ll be downloading will come in .zip format – this is a good thing, because it preserves the file type information. But we’ll need a way to uncompress these files. + +For this we’ll use a program called !SparkFS. This is proprietary software, but you can download a read-only version for free. This will let us extract files from .zip archives. + +To download and install !SparkFS, click [this link][17] and follow the instructions. You want the version of this software for machines with more than 2MB of RAM. + +#### Installing ADFFS and Anymode + +Now we need to install ADFFS, a floppy disk imaging program written by Jon Abbot of the [Archimedes Software Preservation Project][18]. + +This gives us a virtual floppy drive we can use to boot floppy images. It also takes care of the 26 bit memory addressing issues. + +To get your copy, browse to the [ADFFS subforum][19] and click the thread for the latest public release – at the time of writing that’s 2.64. + +Download the .zip file, open it and then drag and drop !ADFFS to somewhere on your SD card where it’s conveniently accessible – we’ll be using it a lot. + +###### Configuring Boot Scripts + +For ADFFS to work properly, we’re going to need to add a little boot script. + +Follow these instructions carefully – if you do the wrong thing here you can really mess up your OS, or even brick your Pi. + +###### Creating !Boot.Loader.CMDLINE/TXT + +Remember how I showed you that you could open up applications as directories by holding down shift when you double-click? We can also do this to get inside the Risc OS boot process. We’ll need to do this now to add our boot script. + +Start by left clicking once on the SD card icon on the icon bar, then hold down shift and double-click !Boot with your left mouse button. Then double click the folder labeled Loader to open it. This is where we’re going to put our script. + +To write our script, click Apps on the icon bar, then double-click !StrongEd. Now click on the fist icon that appeared on the bottom right of the icon bar to open a text editor window, and type: + +``` +disable_mode_changes +``` + +Computers are fussy so take a moment to double-check your spelling. + +To save this file, click the middle button on the text editor and hover your cursor over the arrow next to Save. Then delete the existing text in the Name field and replace it with: + +``` +CMDLINE/TXT +``` + +Now, see that button marked Save? It’s a trap! Instead, drag and drop the pen and paper icon to the Loader folder. + +We’re now finished with this folder, so you can close it and also close the text editor. + +###### Installing Anymode + +Now we need to install the Anymode module. This is to make the screen modes on our software play nice with our GPU and HDMI output. + +Download Anymode from [here,][20] copy the .zip file to somewhere temporary and open it. + +Now go back to the root directory on your SD card, double-click on !Boot again, then open the folders marked Choices, Boot and Predesk. + +Then use your left mouse button to drag and drop the Anymode module from your .zip file to the Predesk folder. + +#### Configuring USB Joysticks and Gamepads + +Over at the Archimedes Software Preservation Project, there’s a [USB joystick driver][21] in development. + +This module is still in alpha testing, and you’ll need to use the command line to configure it, but it’s there if you’d like to give it a try. + +If you can’t get this working, don’t worry too much. It was actually pretty normal back in the day for people either to not have a joystick, or not to be able to get it to work. So pretty much every game can be played with keyboard and mouse. + +I’ll be updating this section as this project develops. + +#### Setting File Types + +Risc OS uses an [ADFS][22] filesystem, different to anything used on Windows or Linux. + +Instead of using a filename extension, ADFS files have a “file type” associated with them to show what. When these files pass through a different operating system, this information can get stripped from the file. + +In theory, if we don’t open our .zip archives until it reaches our Risc OS machine, the file type should be preserved. Usually this works, but sometimes you unzip the archive and find files with no file type attached. You’ll be able to tell when this has happened because you’ll be faced with a green icon labeled “data”. + +Fortunately, this is pretty easy to fix. + +Just click on the file with your middle button. A menu will appear. + +The second item on this menu will include the name of the file and it will have an arrow next to it. Hover your cursor over the arrow and a second menu will appear. + +Near the bottom of this menu will be an option marked “Set Type”, and it will also have an arrow next to it. Hover your cursor over this arrow and a field will appear where you can enter the file type. + +To set the file type on a floppy image, type: + +``` +&FCE +``` + +[Click here for more file type codes.][23] + +### Finding, Loading and Playing Games + +The best start looking for floppy images is in the [Games subforum][24] at the Archimedes Software Preservation Project. + +There’s also a [Risc OS downloads section at Acorn Arcade][25]. + +There are definitely other websites that host Archimedes games, but I have no idea how legal these copies are. + +###### Booting and Switching Floppy Disc Images + +Some games might have specific instructions for how to boot the floppy. If so, then follow them. + +Generally, though, you drag and drop the image file to, then click on it with the middle button and press “boot floppy”. Your game should start straight away. + +Many of the games use more than one floppy disc. To play these, boot disc 1. When you’re asked to switch floppy discs, press control and shift and the function key corresponding to the disc you want to change to. + +### Which Games Should You Play? + +This is a matter of opinion really and everyone’s taste differs. + +Still, if you’re wondering what to try, here are my recommendations. + +This is still a work in progress. I’ll be adding more games as I find what I like. + +#### Cannon Fodder + + + +This is a top-down action/strategy game that’s extremely playable and wickedly funny. + +You control a team of soldiers indirectly by clicking on areas of the screen to tell them where to move and who to kill. Everyone dies with a single shot. + +At the start your enemies are all very easy to beat but the game progresses in difficulty. As you go, you’ll need to start dividing your team up into squads to command separately. + +I used to play this on the Mega Drive back in the day, but it’s so much more playable with an actual mouse. + +[Click here to get Cannon Fodder.][26] + +#### Star Fighter 3000 + + + +This is a 3D space shooter that really laid down the gauntlet for what the Archimedes could do. + +You fly around and blast stuff with lasers and missiles. It’s pretty awesome. It’s kind of a forerunner to Terminal Velocity, if you ever played that. + +It was later ported to the 3D0, Sega Saturn and Playstation, but they could never render the 3D graphics to the same distance. + +[Click here to get Star Fighter 3000.][27] + +You want the download marked “Star Fighter 3000 version 3.20”. This one doesn’t use a floppy image, so don’t use ADFFS to run this file. Just double click the program and go. + +#### Aggressor + + + +This is a side-scrolling run-and-gun where you have unlimited ammo and a whole lot of aliens and robots to kill. Badass. + +#### Bug Hunter + + + +This is a really unique puzzle/platform game – you’re a robot with sticky legs who can walk up and down walls and across the ceiling, and your job is to squash bugs by dropping objects lying around. + +Which is harder than it sounds, because you can easily get yourself into situations where you dropped something in the wrong place, making it impossible to complete your objective, so your only way out is to initiate your self destruct sequence in futility and shame. Which I guess is kinda rather dark, if you dwell on it. + +It’s fun though. + +[Click here to get Bug Hunter.][28] + +#### Mad Professor Mariarti + + + +This is a platformer where you’re a mad scientist who shoots spanners and other weapons at bad guys. It has good music and gameplay and an immersive puzzle element as well. + +[Click here to get Mad Professor Mariarti.][29] + +#### Chuckie Egg + +Ok, now we’re getting really retro. + +Strictly speaking, this doesn’t really belong in this list, because it’s not even an Archimedes game – it’s an old BBC Micro game that I played the hell out of back in the day that some nice chap has ported to Risc OS. + +But there’s a version that runs and it’s awesome so you should play it. + +Basically you’re just this guy who goes around stealing eggs. That’s it. That’s all you do. + +It’s absolutely amazing. + +If you’ve never played it, you really should check it out. + +You can [get Chuckie Egg here][30]. + +This isn’t a floppy image, so you don’t need ADFFS to run it. Just double click on the program and go. + +### Over to You + +Got any favourite Acorn Archimedes games? + +Got any tips for getting them running on the Pi? + +Please let me know in the comments section 🙂 + +-------------------------------------------------------------------------------- + +via: https://blog.dxmtechsupport.com.au/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/ + +作者:[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/2018/06/cannonfodder-1024x768.jpg +[2]: http://www.computinghistory.org.uk/det/897/Acorn-Computers/ +[3]: http://davetrott.co.uk/2017/03/strategy-is-sacrifice/ +[4]: http://www.old-computers.com/museum/computer.asp?c=1015 +[5]: https://www.theverge.com/2016/8/16/12507568/intel-arm-mobile-chips-licensing-deal-idf-2016 +[6]: https://www.riscosopen.org/content/ +[7]: https://www.riscosopen.org/wiki/documentation/show/ARMv6%2Fv7%20software%20compatibility%20list#games +[8]: https://www.riscosopen.org/content/downloads/raspberry-pi +[9]: http://www.raspberry-projects.com/pi/pi-operating-systems/win32diskimager +[10]: http://osxdaily.com/2018/01/11/write-img-to-sd-card-mac-etcher/ +[11]: https://www.raspberrypi.org/downloads/noobs/ +[12]: https://retropie.org.uk/ +[13]: https://www.recalbox.com/ +[14]: https://www.raspberrypi.org/documentation/installation/noobs.md +[15]: https://www.riscosopen.org/wiki/documentation/show/RISC%20OS%20Roadmap +[16]: https://pimylifeup.com/raspberry-pi-wifi-bridge/ +[17]: http://www.riscos.com/ftp_space/generic/sparkfs/index.htm +[18]: https://forums.jaspp.org.uk/forum/index.php +[19]: https://forums.jaspp.org.uk/forum/viewforum.php?f=14&sid=d0f037e95c560144f3910503b776aef5 +[20]: http://www.pi-star.co.uk/anymode/ +[21]: https://forums.jaspp.org.uk/forum/viewtopic.php?f=8&t=396 +[22]: https://en.wikipedia.org/wiki/Advanced_Disc_Filing_System +[23]: https://www.riscosopen.org/wiki/documentation/show/File%20Types +[24]: https://forums.jaspp.org.uk/forum/viewforum.php?f=25 +[25]: http://www.acornarcade.com/downloads/ +[26]: https://forums.jaspp.org.uk/forum/viewtopic.php?f=25&t=188 +[27]: http://starfighter.acornarcade.com/ +[28]: https://forums.jaspp.org.uk/forum/viewtopic.php?f=25&t=330 +[29]: https://forums.jaspp.org.uk/forum/viewtopic.php?f=25&t=148 +[30]: http://homepages.paradise.net.nz/mjfoot/riscos.htm From 40d2dc885ebd13ed8fe0b07728d490678e4533bc Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 17 Dec 2018 19:20:58 +0800 Subject: [PATCH 0155/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Streaming=20Aus?= =?UTF-8?q?tralian=20TV=20Channels=20to=20a=20Raspberry=20Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ustralian TV Channels to a Raspberry Pi.md | 209 ++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 sources/tech/20180527 Streaming Australian TV Channels to a Raspberry Pi.md diff --git a/sources/tech/20180527 Streaming Australian TV Channels to a Raspberry Pi.md b/sources/tech/20180527 Streaming Australian TV Channels to a Raspberry Pi.md new file mode 100644 index 0000000000..ac756223f1 --- /dev/null +++ b/sources/tech/20180527 Streaming Australian TV Channels to a Raspberry Pi.md @@ -0,0 +1,209 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Streaming Australian TV Channels to a Raspberry Pi) +[#]: via: (https://blog.dxmtechsupport.com.au/streaming-australian-tv-channels-to-a-raspberry-pi/) +[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) + +Streaming Australian TV Channels to a Raspberry Pi +====== + +If you’re anything like me, it’s been years since you’ve even thought about hooking an antenna to your television. With so much of the good stuff available by streaming and download, it’s easy go a very long time without even thinking about free-to-air TV. + +But every now and again, something comes up – perhaps the cricket, news and current affairs shows, the FIFA World Cup – where the easiest thing would be to just chuck on the telly. + +When I first started tinkering with the Raspberry Pi as a gaming and media centre platform, the standard advice for watching broadcast TV always seemed to involve an antenna and a USB TV tuner. + +Which I guess is fine if you can be arsed. + +But what if you utterly can’t? + +What if you bitterly resent the idea of more clutter, more cords to add to the mess, more stuff to buy? What if every USB port is precious and jealously guarded for your keyboard, mouse, game controllers and removable storage? What if the wall port for your roof antenna is in a different room? + +That’s all a bit of a hassle for a thing you might use only a few times a year. + +In 2018, shouldn’t we just be able to stream free TV from the internet? + +It turns out that, yes, we can access legal and high quality TV streams from any Australian IP using [Freeview][1]. And thanks to a cool Kodi Add-on by [Matt Huisman][2], it’s now really easy to access this service from a Raspberry Pi. + +I’ve tested this to work on a Model 3 B+ running Retropie 4.4 and Kodi 17.6. But it should work similarly for other models and operating systems, so long as you’re using a reasonably up-to-date version of Kodi. + +Let’s jump right in. + +### If You Already Have Kodi Installed + +If you’re already using your Raspberry Pi to watch movies and TV shows, there’s a good chance you’ve already installed Kodi. + +Most Raspberry Pi operating systems intended for media centre use – such as OSMC or Xbian – come with Kodi installed by default. + +It’s fairly easy to get running on other Linux operating systems, and you might have already installed it there too. + +If your version of Kodi is more than a year or so old, it might be an idea to update it. The following instructions are written for the interface on Kodi 17 (Krypton). + +You can do that by typing the following commands at the command line: + +``` +sudo apt-get update +sudo apt-get upgrade +``` + +And now you can skip ahead to the next section. + +### Installing Kodi + +Installing Kodi on Retropie and other versions of Raspbian is fairly simple. Other Linux operating systems should be able to run it, perhaps with a bit of coaxing. + +You will need to be connected to the internet to install it. + +If you’re using something, such as Risc OS – you probably can’t install kodi. You will need to either swap in another SD card, or use a boot loader to boot into a media centre OS for your TV viewing. + +#### Installing Kodi on Retropie + +It’s really easy to install Kodi using the Retropie menu system. + +Here’s how: + + 1. Navigate to the Retropie main screen – that’s that horizontal menu where you can scroll left and right through all your different consoles + 2. Select “Retropie” + 3. Select “Retropie setup” + 4. Select “Manage Packages” + 5. Select “Manage Optional Packages” + 6. Scroll down and select “Kodi” + 7. Select “Install from Binary” + + + +This will take a minute or two to install. Once it’s installed, you can exit out of the Retropie Setup screen. When you next restart Retropie, you will see Kodi under the “Ports” section of the Retropie main screen. + +#### Installing Kodi on Raspbian + +If you’re running Raspbian without Retropie. But that’s okay, because it’s pretty easy to do it from the command line + +Just type: + +``` +sudo apt-get update +sudo apt-get install kodi +``` + +At this point you have a vanilla installation of Kodi. You can run it by typing: + +``` +kodi +``` + +It’s possible to delve a lot further into setting up Kodi from the command line. Check out [this guide][3] if you’re interested. + +If not, what you’ve just installed will work just fine. + +#### Installing Kodi on Other Versions of Linux + +If you’re using a different flavour of Linux, such as Pidora or Arch Linux ARM, then the above might or might not work – I’m not really sure, because I don’t really use these operating systems. + +If you get stuck, it might be worth a look at the [how-to guide][4] on the Kodi wiki. + +#### Dual Booting a Media Centre OS + +If your operating system of choice isn’t suitable for Kodi – or is just too confusing and difficult to figure out – it might be easiest to use a boot loader for multiple operating systems on the one SD card. + +You can set this up using an OS installer like [PINN][5]. + +Using PINN, you can install a media centre OS like [OSMC][6] to use Kodi – it will be installed with the operating system – and then your preferred OS for your other uses. + +It’s even possible to [move your existing OS over][7]. + +### Adding Australian TV Channels to Kodi + +With Kodi installed and running, you’ve got a pretty good media player for the files on your network and hard drive. + +But we need to install an add-on if we want to use it to chuck on the telly. This only takes a minute or so. + +#### Installing Matt Huisman’s Kodi Repository + +Ready? Let’s get started. + + 1. Open Kodi + 2. Click the cog icon at the top left to enter the settings + 3. Click “System Settings” + 4. Select “Add-ons” + 5. Make sure that “Unknown Sources” is enabled + 6. Right click anywhere on the screen to navigate back to the settings menu + 7. Click “File Manager” + 8. Click “Add Source” + 9. Double-click “Add Source” + 10. Select “” + 11. Type in exactly **** + 12. Select “OK” + 13. Click the text input underneath the label “Enter a name for this media source.” + 14. Type in exactly **MJH** + 15. Click “OK” + 16. Right click twice anywhere on the screen to navigate back to the main menu + 17. Select “Add-ons” + 18. Click “My Add-ons” + 19. Click “..” + 20. Click “Install from zip file” + 21. Click “MJH” + 22. Select “repository.matthuisman.zip” + + + +The repository is now installing. + +If you get stuck with any of this, here’s a video from Matt that starts by installing the repository. + + + +#### Installing the Freeview Australia Add-On + +We’re nearly there! Just a few more steps. + + 1. Right click anywhere on the screen a couple of times to navigate back to the main menu + 2. Select “Add-ons” + 3. Click “My add-ons” + 4. Click “..” + 5. Click “Install from repository” + 6. Click “MattHuisman.nz Repository” + 7. Click “Video add-ons” + 8. Click “AU Freeview” + 9. Click “Install” + + + +You can now have every free-to-air TV channel in your Add-ons main menu item. + +### Watching TV + +When you want to chuck the telly on, all you need to do is click “AU Freeview” in the Add-ons main menu item. This will give you a list of channels to browse through and select. + +If you want, you can also add individual channels to your Favourites menu by right clicking them and selecting “Add to favourites”. + +By default you will be watching Melbourne television. You can change the region by right clicking on “AU Freeview” and clicking “settings”. + +When you first tune in, it sometimes jumps a bit for a few seconds, but after that it’s pretty smooth. + +After spending a few minutes with this, you’ll quickly realise that free-to-air TV hasn’t improved in the years since you last looked at. Unfortunately, I don’t think there’s a fix for that. + +But at least it’s there now for when you want it. + +-------------------------------------------------------------------------------- + +via: https://blog.dxmtechsupport.com.au/streaming-australian-tv-channels-to-a-raspberry-pi/ + +作者:[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]: http://www.freeview.com.au/ +[2]: https://www.matthuisman.nz/ +[3]: https://www.raspberrypi.org/forums/viewtopic.php?t=192499 +[4]: https://kodi.wiki/view/HOW-TO:Install_Kodi_for_Linux +[5]: https://github.com/procount/pinn +[6]: https://osmc.tv/ +[7]: https://github.com/procount/pinn/wiki/How-to-Create-a-Multi-Boot-SD-card-out-of-2-existing-OSes-using-PINN From feda553caebe541995208fe397bf18f96a0d184c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 19:33:14 +0800 Subject: [PATCH 0156/4278] PRF:20181210 How to get started in AI.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qhwdw 好文章 --- .../tech/20181210 How to get started in AI.md | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/translated/tech/20181210 How to get started in AI.md b/translated/tech/20181210 How to get started in AI.md index ee88bb6961..a88e0588f7 100644 --- a/translated/tech/20181210 How to get started in AI.md +++ b/translated/tech/20181210 How to get started in AI.md @@ -1,28 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (How to get started in AI) [#]: via: (https://opensource.com/article/18/12/how-get-started-ai) [#]: author: (Gordon Haff https://opensource.com/users/ghaff) -学习人工智能如何起步 +学习人工智能如何入门 ====== -在你开始从事人工智能之前,你需要先了解人类的智能。 + +> 在你开始从事人工智能之前,你需要先了解人类的智能。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain-think-ai-intelligence-ccby.png?itok=C-gK01E_) -我曾经问过别人也被别人问过关于学习人工智能最好的方式是什么?我应该去阅读什么?我应该去关注什么?后面我将讲到这些,但是,考虑到人工智能涉及很多领域,我把这个问题分开来讲可能更好理解。 +我曾经问过别人、也被别人问过关于学习人工智能(AI)最好的方式是什么?我应该去阅读什么书?我应该去看什么视频?后面我将讲到这些,但是,考虑到人工智能涉及很多领域,我把这个问题分开来讲可能更好理解。 -学习人工智能很重要的一点是区别开研究方面和应用方面。Google 的 Cassie Kozyrkov 在近日于伦敦举行的 O’Reilly 人工智能会议的一个演讲中 [描述了这个区别][1],并且这是一个很好的区别。 +学习人工智能很重要的一点是区别开研究方面和应用方面。Google 的 Cassie Kozyrkov 在近日于伦敦举行的 O'Reilly 人工智能会议的一个演讲中 [描述了这个区别][1],并且这是一个很好的演讲。 -研究人工智能在本质上是学术性的,在你能够获得人工智能的某些细节之前,需要大量的跨各类学科的数学知识。这部分人工智能关注于算法和驱动人工智能发展的工具。比如,什么样的神经网络结构能够改善视觉识别的结果?我们如何使无监督学习成为更有用的方法?我们能否找到一个更好的方法,去理解深度学习流水线是如何得出答案的? +人工智能研究在本质上是学术性的,在你能够获得人工智能的某些细节之前,需要大量的跨各类学科的数学知识。这部分的人工智能关注于算法和驱动人工智能发展的工具。比如,什么样的神经网络结构能够改善视觉识别的结果?我们如何使无监督学习成为更有用的方法?我们能否找到一个更好的方法,去理解深度学习流水线是如何得出答案的? -另一方面,人工智能应用更多是关于使用现有工具去获取有用的结果。开源在这里发挥了一个重要的作用,那就是免费提供了易于使用的、各种语言的软件。公有云提供商也致力于提供大量的机器学习、模型、以及数据集,这使得人工智能入门比其它的要简单的多。 +另一方面,人工智能应用更多是关于使用现有工具去获取有用的结果。开源在这里发挥了一个重要的作用,那就是免费提供了易于使用的、各种语言的软件。公有云提供商也致力于提供大量的机器学习、模型、以及数据集,这使得人工智能的入门比其它的要简单的多。 -在这个问题上我想补充一点,那就是人工智能的从业者不应该为了故弄玄虚而将它们的工具搞成只输出答案的黑匣子。至少,他们应该去了解不同技术、模型、和数据采集方法的限制和潜在偏差。但不需要去深入研究他们工具链中每个部分的理论。 +在这个问题上我想补充一点,那就是人工智能的从业者不应该将他们的工具视为神秘地输出答案的黑匣子。至少,他们应该去了解不同技术、模型、和数据采集方法的限制和潜在偏差。只是不需要去深入研究他们工具链中每个部分的理论基础。 -虽然在日常工作中人工智能可能并不那么重要,但理解人工智能的大量的背景知识还是很有用的。人工智能已经超越了神经网络上深度学习的狭窄范围,目前神经网络上的强化学习和监督学习已经取得重要成就。例如,人工智能经常被视为是增强(而不是替代)人类判断和决策的一种方法。但是在机器和人类之间切换还有它自己的缺陷。 +虽然在日常工作中人工智能可能并不那么重要,但理解人工智能的大量的背景知识还是很有用的。人工智能已经超越了神经网络上深度学习的狭窄范围,目前神经网络上的强化学习和监督学习已经取得重要成就。例如,人工智能经常被视为是增强(而不是替代)人类判断和决策的一种方法。但是在机器和人类之间交换信息还有其自身的缺陷。 有了这些背景知识,下面是的一些研究领域和资源,你可能发现会很有用。 @@ -32,47 +34,46 @@ 你的计算机科学和数学背景知识决定了你的起点。 -如果你的计算机科学和数据背景知识很差或已经荒芜了,但你还希望能够深入了解人工智能的基本原理,那么从一些数学课程开始将会让你受益。MOOCs 上像非盈利的 [edX][2] 平台和 [Coursera][3] 上都有许多可供你选择的课程(这两个平台都对认证收费,但 edX 上所有的课程,对旁听者是全免费的)。 +如果你的计算机科学和数据背景知识很差或已经荒芜了,但你还希望能够深入了解人工智能的基本原理,那么从一些数学课程开始将会让你受益。MOOC 上像非盈利的 [edX][2] 平台和 [Coursera][3] 上都有许多可供你选择的课程(这两个平台都对认证收费,但 edX 上所有的课程,对旁听者是全免费的)。 典型的基础课程包括: -+ [MIT 的微积分课程][22],从微分开始学习 -+ [线性代数][23] (德克萨斯大学) -+ 概率与统计,比如 MIT 的 [概率 — 不确定性与数据科学][24] +- [MIT 的微积分课程][22],从微分开始学习 +- [线性代数][23] (德克萨斯大学) +- 概率与统计,比如 MIT 的 [概率 —— 不确定性与数据科学][24] +从一个研究的角度去深入人工智能,你可能需要深入所有的这些数据领域,甚至更多。但是上面的内容应该让您在深入研究机器学习和AI之前大致了解可能是最重要的研究分支。 -从一个研究的角度去深入人工智能,你可能需要深入所有的这些数据领域,甚至更多。在深入研究机器学习和人工智能之前,上述的内容应该会让你得到一些常见研究分支的大致概念。 +除了 MOOC 之外,像 [MIT OpenCourseWare][4] 这样的资源也提供了大量的数学和计算机科学课程的大纲和各种支持材料。 -除了 MOOCs 之外,像 [MIT OpenCourseWare][4] 这样的资源也提供了大量的数学和计算机科学课程的大纲和各种支持材料。 - -有了这些基础,你就可以学习更专业的人工智能课程了。Andrew Ng 在斯坦福大学教的 “AI MOOC” 就是整个在线课程中最早流行起来的课程之一。今天,他的 [神经网络和深度学习][5] 也是 Coursera 深度学习专业的一部分。在 edX 上也有相关的一些项目,比如,哥伦比亚大学提供的一个 [人工智能 MicroMasters][6]。 +有了这些基础,你就可以学习更专业的人工智能课程了。吴恩达从他在斯坦福大学时教的 “AI MOOC” 就是整个在线课程领域中最早流行起来的课程之一。今天,他的 [神经网络和深度学习][5] 也是 Coursera 深度学习专业的一部分。在 edX 上也有相关的一些项目,比如,哥伦比亚大学提供的一个 [人工智能 MicroMasters][6]。 除了课程之外,也可以在网上找到各种范例和其它学习材料。这些包括: * [神经网络和深度学习][7] - * MIT 的 Ian Goodfellow、Yoshua Bengio、Aaron Courville 出版的 [深度学习][8] + * MIT 出版的 Ian Goodfellow、Yoshua Bengio、Aaron Courville 的《[深度学习][8]》 ### 应用人工智能 -人工智能应用更关注于使用可用的工具,而不是去构建新工具。对一些底层的数学,尤其是统计学的了解仍然是非常有用的 — 甚至可以说是必需的 — 但对这些知识的了解程度不像研究人工智能的要求那么高。 +人工智能应用更关注于使用可用的工具,而不是去构建新工具。对一些底层的数学,尤其是统计学的了解仍然是非常有用的 —— 甚至可以说是必需的 —— 但对这些知识的了解程度不像研究人工智能的要求那么高。 -在这里编程是核心技能。虽然可以使用不同的编程语言去做,但是一些库和工具集 — 比如 Python 的 [PyTorch][9],在这方面有很好的专长。尤其是,如果你有一些编程方面的背景知识,MIT 的 [计算机科学入门和使用 Python 编程][10],它是基于 MIT 的 6.001 课程,是一个非常好的启蒙课程。如果你编程零基础,来自密歇根大学的 Charles Severance 的 [人人学编程(Python 使用入门)][11] 是个很好的开端,它不会像 MIT 的课程那样,把你一下子扔进代码的汪洋大海。 +在这里编程是核心技能。虽然可以使用不同的编程语言去做,但是一些库和工具集 —— 比如 Python 的 [PyTorch][9],依赖于 Python,所以这是一个应该掌握的好技能。尤其是,如果你有某种程度上的编程背景,MIT 的 [计算机科学入门和使用 Python 编程][10],它是基于 MIT 的 6.001 在校课程,是一个非常好的启蒙课程。如果你编程零基础,来自密歇根大学的 Charles Severance 的 [人人学编程(Python 使用入门)][11] 是个很好的开端,它不会像 MIT 的课程那样,把你一下子扔进代码的汪洋大海。 -[R 编程语言][12] 也是一个应该增加到你的技能库中的很有用的技能。虽然它在机器学习(ML)中使用的很少,但它在其它数据科学任务中很常见,并且经常与人工智能/机器学习和数据科学的应用实践结合在一起。比如,许多使用原始和数据清洗相关的应用任务,此外还有你最终要使用的诸如此类的分析技术,都将使用到它。一个 MOOC 系列,像 Harvard 的 [数据科学认证][13] 就是一整套课程的一个例子,这些课程介绍了如何去很好地处理数据。 +[R 编程语言][12] 也是一个应该增加到你的技能库中的很有用的技能。虽然它在机器学习(ML)中使用的很少,但它在其它数据科学任务中很常见,并且经常与人工智能/机器学习和数据科学的应用实践结合在一起。例如,与组织和清理数据相关的许多任务同样适用于您最终使用的任何分析技术。像哈佛的 [数据科学认证][13] 这样的一个 MOOC 系列就是一整套课程的一个例子,这些课程介绍了如何去很好地处理数据。 -如果你从事人工智能方面的工作,那么你很可能会遇到的另一个开源软件库就是 [TensorFlow][14]。它最初是由 Google 人工智能团队中的 Google 智慧团队的研发工程师开发的。[Google 提供了许多教程][15] 让你通过高级 Keras API 去开始使用 TensorFlow。你既可以在 Google 云上也可以在本地运行 TensorFlow。 +如果你从事人工智能方面的工作,那么你很可能会遇到的另一个开源软件库就是 [TensorFlow][14]。它最初是由 Google 人工智能团队中的 Google 大脑团队的研发工程师开发的。[Google 提供了许多教程][15] 让你通过高级 Keras API 去开始使用 TensorFlow。你既可以在 Google 云上也可以在本地运行 TensorFlow。 通常,大的公有云提供商都提供在线数据集和易于使用的机器学习服务。但是,在你开始去 “玩” 数据集和应用之前,你需要考虑清楚,一旦开始选定一个提供商,你将被它们 “锁定” 的程度。 -你的探索学习项目所需的数据集可以从许多不同的源获得。除了公有云提供商之外,[Kaggle][16] 是另一个受欢迎的源,总体来看,它也是一个比较好的学习源。以数字形式提供的政府数据也越来越多了。美国联邦政府的 [Data.gov][17] 声称它提供超过 300,000 的数据集。州和地方政府也发布从餐馆健康评级到狗的名字的所有数据。 +你的探索学习项目所需的数据集可以从许多不同的源获得。除了公有云提供商之外,[Kaggle][16] 是另一个受欢迎的源,总体来看,它也是一个比较好的学习源。以数字形式提供的政府数据也越来越多了。美国联邦政府的 [Data.gov][17] 声称它提供超过 300,000 个数据集。各州和地方政府也发布从餐馆健康评级到狗的名字的所有数据。 ### 研究和应用人工智能兼而有之 -最后我想说明的一点是,人工智能不仅是与数学、编程、和数据有关的一个宽泛的主题。人工智能作为一个综合体涉及到了许多其它的领域,包括心理学、语言学、博弈论、运筹学和控制系统。确实,现在有一些人工智能研究者担心,由于处理能力和大数据的结合,使得该领域过于关注最近才变得强大和有趣的少数几个技术。在了解人类如何学习和推理方面,许多长期存在的问题仍未解决。不管怎样,对这些广泛存在的问题有一个了解,将更好地让你在更广泛的背景中评估人工智能。 +最后我想说明的一点是,人工智能不仅是与数学、编程、数据有关的一个宽泛主题。人工智能作为一个综合体涉及到了许多其它的领域,包括心理学、语言学、博弈论、运筹学和控制系统。确实,现在有一些人工智能研究者担心,由于处理能力和大数据的结合,使得该领域过于关注最近才变得强大和有趣的少数几个技术。在了解人类如何学习和推理方面,许多长期存在的问题仍未解决。不管怎样,对这些广泛存在的问题有一个了解,将更好地让你在更广泛的背景中评估人工智能。 -我比较喜欢的其中一个示例是杜克大学的 [人类和自治实验室][18]。这个实验室的工作涉及人类与机器工作所面临的全部挑战,比如,如果自动化设备失效,自动驾驶仪如何设计才能让那些[“洋红色的孩子“][19] 快速取得对飞机的控制。一个基础的大脑科学课程,比如 MIT 的 [心理学导论][20],它提供了关于人类智能和机器智能之间关系的一些很有用的内容。另一个类似的课程是,MIT 电子工程与计算机科学系已故教授 Marvin Minsky 的 [心灵的社会][21]。 +我比较喜欢的其中一个示例是杜克大学的 [人类和自治实验室][18]。这个实验室的工作涉及人机协同所面临的各种挑战,比如,如果自动化设备失效,自动驾驶仪如何设计才能让那些[“洋红色的孩子“][19] 快速取得控制。有一个基础的大脑科学课程,比如 MIT 的 [心理学导论][20],它提供了关于人类智能和机器智能之间关系的一些很有用的内容。另一个类似的课程是,MIT 电子工程与计算机科学系已故教授 Marvin Minsky 的 [心灵的社会][21]。 -关于学习人工智能,假如说有一个最重要的挑战,那它不是原材料和工具不易获得,而是它们只有这么多。我的目标并不是给你一个全面的指导,相反,而是指出了你可以去学习的不同路径,以及为你提供一些可能的起点。祝你学习愉快! +关于学习人工智能,假如说有一个最重要的挑战,那它不是原材料和工具不易获得,因为它们有如此之多。我的目标并不是给你一个全面的指导,相反,而是指出了你可以去学习的不同路径,以及为你提供一些可能的起点。祝你学习愉快! -------------------------------------------------------------------------------- @@ -81,7 +82,7 @@ via: https://opensource.com/article/18/12/how-get-started-ai 作者:[Gordon Haff][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 b2fa053297477892690da95ad319e5706e1fe838 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 19:34:04 +0800 Subject: [PATCH 0157/4278] PUB:20181210 How to get started in AI.md @qhwdw https://linux.cn/article-10356-1.html --- .../tech => published}/20181210 How to get started in AI.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181210 How to get started in AI.md (99%) diff --git a/translated/tech/20181210 How to get started in AI.md b/published/20181210 How to get started in AI.md similarity index 99% rename from translated/tech/20181210 How to get started in AI.md rename to published/20181210 How to get started in AI.md index a88e0588f7..07a21f9910 100644 --- a/translated/tech/20181210 How to get started in AI.md +++ b/published/20181210 How to get started in AI.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10356-1.html) [#]: subject: (How to get started in AI) [#]: via: (https://opensource.com/article/18/12/how-get-started-ai) [#]: author: (Gordon Haff https://opensource.com/users/ghaff) From d67cadc6cd6a9009eaa120deb87f928944a3dbb5 Mon Sep 17 00:00:00 2001 From: chizelin Date: Mon, 17 Dec 2018 21:10:24 +0800 Subject: [PATCH 0158/4278] [translated] 3 best practices for continuous integration and deployment --- ...r continuous integration and deployment.md | 138 ------------------ ...r continuous integration and deployment.md | 137 +++++++++++++++++ 2 files changed, 137 insertions(+), 138 deletions(-) delete mode 100644 sources/tech/20181115 3 best practices for continuous integration and deployment.md create mode 100644 translated/tech/20181115 3 best practices for continuous integration and deployment.md diff --git a/sources/tech/20181115 3 best practices for continuous integration and deployment.md b/sources/tech/20181115 3 best practices for continuous integration and deployment.md deleted file mode 100644 index 09e10f187b..0000000000 --- a/sources/tech/20181115 3 best practices for continuous integration and deployment.md +++ /dev/null @@ -1,138 +0,0 @@ -[Translating by ChiZelin] -3 best practices for continuous integration and deployment -====== -Learn about automating, using a Git repository, and parameterizing Jenkins pipelines. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) - -The article covers three key topics: automating CI/CD configuration, using a Git repository for common CI/CD artifacts, and parameterizing Jenkins pipelines. - -### Terminology - -First things first; let's define a few terms. **CI/CD** is a practice that allows teams to quickly and automatically test, package, and deploy their applications. It is often achieved by leveraging a server called **[Jenkins][1]** , which serves as the CI/CD orchestrator. Jenkins listens to specific inputs (often a Git hook following a code check-in) and, when triggered, kicks off a pipeline. - -A **pipeline** consists of code written by development and/or operations teams that instructs Jenkins which actions to take during the CI/CD process. This pipeline is often something like "build my code, then test my code, and if those tests pass, deploy my application to the next highest environment (usually a development, test, or production environment)." Organizations often have more complex pipelines, incorporating tools such as artifact repositories and code analyzers, but this provides a high-level example. - -Now that we understand the key terminology, let's dive into some best practices. - -### 1\. Automation is key - -To run CI/CD on a PaaS, you need the proper infrastructure to be configured on the cluster. In this example, I will use [OpenShift][2]. - -"Hello, World" implementations of this are quite simple to achieve. Simply run **oc new-app jenkins- ** and voilà, you have a running Jenkins server ready to go. Uses in the enterprise, however, are much more complex. In addition to the Jenkins server, admins will often need to deploy a code analysis tool such as SonarQube and an artifact repository such as Nexus. They will then have to create pipelines to perform CI/CD and Jenkins slaves to reduce the load on the master. Most of these entities are backed by OpenShift resources that need to be created to deploy the desired CI/CD infrastructure. - -Eventually, the manual steps required to deploy your CI/CD components may need to be replicated, and you might not be the person to perform those steps. To ensure the outcome is produced quickly, error-free, and exactly as it was before, an automation method should be incorporated in the way your infrastructure is created. This can be an Ansible playbook, a Bash script, or any other way you would like to automate the deployment of CI/CD infrastructure. I have used [Ansible][3] and the [OpenShift-Applier][4] role to automate my implementations. You may find these tools valuable, or you may find something else that works better for you and your organization. Either way, you'll find that automation significantly reduces the workload required to recreate CI/CD components. - -#### Configuring the Jenkins master - -Outside of general "automation," I'd like to single out the Jenkins master and talk about a few ways admins can take advantage of OpenShift to automate Jenkins configuration. The Jenkins image from the [Red Hat Container Catalog][5] comes packaged with the [OpenShift-Sync plugin][6] installed. In the [video][7], we discuss how this plugin can be used to create Jenkins pipelines and slaves. - -To create a Jenkins pipeline, create an OpenShift BuildConfig similar to this: - -``` -apiVersion: v1 -kind: BuildConfig -... -spec:   -  source:       -    git:   -      ref: master       -      uri:   -  ...   -  strategy:     -    jenkinsPipelineStrategy:     -      jenkinsfilePath: Jenkinsfile       -    type: JenkinsPipeline -``` - -The OpenShift-Sync plugin will notice that a BuildConfig with the strategy **jenkinsPipelineStrategy** has been created and will convert it into a Jenkins pipeline, pulling from the Jenkinsfile specified by the Git source. An inline Jenkinsfile can also be used instead of pulling from one from a Git repository. See the [documentation][8] for more information. - -To create a Jenkins slave, create an OpenShift ImageStream that starts with the following definition: - -``` -apiVersion: v1 -kind: ImageStream -metadata: -  annotations: -    slave-label: jenkins-slave -    labels: -      role: jenkins-slave -… -``` - -Notice the metadata defined in this ImageStream. The OpenShift-Sync plugin will convert any ImageStream with the label **role: jenkins-slave** into a Jenkins slave. The Jenkins slave will be named after the value from the **slave-label** annotation. - -ImageStreams work just fine for simple Jenkins slave configurations, but some teams will find it necessary to configure nitty-gritty details such as resource limits, readiness and liveness probes, and instance caps. This is where ConfigMaps come into play: - -``` -apiVersion: v1 -kind: ConfigMap -metadata: -  labels: -  role: jenkins-slave -... -data: -  template1: |- -    -``` - -Notice that the **role: jenkins-slave** label is still required to convert the ConfigMap into a Jenkins slave. The **Kubernetes pod template** consists of a lengthy bit of XML that will configure every detail to your organization's liking. To view this XML, as well as more information on converting ImageStreams and ConfigMaps into Jenkins slaves, see the [documentation][9]. - -Notice with the three examples shown above that none of the operations required an administrator to make manual changes to the Jenkins console. By using OpenShift resources, Jenkins can be configured in a way that is easily automated. - -### 2\. Sharing is caring - -The second best practice is maintaining a Git repository of common CI/CD artifacts. The main idea is to prevent teams from reinventing the wheel. Imagine your team needs to perform a blue/green deployment to an OpenShift environment as part of the pipeline's CD phase. The members of your team responsible for writing the pipeline may not be OpenShift experts, nor may they have the bandwidth to write this functionality from scratch. Luckily, somebody has already written a function that incorporates that functionality in a common CI/CD repository, so your team can use that function instead of spending time writing one. - -To take this a step further, your organization may decide to maintain entire pipelines. You may find that teams are writing pipelines with similar functionality. It would be more efficient for those teams to use a parameterized pipeline from a common repository as opposed to writing their own from scratch. - -### 3\. Less is more - -As I hinted in the previous section, the third and final best practice is to parameterize your CI/CD pipelines. Parameterization will prevent an over-abundance of pipelines, making your CI/CD system easier to maintain. Imagine I have multiple regions where I can deploy my application. Without parameterization, I would need a separate pipeline for each region. - -To parameterize a pipeline written as an OpenShift build config, add the **env** stanza to the configuration: - -``` -... -spec: -  ... -  strategy: -    jenkinsPipelineStrategy: -      env: -      - name: REGION -        value: US-West           -      jenkinsfilePath: Jenkinsfile       -    type: JenkinsPipeline -``` - -With this configuration, I can pass the **REGION** parameter the pipeline to deploy my application to the specified region. - -The [video][7] provides a more substantial case where parameterization is a must. Some organizations decide to split up their CI/CD pipelines into separate CI and CD pipelines, usually, because there is some sort of approval process that happens before deployment. Imagine I have four images and three different environments to deploy to. Without parameterization, I would need 12 CD pipelines to allow all deployment possibilities. This can get out of hand very quickly. To make maintenance of the CD pipeline easier, organizations would find it better to parameterize the image and environment to allow one pipeline to perform the work of many. - -### Summary - -CI/CD at the enterprise level tends to become more complex than many organizations anticipate. Luckily, with Jenkins, there are many ways to seamlessly provide automation of your setup. Maintaining a Git repository of common CI/CD artifacts will also ease the effort, as teams can pull from maintained dependencies instead of writing their own from scratch. Finally, parameterization of your CI/CD pipelines will reduce the number of pipelines that will have to be maintained. - -If you've found other practices you can't do without, please share them in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/11/best-practices-cicd - -作者:[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://jenkins.io/ -[2]: https://www.openshift.com/ -[3]: https://docs.ansible.com/ -[4]: https://github.com/redhat-cop/openshift-applier -[5]: https://access.redhat.com/containers/?tab=overview#/registry.access.redhat.com/openshift3/jenkins-2-rhel7 -[6]: https://github.com/openshift/jenkins-sync-plugin -[7]: https://www.youtube.com/watch?v=zlL7AFWqzfw -[8]: https://docs.openshift.com/container-platform/3.11/dev_guide/dev_tutorials/openshift_pipeline.html#the-pipeline-build-config -[9]: https://docs.openshift.com/container-platform/3.11/using_images/other_images/jenkins.html#configuring-the-jenkins-kubernetes-plug-in diff --git a/translated/tech/20181115 3 best practices for continuous integration and deployment.md b/translated/tech/20181115 3 best practices for continuous integration and deployment.md new file mode 100644 index 0000000000..0706d70544 --- /dev/null +++ b/translated/tech/20181115 3 best practices for continuous integration and deployment.md @@ -0,0 +1,137 @@ +持续集成与部署的3个最佳实践 +====== +了解自动化,使用 Git 存储库以及参数化 Jenkins 管道。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) + +本文涵盖了三个关键主题:自动化 CI/CD 配置、使用 Git 存储库处理常见的 CI/CD 工件、参数化 Jenkins 管道。 + +### 术语 + +首先,我们定义一些术语。**CI/CD** 是允许团队快速自动化测试、打包、部署其应用程序的实践。它通常通过利用名为 **[Jenkins][1]** 的服务器来实现,该服务器充当 CI/CD 协调器。Jenkins 侦听特定输入(通常是代码签入后的 Git hook),并在触发时启动管道。 + +**pipeline** 由开发和/或运营团队编写的代码组成,这些代码指导 Jenkins 在 CI/CD 过程中采取哪些操作。这个流水线通常类似于“构建我的代码,然后测试我的代码,如果这些测试通过,则把我的应用程序部署到下一个最高环境(通常是开发、测试或生产环境)”。组织通常具有更复杂的流水线,并入了诸如工件存储库和代码分析器之类的工具,但是这提供了一个高级示例。 + +现在我们了解了关键术语,让我们深入研究一些最佳实践。 + +### 1\. 自动化是关键 + +要在 PaaS 上运行 CI/CD,需要在集群上配置适当的基础设施。在这个例子中,我将使用 [OpenShift][2]。 + +"Hello, World" 的实现很容易实现。简单地运行 **oc new-app jenkins- ** 和 voilà, 你已经准备好运行 Jenkins 服务器了。然而,在企业中的使用要复杂得多。除了 Jenkins 服务器之外,管理员通常还需要部署代码分析工具(如 SonarQube)和构件库(如 Nexus)。然后,它们必须创建管道来执行 CI/CD 和 Jenkins 从服务器,以减少主服务器的负载。这些实体中的大多数都由 OpenShift 资源支持,需要创建这些资源来部署所需的 CI/CD 基础设施。 + +最后,部署 CI/CD 组件所需要的手动步骤可能是需要被重复的,并且你可能不想成为执行那些重复步骤的人。为了确保结果能够像以前一样快速、无错误和准确地产生,应该在创建基础设施的方式中结合自动化方法。这可以是一个 Ansible 剧本、一个 Bash 脚本,或者任何您希望自动化 CI/CD 基础设施部署的其他方式。我已经使用 [Ansible][3] 和 [OpenShift-Applier][4] 角色来自动化我的实现。您可能会发现这些工具很有价值,或者您可能会发现其他一些对您和组织更有效的工具。无论哪种方式,您都将发现自动化显著地减少了重新创建 CI/CD 组件所需的工作量。 + +#### 配置Jenkins主服务器 + +除了一般的“自动化”之外,我想单独介绍一下 Jenkins 主服务器,并讨论管理员如何利用 OpenShift 来自动化配置 Jenkins。来自 [Red Hat Container Catalog][5] 的 Jenkins 映像已经安装了 [OpenShift-Sync plugin][6]。在 [视频][7] 中,我们将讨论如何使用这个插件来创建 Jenkins 管道和从设备。 + +要创建 Jenkins 流水线,请创建一个类似于下面的 OpenShift BuildConfig: + +``` +apiVersion: v1 +kind: BuildConfig +... +spec:   +  source:       +    git:   +      ref: master       +      uri:   +  ...   +  strategy:     +    jenkinsPipelineStrategy:     +      jenkinsfilePath: Jenkinsfile       +    type: JenkinsPipeline +``` + +OpenShift-Sync 插件将注意到已经创建了带有 **jenkinsPipelineStrategy** 策略的 BuildConfig,并将其转换为 Jenkins 管道,从 Git 源指定的 Jenkins 文件中提取。也可以使用内联 Jenkinsfile,而不是从 Git 存储库中提取。有关更多信息,请参阅[文档][8]。 + +要创建 Jenkins 从站,请创建一个 OpenShift ImageStream,它从以下定义开始: + +``` +apiVersion: v1 +kind: ImageStream +metadata: +  annotations: +    slave-label: jenkins-slave +    labels: +      role: jenkins-slave +… +``` + +注意在这个 ImageStream 中定义的元数据。OpenShift-Sync 插件将把带有标签 **role: jenkins-slave** 的任何ImageStream 转换为 Jenkins 从站。Jenkins 从站将以 **slave-label** 注释中的值命名。 + +ImageStreams 对于简单的 Jenkins 从属配置工作得很好,但是一些团队会发现有必要配置一些细节详情,比如资源限制、准备就绪和活动性探测,以及实例帽。这就是 ConfigMap 发挥作用的地方: + +``` +apiVersion: v1 +kind: ConfigMap +metadata: +  labels: +  role: jenkins-slave +... +data: +  template1: |- +    +``` + +注意,仍然需要角色:jenkins-slave 标签来将 ConfigMap 转换为 Jenkins slave。Kubernetes pod 模板由一长段 XML 组成,它将根据组织的喜好配置每个细节。要查看此 XML,以及有关将 ImageStreams 和 ConfigMaps 转换为 Jenkins 从属的更多信息,请参阅[文档][9]。 + +请注意上面所示的三个示例,其中没有一个操作需要管理员对 Jenkins 控制台进行手动更改。通过使用 OpenShift 资源,可以简单的自动化方式配置 Jenkins。 + +### 2\. 分享就是关心 + +第二个最佳实践是维护一个公共 CI/CD 工件的 Git 存储库。主要思想是防止团队重新发明轮子。假设您的团队需要执行到 OpenShift 环境的蓝色/绿色部署,作为管道 CD 阶段的一部分。负责编写流水线的团队成员可能不是 OpenShift 专家,也不可能具有从头开始编写此功能的能力。幸运的是,有人已经编写了一个将此功能合并到一个公共 CI/CD 存储库中的函数,因此您的团队可以使用该函数而不是花时间编写一个函数。 + +为了更进一步,您的组织可能决定维护整个管道。您可能会发现团队正在编写具有相似功能的流水线。对于那些团队来说,使用来自公共存储库的参数化管道要比从头开始编写自己的管道更有效。 + +### 3\. 少即是多 + +正如我在前一节中提到的,第三个也是最后一个最佳实践是参数化您的 CI/CD 管道。参数化将防止过多的管道,使您的 CI/CD 系统更容易维护。假设我有多个区域可以部署应用程序。如果没有参数化,我需要为每个区域设置单独的管道。 + +要参数化作为 OpenShift 构建配置编写的管道,请将 **env** 节添加到配置: + +``` +... +spec: +  ... +  strategy: +    jenkinsPipelineStrategy: +      env: +      - name: REGION +        value: US-West           +      jenkinsfilePath: Jenkinsfile       +    type: JenkinsPipeline +``` + +使用此配置,我可以传递 **REGION** 参数管道以将我的应用程序部署到指定区域。 + +这有一个[视频][7]提供了一个更实质性的情况,其中参数化是必须的。一些组织决定把他们的 CI/CD 管道分割成单独的 CI 和 CD 管道,通常是因为在部署之前有一些审批过程。假设我有四个映像和三个不同的环境要部署。如果没有参数化,我需要12个 CD 管道来允许所有部署可能性。这会很快失去控制。为了使 CD 流水线的维护更容易,组织会发现将映像和环境参数化以便允许一个流水线执行多个流水线的工作会更好。 + +### 总结 + +企业级的 CI/CD 往往比许多组织预期的更加复杂。幸运的是,对于 Jenkins,有很多方法可以无缝地提供设置的自动化。维护一个公共 CI/CD 工件的 Git 存储库也会减轻工作量,因为团队可以从维护的依赖项中提取而不是从头开始编写自己的依赖项。最后,CI/CD 管道的参数化将减少必须维护的管道的数量。 + +如果您找到了其他不可或缺的做法,请在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/best-practices-cicd + +作者:[Austin Dewey][a] +选题:[lujun9972][b] +译者:[ChiZelin](https://github.com/ChiZelin) +校对:[校对者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://jenkins.io/ +[2]: https://www.openshift.com/ +[3]: https://docs.ansible.com/ +[4]: https://github.com/redhat-cop/openshift-applier +[5]: https://access.redhat.com/containers/?tab=overview#/registry.access.redhat.com/openshift3/jenkins-2-rhel7 +[6]: https://github.com/openshift/jenkins-sync-plugin +[7]: https://www.youtube.com/watch?v=zlL7AFWqzfw +[8]: https://docs.openshift.com/container-platform/3.11/dev_guide/dev_tutorials/openshift_pipeline.html#the-pipeline-build-config +[9]: https://docs.openshift.com/container-platform/3.11/using_images/other_images/jenkins.html#configuring-the-jenkins-kubernetes-plug-in From 8b453ba56c5996025518197a77f29fc0bc3a43ca Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 21:42:22 +0800 Subject: [PATCH 0159/4278] PRF:20181202 Drive a locomotive through your Linux terminal.md @geekpi --- ... locomotive through your Linux terminal.md | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/translated/tech/20181202 Drive a locomotive through your Linux terminal.md b/translated/tech/20181202 Drive a locomotive through your Linux terminal.md index 540f3de7ec..e9bdd2c30f 100644 --- a/translated/tech/20181202 Drive a locomotive through your Linux terminal.md +++ b/translated/tech/20181202 Drive a locomotive through your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Drive a locomotive through your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-sl) @@ -9,42 +9,42 @@ 在 Linux 终端中开火车 ====== -使用 sl 命令,你可以让自己坐上火车,有一个有趣的命令行体验。 + +> 使用 sl 命令,你可以让自己驾驶火车,带来一个有趣的命令行体验。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-sl.png?itok=WPTj0Ga9) -现在是 12 月,每个 Linux 终端用户都值得这一年的奖励。因此, 我们将为你带来一个 Linux 命令行玩具的出现日历。什么是命令行玩具?它可能是一个游戏、一个小的无意义的打发时间的东西,或者为你在终端带来快乐的东西。 +现在是 12 月,每个 Linux 终端用户都值得这一年的奖励。因此,我们将为你带来一个 Linux 命令行玩具的日历。什么是命令行玩具?它可能是一个游戏、一个小的无意义的打发时间的东西,或者为你在终端带来快乐的东西。 -今天的 Linux 命令行玩具是来自 Opensource.com 社区版主 [Ben Cotton][1] 的建议。Ben 建议 `sl`,它是蒸汽机车的简称。 +今天的 Linux 命令行玩具来自 Opensource.com 社区版主 [Ben Cotton][1] 的建议。Ben 建议 `sl`,它是蒸汽机车steam locomotive的简称。 -对于 Linux **ls** 命令来说,它也是一个常见的错误,而不是巧合。想要不再打错吗?尝试安装 **sl**。它可能已经在默认仓库中打包。对我而言,在 Fedora 中,这意味着安装起来很简单: +而对于 Linux `ls` 命令来说,`sl` 也是一个常见的拼写错误,这并不是巧合(LCTT 译注:意即 `sl` 是专门用来设计提醒 `ls` 打错的)。想要不再打错吗?尝试安装 `sl`。它可能已经在默认仓库中打包。对我而言,在 Fedora 中,这意味着安装起来很简单: ``` $ sudo dnf install sl -y ``` -现在,只需键入**sl** 即可测试。 +现在,只需键入 `sl` 即可测试。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-sl-animated.gif) -你可能会像我一样注意到,**Ctrl+C** 不会让你的火车脱轨,所以你必须等待整列火车通过。这会让你知道打错了 **ls**! +你可能会像我一样注意到,`Ctrl+C` 不会让你的火车脱轨,所以你必须等待整列火车通过。这会让你知道打错了 `ls`! +想查看 `sl` 源码?它已经在[在 GitHub 上][2]。 -想查看 **sl** 源码?它已经在[在 GitHub 上][2]。 +`sl` 也是分享我个人关于开源许可证的见解的绝佳机会。虽然它的[许可证][3]“足够开源”能够打包到我的发行版,但技术上而言,它并不是 [OSI 批准][4]的许可证。在其版权行之后,许可证的内容很简单: -**sl** 也是分享关于开源许可的个人 PSA 的绝佳机会。虽然它的[许可证][3]“足够开源”以便为我的发行版打包,但技术上而言,它并不是 [OSI 批准][4]的许可证。在版权行之后,许可证的内容很简单: - -``` -Everyone is permitted to do anything on this program including copying, -modifying, and improving, unless you try to pretend that you wrote it. -i.e., the above copyright notice has to appear in all copies. -THE AUTHOR DISCLAIMS ANY RESPONSIBILITY WITH REGARD TO THIS SOFTWARE. -``` +> 每个人都可以在这个程序上做任何事情,包括复制,修改和改进,除非你试图假装你写了它。 +> +> 即,上述版权声明必须出现在所有副本中。 +> +> 作者对本软件不承担任何责任。 遗憾的是,当你选择未经 OSI 批准的许可证时,你可能会意外地为你的用户带来额外的工作,因为他们必须要弄清楚你的许可证是否适用于他们的情况。他们的公司政策是否允许他们做贡献?甚至他们可以合法地使用该程序吗?许可证是否与他们希望与之集成的其他程序的许可证相匹配? 除非你是律师(也许,即使你是律师),否则在非标准许可证范围内选择可能会很棘手。因此,如果你仍在寻找新年的方案,为什么不把仅 OSI 批准的许可证作为你 2019 年新项目的选择呢。 -这并不是对作者的不尊重。**sl** 仍然是一个很棒的小命令行玩具。 +这并不是对作者的不尊重。`sl` 仍然是一个很棒的小命令行玩具。 你有一个你认为我应该介绍的最喜欢的命令行玩具吗?这个系列的日历大部分已经完成,但我还剩下几个空余。请在下面的评论中告诉我,我会了解一下。如果有空间,我会尝试包含它。如果没有,但我得到了一些好的投稿,我会在最后做一些荣誉介绍。 @@ -57,7 +57,7 @@ via: https://opensource.com/article/18/12/linux-toy-sl 作者:[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/) 荣誉推出 @@ -67,4 +67,4 @@ via: https://opensource.com/article/18/12/linux-toy-sl [2]: https://github.com/mtoyoda/sl [3]: https://github.com/mtoyoda/sl/blob/master/LICENSE [4]: https://opensource.org/licenses -[5]: https://opensource.com/article/18/12/linux-toy-boxes \ No newline at end of file +[5]: https://opensource.com/article/18/12/linux-toy-boxes From e18d163096098580b2b780edc8fa2af98c4f93e6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 21:43:24 +0800 Subject: [PATCH 0160/4278] PUB:20181202 Drive a locomotive through your Linux terminal.md @geekpi https://linux.cn/article-10357-1.html --- ...20181202 Drive a locomotive through your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181202 Drive a locomotive through your Linux terminal.md (98%) diff --git a/translated/tech/20181202 Drive a locomotive through your Linux terminal.md b/published/20181202 Drive a locomotive through your Linux terminal.md similarity index 98% rename from translated/tech/20181202 Drive a locomotive through your Linux terminal.md rename to published/20181202 Drive a locomotive through your Linux terminal.md index e9bdd2c30f..4f1f3b5f19 100644 --- a/translated/tech/20181202 Drive a locomotive through your Linux terminal.md +++ b/published/20181202 Drive a locomotive through your Linux terminal.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Drive a locomotive through your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-sl) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10357-1.html) 在 Linux 终端中开火车 ====== From 8a6a8da15d4e5d44f0745a42e17d6b33051eb48c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 22:39:25 +0800 Subject: [PATCH 0161/4278] PRF:20181121 How to swap Ctrl and Caps Lock keys in Linux.md @jlztan --- ...o swap Ctrl and Caps Lock keys in Linux.md | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md b/translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md index cf1c56e908..f1da291931 100644 --- a/translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md +++ b/translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md @@ -1,38 +1,43 @@ -在 Linux 下交换 Ctrl 与 Caps Lock 键 +在 Linux 下交换 Ctrl 与大写锁定键 ====== -Linux 桌面环境使你可以根据需要轻松设置键盘。下面来演示如何去做。 +> Linux 桌面环境使你可以根据需要轻松设置键盘。下面来演示如何去做。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/keyboard_numbers_letters_type_game.jpg?itok=fLlWGw1K) -对于许多使用计算机很多年的用户来说,自从第一批 PC 键盘从生产线上下线后不久,Ctrl 和 Caps Lock 键就已经在错误的位置上了。对我来说,这张 1995 年 Sun 工作站的老式键盘照片上的两个键的位置才是正确的。(原谅我放了一张模糊的图片,它是在昏暗的光线下使用 Minox 间谍相机拍摄的。) +对于许多使用计算机很多年的用户来说,自从第一批 PC 键盘从生产线上下线后不久,Ctrl 和大写锁定键就已经在错误的位置上了。对我来说,这张 1995 年 Sun 工作站的老式键盘照片上的两个键的位置才是正确的。(原谅我放了一张模糊的图片,它是在昏暗的光线下使用 Minox 间谍相机拍摄的。) -感兴趣的话,可以读一下维基百科上对于 [Ctrl 键位置的历史][1] 的介绍。我不打算讨论将 Ctrl 键放在“a”旁边而不是 Shift 键下方的各种理由,不评论 Caps Lock 键的无用性,也没有打算与那些主张使用手掌根来触发 Ctrl 键的人争论,即使在一些笔记本电脑键盘上也不可能这样做,因为有的键会位于腕托以下。 +![](https://opensource.com/sites/default/files/uploads/keyboard.jpg) -相反,我将假设我不是唯一喜欢把 Ctrl 键放在“a”旁边的人,并说明如何使用 Linux 自带的灵活性在各种桌面环境中交换 Ctrl 和 Caps Lock 键的位置。请注意,下面的演示可能只有有限的有效期,因为调整桌面设置的方法经常发生变化,但我希望这为你开了一个好头。 +感兴趣的话,可以读一下维基百科上对于 [Ctrl 键位置的历史][1] 的介绍。我不打算讨论将 Ctrl 键放在“a”旁边而不是 Shift 键下方的各种理由,也不评论大写锁定键的无用性,也没有打算与那些主张使用手掌根来触发 Ctrl 键的人争论,即使在一些笔记本电脑键盘上不可能这样做到,因为有的键会位于腕托以下。 + +相反,我将假设我不是唯一喜欢把 Ctrl 键放在“a”旁边的人,并说明如何使用 Linux 自带的灵活性在各种桌面环境中交换 Ctrl 和大写锁定键的位置。请注意,下面的演示可能只有有限的有效期,因为调整桌面设置的方法经常发生变化,但我希望这为你开了一个好头。 ### GNOME 3 -[GNOME 3][2] 桌面环境用户可以使用 [Tweaks][3] 工具交换 Caps Lock 和 Ctrl 键,如下所示。![](https://opensource.com/sites/default/files/uploads/tweaks-tool.png) +[GNOME 3][2] 桌面环境用户可以使用 [Tweaks][3] 工具交换大写锁定和 Ctrl 键,如下所示。 + +![](https://opensource.com/sites/default/files/uploads/tweaks-tool.png) 具体步骤如下: 1. 从你的 Linux 发行版的软件仓库安装 Tweaks 工具。 2. 启动 Tweaks 程序。 - 3. 从左侧菜单中选择“Keyboard & Mouse”。 - 4. 单击“Additional Layout Options”。 - 5. 在打开的窗口中单击“Ctrl position”,然后选择“Swap Ctrl and Caps Lock”。 + 3. 从左侧菜单中选择 “Keyboard & Mouse”。 + 4. 单击 “Additional Layout Options”。 + 5. 在打开的窗口中单击 “Ctrl position”,然后选择 “Swap Ctrl and Caps Lock”。 -完成!顺便说一句,你可以使用 Tweaks 工具做很多很酷的事情。例如,我将我的右 Ctrl 键设置为 Compose 键,这让我可以使用键盘快捷键打出各种字符,例如通过 `Compose+c+,`、`Compose+e+'`、`Compose+O+^` 以及 `Compose+n+~` 分别键入 ç、é、ô 和 ñ。 +完成!顺便说一句,你可以使用 Tweaks 工具做很多很酷的事情。例如,我将我的右 Ctrl 键设置为 Compose 键,这让我可以使用键盘快捷键打出各种字符,例如通过 `Compose+c+,`、`Compose+e+'`、`Compose+o+^` 以及 `Compose+n+~` 分别键入 ç、é、ô 和 ñ。(LCTT 译注:可参考 [Special characters listed by extended compose sequence](https://www.ibm.com/support/knowledgecenter/en/SSKTWP_9.0.0/com.ibm.notes900.help.doc/acc_spec_characters_r.html)) ### KDE -我不使用 [KDE][4],但我的同事 Seth Kenlon 写的 [KDE tweaks that will change your life][5] 这篇文章的第 5 项演示了如何重新映射按键。 +我不使用 [KDE][4],但我的同事 Seth Kenlon 写的 [将改变你的生命的 KDE tweaks][5] 这篇文章的第 5 项演示了如何重新映射按键。 ### Xfce 据我所知,[Xfce][6] 桌面环境没有一个方便的工具来管理这些(指交换按键)设置。 但是,`setxkbmap` 命令的 `ctrl:swapcaps` 选项可以帮助你完成交换按键的修改。这个修改包含两部分: - 1. 弄清楚命令的用法; + 1. 弄清楚命令的用法; 2. 找出调用命令的位置,以便在桌面启动时激活它。 第一部分非常简单,命令是: @@ -43,7 +48,7 @@ Linux 桌面环境使你可以根据需要轻松设置键盘。下面来演示 在终端窗口中执行此命令,以确保结果符合你的预期。 -假设上述命令有效,应该在哪里调用此命令呢?这需要一些实验。一种可能是在用户主目录的 `.profile` 文件中;另一个可能是将命令添加到 Xfce 的自启动配置(在设置管理器中查找“Session and Startup”)里。 +假设上述命令有效,应该在哪里调用此命令呢?这需要一些实验。一种可能是在用户主目录的 `.profile` 文件中;另一个可能是将命令添加到 Xfce 的自启动配置(在设置管理器中查找 “Session and Startup”)里。 还有一种可能性是在文件 `/etc/default/keyboard` 中使用相同的选项,最终可能看起来像这样: @@ -76,7 +81,7 @@ BACKSPACE="guess" ### 其他环境 -最后,上面 StackExchange 的链接中提到的这一点值得强调--配置控制台与配置终端窗口不同;如前所述,后者是通过桌面管理器进行配置的。 +最后,上面 StackExchange 的链接中提到的这一点值得强调 —— 配置控制台与配置终端窗口不同;如前所述,后者是通过桌面管理器进行配置的。 `setxkbmap`、`xkeyboard-config`、`keyboard`、`console-setup` 和 `setupcon` 命令的手册都是有用的参考资料。或者,如果你不喜欢阅读手册,可以看一下 [这篇极好的文章][13]。 @@ -87,7 +92,7 @@ via: https://opensource.com/article/18/11/how-swap-ctrl-and-caps-lock-your-keybo 作者:[Chris Hermansen][a] 选题:[lujun9972][b] 译者:[jlztan](https://github.com/jlztan) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 35fbfdba5426bf989e8b76b687ff6e63f52978e4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 17 Dec 2018 22:40:01 +0800 Subject: [PATCH 0162/4278] PUB:20181121 How to swap Ctrl and Caps Lock keys in Linux.md @jltzan https://linux.cn/article-10358-1.html --- .../20181121 How to swap Ctrl and Caps Lock keys in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181121 How to swap Ctrl and Caps Lock keys in Linux.md (100%) diff --git a/translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md b/published/20181121 How to swap Ctrl and Caps Lock keys in Linux.md similarity index 100% rename from translated/tech/20181121 How to swap Ctrl and Caps Lock keys in Linux.md rename to published/20181121 How to swap Ctrl and Caps Lock keys in Linux.md From af60871a89dad8a6999cba05398c72f075151ca4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 18 Dec 2018 09:03:50 +0800 Subject: [PATCH 0163/4278] translated --- ...on Ubuntu and Other Linux Distributions.md | 111 ------------------ ...on Ubuntu and Other Linux Distributions.md | 111 ++++++++++++++++++ 2 files changed, 111 insertions(+), 111 deletions(-) delete mode 100644 sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md create mode 100644 translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md b/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md deleted file mode 100644 index 2c7805cbf2..0000000000 --- a/sources/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install Putty on Ubuntu and Other Linux Distributions) -[#]: via: (https://itsfoss.com/putty-linux/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Install Putty on Ubuntu and Other Linux Distributions -====== - -If I am not wrong, [Putty][1] is perhaps the most popular SSH client for Windows. - -In IT companies, the development environment is usually on a remote Linux system while the developers use Windows as their local system. Putty is used for connecting to the remote Linux system from the Windows machine. - -Putty is not limited to Windows only. You can also use this open source software on Linux and macOS. - -But wait! Why would you use a separate SSH client on Linux when you already have the ‘real’ Linux terminal with you? There are several reasons why you would want to use Putty on Linux. - - * You have used Putty for so long on Windows that you are more comfortable with it. - * You find it difficult to manually edit SSH config file to save the various SSH sessions. You prefer Putty’s graphical way of storing SSH connection. - * You want to debug by connecting to raw sockets and serial ports. - - - -Whatever may be the reason, if you want to use Putty on Ubuntu or any other Linux, you can certainly do so. Let me show you how to do that. - -### Installing Putty on Ubuntu Linux - -![Installing Putty on Linux][2] - -The good news for the Ubuntu users is that Putty is available in the universe repository of Ubuntu. - -To install Putty on Ubuntu, you should first make sure that the universe repository is enabled. - -``` -sudo add-apt-repository universe -``` - -Once you have the universe repository enabled, you should update Ubuntu with this command: - -``` -sudo apt update -``` - -After this, you can install Putty with this command: - -``` -sudo apt install putty -``` - -Once installed, you can start Putty by finding it in the menu. - -As you can see in the screenshot below, the Linux version of Putty looks the same as the Windows version. That’s a relief because you won’t have to fiddle around trying to find your way through a new and changed settings. - -![Putty in Linux][3] - -When you enter the remote system’s [hostname][4] or IP address and connect to it, Putty will utilize the already saved SSH keys in your home directory. - -![Using Putty in Ubuntu Linux][5] - -### Installing Putty on other Linux distributions - -[Putty is available for Debian][6] so you just need to use apt-get or aptitude for installing it. - -``` -sudo apt-get install putty -``` - -Putty is also available for Fedora/Red Hat and can be installed using the default package manager. - -``` -sudo dnf install putty -``` - -You can also easily install Putty in Arch Linux based distributions. - -``` -sudo pacman -S putty -``` - -Remember that Putty is an open source software. You can also install it via source code if you really want to. You can get the source code of Putty from the link below. - -[Download Putty Source Code][8] - -I would always prefer the native Linux terminal over an SSH client like Putty. I feel more at home with the GNOME terminal or [Terminator][7]. However, it’s up to an individual’s choice to use the default terminal or Putty in Linux - -What do you use for managing multiple SSH connections on Linux? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/putty-linux/ - -作者:[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.putty.org/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/Putty-linux.png?resize=800%2C450&ssl=1 -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/putty-interface-ubuntu.jpeg?resize=800%2C503&ssl=1 -[4]: https://itsfoss.com/change-hostname-ubuntu/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/putty-interface-ubuntu-1.jpeg?resize=800%2C430&ssl=1 -[6]: https://packages.debian.org/jessie/putty -[7]: https://launchpad.net/terminator -[8]: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html diff --git a/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md b/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..886d5ce5e8 --- /dev/null +++ b/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Putty on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/putty-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 和其他 Linux 发行版上安装 Putty +====== + +如果我没错,[Putty][1] 可能是 Windows 最受欢迎的 SSH 客户端。 + +I在 IT 公司中,开发环境通常在远程 Linux 系统上,而开发人员则使用 Windows 作为本地系统。Putty 用于从 Windows 机器连接到远程 Linux 系统。 + +Putty 不仅限于 Windows。你也可以在 Linux 和 macOS 上使用此开源软件。 + +但是等等!当你已经拥有“真正的” Linux 终端时,为什么要在 Linux 上使用单独的 SSH 客户端?这有几个想在 Linux 上使用 Putty 的原因。 + + * 你在 Windows 上使用 Putty 已经很久了,你觉得它更舒服。 + * 你发现很难手动编辑 SSH 配置文件以保存各种 SSH 会话。你更喜欢 Putty 图形化保存 SSH 连接的方式。 + * 你想通过连接到原始套接字和串口进行调试。 + + + +无论是什么原因,如果你想在 Ubuntu 或任何其他 Linux 上使用 Putty,你当然可以这样做。让我告诉你如何做到。 + +### 在 Ubuntu Linux 上安装 Putty + +![Installing Putty on Linux][2] + +对于 Ubuntu 用户来说,好消息是 Putty 可以在 Ubuntu 的 universe 仓库中找到。 + +要在 Ubuntu上安装 Putty,首先应确保已启用 universe 仓库。 + +``` +sudo add-apt-repository universe +``` + +启用 universe 存储库后,应使用以下命令更新 Ubuntu: + +``` +sudo apt update +``` + +之后,你可以使用以下命令安装 Putty: + +``` +sudo apt install putty +``` + +安装后,你可以在菜单中找到它来启动 Putty。 + +正如你在下面的截图中看到的,Putty 的 Linux 版本看起来与 Windows 版本相同。这让你松了一口气, 因为你不必再尝试新的设置。 + +![Putty in Linux][3] + +当你输入远程系统的[主机名][4]或 IP 地址并连接到它时,Putty 将使用你主目录中已保存的 SSH 密钥。 + +![Using Putty in Ubuntu Linux][5] + +### 在其他 Linux 发行版上安装 Putty + +[Putty 可用于 Debian][6],所以你只需要使用 apt-get 或 aptitude 来安装它。 + +``` +sudo apt-get install putty +``` + +Putty 也适用于 Fedora/Red Hat,并可以使用默认的包管理器进行安装。 + +``` +sudo dnf install putty +``` + +你还可以在基于 Arch Linux 的发行版中轻松安装 Putty。 + +``` +sudo pacman -S putty +``` + +请记住,Putty 是一款开源软件。如果你真的想要,你也可以通过源代码安装它。你可以从下面的链接获取 Putty 的源代码。 + +[下载 Putty 源代码][8] + +我一直喜欢原生 Linux 终端而不是像 Putty 这样的 SSH 客户端。我觉得 GNOME 终端或 [Terminator][7] 更有家的感觉。但是,在 Linux 中使用默认终端或 Putty 是个人选择。 + +你在 Linux 上管理多个 SSH 连接时使用了什么? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/putty-linux/ + +作者:[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.putty.org/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/Putty-linux.png?resize=800%2C450&ssl=1 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/putty-interface-ubuntu.jpeg?resize=800%2C503&ssl=1 +[4]: https://itsfoss.com/change-hostname-ubuntu/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/putty-interface-ubuntu-1.jpeg?resize=800%2C430&ssl=1 +[6]: https://packages.debian.org/jessie/putty +[7]: https://launchpad.net/terminator +[8]: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html \ No newline at end of file From 9062abccaf10eba0d727e39829955f87b626dd65 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 18 Dec 2018 09:14:59 +0800 Subject: [PATCH 0164/4278] translating --- .../20180717 11 Uses for a Raspberry Pi Around the Office.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md b/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md index c1a9e1a165..4eb59ba1a0 100644 --- a/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md +++ b/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9dbc6d7dea1305a1cd95cda59434fa83e6b09840 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 18 Dec 2018 10:08:06 +0800 Subject: [PATCH 0165/4278] hankchow translated --- .../20181212 Aliases- DIY Shell Commands.md | 133 ------------------ .../20181212 Aliases- DIY Shell Commands.md | 123 ++++++++++++++++ 2 files changed, 123 insertions(+), 133 deletions(-) delete mode 100644 sources/tech/20181212 Aliases- DIY Shell Commands.md create mode 100644 translated/tech/20181212 Aliases- DIY Shell Commands.md diff --git a/sources/tech/20181212 Aliases- DIY Shell Commands.md b/sources/tech/20181212 Aliases- DIY Shell Commands.md deleted file mode 100644 index 81dce2efe7..0000000000 --- a/sources/tech/20181212 Aliases- DIY Shell Commands.md +++ /dev/null @@ -1,133 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Aliases: DIY Shell Commands) -[#]: via: (https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) - -Aliases: DIY Shell Commands -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jodi-mucha-540841-unsplash.jpg?itok=n1d1VDUV) - -Aliases, in the context of the Linux shell, are **commands you build yourself** by packing them with combinations of other instructions that are too long or too hard to remember. - -You create an alias by using the word `alias`, then the name of the command you want to create, an equal sign (`=`), and then the Bash command(s) you want your alias to run. For example, `ls` in its base form does not colorize its output, making it difficult to distinguish between directories, files, and links. You can build a new command that shows colors by making an alias like this: - -``` -alias lc='ls --color=auto' -``` - -where `lc` is the name you have picked for your new command. When creating aliases, be sure to check that the name you picked isn't already in use, or you may override an existing command. In this case, `lc` stands for "list (with) color". Notice there is no space in front of or behind the `=`. Finally, you have the regular Bash command(s) you want to run when `lc` is executed. In this case, the `ls` command with the `--color` option. - -After defining your alias, every time you type `lc`, the contents of the current directory will be shown in color. - -But, you may think, "my `ls` command already lists files in different colors!" That is because most Linux distros come with some aliases already set up for you. - -### Aliases you (probably) already have - -Indeed, you can use the `alias` instruction without any options to see what aliases you already have. These will vary by distro, but some typical preset aliases are: - - * `alias ls='ls --color=auto'`: You already saw this one above. The `auto` modifier of the `--color` option tells `ls` to use color when standard output is connected to a terminal. That is, the output of `ls` is going to show up in a terminal window or a text screen, instead of, say, being piped to a file. Other alternatives for `--color` are `always` and `never`. - * `alias cp='cp -i'`: The `-i` option stands for _interactive_. Sometimes, when you use `cp` you may inadvertently overwrite an existing file. By using the `-i`, `cp` will ask you before clobbering anything. - * `alias free='free -m'`: Using `-m` with `free`you can see how much free memory you have and how much your applications are using in megabytes instead of the default bytes. This makes the output of `free` easier to read for a human. - - - -There may be more (or less, or even none), but regardless of what your distribution comes with, you can always use the base form (vs. the aliased form) of a command with the `\` modifier. For example: - -``` -\free -``` - -will execute `free` without the `-m` option, and - -``` -\ls -``` - -will execute `ls` without the `--color=auto` option. - -If you want to get rid or modify the preset aliases forever, note that they live in the global _.bashrc_ file which hangs out in [our old haunt, the _/etc/skel_ directory][1]. - -### Aliases for muscle memory - -Distro designers try their best to predict which aliases are going to be useful for you. But every user is different and comes from a different background. If you are new to GNU+Linux, it may be because you are coming from another system, and the basic commands vary from shell to shell. If you come from a Windows/MS-DOS background, you may want to define an alias like - -``` -alias dir='ls' -``` - -to list files or directories. - -Likewise, - -``` -alias copy='cp' -alias move='mv' -``` - -may also come in handy, at least until you get used to Linux's new lexicon. - -The other problem occurs when mistakes become ingrained in your muscle memory, so you always mistype some words the same way. I, for instance, have great difficulty typing _admnis-_... _adminsi-_... _A-D-M-I-N-I-S-T-R-A-T-I-ON_ ( _phew!_ ) at speed. That is why some users create aliases like - -``` -alias sl='ls' -``` - -and - -``` -alias gerp='echo "You did it *again*!"; grep' -``` - -Although we haven't formally introduced `grep` yet, in its most basic form, it looks for a string of characters in a file or a set of files. It's one of those commands that you will tend to use A LOT once you get to grips with it, as those ingrained mistyping habits that force you to type the instruction twice every time get annoying really quickly. - -Another thing to note in the `gerp` example is that it is not a single instruction, but two. The first one (`echo "You did it *again*!"`) prints out a message reminding you that you misspelled the grep command, then there is a semicolon (`;`) that separates one instruction from the other. Finally, you've got the second command (`grep`) that does the actual grepping. - -Using `gerp` on my system to search for the lines containing the word " _alias_ " in _/etc/skel/.bashrc_ , the output looks like this: - -``` -$ gerp -R alias /etc/skel/.bashrc -You did it *again*! - alias ls='ls --color=auto' - alias grep='grep --colour=auto' - alias egrep='egrep --colour=auto' - alias fgrep='fgrep --colour=auto' -alias cp="cp -i" -alias df='df -h' -alias free='free -m' -alias np='nano -w PKGBUILD' -alias more=less -shopt -s expand_aliases -``` - -Running commands sequentially as part of an alias, or, even better, chaining commands so that one command can use the results coughed up by another, is getting us perilously close to Bash scripting. This has been in the making of this series for quite some time, and we'll start covering it in the very next article. - -For the time being, if you want to get rid of an alias you temporarily set up in a running terminal, use the `unalias` command: - -``` -unalias gerp -``` - -If you want to make your aliases permanent, you can drop them into the _.bashrc_ file you have in your home directory. This is the same thing we did with custom environment variables in [last week's article][2]. - -See you next time! - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands - -作者:[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/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts -[2]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise diff --git a/translated/tech/20181212 Aliases- DIY Shell Commands.md b/translated/tech/20181212 Aliases- DIY Shell Commands.md new file mode 100644 index 0000000000..d7d0c9d096 --- /dev/null +++ b/translated/tech/20181212 Aliases- DIY Shell Commands.md @@ -0,0 +1,123 @@ +命令别名:定义自己的命令 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jodi-mucha-540841-unsplash.jpg?itok=n1d1VDUV) + +命令别名Alias在 Linux shell 中指的是将一些太长或者太难记的多个命令组合起来,成为一个由用户自定义构建的命令。 + +可以通过 `alias` 命令来创建命令别名。在 `alias` 后面跟上想要创建的别名名称、一个等号(`=`),以及希望使用这个别名来执行的命令,这样一个命令别名就创建好了。举个例子,`ls` 命令在默认情况下是不会对输出的内容进行着色的,这样就不能让用户一眼分辨出目录、文件和连接了。对此,可以创建这样一个命令别名,在输出目录内容的时候为输出内容着色: + +``` +alias lc='ls --color=auto' +``` + +其中 `lc` 是自定义的命令别名,代表“list with color”的意思。在创建命令别名的时候,需要先确认使用的别名是不是已经有对应的命令了,如果有的话,原本的命令就会被覆盖掉了。注意,定义命令别名的时候,`=` 两端是没有空格的。当运行 `lc` 的时候,就相当于执行了 `ls --color` 命令。 + +此后,执行 `lc` 列出目录内容的时候,就会输出带有着色的内容了。 + +你可能会发现你在执行 `ls` 的时候,本来就是输出带有着色的内容。那是因为大部分 Linux 发行版都已经将 `ls` 设定为带有着色的命令别名了。 + +### 可以直接使用的命令别名 + +实际上,执行不带任何内容的 `alias` 命令就可以看到当前已经设定的所有命令别名。对于不同的发行版,包含的命令别名不尽相同,但普遍都会有以下这些命令别名: + + * `alias ls='ls --color=auto'`:这个命令别名在前面已经提到过了。`--color=auto` 参数会让 `ls` 命令在通过标准输出在终端中显示内容时进行着色,而其它情况(例如通过管道输出到文件)下则不进行着色。`--color` 这个参数还可以设置为 `always` 或`never`。 + * `alias cp='cp -i'`:`-i` 参数代表“交互interactive”。在使用 `cp` 命令复制文件的时候,可能会无意中覆盖现有的文件,在使用了 `-i` 参数之后,`cp` 命令会在一些关键操作前向用户发出询问。 + * `alias free='free -m'`:在 `free` 命令后面加上 `-m` 参数,就可以将输出的内存信息以 MiB 这个更方面阅读和计算的单位输出,而不是默认的 Byte 单位。 + + + +你使用的发行版自带的命令别名可能多多少少和上面有些差别。但你都可以在命令前面加上 `\` 修饰符来使用命令的最基本形式。例如: + +``` +\free +``` + +就是直接执行 `free`,而不是 `free -m`。还有: + +``` +\ls +``` + +执行的就是不带有`--color=auto` 参数的 `ls`。 + +如果想要持久地保存命令别名,可以在 `.bashrc` 文件中进行修改。 + +### 使用命令别名纠正错误 + +各种发行版的设计者都会尽量设置用户可能需要用到的命令别名。但是不同的用户的习惯各不相同,一些用户可能刚从其它操作系统迁移到 Linux,而不同操作系统的基本命令又因 shell 而异。因此,对于刚从 Windows/MS-DOS 系统迁移到 Linux 系统的用户,不妨使用 + +``` +alias dir='ls' +``` + +这个命令别名来列出目录内容。 + +类似地, + +``` +alias copy='cp' +alias move='mv' +``` + +也可以在尚未完全熟悉 Linux 的时候用得顺手。 + +还有一种情况,就是在经常出现输入错误的场合中做出容错,例如 Administration 这个单词就很难快速正确地输入,因此很多用户都会设置 + +``` +alias sl='ls' +``` + +以及 + +``` +alias gerp='echo "You did it *again*!"; grep' +``` + + `grep` 命令最基本的用途就是在文件中查找字符串,在熟悉这个命令之后,它一定是最常用的命令之一,因此输入错误导致不得不重输命令就很令人抓狂。 + +在上面 `gerp` 的例子中,包含的不只是一条命令,而是两条。第一条命令 `echo "You did it *again*!"` 输出了一条提醒用户拼写错误的消息,然后使用分号(`;`)把两条命令隔开,再往后才是 `grep` 这一条正确的命令。 + +在我的系统上使用 `gerp` 来搜索 `/etc/skel/.bashrc` 中包含“alias”这个单词的行,就会输出以下内容: + +``` +$ gerp -R alias /etc/skel/.bashrc +You did it *again*! + alias ls='ls --color=auto' + alias grep='grep --colour=auto' + alias egrep='egrep --colour=auto' + alias fgrep='fgrep --colour=auto' +alias cp="cp -i" +alias df='df -h' +alias free='free -m' +alias np='nano -w PKGBUILD' +alias more=less +shopt -s expand_aliases +``` + +在命令别名中以固定的顺序执行多个命令,甚至更进一步,把多个命令串连起来,让后面的命令可以使用到前面的命令的执行结果。这样的做法已经非常接近 bash 脚本了。这篇文章已经接近尾声,我们将在下一篇文章中详细介绍。 + +如果想要删除在终端中临时设置的别名,可以使用 `unalias` 命令。 + +``` +unalias gerp +``` + +如果想要持久保存命令别名,可以将命令别名放在用户主目录的 `.bashrc` 文件中,具体的方法在[上一篇文章][2]中已经介绍过。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands + +作者:[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/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts +[2]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise + From 49e075989b63503a01a547fe52e976862824c72b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 18 Dec 2018 11:08:53 +0800 Subject: [PATCH 0166/4278] PRF:20180504 How a university network assistant used Linux in the 90s.md @geekpi --- ...network assistant used Linux in the 90s.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/translated/talk/20180504 How a university network assistant used Linux in the 90s.md b/translated/talk/20180504 How a university network assistant used Linux in the 90s.md index 3c8b0e8a5d..f9e811986d 100644 --- a/translated/talk/20180504 How a university network assistant used Linux in the 90s.md +++ b/translated/talk/20180504 How a university network assistant used Linux in the 90s.md @@ -1,34 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (How a university network assistant used Linux in the 90s) [#]: via: (https://opensource.com/article/18/5/my-linux-story-student) [#]: author: ([Alan Formy-Duva](https://opensource.com/users/alanfdoss) [#]: url: ( ) -大学网络助理如何在 90 年代使用 Linux +90 年代的大学网管如何使用 Linux ====== + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/moneyrecycle_520x292.png?itok=SAaIziNr) -在 20 世纪 90 年代中期,我报名了计算机科学课。我大学的计算机科学系为学生提供了一台 SunOS 服务器,它是一个多用户、多任务的 Unix 系统。我们登录它并编写我们在学习的编程语言代码,例如 C、C++ 和 ADA。在那些日子里,在社交网络和 IM 出现之前,我们还使用该系统相互通信,发送电子邮件和使用诸如 `write` 和 `talk` 之类的程序。我们每个人被允许托管一个个人网站。我很高兴它能够完成我的作业并联系其他用户。 + +在上世纪 90 年代中期,我报名了计算机科学课。我大学的计算机科学系为学生提供了一台 SunOS 服务器,它是一个多用户、多任务的 Unix 系统。我们登录它并编写我们学习的编程语言代码,例如 C、C++ 和 ADA。在那时,在社交网络和 IM 出现之前,我们还使用该系统发送电子邮件和使用诸如 `write` 和 `talk` 之类的程序来相互通信。我们每个人被允许托管一个个人网站。我很高兴能够使用它完成我的作业并联系其他用户。 这是我第一次体验这种类型的操作环境,但我很快就了解了另一个可以做同样事情的操作系统:Linux。 -当我还是一名学生的时候,我还在大学兼职工作。我的第一个职位是住房和住宅部 (H&R) 的网络安装人员。这包含将学生宿舍与校园网络连接起来。由于这是该大学的第一个宿舍网络服务,因此只有两幢楼和大约 75 名学生已经连接。 +那会我还是学生,我在大学找了份兼职工作。我的第一个职位是住房和住宅部(H&R)的网络安装人员。这工作涉及到将学生宿舍与校园网络连接起来。由于这是该大学的第一个宿舍网络服务,因此只有两幢楼和大约 75 名学生连上了网。 -在我工作的第二年,该网络扩展到另外两幢楼。H&R 决定让该大学的信息技术办公室 (OIT) 管理这不断增长的业务。我进入 OIT 并开始担任 OIT 网络经理的学生助理。这就是我发现 Linux 的方式。我的新职责之一是管理防火墙系统,它为宿舍提供网络和互联网访问。 +在第二年,该网络扩展到另外两幢楼。H&R 决定让该大学的信息技术办公室(OIT)管理这不断增长的业务。我进入 OIT 并开始担任 OIT 网络经理的学生助理。这就是我发现 Linux 的方式。我的新职责之一是管理防火墙系统,它为宿舍提供网络和互联网访问。 -每个学生都注册了他们硬件的 MAC 地址。注册学生可以连接到宿舍网络并获得 IP 地址及访问互联网。与大学使用的其他昂贵的 SunOS 和 VMS 服务器不同,这些防火墙使用运行着免费和开源 Linux 操作系统的低成本计算机。截至年底,该系统已注册近 500 名学生。 +每个学生都注册了他们硬件的 MAC 地址。注册的学生可以连接到宿舍网络并获得 IP 地址及访问互联网。与大学使用的其他昂贵的 SunOS 和 VMS 服务器不同,这些防火墙使用运行着自由开源的 Linux 操作系统的低成本计算机。截至年底,该系统已注册近 500 名学生。 ![Red hat Linux install disks][1] -OIT 网络工作人员使用 Linux 运行 HTTP、FTP 和其他服务。他们还在个人桌面上使用 Linux。就在那时,我意识到我手上的计算机看起来和运行起来就像 CS 系昂贵的 SunOS 机器一样但没有高昂的成本。Linux 可以在商用 x86 硬件上运行,例如有 8 MB RAM 和 133Mhz Intel Pentium CPU 的 Dell Latitude。那对我来说是个卖点!我在从一个剩余的仓库中清理出来的机器上安装了 Red Hat Linux 5.2,并给了我的朋友登录帐户。 +OIT 网络工作人员使用 Linux 运行 HTTP、FTP 和其他服务。他们还在个人桌面上使用 Linux。就在那时,我意识到我手上的计算机看起来和运行起来就像 CS 系昂贵的 SunOS 机器一样,但没有高昂的成本。Linux 可以在商用 x86 硬件上运行,例如有 8 MB RAM 和 133Mhz Intel Pentium CPU 的 Dell Latitude。那对我来说是个卖点!我在从一个存货仓库中清理出来的机器上安装了 Red Hat Linux 5.2,并给了我的朋友登录帐户。 我使用我的新 Linux 服务器来托管我的网站并向我的朋友提供帐户,同时它还提供 CS 系服务器没有的图形功能。它使用了 X Windows 系统,我可以使用 Netscape Navigator 浏览网页,使用 [XMMS][2] 播放音乐,并尝试不同的窗口管理器。我也可以下载并编译其他开源软件并编写自己的代码。 -我了解到 Linux 提供了一些非常先进的功能,其中许多功能比更主流的操作系统更方便或更优越。例如,许多操作系统尚未提供应用更新的简单方法。在 Linux 中,这很简单,感谢 [autoRPM][3],一个由 Kirk Bauer 编写的更新管理器,它向 root 用户每日发送邮件,其中包含可用的更新。它有一个直观的界面,用于审查和选择要安装的软件更新 - 这对于 90 年代中期来说非常了不起。 +我了解到 Linux 提供了一些非常先进的功能,其中许多功能比更主流的操作系统更方便或更优越。例如,许多操作系统尚未提供应用更新的简单方法。在 Linux 中,这很简单,感谢 [autoRPM][3],一个由 Kirk Bauer 编写的更新管理器,它向 root 用户每日发送邮件,其中包含可用的更新。它有一个直观的界面,用于审查和选择要安装的软件更新 —— 这对于 90 年代中期来说非常了不起。 -Linux may not have been well-known back then, and it was often received with skepticism, but I was convinced it would survive. And survive it did! +当时 Linux 可能并不为人所知,而且它经常受到怀疑,但我确信它会存活下来。而它确实生存下来了! -------------------------------------------------------------------------------- @@ -37,11 +39,11 @@ via: https://opensource.com/article/18/5/my-linux-story-student 作者:[Alan Formy-Duval][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/) 荣誉推出 [a]:https://opensource.com/users/alanfdoss [1]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/red_hat_linux_install_disks.png?itok=VSw6Cke9 (Red hat Linux install disks) [2]:http://www.xmms.org/ -[3]:http://www.ccp14.ac.uk/solution/linux/autorpm_redhat7_3.html \ No newline at end of file +[3]:http://www.ccp14.ac.uk/solution/linux/autorpm_redhat7_3.html From c60a0e756dcf64271001cf35a71091d63f0e0373 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 18 Dec 2018 11:09:41 +0800 Subject: [PATCH 0167/4278] PUB:20180504 How a university network assistant used Linux in the 90s.md @geekpi https://linux.cn/article-10359-1.html --- ...ow a university network assistant used Linux in the 90s.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20180504 How a university network assistant used Linux in the 90s.md (98%) diff --git a/translated/talk/20180504 How a university network assistant used Linux in the 90s.md b/published/20180504 How a university network assistant used Linux in the 90s.md similarity index 98% rename from translated/talk/20180504 How a university network assistant used Linux in the 90s.md rename to published/20180504 How a university network assistant used Linux in the 90s.md index f9e811986d..38a99e4310 100644 --- a/translated/talk/20180504 How a university network assistant used Linux in the 90s.md +++ b/published/20180504 How a university network assistant used Linux in the 90s.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (How a university network assistant used Linux in the 90s) [#]: via: (https://opensource.com/article/18/5/my-linux-story-student) [#]: author: ([Alan Formy-Duva](https://opensource.com/users/alanfdoss) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10359-1.html) 90 年代的大学网管如何使用 Linux ====== From 73aa9a68a321fc81b3d1f6e7ca0aeb876a43a31a Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 18 Dec 2018 14:05:23 +0800 Subject: [PATCH 0168/4278] Translating How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 3a4332c365..b0f0751d81 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -7,7 +7,7 @@ [#]: via: (https://itsfoss.com/update-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何更新Ubuntu [终端及GUI方式] It's FOSS +如何更新 Ubuntu [终端及GUI方式] It's FOSS ====== **这篇教程将向你展示如何更新服务器版本或者桌面版本的Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于Ubuntu Linux中的更新的一些其他内容。** @@ -16,38 +16,38 @@ 更新 Ubuntu 非常简单。我并不夸张的说。它简单得只要运行两个命令。让我来告诉你更多更新细节。 -Please note that the tutorial is valid for Ubuntu 18.04, 16.04 or any other version. The command line way is also valid for Ubuntu-based distributions like Linux Mint, Linux Lite, elementary OS etc. +请注意,本教程适用于 Ubuntu 18.04,16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint,Linux Lite,elementary OS 等。 -### Update Ubuntu via Command Line +### 通过命令行更新 Ubuntu -![How to Update Ubuntu][2] +![如何更新 Ubuntu][2] -On the desktop, open the terminal. You can find it in the menu or use the Ctrl+Alt+T [keyboard shortcut][3]. If you are logged on to an [Ubuntu server][4], you already have access to a terminal. +在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 -In the terminal, you just have to use the following command: +在终端里,你只需要使用以下命令: ``` sudo apt update && sudo apt upgrade -y ``` -It will ask for password and you can use your account’s password. You won’t see the anything on the screen while typing so keep on typing your password and hit enter. +它将询问密码,而你可以使用你账号的密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 -Now let me explain the above command. +现在,我来解释下上面的命令。 -Actually, it’s not a single command. It’s a combination of two commands. The && is a way to combine two commands in a way that the second command runs only when the previous command ran successfully. +事实上,这不是一条命令。它由两条命令组成。符号 `&&` 是合并两条命令的一个方法,第二条命令仅在前一条命令执行成功时执行。 -The ‘-y’ in the end automatically enters yes when the command ‘apt upgrade’ ask for your confirmation before installing the updates. +当命令 `apt upgrade` 要求你在安装更新前确认时,末尾的参数 `-y` 会自动输入 yes。 -Note that you can also use the two commands separately, one by one: +请注意,你也可以逐条使用这两条命令: ``` sudo apt update sudo apt upgrade ``` -It will take a little longer because you have to wait for one command to finish and then enter the second command. +这将花费更长的时间,因为你必须等待第一条命令执行完成后才能输入第二条命令。 -#### Explanation: sudo apt update +#### 说明:sudo apt update This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. @@ -63,7 +63,7 @@ apt list --upgradable **Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. -#### Explanation: sudo apt upgrade +#### 说明:sudo apt upgrade This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). @@ -75,7 +75,7 @@ So the bottom line is that the sudo apt update checks for the availability of ne The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. -### Update Ubuntu via GUI [For Desktop Users] +### 通过 GUI 更新 Ubuntu[适用于桌面用户] If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. @@ -109,11 +109,11 @@ You can choose to restart later if you don’t want to reboot your system straig Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. -### Few things to keep in mind abou updating Ubuntu +### 更新 Ubuntu 时要记住几件事 You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. -#### Clean up after an update +#### 更新后清理 Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: @@ -121,7 +121,7 @@ Your system will have some unnecessary packages that won’t be required after t sudo apt autoremove ``` -#### Live patching kernel in Ubuntu Server to avoid rebooting +#### 在 Ubuntu Server 中热修复内核以避免重启 In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. @@ -129,13 +129,13 @@ In case of a Linux kernel updates, you’ll have to restart the system after the If you manage servers, you may want to [enable live patching in Ubuntu][16]. -#### Version upgrades are different +#### 版本升级是不同的 The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). [Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. -### Conclusion +### 总结 I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. From 4bbdcb279b3ff9982f636f351cfd140f9bf87f61 Mon Sep 17 00:00:00 2001 From: cycoe Date: Tue, 18 Dec 2018 14:12:40 +0800 Subject: [PATCH 0169/4278] translating by cycoe --- .../20180822 9 flowchart and diagramming tools for Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md b/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md index 853cd1b7c3..5729f765d1 100644 --- a/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md +++ b/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md @@ -1,3 +1,5 @@ +translating by cycoe +cycoe 翻译中 9 flowchart and diagramming tools for Linux ====== From a85fe7df351a1cbf06f0abf05172a56b158ebdfd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 18 Dec 2018 16:04:23 +0800 Subject: [PATCH 0170/4278] PRF:20181205 Bring some color to your Linux terminal with lolcat.md @geekpi --- ...olor to your Linux terminal with lolcat.md | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md b/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md index eb23d85e36..2fc3c4cb0a 100644 --- a/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md +++ b/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Bring some color to your Linux terminal with lolcat) [#]: via: (https://opensource.com/article/18/12/linux-toy-lolcat) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) [#]: url: ( ) -使用 lolcat 为你的 Linux 终端带来一些颜色 +使用 lolcat 为你的 Linux 终端带来彩虹 ====== -使用这个简单的程序,你可以为所需的任何程序的输出添加彩色。 + +> 使用这个简单的工具,你可以为所需的任何程序的输出变成七彩。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-lolcat.png?itok=Es6dYcph) 今天是 Linux 命令行玩具日历的第五天。如果这是你第一次访问该系列,你可能会问自己,什么是命令行玩具。即使我不太确定,但一般来说,它可能是一个游戏,或任何简单的可以帮助你在终端玩得开心的东西。 -很可能你们中的一些人之前已经看过我们日历中的各种选择,但我们希望每个人至少见到一件新事物。 +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 -今日的选择,**lolcat**,是我选择的第一个没有在我的 Linux 发行版中打包的程序,但它安装仍然很简单。它是一个 Ruby 程序,你应该可以使用下面的命令轻松地添加到系统中。 +今日的选择,`lolcat`,是我选择的第一个没有在我的 Linux 发行版中打包的程序,但它安装仍然很简单。它是一个 Ruby 程序,你应该可以使用下面的命令轻松地添加到系统中。 ``` $ gem install lolcat @@ -29,15 +31,18 @@ $ fortune | boxes -a c -d parchment | lolcat ``` 根据你的运气,你可能会看到这样: + ![](https://opensource.com/sites/default/files/uploads/linux-toy-lolcat-parchment.png) -你可以传递给 **lolcat** 一些参数而不必重复它们,我建议你访问 **lolcat** 的 [GitHub 页面][1] 或者在终端输入 **lolcat --help** 了解。但一般来说,它们能设置彩虹的传递和频率,以及我个人最喜欢的动画。谁不喜欢终端的彩色动画打印?让我们再试一次,用一个不同的边框(当然是以猫为主题)和一句在我的句子列表中的适合猫的句子。 +你可以传递给 `lolcat` 一些参数。这里不再赘述,我建议你访问 `lolcat` 的 [GitHub 页面][1] 或者在终端输入 `lolcat --help` 了解。但一般来说,它们能设置彩虹的传递和频率,以及我个人最喜欢的动画。谁不喜欢终端的彩色动画输出呢?让我们再试一次,用一个不同的边框(当然是以猫为主题)和一句在我的格言列表中的适合猫的句子。 ``` fortune -m "nine tails" | boxes -a c -d cat | lolcat -a ``` + ![](https://opensource.com/sites/default/files/uploads/linux-toy-lolcat-animated.gif) -**lolcat** 是 BSD 许可下的开源软件。 + +`lolcat` 是一个 BSD 许可下的开源软件。 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -50,11 +55,11 @@ via: https://opensource.com/article/18/12/linux-toy-lolcat 作者:[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/) 荣誉推出 [a]: https://opensource.com/users/jason-baker [b]: https://github.com/lujun9972 [1]: https://github.com/busyloop/lolcat -[2]: https://opensource.com/article/18/12/linux-toy-cowsay \ No newline at end of file +[2]: https://opensource.com/article/18/12/linux-toy-cowsay From 7fa885b3178e3a6bdd0ea0aeec75cf6b43ae34a6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 18 Dec 2018 16:05:00 +0800 Subject: [PATCH 0171/4278] PUB:20181205 Bring some color to your Linux terminal with lolcat.md @geekpi https://linux.cn/article-10361-1.html --- ...205 Bring some color to your Linux terminal with lolcat.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181205 Bring some color to your Linux terminal with lolcat.md (97%) diff --git a/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md b/published/20181205 Bring some color to your Linux terminal with lolcat.md similarity index 97% rename from translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md rename to published/20181205 Bring some color to your Linux terminal with lolcat.md index 2fc3c4cb0a..629f30a6e3 100644 --- a/translated/tech/20181205 Bring some color to your Linux terminal with lolcat.md +++ b/published/20181205 Bring some color to your Linux terminal with lolcat.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Bring some color to your Linux terminal with lolcat) [#]: via: (https://opensource.com/article/18/12/linux-toy-lolcat) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10361-1.html) 使用 lolcat 为你的 Linux 终端带来彩虹 ====== From f0c2d70ee9c8ef9d37103a27a1f05120615d1d25 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 18 Dec 2018 19:37:13 +0800 Subject: [PATCH 0172/4278] PRF:20171111 A CEOs Guide to Emacs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 部分 --- .../tech/20171111 A CEOs Guide to Emacs.md | 88 ++++++++----------- 1 file changed, 39 insertions(+), 49 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index 5b25f37313..6d14ad7a8e 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -1,57 +1,58 @@ 一位 CEO 的 Emacs 指南 -============================================================ +=========== -几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器或者是说操作系统,而且我还乐此不疲。多年过去了,我也转向了其他更新,更好的工具。结果,我已经忘了如何在不用鼠标的情况下来浏览文件。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是就决定再试一次 Emacs。这是个很正确的决定,原因有以下几个。其中包括了 `.emacs` 和 Dropbox 的技巧,可以让你建立一个良好的,可移植的环境。 +几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,我已经忘了如何在不用鼠标的情况下来浏览文件。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是就决定再试一次 Emacs。这是个很正确的决定,原因有以下几个。其中包括了 `.emacs` 和 Dropbox 的技巧,可以让你建立一个良好的、可移植的环境。 -对于那先还没用过 Emacs 的人来说,你可能会讨厌它,但也可能喜欢上它。它有点像一个房子大小的 Rube Goldberg 机器,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键短语是“乍一看”。一旦你了解了Emacs,你就会意识到它其实是一种可以作为发动机的热核烤面包机。好吧,你想对文字做什么都可以。当考虑到计算寿命在很大程度上与文本有关时,这是一个相当大胆的声明,真的很大胆。 +对于那些还没用过 Emacs 的人来说,你可能会讨厌它,但也可能喜欢上它。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键短语是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一种可以作为发动机的热核烤面包机……好吧,你可以用来对文字做什么都可以。当考虑到你的计算生活在很大程度上与文本有关时,这是一个相当大胆的声明,真的很大胆。 -也许对我来说更重要的是,它是我曾经使用过的一个应用程序,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30] 或 Redmond 附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如文件或 `IDE`)就像碳纤维赛车,他们装备得很好,也很完整。而Emacs 就像一盒经典的 [Campagnolo][31] 零件和一个漂亮的拖钢框架,缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。第二点就是它会给你带来无尽的快乐或烦恼,这取决于你自己,而且会一直持续到你生命的最后一天。我是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时同样感到高兴的人,具体情况因人而异。 +也许对我来说更重要的是,它是我曾经使用过的一个应用程序,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。第一点是它是更快更完整的。第二点就是它会给你带来无尽的快乐或烦恼,这取决于你自己,而且会一直持续到你生命的最后一天。我是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时同样感到高兴的人,具体情况因人而异。 -![1933 steel bicycle](https://blog.fugue.co/assets/images/bicycle.jpg) -一辆我还在骑的1933年产的钢制自行车。你可以从查看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]. +![1933 steel bicycle](https://www.fugue.co/hubfs/Imported_Blog_Media/bicycle-1.jpg) -这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。他的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这。 +*一辆我还在骑的1933年产的钢制自行车。你可以看看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]* -如果通过编辑 `Lisp` 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 `Ludwig` 和 `Emacs Lisp`),但是 `Fugue` 的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs, 40% 用 `IDE` 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32](PHB[1][7])的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 +这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。它的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 -### 最后的优点 +如果通过编辑 Lisp 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32]Pointy-Haired Bosses(PHB[^1] )(以及,其它好奇的人)的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 -使用 Emacs 带来的长期优势是让生活更轻松。与最后的收获相比,最开始的付出完全值得。想想这些: +### 恒久优势 -### 无需上下文切换 +使用 Emacs 带来的长期优势是让生活更轻松。与最后的收获相比,最开始的付出完全值得。想想这些: -`Org` 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议需要做什么的清单,再到员工评论。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些应用程序都有不同的用户界面,保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住细节。我讨厌上下文切换,因为它是一种强加到我身上的方式,原因是破坏了接口模型[2][8],并且我讨厌记住计算机的命令,这本该是计算机要记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更有用,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比通常看起来的要高。操作系统和应用程序供应商已经构建了各种接口,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[3][9]。 +#### 无需上下文切换 -许多应用程序可以全天全屏并用于编辑文本。Emacs 是惟一的,因为它既是编辑器也是 `Emacs Lisp` 解释器。从本质上说,你工作时只要用电脑上的一两个键就能完成。如果你对编程略知一二,就能发现这一位置你可以在 Emacs 中做 _任何事情_。一旦你在内存中有了这些命令,你的电脑就可以在你工作时几乎实时地为你提供高效的运转。你不会想用 `Emacs Lisp` 来重建 Excel,只要用简单的一两行代码就能实现 Excel 中大多数的功能。如果我需要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是我有一封多行的邮件要写,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的计算开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得 Isaac Asimov 书中那些神奇的终端吗[4][10]? Emacs 是我所遇到的最接近他们的东西。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 +Org 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议需要做什么的清单,再到员工评估。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些应用程序都有不同的用户界面、保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住细节。我讨厌上下文切换,因为它是一种强加到我身上的方式,原因是破坏了界面模型[^2] ,并且我讨厌记住本该是计算机要为我记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更有用,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比通常看起来的要高。操作系统和应用程序厂商已经构建了各种界面,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[^3] 。 -### 在安静中创造事情 +许多应用程序可以全天全屏地用于编辑文本。Emacs 是惟一的,因为它既是编辑器也是 Emacs Lisp 解释器。从本质上说,你工作时只要用电脑上的一两个键就能完成。如果你对编程略知一二,就能发现这意味着你可以在 Emacs 中做 _任何事情_。一旦你在内存中有了这些命令,你的电脑就可以在你工作时几乎实时地为你提供高效的运转。你不会想用 Emacs Lisp 来重建 Excel,只要用简单的一两行代码就能实现 Excel 中大多数的功能。如果我需要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是我有一封多行的邮件要写,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的算术开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得艾萨克·阿西莫夫书中那些神奇的终端吗? Emacs 是我所遇到的最接近它们的东西[^4] 。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 + +#### 在安静中创造事情 拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?拥有 `Lisp` 键盘的全部功能?这就是我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 -我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等保存在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序努力提供帮助并使其易于使用。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[5][11]。比其 office 应用程序,我更讨厌在线版的应用程序。 +我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等保存在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序努力提供帮助并使其易于使用。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比其 office 应用程序,我更讨厌在线版的应用程序。 ![1933 steel bicycle](https://blog.fugue.co/assets/images/desktop.jpg) 我的桌面布局, Emacs 在左边 但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间时,我的效率会更高。在 `Fugue` 中使用了 `Slack`,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。仅仅是风投或董事会董事的一次懈怠,或一封电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 -### 带上一切,并保留着 +#### 带上一切,并保留着 第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 `Dropbox` 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何地方,任何环境下工作了,因为你已经精心制作了适合目的套件了。我在 OS X,Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理页面、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 -永久存储在计算机上的限制是文件格式。假设人类已经解决了存储[6][12]的问题,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最持久的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于办公应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 +永久存储在计算机上的限制是文件格式。假设人类已经解决了存储[^6] 的问题,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最持久的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于办公应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 如果你准备尝试 Emacs,请继续阅读!下面的部分不会取代完整的教程,但是在完成阅读时,就可以操作了。 ### 学会驾驭 Emacs —— 一个专业的配置 -所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像现代世界已经过去了。这有点像你只开过车,却要你去学骑自行车[7][13]。 +所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像现代世界已经过去了。这有点像你只开过车,却要你去学骑自行车[^7] 。 -### 该选哪个 Emacs +#### 该选哪个 Emacs -我用的是 GNU 中 OS X 和 Windows 的通用版本的 Emacs。你可以在 [][34][http://emacsformacos.com/][35] 获取 OS X 版本,在[][36][http://www.gnu.org/software/emacs/][37]获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(包括 `Lisp` 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[8][14]! +我用的是 GNU 中 OS X 和 Windows 的通用版本的 Emacs。你可以在 [][34][http://emacsformacos.com/][35] 获取 OS X 版本,在[][36][http://www.gnu.org/software/emacs/][37]获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(包括 `Lisp` 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[^8] ! -### 首先,学会浏览 +#### 首先,学会浏览 在本文中,我将约定 Emacs 中的键和组合。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组快捷键会指向一个教程,这是你首先要做的一件事。 @@ -59,11 +60,11 @@ Emacs 附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 -### 学会复制和粘贴 +#### 学会复制和粘贴 你可以叫 Emacs 设为 `CUA` 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 这样的浏览命令来标记区域(如选择)。所以 `C-F` 是选中管标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除和召回,但它非常类似于剪切和粘贴。在删除的环中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你在这开始摸索, `C-x u` 是撤销。 -### 下一步,学会用 `Ido` 模式 +#### 下一步,学会用 `Ido` 模式 相信我,`Ido` 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独分开的查找或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 `Ido` 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 `Ido` 是 Emacs 的 22 版时开发出来的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 @@ -85,7 +86,7 @@ home `Ido` 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. -### 符号链接是你的好伙伴 +#### 符号链接是你的好伙伴 等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把他们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并链接到 `.emacs` 和 `.emacs.d`,以及主目录 `~`。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的一部分了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件家的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 @@ -113,7 +114,7 @@ home 其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开查找或文件资源管理器再用鼠标点要节省 _很_ 多时间。 `Ido` 模式很有用, 这真的是操作 Emacs 的一种实用的模式。下面让我们去探索一些其他对完成工作很有帮助的模式吧。 -### 字体及风格 +#### 字体及风格 我推荐在 Emacs 中使用很棒的字体系列。它们可以使用不同的括号、0和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1\.5 倍的行间距,并在代码和数据中使用它们适应比例的字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我我将我的 `.emacs` 设置位根据使用的机器的名称,并配置适当的屏幕机字体。代码如下: @@ -142,7 +143,7 @@ home (if (fboundp 'menu-bar-mode) (menu-bar-mode 1)) ``` -### Org 模式 +#### Org 模式 我基本上 `Org` 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。`Org` 最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,`Org` 主要是一种处理结构中内容的方式。在 `Org` 模式中有标题和副标题等,它们的作用就像一个大纲。`Org` 允许你展开或隐藏文本内容,还可以重新排列文本。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 @@ -159,7 +160,7 @@ home 我有一个总是在缓冲区中打开的 `stuff.org` 文件。我把它当作记事本。`Org` 使得提取待办事项和有期限的事情变得很容易。当你在内联 `Lisp` 代码并在需要计算它时,它特别有用。拥有包含内容的代码非常方便。同样,你可以使用 Emacs 访问实际的计算机,这是一种解放。 -#### 用 `Org` 模式进行发布 +##### 用 `Org` 模式进行发布 我关心的是文档的外观和格式。我我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。`Org` 对将 `LaTeX` 生成 PDF 支持的很好, `LaTeX` 有自己的学习曲线,但是做简单的事情非常简单。 @@ -187,9 +188,9 @@ home 这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 `LaTeX` 一样。在我看来这还不错,但是字体很无聊,而且有点奇怪。此外,如果你使用标准格式,人们会认为他们正在阅读的东西是或假装是一篇学术论文。别怪我没提醒你。 -### `Ace Jump` 模式 +#### `Ace Jump` 模式 -如果你想使用的话,这是个辅助而不是主要功能。它的工作原理有点像 Jef Raskin 的 `Leap` 功能[9][15]。 按下 `C-c` `C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `Lisp` 目录下,并在 `.emacs` 文件添加如下代码: +如果你想使用的话,这是个辅助而不是主要功能。它的工作原理有点像 Jef Raskin 的 `Leap` 功能[^9] 。 按下 `C-c` `C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `Lisp` 目录下,并在 `.emacs` 文件添加如下代码: ``` ;; set up ace-jump-mode @@ -202,27 +203,16 @@ home 这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除编程(或编程)之外你对 Emacs 的使用,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来引入其他特性或模式。我很确定我将会向你展示如何在 Emacs 和 `Ludwig` 模式下使用 `Fugue`,因为我会将它发展成比代码突出显示更有用的东西。把你的想法发到 [@fugueHQ][41] 上。 -* * * -#### 附注 - -1. [^][16] If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. - -2. [^][17] [][18][http://archive.wired.com/wired/archive/2.08/tufte.html][19] - -3. [^][20] I mainly use this to perform calculations while writing. For example, I was writing an offer letter to a new employee and wanted to calculate how many options to include in the offer. Since I have a variable defined in my `.emacs` for outstanding-shares, I can simply type `M-: (* .001 outstanding-shares)`and get a tenth of a point without opening a calculator or spreadsheet. I keep  _lots_ of numbers in variables like this so I can avoid context switching. - -4. [^][21] The missing piece of this is the web. There is an Emacs web browser called eww that will allow you to browse in Emacs. I actually use this, as it is both a great ad-blocker and removes most of the poor choices in readability from the web designer's hands. It's a bit like Reading Mode in Safari. Unfortunately, most websites have lots of annoying cruft and navigation that translates poorly into text. - -5. [^][22] Usability is often confused with learnability. Learnability is how difficult it is to learn a tool. Usability is how useful the tool is. Often, these are at odds, such as with the mouse and menus. Menus are highly learnable, but have poor usability, so there have been keyboard shortcuts from the earliest days. Raskin was right on many points where he was ignored about GUIs in general. Now, OSes are putting things like decent search onto a keyboard shortcut. On OS X and Windows, my default method of navigation is search. Ubuntu's search is badly broken, as is the rest of its GUI. - -6. [^][23] AWS S3 has effectively solved file storage for as long as we have the Internet. Trillions of objects are stored in S3 and they've never lost one of them. Most every service out there that offers cloud storage is built on S3 or imitates it. No one has the scale of S3, so I keep important stuff there, via Dropbox. - -7. [^][24] By now, you might be thinking "what is it with this guy and bicycles?" ... I love them on every level. They are the most mechanically efficient form of transportation ever invented. They can be objects of real beauty. And, with some care, they can last a lifetime. I had Rivendell Bicycle Works build a frame for me back in 2001 and it still makes me happy every time I look at it. Bicycles and UNIX are the two best inventions I've interacted with. Well, they and Emacs. - -8. [^][25] This is not a tutorial for Emacs. It comes with one and it's excellent. I do walk through some of the things that I find most important to getting a useful Emacs setup, but this is not a replacement in any way. - -9. [^][26] Jef Raskin designed the Canon Cat computer in the 1980s after falling out with Steve Jobs on the Macintosh project, which he originally led. The Cat had a document-centric interface (as all computers should) and used the keyboard in innovative ways that you can now imitate with Emacs. If I could have a modern, powerful Cat with a giant high-res screen and Unix underneath, I'd trade my Mac for it right away. [][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] +[^1]: If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. +[^2]: http://archive.wired.com/wired/archive/2.08/tufte.html +[^3]: I mainly use this to perform calculations while writing. For example, I was writing an offer letter to a new employee and wanted to calculate how many options to include in the offer. Since I have a variable defined in my `.emacs` for outstanding-shares, I can simply type `M-: (* .001 outstanding-shares)`and get a tenth of a point without opening a calculator or spreadsheet. I keep  _lots_ of numbers in variables like this so I can avoid context switching. +[^4]: The missing piece of this is the web. There is an Emacs web browser called eww that will allow you to browse in Emacs. I actually use this, as it is both a great ad-blocker and removes most of the poor choices in readability from the web designer's hands. It's a bit like Reading Mode in Safari. Unfortunately, most websites have lots of annoying cruft and navigation that translates poorly into text. +[^5]: Usability is often confused with learnability. Learnability is how difficult it is to learn a tool. Usability is how useful the tool is. Often, these are at odds, such as with the mouse and menus. Menus are highly learnable, but have poor usability, so there have been keyboard shortcuts from the earliest days. Raskin was right on many points where he was ignored about GUIs in general. Now, OSes are putting things like decent search onto a keyboard shortcut. On OS X and Windows, my default method of navigation is search. Ubuntu's search is badly broken, as is the rest of its GUI. +[^6]: AWS S3 has effectively solved file storage for as long as we have the Internet. Trillions of objects are stored in S3 and they've never lost one of them. Most every service out there that offers cloud storage is built on S3 or imitates it. No one has the scale of S3, so I keep important stuff there, via Dropbox. +[^7]: By now, you might be thinking "what is it with this guy and bicycles?" ... I love them on every level. They are the most mechanically efficient form of transportation ever invented. They can be objects of real beauty. And, with some care, they can last a lifetime. I had Rivendell Bicycle Works build a frame for me back in 2001 and it still makes me happy every time I look at it. Bicycles and UNIX are the two best inventions I've interacted with. Well, they and Emacs. +[^8]: This is not a tutorial for Emacs. It comes with one and it's excellent. I do walk through some of the things that I find most important to getting a useful Emacs setup, but this is not a replacement in any way. +[^9]: Jef Raskin designed the Canon Cat computer in the 1980s after falling out with Steve Jobs on the Macintosh project, which he originally led. The Cat had a document-centric interface (as all computers should) and used the keyboard in innovative ways that you can now imitate with Emacs. If I could have a modern, powerful Cat with a giant high-res screen and Unix underneath, I'd trade my Mac for it right away. [][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] -------------------------------------------------------------------------------- From b9246f66148532703d7ce7c6439033a95b02d6d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 18 Dec 2018 23:25:57 +0800 Subject: [PATCH 0173/4278] PRF:20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md @geekpi --- ...arch Or Find Files And Folders in Linux.md | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md b/translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md index a95aef6e7d..8358a9ebb0 100644 --- a/translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md +++ b/translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md @@ -1,26 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Four Easy Ways to Search Or Find Files And Folders in Linux) [#]: via: (https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) -四种简单的方法来搜索或查找 Linux 中的文件和文件夹 +搜索 Linux 中的文件和文件夹的四种简单方法 ====== -Linux 管理员一天都不能离开搜索文件,因为这是他们的日常活动。 +Linux 管理员一天都不能离开搜索文件,因为这是他们的日常活动。了解一些搜索的东西是不错的,因为这能帮助你在命令行服务器中工作。这些命令记忆起来不复杂,因为它们使用的是标准语法。 -了解一些搜索的东西是不错的,因为这能帮助你在命令行服务器中工作。 - -这些命令记忆起来不复杂,因为它们使用的是标准语法。 - -这里执行四个 Linux 命令,每个命令都有自己独特的功能。 +可以通过四个 Linux 命令啦执行此操作,每个命令都有自己独特的功能。 ### 方法 1:使用 find 命令在 Linux 中搜索文件和文件夹 -find 命令被广泛使用,并且是非常著名的在 Linux 中搜索文件和文件夹的命令。它搜索当前目录中的给定文件,并根据搜索条件递归遍历其子目录。 +`find` 命令被广泛使用,并且是在 Linux 中搜索文件和文件夹的著名命令。它搜索当前目录中的给定文件,并根据搜索条件递归遍历其子目录。 它允许用户根据大小、名称、所有者、组、类型、权限、日期和其他条件执行所有类型的文件搜索。 @@ -72,19 +68,19 @@ find 命令被广泛使用,并且是非常著名的在 Linux 中搜索文件 ### 方法 2:使用 locate 命令在 Linux 中搜索文件和文件夹 -locate 命令比 find 命令运行得更快,因为它使用 updatedb 数据库,而 find 命令在真实系统中搜索。 +`locate` 命令比 `find` 命令运行得更快,因为它使用 `updatedb` 数据库,而 `find` 命令在真实系统中搜索。 它使用数据库而不是搜索单个目录路径来获取给定文件。 -locate 命令未在大多数发行版中预安装,因此,请使用你的包管理器进行安装。 +`locate` 命令未在大多数发行版中预安装,因此,请使用你的包管理器进行安装。 -数据库通过 cron 定期更新,但我们可以通过运行以下命令手动更新它。 +数据库通过 cron 任务定期更新,但我们可以通过运行以下命令手动更新它。 ``` $ sudo updatedb ``` -只需运行以下命令即可列出给定的文件或文件夹。在 locate 命令中不需要指定特定选项来打印文件或文件夹。 +只需运行以下命令即可列出给定的文件或文件夹。在 `locate` 命令中不需要指定特定选项来打印文件或文件夹。 在系统中搜索 `ssh` 文件夹。 @@ -107,13 +103,13 @@ $ sudo updatedb ### 方法 3:在 Linux 中搜索文件使用 which 命令 -which 返回在终端输入命令时执行的可执行文件的完整路径。 +`which` 返回在终端输入命令时执行的可执行文件的完整路径。 当你想要为可执行文件创建桌面快捷方式或符号链接时,它非常有用。 -which 命令搜索当前用户而不是所有用户的 PATH 环境变量中列出的目录。我的意思是,当你登录自己的帐户时,你无法搜索 root 用户文件或目录。 +`which` 命令搜索当前用户而不是所有用户的 `$PATH` 环境变量中列出的目录。我的意思是,当你登录自己的帐户时,你无法搜索 root 用户文件或目录。 -运行以下命令以打印 vim 可执行文件的完整路径。 +运行以下命令以打印 `vim` 可执行文件的完整路径。 ``` # which vi @@ -132,12 +128,13 @@ which 命令搜索当前用户而不是所有用户的 PATH 环境变量中列 ### 方法 4:使用 whereis 命令在 Linux 中搜索文件 -whereis 命令用于搜索给定命令的二进制、源码和手册页文件。 +`whereis` 命令用于搜索给定命令的二进制、源码和手册页文件。 ``` # whereis vi vi: /usr/bin/vi /usr/share/man/man1/vi.1p.gz /usr/share/man/man1/vi.1.gz ``` + -------------------------------------------------------------------------------- via: https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/ @@ -145,9 +142,9 @@ via: https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders 作者:[Prakash Subramanian][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/prakash/ -[b]: https://github.com/lujun9972 \ No newline at end of file +[b]: https://github.com/lujun9972 From f7b88e3744d9acbf35afab82437378d96b75aac8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 18 Dec 2018 23:26:46 +0800 Subject: [PATCH 0174/4278] PUB:20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md @geekpi https://linux.cn/article-10362-1.html --- ... Easy Ways to Search Or Find Files And Folders in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md (98%) diff --git a/translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md b/published/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md similarity index 98% rename from translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md rename to published/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md index 8358a9ebb0..d9326f0904 100644 --- a/translated/tech/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md +++ b/published/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10362-1.html) [#]: subject: (Four Easy Ways to Search Or Find Files And Folders in Linux) [#]: via: (https://www.2daygeek.com/four-easy-ways-to-search-or-find-files-and-folders-in-linux/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) From 13b7fc841a5a6fdb39245fe1d483c99bc14c7b08 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 19 Dec 2018 00:44:58 +0800 Subject: [PATCH 0175/4278] PRF:20180419 Migrating to Linux- Network and System Settings.md @ScarboroughCoral --- ...g to Linux- Network and System Settings.md | 102 ++++++++---------- 1 file changed, 44 insertions(+), 58 deletions(-) diff --git a/translated/tech/20180419 Migrating to Linux- Network and System Settings.md b/translated/tech/20180419 Migrating to Linux- Network and System Settings.md index 480aa05239..b9fe12b66e 100644 --- a/translated/tech/20180419 Migrating to Linux- Network and System Settings.md +++ b/translated/tech/20180419 Migrating to Linux- Network and System Settings.md @@ -1,106 +1,92 @@ -# 迁移到 Linux 工作环境: 网络和系统设置 +迁移到 Linux:网络和系统设置 +====== + +> 这个系列我们提供了基础知识的概述,以帮助您成功地从另一个操作系统过渡到 Linux;这篇中我们涉及到 Linux 桌面系统上的一些常见设置。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/animals-birds-flock-55832.jpg?itok=NUGAyhDO) -在这个系列中,我们提供了基础知识的概述,以帮助您成功地从另一个操作系统过渡到Linux。如果你错过了以前的文章,可以从这访问: +在这个系列中,我们提供了基础知识的概述,以帮助您成功地从另一个操作系统过渡到 Linux。如果你错过了以前的文章,可以从这访问: -[Part 1 - 基本介绍][1] +- [第1部分 - 入门介绍][1] +- [第2部分 - 磁盘、文件和文件系统][2] +- [第3部分 - 图形操作环境][3] +- [第4部分 - 命令行][4] +- [第5部分 - 使用 sudo][5] +- [第5部分 - 安装软件][6] -[Part 2 - 磁盘、文件和文件系统][2] +Linux 提供了一系列网络和系统设置。在你的桌面计算机上,Linux 允许您调整系统上的任何内容。大多数这些设置都出现在 `/etc` 目录下的纯文本文件中。这里我将介绍你使用桌面 Linux 操作系统的过程中最常用的设置。 -[Part 3 - 图形界面环境][3] +大多数设置都能够在“设置”程序里面找到,这些设置可能对于不同的 Linux 发行版有所不同。通常来说,你可以修改背景、调整音量、连接打印机、进行显示设置等。对于这些设置尽管我不会全部谈论,但你可以自己探索。 -[Part 4 - 命令行][4] +### 连接互联网 -[Part 5 - 使用 sudo 命令][5] +在 Linux 中连接到互联网通常非常简单。如果您通过以太网电缆连接,Linux 通常会在插入电缆时或启动时(如果电缆已连接)获得 IP 地址并自动连接。 -[Part 6 - 软件安装][6] +如果您使用无线网络,则在大多数发行版中都有一个菜单,可以在指示器面板中或在“设置”中(取决于您的发行版),您可以在其中选择无线网络的 SSID。如果网络受密码保护,它通常会提示您输入密码。然后连接,这个过程相当顺利。 -Linux 提供了一系列网络和系统设置。在桌面上,Linux允许您调整系统上的任何内容。大多数这些设置都在/ etc目录下的纯文本文件中公开。这里我将介绍你使用桌面 Linux 操作系统的过程中最常用的设置。 - - - -大多数设置都能够在设置程序里面找到,这些设置可能对于不同的 Linux 发行版有所不同。通常来说,你可以修改背景、调整音量、连接打印机、进行显示设置等。对于这些设置尽管我不会全部谈论,但你可以自己探索。 - - - -### 连接因特网 - -在Linux中连接到Internet通常非常简单。如果您通过以太网电缆连接,Linux通常会在插入电缆时或启动时获得IP地址并自动连接(如果电缆已连接)。 - -如果您使用无线,则在大多数发行版中都有一个菜单,可以在指示器面板中或在设置中(取决于您的发行版),您可以在其中选择无线网络的SSID。如果网络受密码保护,它通常会提示您输入密码。 然后连接,这个过程相当顺利。 - -在图形界面您可以通过进入设置来调整网络设置。通常称为系统设置或者是设置。通常可以轻松找到设置程序,因为它的图标是齿轮或工具图片(图1)。 +在图形界面您可以通过进入设置来调整网络设置。通常称为“系统设置”或者是“设置”。通常可以轻松找到设置程序,因为它的图标是齿轮或工具图片(图1)。 ![Network Settings][8] -图1: Gnome 桌面网络设置指示器图标. - -[经许可使用][9] +*图1: Gnome 桌面网络设置指示器图标。* ### 网络接口名称 -在 Linux 下,网络设备有名称。 从历史上看,它们的名称分别为 eth0 和 wlan0 - 或以太网和无线。 较新的 Linux 系统一直使用看起来更深奥的不同名称,如 enp4s0和 wlp5s0 。 如果名称以 en 开头,则它是有线以太网接口。 如果它以 wl 开头,那么它就是一个无线接口。 其余的字母和数字反映了设备如何连接到硬件。 +在 Linux 下,网络设备有名称。 从历史上看,它们的名称分别为 eth0 和 wlan0 —— 或“以太网”和“无线网络”。 较新的 Linux 系统一直使用看起来更深奥的不同名称,如 enp4s0 和 wlp5s0 。 如果名称以 en 开头,则它是有线以太网接口。 如果它以 wl 开头,那么它就是一个无线接口。 其余的字母和数字反映了设备如何连接到硬件。 ### 通过命令行进行网络管理 如果您希望更好地控制网络设置,或者如果您在没有图形桌面的情况下管理网络连接,则还可以从命令行管理网络。 -请注意,用于在图形桌面中管理网络的最常用服务是网络管理器,而网络管理器通常会覆盖在命令行上进行的设置更改。如果您正在使用网络管理器,最好在其界面中更改您的设置,以防止撤消您从命令行或其他位置所做的更改。 +请注意,用于在图形桌面中管理网络的最常用服务是“网络管理器Network Manager”,而网络管理器通常会覆盖在命令行上进行的设置更改。如果您正在使用网络管理器,最好在其界面中更改您的设置,以防止撤消您从命令行或其他位置所做的更改。 -更改图形环境中的设置很可能与网络管理器交互,您还可以使用名为nmtui的工具从命令行更改网络管理器设置。nmtui工具提供了您在图形环境中找到的所有设置,但是在基于文本的半图形界面中提供了该设置,该界面可在命令行上运行(图2)。 +在图形环境中的更改设置与在网络管理器中很类似,您还可以使用名为 `nmtui` 的工具从命令行更改网络管理器设置。`nmtui` 工具提供了您在图形环境中找到的所有设置,但是是在基于文本的半图形界面中提供了该设置,该界面可在命令行上运行(图 2)。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-2_0.png?itok=1QVjDdbJ) -图 2:nmtui 界面 +*图 2:nmtui 界面* -[经许可使用][9] - -在命令行上,有一个名为 ifconfig 的旧工具来管理网络,还有一个名为 ip 的新工具。在某些发行版中,ifconfig 被认为是不推荐使用的,默认情况下甚至没有安装。在其他发行版上,ifconfig 仍可以使用。 +在命令行上,有一个名为 `ifconfig` 的旧工具来管理网络,还有一个名为 `ip` 的新工具。在某些发行版中,`ifconfig` 被认为是不推荐使用的,默认情况下甚至没有安装。在其他发行版上,`ifconfig` 仍可以使用。 以下是一些允许您显示和更改网络设置的命令: ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/screen_shot_2018-04-17_at_3.11.48_pm.png?itok=EZsjb-GQ) -[经许可使用][9] - ### 进程和系统信息 -在 Windows 系统中,你可以使用任务管理器来查看所有正在运行的程序和服务的列表。你可以停止运行中的程序,并且可以在其中显示的某些选项卡中查看系统性能.。 +在 Windows 系统中,你可以使用任务管理器来查看所有正在运行的程序和服务的列表。你可以停止运行中的程序,并且可以在其中显示的某些选项卡中查看系统性能。 -在 Linux 系统下你可以使用命令行或者图形界面中做同样的事情。Linux 系统中根据你的发行版本会有不同的几个可以使用的图形工具。大多数所共有的工具是 System Monitor 和 KSysGuard。在这些工具中,你可以查看系统性能,查看进程列表甚至是杀死进程(图 3)。 +在 Linux 系统下你可以使用命令行或者图形界面中做同样的事情。Linux 系统中根据你的发行版本会有不同的几个可用的图形工具。大多数所共有的工具是“系统监视器”和 KSysGuard。在这些工具中,你可以查看系统性能,查看进程列表甚至是杀死进程(图 3)。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-3_2.png?itok=ePeXj9PA) -图 3:NetHogs 截图 - -[经许可使用][9] +*图 3:NetHogs 截图* 在这些工具中,你也可以查看系统全局网络流量(图 4)。 ![System Monitor][11] -图4: Gnome System Monitor 的截图 - -[经许可使用][9] +*图 4:Gnome System Monitor 的截图* ### 管理进程和系统使用 -您还可以从命令行使用相当多的工具。使用 ps 命令可以查看系统中的进程列表。默认情况下,这个命令的结果是显示当前终端会话下的所有进程列表。但是你也可以通过使用各种命令行参数显示其他进程。如果 ps 命令不会使用可以使用命令 info ps 或者 man ps。 +您还可以从命令行使用相当多的工具。使用 `ps` 命令可以查看系统中的进程列表。默认情况下,这个命令的结果是显示当前终端会话下的所有进程列表。但是你也可以通过使用各种命令行参数显示其他进程。如果 `ps` 命令不会使用,可以使用命令 `info ps` 或者 `man ps` 获取帮助。 -大多数人都希望得到一个进程列表,因为他们想要停止占用过多内存或CPU时间的进程。这种情况下有两个非常简单的命令,分别是 top 和 htop 命令(图 5)。 +大多数人都希望得到一个进程列表,因为他们想要停止占用过多内存或 CPU 时间的进程。这种情况下有两个非常简单的命令,分别是 `top` 和 `htop` 命令(图 5)。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-5_0.png?itok=2nm5EmAl) -top 和 htop 工具使用效果非常相似。两个命令每秒或者两秒会更新重新排序,这样会把占用 CPU 资源最多的放置在列表顶部。你也可以根据其他资源的使用情况比如内存使用情况来排序。 +*图 5:top 截屏* -使用两个命令时 (top and htop),你可以输入 ”?“ 来获取使用帮助,输入 ”q“ 来退出程序。使用 top 命令你可以按”k“键然后输入进程 ID 来杀死某个进程。 +`top` 和 `htop` 工具使用效果非常相似。两个命令每秒或者两秒会更新重新排序,这样会把占用 CPU 资源最多的放置在列表顶部。你也可以根据其他资源的使用情况比如内存使用情况来排序。 -使用 htop 命令时你可以使用 ↑↓ 键来将列表中的一条记录进行高亮显示,按下 F9 键会杀死进程(需要回车确认)。 +使用这两个命令时(`top` 和 `htop`),你可以输入 `?` 来获取使用帮助,输入 `q` 来退出程序。使用 `top` 命令你可以按 `k` 键然后输入进程 ID 来杀死某个进程。 + +使用 `htop` 命令时你可以使用 `↑` `↓` 键来将列表中的一条记录进行高亮显示,按下 `F9` 键会杀死进程(需要回车确认)。 本系列中提供的信息和工具将帮助您开始使用 Linux。 只需一点时间和耐心,您就会感到这非常舒服。 -想学习更多 Linux 内容可访问免费的 ["Linux 简介" ][12]课程,此课程来自 Linux 基金会和 edx. +想学习更多 Linux 内容可访问免费的 [Linux 简介][12]课程,此课程来自 Linux 基金会和 edx。 ------ @@ -109,20 +95,20 @@ via: https://www.linux.com/blog/learn/2018/4/migrating-linux-network-and-system- 作者:[John Bonesio][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[ScarboroughCoral](https://github.com/ScarboroughCoral) -校对:[校对者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/johnbonesio -[1]: https://www.linux.com/blog/learn/intro-to-linux/2017/10/migrating-linux-introduction -[2]: https://www.linux.com/blog/learn/intro-to-linux/2017/11/migrating-linux-disks-files-and-filesystems -[3]: https://www.linux.com/blog/learn/2017/12/migrating-linux-graphical-environments -[4]: https://www.linux.com/blog/learn/2018/1/migrating-linux-command-line -[5]: https://www.linux.com/blog/learn/2018/3/migrating-linux-using-sudo -[6]: https://www.linux.com/blog/learn/2018/3/migrating-linux-installing-software +[1]: https://linux.cn/article-9212-1.html +[2]: https://linux.cn/article-9213-1.html +[3]: https://linux.cn/article-9293-1.html +[4]: https://linux.cn/article-9565-1.html +[5]: https://linux.cn/article-9819-1.html +[6]: https://linux.cn/article-9823-1.html [7]: https://www.linux.com/files/images/figure-1png-2 -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-1_2.png?itok=J-C6q-t5 "Network Settings" +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-1_2.png?itok=J-C6q-t5 "Network Settings" [9]: https://www.linux.com/licenses/category/used-permission [10]: https://www.linux.com/files/images/figure-4png-1 -[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-4_1.png?itok=boI-L1mF "System Monitor" +[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/figure-4_1.png?itok=boI-L1mF "System Monitor" [12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 5bae0d23ac4dfdf272d8cb162c8b1ddc0389daad Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 19 Dec 2018 00:45:38 +0800 Subject: [PATCH 0176/4278] PUB:20180419 Migrating to Linux- Network and System Settings.md @ScarboroughCoral https://linux.cn/article-10363-1.html --- .../20180419 Migrating to Linux- Network and System Settings.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180419 Migrating to Linux- Network and System Settings.md (100%) diff --git a/translated/tech/20180419 Migrating to Linux- Network and System Settings.md b/published/20180419 Migrating to Linux- Network and System Settings.md similarity index 100% rename from translated/tech/20180419 Migrating to Linux- Network and System Settings.md rename to published/20180419 Migrating to Linux- Network and System Settings.md From 2b9a2b44cf96f43fa321c18b88f089658ff56f3f Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 19 Dec 2018 08:51:41 +0800 Subject: [PATCH 0177/4278] translated --- ...roken Ubuntu OS Without Reinstalling It.md | 78 ------------------- ...roken Ubuntu OS Without Reinstalling It.md | 78 +++++++++++++++++++ 2 files changed, 78 insertions(+), 78 deletions(-) delete mode 100644 sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md create mode 100644 translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md diff --git a/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md b/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md deleted file mode 100644 index 0d24e0d7c6..0000000000 --- a/sources/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (How To Fix Broken Ubuntu OS Without Reinstalling It) -[#]: via: (https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-it/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) -[#]: url: ( ) - -How To Fix Broken Ubuntu OS Without Reinstalling It -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Fix-Broken-Ubuntu-OS-720x340.jpg) - -Today, I was upgrading my Ubuntu 18.04 LTS system. Unfortunately, the power has gone in mid-way and the system powered off while updating Ubuntu OS. When the power is back, I boot the system again. Right after entering the password at the login screen, it’s gone blank and didn’t respond. Keyboard and mouse also didn’t work. All I see is just a blank screen! Thankfully, It’s just a test machine and there were no important data in it. I can simply wipe off the entire OS and install it again. But, I don’t want to do that. Since I have nothing to lose, I just wanted to repair my broken Ubuntu system without reinstalling it completely and it worked!!! If you ever find yourself in a situation like mine, don’t panic. This brief tutorial describes how to easily fix broken Ubuntu OS without losing data and without reinstalling it completely. - -### Fix Broken Ubuntu OS - -First of all, try to login with live cd and **backup your data** in an external drive. Just in case, if this method didn’t work, you can still have your data and reinstall everything! - -At the login screen, press **CTRL+ALT+F1** to switch to **tty1**. You can learn more about switching between TTYs [**here**][1]. - -Now, type the following commands one by one to fix the broken Ubuntu Linux. - -``` -$ sudo rm /var/lib/apt/lists/lock - -$ sudo rm /var/lib/dpkg/lock - -$ sudo rm /var/lib/dpkg/lock-frontend - -$ sudo dpkg --configure -a - -$ sudo apt clean - -$ sudo apt update --fix-missing - -$ sudo apt install -f - -$ sudo dpkg --configure -a - -$ sudo apt upgrade - -$ sudo apt dist-upgrade -``` - -Finally, reboot the system using command: - -``` -$ sudo reboot -``` - -You can now be able to login to your Ubuntu system as usual. - -After I followed these steps, all of my data in Ubuntu 18.04 test system was there and everything is the same as I left it. This method may not work for everyone. However, this small tip worked for me and saved a couple minutes from reinstalling. If you know any other better way, please let me know in the comment section. I will add them in this guide as well. - -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-fix-broken-ubuntu-os-without-reinstalling-it/ - -作者:[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-switch-between-ttys-without-using-function-keys-in-linux/ diff --git a/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md b/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md new file mode 100644 index 0000000000..2fbdc6f07e --- /dev/null +++ b/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (How To Fix Broken Ubuntu OS Without Reinstalling It) +[#]: via: (https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-it/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) +[#]: url: ( ) + +如何不重装修复损坏的 Ubuntu 系统 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Fix-Broken-Ubuntu-OS-720x340.jpg) + +今天,我在升级我的 Ubuntu 18.04 LTS 系统。不幸的是,在更新 Ubuntu 时中途断电,系统关机。电源恢复后,我再次启动系统。在登录页面输入密码后,它变成空白并且没有响应。键盘和鼠标也没有作用。我只看到一个空白的屏幕!值得庆幸的是,它只是一台测试机,并且没有重要的数据。我可以直接擦除整个系统然后重新安装。但是,我不想这样做。由于我没有什么可失去的,我只是想不重装修复我损坏的 Ubuntu 系统,并且我成功了!如果你发现自己处于像我这样的境地,不要惊慌。这个简短的教程描述了如何在不丢失数据的情况下轻松修复损坏的 Ubuntu 系统,而无需重新安装。 + +### 修复损坏的 Ubuntu 系统 + +首先,尝试使用 live cd 登录并**在外部驱动器中备份数据**。以防这个方法没用,你仍然可以获取数据并重新安装系统! + +在登录页上,按下 **CTRL+ALT+F1** 切换到 **tty1**。你可以在[**此处**][1]了解有关在 TTY 之间切换的更多信息。 + +现在,逐个输入以下命令来修复损坏的 Ubuntu Linux。 + +``` +$ sudo rm /var/lib/apt/lists/lock + +$ sudo rm /var/lib/dpkg/lock + +$ sudo rm /var/lib/dpkg/lock-frontend + +$ sudo dpkg --configure -a + +$ sudo apt clean + +$ sudo apt update --fix-missing + +$ sudo apt install -f + +$ sudo dpkg --configure -a + +$ sudo apt upgrade + +$ sudo apt dist-upgrade +``` + +最后,使用命令重启系统: + +``` +$ sudo reboot +``` + +你现在可以像往常一样登录到你的 Ubuntu 系统。 + +我做完这些步骤后,我 Ubuntu 18.04 测试系统中的所有数据都还在,一切都之前的一样。此方法可能不适用于所有人。但是,这个小小的贴士对我有用,并且比重装节省了一些时间。如果你了解其他更好的方法,请在评论区告诉我。我也会在本指南中添加它们。 + +这是这些了。希望这篇文章有用。 + +还有更多好东西。敬请关注! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-it/ + +作者:[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]: https://www.ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/ \ No newline at end of file From 66b22351b1d9b10c097ad36d8989173e5bbe5166 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 19 Dec 2018 08:59:31 +0800 Subject: [PATCH 0178/4278] translating --- ...nt Dropbox Folder Locally As Virtual File System In Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md index 691600a4cc..ae559de4c6 100644 --- a/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md +++ b/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @@ -1,3 +1,5 @@ +translating---geekpi + Dbxfs – Mount Dropbox Folder Locally As Virtual File System In Linux ====== From 31b5122870c1e31449d6db8a71b377806cb4e0d7 Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Wed, 19 Dec 2018 09:35:33 +0800 Subject: [PATCH 0179/4278] update --- ... - Notmuch, mbsync, postfix and dovecot.md | 237 ------------------ ... - Notmuch, mbsync, postfix and dovecot.md | 235 +++++++++++++++++ 2 files changed, 235 insertions(+), 237 deletions(-) delete mode 100644 sources/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md create mode 100644 translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md diff --git a/sources/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md b/sources/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md deleted file mode 100644 index b239209c1b..0000000000 --- a/sources/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md +++ /dev/null @@ -1,237 +0,0 @@ -translating by lixinyuxx - -My personal Email setup - Notmuch, mbsync, postfix and dovecot -====== -I've been using personal email setup for quite long and have not documented it anywhere. Recently when I changed my laptop (a post is pending about it) I got lost trying to recreate my local mail setup. So this post is a self documentation so that I don't have to struggle again to get it right. - -### Server Side - -I run my own mail server and I use postfix as SMTP server and Dovecot for the IMAP purpose. I'm not going into detail of setting those up as my setup was mostly done by using scripts created by Jonas for Redpill infrastructure. What redpill is?. (In jonas's own words) - -> Redpill is a concept - a way to setup Debian hosts to collaborate across organisations I develop the concept, and use it for the first ever Redpill network-of-networks redpill.dk, involving my own network (jones.dk), my main client's network (homebase.dk), a network in Germany including Skolelinux Germany (free-owl.de), and Vasudev's network (copyninja.info) - -Along with that I have a dovecot sieve filtering to classify on high level mails into various folders depending on from where they originate. All the rules live in the ~/dovecot.sieve file under every account which has a mail address. - -Again I'm not going into detail of how to set these things up, as its not goal of my this post. - -### On my Laptop - -On my laptop I've following 4 parts setup - - 1. Mail syncing : Done using mbsync command - 2. Classification: Done using notmuch - 3. Reading: Done using notmuch-emacs - 4. Mail sending: Done using postfix running as relay server and SMTP client. - - - -### Mail Syncing - -Mail syncing is done using mbsync tool, I was previously user of offlineimap and recently switched to mbsync as I felt it more lighter and simpler to configure than offlineimap. mbsync command is provided by package isync. - -Configuration file is ~/.mbsyncrc. Below is my sample content with some private things redacted. - -``` -IMAPAccount copyninja -Host imap.copyninja.info -User vasudev -PassCmd "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/path/to/passphrase.txt -d ~/path/to/mailpass.gpg" -SSLType IMAPS -SSLVersion TLSv1.2 -CertificateFile /etc/ssl/certs/ca-certificates.crt - - -IMAPAccount gmail-kamathvasudev -Host imap.gmail.com -User kamathvasudev@gmail.com -PassCmd "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/path/to/passphrase.txt -d ~/path/to/mailpass.gpg" -SSLType IMAPS -SSLVersion TLSv1.2 -CertificateFile /etc/ssl/certs/ca-certificates.crt - -IMAPStore copyninja-remote -Account copyninja - -IMAPStore gmail-kamathvasudev-remote -Account gmail-kamathvasudev - -MaildirStore copyninja-local -Path ~/Mail/vasudev-copyninja.info/ -Inbox ~/Mail/vasudev-copyninja.info/INBOX - -MaildirStore gmail-kamathvasudev-local -Path ~/Mail/Gmail-1/ -Inbox ~/Mail/Gmail-1/INBOX - -Channel copyninja -Master :copyninja-remote: -Slave :copyninja-local: -Patterns * -Create Both -SyncState * -Sync All - -Channel gmail-kamathvasudev -Master :gmail-kamathvasudev-remote: -Slave :gmail-kamathvasudev-local: -# Exclude everything under the internal [Gmail] folder, except the interesting folders -Patterns * ![Gmail]* -Create Both -SyncState * -Sync All -``` - -Explanation for some interesting part in above configuration. One is the PassCmd which allows you to provide shell command to obtain the password for the account. This avoids filling in the password in configuration file. I'm using symmetric encryption with gpg and storing password some where on my disk. Which is of course just safe guarded by Unix ACL. - -I actually wanted to use my public key to encrypt the file but unlocking the file when script is run in background or via systemd looks difficult (or looked nearly impossible). If you have better suggestion I'm all ears :-). - -Next instruction part is Patterns. This allows you to selectively sync mail from your mail server. This was really helpful for me to exclude all crappy [Gmail]/ folders. - -### Mail Classification - -Once mail is locally on your device, we need a way to read the mails easily in a mail reader. My original setup was serving synced Maildir using local dovecot instance and read it in Gnus. This setup was bit of a over kill with all server software setups but inability of Gnus to not cope well with Maildir format this was best way to do it. This setup also has a disadvantage, that is searching a mail quickly when you have huge pile of mail to go through. This is where notmuch comes into picture. - -notmuch allows me to easily index through Gigabytes of my mail archives and get what I need very easily. I've created a small script which combines executing of mbsync and notmuch execution. I tag mails based on the Maildirs which are actually created on server side using dovecot sieve. Below is my full shell script which is doing task of syncing classification and deleting of spams. - -``` -#!/bin/sh - -MBSYNC=$(pgrep mbsync) -NOTMUCH=$(pgrep notmuch) - -if [ -n "$MBSYNC" -o -n "$NOTMUCH" ]; then - echo "Already running one instance of mail-sync. Exiting..." - exit 0 -fi - -echo "Deleting messages tagged as *deleted*" -notmuch search --format=text0 --output=files tag:deleted |xargs -0 --no-run-if-empty rm -v - -echo "Moving spam to Spam folder" -notmuch search --format=text0 --output=files tag:Spam and \ - to:vasudev@copyninja.info | \ - xargs -0 -I {} --no-run-if-empty mv -v {} ~/Mail/vasudev-copyninja.info/Spam/cur -notmuch search --format=text0 --output=files tag:Spam and - to:vasudev-debian@copyninja.info | \ - xargs -0 -I {} --no-run-if-empty mv -v {} ~/Mail/vasudev-copyninja.info/Spam/cur - - -MDIR="vasudev-copyninja.info vasudev-debian Gmail-1" -mbsync -Va -notmuch new - -for mdir in $MDIR; do - echo "Processing $mdir" - for fdir in $(ls -d /home/vasudev/Mail/$mdir/*); do - if [ $(basename $fdir) != "INBOX" ]; then - echo "Tagging for $(basename $fdir)" - notmuch tag +$(basename $fdir) -inbox -- folder:$mdir/$(basename $fdir) - fi - done -done -``` - -So before running mbsync I search for all mails tagged as deleted and delete them from system. Next I look for mails tagged as Spam on both my accounts and move it to Spam folder. Yeah you got it right these are mails escaping the spam filter and landing in my inbox and personally marked as Spam. - -After running mbsync I tag mails based on their folder (searching string folder:). This allows me easily get contents of lets say a mailing list without remembering the list address. - -### Reading Mails - -Now that we have synced and classified mail its time to setup the reading part. I use notmuch-emacs interface to read the mails. I use Spacemacs flavor of emacs so I took some time to write down the a private layer which brings together all my keybindings and classification in one place and does not clutter my entire .spacemacs file. You can find the code for my private layer in [notmuch-emacs-layer repository][1] - -### Sending Mails - -Well its not sufficient that if we can read mails, we need to be able to reply to mail. And this was the slightly tricky part where I recently got lost and had to write this post so that I don't forget it again. (And of course don't have to refer some outdated posts on web). - -My setup to send mails is using postfix as SMTP client with my own SMTP server as relayhost for it. The problem of relaying is it's not for the hosts with dynamic IP. There are couple of ways to allow hosts with dynamic IP to use relay servers, one is put the IP address from where mail will originate into my_network or second use SASL authentication. - -My preferred way is use of SASL authentication. For this I first had to create a separate account one for each machine which is going to relay the mails to my main server. Idea is to not use my primary account for SASL authentication. (Originally I was using primary account, but Jonas gave this idea of account per road runner). -``` -adduser _relay - -``` - -Here replace with name of your laptop/desktop or whatever you are using. Now we need to adjust postfix to act as relaying server. So add following lines to postfix configuration -``` -# SASL authentication -smtp_sasl_auth_enable = yes -smtp_tls_security_level = encrypt -smtp_sasl_tls_security_options = noanonymous -relayhost = [smtp.copyninja.info]:submission -smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd -``` - -So here relayhost is the server name which your postfix instance will be using to relay mails forward into internet. :submission part tells postfix to forward mail on to port 587 (secure). smtp_sasl_tls_security_options is set to disallow anonymous connection. This is must so that relay server trusts your mobile host and agrees to forward the mail for you. - -/etc/postfix/sasl_passwd is the file where you need to store password for account to be used for SASL authentication with server. Put following content into it. -``` -[smtp.example.com]:submission user:password - -``` - -Replace smtp.example.com with your SMTP server name which you have put in relayhost configuration. Replace user with _relay user you created and its password. - -To secure the sasl_passwd file and create a hash of it for postfix use following command. -``` -chown root:root /etc/postfix/sasl_passwd -chmod 0600 /etc/postfix/sasl_passwd -postmap /etc/postfix/sasl_passwd -``` - -The last command will create /etc/postfix/sasl_passwd.db file which is hash of your file /etc/postfix/sasl_passwd with same owner and permission. Now reload the postfix and check if mail makes out of your system using mail command. - -### Bonus Part - -Well since I've a script created above bringing together mail syncing and classification. I went ahead and created a systemd timer to periodically sync mails in the background. In my case every 10 minutes. Below is mailsync.timer file. -``` -[Unit] -Description=Check Mail Every 10 minutes -RefuseManualStart=no -RefuseManualStop=no - -[Timer] -Persistent=false -OnBootSec=5min -OnUnitActiveSec=10min -Unit=mailsync.service - -[Install] -WantedBy=default.target -``` - -Below is mailsync.service which is needed by mailsync.timer to execute our scripts. - -``` -[Unit] -Description=Check Mail -RefuseManualStart=no -RefuseManualStop=yes - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/mail-sync -StandardOutput=syslog -StandardError=syslog -``` - -Put these files under /etc/systemd/user and run below command to enable them. -``` -systemctl enable --user mailsync.timer -systemctl enable --user mailsync.service -systemctl start --user mailsync.timer -``` - -So that's how I've sync and send mail from my system. I came to know about afew from Jonas Smedegaard who also proof read this post. So next step I will try to improve my notmuch configuration using afew and of course a post will follow after that :-). - --------------------------------------------------------------------------------- - -via: https://copyninja.info/blog/email_setup.html - -作者:[copyninja][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://copyninja.info -[1]:https://source.copyninja.info/notmuch-emacs-layer.git/ diff --git a/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md b/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md new file mode 100644 index 0000000000..ffbf6d11a7 --- /dev/null +++ b/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md @@ -0,0 +1,235 @@ +我的个人电子邮件系统 - Notmuch, mbsync, postfix and dovecot +====== +我使用个人电子邮件系统已经相当长的时间了, 没有文字记录。最近当我换了我的笔记本电脑(职业变更做的变动)我在试图重新创建本地邮件设置时迷路了。所以这篇文章是一个自我文档, 这样我就不用再挣扎了就能改正过来。 + +### 服务器端 + +我运行自己的邮件服务器, 并使用 Postfix 作为 SMTP 服务器和用 Dovecot 实现 IMAP 。我不打算详细介绍如何配置这些设置, 因为我的设置主要是通过使用 Jonas 为 Redpill 基础架构创建的脚本完成的。什么是 Redpill ?(用 Jonas 自己的话说) + +> Redpill 是一个概念 - 一种设置 Debian hosts 去跨组织协作的方式 我发展了这个概念, 并将其首次使用 Redpill 去联网 redpill.dk, 涉及我自己的网络 (jones.dk), 我的主要客户的网络 (homebase.dk),在德国的一个网络, 包括Skolelinux Germany (free-owl.de), 和 Vasudev 的网络 (copyninja.info) + +除此之外, 我还有一个 dovecot sieve 过滤, 根据邮件的来源, 对高级邮件进行分类, 并将其分类到各种文件夹中。所有的规则都存在于每个有邮件地址的账户下的 ~/dovecot.sieve文件中。 + +再次, 我不详细介绍如何设置这些东西, 因为这不是我这个帖子的目标。 + +### 在我的笔记本电脑上 + +在我的笔记本电脑上, 我已经按照4个部分设置 + + 1. 邮件同步: 使用 mbsync 命令完成 + 2. 分类: 使用 notmuch 完成 + 3. 阅读: 使用 notmuch-emacs 完成 + 4. 邮件发送: 使用作为转接服务器和 SMTP 客户端运行的 postfix 完成。 + + + +### 邮件同步 + +邮件同步是使用 mbsync 工具完成的, 我以前是离线的用户, 最近切换到 mbsync, 因为我觉得它比 OfflineIMAP 的配置更轻, 更简单。命令是由包 isync 提供的。 + +配置文件是 ~/.mbsyncrc. 下面是我的例子与一些私人设置。 + +``` +IMAPAccount copyninja +Host imap.copyninja.info +User vasudev +PassCmd "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/path/to/passphrase.txt -d ~/path/to/mailpass.gpg" +SSLType IMAPS +SSLVersion TLSv1.2 +CertificateFile /etc/ssl/certs/ca-certificates.crt + + +IMAPAccount gmail-kamathvasudev +Host imap.gmail.com +User kamathvasudev@gmail.com +PassCmd "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/path/to/passphrase.txt -d ~/path/to/mailpass.gpg" +SSLType IMAPS +SSLVersion TLSv1.2 +CertificateFile /etc/ssl/certs/ca-certificates.crt + +IMAPStore copyninja-remote +Account copyninja + +IMAPStore gmail-kamathvasudev-remote +Account gmail-kamathvasudev + +MaildirStore copyninja-local +Path ~/Mail/vasudev-copyninja.info/ +Inbox ~/Mail/vasudev-copyninja.info/INBOX + +MaildirStore gmail-kamathvasudev-local +Path ~/Mail/Gmail-1/ +Inbox ~/Mail/Gmail-1/INBOX + +Channel copyninja +Master :copyninja-remote: +Slave :copyninja-local: +Patterns * +Create Both +SyncState * +Sync All + +Channel gmail-kamathvasudev +Master :gmail-kamathvasudev-remote: +Slave :gmail-kamathvasudev-local: +# Exclude everything under the internal [Gmail] folder, except the interesting folders +Patterns * ![Gmail]* +Create Both +SyncState * +Sync All +``` + +对上述配置中的一些有趣部分进行说明。一个是 PassCmd , 它允许您提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我使用对称加密与 gpg 和存储密码在我的磁盘上的一些地方。这当然是由 Unix ACL 保护安全。 + +实际上, 我想使用我的公钥加密文件, 但当脚本在后台或通过 systemd 运行时, 解锁文件看起来很困难 (或看起来几乎不可能)。如果你有更好的建议, 我洗耳恭听:-)。 + +下一个指令部分是模式。这使您可以有选择地同步来自邮件服务器的邮件。这对我来说真的很有帮助, 可以排除所有的垃圾 [Gmail]/ folders. + +### 邮件分类 + +一旦邮件在您本地的设备, 我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步 Maildir, 并在 Gnus 中阅读。这种设置是有点大题小作相比于设置所有服务器软件, 但 Gnus 无法很好地应付 maildir 格式, 这是最好的方法。这个设置也有一个缺点, 那就是在你有大量邮件要看的时候快速搜索邮件。这是为数不多的情况。 + +不多让我很容易索引通过千兆字节的邮件档案, 并很容易得到我需要的东西。我已经创建了一个小脚本, 它结合了执行 mbsync 和 notmuch 执行语句。我基于 Maildirs 标记邮件, 实际上是创建在服务器端使用 dovecot sieve 。下面是我的完整 shell 脚本, 它正在执行同步分类和删除垃圾邮件的任务。 + +``` +#!/bin/sh + +MBSYNC=$(pgrep mbsync) +NOTMUCH=$(pgrep notmuch) + +if [ -n "$MBSYNC" -o -n "$NOTMUCH" ]; then + echo "Already running one instance of mail-sync. Exiting..." + exit 0 +fi + +echo "Deleting messages tagged as *deleted*" +notmuch search --format=text0 --output=files tag:deleted |xargs -0 --no-run-if-empty rm -v + +echo "Moving spam to Spam folder" +notmuch search --format=text0 --output=files tag:Spam and \ + to:vasudev@copyninja.info | \ + xargs -0 -I {} --no-run-if-empty mv -v {} ~/Mail/vasudev-copyninja.info/Spam/cur +notmuch search --format=text0 --output=files tag:Spam and + to:vasudev-debian@copyninja.info | \ + xargs -0 -I {} --no-run-if-empty mv -v {} ~/Mail/vasudev-copyninja.info/Spam/cur + + +MDIR="vasudev-copyninja.info vasudev-debian Gmail-1" +mbsync -Va +notmuch new + +for mdir in $MDIR; do + echo "Processing $mdir" + for fdir in $(ls -d /home/vasudev/Mail/$mdir/*); do + if [ $(basename $fdir) != "INBOX" ]; then + echo "Tagging for $(basename $fdir)" + notmuch tag +$(basename $fdir) -inbox -- folder:$mdir/$(basename $fdir) + fi + done +done +``` + +因此, 在运行 mbsync 之前, 我搜索所有标记为已删除的邮件, 并将其从系统中删除。接下来, 我在我的帐户上查找标记为 "垃圾邮件" 的邮件, 并将其移动到垃圾邮件文件夹。你做的对, 这些邮件逃脱垃圾邮件过滤器进到我的 inbox, 并被我亲自标记为垃圾邮件。 + +运行 mbsync 后, 我基于他们的文件夹标记邮件 (搜索字符串文件夹:)。这让我可以很容易地得到一个邮件列表的内容, 而不需要记住列表地址。 + +### 阅读邮件 + +现在, 我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格, 所以我花了一些时间写下一个私有层, 它将我所有的快捷键和分类集中在一个地方, 不会扰乱我的整个. spacemacs 文件。您可以在 [notmuch-emacs-layer repository][1] 找到我私有层的代码。 + +### 发送邮件 + +如果我们能阅读邮件, 我们就需要能够回复邮件, 这还不够。而这是我最近迷惑的一个略显棘手的部分, 不得不写这篇文章, 这样我就不会再忘记了。(当然也不必在网络上引用一些过时的帖子)。 + +我的设置发送邮件使用 postfix 作为 SMTP 客户端与我自己的 SMTP 服务器作为它的转接主机。转接的问题是, 它不是具有动态 IP 的主机。有几种方法可以允许具有动态 ip 的主机使用转接服务器, 一种是将邮件从其中发源于 my_network 或第二个使用 SASL 身份验证的 IP 地址。 + +我的首选方法是使用 SASL 身份验证。为此, 我首先要为每台机器创建一个单独的账户, 它将把邮件传递到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主要账户, 但 Jonas 给出了每个可行账户的想法 +``` +adduser _relay + +``` + +这里替换 与您的笔记本电脑的名称或任何你正在使用的设备。现在我们需要调整 postfix , 作为转接服务器。因此, 在 postfix 配置中添加以下行 +``` +# SASL authentication +smtp_sasl_auth_enable = yes +smtp_tls_security_level = encrypt +smtp_sasl_tls_security_options = noanonymous +relayhost = [smtp.copyninja.info]:submission +smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd +``` + +因此, 这里的 relayhost 是您的 postfix 实例将用于邮件转发到互联网的服务器名称。submission 的部分 postfix 将邮件转发到端口 587 (安全)。smtp_sasl_tls_security_options 设置为不允许匿名连接。这必须使转接服务器信任您的移动主机, 并同意为您转发邮件。 + +/etc/postfix/sasl__asswd 是您需要存储用于服务器 SASL 身份验证的帐户密码的文件。将以下内容放入其中。 +``` +[smtp.example.com]:submission user:password + +``` + +替换 smtp.example.com 用你的 SMTP 服务器名称, 您已输入的 relayhost 认证。 用您创建的用户及其密码替换 user with _relay 。 + +若要保护 sasl_passwd 文件, 并创建它的哈希值进行 postfix 使用以下命令。 +``` +chown root:root /etc/postfix/sasl_passwd +chmod 0600 /etc/postfix/sasl_passwd +postmap /etc/postfix/sasl_passwd +``` + +最后的命令将创建 /etc/postfix/sasl_passwd.db 文件是您的文件的哈希值 /etc/postfix/sasl_passwd 具有相同的所有者和权限。现在重新加载 postfix, 并检查邮件是否使用邮件命令从您的系统中取出。 + +### Bonus 的部分 + +好吧, 因为我有一个脚本创建以上结合了邮件的同步和分类。我继续创建了一个 systemd 计时器, 以定期同步后台的邮件。就我而言, 每10分钟一次。下面是 mailsync.timer 文件。 +``` +[Unit] +Description=Check Mail Every 10 minutes +RefuseManualStart=no +RefuseManualStop=no + +[Timer] +Persistent=false +OnBootSec=5min +OnUnitActiveSec=10min +Unit=mailsync.service + +[Install] +WantedBy=default.target +``` + +下面是 mailsync. 服务, 这是邮件同步计时器执行我们的脚本所需要的。 + +``` +[Unit] +Description=Check Mail +RefuseManualStart=no +RefuseManualStop=yes + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/mail-sync +StandardOutput=syslog +StandardError=syslog +``` + +将这些文件置于 /etc/systemd/user 目录下并运行以下代码去开启他们 +``` +systemctl enable --user mailsync.timer +systemctl enable --user mailsync.service +systemctl start --user mailsync.timer +``` + +这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew 他同时阅读了这篇帖子。因此, 下一步, 我将尝试使用 afew 改进我的 notmuch 配置, 当然还会有一个后续的帖子:-)。 + +-------------------------------------------------------------------------------- + +via: https://copyninja.info/blog/email_setup.html + +作者:[copyninja][a] +译者:[lixinyuxx](https://github.com/lixinyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://copyninja.info +[1]:https://source.copyninja.info/notmuch-emacs-layer.git/ From 9b1bba79fda1b38b9df99d31607edf9c7d545de6 Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Wed, 19 Dec 2018 09:40:41 +0800 Subject: [PATCH 0180/4278] 20180101 --- ...en solutions to everything in education.md | 113 ------------------ ...en solutions to everything in education.md | 110 +++++++++++++++++ 2 files changed, 110 insertions(+), 113 deletions(-) delete mode 100644 sources/tech/20180101 27 open solutions to everything in education.md create mode 100644 translated/tech/20180101 27 open solutions to everything in education.md diff --git a/sources/tech/20180101 27 open solutions to everything in education.md b/sources/tech/20180101 27 open solutions to everything in education.md deleted file mode 100644 index eeba3692e4..0000000000 --- a/sources/tech/20180101 27 open solutions to everything in education.md +++ /dev/null @@ -1,113 +0,0 @@ -translating by lixinyuxx - -27 open solutions to everything in education -====== -![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo) - -Openness (from open source software, to open hardware, to open principles) is changing the paradigm of education. So, to celebrate all that's gone on this year, I collected 27 of the best articles published on Opensource.com in 2017 on the subject. I divided them into broad themes, rather than ordering them by popularity. And, if these 27 stories don't satisfy your appetite for information about open source in education, check out our companion article on how [education is leveraging Raspberry Pi and Linux][30]. - -### Open is better for everyone - -1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt reviews David Price's book OPEN, which explores the idea that "open" isn't just a technological shift, rather it's "how we'll work, live, and learn in the future." - -2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur points out how to get ahead in the workforce by learning open source. This advice isn't just for programmers; designers, writers, marketers, and other creative professionals are also essential to the success of open source. - -3. [A graduate degree could springboard you into an open source job][3]: Citing research that shows that Linux skills lead to higher pay, Joshua Pearce makes the case that open source proficiency and a graduate degree are an unbeatable career combination. - -4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger shows us how open practices are creating a more inclusive, agile, and open culture in a Pennsylvania school district. Charlie says it's not just about saving money; the district also gains from "open leadership principles that foster innovation among teachers and students, help to better engage the community, and create a more vibrant and inclusive learning community." - -5. [15 ways to empower students with open source tools][5]: I write how open source gives students the freedom to explore, tinker, and learn, whether they're learning basic digital literacy or expanding on those skills with fun projects. - -6. [Developer opportunities to code for good][6]: Open source is often the backbone of socially beneficial projects. As Ahn Bui, vice president of Benetech Labs, states in this interview: "Establishing open data standards is an integral step in breaking down data silos. Those open standards will provide the foundation for interoperability and in turn, translate to more organizations building together, often more cost effectively. The ultimate goal is to serve more people at the same cost or even less." - -### Open education resources for remixing and reusing - -1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis, director of programs for Wiki Ed, discusses how open educational resources (OERs), such as Wiki Ed, are providing high-quality and affordable open source learning resources as classroom teaching tools. - -2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green, director of open education for Creative Commons, shares how the face of education is changing in higher education and what Creative Commons is doing to facilitate it. - -3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites, community evangelist and chief marketing officer of Open Up Resources, talks about the nonprofit organization's efforts to provide open, standards-aligned curricula for K-12 schools. - -4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke, educational technologist at the University of Hawaii at Manoa, says that transitioning to OER in college courses will "empower faculty to take control of what content they teach with, which we expect will result in their saving students money." - -5. [How open courses are slashing the cost of higher education][11]: Saylor Academy's director of education Devon Ritter reports how Saylor is building its college credit-eligible courses on openly licensed content, with the goal of making higher education affordable and accessible to more people. - -6. [Open educational resources movement gains speed][12]: Alexis Clifton, executive director of the State University of New York OER Services, describes how New York's US$ 8 million investment is spurring growth in open education and making college more affordable. - -7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik from Duke University explores OSPRI (Open Source Pedagogy Research and Innovation), a collaboration between Duke and Red Hat that's building a 21st-century, preK-12 learning ecosystem that is open by design. - -8. [Perma.cc stops scholarly link rot][14]: Virginia Tech's Phillip Young writes about Perma.cc, a solution to "link rot," which is the high probability that hyperlinks in academic papers will disappear or change over time. - -9. [Open education: How students save money by creating open textbooks][15]: OER pioneer Robin DeRosa talks about "the freedom that the openly licensed textbook introduced, and the overarching idea that education and learning should be contextualized in inclusive ecosystems that enhance the public good." - -### Open source tools in the classroom - -1. [How an open source board game is saving the planet][16]: Joshua Pearce writes about Save the Planet, a board game that empowers students to solve environmental problems while having fun and contributing to the maker community. - -2. [A new Android app for teaching kids how to read][17]: Michael Hall talks about Phoenicia, a children's literacy app he developed after his son was diagnosed with autism, the value of coding for good, and why user testing matters more than you think. - -3. [8 open source Android apps for education][18]: Joshua Allen Holm challenges us to use our smartphones as learning tools by recommending eight open source apps from the F-Droid repository to try. - -4. [3 open source alternatives to MATLAB][19]: Jason Baker's update to his 2016 survey of open source mathematical computing software presents alternatives to MATLAB, the expensive, proprietary solution nearly ubiquitous in mathematics, physical sciences, engineering, and economics. - -5. [What does SVG have to do with teaching kids to code?][20] Retired engineer Jay Nick talks about how he uses art as a creative way to introduce students to coding. He volunteers in schools, using Scalable Vector Graphics (SVG) to teach an approach to coding that combines principles of mathematics and art. - -6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, who holds a PhD in fine arts from Texas Tech, shares his experience using open source tools in a world ruled by proprietary solutions. Kyle says there's a bias against using open source in disciplines outside of computer science: "Many people think non-technical students can't use Linux, and they make a lot of assumptions about people who use it in their advanced degree programs. … Well, it is possible, and I'm proof." - -7. [A list of open source tools for college][22]: Aaron Cocker outlines the open source tools (including presentation, backup, and programming software) he uses while working on his undergraduate degree in computer science. - -8. [5 great KDE apps to help you study][23]: Zsolt Szakács offers five KDE applications that help anyone who wants to learn new skills or cultivate existing ones. - -### Coding in the classroom - -1. [How to get the next generation coding early][24]: Bryson Payne says we need to teach kids to code before high school: By ninth grade 80% of girls and 60% of boys have already self-selected out of a STEM career. But it's not only about jobs and closing the IT skills gap, he suggests. "Teaching a young person to code could be the single most life-changing skill you can give them. And it's not just a career-enhancer. Coding is about problem-solving, it's about creativity, and more importantly, it's about empowerment." - -2. [Kids can't code without computers][25]: Patrick Masson introduces the FLOSS Desktops for Kids program, which teaches students at underserved schools to repurpose older computers with open source software, such as Linux, LibreOffice, and GIMP. Not only is the program breathing new life into broken or decommissioned hardware, it's also giving students important skills that may translate into future careers. - -3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva offers suggestions for using [Scratch][27] to spark kids' interest in programming, just as LOGO did when he started using it in the 1980s. - -4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger describes App Inventor, a programming framework for building Android applications using a visual blocks language (similar to Scratch or [Snap][29]). - -Throughout the year we learned that there is an open solution to everything in education, and I expect this theme to continue in 2018 and beyond. Are there open education topics you'd like Opensource.com to cover in the coming year? If so, please share your ideas in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/best-open-education - -作者:[Don Watkins][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/don-watkins -[1]:https://opensource.com/article/17/7/book-review-open -[2]:https://opensource.com/article/17/8/jump-start-your-career -[3]:https://opensource.com/article/17/1/grad-school-open-source-academic-lab -[4]:https://opensource.com/article/17/7/open-school-leadership -[5]:https://opensource.com/article/17/7/empower-students-open-source-tools -[6]:https://opensource.com/article/17/3/interview-anh-bui-benetech-labs -[7]:https://opensource.com/article/17/1/Wiki-Education-Foundation -[8]:https://opensource.com/article/17/2/future-textbooks-cable-green-creative-commons -[9]:https://opensource.com/article/17/1/open-up-resources -[10]:https://opensource.com/article/17/2/interview-education-billy-meinke -[11]:https://opensource.com/article/17/7/college-alternatives -[12]:https://opensource.com/article/17/10/open-educational-resources-alexis-clifton -[13]:https://opensource.com/article/17/3/education-should-be-open-design -[14]:https://opensource.com/article/17/9/stop-link-rot-permacc -[15]:https://opensource.com/article/17/11/creating-open-textbooks -[16]:https://opensource.com/article/17/7/save-planet-board-game -[17]:https://opensource.com/article/17/4/phoenicia-education-software -[18]:https://opensource.com/article/17/8/8-open-source-android-apps-education -[19]:https://opensource.com/alternatives/matlab -[20]:https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam -[21]:https://opensource.com/article/17/5/how-linux-higher-education -[22]:https://opensource.com/article/17/6/open-source-tools-university-student -[23]:https://opensource.com/article/17/6/kde-education-software -[24]:https://opensource.com/article/17/8/teach-kid-code-change-life -[25]:https://opensource.com/article/17/9/floss-desktops-kids -[26]:https://opensource.com/article/17/3/logo-scratch-teach-programming-kids -[27]:https://scratch.mit.edu/ -[28]:https://opensource.com/article/17/8/app-inventor-android-app-development -[29]:http://snap.berkeley.edu/ -[30]:https://opensource.com/article/17/12/best-opensourcecom-linux-and-raspberry-pi-education diff --git a/translated/tech/20180101 27 open solutions to everything in education.md b/translated/tech/20180101 27 open solutions to everything in education.md new file mode 100644 index 0000000000..898a4250ab --- /dev/null +++ b/translated/tech/20180101 27 open solutions to everything in education.md @@ -0,0 +1,110 @@ +27个解决教学问题的开放式方法 +====== +![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo) + +开放式理念 (从开源软件到开放硬件, 再到开放原则) 正在改变教育的范式。因此, 为了庆祝今年发生的一切, 我收集了2017年在 Opensource.com 上发表的27篇关于这个主题的最好的文章。我把它们分成明确的主题, 而不是按人气来分类。而且, 如果这27个故事不能满足你对教育公开信息的胃口, 那就看看我们的协同文章吧 " [education is leveraging Raspberry Pi and Linux][30]. + +### 开放对每个人都有好处 + +1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt 评价David Price 的书 'OPEN' ,该书探讨了 "开放" 不仅仅是技术转变的观点, 而是 "我们未来将如何工作、生活和学习"。 + +2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur 指出了如何利用开放式学习在工作群体中脱颖而出。 这个建议不仅仅是针对程序员的, 而是针对程序员的。设计师、作家、营销人员和其他创意专业人士也是开放式成功的关键。 + +3. [A graduate degree could springboard you into an open source job][3]: 引用的研究表明会 Linux 技能会带来更高的薪水, Joshua Pearce 说对开源的熟练和研究生学位是无与伦比的职业技能组合。 + +4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger 向我们展示了开放的做法是如何在宾夕法尼亚州的一个学区创造一种更具包容性、敏捷性和开放性的文化的。 Charlie 说, 这不仅仅是为了省钱;该区还受益于 "开放式领导原则, 促进师生创新, 帮助更好地吸引社区, 创造一个更有活力和包容性的学习社区"。 + +5. [15 ways to empower students with open source tools][5]: 我写开源是如何让学生自由探索、补拙和学习的, 不管他们是在学习基本的数字化素养, 还是通过有趣的项目来扩展这些技能。 + +6. [Developer opportunities to code for good][6]: 开源往往是对社会有益的项目的支柱。正如 Benetech Labs 副总裁 Ahn Bui 在这次采访中指出的那样: "建立开放数据标准是打破数据孤岛不可或缺的一步。这些开放标准将为互操作性提供基础, 进而转化为更多的组织共同建设, 往往更具成本效益。最终目标是以同样的成本甚至更低的成本为更多的人服务。 + +### 用于再混合和再利用的开放教育资源 + +1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis,Wiki Ed 的, 项目总监,讨论开放教育资源 (OERs) ,如 Wiki Ed,如何提供高质量且经济实惠的开源学习资源作为课堂教学工具。 + +2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green, Creative Common 开放教育主任,分享高等教育中教育面貌是如何变化的, 以及 Creative Common 正在采取哪些措施来促进教育。 + +3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites,Open Up Resources 的社区福音传教士和首席营销官, 谈论非营利组织努力为 K-12 学校提供开放的, 标准一致的课程。 + +4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke夏威夷大学马诺阿分校的教育技术专家,他说, 在大学课程中过渡到 ORE 将 "使教师能够控制他们教授的内容, 我们预计这将为他们节省学生的费用"。 + +5. [How open courses are slashing the cost of higher education][11]: Saylor Academy 的教育主任 Devon Ritter 报告了 Saylor 是如何建立以公开许可内容为基础的大学学分课程, 目的是使更多的人能够负担得起和获得高等教育。 + +6. [Open educational resources movement gains speed][12]: Alexis Clifton,State University of New York 的 OER 服务的执行主任, 描述了纽约800万美元的投资如何刺激开放教育的增长, 并使大学更实惠。 + +7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik 在Duke University 探索 OSPRI (Open Source Pedagogy Research and Innovation,开源教育学的研究与创新), 在 Duke 和 Red Hat 的联合合作这是建立一个21世纪的, preK-12 学习生态系统, 是开放的设计。 + +8. [Perma.cc stops scholarly link rot][14]: Virginia Tech 的 Phillip Young 写关于 Perma.cc, "link rot,"(链接失效) 的解决方案 很大可能在学术论文中的超链接随着时间的推移而消失或变化。 + +9. [Open education: How students save money by creating open textbooks][15]: OER 先驱 Robin DeRosa 谈到 "公开许可教科书引入的自由, 以及教育和学习应结合包容性生态系统, 以增强公益的总体理念"。 + +### 课堂上的开源工具 + +1. [How an open source board game is saving the planet][16]: Joshua Pearce 写关于拯救地球, 一个棋盘游戏, 使学生能够解决环境问题, 同时有乐趣, 并为制造商社区作出贡献。 + +2. [A new Android app for teaching kids how to read][17]: Michael Hall 谈到 Phoenicia,他在儿子被诊断为自闭症后开发的儿童识字应用, 为了产生更好的编码价值, 以及为什么用户测试比你想象的更重要。 + +3. [8 open source Android apps for education][18]: Joshua Allen Holm 通过推荐 F-Droid 存储库中的8个开源应用来尝试, 这将挑战我们将智能手机用作学习工具。 + +4. [3 open source alternatives to MATLAB][19]: Jason Baker's 更新了他2016年的开源数学计算软件调查, 提出了 MATLAB 的替代方案, 这是数学、物理科学、工程和经济学中几乎无处不在的昂贵的专有解决方案。 + +5. [What does SVG have to do with teaching kids to code?][20] 退休工程师 Jay Nick 谈论他如何使用艺术作为一种创造性的方式, 向学生介绍编码。他在学校做志愿者, 使用可缩放矢量图形 (SVG,Scalable Vector Graphics) 教授一种结合数学和艺术原理的编码方法。 + +6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, 在 Texas Tech 拥有美术博士学位 分享他在单一解决方案统治的世界中使用开源工具的经验。 Kyle 说有一种偏见, 反对在计算机科学以外的学科中使用开源:"很多人认为非技术专业的学生不能使用 Linux, 他们对在高级学位课程中使用 Linux 的人做出了很多假设。...嗯, 这是有可能的, 我就是证明。 + +7. [A list of open source tools for college][22]: Aaron Cocker 概述了他在攻读计算机科学本科学位时使用的开源工具 (包括演示、备份和编程软件)。 + +8. [5 great KDE apps to help you study][23]: Zsolt Szakács 提供五个 KDE 应用程序, 帮助任何想要学习新技能或培养现有技能的人。 + +### 在教室编码 + +1. [How to get the next generation coding early][24]: Bryson Payne 说我们需要教孩子们在高中前编码: 到了九年级, 80% 的女孩和60% 的男孩已经从 STEM 职业中自选。但他建议, 这不仅仅是就业和缩小 IT 技能差距的问题。"教一个年轻人编写代码可能是你能给他们的最改变生活的技能。而且这不仅仅是一个职业提升者。编码是关于解决问题, 它是关于创造力, 更重要的是, 它是关于授权。 + +2. [Kids can't code without computers][25]: Patrick Masson 推出了 FLOSS 儿童桌面计划, 该计划教授服务不足学校的学生使用开源软件 (如 Linux、LibreOffice 和 GIMP) 重新设计较旧的计算机。该计划不仅为破碎或退役的硬件注入新的生命, 还为学生提供了重要的技能, 这些技能可能会转化为未来的职业。 + +3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva 提供 [Scratch][27] 的使用建议激发孩子们对编程的兴趣, 就像 LOGO 在20世纪80年代开始使用它时一样。 + +4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger 描述应用发明者, 一个编程框架, 用于构建 Android 应用程序使用可视块语言 (类似 Scratch 或者[Snap][29]). + +在这一年里, 我们了解到, 教育领域的一切都有一个开放的解决方案, 我预计这一主题将在2018年及以后继续下去。在未来的一年里, 你是否希望 Opensource.com 涵盖开放的教育主题?如果是, 请在评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/best-open-education + +作者:[Don Watkins][a] +译者:[lixinyuxx](https://github.com/lixinyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/don-watkins +[1]:https://opensource.com/article/17/7/book-review-open +[2]:https://opensource.com/article/17/8/jump-start-your-career +[3]:https://opensource.com/article/17/1/grad-school-open-source-academic-lab +[4]:https://opensource.com/article/17/7/open-school-leadership +[5]:https://opensource.com/article/17/7/empower-students-open-source-tools +[6]:https://opensource.com/article/17/3/interview-anh-bui-benetech-labs +[7]:https://opensource.com/article/17/1/Wiki-Education-Foundation +[8]:https://opensource.com/article/17/2/future-textbooks-cable-green-creative-commons +[9]:https://opensource.com/article/17/1/open-up-resources +[10]:https://opensource.com/article/17/2/interview-education-billy-meinke +[11]:https://opensource.com/article/17/7/college-alternatives +[12]:https://opensource.com/article/17/10/open-educational-resources-alexis-clifton +[13]:https://opensource.com/article/17/3/education-should-be-open-design +[14]:https://opensource.com/article/17/9/stop-link-rot-permacc +[15]:https://opensource.com/article/17/11/creating-open-textbooks +[16]:https://opensource.com/article/17/7/save-planet-board-game +[17]:https://opensource.com/article/17/4/phoenicia-education-software +[18]:https://opensource.com/article/17/8/8-open-source-android-apps-education +[19]:https://opensource.com/alternatives/matlab +[20]:https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam +[21]:https://opensource.com/article/17/5/how-linux-higher-education +[22]:https://opensource.com/article/17/6/open-source-tools-university-student +[23]:https://opensource.com/article/17/6/kde-education-software +[24]:https://opensource.com/article/17/8/teach-kid-code-change-life +[25]:https://opensource.com/article/17/9/floss-desktops-kids +[26]:https://opensource.com/article/17/3/logo-scratch-teach-programming-kids +[27]:https://scratch.mit.edu/ +[28]:https://opensource.com/article/17/8/app-inventor-android-app-development +[29]:http://snap.berkeley.edu/ From 47c856dc6c4fd72c084a5c578626530adadc568e Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Wed, 19 Dec 2018 09:41:57 +0800 Subject: [PATCH 0181/4278] Revert "20180101" This reverts commit 9b1bba79fda1b38b9df99d31607edf9c7d545de6. --- ...en solutions to everything in education.md | 113 ++++++++++++++++++ ...en solutions to everything in education.md | 110 ----------------- 2 files changed, 113 insertions(+), 110 deletions(-) create mode 100644 sources/tech/20180101 27 open solutions to everything in education.md delete mode 100644 translated/tech/20180101 27 open solutions to everything in education.md diff --git a/sources/tech/20180101 27 open solutions to everything in education.md b/sources/tech/20180101 27 open solutions to everything in education.md new file mode 100644 index 0000000000..eeba3692e4 --- /dev/null +++ b/sources/tech/20180101 27 open solutions to everything in education.md @@ -0,0 +1,113 @@ +translating by lixinyuxx + +27 open solutions to everything in education +====== +![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo) + +Openness (from open source software, to open hardware, to open principles) is changing the paradigm of education. So, to celebrate all that's gone on this year, I collected 27 of the best articles published on Opensource.com in 2017 on the subject. I divided them into broad themes, rather than ordering them by popularity. And, if these 27 stories don't satisfy your appetite for information about open source in education, check out our companion article on how [education is leveraging Raspberry Pi and Linux][30]. + +### Open is better for everyone + +1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt reviews David Price's book OPEN, which explores the idea that "open" isn't just a technological shift, rather it's "how we'll work, live, and learn in the future." + +2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur points out how to get ahead in the workforce by learning open source. This advice isn't just for programmers; designers, writers, marketers, and other creative professionals are also essential to the success of open source. + +3. [A graduate degree could springboard you into an open source job][3]: Citing research that shows that Linux skills lead to higher pay, Joshua Pearce makes the case that open source proficiency and a graduate degree are an unbeatable career combination. + +4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger shows us how open practices are creating a more inclusive, agile, and open culture in a Pennsylvania school district. Charlie says it's not just about saving money; the district also gains from "open leadership principles that foster innovation among teachers and students, help to better engage the community, and create a more vibrant and inclusive learning community." + +5. [15 ways to empower students with open source tools][5]: I write how open source gives students the freedom to explore, tinker, and learn, whether they're learning basic digital literacy or expanding on those skills with fun projects. + +6. [Developer opportunities to code for good][6]: Open source is often the backbone of socially beneficial projects. As Ahn Bui, vice president of Benetech Labs, states in this interview: "Establishing open data standards is an integral step in breaking down data silos. Those open standards will provide the foundation for interoperability and in turn, translate to more organizations building together, often more cost effectively. The ultimate goal is to serve more people at the same cost or even less." + +### Open education resources for remixing and reusing + +1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis, director of programs for Wiki Ed, discusses how open educational resources (OERs), such as Wiki Ed, are providing high-quality and affordable open source learning resources as classroom teaching tools. + +2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green, director of open education for Creative Commons, shares how the face of education is changing in higher education and what Creative Commons is doing to facilitate it. + +3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites, community evangelist and chief marketing officer of Open Up Resources, talks about the nonprofit organization's efforts to provide open, standards-aligned curricula for K-12 schools. + +4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke, educational technologist at the University of Hawaii at Manoa, says that transitioning to OER in college courses will "empower faculty to take control of what content they teach with, which we expect will result in their saving students money." + +5. [How open courses are slashing the cost of higher education][11]: Saylor Academy's director of education Devon Ritter reports how Saylor is building its college credit-eligible courses on openly licensed content, with the goal of making higher education affordable and accessible to more people. + +6. [Open educational resources movement gains speed][12]: Alexis Clifton, executive director of the State University of New York OER Services, describes how New York's US$ 8 million investment is spurring growth in open education and making college more affordable. + +7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik from Duke University explores OSPRI (Open Source Pedagogy Research and Innovation), a collaboration between Duke and Red Hat that's building a 21st-century, preK-12 learning ecosystem that is open by design. + +8. [Perma.cc stops scholarly link rot][14]: Virginia Tech's Phillip Young writes about Perma.cc, a solution to "link rot," which is the high probability that hyperlinks in academic papers will disappear or change over time. + +9. [Open education: How students save money by creating open textbooks][15]: OER pioneer Robin DeRosa talks about "the freedom that the openly licensed textbook introduced, and the overarching idea that education and learning should be contextualized in inclusive ecosystems that enhance the public good." + +### Open source tools in the classroom + +1. [How an open source board game is saving the planet][16]: Joshua Pearce writes about Save the Planet, a board game that empowers students to solve environmental problems while having fun and contributing to the maker community. + +2. [A new Android app for teaching kids how to read][17]: Michael Hall talks about Phoenicia, a children's literacy app he developed after his son was diagnosed with autism, the value of coding for good, and why user testing matters more than you think. + +3. [8 open source Android apps for education][18]: Joshua Allen Holm challenges us to use our smartphones as learning tools by recommending eight open source apps from the F-Droid repository to try. + +4. [3 open source alternatives to MATLAB][19]: Jason Baker's update to his 2016 survey of open source mathematical computing software presents alternatives to MATLAB, the expensive, proprietary solution nearly ubiquitous in mathematics, physical sciences, engineering, and economics. + +5. [What does SVG have to do with teaching kids to code?][20] Retired engineer Jay Nick talks about how he uses art as a creative way to introduce students to coding. He volunteers in schools, using Scalable Vector Graphics (SVG) to teach an approach to coding that combines principles of mathematics and art. + +6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, who holds a PhD in fine arts from Texas Tech, shares his experience using open source tools in a world ruled by proprietary solutions. Kyle says there's a bias against using open source in disciplines outside of computer science: "Many people think non-technical students can't use Linux, and they make a lot of assumptions about people who use it in their advanced degree programs. … Well, it is possible, and I'm proof." + +7. [A list of open source tools for college][22]: Aaron Cocker outlines the open source tools (including presentation, backup, and programming software) he uses while working on his undergraduate degree in computer science. + +8. [5 great KDE apps to help you study][23]: Zsolt Szakács offers five KDE applications that help anyone who wants to learn new skills or cultivate existing ones. + +### Coding in the classroom + +1. [How to get the next generation coding early][24]: Bryson Payne says we need to teach kids to code before high school: By ninth grade 80% of girls and 60% of boys have already self-selected out of a STEM career. But it's not only about jobs and closing the IT skills gap, he suggests. "Teaching a young person to code could be the single most life-changing skill you can give them. And it's not just a career-enhancer. Coding is about problem-solving, it's about creativity, and more importantly, it's about empowerment." + +2. [Kids can't code without computers][25]: Patrick Masson introduces the FLOSS Desktops for Kids program, which teaches students at underserved schools to repurpose older computers with open source software, such as Linux, LibreOffice, and GIMP. Not only is the program breathing new life into broken or decommissioned hardware, it's also giving students important skills that may translate into future careers. + +3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva offers suggestions for using [Scratch][27] to spark kids' interest in programming, just as LOGO did when he started using it in the 1980s. + +4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger describes App Inventor, a programming framework for building Android applications using a visual blocks language (similar to Scratch or [Snap][29]). + +Throughout the year we learned that there is an open solution to everything in education, and I expect this theme to continue in 2018 and beyond. Are there open education topics you'd like Opensource.com to cover in the coming year? If so, please share your ideas in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/best-open-education + +作者:[Don Watkins][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/don-watkins +[1]:https://opensource.com/article/17/7/book-review-open +[2]:https://opensource.com/article/17/8/jump-start-your-career +[3]:https://opensource.com/article/17/1/grad-school-open-source-academic-lab +[4]:https://opensource.com/article/17/7/open-school-leadership +[5]:https://opensource.com/article/17/7/empower-students-open-source-tools +[6]:https://opensource.com/article/17/3/interview-anh-bui-benetech-labs +[7]:https://opensource.com/article/17/1/Wiki-Education-Foundation +[8]:https://opensource.com/article/17/2/future-textbooks-cable-green-creative-commons +[9]:https://opensource.com/article/17/1/open-up-resources +[10]:https://opensource.com/article/17/2/interview-education-billy-meinke +[11]:https://opensource.com/article/17/7/college-alternatives +[12]:https://opensource.com/article/17/10/open-educational-resources-alexis-clifton +[13]:https://opensource.com/article/17/3/education-should-be-open-design +[14]:https://opensource.com/article/17/9/stop-link-rot-permacc +[15]:https://opensource.com/article/17/11/creating-open-textbooks +[16]:https://opensource.com/article/17/7/save-planet-board-game +[17]:https://opensource.com/article/17/4/phoenicia-education-software +[18]:https://opensource.com/article/17/8/8-open-source-android-apps-education +[19]:https://opensource.com/alternatives/matlab +[20]:https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam +[21]:https://opensource.com/article/17/5/how-linux-higher-education +[22]:https://opensource.com/article/17/6/open-source-tools-university-student +[23]:https://opensource.com/article/17/6/kde-education-software +[24]:https://opensource.com/article/17/8/teach-kid-code-change-life +[25]:https://opensource.com/article/17/9/floss-desktops-kids +[26]:https://opensource.com/article/17/3/logo-scratch-teach-programming-kids +[27]:https://scratch.mit.edu/ +[28]:https://opensource.com/article/17/8/app-inventor-android-app-development +[29]:http://snap.berkeley.edu/ +[30]:https://opensource.com/article/17/12/best-opensourcecom-linux-and-raspberry-pi-education diff --git a/translated/tech/20180101 27 open solutions to everything in education.md b/translated/tech/20180101 27 open solutions to everything in education.md deleted file mode 100644 index 898a4250ab..0000000000 --- a/translated/tech/20180101 27 open solutions to everything in education.md +++ /dev/null @@ -1,110 +0,0 @@ -27个解决教学问题的开放式方法 -====== -![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo) - -开放式理念 (从开源软件到开放硬件, 再到开放原则) 正在改变教育的范式。因此, 为了庆祝今年发生的一切, 我收集了2017年在 Opensource.com 上发表的27篇关于这个主题的最好的文章。我把它们分成明确的主题, 而不是按人气来分类。而且, 如果这27个故事不能满足你对教育公开信息的胃口, 那就看看我们的协同文章吧 " [education is leveraging Raspberry Pi and Linux][30]. - -### 开放对每个人都有好处 - -1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt 评价David Price 的书 'OPEN' ,该书探讨了 "开放" 不仅仅是技术转变的观点, 而是 "我们未来将如何工作、生活和学习"。 - -2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur 指出了如何利用开放式学习在工作群体中脱颖而出。 这个建议不仅仅是针对程序员的, 而是针对程序员的。设计师、作家、营销人员和其他创意专业人士也是开放式成功的关键。 - -3. [A graduate degree could springboard you into an open source job][3]: 引用的研究表明会 Linux 技能会带来更高的薪水, Joshua Pearce 说对开源的熟练和研究生学位是无与伦比的职业技能组合。 - -4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger 向我们展示了开放的做法是如何在宾夕法尼亚州的一个学区创造一种更具包容性、敏捷性和开放性的文化的。 Charlie 说, 这不仅仅是为了省钱;该区还受益于 "开放式领导原则, 促进师生创新, 帮助更好地吸引社区, 创造一个更有活力和包容性的学习社区"。 - -5. [15 ways to empower students with open source tools][5]: 我写开源是如何让学生自由探索、补拙和学习的, 不管他们是在学习基本的数字化素养, 还是通过有趣的项目来扩展这些技能。 - -6. [Developer opportunities to code for good][6]: 开源往往是对社会有益的项目的支柱。正如 Benetech Labs 副总裁 Ahn Bui 在这次采访中指出的那样: "建立开放数据标准是打破数据孤岛不可或缺的一步。这些开放标准将为互操作性提供基础, 进而转化为更多的组织共同建设, 往往更具成本效益。最终目标是以同样的成本甚至更低的成本为更多的人服务。 - -### 用于再混合和再利用的开放教育资源 - -1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis,Wiki Ed 的, 项目总监,讨论开放教育资源 (OERs) ,如 Wiki Ed,如何提供高质量且经济实惠的开源学习资源作为课堂教学工具。 - -2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green, Creative Common 开放教育主任,分享高等教育中教育面貌是如何变化的, 以及 Creative Common 正在采取哪些措施来促进教育。 - -3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites,Open Up Resources 的社区福音传教士和首席营销官, 谈论非营利组织努力为 K-12 学校提供开放的, 标准一致的课程。 - -4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke夏威夷大学马诺阿分校的教育技术专家,他说, 在大学课程中过渡到 ORE 将 "使教师能够控制他们教授的内容, 我们预计这将为他们节省学生的费用"。 - -5. [How open courses are slashing the cost of higher education][11]: Saylor Academy 的教育主任 Devon Ritter 报告了 Saylor 是如何建立以公开许可内容为基础的大学学分课程, 目的是使更多的人能够负担得起和获得高等教育。 - -6. [Open educational resources movement gains speed][12]: Alexis Clifton,State University of New York 的 OER 服务的执行主任, 描述了纽约800万美元的投资如何刺激开放教育的增长, 并使大学更实惠。 - -7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik 在Duke University 探索 OSPRI (Open Source Pedagogy Research and Innovation,开源教育学的研究与创新), 在 Duke 和 Red Hat 的联合合作这是建立一个21世纪的, preK-12 学习生态系统, 是开放的设计。 - -8. [Perma.cc stops scholarly link rot][14]: Virginia Tech 的 Phillip Young 写关于 Perma.cc, "link rot,"(链接失效) 的解决方案 很大可能在学术论文中的超链接随着时间的推移而消失或变化。 - -9. [Open education: How students save money by creating open textbooks][15]: OER 先驱 Robin DeRosa 谈到 "公开许可教科书引入的自由, 以及教育和学习应结合包容性生态系统, 以增强公益的总体理念"。 - -### 课堂上的开源工具 - -1. [How an open source board game is saving the planet][16]: Joshua Pearce 写关于拯救地球, 一个棋盘游戏, 使学生能够解决环境问题, 同时有乐趣, 并为制造商社区作出贡献。 - -2. [A new Android app for teaching kids how to read][17]: Michael Hall 谈到 Phoenicia,他在儿子被诊断为自闭症后开发的儿童识字应用, 为了产生更好的编码价值, 以及为什么用户测试比你想象的更重要。 - -3. [8 open source Android apps for education][18]: Joshua Allen Holm 通过推荐 F-Droid 存储库中的8个开源应用来尝试, 这将挑战我们将智能手机用作学习工具。 - -4. [3 open source alternatives to MATLAB][19]: Jason Baker's 更新了他2016年的开源数学计算软件调查, 提出了 MATLAB 的替代方案, 这是数学、物理科学、工程和经济学中几乎无处不在的昂贵的专有解决方案。 - -5. [What does SVG have to do with teaching kids to code?][20] 退休工程师 Jay Nick 谈论他如何使用艺术作为一种创造性的方式, 向学生介绍编码。他在学校做志愿者, 使用可缩放矢量图形 (SVG,Scalable Vector Graphics) 教授一种结合数学和艺术原理的编码方法。 - -6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, 在 Texas Tech 拥有美术博士学位 分享他在单一解决方案统治的世界中使用开源工具的经验。 Kyle 说有一种偏见, 反对在计算机科学以外的学科中使用开源:"很多人认为非技术专业的学生不能使用 Linux, 他们对在高级学位课程中使用 Linux 的人做出了很多假设。...嗯, 这是有可能的, 我就是证明。 - -7. [A list of open source tools for college][22]: Aaron Cocker 概述了他在攻读计算机科学本科学位时使用的开源工具 (包括演示、备份和编程软件)。 - -8. [5 great KDE apps to help you study][23]: Zsolt Szakács 提供五个 KDE 应用程序, 帮助任何想要学习新技能或培养现有技能的人。 - -### 在教室编码 - -1. [How to get the next generation coding early][24]: Bryson Payne 说我们需要教孩子们在高中前编码: 到了九年级, 80% 的女孩和60% 的男孩已经从 STEM 职业中自选。但他建议, 这不仅仅是就业和缩小 IT 技能差距的问题。"教一个年轻人编写代码可能是你能给他们的最改变生活的技能。而且这不仅仅是一个职业提升者。编码是关于解决问题, 它是关于创造力, 更重要的是, 它是关于授权。 - -2. [Kids can't code without computers][25]: Patrick Masson 推出了 FLOSS 儿童桌面计划, 该计划教授服务不足学校的学生使用开源软件 (如 Linux、LibreOffice 和 GIMP) 重新设计较旧的计算机。该计划不仅为破碎或退役的硬件注入新的生命, 还为学生提供了重要的技能, 这些技能可能会转化为未来的职业。 - -3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva 提供 [Scratch][27] 的使用建议激发孩子们对编程的兴趣, 就像 LOGO 在20世纪80年代开始使用它时一样。 - -4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger 描述应用发明者, 一个编程框架, 用于构建 Android 应用程序使用可视块语言 (类似 Scratch 或者[Snap][29]). - -在这一年里, 我们了解到, 教育领域的一切都有一个开放的解决方案, 我预计这一主题将在2018年及以后继续下去。在未来的一年里, 你是否希望 Opensource.com 涵盖开放的教育主题?如果是, 请在评论中分享你的想法。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/best-open-education - -作者:[Don Watkins][a] -译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/don-watkins -[1]:https://opensource.com/article/17/7/book-review-open -[2]:https://opensource.com/article/17/8/jump-start-your-career -[3]:https://opensource.com/article/17/1/grad-school-open-source-academic-lab -[4]:https://opensource.com/article/17/7/open-school-leadership -[5]:https://opensource.com/article/17/7/empower-students-open-source-tools -[6]:https://opensource.com/article/17/3/interview-anh-bui-benetech-labs -[7]:https://opensource.com/article/17/1/Wiki-Education-Foundation -[8]:https://opensource.com/article/17/2/future-textbooks-cable-green-creative-commons -[9]:https://opensource.com/article/17/1/open-up-resources -[10]:https://opensource.com/article/17/2/interview-education-billy-meinke -[11]:https://opensource.com/article/17/7/college-alternatives -[12]:https://opensource.com/article/17/10/open-educational-resources-alexis-clifton -[13]:https://opensource.com/article/17/3/education-should-be-open-design -[14]:https://opensource.com/article/17/9/stop-link-rot-permacc -[15]:https://opensource.com/article/17/11/creating-open-textbooks -[16]:https://opensource.com/article/17/7/save-planet-board-game -[17]:https://opensource.com/article/17/4/phoenicia-education-software -[18]:https://opensource.com/article/17/8/8-open-source-android-apps-education -[19]:https://opensource.com/alternatives/matlab -[20]:https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam -[21]:https://opensource.com/article/17/5/how-linux-higher-education -[22]:https://opensource.com/article/17/6/open-source-tools-university-student -[23]:https://opensource.com/article/17/6/kde-education-software -[24]:https://opensource.com/article/17/8/teach-kid-code-change-life -[25]:https://opensource.com/article/17/9/floss-desktops-kids -[26]:https://opensource.com/article/17/3/logo-scratch-teach-programming-kids -[27]:https://scratch.mit.edu/ -[28]:https://opensource.com/article/17/8/app-inventor-android-app-development -[29]:http://snap.berkeley.edu/ From 6602c304cc871ab4fe6dc569686f2a8f1afaccf6 Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Wed, 19 Dec 2018 11:01:39 +0800 Subject: [PATCH 0182/4278] correct --- ... - Notmuch, mbsync, postfix and dovecot.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md b/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md index ffbf6d11a7..0edd75e2bd 100644 --- a/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md +++ b/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md @@ -1,12 +1,12 @@ 我的个人电子邮件系统 - Notmuch, mbsync, postfix and dovecot ====== -我使用个人电子邮件系统已经相当长的时间了, 没有文字记录。最近当我换了我的笔记本电脑(职业变更做的变动)我在试图重新创建本地邮件设置时迷路了。所以这篇文章是一个自我文档, 这样我就不用再挣扎了就能改正过来。 +我使用个人电子邮件系统已经相当长的时间了, 没有文字记录。最近当我换了我的笔记本电脑(职业变更做的变动)我在试图重新创建本地邮件设置时迷茫了。所以这篇文章是一个自己的文档, 这样我就不用费劲就能修正过来。 ### 服务器端 我运行自己的邮件服务器, 并使用 Postfix 作为 SMTP 服务器和用 Dovecot 实现 IMAP 。我不打算详细介绍如何配置这些设置, 因为我的设置主要是通过使用 Jonas 为 Redpill 基础架构创建的脚本完成的。什么是 Redpill ?(用 Jonas 自己的话说) -> Redpill 是一个概念 - 一种设置 Debian hosts 去跨组织协作的方式 我发展了这个概念, 并将其首次使用 Redpill 去联网 redpill.dk, 涉及我自己的网络 (jones.dk), 我的主要客户的网络 (homebase.dk),在德国的一个网络, 包括Skolelinux Germany (free-owl.de), 和 Vasudev 的网络 (copyninja.info) +> Redpill 是一个概念 - 一种设置 Debian hosts 去跨组织协作的方式 我延申了这个概念, 并将其首次使用 Redpill 去联网 redpill.dk, 涉及我自己的网络 (jones.dk), 我的主要客户的网络 (homebase.dk),在德国的一个网络, 包括Skolelinux Germany (free-owl.de), 和 Vasudev 的网络 (copyninja.info) 除此之外, 我还有一个 dovecot sieve 过滤, 根据邮件的来源, 对高级邮件进行分类, 并将其分类到各种文件夹中。所有的规则都存在于每个有邮件地址的账户下的 ~/dovecot.sieve文件中。 @@ -25,9 +25,9 @@ ### 邮件同步 -邮件同步是使用 mbsync 工具完成的, 我以前是离线的用户, 最近切换到 mbsync, 因为我觉得它比 OfflineIMAP 的配置更轻, 更简单。命令是由包 isync 提供的。 +邮件同步是使用 mbsync 工具完成的, 我以前是 OfflineIMAP 的用户, 最近切换到 mbsync, 因为我觉得它比 OfflineIMAP 的配置更轻, 更简单。命令是由包 isync 提供的。 -配置文件是 ~/.mbsyncrc. 下面是我的例子与一些私人设置。 +配置文件是 ~/.mbsyncrc. 下面是我的例子与一些个人设置。 ``` IMAPAccount copyninja @@ -79,7 +79,7 @@ SyncState * Sync All ``` -对上述配置中的一些有趣部分进行说明。一个是 PassCmd , 它允许您提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我使用对称加密与 gpg 和存储密码在我的磁盘上的一些地方。这当然是由 Unix ACL 保护安全。 +对上述配置中的一些有趣部分进行说明。一个是 PassCmd , 它允许您提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我在我磁盘上的一些地方使用对称加密 gpg 和存储密码。这当然是由 Unix ACL 保护安全。 实际上, 我想使用我的公钥加密文件, 但当脚本在后台或通过 systemd 运行时, 解锁文件看起来很困难 (或看起来几乎不可能)。如果你有更好的建议, 我洗耳恭听:-)。 @@ -87,9 +87,9 @@ Sync All ### 邮件分类 -一旦邮件在您本地的设备, 我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步 Maildir, 并在 Gnus 中阅读。这种设置是有点大题小作相比于设置所有服务器软件, 但 Gnus 无法很好地应付 maildir 格式, 这是最好的方法。这个设置也有一个缺点, 那就是在你有大量邮件要看的时候快速搜索邮件。这是为数不多的情况。 +一旦邮件在您本地的设备, 我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步 Maildir, 并在 Gnus 中阅读。这种设置相比于设置所有服务器软件是有点大题小作, 但 Gnus 无法很好地应付 maildir 格式, 这是最好的方法。这个设置也有一个缺点, 那就是在你有大量邮件要看的时候快速搜索邮件。这是为数不多的情况。 -不多让我很容易索引通过千兆字节的邮件档案, 并很容易得到我需要的东西。我已经创建了一个小脚本, 它结合了执行 mbsync 和 notmuch 执行语句。我基于 Maildirs 标记邮件, 实际上是创建在服务器端使用 dovecot sieve 。下面是我的完整 shell 脚本, 它正在执行同步分类和删除垃圾邮件的任务。 +不多的情况下我想很容易索引通过千兆字节的邮件档案, 并得到我需要的东西。我已经创建了一个小脚本, 它结合了执行 mbsync 和 notmuch 执行语句。我基于 Maildirs 标记邮件, 实际上是创建在服务器端使用 dovecot sieve 。下面是我的完整 shell 脚本, 它正在执行同步分类和删除垃圾邮件的任务。 ``` #!/bin/sh @@ -135,15 +135,15 @@ done ### 阅读邮件 -现在, 我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格, 所以我花了一些时间写下一个私有层, 它将我所有的快捷键和分类集中在一个地方, 不会扰乱我的整个. spacemacs 文件。您可以在 [notmuch-emacs-layer repository][1] 找到我私有层的代码。 +现在, 我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格, 所以我花了一些时间写下一个私有层(private layer), 它将我所有的快捷键和分类集中在一个地方, 不会扰乱我的整个. spacemacs 文件。您可以在 [notmuch-emacs-layer repository][1] 找到我私有层的代码。 ### 发送邮件 -如果我们能阅读邮件, 我们就需要能够回复邮件, 这还不够。而这是我最近迷惑的一个略显棘手的部分, 不得不写这篇文章, 这样我就不会再忘记了。(当然也不必在网络上引用一些过时的帖子)。 +如果我们能阅读邮件, 我们就需要能够回复邮件, 这还不够。而这是最近是我感到迷茫的一个略显棘手的部分, 不得不写这篇文章, 这样我就不会再忘记了。(当然也不必在网络上引用一些过时的帖子)。 我的设置发送邮件使用 postfix 作为 SMTP 客户端与我自己的 SMTP 服务器作为它的转接主机。转接的问题是, 它不是具有动态 IP 的主机。有几种方法可以允许具有动态 ip 的主机使用转接服务器, 一种是将邮件从其中发源于 my_network 或第二个使用 SASL 身份验证的 IP 地址。 -我的首选方法是使用 SASL 身份验证。为此, 我首先要为每台机器创建一个单独的账户, 它将把邮件传递到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主要账户, 但 Jonas 给出了每个可行账户的想法 +我的首选方法是使用 SASL 身份验证。为此, 我首先要为每台机器创建一个单独的账户, 它将把邮件传递到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主要账户, 但 Jonas 给出了每个可行账户的想法) ``` adduser _relay @@ -167,16 +167,16 @@ smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd ``` -替换 smtp.example.com 用你的 SMTP 服务器名称, 您已输入的 relayhost 认证。 用您创建的用户及其密码替换 user with _relay 。 + 用你的 SMTP 服务器名称替换 smtp.example.com ,您已输入的 relayhost 认证。 用您创建的用户及其密码替换 user with _relay 。 -若要保护 sasl_passwd 文件, 并创建它的哈希值进行 postfix 使用以下命令。 +若要保护 sasl_passwd 文件, 并创建它的 hash(哈希) 进行 postfix 使用以下命令。 ``` chown root:root /etc/postfix/sasl_passwd chmod 0600 /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd ``` -最后的命令将创建 /etc/postfix/sasl_passwd.db 文件是您的文件的哈希值 /etc/postfix/sasl_passwd 具有相同的所有者和权限。现在重新加载 postfix, 并检查邮件是否使用邮件命令从您的系统中取出。 +最后的命令将创建 /etc/postfix/sasl_passwd.db 文件是您的文件的 hash /etc/postfix/sasl_passwd 具有相同的所有者和权限。现在重新加载 postfix, 并检查邮件是否使用邮件命令从您的系统中取出。 ### Bonus 的部分 @@ -212,14 +212,14 @@ StandardOutput=syslog StandardError=syslog ``` -将这些文件置于 /etc/systemd/user 目录下并运行以下代码去开启他们 +将这些文件置于 /etc/systemd/user 目录下并运行以下代码去开启它们 ``` systemctl enable --user mailsync.timer systemctl enable --user mailsync.service systemctl start --user mailsync.timer ``` -这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew 他同时阅读了这篇帖子。因此, 下一步, 我将尝试使用 afew 改进我的 notmuch 配置, 当然还会有一个后续的帖子:-)。 +这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew ,他同时阅读了这篇帖子。因此, 下一步, 我将尝试使用 afew 改进我的 notmuch 配置, 当然还会有一个后续的帖子:-)。 -------------------------------------------------------------------------------- From 2132fc3343ac37a09ecbbb1deaac05790124f4d8 Mon Sep 17 00:00:00 2001 From: jlztan Date: Wed, 19 Dec 2018 11:16:42 +0800 Subject: [PATCH 0183/4278] =?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 --- ...23 Celebrate Christmas In Linux Way With These Wallpapers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/sources/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md index e59286ddbc..94c08d72ae 100644 --- a/sources/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md +++ b/sources/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (jlztan) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Celebrate Christmas In Linux Way With These Wallpapers) From 5b9c7454137a8a6639bad8a9dad3f08eac8f530d Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 19 Dec 2018 13:40:24 +0800 Subject: [PATCH 0184/4278] Translating How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index b0f0751d81..00864bffa9 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -49,31 +49,31 @@ sudo apt upgrade #### 说明:sudo apt update -This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. +这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会更新而你的系统将不会知道是否又可用的新版本。 -This is why when you run the sudo apt update, you’ll see lots of URLs in the output. The command fetches the package information from the respective repositories (the URLs you see in the output). +这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。 -![Updating Ubuntu Linux][5] +![更新 Ubuntu Linux][5] -At the end of the command, it tells you how many packages can be upgraded. You can see these packages by running the following command: +在命令的末尾,它告诉你有多少个软件包可以被更新。你可以使用下列命令查看这些软件包: ``` apt list --upgradable ``` -**Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. +**补充阅读:** 阅读这篇文章了解[命令 `apt update` 的输出中的 Ign,Hit 和 Get 是什么][6]。 #### 说明:sudo apt upgrade -This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). +这条命令将已安装的软件包版本与本地数据库进行匹配。它收集全部信息,然后列出所有具有更新版本的软件包。此时,它会询问您是否要升级(已安装的软件包更新到新版本)。 -![Update Ubuntu Linux via Command Line][7] +![通过命令行更新 Ubuntu Linux][7] -You can type ‘yes’, ‘y’ or just press enter to confirm the installation of updates. +你可以键入 `yes`,`y` 或者只敲回车键去确认安装这些更新。 -So the bottom line is that the sudo apt update checks for the availability of new versions while as the sudo apt upgrade actually performs the update. +所以总的来说,`sudo apt update` 会检查可用的新版本,而 `sudo apt upgrade` 实际上会执行更新。 -The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. +命令 `update` 可能会令人困惑,因为你可能期望通过命令 `apt update` 安装更新来更新系统,但这并不会发生。 ### 通过 GUI 更新 Ubuntu[适用于桌面用户] From 7b7ec40b94c86f3bef61a01487c87cee78f90a70 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 19 Dec 2018 15:12:29 +0800 Subject: [PATCH 0185/4278] PRF:20171111 A CEOs Guide to Emacs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 部分 --- .../tech/20171111 A CEOs Guide to Emacs.md | 69 ++++++++++--------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index 6d14ad7a8e..9ddbab89d2 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -13,7 +13,7 @@ 这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。它的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 -如果通过编辑 Lisp 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32]Pointy-Haired Bosses(PHB[^1] )(以及,其它好奇的人)的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 +如果通过编辑 Lisp 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 公司的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32]Pointy-Haired Bosses(PHB[^1] )(以及,其它好奇的人)的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 ### 恒久优势 @@ -27,48 +27,49 @@ Org 模式本身就值得花时间,但如果你像我一样,你通常要处 #### 在安静中创造事情 -拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?拥有 `Lisp` 键盘的全部功能?这就是我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 +拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?发挥了 Lisp 键盘的全部威力了吗?我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 -我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等保存在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序努力提供帮助并使其易于使用。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比其 office 应用程序,我更讨厌在线版的应用程序。 +我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 应用程序,我更讨厌其在线版。 -![1933 steel bicycle](https://blog.fugue.co/assets/images/desktop.jpg) -我的桌面布局, Emacs 在左边 +![](https://www.fugue.co/hubfs/Imported_Blog_Media/desktop-1.jpg) -但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间时,我的效率会更高。在 `Fugue` 中使用了 `Slack`,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。仅仅是风投或董事会董事的一次懈怠,或一封电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 +*我的桌面布局, Emacs 在左边* -#### 带上一切,并保留着 +但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间段时,我的效率会更高。我们 Fugue 公司使用 Slack,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。只要一个 Slackstorm 或一封风投或董事会董事的电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 -第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 `Dropbox` 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何地方,任何环境下工作了,因为你已经精心制作了适合目的套件了。我在 OS X,Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理页面、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 +#### 包罗万象,永久长青 -永久存储在计算机上的限制是文件格式。假设人类已经解决了存储[^6] 的问题,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最持久的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于办公应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 +第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 Dropbox 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何你已经精心打造了适合你的目的的套件的环境中工作了。我在 OS X、Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理 Pages、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 + +限制在计算机上永久存储的因素是文件格式。假设人类已经解决了存储问题[^6] ,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最长青的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于 Office 应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 如果你准备尝试 Emacs,请继续阅读!下面的部分不会取代完整的教程,但是在完成阅读时,就可以操作了。 ### 学会驾驭 Emacs —— 一个专业的配置 -所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像现代世界已经过去了。这有点像你只开过车,却要你去学骑自行车[^7] 。 +所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像穿越到过去。这有点像你只开过车,却要你去学骑自行车[^7] 。 #### 该选哪个 Emacs -我用的是 GNU 中 OS X 和 Windows 的通用版本的 Emacs。你可以在 [][34][http://emacsformacos.com/][35] 获取 OS X 版本,在[][36][http://www.gnu.org/software/emacs/][37]获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(包括 `Lisp` 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[^8] ! +我用的是来自 GNU 的 OS X 和 Windows 的通用版本的 Emacs。你可以在 [http://emacsformacos.com/][35] 获取 OS X 版本,在 [http://www.gnu.org/software/emacs/][37] 获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(涉及到 Lisp 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[^8] ! -#### 首先,学会浏览 +#### 首先,学会导航 -在本文中,我将约定 Emacs 中的键和组合。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组快捷键会指向一个教程,这是你首先要做的一件事。 +在本文中,我将使用 Emacs 的按键和组合键约定。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组合快捷键会指向一个教程,这是你首先要做的一件事。 -不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以您不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后移动一个单词。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向前多少个单词或向上或线下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其他真正重要的浏览命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中的[希伯列][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 +不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生的导航命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。这个 Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以您不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后在单词间移动。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向后移动多少个单词或向上或向下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其它真正重要的导航命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中一个过时的[观点][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 -Emacs 附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 +Emacs 所附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 #### 学会复制和粘贴 -你可以叫 Emacs 设为 `CUA` 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 这样的浏览命令来标记区域(如选择)。所以 `C-F` 是选中管标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除和召回,但它非常类似于剪切和粘贴。在删除的环中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你在这开始摸索, `C-x u` 是撤销。 +你可以把 Emacs 设为 CUA 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 和导航命令来标记区域(如同选择)。所以 `C-F` 是选中光标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除killing召回yanking,但它非常类似于剪切和粘贴。在删除中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你开始尝试了,那么 `C-x u` 是撤销。 -#### 下一步,学会用 `Ido` 模式 +#### 下一步,学会用 Ido 模式 -相信我,`Ido` 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独分开的查找或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 `Ido` 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 `Ido` 是 Emacs 的 22 版时开发出来的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 +相信我,Ido 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独的访达或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 Ido 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 Ido 是 Emacs 的 22 版时开始出现的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 -Emacs 中的大多数功能都表现在模式上。要安装制定的模式,需要做两件事。嗯,一开始你需要做一些额外的事情,但这些只需要做一次,然后再做这两件事。那么,额外的事情是你需要一个单独的位置来放置所有 `Emacs Lisp` 文件,并且你需要告诉 Emacs 这个位置在哪。我建议你在 Dropbox 上创建一个单独的目录,那是你 Emacs 主目录。在这里,你需要创建一个 `.emacs` 文件和 `.emacs.d` 目录。在 `.emacs.d` 目录下,创建一个 `lisp` 的目录。就像这样: +Emacs 中的大多数功能都表现在模式上。要安装指定的模式,需要做两件事。嗯,一开始你需要做一些额外的事情,但这些只需要做一次,然后再做这两件事。那么,这件额外的事情是你需要一个单独的位置来放置所有 Emacs Lisp 文件,并且你需要告诉 Emacs 这个位置在哪。我建议你在 Dropbox 上创建一个单独的目录,那是你 Emacs 主目录。在这里,你需要创建一个 `.emacs` 文件和 `.emacs.d` 目录。在 `.emacs.d` 目录下,创建一个 `lisp` 的目录。就像这样: ``` home @@ -80,21 +81,23 @@ home -lisp ``` -你可以将那些像模式的 `.el` 文件放到 `home/.emacs.d/lis` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: +你可以将那些比如模式的 `.el` 文件放到 `home/.emacs.d/lisp` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: -`(add-to-list 'load-path "~/.emacs.d/lisp/")` +``` +(add-to-list 'load-path "~/.emacs.d/lisp/") +``` -`Ido` 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. +Ido 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放这个 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. #### 符号链接是你的好伙伴 -等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把他们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并链接到 `.emacs` 和 `.emacs.d`,以及主目录 `~`。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的一部分了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件家的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 +等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把它们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并做符号链接到 `~` 下的 `.emacs` 、`.emacs.d` 和你的主要存放文档的目录。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的地方了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件夹的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 -至此,你已经完成了在任意机器上指向 Emacs 配置和配置文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就得到了你的整个工作环境。第一次做这个似乎有点困难,但是一旦你知道你在做什么,就只需要10分钟(最多)。 +至此,你已经完成了在任意机器上指向你的 Emacs 配置和文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就可以得到你的整个工作环境。第一次做这个似乎有点困难,但是一旦你知道你在做什么,就(最多)只需要 10 分钟。 -但我们现在是在配置 `Ido`…… +但我们现在是在配置 Ido …… -按下 `C-x` `C-f` 然后输入 `~/.emacs RET RET` 来创建 `.emacs` 文件,将下面几行添加进去: +按下 `C-x` `C-f` 然后输入 `~/.emacs` 和两次回车来创建 `.emacs` 文件,将下面几行添加进去: ``` ;; set up ido mode @@ -104,15 +107,19 @@ home (ido-mode 1) ``` -在 `.emacs` 窗口开着的时候,执行 `M-x evaluate-buffer` 命令。如果某处弄错了的话,将得到一个错误,或者你将得到 `Ido`。`Ido` 改变了在 `minibuffer` 中操作文件操方式。有一篇比较好的文档,但是我也会指出一些技巧。有效地使用 `~/`;你可以在 `minibuffer` 的任何地方输入 `~/`,它就会跳转到主目录。这就意味着,你应该让你的大部分东西就近的放在主目录下。我用 `~/org` 目录来保存所有非代码的东西,用 `~/code` 保存代码。一旦你进入到正确的目录,通常会拥有一组具有不同扩展名的文件,特别是当你使用 `Org` 模式并从中发布的话。你可以输入 `period` 和想要的扩展名,无论你的在文件名的什么位置,`Ido` 都会将选择限制在具有该扩展名的文件中。例如,我在 `Org` 模式下写这篇博客,所以该文件是: +在 `.emacs` 窗口开着的时候,执行 `M-x evaluate-buffer` 命令。如果某处弄错了的话,将得到一个错误,或者你将得到 Ido。Ido 改变了在 minibuffer 中操作文件操方式。关于这个有一篇比较好的文档,但是我也会指出一些技巧。有效地使用 `~/`;你可以在 minibuffer 的任何地方输入 `~/`,它就会跳转到主目录。这就意味着,你应该让你的大部分东西就近的放在主目录下。我用 `~/org` 目录来保存所有非代码的东西,用 `~/code` 保存代码。一旦你进入到正确的目录,通常会拥有一组具有不同扩展名的文件,特别是当你使用 Org 模式并从中发布的话。你可以输入 `.` 和想要的扩展名,无论你的在文件名的什么位置,Ido 都会将选择限制在具有该扩展名的文件中。例如,我在 Org 模式下写这篇博客,所以该文件是: -`~/org/blog/emacs.org` +``` +~/org/blog/emacs.org +``` -我偶尔也会用 `Org` 模式发布成 HTML 格式,所以我将在同一目录下得到 `emacs.html` 文件。当我想打开 `Org` 文件时,我会输入: +我偶尔也会用 Org 模式发布成 HTML 格式,所以我将在同一目录下得到 `emacs.html` 文件。当我想打开该 Org 文件时,我会输入: -`C-x C-f ~/o[RET]/bl[RET].or[RET]` +``` +C-x C-f ~/o[RET]/bl[RET].or[RET] +``` -其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开查找或文件资源管理器再用鼠标点要节省 _很_ 多时间。 `Ido` 模式很有用, 这真的是操作 Emacs 的一种实用的模式。下面让我们去探索一些其他对完成工作很有帮助的模式吧。 +其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开访达或文件资源管理器再用鼠标点要节省 _很_ 多时间。 Ido 模式很有用,而这只是操作 Emacs 的一种实用模式而已。下面让我们去探索一些其它对完成工作很有帮助的模式吧。 #### 字体及风格 From 1704626c5ecb804fae391bf0dc8aa6c46dc7f9f4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 19 Dec 2018 15:45:26 +0800 Subject: [PATCH 0186/4278] PRF:20180911 Know Your Storage- Block, File - Object.md @qhwdw --- ...Know Your Storage- Block, File - Object.md | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/translated/tech/20180911 Know Your Storage- Block, File - Object.md b/translated/tech/20180911 Know Your Storage- Block, File - Object.md index 3dc77ad8e3..01f4cb4b15 100644 --- a/translated/tech/20180911 Know Your Storage- Block, File - Object.md +++ b/translated/tech/20180911 Know Your Storage- Block, File - Object.md @@ -1,43 +1,44 @@ 认识存储:块、文件和对象 ====== +> 今天产生的大量数据带来了新的存储挑战。在本文中了解各种存储类型以及它们的使用方式。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/block2_1920.jpg?itok=s1y6RLhT) -现在,对于那些创建或消费数据的公司来说,处理生成的数量巨大的数据是个非常大的挑战。而对于那些解决存储相关问题的科技公司来说,也是一个挑战。 +现在,对于那些创建或消费数据的公司来说,处理数量巨大的生成数据是个非常大的挑战。而对于那些解决存储相关问题的科技公司来说,也是一个挑战。 - Red Hat 存储首席产品营销经理 Michael St. Jean 说,“数据每年呈几何级增长,而我们发现数据大量增长的主要原因是由于消费增长和为拓展价值而进行的产业转型,毫无疑问,物联网对数据增长的贡献很大,但对软件定义存储来说最重要的挑战是,如何处理用户场景相关的数据增长。“ +Red Hat 存储首席产品营销经理 Michael St. Jean 说,“数据每年呈几何级增长,而我们发现数据大量增长的主要原因是由于消费增长和为拓展价值而进行的产业转型,毫无疑问,物联网对数据增长的贡献很大,但对软件定义存储来说最重要的挑战是,如何处理用户场景相关的数据增长。“ -任何挑战都意味着机遇。Azure 存储、介质和边缘总经理 Tad Brockway 说,“今天,新旧数据源产生的海量数据为我们满足客户在规模、性能、灵活性、治理方面急剧增长的需求提供了一个机遇。” +任何挑战都意味着机遇。Azure 存储、介质和边缘计算总经理 Tad Brockway 说,“今天,新旧数据源产生的海量数据为我们满足客户在规模、性能、灵活性、治理方面急剧增长的需求提供了一个机遇。” ### 现代软件定义存储的三种类型 -这里有三个不同类型的存储解决方案 — 块、文件、和对象 — 虽然它们每个都可以与其它的共同工作,但它们每个都有不同的用途。 +这里有三个不同类型的存储解决方案 —— 块、文件、和对象 —— 虽然它们每个都可以与其它的共同工作,但它们每个都有不同的用途。 -块存储是数据存储的最古老形式,数据都存储在固定长度的块或多个块中。块存储适用于企业存储环境,并且通常使用光纤通道或 iSCSI 接口。根据 SUSE 软件定义存储高级产品经理 Larry Morris 的说法,“块存储要求一个应用去映射存储设备上存储数据块的位置”。 +块存储是数据存储的最古老形式,数据都存储在固定长度的块或多个块中。块存储适用于企业存储环境,并且通常使用光纤通道或 iSCSI 接口。根据 SUSE 的软件定义存储高级产品经理 Larry Morris 的说法,“块存储要求一个应用去映射存储设备上存储数据块的位置。” -块存储在存储区域网和软件定义存储系统中是虚拟的,它是处于一个共享的硬件基础设施上的抽象逻辑设备,它创建和存在于服务器、虚拟服务器、或运行在基于像 SCSI、SATA、SAS、FCP、FCoE、或 iSCSI 这样的协议的系统管理程序上。 +块存储在存储区域网和软件定义存储系统中是虚拟的,它是处于一个共享的硬件基础设施上的抽象逻辑设备,其创建和存在于服务器、虚拟服务器、或运行在基于像 SCSI、SATA、SAS、FCP、FCoE、或 iSCSI 这样的协议的系统管理程序上。 -St. Jean 说“块存储将单个的存储卷(像一个虚拟或云存储节点、或一个老式硬盘)分割成单独的被称为块的实体。“ +St. Jean 说“块存储将单个的存储卷(如一个虚拟或云存储节点、或一个老式硬盘)分割成单独的被称为块的实体。” -每个块独立存在,并且能够用它自己的数据传输协议和操作系统格式化 — 给用户完全的配置自主权。由于块存储系统并不负责像文件存储系统那样的文件查找职责,所以,块存储是一个非常快的存储系统。由于同时具备速度和配置灵活性,使得块存储非常适合原始服务器存储或富媒体数据库。 +每个块独立存在,并且能够用它自己的数据传输协议和操作系统格式化 —— 给用户完全的配置自主权。由于块存储系统并不负责像文件存储系统那样的文件查找职责,所以,块存储是一个非常快的存储系统。由于同时具备速度和配置灵活性,使得块存储非常适合原始服务器存储或富媒体数据库。 -块存储适合于宿主机操作系统、应用程序、数据库、完整虚拟机和容器。传统上,块存储仅能够被独立的机器、或集群中呈现出的机器访问。 +块存储适合于宿主机操作系统、应用程序、数据库、完整虚拟机和容器。传统上,块存储仅能够被独立的机器访问,或呈现给集群中的机器访问。 ### 基于文件的存储 -基于文件的存储使用一个文件系统去映射存储设备上数据的存储位置。这种技术在直接或网络附加存储系统应用领域中处于支配地位。它需要做两件事情:组织数据并呈现给用户。 St. Jean 说,”使用文件存储时,数据在服务器侧的排列格式与客户端用户所看到的是完全相同的。这就允许用户通过一些唯一标识符(像文件名、位置、或 URL)去请求一个文件,使用特定的数据传输协议与存储系统沟通。 +基于文件的存储使用一个文件系统去映射存储设备上数据的存储位置。这种技术在直连或网络附加存储系统应用领域中处于支配地位。它需要做两件事情:组织数据并呈现给用户。St. Jean 说,”使用文件存储时,数据在服务器侧的存储方式与客户端用户所看到的是完全相同的。这就允许用户通过一些唯一标识符(像文件名、位置、或 URL)去请求一个文件,使用特定的数据传输协议与存储系统沟通。 -最终成为了一种能够从上到下进行浏览的分层的文件结构。文件存储处于块存储之上,允许用户去查看和访问文件、文件夹这样的数据,但是限制访问处于这些文件和文件夹之下的数据块。 +其结果就是一种能够从上到下进行浏览的分层的文件结构。文件存储处于块存储之上,允许用户去查看和访问文件、文件夹这样的数据,但是被限制访问处于这些文件和文件夹之下的数据块。 -Brockway 解释说,“文件存储一般用于像 NFS 和 CIFS/SMB 这种很多服务器基于 IP 网络进行访问的共享文件系统上。访问控制通过用户和组的权限实现在文件、目录、和导出级别上。基于文件的存储可用于被多个用户和机器、二进制应用程序、数据库、虚拟机所需要的文件的存储上,以及容器上。“ +Brockway 解释说,“文件存储一般用于像 NFS 和 CIFS/SMB 这种很多服务器基于 IP 网络进行访问的共享文件系统上。访问控制通过用户和组的权限实现在文件、目录和导出级别上。基于文件的存储可用于被多个用户和机器、二进制应用程序、数据库、虚拟机所需要的文件的存储上,以及容器上。“ ### 对象存储 -对象存储是最新的数据存储形式,它为非结构化数据提供一个库,它将内容从索引中分离出来,并允许多个文件连接到一个对象上。一个对象就是与任何相关元数据配对的一个数据块,这些元数据提供对象中包含的字节的上下文(比如数据创建时间和数据大小等)。也就是说这两样东西 — 数据和元数据 — 构成了一个对象。 +对象存储是最新的数据存储形式,它为非结构化数据提供一个仓库,它将内容从索引中分离出来,并允许多个文件连接到一个对象上。一个对象就是与任何相关元数据配对的一个数据块,这些元数据提供对象中包含的字节的上下文(比如数据创建时间和数据大小等)。也就是说这两样东西 —— 数据和元数据 —— 构成了一个对象。 对象存储的一个好处是每个数据块都关联了一个唯一标识符。访问数据需要唯一标识符,并且不需要应用程序或用户知道数据的真实存储位置。对象数据是通过 API 来访问的。 -St. Jean 说,“对象中存储的数据是没有压缩和加密的,对象本身被安排在对象存储(一个填满其它对象的中心库)中或容器(包含应用程序运行所需要的所有文件的一个包)中。与文件存储系统的层次结构相比,对象、对象存储和容器在本质上是平面的 — 这使得它们在存储规模巨大时访问速度很快。” +St. Jean 说,“对象中存储的数据是没有压缩和加密的,对象本身被组织在对象存储(一个填满其它对象的中心库)中或容器(包含应用程序运行所需要的所有文件的一个包)中。与文件存储系统的层次结构相比,对象、对象存储和容器在本质上是平面的 —— 这使得它们在存储规模巨大时访问速度很快。” 对象存储可以扩展到很多 PB 字节大小,以适应巨大的数据集,因此它是图像、音频、视频、日志、备份、和分析服务所使用的数据存储的最佳选择。 @@ -52,7 +53,7 @@ via: https://www.linux.com/blog/2018/9/know-your-storage-block-file-object 作者:[Swapnil Bhartiya][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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 87d11f5ea0d30a91101f01eac2fd6a79208a2f16 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 19 Dec 2018 15:46:05 +0800 Subject: [PATCH 0187/4278] PUB:20180911 Know Your Storage- Block, File - Object.md @qhwdw https://linux.cn/article-10364-1.html --- .../20180911 Know Your Storage- Block, File - Object.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180911 Know Your Storage- Block, File - Object.md (100%) diff --git a/translated/tech/20180911 Know Your Storage- Block, File - Object.md b/published/20180911 Know Your Storage- Block, File - Object.md similarity index 100% rename from translated/tech/20180911 Know Your Storage- Block, File - Object.md rename to published/20180911 Know Your Storage- Block, File - Object.md From 3bdd047664f41dbda43491fc6efafb06ddea3914 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 19 Dec 2018 17:52:06 +0800 Subject: [PATCH 0188/4278] PRF:20181130 SMPlayer in Linux- Features, Download and Installation.md @geekpi --- ...ux- Features, Download and Installation.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md b/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md index be826fc446..1e0147ac10 100644 --- a/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md +++ b/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md @@ -1,29 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (SMPlayer in Linux: Features, Download and Installation) [#]: via: (https://itsfoss.com/smplayer/) [#]: author: (Aquil Roshan;Abhishek Prakash https://itsfoss.com/author/aquil/) [#]: url: ( ) -Linux 中的 SMPlayer:功能,下载和安装 +SMPlayer:增强版的媒体播放器 ====== 当你要播放视频时,你会在[全新安装的 Ubuntu][1],或其他许多发行版中,会注意到一个消息: ![][2] -默认媒体播放器没有适合的编解码器 -这意味着系统上没有安装播放媒体的[所需编解码器][3]。现在,由于某些版权问题,某些基于 Linux 的操作系统无法在安装介质中预先打包编解码器。但是它们能让你只需点击即可下载和安装编解码器,或者你可以安装拥有所有媒体编解码器的媒体播放器。了解一下 [SMPlayer][4]。 +*默认媒体播放器没有适合的编解码器* + +这意味着系统上没有安装播放媒体的[所需编解码器][3]。现在,由于某些版权问题,某些基于 Linux 的操作系统无法在安装介质中预先打包编解码器。但是它们能让你只需点击即可下载和安装编解码器,或者你可以安装拥有所有媒体编解码器的媒体播放器。让我们了解一下 [SMPlayer][4]。 ### 认识 SMPlayer:适用于 Linux 的更好的媒体播放器 -SMPlayer 是一款免费的开源媒体播放器,它基于强大的 [MPlayer][5] 媒体引擎。SMPlayer 能够播放 avi、mp4、mkv、mpeg、mov、divx、h.264 以及其他任何主要媒体格式。锦上添花的是,它也可以播放 [YouTube][6] 视频,并且无广告。 +SMPlayer 是一款自由开源媒体播放器,它基于强大的 [MPlayer][5] 媒体引擎。SMPlayer 能够播放 avi、mp4、mkv、mpeg、mov、divx、h.264 以及其他任何主要媒体格式。锦上添花的是,它也可以播放 [YouTube][6] 视频,并且无广告。 ![SMPlayer default interface][7] -SMPlayer 是一个完整的媒体解决方案。它是跨平台的,因此可在所有操作系统上使用。如果你是双启动,则可以将其安装在 Windows 和 Linux 操作系统上,以便在两个系统上获得统一的体验。它还支持带触摸的可变形笔记本。 +SMPlayer 是一个完整的媒体解决方案。它是跨平台的,因此可在所有操作系统上使用。如果你是双启动系统,则可以将其安装在 Windows 和 Linux 操作系统上,以便在两个系统上获得统一的体验。它还支持带触摸的可变形笔记本。 你也可以在 SMPlayer 上播放 YouTube。我知道每次复制粘贴视频 URL 并在外部播放器上播放是不切实际的。但是当你观看相对较长的视频时,SMPlayer 特别有用。SMPlayer 以相当好的质量播放 YouTube 视频,我觉得比在浏览器中播放得更好。通过在 SMPlayer 上播放较长的视频,你可以远离视频中间弹出的插播广告。 @@ -51,7 +52,7 @@ SMPlayer 应该可在所有主要 Linux 发行版的软件中心获取。你可 sudo apt install smplayer ``` -或者,你可以在[这里][11]下载 Fedora、Arch Linux、OpenSUSE 和 Debian 的软件包 +或者,你可以在[这里][11]下载 Fedora、Arch Linux、OpenSUSE 和 Debian 的软件包。 ### 总结 @@ -66,7 +67,7 @@ via: https://itsfoss.com/smplayer/ 作者:[Aquil Roshan;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/) 荣誉推出 @@ -83,4 +84,4 @@ via: https://itsfoss.com/smplayer/ [9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-icon-packs.jpg?fit=800%2C450&ssl=1 [10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-theme.jpg?fit=800%2C450&ssl=1 [11]: https://software.opensuse.org/download.html?project=home%3Asmplayerdev&package=smplayer -[12]: https://itsfoss.com/essential-linux-applications/ \ No newline at end of file +[12]: https://itsfoss.com/essential-linux-applications/ From 228a0a7fbc5fe30c4c28571541ca6d741875b5f5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 19 Dec 2018 17:53:02 +0800 Subject: [PATCH 0189/4278] PUB:20181130 SMPlayer in Linux- Features, Download and Installation.md @geekpi https://linux.cn/article-10365-1.html --- ... SMPlayer in Linux- Features, Download and Installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181130 SMPlayer in Linux- Features, Download and Installation.md (98%) diff --git a/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md b/published/20181130 SMPlayer in Linux- Features, Download and Installation.md similarity index 98% rename from translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md rename to published/20181130 SMPlayer in Linux- Features, Download and Installation.md index 1e0147ac10..5165fed0f7 100644 --- a/translated/tech/20181130 SMPlayer in Linux- Features, Download and Installation.md +++ b/published/20181130 SMPlayer in Linux- Features, Download and Installation.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (SMPlayer in Linux: Features, Download and Installation) [#]: via: (https://itsfoss.com/smplayer/) [#]: author: (Aquil Roshan;Abhishek Prakash https://itsfoss.com/author/aquil/) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10365-1.html) SMPlayer:增强版的媒体播放器 ====== From 45de03a32dcf7afd5789fe4142114aac0757cf93 Mon Sep 17 00:00:00 2001 From: jlztan Date: Wed, 19 Dec 2018 18:13:24 +0800 Subject: [PATCH 0190/4278] Delete 20171223 Celebrate Christmas In Linux Way With These Wallpapers.md --- ...tmas In Linux Way With These Wallpapers.md | 201 ------------------ 1 file changed, 201 deletions(-) delete mode 100644 sources/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md diff --git a/sources/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/sources/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md deleted file mode 100644 index 94c08d72ae..0000000000 --- a/sources/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md +++ /dev/null @@ -1,201 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (jlztan) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Celebrate Christmas In Linux Way With These Wallpapers) -[#]: via: (https://itsfoss.com/christmas-linux-wallpaper/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -[#]: url: ( ) - -Celebrate Christmas In Linux Way With These Wallpapers -====== - -It’s the holiday season and many of you might be celebrating Christmas already. From the team of It’s FOSS, I would like to wish you a Merry Christmas and a happy new year. - -To continue the festive mood, I’ll show you some really awesome [Linux wallpapers][1] on Christmas theme. But before we see that, how about a Christmas Tree in Linux terminal. - -### Display Christmas Tree in Linux Terminal - - - -If you want to display an animated Christmas tree in the terminal, you can use the command below: - -``` -curl https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh | bash -``` - -If you don’t want to get it from the internet all the time, you can get the shell script from its GitHub repository, change the permission and run it like a normal shell script. - -[ChristBASHTree][2] - -### Display Christmas Tree in Linux terminal using Perl - -[![Christmas Tree in Linux terminal by NixCraft][3]][4] - -This trick was originally shared by [NixCraft][5]. You’ll need to install a Perl module for this. - -To be honest, I don’t like using Perl modules because uninstalling them is a real pain. So **use this Perl module knowing that you’ll have to manually remove it**. - -``` -perl -MCPAN -e 'install Acme::POE::Tree' -``` - -You can read the original article [here][5] to know more about it. - -## Download Linux Christmas Wallpapers - -All these Linux Christmas wallpapers are created by Mark Riedesel and you can find plenty of other artwork on [his website][6]. - -He has been making such wallpapers almost every year since 2002. Quite understandably some of the earliest wallpapers don’t have modern aspect ratio. I have put them up in reverse chronological order. - -One tiny note. The images displayed here are highly compressed so download the wallpapers from the provided link only. - -![Christmas Linux Wallpaper][7] - -[Download This Wallpaper][8] - -[![Christmas Linux Wallpapers][9]][10] - -[Download This Wallpaper][11] - -[![Christmas Linux Wallpapers][12]][13] - -[Download This Wallpaper][14] - -[![Christmas Linux Wallpapers][15]][16] - -[Download This Wallpaper][17] - -[![Christmas Linux Wallpapers][18]][19] - -[Download This Wallpaper][20] - -[![Christmas Linux Wallpapers][21]][22] - -[Download This Wallpaper][23] - -[![Christmas Linux Wallpapers][24]][25] - -[Download This Wallpaper][26] - -[![Christmas Linux Wallpapers][27]][28] - -[Download This Wallpaper][29] - -[![Christmas Linux Wallpapers][30]][31] - -[Download This Wallpaper][32] - -[![Christmas Linux Wallpapers][33]][34] - -[Download This Wallpaper][35] - -[![Christmas Linux Wallpapers][36]][37] - -[Download This Wallpaper][38] - -[![Christmas Linux Wallpapers][39]][40] - -[Download This Wallpaper][41] - -[![Christmas Linux Wallpapers][42]][43] - -[Download This Wallpaper][44] - -[![Christmas Linux Wallpapers][45]][46] - -[Download This Wallpaper][47] - -[![Christmas Linux Wallpapers][48]][49] - -[Download This Wallpaper][50] - -### Bonus: Linux Christmas carols - -Here is a bonus for you. Christmas carols Linuxified for Linux lovers like us. - -In [an article on Computer World][51], [Sandra Henry-Stocker][52] shared such Christmas carols. An excerpt: - -To the tune of: [Chestnuts Roasting on an Open Fire][53] - -> Running merrily on open source -> With users happy as can be -> We’re using Linux and getting lots done -> And happy everything is free - -To the tune of: [The Twelve Days of Christmas][54] - -> On my first day with Linux, my admin gave to me a password and a login ID -> On my second day with Linux my admin gave to me two new commands and a password and a login ID - -You can read full carols [here][51]. - -Merry Linux to you!! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/christmas-linux-wallpaper/ - -作者:[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/beautiful-linux-wallpapers/ -[2]: https://github.com/sergiolepore/ChristBASHTree -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/perl-tree.gif?resize=600%2C622&ssl=1 -[4]: https://itsfoss.com/christmas-linux-wallpaper/perl-tree/ -[5]: https://www.cyberciti.biz/open-source/command-line-hacks/linux-unix-desktop-fun-christmas-tree-for-your-terminal/ -[6]: http://www.klowner.com/ -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmas-linux-wallpaper-featured.jpeg?resize=800%2C450&ssl=1 -[8]: http://klowner.com/wallery/christmas_tux_2017/download/ChristmasTux2017_3840x2160.png -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2016_3840x2160_result.jpg?resize=800%2C450&ssl=1 -[10]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2016_3840x2160_result/ -[11]: http://www.klowner.com/wallpaper/christmas_tux_2016/ -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2015_2560x1920_result.jpg?resize=800%2C600&ssl=1 -[13]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2015_2560x1920_result/ -[14]: http://www.klowner.com/wallpaper/christmas_tux_2015/ -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2014_2560x1440_result.jpg?resize=800%2C450&ssl=1 -[16]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2014_2560x1440_result/ -[17]: http://www.klowner.com/wallpaper/christmas_tux_2014/ -[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2013_result.jpg?resize=800%2C450&ssl=1 -[19]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2013_result/ -[20]: http://www.klowner.com/wallpaper/christmas_tux_2013/ -[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2012_2560x1440_result.jpg?resize=800%2C450&ssl=1 -[22]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2012_2560x1440_result/ -[23]: http://www.klowner.com/wallpaper/christmas_tux_2012/ -[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2011_2560x1440_result.jpg?resize=800%2C450&ssl=1 -[25]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2011_2560x1440_result/ -[26]: http://www.klowner.com/wallpaper/christmas_tux_2011/ -[27]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2010_5120x2880_result.jpg?resize=800%2C450&ssl=1 -[28]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2010_5120x2880_result/ -[29]: http://www.klowner.com/wallpaper/christmas_tux_2010/ -[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2009_1600x1200_result.jpg?resize=800%2C600&ssl=1 -[31]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2009_1600x1200_result/ -[32]: http://www.klowner.com/wallpaper/christmas_tux_2009/ -[33]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2008_2560x1600_result.jpg?resize=800%2C500&ssl=1 -[34]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2008_2560x1600_result/ -[35]: http://www.klowner.com/wallpaper/christmas_tux_2008/ -[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2007_2560x1600_result.jpg?resize=800%2C500&ssl=1 -[37]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2007_2560x1600_result/ -[38]: http://www.klowner.com/wallpaper/christmas_tux_2007/ -[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2006_1024x768_result.jpg?resize=800%2C600&ssl=1 -[40]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2006_1024x768_result/ -[41]: http://www.klowner.com/wallpaper/christmas_tux_2006/ -[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2005_1600x1200_result.jpg?resize=800%2C600&ssl=1 -[43]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2005_1600x1200_result/ -[44]: http://www.klowner.com/wallpaper/christmas_tux_2005/ -[45]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2004_1600x1200_result.jpg?resize=800%2C600&ssl=1 -[46]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2004_1600x1200_result/ -[47]: http://www.klowner.com/wallpaper/christmas_tux_2004/ -[48]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2002_1600x1200_result.jpg?resize=800%2C600&ssl=1 -[49]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2002_1600x1200_result/ -[50]: http://www.klowner.com/wallpaper/christmas_tux_2002/ -[51]: http://www.computerworld.com/article/3151076/linux/merry-linux-to-you.html -[52]: https://twitter.com/bugfarm -[53]: https://www.youtube.com/watch?v=dhzxQCTCI3E -[54]: https://www.youtube.com/watch?v=oyEyMjdD2uk From c1e7fb3466c15af52f7f7f805fff1a91045a2239 Mon Sep 17 00:00:00 2001 From: jlztan Date: Wed, 19 Dec 2018 18:16:59 +0800 Subject: [PATCH 0191/4278] Create 20171223 Celebrate Christmas In Linux Way With These Wallpapers.md --- ...tmas In Linux Way With These Wallpapers.md | 190 ++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md diff --git a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md new file mode 100644 index 0000000000..1132a52058 --- /dev/null +++ b/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @@ -0,0 +1,190 @@ +使用这些壁纸以 Linux 的方式庆祝圣诞节 +====== + +当前正是假日季节,很多人可能已经在庆祝圣诞节了。我代表 It's FOSS 团队祝你圣诞快乐,新年快乐。 + +为了延续节日氛围,我将向你展示一些非常棒的圣诞主题 [Linux壁纸][1]。在呈现这些壁纸之前,先来看一棵 Linux 终端下的圣诞树。 + +### 在 Linux 终端下显示圣诞树 + +圣诞树的效果如 [这个页面](https://giphy.com/embed/xUNda6KphvbpYxL3tm) 所示。 + +使用以下命令在终端中显示一棵动画圣诞树: + +``` +curl https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh | bash +``` + +要是不想一直从互联网上获取这棵圣诞树,也可以从它的 [GitHub 仓库][2] 中获取对应的 shell 脚本,更改权限之后按照运行普通 shell 脚本的方式运行它。 + +### 使用 Perl 在 Linux 终端下显示圣诞树 + +[![Christmas Tree in Linux terminal by NixCraft][3]][4] + +这个技巧最初由 [NixCraft][5] 分享,你需要为此安装 Perl 模块。 + +说实话,我不喜欢使用 Perl 模块,因为卸载它们真的很痛苦。所以使用这个 Perl 模块时需谨记,你必须手动移除它。 + +``` +perl -MCPAN -e 'install Acme::POE::Tree' +``` + +你可以阅读 [原文][5] 来了解更多信息。 + +## 下载 Linux 圣诞主题壁纸 + +所有这些 Linux 圣诞主题壁纸都是由 Mark Riedesel 制作的,你可以在 [他的网站][6] 上找到很多其他艺术品。 + +自 2002 年以来,他几乎每年都在制作这样的壁纸。可以理解的是,最早的一些壁纸不具有现代的宽高比。我把它们按时间倒序排列。 + +注意一个小地方,这里显示的图片都是高度压缩的,因此你要通过图片下方提供的链接进行下载。 + +![Christmas Linux Wallpaper][7] + +[下载此壁纸][8] + +[![Christmas Linux Wallpapers][9]][10] + +[下载此壁纸][11] + +[![Christmas Linux Wallpapers][12]][13] + +[下载此壁纸][14] + +[![Christmas Linux Wallpapers][15]][16] + +[下载此壁纸][17] + +[![Christmas Linux Wallpapers][18]][19] + +[下载此壁纸][20] + +[![Christmas Linux Wallpapers][21]][22] + +[下载此壁纸][23] + +[![Christmas Linux Wallpapers][24]][25] + +[下载此壁纸][26] + +[![Christmas Linux Wallpapers][27]][28] + +[下载此壁纸][29] + +[![Christmas Linux Wallpapers][30]][31] + +[下载此壁纸][32] + +[![Christmas Linux Wallpapers][33]][34] + +[下载此壁纸][35] + +[![Christmas Linux Wallpapers][36]][37] + +[下载此壁纸][38] + +[![Christmas Linux Wallpapers][39]][40] + +[下载此壁纸][41] + +[![Christmas Linux Wallpapers][42]][43] + +[下载此壁纸][44] + +[![Christmas Linux Wallpapers][45]][46] + +[下载此壁纸][47] + +[![Christmas Linux Wallpapers][48]][49] + +[下载此壁纸][50] + +### 福利:Linux 圣诞颂歌 + +这是给你的一份福利,给像我们一样的 Linux 爱好者的关于 Linux 的圣诞颂歌。 + +在 [计算机世界的一篇文章][51] 中,[Sandra Henry-Stocker][52] 分享了这些圣诞颂歌。摘录片段如下: + +这一段用的 [Chestnuts Roasting on an Open Fire][53] 的曲调: + +> Running merrily on open source +> With users happy as can be +> We’re using Linux and getting lots done +> And happy everything is free + +这一段用的 [The Twelve Days of Christmas][54] 的曲调: + +> On my first day with Linux, my admin gave to me a password and a login ID +> On my second day with Linux my admin gave to me two new commands and a password and a login ID + +在 [这里][51] 阅读完整的颂歌。 + +祝你享受 Linux! + +------ + +via: https://itsfoss.com/christmas-linux-wallpaper/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[jlztan](https://github.com/jlztan) +校对:[校对者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/beautiful-linux-wallpapers/ +[2]: https://github.com/sergiolepore/ChristBASHTree +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/perl-tree.gif?resize=600%2C622&ssl=1 +[4]: https://itsfoss.com/christmas-linux-wallpaper/perl-tree/ +[5]: https://www.cyberciti.biz/open-source/command-line-hacks/linux-unix-desktop-fun-christmas-tree-for-your-terminal/ +[6]: http://www.klowner.com/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmas-linux-wallpaper-featured.jpeg?resize=800%2C450&ssl=1 +[8]: http://klowner.com/wallery/christmas_tux_2017/download/ChristmasTux2017_3840x2160.png +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2016_3840x2160_result.jpg?resize=800%2C450&ssl=1 +[10]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2016_3840x2160_result/ +[11]: http://www.klowner.com/wallpaper/christmas_tux_2016/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2015_2560x1920_result.jpg?resize=800%2C600&ssl=1 +[13]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2015_2560x1920_result/ +[14]: http://www.klowner.com/wallpaper/christmas_tux_2015/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2014_2560x1440_result.jpg?resize=800%2C450&ssl=1 +[16]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2014_2560x1440_result/ +[17]: http://www.klowner.com/wallpaper/christmas_tux_2014/ +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2013_result.jpg?resize=800%2C450&ssl=1 +[19]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2013_result/ +[20]: http://www.klowner.com/wallpaper/christmas_tux_2013/ +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2012_2560x1440_result.jpg?resize=800%2C450&ssl=1 +[22]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2012_2560x1440_result/ +[23]: http://www.klowner.com/wallpaper/christmas_tux_2012/ +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2011_2560x1440_result.jpg?resize=800%2C450&ssl=1 +[25]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2011_2560x1440_result/ +[26]: http://www.klowner.com/wallpaper/christmas_tux_2011/ +[27]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2010_5120x2880_result.jpg?resize=800%2C450&ssl=1 +[28]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2010_5120x2880_result/ +[29]: http://www.klowner.com/wallpaper/christmas_tux_2010/ +[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2009_1600x1200_result.jpg?resize=800%2C600&ssl=1 +[31]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2009_1600x1200_result/ +[32]: http://www.klowner.com/wallpaper/christmas_tux_2009/ +[33]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2008_2560x1600_result.jpg?resize=800%2C500&ssl=1 +[34]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2008_2560x1600_result/ +[35]: http://www.klowner.com/wallpaper/christmas_tux_2008/ +[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2007_2560x1600_result.jpg?resize=800%2C500&ssl=1 +[37]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2007_2560x1600_result/ +[38]: http://www.klowner.com/wallpaper/christmas_tux_2007/ +[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2006_1024x768_result.jpg?resize=800%2C600&ssl=1 +[40]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2006_1024x768_result/ +[41]: http://www.klowner.com/wallpaper/christmas_tux_2006/ +[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2005_1600x1200_result.jpg?resize=800%2C600&ssl=1 +[43]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2005_1600x1200_result/ +[44]: http://www.klowner.com/wallpaper/christmas_tux_2005/ +[45]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2004_1600x1200_result.jpg?resize=800%2C600&ssl=1 +[46]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2004_1600x1200_result/ +[47]: http://www.klowner.com/wallpaper/christmas_tux_2004/ +[48]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2002_1600x1200_result.jpg?resize=800%2C600&ssl=1 +[49]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2002_1600x1200_result/ +[50]: http://www.klowner.com/wallpaper/christmas_tux_2002/ +[51]: http://www.computerworld.com/article/3151076/linux/merry-linux-to-you.html +[52]: https://twitter.com/bugfarm +[53]: https://www.youtube.com/watch?v=dhzxQCTCI3E +[54]: https://www.youtube.com/watch?v=oyEyMjdD2uk From 54787c29b9075afa34d775af0a3b6a919ba83cbf Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Wed, 19 Dec 2018 18:35:52 +0800 Subject: [PATCH 0192/4278] Update 20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md --- ... - Notmuch, mbsync, postfix and dovecot.md | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md b/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md index 0edd75e2bd..01e5c82f08 100644 --- a/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md +++ b/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md @@ -1,20 +1,20 @@ -我的个人电子邮件系统 - Notmuch, mbsync, postfix and dovecot +我的个人电子邮件系统 - Notmuch, mbsync,postfix and dovecot ====== -我使用个人电子邮件系统已经相当长的时间了, 没有文字记录。最近当我换了我的笔记本电脑(职业变更做的变动)我在试图重新创建本地邮件设置时迷茫了。所以这篇文章是一个自己的文档, 这样我就不用费劲就能修正过来。 +我使用个人电子邮件系统已经相当长的时间了, 没有文字记录。最近当我换了我的笔记本电脑(职业变更做的变动)我在试图重新创建本地邮件设置时迷茫了。所以这篇文章是一个自己的文档, 这样我就不用费劲就能修正过来。 ### 服务器端 -我运行自己的邮件服务器, 并使用 Postfix 作为 SMTP 服务器和用 Dovecot 实现 IMAP 。我不打算详细介绍如何配置这些设置, 因为我的设置主要是通过使用 Jonas 为 Redpill 基础架构创建的脚本完成的。什么是 Redpill ?(用 Jonas 自己的话说) +我运行自己的邮件服务器, 并使用 Postfix 作为 SMTP 服务器和用 Dovecot 实现 IMAP 。我不打算详细介绍如何配置这些设置, 因为我的设置主要是通过使用 Jonas 为 Redpill 基础架构创建的脚本完成的。什么是 Redpill ?(用 Jonas 自己的话说) -> Redpill 是一个概念 - 一种设置 Debian hosts 去跨组织协作的方式 我延申了这个概念, 并将其首次使用 Redpill 去联网 redpill.dk, 涉及我自己的网络 (jones.dk), 我的主要客户的网络 (homebase.dk),在德国的一个网络, 包括Skolelinux Germany (free-owl.de), 和 Vasudev 的网络 (copyninja.info) +> Redpill 是一个概念 - 一种设置 Debian hosts 去跨组织协作的方式 我延申了这个概念, 并将其首次使用 Redpill 去联网 redpill.dk, 涉及我自己的网络 (jones.dk), 我的主要客户的网络 (homebase.dk),在德国的一个网络, 包括Skolelinux Germany (free-owl.de), 和 Vasudev 的网络 (copyninja.info) -除此之外, 我还有一个 dovecot sieve 过滤, 根据邮件的来源, 对高级邮件进行分类, 并将其分类到各种文件夹中。所有的规则都存在于每个有邮件地址的账户下的 ~/dovecot.sieve文件中。 +除此之外, 我还有一个 dovecot sieve 过滤, 根据邮件的来源, 对高级邮件进行分类, 并将其分类到各种文件夹中。所有的规则都存在于每个有邮件地址的账户下的 ~/dovecot.sieve文件中。 -再次, 我不详细介绍如何设置这些东西, 因为这不是我这个帖子的目标。 +再次, 我不详细介绍如何设置这些东西, 因为这不是我这个帖子的目标。 ### 在我的笔记本电脑上 -在我的笔记本电脑上, 我已经按照4个部分设置 +在我的笔记本电脑上,我已经按照4个部分设置 1. 邮件同步: 使用 mbsync 命令完成 2. 分类: 使用 notmuch 完成 @@ -25,7 +25,7 @@ ### 邮件同步 -邮件同步是使用 mbsync 工具完成的, 我以前是 OfflineIMAP 的用户, 最近切换到 mbsync, 因为我觉得它比 OfflineIMAP 的配置更轻, 更简单。命令是由包 isync 提供的。 +邮件同步是使用 mbsync 工具完成的, 我以前是 OfflineIMAP 的用户,最近切换到 mbsync,因为我觉得它比 OfflineIMAP 的配置更轻,更简单。命令是由包 isync 提供的。 配置文件是 ~/.mbsyncrc. 下面是我的例子与一些个人设置。 @@ -79,17 +79,17 @@ SyncState * Sync All ``` -对上述配置中的一些有趣部分进行说明。一个是 PassCmd , 它允许您提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我在我磁盘上的一些地方使用对称加密 gpg 和存储密码。这当然是由 Unix ACL 保护安全。 +对上述配置中的一些有趣部分进行说明。一个是 PassCmd , 它允许你提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我在我磁盘上的一些地方使用对称加密 gpg 和存储密码。这当然是由 Unix ACL 保护安全。 -实际上, 我想使用我的公钥加密文件, 但当脚本在后台或通过 systemd 运行时, 解锁文件看起来很困难 (或看起来几乎不可能)。如果你有更好的建议, 我洗耳恭听:-)。 +实际上, 我想使用我的公钥加密文件, 但当脚本在后台或通过 systemd 运行时, 解锁文件看起来很困难 (或看起来几乎不可能)。如果你有更好的建议, 我洗耳恭听:-)。 -下一个指令部分是模式。这使您可以有选择地同步来自邮件服务器的邮件。这对我来说真的很有帮助, 可以排除所有的垃圾 [Gmail]/ folders. +下一个指令部分是模式。这使你可以有选择地同步来自邮件服务器的邮件。这对我来说真的很有帮助, 可以排除所有的垃圾 [Gmail]/ folders. ### 邮件分类 -一旦邮件在您本地的设备, 我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步 Maildir, 并在 Gnus 中阅读。这种设置相比于设置所有服务器软件是有点大题小作, 但 Gnus 无法很好地应付 maildir 格式, 这是最好的方法。这个设置也有一个缺点, 那就是在你有大量邮件要看的时候快速搜索邮件。这是为数不多的情况。 +一旦邮件在你本地的设备, 我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步 Maildir, 并在 Gnus 中阅读。这种设置相比于设置所有服务器软件是有点大题小作, 但 Gnus 无法很好地应付 maildir 格式, 这是最好的方法。这个设置也有一个缺点, 那就是在你有大量邮件要看的时候快速搜索邮件。这是为数不多的情况。 -不多的情况下我想很容易索引通过千兆字节的邮件档案, 并得到我需要的东西。我已经创建了一个小脚本, 它结合了执行 mbsync 和 notmuch 执行语句。我基于 Maildirs 标记邮件, 实际上是创建在服务器端使用 dovecot sieve 。下面是我的完整 shell 脚本, 它正在执行同步分类和删除垃圾邮件的任务。 +不多的情况下我想很容易索引通过千兆字节的邮件档案, 并得到我需要的东西。我已经创建了一个小脚本, 它结合了执行 mbsync 和 notmuch 执行语句。我基于 Maildirs 标记邮件, 实际上是创建在服务器端使用 dovecot sieve 。下面是我的完整 shell 脚本, 它正在执行同步分类和删除垃圾邮件的任务。 ``` #!/bin/sh @@ -129,27 +129,27 @@ for mdir in $MDIR; do done ``` -因此, 在运行 mbsync 之前, 我搜索所有标记为已删除的邮件, 并将其从系统中删除。接下来, 我在我的帐户上查找标记为 "垃圾邮件" 的邮件, 并将其移动到垃圾邮件文件夹。你做的对, 这些邮件逃脱垃圾邮件过滤器进到我的 inbox, 并被我亲自标记为垃圾邮件。 +因此, 在运行 mbsync 之前, 我搜索所有标记为已删除的邮件, 并将其从系统中删除。接下来, 我在我的帐户上查找标记为 "垃圾邮件" 的邮件, 并将其移动到垃圾邮件文件夹。你做的对,这些邮件逃脱垃圾邮件过滤器进到我的 inbox ,并被我亲自标记为垃圾邮件。 -运行 mbsync 后, 我基于他们的文件夹标记邮件 (搜索字符串文件夹:)。这让我可以很容易地得到一个邮件列表的内容, 而不需要记住列表地址。 +运行 mbsync 后, 我基于他们的文件夹标记邮件 (搜索字符串文件夹:)。这让我可以很容易地得到一个邮件列表的内容, 而不需要记住列表地址。 ### 阅读邮件 -现在, 我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格, 所以我花了一些时间写下一个私有层(private layer), 它将我所有的快捷键和分类集中在一个地方, 不会扰乱我的整个. spacemacs 文件。您可以在 [notmuch-emacs-layer repository][1] 找到我私有层的代码。 +现在, 我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格, 所以我花了一些时间写下一个私有层(private layer),它将我所有的快捷键和分类集中在一个地方, 不会扰乱我的整个. spacemacs 文件。你可以在 [notmuch-emacs-layer repository][1] 找到我私有层的代码。 ### 发送邮件 -如果我们能阅读邮件, 我们就需要能够回复邮件, 这还不够。而这是最近是我感到迷茫的一个略显棘手的部分, 不得不写这篇文章, 这样我就不会再忘记了。(当然也不必在网络上引用一些过时的帖子)。 +如果我们能阅读邮件, 我们就需要能够回复邮件, 这还不够。而这是最近是我感到迷茫的一个略显棘手的部分, 不得不写这篇文章, 这样我就不会再忘记了。(当然也不必在网络上引用一些过时的帖子)。 -我的设置发送邮件使用 postfix 作为 SMTP 客户端与我自己的 SMTP 服务器作为它的转接主机。转接的问题是, 它不是具有动态 IP 的主机。有几种方法可以允许具有动态 ip 的主机使用转接服务器, 一种是将邮件从其中发源于 my_network 或第二个使用 SASL 身份验证的 IP 地址。 +我的设置发送邮件使用 postfix 作为 SMTP 客户端与我自己的 SMTP 服务器作为它的转接主机。转接的问题是, 它不是具有动态 IP 的主机。有几种方法可以允许具有动态 ip 的主机使用转接服务器, 一种是将邮件从其中发源于 my_network 或第二个使用 SASL 身份验证的 IP 地址。 -我的首选方法是使用 SASL 身份验证。为此, 我首先要为每台机器创建一个单独的账户, 它将把邮件传递到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主要账户, 但 Jonas 给出了每个可行账户的想法) +我的首选方法是使用 SASL 身份验证。为此, 我首先要为每台机器创建一个单独的账户, 它将把邮件传递到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主要账户, 但 Jonas 给出了每个可行账户的想法) ``` adduser _relay ``` -这里替换 与您的笔记本电脑的名称或任何你正在使用的设备。现在我们需要调整 postfix , 作为转接服务器。因此, 在 postfix 配置中添加以下行 +这里替换 与你的笔记本电脑的名称或任何你正在使用的设备。现在我们需要调整 postfix , 作为转接服务器。因此, 在 postfix 配置中添加以下行 ``` # SASL authentication smtp_sasl_auth_enable = yes @@ -159,28 +159,28 @@ relayhost = [smtp.copyninja.info]:submission smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd ``` -因此, 这里的 relayhost 是您的 postfix 实例将用于邮件转发到互联网的服务器名称。submission 的部分 postfix 将邮件转发到端口 587 (安全)。smtp_sasl_tls_security_options 设置为不允许匿名连接。这必须使转接服务器信任您的移动主机, 并同意为您转发邮件。 +因此, 这里的 relayhost 是你的 postfix 实例将用于邮件转发到互联网的服务器名称。submission 的部分 postfix 将邮件转发到端口 587 (安全)。smtp_sasl_tls_security_options 设置为不允许匿名连接。这必须使转接服务器信任你的移动主机, 并同意为你转发邮件。 -/etc/postfix/sasl__asswd 是您需要存储用于服务器 SASL 身份验证的帐户密码的文件。将以下内容放入其中。 +/etc/postfix/sasl__asswd 是你需要存储用于服务器 SASL 身份验证的帐户密码的文件。将以下内容放入其中。 ``` [smtp.example.com]:submission user:password ``` - 用你的 SMTP 服务器名称替换 smtp.example.com ,您已输入的 relayhost 认证。 用您创建的用户及其密码替换 user with _relay 。 + 用你的 SMTP 服务器名称替换 smtp.example.com ,你已输入的 relayhost 认证。 用你创建的用户及其密码替换 user with _relay 。 -若要保护 sasl_passwd 文件, 并创建它的 hash(哈希) 进行 postfix 使用以下命令。 +若要保护 sasl_passwd 文件, 并创建它的 hash(哈希) 进行 postfix 使用以下命令。 ``` chown root:root /etc/postfix/sasl_passwd chmod 0600 /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd ``` -最后的命令将创建 /etc/postfix/sasl_passwd.db 文件是您的文件的 hash /etc/postfix/sasl_passwd 具有相同的所有者和权限。现在重新加载 postfix, 并检查邮件是否使用邮件命令从您的系统中取出。 +最后的命令将创建 /etc/postfix/sasl_passwd.db 文件是你的文件的 hash /etc/postfix/sasl_passwd 具有相同的所有者和权限。现在重新加载 postfix, 并检查邮件是否使用邮件命令从你的系统中取出。 ### Bonus 的部分 -好吧, 因为我有一个脚本创建以上结合了邮件的同步和分类。我继续创建了一个 systemd 计时器, 以定期同步后台的邮件。就我而言, 每10分钟一次。下面是 mailsync.timer 文件。 +好吧, 因为我有一个脚本创建以上结合了邮件的同步和分类。我继续创建了一个 systemd 计时器, 以定期同步后台的邮件。就我而言, 每10分钟一次。下面是 mailsync.timer 文件。 ``` [Unit] Description=Check Mail Every 10 minutes @@ -197,7 +197,7 @@ Unit=mailsync.service WantedBy=default.target ``` -下面是 mailsync. 服务, 这是邮件同步计时器执行我们的脚本所需要的。 +下面是 mailsync. 服务, 这是邮件同步计时器执行我们的脚本所需要的。 ``` [Unit] @@ -219,7 +219,7 @@ systemctl enable --user mailsync.service systemctl start --user mailsync.timer ``` -这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew ,他同时阅读了这篇帖子。因此, 下一步, 我将尝试使用 afew 改进我的 notmuch 配置, 当然还会有一个后续的帖子:-)。 +这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew ,他同时阅读了这篇帖子。因此, 下一步, 我将尝试使用 afew 改进我的 notmuch 配置, 当然还会有一个后续的帖子:-)。 -------------------------------------------------------------------------------- From 1cafa689f8fb0e38699d9171075c2abf378b7fe3 Mon Sep 17 00:00:00 2001 From: wwhio Date: Thu, 20 Dec 2018 00:56:59 +0800 Subject: [PATCH 0193/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=AF=95?= =?UTF-8?q?=EF=BC=8C=E8=AF=B7=E6=B1=82=E6=A0=A1=E5=AF=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talk/20180623 The IBM 029 Card Punch.md | 72 ------------------- .../talk/20180623 The IBM 029 Card Punch.md | 71 ++++++++++++++++++ 2 files changed, 71 insertions(+), 72 deletions(-) delete mode 100644 sources/talk/20180623 The IBM 029 Card Punch.md create mode 100644 translated/talk/20180623 The IBM 029 Card Punch.md diff --git a/sources/talk/20180623 The IBM 029 Card Punch.md b/sources/talk/20180623 The IBM 029 Card Punch.md deleted file mode 100644 index 6b36845c2d..0000000000 --- a/sources/talk/20180623 The IBM 029 Card Punch.md +++ /dev/null @@ -1,72 +0,0 @@ -Translating by wwhio - - -The IBM 029 Card Punch -====== -Lines of code longer than 80 characters drive me crazy. I appreciate that this is pedantic. I’ve seen people on the internet make good arguments for why the 80-character limit ought to be respected even on our modern Retina-display screens, but those arguments hardly justify the visceral hatred I feel for even that one protruding 81st character. - -There was once a golden era in which it was basically impossible to go over the 80-character limit. The 80-character limit was a physical reality, because there was no 81st column for an 81st character to fit in. Any programmers attempting to name a function something horrendously long and awful would discover, in a moment of delicious, slow-dawning horror, that there literally isn’t room for their whole declaration. - -This golden era was the era of punch card programming. By the 1960s, IBM’s punch cards had set the standard and the standard was that punch cards had 80 columns. The 80-column standard survived into the teletype and dumb terminal era and from there embedded itself into the nooks and crannies of our operating systems. Today, when you launch your terminal emulator and open a new window, odds are it will be 80 characters wide, even though we now have plenty of screen real estate and tend to favor longer identifiers over inscrutable nonsense like `iswcntrl()`. - -If questions on Quora are any indication, many people have trouble imagining what it must have been like to program computers using punch cards. I will admit that for a long time I also didn’t understand how punch card programming could have worked, because it struck me as awfully labor-intensive to punch all those holes. This was a misunderstanding; programmers never punched holes in cards the same way a train conductor does. They had card punch machines (also known as key punches), which allowed them to punch holes in cards using a typewriter-style keyboard. And card punches were hardly new technology—they were around as early as the 1890s. - -One of the most widely used card punch machines was the IBM 029. It is perhaps the best remembered card punch today. - -![][1] - -The IBM 029 was released in 1964 as part of IBM’s System/360 rollout. System/360 was a family of computing systems and peripherals that would go on to dominate the mainframe computing market in the late 1960s. Like many of the other System/360 machines, the 029 was big. This was an era when the distinction between computing machinery and furniture was blurry—the 029 was not something you put on a table but an entire table in itself. The 029 improved upon its predecessor, the 026, by supporting new characters like parentheses and by generally being quieter. It had cool electric blue highlights and was flat and angular whereas the 026 had a 1940s rounded, industrial look. Another of its big selling points was that it could automatically left-pad numeric fields with zeros, demonstrating that JavaScript programmers were not the first programmers too lazy to do their own left-padding. - -But wait, you might say—IBM released a brand-new card punch in 1964? What about that photograph of the Unix gods at Bell Labs using teletype machines in, like, 1970? Weren’t card punching machines passé by the mid- to late-1960s? Well, it might surprise you to know that the 029 was available in IBM’s catalog until as late as 1984. In fact, most programmers programmed using punch cards until well into the 1970s. This doesn’t make much sense given that there were people using teletype machines during World War II. Indeed, the teletype is almost of the same vintage as the card punch. The limiting factor, it turns out, was not the availability of teletypes but the availability of computing time. What kept people from using teletypes was that teletypes assumed an interactive, “online” model of communication with the computer. Before Unix and the invention of timesharing operating systems, your interactive session with a computer would have stopped everyone else from using it, a delay potentially costing thousands of dollars. So programmers instead wrote their programs offline using card punch machines and then fed them into mainframe computers later as batch jobs. Punch cards had the added benefit of being a cheap data store in an era where cheap, reliable data storage was hard to come by. Your programs lived in stacks of cards on your shelves rather than in files on your hard drive. - -So what was it actually like using an IBM 029 card punch? That’s hard to explain without first taking a look at the cards themselves. A typical punch card had 12 rows and 80 columns. The bottom nine rows were the digit rows, numbered one through nine. These rows had the appropriate digit printed in each column. The top three rows, called the “zone” rows, consisted of two blank rows and usually a zero row. Row 12 was at the very top of the card, followed by row 11, then rows zero through nine. This somewhat confusing ordering meant that the top edge of the card was called the 12 edge while the bottom was called the nine edge. A corner of each card was usually clipped to make it easier to keep a stack of cards all turned around the right way. - -![][2] - -When they were first invented, punch cards were meant to be punched with circular holes, but IBM eventually realized that they could fit more columns on a card if the holes were narrow rectangles. Different combinations of holes in a column represented different characters. For human convenience, card punches like the 029 would print each column’s character at the top of the card at the same time as punching the necessary holes. Digits were represented by one punched hole in the appropriate digit row. Alphabetical and symbolic characters were represented by a hole in a zone row and then a combination of one or two holes in the digit rows. The letter A, for example, was represented by a hole in the 12 zone row and another hole in the one row. This was an encoding of sorts, sometimes called the Hollerith code, after the original inventor of the punch card machine. The encoding allowed for only a relatively small character set; lowercase letters, for example, were not represented. Some clever engineer today might wonder why punch cards didn’t just use a binary encoding—after all, with 12 rows, you could encode over 4000 characters. The Hollerith code was used instead because it ensured that no more than three holes ever appeared in a single column. This preserved the structural integrity of the card. A binary encoding would have entailed so many holes that the card would have fallen apart. - -Cards came in different flavors. By the 1960s, 80 columns was the standard, but those 80 columns could be used to represent different things. The basic punch card was unlabeled, but cards meant for COBOL programming, for example, divided the 80 columns into fields. On a COBOL card, the last eight columns were reserved for an identification number, which could be used to automatically sort a stack of cards if it were dropped (apparently a perennial hazard). Another column, column seven, could be used to indicate that the statement on this card was a continuation of a statement on a previous card. This meant that if you were truly desperate you could circumvent the 80-character limit, though whether a two-card statement counts as one long line or just two is unclear. FORTRAN cards were similar but had different fields. Universities often watermarked the punch cards handed out by their computing centers, while other kinds of designs were introduced for special occasions like the [1976 bicentennial][3]. - -Ultimately the cards had to be read and understood by a computer. IBM sold a System/360 peripheral called the IBM 2540 which could read up to 1000 cards per minute. The IBM 2540 ran electrical brushes across the surface of each card which made contact with a plate behind the cards wherever there was a hole. Once read, the System/360 family of computers represented the characters on each punch card using an 8-bit encoding called EBCDIC, which stood for Extended Binary Coded Decimal Interchange Code. EBCDIC was a proper binary encoding, but it still traced its roots back to the punch card via an earlier encoding called BCDIC, a 6-bit encoding which used the low four bits to represent a punch card’s digit rows and the high two bits to represent the zone rows. Punch card programmers would typically hand their cards to the actual computer operators, who would feed the cards into the IBM 2540 and then hand the printed results back to the programmer. The programmer usually didn’t see the computer at all. - -What the programmer did see a lot of was the card punch. The 029 was not a computer, but that doesn’t mean that it wasn’t a complicated machine. The best way to understand what it was like using the 029 is to watch [this instructional video][4] made by the computing center at the University of Michigan in 1967. I’m going to do my best to summarize it here, but if you don’t watch the video you will miss out on all the wonderful clacking and whooshing. - -The 029 was built around a U-shaped track that the punch cards traveled along. On the right-hand side, at the top of the U, was the card hopper, which you would typically load with a fresh stack of cards before using the machine. The IBM 029 worked primarily with 80-column cards, but the card hopper could accommodate smaller cards if needed. Your punch cards would start in the card hopper, travel along the line of the U, and then end up in the stacker, at the top of the U on the left-hand side. The cards would accumulate there in the order that you punched them. - -To turn the machine on, you flipped a switch under the desk at about the height of your knees. You then pressed the “FEED” key twice to get cards loaded into the machine. The business part of the card track, the bottom of the U, was made up of three separate stations: On the right was a kind of waiting area, in the middle was the punching station, and on the left was the reading station. Pressing the “FEED” key twice loaded one card into the punching station and one card into the waiting area behind it. A column number indicator right above the punching station told you which column you were currently punching. With every keystroke, the machine would punch the requisite holes, print the appropriate character at the top of the card, and then advance the card through the punching station by one column. If you punched all 80 columns, the card would automatically be released to the reading station and a new card would be loaded into the punching station. If you wanted this to happen before you reached the 80th column, you could press the “REL” key (for “release”). - -The printed characters made it easy to spot a mistake. But fixing a mistake, as the University of Michigan video warns, is not as easy as whiting out the printed character at the top of the card and writing in a new one. The holes are all that the computer will read. Nor is it as easy as backspacing one space and typing in a new character. The holes have already been punched in the column, after all, and cannot be unpunched. Punching more holes will only produce an invalid combination not associated with any character. The IBM 029 did have a backspace button that moved the punched card backward one column, but the button was placed on the face of the machine instead of on the keyboard. This was probably done to discourage its use, since backspacing was so seldom what the user actually wanted to do. - -Instead, the only way to correct a mistake was scrap the incorrect card and punch a new one. This is where the reading station came in handy. Say you made a mistake in the 68th column of a card. To fix your mistake, you could carefully repunch the first 67 columns of a new card and then punch the correct character in the 68th column. Alternatively, you could release the incorrect card to the reading station, load a new card into the punching station, and hold down the “DUP” key (for duplicate) until the column number indicator reads 68. You could then correct your mistake by punching the correct character. The reading station and the “DUP” key together allowed IBM 029 operators to easily copy the contents of one card to the next. There were all sorts of reasons to do this, but correcting mistakes was the most common. - -The “DUP” key allowed the 029’s operator to invoke the duplicate functionality manually. But the 029 could also duplicate automatically where necessary. This was particularly useful when punched cards were used to record data rather than programs. For example, you might be using each card to record information about a single undergraduate university student. On each card, you might have a field that contains the name of that student’s residence hall. Perhaps you find yourself entering data for all the students in one residence hall at one time. In that case, you’d want the 029 to automatically copy over the previous card’s residence hall field every time you reached the first column of the field. - -Automated behavior like this could be programmed into the 029 by using the program drum. The drum sat upright in the middle of the U above the punching station. You programmed the 029 by punching holes in a card and wrapping that card around the program drum. The punched card allowed you to specify the automatic behavior you expected from the machine at each column of the card currently in the punching station. You could specify that a column should automatically be copied from the previous card, which is how an 029 operator might more quickly enter student records. You could also specify, say, that a particular field should contain numeric or alphabetic characters, or that a given field should be left blank and skipped altogether. The program drum made it much easier to punch schematized cards where certain column ranges had special meanings. There is another [“advanced” instructional video][5] produced by the University of Michigan that covers the program drum that is worth watching, provided, of course, that you have already mastered the basics. - -Watching either of the University of Michigan videos today, what’s surprising is how easy the card punch is to operate. Correcting mistakes is tedious, but otherwise the machine seems to be less of an obstacle than I would have expected. Moving from one card to the next is so seamless that I can imagine COBOL or FORTRAN programmers forgetting that they are creating separate cards rather than one long continuous text file. On the other hand, it’s interesting to consider how card punches, even though they were only an input tool, probably limited how early programming languages evolved. Structured programming would eventually come along and encourage people to think of entire blocks of code as one unit, but I can see how punch card programming’s emphasis on each line made structured programming hard to conceive of. It’s no wonder that punch card programmers were not the ones that decided to enclose blocks with single curly braces entirely on their own lines. How wasteful that would have seemed! - -So even though nobody programs using punch cards anymore, every programmer ought to [try it][6] at least once—if only to understand why COBOL and FORTRAN look the way they do, or how 80 characters somehow became everybody’s favorite character limit. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][7] on Twitter or subscribe to the [RSS feed][8] to make sure you know when a new post is out. - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://twobithistory.org/images/ibm029_front.jpg -[2]: https://twobithistory.org/images/card.png -[3]: http://www.jkmscott.net/data/Punched%20card%20013.jpg -[4]: https://www.youtube.com/watch?v=kaQmAybWn-w -[5]: https://www.youtube.com/watch?v=SWD1PwNxpoU -[6]: http://www.masswerk.at/keypunch/ -[7]: https://twitter.com/TwoBitHistory -[8]: https://twobithistory.org/feed.xml diff --git a/translated/talk/20180623 The IBM 029 Card Punch.md b/translated/talk/20180623 The IBM 029 Card Punch.md new file mode 100644 index 0000000000..a1283e70b2 --- /dev/null +++ b/translated/talk/20180623 The IBM 029 Card Punch.md @@ -0,0 +1,71 @@ +IBM 029 型打孔机 +====== +我知道这很学院派,可一行超过 80 个字符的代码还是让我抓狂。我也在网上见过不少人认为即在现代视网膜屏幕下也应当采用行长度为 80 个字符的标准,可他们都不理解我对破坏这一标准的怒火,就算 1 个字符也不行。 + +在这一标准的黄金时期,一行代码的长度几乎不会超过 80 个字符的限制。在那时,这一限制是物理的,没有第 81 列用于存放第 81 个字符。每一个试图把函数名起的又长又臭的程序员都会在短暂的愉悦后迎来更多的麻烦,而这仅仅时因为没有足够的空间放下整个函数的声明。 + +这一黄金时期也是打孔卡编程时期。在 20 世纪 60 年代, IBM 打孔卡的特性,也就是打孔卡的长度为 80 个字符成为了打孔卡的标准。这一标准在后来的电传打字机和哑终端时期得以延续,并逐渐成为操作系统中隐藏的细节。时至今日,即使我们用上了更大、更好的屏幕,偏向于使用更长的标识符而不是类似 `iswcntrl()` 这样令人难以猜测的函数名,可当你打开新的终端模拟器窗口时,默认的宽度依然是 80 个字符。 + +从 Quora 上的很多问题中可以发现,很多人并不能想象如何使用打孔卡给计算机编程。我承认,在很长的一段时间里我也不能理解卡编程成是如何工作的,因为这让我想到有很多劳工不停的给这些打孔卡打孔。当然,这是一个误解,程序员不需要亲自给打孔卡打孔,就像是火车调度员不用亲自扳道岔。程序员们有打孔机(也被称为键控打孔机key punches),这让他们可以使用打字机式的键盘给打孔卡打孔。这样的设备在 19 世纪 90 年代时就已经不是什么新技术了。 + +那时,最为广泛使用的打孔机之一便是 IBM 029 型打孔机。就算在今天,它也许是最棒的打孔机。 + +![][1] + +IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件发售的。 System/360 是计算系统与外设所组成的一个系列,在 20 世纪 60 年代晚期,它几乎垄断了整个大型计算机市场。就像其它 System/360 外设一样, 029 型打孔机也是个大块头。那时,计算机和家具的界限还很模糊,但 029 型打孔机可不是那种会占领你的整张桌子的机器。它改进自 026 型打孔机,增加了新的字符支持,如括号,总体上也更加安静。与前辈 026 型所展出 20 世纪 40 年代的圆形按钮与工业化的样貌相比, 029 型的按键方正扁平、功能按键还有酷炫的蓝色高亮提示。它的另一个重要买点是它能够在数字区numeric fields左侧自动的填充 0 ,这证明了 JavaScript 程序员不是第一批懒得自己做左填充left-padding的程序员。 +(译者注:这项功能需要额外的 4 张 [标准模块系统卡SMS card](https://en.wikipedia.org/wiki/IBM_Standard_Modular_System)才能使用。例如数字区长度为 6 时,操作员只需要输入 73 ,打孔机会自动填充起始位置上的 4 个 0 ,故最终输出 000073。[更多信息](https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch)) + +等等!你说的是 IBM 在 1964 年发布了全新的打孔机?你知道那张在贝尔实验室拍摄的 Unix 之父正在使用电传打字机的照片吗?那是哪一年的来着?1970?打孔机不是应该在 20 世纪 60 年代中期到晚期时就过时了吗?是的,你也许会奇怪,为什么直到 1984 年, IBM 的产品目录中才出现 029 型打孔机的身影。事实上,直到 20 世纪 70 年代,大多数程序员仍然在使用打孔卡编程。其实二战期间就已经有人在用电传打字机了,可那时并没能普及。客观的讲,电传打字机几乎和打孔卡一样古老。也许和你想象的恰恰相反,并不是电传打字机本身限制了他的普及,而是计算时间。人们拒绝使用电传打字机的原因是,它是可交互的,它和计算机使用“在线”的传输方式"online" mode of communication。在以 Unix 为代表的分时操作系统被发明前,你和电脑的交互会被任何人的使用而打断,而这一点延迟通常意味着几千美元的损失。所以程序员们普遍选择离线地使用打孔机编程,再将打孔卡放入大型计算机中,作为批任务batch job执行。在那时,还没有即廉价又可靠的存储设备,可打孔卡的廉价优势已经足够让他成为那时最流行的数据存储方式了。那时的程序是书架上一落的打孔卡而不是硬盘里的一堆文件。 + +那么实际使用 IBM 029 型打孔机是个什么样子呢?这很难向没有实际看过打孔卡的人解释。一张打孔卡通常有12行80列。打孔卡下面是从 1 到 9 的数字行digit rows,打孔卡上的每一列都有这些行所对应的数字。最上面的三行是空间行"zone" rows,通常由两行空白行和一行 0 行组成。第 12 行是打孔卡最顶层的行,接下来是 11 行,随后是从数字 0 到 9 所在的行。这个有点让人感到困惑的顺序的原因是打孔卡的上边缘被称为12 边12 edge、下边缘被称为 9 边9 edge。那时,为了让打孔卡便于整理,常常会剪去打孔卡的一个角。 + +![][2] +(译者注:可参考[EBCDIC 编码](https://zh.wikipedia.org/wiki/EBCDIC)) + +在打孔卡发明之初,孔洞的形状是圆形的,但是 IBM 最终意识到如果使用窄长方形作为孔洞,一张卡就可以放下更多的列了。每一列中孔洞的不同组合就可以表达不同的字符。像 029 型这样的拥有人性化设计的打孔机除了完成本质的打孔任务外,还会在打孔卡最上方打印出每一列所对应的字符。输入是数字就在对应的数字行上打孔。输入的是字母或符号就用一个在空间列的孔和一或俩个在数字列的孔的组合表示,例如字母 A 就用一个在第 12 空间行的空和一个数字 1 所在行的孔表示。这是一种顺序编码,在第一台打孔机被发明后,也叫 Hollerith 编码。这种编码只能表示相对较小的一套字符集,小写字母就没有包含在这套字符集中,但它的优势在于保留了打孔卡的结构强度。如果直接使用二进制编码,打孔卡可能会因为孔洞过于密集而断裂。 + +打孔卡也有不同。在 20 世纪 60 年代,80 列虽然是标准,但表达的方式不一定相同。基础打孔卡是无标注的,但用于 COBOL 编程的打孔卡会把最后的 8 列保留,供标识数保存使用。这一标识数可以在打孔卡被打乱 (例如一叠打孔卡掉在地上了) 后用于自动排序。此外,第 7 列被用于表示本张打孔卡上的是否是上一张打孔卡一起构成一条语句。也就是说当你真的对 80 字符的限制感到绝望的时候,还可以用两张卡甚至更多的卡拼接成一条长语句。用于 FORTRAN 编程的打孔卡和 COBOL 打孔卡类似,但是定义的列不同。大学里使用的打孔卡通常会由其计算机中心加上水印,其他的设计则会在如 [1976 年美国独立 200 周年][3] 的特殊场合才会加入。 + +最终,这些打孔卡都要被计算机读取和计算。 IBM 出售的 System/360 大型计算机的外设 IBM 2540 可以以每分钟 1000 张打孔卡的速度读取这些卡片。IBM 2540 使用电刷扫过每张打孔卡,电刷通过孔洞就可以接触到卡片后面的金属板完成一次读取。一旦读取完毕, System/360 大型计算机就会把每张打孔卡上的数据使用一种定长的 8 位编码保存,这种编码是扩展的二进制十数交换码Extended Binary Coded Decimal Interchange Code,简写为 EBCDIC 编码。它的源自于早期打孔卡所使用的 BCDIDC 编码,这一 6 位编码使用低 4 位表示数字行,高 2 位表示空间行。程序员们在打孔卡上编写玩程序后,会把卡片们交给计算机操作员,操作员们会把这些卡片放入 IBM 2540 ,再把打印结果交给程序员。那时的程序员大多都没有见过计算机长什么样。 + +程序员们真正能见到的是很多打孔机。 029 型打孔机虽然不是计算机,但这并不意味着它不是一台复杂的机器。看看这个由密歇根大学University of Michigan在 1967 年制作的[教学视频][4],你就能更好的理解使用一台 029 型打孔机是什么情形了。我会尽可能在这里总结这段视频,但如果你不去亲自看看的话,你会错过许多惊奇和感叹。 + +029 型打孔机的结构围绕着一个打孔卡穿过机器的 U 形轨道开始。使用打孔机时,右手边也就是 U 形轨道的右侧顶部是进卡卡槽hopper,使用前通常在里面放入一叠未使用的打孔卡。虽然 029 型打孔机主要使用 80 列打孔卡,但在需要的情况下也可以使用更小号的打孔卡。在打孔机的使用过程中,打孔卡离开轨道右上端的进卡卡槽,顺着 U 形轨道移动并最终进入左上端的出卡卡槽stacker。这一流程可以保证出卡卡槽中的打孔卡按打孔时的先后顺序排列。 + +029 型打孔机的开关在桌面下膝盖高度的位置。在开机后,连按两次 “装入FEED” 键让机器自动将打孔卡从进卡卡槽中取出并移动到机器内。 U 形轨道的底部是打孔机的核心区域,它由三个部分组成:右侧是等待区,中间是打孔操作区,左侧是阅读区。连按两次 “装入” 键,机器就会把一张打孔卡装入打孔机的打孔操作区,另一张打孔卡进入等待区。在打孔操作区上方有一个列数指示器来显示当前打孔所在的列的位置。这时,每按下一个按键,机器就会在打孔卡对应的位置打孔并在卡片的顶部打印按键对应的字符,随后将打孔卡向左移动一列。如果一张卡片的 80 列全部被打上了数据,这张卡片会被打孔操作区自动释放并进入阅读区,同时,一张新的打孔卡会被装入打孔操作区。如果没有打完全部的 80 列,可以使用 “释放REL (for release)” 键完成上面的操作。 + +在打孔卡上打印对应的字符这一设计让人很容易分辨出错误。但就像密歇根大学的视频中警告的那样,打孔卡上修正一个错误可不像擦掉一个打印的字符然后再写上一个新的那样容易,因为计算机只会根据卡片上的孔来读取信息。因为被打出的孔不能被复原unpunched,所以并不能直接退回一列然后再打上一个新的字符。打出更多的孔也只能让这一列的组合变成一个无效字符。 IBM 029 型打孔机上虽然有一个可以让打孔卡回退一列的退格按键,但这个按键被放置在机器上而非在键盘上。这样的设计也许是为了阻止这个按键的使用,因为实际上很少有用户需要这个功能。 + +实际上,只有废弃错误的打孔卡再在新的打孔卡上重新打孔这一种修正错误的方式。这就是阅读区的用武之处了。当你发现打孔卡上的第 68 列出错时,你需要在新的打孔卡上小心的给前 67 列打孔,然后给第 68 列打上正确的字母。另一种操作方式是把带有错误信息的打孔卡放在阅读区,同时在打孔操作区载入一张新的打孔卡,然后按下 “重复DUP (for duplicate)” 按键直到列数指示器显示 68 列。这时按下正确的字符来修正错误。阅读区和重复按键使得 029 型打孔机很容易复制打孔卡上的内容。当然,这一功能的使用可能有各种各样的原因,但改错是最常见的。 + +“重复”按键允许 029 型打孔机的操作员手动调用重复的函数。但是 029 型打孔机还可以设置为自动重复。当用于记录数据而不是编程时,这项功能十分有效。举个例子,当用打孔卡来记录大学生的信息时,每张卡片上都需要输入学生的宿舍楼的名字,如果发现所输入信息的学生都在同一栋楼,就可以使用 029 型打孔机的自动重复功能来完成宿舍楼名称的填写。 + +像这样的自动化操作可以通过打孔卡给 029 型打孔机编程控制。安装打孔卡的圆柱形装置drum就在 U 形轨道中间部分的右上角。通过使用 029 型在打孔卡上写下程序,然后把打孔卡的装入圆柱形装置,再将其安装到打孔机内后,就完成了一次给 029 型打孔机的编程任务。用户可以通过这种方式对打孔卡的每一列都按需要定义不同的自动化操作。029 型打孔机允许指定某些列重复上一张打孔卡相同位置的字符,这就是它能更快的输入学生信息的理由。它还允许指定某些列只能输入数字或者字母,指定特定的列为空或者到某一列时就直接跳过一整张打孔卡。这样的可编程特性使它在输入拥有固定格式的数据时效率很高。密歇根大学制作的[进阶教学视频][5]包括了给 029 型打孔机编程的过程,如果你已经掌握了它的基础操作,就快去看看吧。 + +这会儿,无论你是否看了密歇根大学制作的视频,都会感叹打孔机的操作之简便。虽然修正错误的过程很乏味,但除此之外,操作一台打孔机并不像想象的那样复杂。我甚至可以想象打孔卡之间的无缝切换让 COBOL 和 FORTRAN 程序员忘记了他们的程序是打在不同的打孔卡上而不是写在一个连续的文本文件内。另一方面,思考一下打孔机是如何影响编程语言的发展也是很有趣的,虽然它仅仅是一台输入设备。结构化编程最终会出现并鼓励程序员把整个代码块视为一个整体,但可以想象打孔卡程序员们强调每一行的作用且难以认同结构化编程的场景。同时你能够理解他们为什么不把代码块闭合所使用的括号放在单独的一行,只是因为这样会浪费打孔卡。 + +现在,虽然没有人再使用打孔卡编程了,每个程序员都该试试[这个][6],哪怕一次也好。或许你因此能够更好的理解 COBOL 和 FORTRAN 的历史,或许你就能体会到为什么每个人把 80 个字符作为长度限制的标注。 + +喜欢吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][7] 或者订阅我们的 [RSS][8],这样你就能在第一时间收到新文章的通知。 + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[wwhio](https://github.com/wwhio) +校对:[校对者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://twobithistory.org/images/ibm029_front.jpg +[2]: https://twobithistory.org/images/card.png +[3]: http://www.jkmscott.net/data/Punched%20card%20013.jpg +[4]: https://www.youtube.com/watch?v=kaQmAybWn-w +[5]: https://www.youtube.com/watch?v=SWD1PwNxpoU +[6]: http://www.masswerk.at/keypunch/ +[7]: https://twitter.com/TwoBitHistory +[8]: https://twobithistory.org/feed.xml From 6abe0371b0c84efcec18609eb2656a360cf58121 Mon Sep 17 00:00:00 2001 From: wwhio Date: Thu, 20 Dec 2018 00:58:33 +0800 Subject: [PATCH 0194/4278] =?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=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translated/talk/20180623 The IBM 029 Card Punch.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/talk/20180623 The IBM 029 Card Punch.md b/translated/talk/20180623 The IBM 029 Card Punch.md index a1283e70b2..f905ee1481 100644 --- a/translated/talk/20180623 The IBM 029 Card Punch.md +++ b/translated/talk/20180623 The IBM 029 Card Punch.md @@ -28,13 +28,13 @@ IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件 最终,这些打孔卡都要被计算机读取和计算。 IBM 出售的 System/360 大型计算机的外设 IBM 2540 可以以每分钟 1000 张打孔卡的速度读取这些卡片。IBM 2540 使用电刷扫过每张打孔卡,电刷通过孔洞就可以接触到卡片后面的金属板完成一次读取。一旦读取完毕, System/360 大型计算机就会把每张打孔卡上的数据使用一种定长的 8 位编码保存,这种编码是扩展的二进制十数交换码Extended Binary Coded Decimal Interchange Code,简写为 EBCDIC 编码。它的源自于早期打孔卡所使用的 BCDIDC 编码,这一 6 位编码使用低 4 位表示数字行,高 2 位表示空间行。程序员们在打孔卡上编写玩程序后,会把卡片们交给计算机操作员,操作员们会把这些卡片放入 IBM 2540 ,再把打印结果交给程序员。那时的程序员大多都没有见过计算机长什么样。 -程序员们真正能见到的是很多打孔机。 029 型打孔机虽然不是计算机,但这并不意味着它不是一台复杂的机器。看看这个由密歇根大学University of Michigan在 1967 年制作的[教学视频][4],你就能更好的理解使用一台 029 型打孔机是什么情形了。我会尽可能在这里总结这段视频,但如果你不去亲自看看的话,你会错过许多惊奇和感叹。 +程序员们真正能见到的是很多打孔机。 029 型打孔机虽然不是计算机,但这并不意味着它不是一台复杂的机器。看看这个由密歇根大学University of Michigan在 1967 年制作的[教学视频][4],你就能更好的理解使用一台 029 型打孔机是什么情形了。我会尽可能在这里总结这段视频,但如果你不去亲自看看的话,你会错过许多惊奇和感叹。 029 型打孔机的结构围绕着一个打孔卡穿过机器的 U 形轨道开始。使用打孔机时,右手边也就是 U 形轨道的右侧顶部是进卡卡槽hopper,使用前通常在里面放入一叠未使用的打孔卡。虽然 029 型打孔机主要使用 80 列打孔卡,但在需要的情况下也可以使用更小号的打孔卡。在打孔机的使用过程中,打孔卡离开轨道右上端的进卡卡槽,顺着 U 形轨道移动并最终进入左上端的出卡卡槽stacker。这一流程可以保证出卡卡槽中的打孔卡按打孔时的先后顺序排列。 -029 型打孔机的开关在桌面下膝盖高度的位置。在开机后,连按两次 “装入FEED” 键让机器自动将打孔卡从进卡卡槽中取出并移动到机器内。 U 形轨道的底部是打孔机的核心区域,它由三个部分组成:右侧是等待区,中间是打孔操作区,左侧是阅读区。连按两次 “装入” 键,机器就会把一张打孔卡装入打孔机的打孔操作区,另一张打孔卡进入等待区。在打孔操作区上方有一个列数指示器来显示当前打孔所在的列的位置。这时,每按下一个按键,机器就会在打孔卡对应的位置打孔并在卡片的顶部打印按键对应的字符,随后将打孔卡向左移动一列。如果一张卡片的 80 列全部被打上了数据,这张卡片会被打孔操作区自动释放并进入阅读区,同时,一张新的打孔卡会被装入打孔操作区。如果没有打完全部的 80 列,可以使用 “释放REL (for release)” 键完成上面的操作。 +029 型打孔机的开关在桌面下膝盖高度的位置。在开机后,连按两次 “装入FEED” 键让机器自动将打孔卡从进卡卡槽中取出并移动到机器内。 U 形轨道的底部是打孔机的核心区域,它由三个部分组成:右侧是等待区,中间是打孔操作区,左侧是阅读区。连按两次 “装入” 键,机器就会把一张打孔卡装入打孔机的打孔操作区,另一张打孔卡进入等待区。在打孔操作区上方有一个列数指示器来显示当前打孔所在的列的位置。这时,每按下一个按键,机器就会在打孔卡对应的位置打孔并在卡片的顶部打印按键对应的字符,随后将打孔卡向左移动一列。如果一张卡片的 80 列全部被打上了数据,这张卡片会被打孔操作区自动释放并进入阅读区,同时,一张新的打孔卡会被装入打孔操作区。如果没有打完全部的 80 列,可以使用 “释放REL (for release)” 键完成上面的操作。 -在打孔卡上打印对应的字符这一设计让人很容易分辨出错误。但就像密歇根大学的视频中警告的那样,打孔卡上修正一个错误可不像擦掉一个打印的字符然后再写上一个新的那样容易,因为计算机只会根据卡片上的孔来读取信息。因为被打出的孔不能被复原unpunched,所以并不能直接退回一列然后再打上一个新的字符。打出更多的孔也只能让这一列的组合变成一个无效字符。 IBM 029 型打孔机上虽然有一个可以让打孔卡回退一列的退格按键,但这个按键被放置在机器上而非在键盘上。这样的设计也许是为了阻止这个按键的使用,因为实际上很少有用户需要这个功能。 +在打孔卡上打印对应的字符这一设计让人很容易分辨出错误。但就像密歇根大学的视频中警告的那样,打孔卡上修正一个错误可不像擦掉一个打印的字符然后再写上一个新的那样容易,因为计算机只会根据卡片上的孔来读取信息。因为被打出的孔不能被复原unpunched,所以并不能直接退回一列然后再打上一个新的字符。打出更多的孔也只能让这一列的组合变成一个无效字符。 IBM 029 型打孔机上虽然有一个可以让打孔卡回退一列的退格按键,但这个按键被放置在机器上而非在键盘上。这样的设计也许是为了阻止这个按键的使用,因为实际上很少有用户需要这个功能。 实际上,只有废弃错误的打孔卡再在新的打孔卡上重新打孔这一种修正错误的方式。这就是阅读区的用武之处了。当你发现打孔卡上的第 68 列出错时,你需要在新的打孔卡上小心的给前 67 列打孔,然后给第 68 列打上正确的字母。另一种操作方式是把带有错误信息的打孔卡放在阅读区,同时在打孔操作区载入一张新的打孔卡,然后按下 “重复DUP (for duplicate)” 按键直到列数指示器显示 68 列。这时按下正确的字符来修正错误。阅读区和重复按键使得 029 型打孔机很容易复制打孔卡上的内容。当然,这一功能的使用可能有各种各样的原因,但改错是最常见的。 From 9a7e0dce391e93e9566f04297cdaef29ceff1ff8 Mon Sep 17 00:00:00 2001 From: wwhio Date: Thu, 20 Dec 2018 00:59:32 +0800 Subject: [PATCH 0195/4278] =?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=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translated/talk/20180623 The IBM 029 Card Punch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/talk/20180623 The IBM 029 Card Punch.md b/translated/talk/20180623 The IBM 029 Card Punch.md index f905ee1481..e13a10593c 100644 --- a/translated/talk/20180623 The IBM 029 Card Punch.md +++ b/translated/talk/20180623 The IBM 029 Card Punch.md @@ -13,7 +13,7 @@ IBM 029 型打孔机 ![][1] IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件发售的。 System/360 是计算系统与外设所组成的一个系列,在 20 世纪 60 年代晚期,它几乎垄断了整个大型计算机市场。就像其它 System/360 外设一样, 029 型打孔机也是个大块头。那时,计算机和家具的界限还很模糊,但 029 型打孔机可不是那种会占领你的整张桌子的机器。它改进自 026 型打孔机,增加了新的字符支持,如括号,总体上也更加安静。与前辈 026 型所展出 20 世纪 40 年代的圆形按钮与工业化的样貌相比, 029 型的按键方正扁平、功能按键还有酷炫的蓝色高亮提示。它的另一个重要买点是它能够在数字区numeric fields左侧自动的填充 0 ,这证明了 JavaScript 程序员不是第一批懒得自己做左填充left-padding的程序员。 -(译者注:这项功能需要额外的 4 张 [标准模块系统卡SMS card](https://en.wikipedia.org/wiki/IBM_Standard_Modular_System)才能使用。例如数字区长度为 6 时,操作员只需要输入 73 ,打孔机会自动填充起始位置上的 4 个 0 ,故最终输出 000073。[更多信息](https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch)) +(译者注:这项功能需要额外的 4 张 [标准模块系统卡SMS card](https://en.wikipedia.org/wiki/IBM_Standard_Modular_System)才能使用。例如设置数字区域长度为 6 列时,操作员只需要输入 73 ,打孔机会自动填充起始位置上的 4 个 0 ,故最终输出 000073。[更多信息](https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch)) 等等!你说的是 IBM 在 1964 年发布了全新的打孔机?你知道那张在贝尔实验室拍摄的 Unix 之父正在使用电传打字机的照片吗?那是哪一年的来着?1970?打孔机不是应该在 20 世纪 60 年代中期到晚期时就过时了吗?是的,你也许会奇怪,为什么直到 1984 年, IBM 的产品目录中才出现 029 型打孔机的身影。事实上,直到 20 世纪 70 年代,大多数程序员仍然在使用打孔卡编程。其实二战期间就已经有人在用电传打字机了,可那时并没能普及。客观的讲,电传打字机几乎和打孔卡一样古老。也许和你想象的恰恰相反,并不是电传打字机本身限制了他的普及,而是计算时间。人们拒绝使用电传打字机的原因是,它是可交互的,它和计算机使用“在线”的传输方式"online" mode of communication。在以 Unix 为代表的分时操作系统被发明前,你和电脑的交互会被任何人的使用而打断,而这一点延迟通常意味着几千美元的损失。所以程序员们普遍选择离线地使用打孔机编程,再将打孔卡放入大型计算机中,作为批任务batch job执行。在那时,还没有即廉价又可靠的存储设备,可打孔卡的廉价优势已经足够让他成为那时最流行的数据存储方式了。那时的程序是书架上一落的打孔卡而不是硬盘里的一堆文件。 From d12dfbfd5465731b90ad51d3c8ed9b8e98cffe65 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 20 Dec 2018 08:52:51 +0800 Subject: [PATCH 0196/4278] translated --- ...to The Matrix at the Linux command line.md | 54 ------------------- ...to The Matrix at the Linux command line.md | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 sources/tech/20181212 Patch into The Matrix at the Linux command line.md create mode 100644 translated/tech/20181212 Patch into The Matrix at the Linux command line.md diff --git a/sources/tech/20181212 Patch into The Matrix at the Linux command line.md b/sources/tech/20181212 Patch into The Matrix at the Linux command line.md deleted file mode 100644 index 108fb7c97d..0000000000 --- a/sources/tech/20181212 Patch into The Matrix at the Linux command line.md +++ /dev/null @@ -1,54 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Patch into The Matrix at the Linux command line) -[#]: via: (https://opensource.com/article/18/12/linux-toy-cmatrix) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Patch into The Matrix at the Linux command line -====== -Recreate the classic look and feel of everyone's favorite 1990s sci-fi movie code scroller with cmatrix. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cmatrix.png?itok=YlmbHVPr) - -You've found your way to today's entry from the Linux command-line toys advent calendar. If this is your first visit to the series, you might be wondering what a command-line toy even is? It's anything that's an entertaining diversion at the terminal, be it a game, a fun utility, or a simple distraction. - -Some of these are classics, and some are completely new (at least to me), but I hope all of you find something you enjoy in this series. - -As we come to the close of another year, it's a good time for looking back, and looking forward. What will 2019 hold for you? What does it mean to be 2019? - -I'm reminded that 2019 will mark the twentieth anniversary of one of my favorite science fiction movies from my teenage years, that at the time had me thinking a lot about what the future would hold: [The Matrix][1]. For a computer nerd kid like me, it was the ultimate story of a computer programmer rising up and becoming an action hero in a virtual universe by tapping into the power of his mind. - -At the time, there was no movie that seemed more futuristic to me; both in the story itself, and in the mesmerizing special effects. Realizing that it was filmed over twenty years ago doesn't change that in my mind. - -Bringing it back to our command-line toy for today, let's recreate the downward flowing code of the Matrix at our terminal with **cmatrix**. **cmatrix** was an easy install for me, packaged for Fedora, so installing it took simply: - -``` -$ dnf install cmatrix -``` - -Then, just type **cmatrix **at your terminal to run. -![](https://opensource.com/sites/default/files/uploads/linux-toy-cmatrix-animated.gif) -You can find the source code for **** **cmatrix** [on GitHub][2] under a GPL license. - -Do you have a favorite command-line toy that you think I ought to include? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Winterize your Bash prompt in Linux][3], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-cmatrix - -作者:[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://en.wikipedia.org/wiki/The_Matrix -[2]: https://github.com/abishekvashok/cmatrix -[3]: https://opensource.com/article/18/12/linux-toy-bash-prompt diff --git a/translated/tech/20181212 Patch into The Matrix at the Linux command line.md b/translated/tech/20181212 Patch into The Matrix at the Linux command line.md new file mode 100644 index 0000000000..1793ec25ad --- /dev/null +++ b/translated/tech/20181212 Patch into The Matrix at the Linux command line.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Patch into The Matrix at the Linux command line) +[#]: via: (https://opensource.com/article/18/12/linux-toy-cmatrix) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在命令行中步入黑客帝国 +====== +使用 cmatrix 重建每个人最喜欢的 20 世纪 90 年代科幻电影中滚动代码的经典外观。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cmatrix.png?itok=YlmbHVPr) + +你发现了今天的命令行玩具日历。如果这是你第一次访问该系列,你可能想知道什么是命令行玩具?它可以是在命令行中任何可以娱乐的东西,可以是一个游戏,一个有趣的工具,或者一个消遣的东西。 + +其中一些是经典,有些是全新的(至少对我而言),但我希望你们所有人都能在这个系列中找到你喜欢的东西。 + +在我们在接近下一年的时候,现在是回顾和期待的好时机。2019 年会为你带来什么?2019 年意味着什么? + +我想起 2019 年将是我青少年时期最喜欢的科幻电影之一[黑客帝国][1]的二十周年纪念日,它当时让我思考了未来将会发生什么。对于像我这样的痴迷计算机小孩来说,这是一个电脑程序员通过利用自己思维的力量崛起并成为虚拟宇宙中的动作英雄的终极故事。 + +当时,没有一部电影对我来说似乎更具未来感。无论是故事本身,还是迷人的特效。即使意识到它是在二十多年前拍摄的也并没有改变我的想法。 + +今天将它带回我们的命令行玩具,让我们在终端用 **cmatrix** 重建黑客帝国中那向下滚动的代码流。 **cmatrix** 对我来说很容易安装,它在 Fedora 中被打包了,所以安装它只需: + +``` +$ dnf install cmatrix +``` + +接着,只需在你的终端输入 **cmatrix** 即可运行。 +![](https://opensource.com/sites/default/files/uploads/linux-toy-cmatrix-animated.gif) +你可以在 [GitHub][2] 上找到使用 GPL 许可的 **cmatrix** 的源代码。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。评论留言让我知道,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +了解一下昨天的玩具,[在 Linux 中让 Bash 提示符变得像冬天][2],还有记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-cmatrix + +作者:[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://en.wikipedia.org/wiki/The_Matrix +[2]: https://github.com/abishekvashok/cmatrix +[3]: https://opensource.com/article/18/12/linux-toy-bash-prompt \ No newline at end of file From d32cebf5e13418d3503d69ab39076dad932ea782 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 20 Dec 2018 08:59:40 +0800 Subject: [PATCH 0197/4278] translating --- sources/tech/20181208 Play Tetris at your Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181208 Play Tetris at your Linux terminal.md b/sources/tech/20181208 Play Tetris at your Linux terminal.md index d3a94bcaf6..db1fe62c24 100644 --- a/sources/tech/20181208 Play Tetris at your Linux terminal.md +++ b/sources/tech/20181208 Play Tetris at your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c2550effc87eb921631245f2c7209043d7d4d8ad Mon Sep 17 00:00:00 2001 From: zjon Date: Thu, 20 Dec 2018 11:09:22 +0800 Subject: [PATCH 0198/4278] Update 20171012 7 Best eBook Readers for Linux.md zjon is translating 20171012 7 Best eBook Readers for Linux --- sources/tech/20171012 7 Best eBook Readers for Linux.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20171012 7 Best eBook Readers for Linux.md b/sources/tech/20171012 7 Best eBook Readers for Linux.md index 5198f1bdc0..9f69c6decb 100644 --- a/sources/tech/20171012 7 Best eBook Readers for Linux.md +++ b/sources/tech/20171012 7 Best eBook Readers for Linux.md @@ -1,3 +1,4 @@ +zjon is translating 7 Best eBook Readers for Linux ====== **Brief:** In this article, we are covering some of the best ebook readers for Linux. These apps give a better reading experience and some will even help in managing your ebooks. From 83278751d60a03c62e3dfe31a6d5bb8507078479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Thu, 20 Dec 2018 20:26:31 +0800 Subject: [PATCH 0199/4278] Create 20180912 How to turn on an LED with Fedora IoT.md --- ...2 How to turn on an LED with Fedora IoT.md | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 translated/tech/20180912 How to turn on an LED with Fedora IoT.md diff --git a/translated/tech/20180912 How to turn on an LED with Fedora IoT.md b/translated/tech/20180912 How to turn on an LED with Fedora IoT.md new file mode 100644 index 0000000000..59bbc1280b --- /dev/null +++ b/translated/tech/20180912 How to turn on an LED with Fedora IoT.md @@ -0,0 +1,201 @@ +# 如何使用 Fedora IoT 开启 LED 灯 + +![](https://fedoramagazine.org/wp-content/uploads/2018/08/LED-IoT-816x345.jpg) + +你喜欢 Fedora、容器和树莓派吗?这三者结合操控 LED 会怎么样?本文介绍的是 Fedora IoT,将展示如何在树莓派上安装预览镜像。还将学习如何与 GPIO 交互以开启 LED。 + +### 什么是 Fedora IoT? + +Fedora IoT 是当前 Fedora 项目的目标之一,计划成为一个完整的 Fedora 版本。Fedora IoT 将是一个在ARM(目前仅限 aarch64)例如树莓派,以及 x86_64 架构设备上运行的系统。 + +![][1] + +Fedora IoT 基于 OSTree 开发, 就像[Fedora Silverblue][2] 和以往的 [Atomic Host][3]. + +### 下载和安装 Fedora IoT + +官方 Fedora IoT 镜像将和 Fedora 29 一起发布。但是在此期间你可以下载 [Fedora 28-based 镜像][4] 来进行这个实验。 + +你有两种方法来安装这个系统:使用 dd 命令闪存SD卡,或者使用 fedora-arm-installer 工具。Fedora 的 Wiki 里面提供了更多关于[设置物理设备][5] 的信息来开发 IoT。另外,你可能需要调整第三个分区的大小。 + +把 SD 卡插入到设备并运行,需要创建一个用户来完成安装。这个步骤需要串行连接或带键盘的 HDMI 显示器来与设备进行交互。 + +当系统安装完成后,下一步就是要设置网络连接。使用你刚才创建的用户登录系统,可以使用下列方式之一完成网络连接设置: + +- 如果你需要手动配置你的网络,可能需要执行类似如下命令,需要保证设置正确的网络地址: + +``` + $ nmcli connection add con-name cable ipv4.addresses \ + 192.168.0.10/24 ipv4.gateway 192.168.0.1 \ + connection.autoconnect true ipv4.dns "8.8.8.8,1.1.1.1" \ + type ethernet ifname eth0 ipv4.method manual + +``` + +- 如果你网络上运行着 DHCP 服务,可能需要类似如下命令: + +``` + $ nmcli con add type ethernet con-name cable ifname eth0 +``` + + + +### **Fedora 中的 GPIO 接口** + +许多关于 Linux 上 GPIO 的教程都关注传统的 GPIO sysfis 接口。这个接口已经不推荐使用了,并且上游 Linux 内核社区由于安全和其他问题的缘故打算完全删除它。 + +Fedora 已经不将这个传统的接口编译到内核了,因此在系统上没有 /sys/class/gpio 这个文件。此教程使用一个上游内核提供的一个新的字符设备 /dev/gpiochipN 。这是目前和 GPIO 交互的方式。 + +为了和这个新设备进行交互,你需要使用一个库和一系列命令行界面工具。公共命令行工具比如说 echo 和 cat 在此设备上无法正常工作。 + +你可以通过安装 libgpiod-utils 包来安装命令行界面工具。python3-libgpiod 包提供了相应的 Python 库。 + +### **使用 Podman 来创建一个容器** + +[Podman][6] 是一个容器运行环境,其命令行界面类似于Docker。Podman的一大优势是它不会在后台运行任何守护进程。这对于资源有限的设备尤其有用。Podman 还允许您使用 systemd 单元文件启动容器化服务。此外,它还有许多其他功能。 + +我们使用如下两步来创建一个容器: + +``` +1. 创建包含所需包的分层镜像。 +2. 使用分层镜像创建一个新容器。 +``` + + + +首先创建一个 Dockerfile 文件,内容如下。这些内容告诉 podman 基于可使用的最新 Fedora 镜像来构建我们的分层镜像。然后就是更新系统和安装一些软件包: + +``` +FROM fedora:latest +RUN dnf -y update +RUN dnf -y install libgpiod-utils python3-libgpiod + +``` + +这样你就完成了镜像的生成前的配置工作,这个镜像基于最新的 Fedora,而且包含了和 GPIO 交互的软件包。 + +现在你就可以运行下方命令来构建你的基本镜像了: + +``` +$ sudo podman build --tag fedora:gpiobase -f ./Dockerfile + +``` + +你已经成功创建了你的自定义镜像。这样以后你就可以不用每次都重新搭建环境了,而是基于你创建的镜像来完成工作。 + +### 使用 Podman 完成工作 + +为了确认当前的镜像,可以运行下方命令: + +``` +$ sudo podman images +REPOSITORY TAG IMAGE ID CREATED SIZE +localhost/fedora gpiobase 67a2b2b93b4b 10 minutes ago 488MB +docker.io/library/fedora latest c18042d7fac6 2 days ago 300MB + +``` + +现在,启动容器并进行一些实际的实验。 容器通常是隔离的,无法访问主机系统,包括GPIO接口。 因此需要在启动容器时将其挂载在容器内。 可以使用以下命令中的 -device 选项来解决: + +``` +$ sudo podman run -it --name gpioexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash + +``` + +运行之后就进入了正在运行的容器中。 在继续之前,这里有一些容器命令。 输入 exit 或者按下 **Ctrl+D** 来退出容器。 + +显示所有存在的容器可以运行如下命令: + +``` +$ sudo podman container ls -a +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +64e661d5d4e8 localhost/fedora:gpiobase /bin/bash 37 seconds ago Exited (0) Less than a second ago gpioexperiment + +``` + +使用如下命令创建一个新的容器: + +``` +$ sudo podman run -it --name newexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash + +``` + +如果想删除容器可以使用如下命令: + +``` +$ sudo podman rm newexperiment + +``` + +### **开启 LED 灯** + +现在可以使用已创建的容器。 如果容器已经退出,请使用以下命令再次启动它: + +``` +$ sudo podman start -ia gpioexperiment + +``` + +如前所述,可以使用 Fedora 中 libgpiod-utils 包提供的 CLI 工具。 要列出可用的 GPIO 芯片可以使用如下命令: + +``` +$ gpiodetect +gpiochip0 [pinctrl-bcm2835] (54 lines) + +``` + +要获取特定芯片的公开列表,请运行: + +``` +$ gpioinfo gpiochip0 + +``` + +请注意,物理引脚数与前一个命令打印的行数之间没有相关性。 重要的是 BCM 编号,如 [pinout.xyz][7] 所示。 建议不要使用没有相应 BCM 编号的线路。 + +现在,将 LED 连接到物理引脚40,也就是 BCM 21。请记住:LED的短腿(负极,称为阴极)必须连接到带有330欧姆电阻的树莓派的 GND 引脚, 并且长腿(阳极)到物理引脚40。 + +运行以下命令打开LED。,按下 **Ctrl + C ** 关闭: + +``` +$ gpioset --mode=wait gpiochip0 21=1 + +``` + +要点亮一段时间,请添加 -b(在后台运行)和 -s NUM(多少秒)参数,如下所示。 例如,要点亮 LED 5秒钟,运行如下命令: + +``` +$ gpioset -b -s 5 --mode=time gpiochip0 21=1 + +``` + +另一个有用的命令是 gpioget。 它可以获得引脚的状态(高或低),可用于检测按钮和开关。 + +![Closeup of LED connection with GPIO][8] + +### **总结** + +你也可以使用 Python 操控 LED - [这里有一些例子][9]。 也可以在容器内使用 i2c 设备。 此外,Podman 与此 Fedora 版本并不严格相关。 你可以在任何现有的 Fedora Edition 上安装它,或者在 Fedora 中使用两个基于 OSTree 的新系统进行尝试:[Fedora Silverblue][2] 和 [Fedora CoreOS][10]。 + +------ + +via: https://fedoramagazine.org/turnon-led-fedora-iot/ + +作者:[Alessio Ciregia][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[ScarboroughCoral](https://github.com/ScarboroughCoral) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://alciregi.id.fedoraproject.org/ +[1]: https://fedoramagazine.org/wp-content/uploads/2018/08/oled-1024x768.png +[2]: https://teamsilverblue.org/ +[3]: https://www.projectatomic.io/ +[4]: https://kojipkgs.fedoraproject.org/compose/iot/latest-Fedora-IoT-28/compose/IoT/ +[5]: https://fedoraproject.org/wiki/InternetOfThings/GettingStarted#Setting_up_a_Physical_Device +[6]: https://github.com/containers/libpod +[7]: https://pinout.xyz/ +[8]: https://fedoramagazine.org/wp-content/uploads/2018/08/breadboard-1024x768.png +[9]: https://github.com/brgl/libgpiod/tree/master/bindings/python/examples +[10]: https://coreos.fedoraproject.org/ From 3c68a0d9d6b73f7ebd64bc1bca2a51bdc59cdb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Thu, 20 Dec 2018 20:28:22 +0800 Subject: [PATCH 0200/4278] Delete 20180912 How to turn on an LED with Fedora IoT.md --- ...2 How to turn on an LED with Fedora IoT.md | 202 ------------------ 1 file changed, 202 deletions(-) delete mode 100644 sources/tech/20180912 How to turn on an LED with Fedora IoT.md diff --git a/sources/tech/20180912 How to turn on an LED with Fedora IoT.md b/sources/tech/20180912 How to turn on an LED with Fedora IoT.md deleted file mode 100644 index 5f1843fc83..0000000000 --- a/sources/tech/20180912 How to turn on an LED with Fedora IoT.md +++ /dev/null @@ -1,202 +0,0 @@ -Translating by ScarboroughCoral -How to turn on an LED with Fedora IoT -====== - -![](https://fedoramagazine.org/wp-content/uploads/2018/08/LED-IoT-816x345.jpg) - -Do you enjoy running Fedora, containers, and have a Raspberry Pi? What about using all three together to play with LEDs? This article introduces Fedora IoT and shows you how to install a preview image on a Raspberry Pi. You’ll also learn how to interact with GPIO in order to light up an LED. - -### What is Fedora IoT? - -Fedora IoT is one of the current Fedora Project objectives, with a plan to become a full Fedora Edition. The result will be a system that runs on ARM (aarch64 only at the moment) devices such as the Raspberry Pi, as well as on the x86_64 architecture. - -![][1] - -Fedora IoT is based on OSTree, like [Fedora Silverblue][2] and the former [Atomic Host][3]. - -### Download and install Fedora IoT - -The official Fedora IoT images are coming with the Fedora 29 release. However, in the meantime you can download a [Fedora 28-based image][4] for this experiment. - -You have two options to install the system: either flash the SD card using a dd command, or use a fedora-arm-installer tool. The Fedora Wiki offers more information about [setting up a physical device][5] for IoT. Also, remember that you might need to resize the third partition. - -Once you insert the SD card into the device, you’ll need to complete the installation by creating a user. This step requires either a serial connection, or a HDMI display with a keyboard to interact with the device. - -When the system is installed and ready, the next step is to configure a network connection. Log in to the system with the user you have just created choose one of the following options: - - * If you need to configure your network manually, run a command similar to the following. Remember to use the right addresses for your network: -``` - $ nmcli connection add con-name cable ipv4.addresses \ - 192.168.0.10/24 ipv4.gateway 192.168.0.1 \ - connection.autoconnect true ipv4.dns "8.8.8.8,1.1.1.1" \ - type ethernet ifname eth0 ipv4.method manual - -``` - - * If there’s a DHCP service on your network, run a command like this: - -``` - $ nmcli con add type ethernet con-name cable ifname eth0 -``` - - - - -### **The GPIO interface in Fedora** - -Many tutorials about GPIO on Linux focus on a legacy GPIO sysfis interface. This interface is deprecated, and the upstream Linux kernel community plan to remove it completely, due to security and other issues. - -The Fedora kernel is already compiled without this legacy interface, so there’s no /sys/class/gpio on the system. This tutorial uses a new character device /dev/gpiochipN provided by the upstream kernel. This is the current way of interacting with GPIO. - -To interact with this new device, you need to use a library and a set of command line interface tools. The common command line tools such as echo or cat won’t work with this device. - -You can install the CLI tools by installing the libgpiod-utils package. A corresponding Python library is provided by the python3-libgpiod package. - -### **Creating a container with Podman** - -[Podman][6] is a container runtime with a command line interface similar to Docker. The big advantage of Podman is it doesn’t run any daemon in the background. That’s especially useful for devices with limited resources. Podman also allows you to start containerized services with systemd unit files. Plus, it has many additional features. - -We’ll create a container in these two steps: - - 1. Create a layered image containing the required packages. - 2. Create a new container starting from our image. - - - -First, create a file Dockerfile with the content below. This tells podman to build an image based on the latest Fedora image available in the registry. Then it updates the system inside and installs some packages: - -``` -FROM fedora:latest -RUN  dnf -y update -RUN  dnf -y install libgpiod-utils python3-libgpiod - -``` - -You have created a build recipe of a container image based on the latest Fedora with updates, plus packages to interact with GPIO. - -Now, run the following command to build your base image: - -``` -$ sudo podman build --tag fedora:gpiobase -f ./Dockerfile - -``` - -You have just created your custom image with all the bits in place. You can play with this base container images as many times as you want without installing the packages every time you run it. - -### Working with Podman - -To verify the image is present, run the following command: - -``` -$ sudo podman images -REPOSITORY                 TAG        IMAGE ID       CREATED          SIZE -localhost/fedora           gpiobase   67a2b2b93b4b   10 minutes ago  488MB -docker.io/library/fedora   latest     c18042d7fac6   2 days ago     300MB - -``` - -Now, start the container and do some actual experiments. Containers are normally isolated and don’t have an access to the host system, including the GPIO interface. Therefore, you need to mount it inside while starting the container. To do this, use the –device option in the following command: - -``` -$ sudo podman run -it --name gpioexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash - -``` - -You are now inside the running container. Before you move on, here are some more container commands. For now, exit the container by typing exit or pressing **Ctrl+D**. - -To list the the existing containers, including those not currently running, such as the one you just created, run: - -``` -$ sudo podman container ls -a -CONTAINER ID   IMAGE             COMMAND     CREATED          STATUS                              PORTS   NAMES -64e661d5d4e8   localhost/fedora:gpiobase   /bin/bash 37 seconds ago Exited (0) Less than a second ago           gpioexperiment - -``` - -To create a new container, run this command: - -``` -$ sudo podman run -it --name newexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash - -``` - -Delete it with the following command: - -``` -$ sudo podman rm newexperiment - -``` - -### **Turn on an LED** - -Now you can use the container you already created. If you exited from the container, start it again with this command: - -``` -$ sudo podman start -ia gpioexperiment - -``` - -As already discussed, you can use the CLI tools provided by the libgpiod-utils package in Fedora. To list the available GPIO chips, run: - -``` -$ gpiodetect -gpiochip0 [pinctrl-bcm2835] (54 lines) - -``` - -To get the list of the lines exposed by a specific chip, run: - -``` -$ gpioinfo gpiochip0 - -``` - -Notice there’s no correlation between the number of physical pins and the number of lines printed by the previous command. What’s important is the BCM number, as shown on [pinout.xyz][7]. It is not advised to play with the lines that don’t have a corresponding BCM number. - -Now, connect an LED to the physical pin 40, that is BCM 21. Remember: the shorter leg of the LED (the negative leg, called the cathode) must be connected to a GND pin of the Raspberry Pi with a 330 ohm resistor, and the long leg (the anode) to the physical pin 40. - -To turn the LED on, run the following command. It will stay on until you press **Ctrl+C** : - -``` -$ gpioset --mode=wait gpiochip0 21=1 - -``` - -To light it up for a certain period of time, add the -b (run in the background) and -s NUM (how many seconds) parameters, as shown below. For example, to light the LED for 5 seconds, run: - -``` -$ gpioset -b -s 5 --mode=time gpiochip0 21=1 - -``` - -Another useful command is gpioget. It gets the status of a pin (high or low), and can be useful to detect buttons and switches. - -![Closeup of LED connection with GPIO][8] - -### **Conclusion** - -You can also play with LEDs using Python — [there are some examples here][9]. And you can also use the i2c devices inside the container as well. In addition, Podman is not strictly related to this Fedora edition. You can install it on any existing Fedora Edition, or try it on the two new OSTree-based systems in Fedora: [Fedora Silverblue][2] and [Fedora CoreOS][10]. - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/turnon-led-fedora-iot/ - -作者:[Alessio Ciregia][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]: http://alciregi.id.fedoraproject.org/ -[1]: https://fedoramagazine.org/wp-content/uploads/2018/08/oled-1024x768.png -[2]: https://teamsilverblue.org/ -[3]: https://www.projectatomic.io/ -[4]: https://kojipkgs.fedoraproject.org/compose/iot/latest-Fedora-IoT-28/compose/IoT/ -[5]: https://fedoraproject.org/wiki/InternetOfThings/GettingStarted#Setting_up_a_Physical_Device -[6]: https://github.com/containers/libpod -[7]: https://pinout.xyz/ -[8]: https://fedoramagazine.org/wp-content/uploads/2018/08/breadboard-1024x768.png -[9]: https://github.com/brgl/libgpiod/tree/master/bindings/python/examples -[10]: https://coreos.fedoraproject.org/ From ccff8ae5e89141ad282f78a42bfe3c58950dc78f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 20 Dec 2018 22:15:39 +0800 Subject: [PATCH 0201/4278] PRF:20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md @geekpi --- ...roken Ubuntu OS Without Reinstalling It.md | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md b/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md index 2fbdc6f07e..858862096e 100644 --- a/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md +++ b/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (How To Fix Broken Ubuntu OS Without Reinstalling It) [#]: via: (https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-it/) @@ -18,29 +18,20 @@ 首先,尝试使用 live cd 登录并**在外部驱动器中备份数据**。以防这个方法没用,你仍然可以获取数据并重新安装系统! -在登录页上,按下 **CTRL+ALT+F1** 切换到 **tty1**。你可以在[**此处**][1]了解有关在 TTY 之间切换的更多信息。 +在登录页上,按下 `CTRL+ALT+F1` 切换到 tty1。你可以在[此处][1]了解有关在 TTY 之间切换的更多信息。 现在,逐个输入以下命令来修复损坏的 Ubuntu Linux。 ``` $ sudo rm /var/lib/apt/lists/lock - $ sudo rm /var/lib/dpkg/lock - $ sudo rm /var/lib/dpkg/lock-frontend - $ sudo dpkg --configure -a - $ sudo apt clean - $ sudo apt update --fix-missing - $ sudo apt install -f - $ sudo dpkg --configure -a - $ sudo apt upgrade - $ sudo apt dist-upgrade ``` @@ -52,7 +43,7 @@ $ sudo reboot 你现在可以像往常一样登录到你的 Ubuntu 系统。 -我做完这些步骤后,我 Ubuntu 18.04 测试系统中的所有数据都还在,一切都之前的一样。此方法可能不适用于所有人。但是,这个小小的贴士对我有用,并且比重装节省了一些时间。如果你了解其他更好的方法,请在评论区告诉我。我也会在本指南中添加它们。 +我做完这些步骤后,我 Ubuntu 18.04 测试系统中的所有数据都还在,一切都之前的一样。此方法可能不适用于所有人。但是,这个小小的技巧对我有用,并且比重装节省了一些时间。如果你了解其他更好的方法,请在评论区告诉我。我也会在本指南中添加它们。 这是这些了。希望这篇文章有用。 @@ -69,10 +60,10 @@ via: https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling- 作者:[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/) 荣誉推出 [a]: https://www.ostechnix.com/author/sk/ [b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/ \ No newline at end of file +[1]: https://www.ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/ From b84383d0c6c5243606f103ae11a70a76f8efee3a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 20 Dec 2018 22:16:47 +0800 Subject: [PATCH 0202/4278] PUB:20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md @geekpi https://linux.cn/article-10367-1.html --- ...205 How To Fix Broken Ubuntu OS Without Reinstalling It.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md (97%) diff --git a/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md b/published/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md similarity index 97% rename from translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md rename to published/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md index 858862096e..4db620bf58 100644 --- a/translated/tech/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md +++ b/published/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (How To Fix Broken Ubuntu OS Without Reinstalling It) [#]: via: (https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-it/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10367-1.html) 如何不重装修复损坏的 Ubuntu 系统 ====== From 39ffd0e98559e69ca53f58784373ebe2f81d7a63 Mon Sep 17 00:00:00 2001 From: jlztan Date: Thu, 20 Dec 2018 22:20:41 +0800 Subject: [PATCH 0203/4278] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20PR=EF=BC=9A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=B4=E9=83=A8=E7=9A=84=E5=85=83=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...brate Christmas In Linux Way With These Wallpapers.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md index 1132a52058..3c282ce7d5 100644 --- a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md +++ b/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @@ -1,3 +1,12 @@ +[#]: collector: (lujun9972) +[#]: translator: (jlztan) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Celebrate Christmas In Linux Way With These Wallpapers) +[#]: via: (https://itsfoss.com/christmas-linux-wallpaper/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) +[#]: url: ( ) + 使用这些壁纸以 Linux 的方式庆祝圣诞节 ====== From a99040998a1f6e1b2b9cedf7687234f9915cfd4a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 20 Dec 2018 22:26:02 +0800 Subject: [PATCH 0204/4278] PRF:20181212 Patch into The Matrix at the Linux command line.md @geekpi --- ...to The Matrix at the Linux command line.md | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181212 Patch into The Matrix at the Linux command line.md b/translated/tech/20181212 Patch into The Matrix at the Linux command line.md index 1793ec25ad..9660bf046d 100644 --- a/translated/tech/20181212 Patch into The Matrix at the Linux command line.md +++ b/translated/tech/20181212 Patch into The Matrix at the Linux command line.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Patch into The Matrix at the Linux command line) @@ -9,10 +9,12 @@ 在命令行中步入黑客帝国 ====== -使用 cmatrix 重建每个人最喜欢的 20 世纪 90 年代科幻电影中滚动代码的经典外观。 + +> 使用 cmatrix 重建每个人都喜欢的 20 世纪 90 年代科幻电影中滚动代码的经典外观。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cmatrix.png?itok=YlmbHVPr) -你发现了今天的命令行玩具日历。如果这是你第一次访问该系列,你可能想知道什么是命令行玩具?它可以是在命令行中任何可以娱乐的东西,可以是一个游戏,一个有趣的工具,或者一个消遣的东西。 +这是今天的命令行玩具日历推荐项目。如果这是你第一次访问该系列,你可能想知道什么是命令行玩具?它可以是在命令行中任何可以娱乐的东西,可以是一个游戏,一个有趣的工具,或者一个消遣的东西。 其中一些是经典,有些是全新的(至少对我而言),但我希望你们所有人都能在这个系列中找到你喜欢的东西。 @@ -20,17 +22,19 @@ 我想起 2019 年将是我青少年时期最喜欢的科幻电影之一[黑客帝国][1]的二十周年纪念日,它当时让我思考了未来将会发生什么。对于像我这样的痴迷计算机小孩来说,这是一个电脑程序员通过利用自己思维的力量崛起并成为虚拟宇宙中的动作英雄的终极故事。 -当时,没有一部电影对我来说似乎更具未来感。无论是故事本身,还是迷人的特效。即使意识到它是在二十多年前拍摄的也并没有改变我的想法。 +当时,对我来说没有比这部电影更具未来感了。无论是故事本身,还是迷人的特效。即使意识到它是在二十多年前拍摄的也并没有改变我的想法。 -今天将它带回我们的命令行玩具,让我们在终端用 **cmatrix** 重建黑客帝国中那向下滚动的代码流。 **cmatrix** 对我来说很容易安装,它在 Fedora 中被打包了,所以安装它只需: +今天将它带回我们的命令行玩具,让我们在终端用 `cmatrix` 重建黑客帝国中那向下滚动的代码流。 `cmatrix` 很容易安装,它在 Fedora 中被打包了,所以安装它只需: ``` $ dnf install cmatrix ``` -接着,只需在你的终端输入 **cmatrix** 即可运行。 +接着,只需在你的终端输入 `cmatrix` 即可运行。 + ![](https://opensource.com/sites/default/files/uploads/linux-toy-cmatrix-animated.gif) -你可以在 [GitHub][2] 上找到使用 GPL 许可的 **cmatrix** 的源代码。 + +你可以在 [GitHub][2] 上找到使用 GPL 许可的 `cmatrix` 的源代码。 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。评论留言让我知道,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -43,7 +47,7 @@ via: https://opensource.com/article/18/12/linux-toy-cmatrix 作者:[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/) 荣誉推出 @@ -51,4 +55,4 @@ via: https://opensource.com/article/18/12/linux-toy-cmatrix [b]: https://github.com/lujun9972 [1]: https://en.wikipedia.org/wiki/The_Matrix [2]: https://github.com/abishekvashok/cmatrix -[3]: https://opensource.com/article/18/12/linux-toy-bash-prompt \ No newline at end of file +[3]: https://opensource.com/article/18/12/linux-toy-bash-prompt From cf6fc9935c5903a66f7daaaf932052d77dc28479 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 20 Dec 2018 22:27:30 +0800 Subject: [PATCH 0205/4278] PUB:20181212 Patch into The Matrix at the Linux command line.md @geekpi https://linux.cn/article-10368-1.html --- .../20181212 Patch into The Matrix at the Linux command line.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181212 Patch into The Matrix at the Linux command line.md (100%) diff --git a/translated/tech/20181212 Patch into The Matrix at the Linux command line.md b/published/20181212 Patch into The Matrix at the Linux command line.md similarity index 100% rename from translated/tech/20181212 Patch into The Matrix at the Linux command line.md rename to published/20181212 Patch into The Matrix at the Linux command line.md From eb69ee153ff6179759dad824fcdf2c253080127d Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Thu, 20 Dec 2018 22:41:16 +0800 Subject: [PATCH 0206/4278] commit --- ...en solutions to everything in education.md | 113 ------------------ ...en solutions to everything in education.md | 110 +++++++++++++++++ 2 files changed, 110 insertions(+), 113 deletions(-) delete mode 100644 sources/tech/20180101 27 open solutions to everything in education.md create mode 100644 translated/tech/20180101 27 open solutions to everything in education.md diff --git a/sources/tech/20180101 27 open solutions to everything in education.md b/sources/tech/20180101 27 open solutions to everything in education.md deleted file mode 100644 index eeba3692e4..0000000000 --- a/sources/tech/20180101 27 open solutions to everything in education.md +++ /dev/null @@ -1,113 +0,0 @@ -translating by lixinyuxx - -27 open solutions to everything in education -====== -![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo) - -Openness (from open source software, to open hardware, to open principles) is changing the paradigm of education. So, to celebrate all that's gone on this year, I collected 27 of the best articles published on Opensource.com in 2017 on the subject. I divided them into broad themes, rather than ordering them by popularity. And, if these 27 stories don't satisfy your appetite for information about open source in education, check out our companion article on how [education is leveraging Raspberry Pi and Linux][30]. - -### Open is better for everyone - -1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt reviews David Price's book OPEN, which explores the idea that "open" isn't just a technological shift, rather it's "how we'll work, live, and learn in the future." - -2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur points out how to get ahead in the workforce by learning open source. This advice isn't just for programmers; designers, writers, marketers, and other creative professionals are also essential to the success of open source. - -3. [A graduate degree could springboard you into an open source job][3]: Citing research that shows that Linux skills lead to higher pay, Joshua Pearce makes the case that open source proficiency and a graduate degree are an unbeatable career combination. - -4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger shows us how open practices are creating a more inclusive, agile, and open culture in a Pennsylvania school district. Charlie says it's not just about saving money; the district also gains from "open leadership principles that foster innovation among teachers and students, help to better engage the community, and create a more vibrant and inclusive learning community." - -5. [15 ways to empower students with open source tools][5]: I write how open source gives students the freedom to explore, tinker, and learn, whether they're learning basic digital literacy or expanding on those skills with fun projects. - -6. [Developer opportunities to code for good][6]: Open source is often the backbone of socially beneficial projects. As Ahn Bui, vice president of Benetech Labs, states in this interview: "Establishing open data standards is an integral step in breaking down data silos. Those open standards will provide the foundation for interoperability and in turn, translate to more organizations building together, often more cost effectively. The ultimate goal is to serve more people at the same cost or even less." - -### Open education resources for remixing and reusing - -1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis, director of programs for Wiki Ed, discusses how open educational resources (OERs), such as Wiki Ed, are providing high-quality and affordable open source learning resources as classroom teaching tools. - -2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green, director of open education for Creative Commons, shares how the face of education is changing in higher education and what Creative Commons is doing to facilitate it. - -3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites, community evangelist and chief marketing officer of Open Up Resources, talks about the nonprofit organization's efforts to provide open, standards-aligned curricula for K-12 schools. - -4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke, educational technologist at the University of Hawaii at Manoa, says that transitioning to OER in college courses will "empower faculty to take control of what content they teach with, which we expect will result in their saving students money." - -5. [How open courses are slashing the cost of higher education][11]: Saylor Academy's director of education Devon Ritter reports how Saylor is building its college credit-eligible courses on openly licensed content, with the goal of making higher education affordable and accessible to more people. - -6. [Open educational resources movement gains speed][12]: Alexis Clifton, executive director of the State University of New York OER Services, describes how New York's US$ 8 million investment is spurring growth in open education and making college more affordable. - -7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik from Duke University explores OSPRI (Open Source Pedagogy Research and Innovation), a collaboration between Duke and Red Hat that's building a 21st-century, preK-12 learning ecosystem that is open by design. - -8. [Perma.cc stops scholarly link rot][14]: Virginia Tech's Phillip Young writes about Perma.cc, a solution to "link rot," which is the high probability that hyperlinks in academic papers will disappear or change over time. - -9. [Open education: How students save money by creating open textbooks][15]: OER pioneer Robin DeRosa talks about "the freedom that the openly licensed textbook introduced, and the overarching idea that education and learning should be contextualized in inclusive ecosystems that enhance the public good." - -### Open source tools in the classroom - -1. [How an open source board game is saving the planet][16]: Joshua Pearce writes about Save the Planet, a board game that empowers students to solve environmental problems while having fun and contributing to the maker community. - -2. [A new Android app for teaching kids how to read][17]: Michael Hall talks about Phoenicia, a children's literacy app he developed after his son was diagnosed with autism, the value of coding for good, and why user testing matters more than you think. - -3. [8 open source Android apps for education][18]: Joshua Allen Holm challenges us to use our smartphones as learning tools by recommending eight open source apps from the F-Droid repository to try. - -4. [3 open source alternatives to MATLAB][19]: Jason Baker's update to his 2016 survey of open source mathematical computing software presents alternatives to MATLAB, the expensive, proprietary solution nearly ubiquitous in mathematics, physical sciences, engineering, and economics. - -5. [What does SVG have to do with teaching kids to code?][20] Retired engineer Jay Nick talks about how he uses art as a creative way to introduce students to coding. He volunteers in schools, using Scalable Vector Graphics (SVG) to teach an approach to coding that combines principles of mathematics and art. - -6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, who holds a PhD in fine arts from Texas Tech, shares his experience using open source tools in a world ruled by proprietary solutions. Kyle says there's a bias against using open source in disciplines outside of computer science: "Many people think non-technical students can't use Linux, and they make a lot of assumptions about people who use it in their advanced degree programs. … Well, it is possible, and I'm proof." - -7. [A list of open source tools for college][22]: Aaron Cocker outlines the open source tools (including presentation, backup, and programming software) he uses while working on his undergraduate degree in computer science. - -8. [5 great KDE apps to help you study][23]: Zsolt Szakács offers five KDE applications that help anyone who wants to learn new skills or cultivate existing ones. - -### Coding in the classroom - -1. [How to get the next generation coding early][24]: Bryson Payne says we need to teach kids to code before high school: By ninth grade 80% of girls and 60% of boys have already self-selected out of a STEM career. But it's not only about jobs and closing the IT skills gap, he suggests. "Teaching a young person to code could be the single most life-changing skill you can give them. And it's not just a career-enhancer. Coding is about problem-solving, it's about creativity, and more importantly, it's about empowerment." - -2. [Kids can't code without computers][25]: Patrick Masson introduces the FLOSS Desktops for Kids program, which teaches students at underserved schools to repurpose older computers with open source software, such as Linux, LibreOffice, and GIMP. Not only is the program breathing new life into broken or decommissioned hardware, it's also giving students important skills that may translate into future careers. - -3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva offers suggestions for using [Scratch][27] to spark kids' interest in programming, just as LOGO did when he started using it in the 1980s. - -4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger describes App Inventor, a programming framework for building Android applications using a visual blocks language (similar to Scratch or [Snap][29]). - -Throughout the year we learned that there is an open solution to everything in education, and I expect this theme to continue in 2018 and beyond. Are there open education topics you'd like Opensource.com to cover in the coming year? If so, please share your ideas in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/best-open-education - -作者:[Don Watkins][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/don-watkins -[1]:https://opensource.com/article/17/7/book-review-open -[2]:https://opensource.com/article/17/8/jump-start-your-career -[3]:https://opensource.com/article/17/1/grad-school-open-source-academic-lab -[4]:https://opensource.com/article/17/7/open-school-leadership -[5]:https://opensource.com/article/17/7/empower-students-open-source-tools -[6]:https://opensource.com/article/17/3/interview-anh-bui-benetech-labs -[7]:https://opensource.com/article/17/1/Wiki-Education-Foundation -[8]:https://opensource.com/article/17/2/future-textbooks-cable-green-creative-commons -[9]:https://opensource.com/article/17/1/open-up-resources -[10]:https://opensource.com/article/17/2/interview-education-billy-meinke -[11]:https://opensource.com/article/17/7/college-alternatives -[12]:https://opensource.com/article/17/10/open-educational-resources-alexis-clifton -[13]:https://opensource.com/article/17/3/education-should-be-open-design -[14]:https://opensource.com/article/17/9/stop-link-rot-permacc -[15]:https://opensource.com/article/17/11/creating-open-textbooks -[16]:https://opensource.com/article/17/7/save-planet-board-game -[17]:https://opensource.com/article/17/4/phoenicia-education-software -[18]:https://opensource.com/article/17/8/8-open-source-android-apps-education -[19]:https://opensource.com/alternatives/matlab -[20]:https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam -[21]:https://opensource.com/article/17/5/how-linux-higher-education -[22]:https://opensource.com/article/17/6/open-source-tools-university-student -[23]:https://opensource.com/article/17/6/kde-education-software -[24]:https://opensource.com/article/17/8/teach-kid-code-change-life -[25]:https://opensource.com/article/17/9/floss-desktops-kids -[26]:https://opensource.com/article/17/3/logo-scratch-teach-programming-kids -[27]:https://scratch.mit.edu/ -[28]:https://opensource.com/article/17/8/app-inventor-android-app-development -[29]:http://snap.berkeley.edu/ -[30]:https://opensource.com/article/17/12/best-opensourcecom-linux-and-raspberry-pi-education diff --git a/translated/tech/20180101 27 open solutions to everything in education.md b/translated/tech/20180101 27 open solutions to everything in education.md new file mode 100644 index 0000000000..43f4717c1f --- /dev/null +++ b/translated/tech/20180101 27 open solutions to everything in education.md @@ -0,0 +1,110 @@ +27个解决教学问题的开放式方法 +====== +![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo) + +开放式理念 (从开源软件到开放硬件, 再到开放原则) 正在改变教育的范式。因此, 为了庆祝今年发生的一切, 我收集了2017年在 Opensource.com 上发表的27篇关于这个主题的最好的文章。我把它们分成明确的主题, 而不是按人气来分类。而且, 如果这27个故事不能满足你对教育公开信息的胃口, 那就看看我们的合作文章吧 “ [education is leveraging Raspberry Pi and Linux][30]” + +### 开放对每个人都有好处 + +1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt 评价David Price 的书 'OPEN' ,该书探讨了 “开放” 不仅仅是技术转变的观点, 而是 “我们未来将如何工作、生活和学习”。 + +2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur 指出了如何利用开放式学习在工作群体中脱颖而出。 这个建议不仅仅是针对程序员的, 而是针对程序员的。设计师、作家、营销人员和其他创意专业人士也是开放式成功的关键。 + +3. [A graduate degree could springboard you into an open source job][3]: 引用的研究表明会 Linux 技能会带来更高的薪水, Joshua Pearce 说对开源的熟练和研究生学位是无与伦比的职业技能组合。 + +4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger 向我们展示了开放的做法是如何在宾夕法尼亚州的一个学区创造一种更具包容性、敏捷性和开放性的文化的。 Charlie 说, 这不仅仅是为了省钱;该区还受益于 “开放式领导原则, 促进师生创新, 帮助更好地吸引社区, 创造一个更有活力和包容性的学习社区”。 + +5. [15 ways to empower students with open source tools][5]: 我写开源是如何让学生自由探索、补拙和学习的, 不管他们是在学习基本的数字化素养, 还是通过有趣的项目来扩展这些技能。 + +6. [Developer opportunities to code for good][6]: 开源往往是对社会有益的项目的支柱。正如 Benetech Labs 副总裁 Ahn Bui 在这次采访中指出的那样: “建立开放数据标准是打破数据孤岛不可或缺的一步。这些开放标准将为互操作性提供基础, 进而转化为更多的组织共同建设, 往往更具成本效益。最终目标是以同样的成本甚至更低的成本为更多的人服务。” + +### 用于再融合和再利用的开放式教育资源 + +1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis,Wiki Ed 的, 项目总监,讨论开放教育资源 (OERs) ,如 Wiki Ed,如何提供高质量且经济实惠的开源学习资源作为课堂教学工具。 + +2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green,是 Creative Common 开放教育主任,分享高等教育中教育面貌是如何变化的, 以及 Creative Common 正在采取哪些措施来促进教育。 + +3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites,是 Open Up Resources 社区的福音传教士和首席营销官, 谈论非营利组织努力为 K-12 学校提供开放的, 标准一致的课程。 + +4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke , Hawaii 大学 Manoa 分校的教育技术专家,他说, 在大学课程中过渡到 ORE 将 “使教师能够控制他们教授的内容, 我们预计这将为他们节省学生的费用。” + +5. [How open courses are slashing the cost of higher education][11]: Saylor Academy 的教育主任 Devon Ritter 报告了 Saylor 是如何建立以公开许可内容为基础的大学学分课程, 目的是使更多的人能够负担得起和获得高等教育。 + +6. [Open educational resources movement gains speed][12]: Alexis Clifton,State University of New York 的 OER 服务的执行主任, 描述了纽约800万美元的投资如何刺激开放教育的增长, 并使大学更实惠。 + +7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik 在Duke University 探索 OSPRI (Open Source Pedagogy Research and Innovation,开源教育学的研究与创新), 在 Duke 和 Red Hat 的联合合作这是建立一个21世纪的, preK-12 学习生态系统, 是开放的设计。 + +8. [Perma.cc stops scholarly link rot][14]: Virginia Tech 的 Phillip Young 写关于 Perma.cc, “link rot”(链接失效) 的解决方案 很大可能在学术论文中的超链接随着时间的推移而消失或变化。 + +9. [Open education: How students save money by creating open textbooks][15]: OER 先驱 Robin DeRosa 谈到 “公开许可教科书引入的自由, 以及教育和学习应结合包容性生态系统, 以增强公益的总体理念”。 + +### 课堂上的开源工具 + +1. [How an open source board game is saving the planet][16]: Joshua Pearce 写的关于拯救地球的一个棋盘游戏, 使学生能够解决环境问题, 同时有乐趣, 并为制造商社区作出贡献。 + +2. [A new Android app for teaching kids how to read][17]: Michael Hall 谈到他的儿子 Phoenicia,他在儿子被诊断为自闭症后开发的儿童识字应用, 为了产生更好的编码价值, 以及为什么用户测试比你想象的更重要。 + +3. [8 open source Android apps for education][18]: Joshua Allen Holm 通过推荐 F-Droid 存储库中的8个开源应用来尝试, 这将挑战我们将智能手机用作学习工具。 + +4. [3 open source alternatives to MATLAB][19]: Jason Baker's 更新了他2016年的开源数学计算软件调查, 提出了 MATLAB 的替代方案, 这是数学、物理科学、工程和经济学中几乎无处不在的昂贵的专用解决方案。 + +5. [What does SVG have to do with teaching kids to code?][20] 退休工程师 Jay Nick 谈论他如何使用艺术作为一种创造性的方式, 向学生介绍编码。他在学校做志愿者, 使用可缩放矢量图形 (SVG,Scalable Vector Graphics) 教授一种结合数学和艺术原理的编码方法。 + +6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, 在 Texas Tech 拥有美术博士学位分享他在单一解决方案统治的世界中使用开源工具的经验。 Kyle 说有一种偏见, 反对在计算机科学以外的学科中使用开源:“很多人认为非技术专业的学生不能使用 Linux, 他们对在高级学位课程中使用 Linux 的人做出了很多假设。...嗯, 这是有可能的, 我就是证明。” + +7. [A list of open source tools for college][22]: Aaron Cocker 概述了他在攻读计算机科学本科学位时使用的开源工具 (包括演示、备份和编程软件)。 + +8. [5 great KDE apps to help you study][23]: Zsolt Szakács 提供五个 KDE 应用程序, 帮助任何想要学习新技能或培养现有技能的人。 + +### 在教室编码 + +1. [How to get the next generation coding early][24]: Bryson Payne 说我们需要教孩子们在高中前编码: 到了九年级, 80% 的女孩和60% 的男孩已经从 STEM 职业中自选。但他建议, 这不仅仅是就业和缩小 IT 技能差距的问题。“教一个年轻人编写代码可能是你能给他们的最改变生活的技能。而且这不仅仅是一个职业提升者。编码是关于解决问题, 它是关于创造力, 更重要的是, 它是关于授权。 + +2. [Kids can't code without computers][25]: Patrick Masson 推出了 FLOSS 儿童桌面计划, 该计划教授服务不足学校的学生使用开源软件 (如 Linux、LibreOffice 和 GIMP) 重新设计较旧的计算机。该计划不仅为破旧或退役的硬件注入新的生命, 还为学生提供了重要的技能, 这些技能可能会利于转化为未来的职业。 + +3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva 提出 [Scratch][27] 的使用建议以激发孩子们对编程的兴趣, 就像 LOGO 在20世纪80年代开始使用它时一样。 + +4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger 描述应用发明者, 一个编程框架, 用于构建 Android 应用程序使用可视块语言 (类似 Scratch 或者[Snap][29]). + +在这一年里, 我们了解到, 教育领域的一切都有一个开放的解决方案, 我预计这一主题将在2018年及以后继续下去。在未来的一年里, 你是否希望 Opensource.com 涵盖开放式的教育主题?如果是, 请在评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/best-open-education + +作者:[Don Watkins][a] +译者:[lixinyuxx](https://github.com/lixinyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/don-watkins +[1]:https://opensource.com/article/17/7/book-review-open +[2]:https://opensource.com/article/17/8/jump-start-your-career +[3]:https://opensource.com/article/17/1/grad-school-open-source-academic-lab +[4]:https://opensource.com/article/17/7/open-school-leadership +[5]:https://opensource.com/article/17/7/empower-students-open-source-tools +[6]:https://opensource.com/article/17/3/interview-anh-bui-benetech-labs +[7]:https://opensource.com/article/17/1/Wiki-Education-Foundation +[8]:https://opensource.com/article/17/2/future-textbooks-cable-green-creative-commons +[9]:https://opensource.com/article/17/1/open-up-resources +[10]:https://opensource.com/article/17/2/interview-education-billy-meinke +[11]:https://opensource.com/article/17/7/college-alternatives +[12]:https://opensource.com/article/17/10/open-educational-resources-alexis-clifton +[13]:https://opensource.com/article/17/3/education-should-be-open-design +[14]:https://opensource.com/article/17/9/stop-link-rot-permacc +[15]:https://opensource.com/article/17/11/creating-open-textbooks +[16]:https://opensource.com/article/17/7/save-planet-board-game +[17]:https://opensource.com/article/17/4/phoenicia-education-software +[18]:https://opensource.com/article/17/8/8-open-source-android-apps-education +[19]:https://opensource.com/alternatives/matlab +[20]:https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam +[21]:https://opensource.com/article/17/5/how-linux-higher-education +[22]:https://opensource.com/article/17/6/open-source-tools-university-student +[23]:https://opensource.com/article/17/6/kde-education-software +[24]:https://opensource.com/article/17/8/teach-kid-code-change-life +[25]:https://opensource.com/article/17/9/floss-desktops-kids +[26]:https://opensource.com/article/17/3/logo-scratch-teach-programming-kids +[27]:https://scratch.mit.edu/ +[28]:https://opensource.com/article/17/8/app-inventor-android-app-development +[29]:http://snap.berkeley.edu/ From aaecf1d4609269144f95e5fe79a5dfa825cd36a3 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Thu, 20 Dec 2018 22:50:29 +0800 Subject: [PATCH 0207/4278] Translating by qhwdw --- sources/tech/20181212 How to Build a Netboot Server, Part 2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181212 How to Build a Netboot Server, Part 2.md b/sources/tech/20181212 How to Build a Netboot Server, Part 2.md index 0301a34da5..1d1ce2f68f 100644 --- a/sources/tech/20181212 How to Build a Netboot Server, Part 2.md +++ b/sources/tech/20181212 How to Build a Netboot Server, Part 2.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5a97264a42ecefac7b2243aa65c0a80cba61fe13 Mon Sep 17 00:00:00 2001 From: wwhio Date: Thu, 20 Dec 2018 22:57:44 +0800 Subject: [PATCH 0208/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20171119 The Ruby Story.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20171119 The Ruby Story.md b/sources/talk/20171119 The Ruby Story.md index 90d5f41790..4c6b46b7de 100644 --- a/sources/talk/20171119 The Ruby Story.md +++ b/sources/talk/20171119 The Ruby Story.md @@ -1,3 +1,5 @@ +Translating by wwhio + The Ruby Story ====== Ruby has always been one of my favorite languages, though I’ve sometimes found it hard to express why that is. The best I’ve been able to do is this musical analogy: Whereas Python feels to me like punk rock—it’s simple, predictable, but rigid—Ruby feels like jazz. Ruby gives programmers a radical freedom to express themselves, though that comes at the cost of added complexity and can lead to programmers writing programs that don’t make immediate sense to other people. From 4a06c0160382196631c5cb6762b5305f5e47ddf8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 21 Dec 2018 07:13:26 +0800 Subject: [PATCH 0209/4278] PRF:20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md @lixinyuxx --- ... - Notmuch, mbsync, postfix and dovecot.md | 83 ++++++++++--------- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md b/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md index 01e5c82f08..12f45713d4 100644 --- a/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md +++ b/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md @@ -1,33 +1,34 @@ -我的个人电子邮件系统 - Notmuch, mbsync,postfix and dovecot +我的个人电子邮件系统设置:notmuch、mbsync、Postfix 和 dovecot ====== -我使用个人电子邮件系统已经相当长的时间了, 没有文字记录。最近当我换了我的笔记本电脑(职业变更做的变动)我在试图重新创建本地邮件设置时迷茫了。所以这篇文章是一个自己的文档, 这样我就不用费劲就能修正过来。 + +我使用个人电子邮件系统已经相当长的时间了,但是一直没有记录过文档。最近我换了我的笔记本电脑(职业变更导致的变动),我在试图重新创建本地邮件系统时迷茫了。所以这篇文章是一个给自己看的文档,这样我就不用费劲就能再次搭建出来。 ### 服务器端 -我运行自己的邮件服务器, 并使用 Postfix 作为 SMTP 服务器和用 Dovecot 实现 IMAP 。我不打算详细介绍如何配置这些设置, 因为我的设置主要是通过使用 Jonas 为 Redpill 基础架构创建的脚本完成的。什么是 Redpill ?(用 Jonas 自己的话说) +我运行自己的邮件服务器,并使用 Postfix 作为 SMTP 服务器,用 Dovecot 实现 IMAP。我不打算详细介绍如何配置这些设置,因为我的设置主要是通过使用 Jonas 为 Redpill 基础架构创建的脚本完成的。什么是 Redpill?(用 Jonas 自己的话说): -> Redpill 是一个概念 - 一种设置 Debian hosts 去跨组织协作的方式 我延申了这个概念, 并将其首次使用 Redpill 去联网 redpill.dk, 涉及我自己的网络 (jones.dk), 我的主要客户的网络 (homebase.dk),在德国的一个网络, 包括Skolelinux Germany (free-owl.de), 和 Vasudev 的网络 (copyninja.info) +> \ Redpill 是一个概念:一种设置 Debian hosts 去跨组织协作的方式 +> +> \ 我发展了这个概念,并将其首次用于 Redpill 网中网:redpill.dk,其中涉及到了我自己的网络(jones.dk),我的主要客户的网络(homebase.dk),一个包括 Skolelinux Germany(free-owl.de)的在德国的网络,和 Vasudev 的网络(copyninja.info) -除此之外, 我还有一个 dovecot sieve 过滤, 根据邮件的来源, 对高级邮件进行分类, 并将其分类到各种文件夹中。所有的规则都存在于每个有邮件地址的账户下的 ~/dovecot.sieve文件中。 +除此之外, 我还有一个 dovecot sieve 过滤,根据邮件的来源,对邮件进行高级分类,将其放到各种文件夹中。所有的规则都存在于每个有邮件地址的账户下的 `~/dovecot.sieve` 文件中。 -再次, 我不详细介绍如何设置这些东西, 因为这不是我这个帖子的目标。 +再次,我不会详细介绍如何设置这些东西,因为这不是我这个帖子的目标。 ### 在我的笔记本电脑上 -在我的笔记本电脑上,我已经按照4个部分设置 - - 1. 邮件同步: 使用 mbsync 命令完成 - 2. 分类: 使用 notmuch 完成 - 3. 阅读: 使用 notmuch-emacs 完成 - 4. 邮件发送: 使用作为转接服务器和 SMTP 客户端运行的 postfix 完成。 - +在我的笔记本电脑上,我已经按照 4 个部分设置 + 1. 邮件同步:使用 `mbsync` 命令完成 + 2. 分类:使用 notmuch 完成 + 3. 阅读:使用 notmuch-emacs 完成 + 4. 邮件发送:使用作为中继服务器和 SMTP 客户端运行的 Postfix 完成。 ### 邮件同步 -邮件同步是使用 mbsync 工具完成的, 我以前是 OfflineIMAP 的用户,最近切换到 mbsync,因为我觉得它比 OfflineIMAP 的配置更轻,更简单。命令是由包 isync 提供的。 +邮件同步是使用 `mbsync` 工具完成的, 我以前是 OfflineIMAP 的用户,最近切换到 `mbsync`,因为我觉得它比 OfflineIMAP 的配置更轻量、更简单。该命令是由 isync 包提供的。 -配置文件是 ~/.mbsyncrc. 下面是我的例子与一些个人设置。 +配置文件是 `~/.mbsyncrc`。下面是我的例子与一些个人设置。 ``` IMAPAccount copyninja @@ -79,17 +80,17 @@ SyncState * Sync All ``` -对上述配置中的一些有趣部分进行说明。一个是 PassCmd , 它允许你提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我在我磁盘上的一些地方使用对称加密 gpg 和存储密码。这当然是由 Unix ACL 保护安全。 +对上述配置中的一些有趣部分进行一下说明。一个是 PassCmd,它允许你提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我使用 gpg 的对称加密,并在我的磁盘上存储密码。这当然是由 Unix ACL 保护安全的。 -实际上, 我想使用我的公钥加密文件, 但当脚本在后台或通过 systemd 运行时, 解锁文件看起来很困难 (或看起来几乎不可能)。如果你有更好的建议, 我洗耳恭听:-)。 +实际上,我想使用我的公钥来加密文件,但当脚本在后台或通过 systemd 运行时,解锁文件看起来很困难 (或者说几乎不可能)。如果你有更好的建议,我洗耳恭听:-)。 -下一个指令部分是模式。这使你可以有选择地同步来自邮件服务器的邮件。这对我来说真的很有帮助, 可以排除所有的垃圾 [Gmail]/ folders. +下一个指令部分是 Patterns。这使你可以有选择地同步来自邮件服务器的邮件。这对我来说真的很有帮助,可以排除所有的 “[Gmail]/ folders” 垃圾目录。 ### 邮件分类 -一旦邮件在你本地的设备, 我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步 Maildir, 并在 Gnus 中阅读。这种设置相比于设置所有服务器软件是有点大题小作, 但 Gnus 无法很好地应付 maildir 格式, 这是最好的方法。这个设置也有一个缺点, 那就是在你有大量邮件要看的时候快速搜索邮件。这是为数不多的情况。 +一旦邮件到达你的本地设备,我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步的 Maildir,并在 Gnus 中阅读。这种设置相比于设置所有的服务器软件是有点大题小作,但 Gnus 无法很好地应付 Maildir 格式,这是最好的方法。这个设置也有一个缺点,那就是在你快速搜索邮件时,要搜索大量邮件。而这就是 notmuch 的用武之地。 -不多的情况下我想很容易索引通过千兆字节的邮件档案, 并得到我需要的东西。我已经创建了一个小脚本, 它结合了执行 mbsync 和 notmuch 执行语句。我基于 Maildirs 标记邮件, 实际上是创建在服务器端使用 dovecot sieve 。下面是我的完整 shell 脚本, 它正在执行同步分类和删除垃圾邮件的任务。 +notmuch 允许我轻松索引上千兆字节的邮件档案而找到我需要的东西。我已经创建了一个小脚本,它结合了执行 `mbsync` 和 `notmuch`。我使用 dovecot sieve 来基于实际上创建在服务器端的 Maildirs 标记邮件。下面是我的完整 shell 脚本,它执行同步分类和删除垃圾邮件的任务。 ``` #!/bin/sh @@ -129,27 +130,28 @@ for mdir in $MDIR; do done ``` -因此, 在运行 mbsync 之前, 我搜索所有标记为已删除的邮件, 并将其从系统中删除。接下来, 我在我的帐户上查找标记为 "垃圾邮件" 的邮件, 并将其移动到垃圾邮件文件夹。你做的对,这些邮件逃脱垃圾邮件过滤器进到我的 inbox ,并被我亲自标记为垃圾邮件。 +因此,在运行 `mbsync` 之前,我搜索所有标记为“deleted”的邮件,并将其从系统中删除。接下来,我在我的帐户上查找标记为“Spam”的邮件,并将其移动到“Spam”文件夹。你没看错,这些邮件逃脱了垃圾邮件过滤器进入到我的收件箱,并被我亲自标记为垃圾邮件。 -运行 mbsync 后, 我基于他们的文件夹标记邮件 (搜索字符串文件夹:)。这让我可以很容易地得到一个邮件列表的内容, 而不需要记住列表地址。 +运行 `mbsync` 后,我基于它们的文件夹标记邮件(搜索字符串 `folder:`)。这让我可以很容易地得到一个邮件列表的内容,而不需要记住列表地址。 ### 阅读邮件 -现在, 我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格, 所以我花了一些时间写下一个私有层(private layer),它将我所有的快捷键和分类集中在一个地方, 不会扰乱我的整个. spacemacs 文件。你可以在 [notmuch-emacs-layer repository][1] 找到我私有层的代码。 +现在,我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格,所以我花了一些时间写了一个私有层,它将我所有的快捷键和分类集中在一个地方,而不会扰乱我的整个 `.spacemacs` 文件。你可以在 [notmuch-emacs-layer 仓库][1] 找到我的私有层的代码。 ### 发送邮件 -如果我们能阅读邮件, 我们就需要能够回复邮件, 这还不够。而这是最近是我感到迷茫的一个略显棘手的部分, 不得不写这篇文章, 这样我就不会再忘记了。(当然也不必在网络上引用一些过时的帖子)。 +能阅读邮件这还不够,我们也需要能够回复邮件。而这是最近是我感到迷茫的一个略显棘手的部分,以至于不得不写这篇文章,这样我就不会再忘记了。(当然也不必在网络上参考一些过时的帖子。) -我的设置发送邮件使用 postfix 作为 SMTP 客户端与我自己的 SMTP 服务器作为它的转接主机。转接的问题是, 它不是具有动态 IP 的主机。有几种方法可以允许具有动态 ip 的主机使用转接服务器, 一种是将邮件从其中发源于 my_network 或第二个使用 SASL 身份验证的 IP 地址。 +我的系统发送邮件使用 Postfix 作为 SMTP 客户端,使用我自己的 SMTP 服务器作为它的中继主机。中继的问题是,它不能是具有动态 IP 的主机。有两种方法可以允许具有动态 IP 的主机使用中继服务器, 一种是将邮件来源的 IP 地址放入 `my_network` 或第二个使用 SASL 身份验证。 + +我的首选方法是使用 SASL 身份验证。为此,我首先要为每台机器创建一个单独的账户,它将把邮件中继到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主账户,但 Jonas 给出了可行的按账户的想法) -我的首选方法是使用 SASL 身份验证。为此, 我首先要为每台机器创建一个单独的账户, 它将把邮件传递到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主要账户, 但 Jonas 给出了每个可行账户的想法) ``` adduser _relay - ``` -这里替换 与你的笔记本电脑的名称或任何你正在使用的设备。现在我们需要调整 postfix , 作为转接服务器。因此, 在 postfix 配置中添加以下行 +这里替换 `` 为你的笔记本电脑的名称或任何你正在使用的设备。现在我们需要调整 Postfix 作为中继服务器。因此,在 Postfix 配置中添加以下行: + ``` # SASL authentication smtp_sasl_auth_enable = yes @@ -159,28 +161,30 @@ relayhost = [smtp.copyninja.info]:submission smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd ``` -因此, 这里的 relayhost 是你的 postfix 实例将用于邮件转发到互联网的服务器名称。submission 的部分 postfix 将邮件转发到端口 587 (安全)。smtp_sasl_tls_security_options 设置为不允许匿名连接。这必须使转接服务器信任你的移动主机, 并同意为你转发邮件。 +因此, 这里的 `relayhost` 是用于将邮件转发到互联网的 Postfix 实例的服务器名称。`submission` 的部分 Postfix 将邮件转发到端口 587(安全端口)。`smtp_sasl_tls_security_options` 设置为不允许匿名连接。这是必须的,以便中继服务器信任你的移动主机,并同意为你转发邮件。 + +`/etc/postfix/sasl_passwd` 是你需要存储用于服务器 SASL 身份验证的帐户密码的文件。将以下内容放入其中。 -/etc/postfix/sasl__asswd 是你需要存储用于服务器 SASL 身份验证的帐户密码的文件。将以下内容放入其中。 ``` [smtp.example.com]:submission user:password - ``` - 用你的 SMTP 服务器名称替换 smtp.example.com ,你已输入的 relayhost 认证。 用你创建的用户及其密码替换 user with _relay 。 +用你已放入 `relayhost` 配置的 SMTP 服务器名称替换 `smtp.example.com`。用你创建的 `_relay` 用户及其密码替换 `user` 和 `passwd`。 + +若要保护 `sasl_passwd` 文件,并为 Postfix 创建它的哈希文件,使用以下命令。 -若要保护 sasl_passwd 文件, 并创建它的 hash(哈希) 进行 postfix 使用以下命令。 ``` chown root:root /etc/postfix/sasl_passwd chmod 0600 /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd ``` -最后的命令将创建 /etc/postfix/sasl_passwd.db 文件是你的文件的 hash /etc/postfix/sasl_passwd 具有相同的所有者和权限。现在重新加载 postfix, 并检查邮件是否使用邮件命令从你的系统中取出。 +最后一条命令将创建 `/etc/postfix/sasl_passwd.db` 文件,它是你的文件的 `/etc/postfix/sasl_passwd` 的哈希文件,具有相同的所有者和权限。现在重新加载 Postfix,并使用 `mail` 命令检查邮件是否从你的系统中发出。 ### Bonus 的部分 -好吧, 因为我有一个脚本创建以上结合了邮件的同步和分类。我继续创建了一个 systemd 计时器, 以定期同步后台的邮件。就我而言, 每10分钟一次。下面是 mailsync.timer 文件。 +好吧,因为我有一个脚本创建以上结合了邮件的同步和分类。我继续创建了一个 systemd 计时器,以定期同步后台的邮件。就我而言,每 10 分钟一次。下面是 `mailsync.timer` 文件。 + ``` [Unit] Description=Check Mail Every 10 minutes @@ -197,7 +201,7 @@ Unit=mailsync.service WantedBy=default.target ``` -下面是 mailsync. 服务, 这是邮件同步计时器执行我们的脚本所需要的。 +下面是 mailsync.service 服务,这是 mailsync.timer 执行我们的脚本所需要的。 ``` [Unit] @@ -212,14 +216,15 @@ StandardOutput=syslog StandardError=syslog ``` -将这些文件置于 /etc/systemd/user 目录下并运行以下代码去开启它们 +将这些文件置于 `/etc/systemd/user` 目录下并运行以下代码去开启它们: + ``` systemctl enable --user mailsync.timer systemctl enable --user mailsync.service systemctl start --user mailsync.timer ``` -这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew ,他同时阅读了这篇帖子。因此, 下一步, 我将尝试使用 afew 改进我的 notmuch 配置, 当然还会有一个后续的帖子:-)。 +这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew,他审阅了这篇帖子。因此, 下一步, 我将尝试使用 afew 改进我的 notmuch 配置,当然还会有一个后续的帖子:-)。 -------------------------------------------------------------------------------- @@ -227,7 +232,7 @@ via: https://copyninja.info/blog/email_setup.html 作者:[copyninja][a] 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ed9ed4b2e62d59394b53735e5cceb8389d12f75a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 21 Dec 2018 07:13:56 +0800 Subject: [PATCH 0210/4278] PUB:20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md @lixingyuxx https://linux.cn/article-10369-1.html --- ...personal Email setup - Notmuch, mbsync, postfix and dovecot.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md (100%) diff --git a/translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md b/published/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md similarity index 100% rename from translated/tech/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md rename to published/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md From dd9c5382b4018acb20130115ab004985b810733b Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 21 Dec 2018 08:52:33 +0800 Subject: [PATCH 0211/4278] translated --- ...es for a Raspberry Pi Around the Office.md | 142 ------------------ ...es for a Raspberry Pi Around the Office.md | 142 ++++++++++++++++++ 2 files changed, 142 insertions(+), 142 deletions(-) delete mode 100644 sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md create mode 100644 translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md diff --git a/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md b/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md deleted file mode 100644 index 4eb59ba1a0..0000000000 --- a/sources/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md +++ /dev/null @@ -1,142 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (11 Uses for a Raspberry Pi Around the Office) -[#]: via: (https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-office/) -[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) - -11 Uses for a Raspberry Pi Around the Office -====== - -Look, I know what you’re thinking: a Raspberry Pi is really just for tinkering, prototyping and hobby use. It’s not actually meant for running a business on. - -And it’s definitely true that this computer’s relatively low processing power, corruptible SD card, lack of battery backup and the DIY nature of the support means it’s not going to be a viable replacement for a [professionally installed and configured business server][1] for your most mission-critical operations any time soon. - -But the board is affordable, incredibly frugal with power, small enough to fit just about anywhere and endlessly flexible – it’s actually a pretty great way to handle some basic tasks around the office. - -And, even better, there’s a whole world of people out there who have done these projects before and are happy to share how they did it. - -### DNS Server - -Every time you type a website address or click a link in your browser, it needs to convert the domain name into a numeric IP address before it can show you anything. - -Normally this means a request to a DNS server somewhere on the internet – but you can speed up your browsing by handling this locally. - -You can also assign your own subdomains for local access to machines around the office. - -[Here’s how to get this working.][2] - -### Toilet Occupied Sign - -Ever get queues at the loos? - -That’s annoying for those left waiting and the time spent dealing with it is a drain on your whole office’s productivity. - -I guess you could always hang those signs they have on airplanes all through your office. - -[Occu-pi][3] is a much simpler solution, using a magnetic switch and a Raspberry Pi to tell when the bolt is closed and update a Slack channel as to when it’s in use – meaning that the whole office can tell at a glance of their computer or mobile device whether there’s a cubicle free. - -### Honeypot Trap for Hackers - -It should scare most business owners just a little bit that their first clue that a hacker’s breached the network is when something goes badly wrong. - -That’s where it can help to have a honeypot: a computer that serves no purpose except to sit on your network with certain ports open to masquerade as a juicy target to hackers. - -Security researchers often deploy honeypots on the exterior of a network, to collect data on what attackers are doing. - -But for the average small business, these are more usefully deployed in the interior, to serve as kind of a tripwire. Because no ordinary user has any real reason to want to connect to the honeypot, any login attempts that occur are a very good indicator that mischief is afoot. - -This can provide early warning of outsider intrusion, and of trusted insiders up to no good. - -In larger, client/server networks, it might be more practical to run something like this as a virtual machine. But in small-office/home-office situations with a peer-to-peer network running on a wireless router, something like [HoneyPi][4] is a great little burglar alarm. - -### Print Server - -Network-attached printers are so much more convenient. - -But it can be expensive to replace all your printers- especially if you’re otherwise happy with them. - -It might make a lot more sense to [set up a Raspberry Pi as a print server][5]. - -### Network Attached Storage - -Turning simple hard drives into network attached storage was one of the earliest practical uses for a Raspberry Pi, and it’s still one of the best. - -[Here’s how to create a NAS with your Raspberry Pi.][6] - -### Ticketing Server - -Looking for a way to manage the support tickets for your help desk on a shoestring budget? - -There’s a totally open source ticketing program called osTicket that you can install on your Pi, and it’s even available as [a ready-to-go SD card image][7]. - -### Digital Signage - -Whether it’s for events, advertising, a menu, or something else entirely, a lot of businesses need a way to display digital signage – and the Pi’s affordability and frugal electricity needs make it a very attractive choice. - -[There are a wealth of options to choose from here.][8] - -### Directories and Kiosks - -[FullPageOS][9] is a Linux distribution based on Raspbian that boots straight into a full screen version of Chromium – ideal for shopping directoriers, library catalogues and so on. - -### Basic Intranet Web Server - -For hosting a public-facing website, you’re really much better off just getting a hosting account. A Raspberry Pi is not really built to serve any real volume of web traffic. - -But for small offices, it can host an internal business wiki or basic company intranet. It can also work as a sandbox environment for experimenting with code and server configurations. - -[Here’s how to get Apache, MySQL and PHP running on a Pi.][10] - -### Penetration Tester - -Kali Linux is an operating system built specifically to probe networks for security vulnerabilities. By installing it on a Pi, you’ve got a super portable penetration tester with more than 600 tools included. - -[You can find a torrent link for the Raspberry Pi image here.][11] - -Be absolutely scrupulous to only use this on your own network or networks you’ve got permission to perform a security audit on – using this to hack other networks is a serious crime. - -### VPN Server - -When you’re out on the road, relying on public wireless internet, you’ve not really any say in who else might be on the network, snooping on all your traffic. That’s why it can be reassuring to encrypt everything with a VPN connection. - -There are any number of commercial VPN services you can subscribe to – and you can install your own in the cloud – but by running one from your office, you can also access the local network from anywhere. - -For light use – say, the occasional bit of business travel – a Raspberry Pi is a great, power-efficient way to set up a VPN server. (It’s also worth checking first that your router doesn’t offer this functionality already – very many do.) - -[Here’s how to install OpenVPN on a Raspberry Pi.][12] - -### Wireless Coffee Machine - -Ahh, ambrosia: sweet nectar of the gods and the backbone of all productive enterprise. - -So why not [hack the office coffee machine into a smart coffee machine][13] for precision temperature control and wireless network connectivity? - --------------------------------------------------------------------------------- - -via: https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-office/ - -作者:[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://dxmtechsupport.com.au/server-configuration -[2]: https://www.1and1.com/digitalguide/server/configuration/how-to-make-your-raspberry-pi-into-a-dns-server/ -[3]: https://blog.usejournal.com/occu-pi-the-bathroom-of-the-future-ed69b84e21d5 -[4]: https://trustfoundry.net/honeypi-easy-honeypot-raspberry-pi/ -[5]: https://opensource.com/article/18/3/print-server-raspberry-pi -[6]: https://howtoraspberrypi.com/create-a-nas-with-your-raspberry-pi-and-samba/ -[7]: https://everyday-tech.com/a-raspberry-pi-ticketing-system-image-with-osticket/ -[8]: https://blog.capterra.com/7-free-and-open-source-digital-signage-software-options-for-your-next-event/ -[9]: https://github.com/guysoft/FullPageOS -[10]: https://maker.pro/raspberry-pi/projects/raspberry-pi-web-server -[11]: https://www.offensive-security.com/kali-linux-arm-images/ -[12]: https://medium.freecodecamp.org/running-your-own-openvpn-server-on-a-raspberry-pi-8b78043ccdea -[13]: https://www.techradar.com/au/how-to/how-to-build-your-own-smart-coffee-machine diff --git a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md b/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md new file mode 100644 index 0000000000..88e7fbd86a --- /dev/null +++ b/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (11 Uses for a Raspberry Pi Around the Office) +[#]: via: (https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-office/) +[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) + +树莓派在办公室的 11 种用法 +====== + +我知道你在想什么:树莓派只能用在修修补补、原型设计和个人爱好中。它实际不能用在业务中。 + +毫无疑问,这台电脑的处理能力相对较低、易损坏的 SD 卡、缺乏电池备份以及支持的 DIY 性质,这意味着它不会是一个能在任何时候执行最关键的操作的[专业的已安装和已配置的商业服务器][1]的可行替代,。 + +但是它电路板便宜、功耗很小、很小几乎适合任何地方、无限灵活 - 这实际上是处理办公室一些基本任务的好方法。 + +而且,更好的是,已经有一些人完成了这些项目并很乐意分享他们是如何做到的。 + +### DNS 服务器 + +每次在浏览器中输入网站地址或者点击链接时,都需要将域名转换为数字 IP 地址,然后才能显示内容。 + +通常这意味着向互联网上某处 DNS 服务器发出请求 - 但你可以通过本地处理来加快浏览速度。 + +你还可以分配自己的子域,以便本地访问办公室中的计算机。 + +[这里是如何让这它工作。][2] + +### 厕所占用标志 + +在厕所排过队吗? + +这对于那些等待的人来说很烦人,花在处理它上面的时间会耗费你在办公室的工作效率。 + +我想你希望在办公室里也悬挂飞机上有的标志。 + +[Occu-pi][3] 是一个更简单的解决方案,使用磁性开关和树莓派来判断螺栓何时关闭并在 Slack 频道中更新厕所在使用中 - 这意味着整个办公室的人都可以看一眼电脑或者移动设备知道是否有空闲的隔间。 + +### 针对黑客的蜜罐陷阱 + +黑客破坏了网络的第一个线索是一些事情变得糟糕,这应该会吓到大多数企业主。 + +这就是可以用到蜜罐的地方:一台没有任何服务的计算机位于你的网络,将特定端口打开伪装成黑客喜欢的目标。 + +安全研究人员经常在网络外部部署蜜罐,以收集攻击者正在做的事情的数据。 + +但对于普通的小型企业来说,这些作为一种绊脚石部署在内部更有用。因为普通用户没有真正的理由想要连接到蜜罐,所以任何发生的登录尝试都是正在进行捣乱的非常好的指示。 + +这可以提供对外部人员入侵的预警,并且可信赖的内部人员也没有任何好处。 + +在较大的客户端/服务器网络中,将它作为虚拟机运行可能更为实际。但是在无线路由器上运行的点对点的小型办公室/家庭办公网络中,[HoneyPi][4] 之类的东西是一个很小的防盗报警器。 + +### 打印服务器 + +网络连接的打印机更方便。 + +但更换所有打印机可能会很昂贵 - 特别是如果你对它们感到满意的话。 + +[将树莓派设置为打印服务器][5]可能会更有意义。 + +### 网络附加存储 (NAS) + +将硬盘变为 NAS 是树莓派最早的实际应用之一,并且它仍然是最好的之一。 + +[这是如何使用树莓派创建NAS。][6] + +### 工单服务器 + +想要在预算不足的情况下在服务台中支持工单? + +有一个名为 osTicket 的完全开源的工单程序,它可以安装在你的树莓派上,它甚至还有[随时可用的 SD 卡镜像][7]。 + +### 数字标牌 + +无论是用于活动、广告、菜单还是其他任何东西,许多企业都需要一种显示数字标牌的方式 - 而树莓派的廉价和省电使其成为一个非常有吸引力的选择。 + +[这有很多可供选择的选项。] [8] + +### 目录和信息亭 + +[FullPageOS][9] 是一个基于 Raspbian 的 Linux 发行版,它直接引导到 Chromium 的全屏版本 - 这非常适合导购、图书馆目录等。 + +### 基本的内联网 Web 服务器 + +对于托管一个面向公众的网站,你最好有一个托管帐户。树莓派不适合面对真正的网络流量。 + +但对于小型办公室,它可以托管内部业务维基或基本的公司内网。它还可以用作沙箱环境,用于试验代码和服务器配置。 + +[这里是如何在树莓派上运行 Apache、MySQL 和 PHP。][10] + +### 渗透测试器 + +Kali Linux 是专为探测网络安全漏洞而构建的操作系统。通过将其安装在树莓派上,你就拥有了一个超便携式穿透测试器,其中包含 600 多种工具。 + +[你可以在这里找到树莓派镜像的种子链接。][11] + +绝对小心只在你自己的网络或你有权对它安全审计的网络中使用它 - 使用此方法来破解其他网络是严重的犯罪行为。 + +### VPN 服务器 + +当你外出时,依靠的是公共无线互联网,你无法控制还有谁在网络中、谁在窥探你的所有流量。这就是为什么通过 VPN 连接加密所有内容可以让人放心。 + +你可以订阅任意数量的商业 VPN 服务,并且你可以在云中安装自己的服务,但是在办公室运行一个 VPN,这样你也可以从任何地方访问本地网络。 + +对于轻度使用 - 比如偶尔的商务旅行 - 树莓派是一种强大的,节约能源的设置 VPN 服务器的方式。(首先要检查一下你的路由器是不是不支持这个功能,许多路由器是支持的。) + +[这是如何在树莓派上安装 OpenVPN。][12] + +### 无线咖啡机 + +啊,美味:美味的饮料还是公司内工作效率的支柱。 + +那么, 为什么不[将办公室的咖啡机变成可以精确控制温度和无线连接的智能咖啡机呢?][13] + +-------------------------------------------------------------------------------- + +via: https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-office/ + +作者:[James Mawson][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://blog.dxmtechsupport.com.au/author/james-mawson/ +[b]: https://github.com/lujun9972 +[1]: https://dxmtechsupport.com.au/server-configuration +[2]: https://www.1and1.com/digitalguide/server/configuration/how-to-make-your-raspberry-pi-into-a-dns-server/ +[3]: https://blog.usejournal.com/occu-pi-the-bathroom-of-the-future-ed69b84e21d5 +[4]: https://trustfoundry.net/honeypi-easy-honeypot-raspberry-pi/ +[5]: https://opensource.com/article/18/3/print-server-raspberry-pi +[6]: https://howtoraspberrypi.com/create-a-nas-with-your-raspberry-pi-and-samba/ +[7]: https://everyday-tech.com/a-raspberry-pi-ticketing-system-image-with-osticket/ +[8]: https://blog.capterra.com/7-free-and-open-source-digital-signage-software-options-for-your-next-event/ +[9]: https://github.com/guysoft/FullPageOS +[10]: https://maker.pro/raspberry-pi/projects/raspberry-pi-web-server +[11]: https://www.offensive-security.com/kali-linux-arm-images/ +[12]: https://medium.freecodecamp.org/running-your-own-openvpn-server-on-a-raspberry-pi-8b78043ccdea +[13]: https://www.techradar.com/au/how-to/how-to-build-your-own-smart-coffee-machine \ No newline at end of file From 5dd95c43b49d1b427c2b2341bc725b9351b8f252 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 21 Dec 2018 08:59:20 +0800 Subject: [PATCH 0212/4278] translating --- ...o Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md index 1b52121add..379bbfd20a 100644 --- a/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ b/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 17ba37122e923c2297b5e54c287781f60733a5fc Mon Sep 17 00:00:00 2001 From: Auk7F7 <34982730+Auk7F7@users.noreply.github.com> Date: Fri, 21 Dec 2018 11:31:10 +0800 Subject: [PATCH 0213/4278] Update 20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md translating by Auk7F7 --- ...Audit - A Tool To Check Vulnerable Packages In Arch Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md index 7c626bb0b2..3f77bee3d1 100644 --- a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md +++ b/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -7,6 +7,8 @@ [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) [#]: url: ( ) +translating by Auk7F7 + Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux ====== From 0113da44dbfd713cb49fe7bc2d14dd1050656f45 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 11:53:43 +0800 Subject: [PATCH 0214/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Getting=20start?= =?UTF-8?q?ed=20with=20Prometheus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0181220 Getting started with Prometheus.md | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 sources/tech/20181220 Getting started with Prometheus.md diff --git a/sources/tech/20181220 Getting started with Prometheus.md b/sources/tech/20181220 Getting started with Prometheus.md new file mode 100644 index 0000000000..79704addb7 --- /dev/null +++ b/sources/tech/20181220 Getting started with Prometheus.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Prometheus) +[#]: via: (https://opensource.com/article/18/12/introduction-prometheus) +[#]: author: (Michael Zamot https://opensource.com/users/mzamot) + +Getting started with Prometheus +====== +Learn to install and write queries for the Prometheus monitoring and alerting system. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn) + +[Prometheus][1] is an open source monitoring and alerting system that directly scrapes metrics from agents running on the target hosts and stores the collected samples centrally on its server. Metrics can also be pushed using plugins like **collectd_exporter** —although this is not Promethius' default behavior, it may be useful in some environments where hosts are behind a firewall or prohibited from opening ports by security policy. + +Prometheus, a project of the [Cloud Native Computing Foundation][2], scales up using a federation model, which enables one Prometheus server to scrape another Prometheus server. This allows creation of a hierarchical topology, where a central system or higher-level Prometheus server can scrape aggregated data already collected from subordinate instances. + +Besides the Prometheus server, its most common components are its [Alertmanager][3] and its exporters. + +Alerting rules can be created within Prometheus and configured to send custom alerts to Alertmanager. Alertmanager then processes and handles these alerts, including sending notifications through different mechanisms like email or third-party services like [PagerDuty][4]. + +Prometheus' exporters can be libraries, processes, devices, or anything else that exposes the metrics that will be scraped by Prometheus. The metrics are available at the endpoint **/metrics** , which allows Prometheus to scrape them directly without needing an agent. The tutorial in this article uses **node_exporter** to expose the target hosts' hardware and operating system metrics. Exporters' outputs are plaintext and highly readable, which is one of Prometheus' strengths. + +In addition, you can configure [Grafana][5] to use Prometheus as a backend to provide data visualization and dashboarding functions. + +### Making sense of Prometheus' configuration file + +The number of seconds between when **/metrics** is scraped controls the granularity of the time-series database. This is defined in the configuration file as the **scrape_interval** parameter, which by default is set to 60 seconds. + +Targets are set for each scrape job in the **scrape_configs** section. Each job has its own name and a set of labels that can help filter, categorize, and make it easier to identify the target. One job can have many targets. + +### Installing Prometheus + +In this tutorial, for simplicity, we will install a Prometheus server and **node_exporter** with docker. Docker should already be installed and configured properly on your system. For a more in-depth, automated method, I recommend Steve Ovens' article [How to use Ansible to set up system monitoring with Prometheus][6]. + +Before starting, create the Prometheus configuration file **prometheus.yml** in your work directory as follows: + +``` +global: +  scrape_interval:      15s +  evaluation_interval: 15s + +scrape_configs: +  - job_name: 'prometheus' + +        static_configs: +        - targets: ['localhost:9090'] + +  - job_name: 'webservers' + +        static_configs: +        - targets: [':9100'] +``` + +Start Prometheus with Docker by running the following command: + +``` +$ sudo docker run -d -p 9090:9090 -v +/path/to/prometheus.yml:/etc/prometheus/prometheus.yml +prom/prometheus +``` + +By default, the Prometheus server will use port 9090. If this port is already in use, you can change it by adding the parameter **\--web.listen-address=" :"** at the end of the previous command. + +In the machine you want to monitor, download and run the **node_exporter** container by using the following command: + +``` +$ sudo docker run -d -v "/proc:/host/proc" -v "/sys:/host/sys" -v +"/:/rootfs" --net="host" prom/node-exporter --path.procfs +/host/proc --path.sysfs /host/sys --collector.filesystem.ignored- +mount-points "^/(sys|proc|dev|host|etc)($|/)" +``` + +For the purposes of this learning exercise, you can install **node_exporter** and Prometheus on the same machine. Please note that it's not wise to run **node_exporter** under Docker in production—this is for testing purposes only. + +To verify that **node_exporter** is running, open your browser and navigate to **http:// :9100/metrics**. All the metrics collected will be displayed; these are the same metrics Prometheus will scrape. + +![](https://opensource.com/sites/default/files/uploads/check-node_exporter.png) + +To verify the Prometheus server installation, open your browser and navigate to . + +You should see the Prometheus interface. Click on **Status** and then **Targets**. Under State, you should see your machines listed as **UP**. + +![](https://opensource.com/sites/default/files/uploads/targets-up.png) + +### Using Prometheus queries + +It's time to get familiar with [PromQL][7], Prometheus' query syntax, and its graphing web interface. Go to **** on your Prometheus server. You will see a query editor and two tabs: Graph and Console. + +Prometheus stores all data as time series, identifying each one with a metric name. For example, the metric **node_filesystem_avail_bytes** shows the available filesystem space. The metric's name can be used in the expression box to select all of the time series with this name and produce an instant vector. If desired, these time series can be filtered using selectors and labels—a set of key-value pairs—for example: + +``` +node_filesystem_avail_bytes{fstype="ext4"} +``` + +When filtering, you can match "exactly equal" ( **=** ), "not equal" ( **!=** ), "regex-match" ( **=~** ), and "do not regex-match" ( **!~** ). The following examples illustrate this: + +To filter **node_filesystem_avail_bytes** to show both ext4 and XFS filesystems: + +``` +node_filesystem_avail_bytes{fstype=~"ext4|xfs"} +``` + +To exclude a match: + +``` +node_filesystem_avail_bytes{fstype!="xfs"} +``` + +You can also get a range of samples back from the current time by using square brackets. You can use **s** to represent seconds, **m** for minutes, **h** for hours, **d** for days, **w** for weeks, and **y** for years. When using time ranges, the vector returned will be a range vector. + +For example, the following command produces the samples from five minutes to the present: + +``` +node_memory_MemAvailable_bytes[5m] +``` + +Prometheus also includes functions to allow advanced queries, such as this: + +``` +100 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated (1 - avg by(instance)(irate(node_cpu_seconds_total{job='webservers',mode='idle'}[5m]))) +``` + +Notice how the labels are used to filter the job and the mode. The metric **node_cpu_seconds_total** returns a counter, and the **irate()** function calculates the per-second rate of change based on the last two data points of the range interval (meaning the range can be smaller than five minutes). To calculate the overall CPU usage, you can use the idle mode of the **node_cpu_seconds_total** metric. The idle percent of a processor is the opposite of a busy processor, so the **irate** value is subtracted from 1. To make it a percentage, multiply it by 100. + +![](https://opensource.com/sites/default/files/uploads/cpu-usage.png) + +### Learn more + +Prometheus is a powerful, scalable, lightweight, and easy to use and deploy monitoring tool that is indispensable for every system administrator and developer. For these and other reasons, many companies are implementing Prometheus as part of their infrastructure. + +To learn more about Prometheus and its functions, I recommend the following resources: + ++ About [PromQL][8] ++ What [node_exporters collects][9] ++ [Prometheus functions][10] ++ [4 open source monitoring tools][11] ++ [Now available: The open source guide to DevOps monitoring tools][12] + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/introduction-prometheus + +作者:[Michael Zamot][a] +选题:[lujun9972][b] +译者:[译者ID](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://prometheus.io/ +[2]: https://www.cncf.io/ +[3]: https://prometheus.io/docs/alerting/alertmanager/ +[4]: https://en.wikipedia.org/wiki/PagerDuty +[5]: https://grafana.com/ +[6]: https://opensource.com/article/18/3/how-use-ansible-set-system-monitoring-prometheus +[7]: https://prometheus.io/docs/prometheus/latest/querying/basics/ +[8]: https://prometheus.io/docs/prometheus/latest/querying/basics/ +[9]: https://github.com/prometheus/node_exporter#collectors +[10]: https://prometheus.io/docs/prometheus/latest/querying/functions/ +[11]: https://opensource.com/article/18/8/open-source-monitoring-tools +[12]: https://opensource.com/article/18/8/now-available-open-source-guide-devops-monitoring-tools From a9b3773a74c7e41743ee2f62da56a500dab87614 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 11:55:44 +0800 Subject: [PATCH 0215/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Termtosvg=20?= =?UTF-8?q?=E2=80=93=20Record=20Your=20Terminal=20Sessions=20As=20SVG=20An?= =?UTF-8?q?imations=20In=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nal Sessions As SVG Animations In Linux.md | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md diff --git a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md new file mode 100644 index 0000000000..f25406a66a --- /dev/null +++ b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux) +[#]: via: (https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux +====== + +By default everyone prefer history command to review/recall the previously entered commands in terminal. + +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. + +This tool will help us to record the users terminal activity, also will help us to identify other useful information from the output. + +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]** and **[Terminalizer Tool][2]**. + +But if you are looking for **[GIF Recorder][3]** then try **[Gifine][4]** , **[Kgif][5]** and **[Peek][6]** utilities. + +Script is one of the best utility to record your terminal session on headless server. + +Script is a Unix command line utility that records a terminal session (in other terms, It’s record everything displayed on your terminal). + +It stores the output in the current directory as a text file and the default file name is typescript. + +### What is Termtosvg + +Termtosvg is a Unix terminal recorder written in Python that renders your command line sessions as standalone SVG animations. + +### Termtosvg Features + + * Produce lightweight and clean looking animations embeddable on a project page. + * Custom color themes, terminal UI and animation controls via SVG templates. + * Compatible with asciinema recording format. + * It requires Python >= 3.5 + + + +### How to Install Termtosvg In Linux + +It was written in Python and pip installation is a recommended method to install Termtosvg on Linux. + +Make sure you should have installed python-pip package on your system. If no, use the following command to install it. + +For Debian/Ubuntu users, use **[Apt Command][7]** or **[Apt-Get Command][8]** to install pip package. + +``` +$ sudo apt install python-pip +``` + +For Archlinux users, use **[Pacman Command][9]** to install pip package. + +``` +$ sudo pacman -S python-pip +``` + +For Fedora users, use **[DNF Command][10]** to install pip package. + +``` +$ sudo dnf install python-pip +``` + +For CentOS/RHEL users, use **[YUM Command][11]** to install pip package. + +``` +$ sudo yum install python-pip +``` + +For openSUSE users, use **[Zypper Command][12]** to install pip package. + +``` +$ sudo zypper install python-pip +``` + +Finally run the following **[pip command][13]** to install Termtosvg tool in Linux. + +``` +$ sudo pip3 install termtosvg pyte python-xlib svgwrite +``` + +### How to Record Your Terminal Session Using Termtosvg + +Once you successfully installed Termtosvg. Just run the following command to start recording. + +``` +$ termtosvg +Recording started, enter "exit" command or Control-D to end +``` + +For testing purpose run few commands and see whether it’s working fine or not. + +``` +$ 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 +$ hostname +daygeek-Y700 +$ cat /etc/*-release +Manjaro Linux +DISTRIB_ID=ManjaroLinux +DISTRIB_RELEASE=18.0 +DISTRIB_CODENAME=Illyria +DISTRIB_DESCRIPTION="Manjaro Linux" +Manjaro Linux +NAME="Manjaro Linux" +ID=manjaro +ID_LIKE=arch +PRETTY_NAME="Manjaro Linux" +ANSI_COLOR="1;32" +HOME_URL="https://www.manjaro.org/" +SUPPORT_URL="https://www.manjaro.org/" +BUG_REPORT_URL="https://bugs.manjaro.org/" +$ free -g +free: Multiple unit options doesn't make sense. +$ free -m +free: Multiple unit options doesn't make sense. +$ pip3 --version +pip 18.1 from /usr/lib/python3.7/site-packages/pip (python 3.7) +``` + +Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in `/tmp` folder with a unique name. + +``` +$ exit +exit +Recording ended, SVG animation is /tmp/termtosvg_5waorper.svg +``` + +We can open the SVG file output with help of any web browser. + +``` +$ firefox /tmp/termtosvg_5waorper.svg +``` + +![][15] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-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/script-command-record-save-your-terminal-session-activity-linux/ +[2]: https://www.2daygeek.com/terminalizer-a-tool-to-record-your-terminal-and-generate-animated-gif-images/ +[3]: https://www.2daygeek.com/category/gif-recorder/ +[4]: https://www.2daygeek.com/gifine-create-animated-gif-vedio-recorder-linux-mint-debian-ubuntu/ +[5]: https://www.2daygeek.com/kgif-create-animated-gif-file-active-window-screen-recorder-capture-arch-linux-mint-fedora-ubuntu-debian-opensuse-centos/ +[6]: https://www.2daygeek.com/peek-create-animated-gif-screen-recorder-capture-arch-linux-mint-fedora-ubuntu/ +[7]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[8]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[9]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[10]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[11]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[12]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[13]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[14]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[15]: https://www.2daygeek.com/wp-content/uploads/2018/12/Termtosvg-Record-Your-Terminal-Sessions-As-SVG-Animations-In-Linux-1.gif From 72cac1ddd191b5564b8b85c744755bdaabb6bc72 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 11:58:26 +0800 Subject: [PATCH 0216/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Let=20your=20Li?= =?UTF-8?q?nux=20terminal=20speak=20its=20mind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Let your Linux terminal speak its mind.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/tech/20181220 Let your Linux terminal speak its mind.md diff --git a/sources/tech/20181220 Let your Linux terminal speak its mind.md b/sources/tech/20181220 Let your Linux terminal speak its mind.md new file mode 100644 index 0000000000..7f237c0962 --- /dev/null +++ b/sources/tech/20181220 Let your Linux terminal speak its mind.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Let your Linux terminal speak its mind) +[#]: via: (https://opensource.com/article/18/12/linux-toy-espeak) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Let your Linux terminal speak its mind +====== +eSpeak is an open source text-to-speech synthesizer that can be invoked from the Linux command line. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) + +Greetings from another day in our 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. + +We hope that even if you've seen some of these before, there will be something new for everybody in our series. + +Some of you may be too young to remember, but before there was Alexa, Siri, or the Google Assistant, computers still had voices. + +Many of us will never forget HAL 9000 from [2001: A Space Odessey][1] helpfully conversing with the crew (sorry, Dave). But between 1960s science fiction and today, there was a whole generation of speaking computers. Some of them great, most of them, not so great. + +One of my favorites is the open source project [eSpeak][2]. It's available in many forms, including a library version you can use to include speech technology in your own project, but it also coms as a command-line program that you can install and use easily. In my distribution, this was as simple as: + +``` +$ sudo dnf install espeak +``` + +Invoking eSpeak then can be invoked either interactively, or by piping text to it using the output of another program or a simple echo command. There are a number of [voice files][3] available for eSpeak, and if you're especially bored over the holidays, you could even create your own. + +A fork of eSpeak called eSpeak NG ("Next Generation") was created in 2015 from some developers who wanted to continue development of the otherwise lightly-updated eSpeak. eSpeak is made available as open source under a GPL version 3 license, and you can find out more about the project and download the source code [on SourceForge][2]. + +I'll also throw in a bonus toy today, [cava][4]. Because I've been eager to give each of these articles a unique screenshot as the lead image, and today's toy outputs sound rather than something visual, I needed to find something to fill the space. Short for "console-based audio visualizer for ALSA" (although it supports more than just ALSA now), cava is a nice MIT-licensed terminal audio visualization tool that's fun to watch. Below, is a visualization of eSpeak's output of the following: + +``` +$ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-cava.gif) + +Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, 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, [Solve a puzzle at the Linux command line with nudoku][5], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-espeak + +作者:[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://en.wikipedia.org/wiki/2001:_A_Space_Odyssey_(film) +[2]: http://espeak.sourceforge.net/ +[3]: http://espeak.sourceforge.net/voices.html +[4]: https://github.com/karlstav/cava +[5]: https://opensource.com/article/18/12/linux-toy-nudoku From c3e4b8640c490d562dadc579d7f0b6430156a967 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 12:04:58 +0800 Subject: [PATCH 0217/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Head=20to=20the?= =?UTF-8?q?=20arcade=20in=20your=20Linux=20terminal=20with=20this=20Pac-ma?= =?UTF-8?q?n=20clone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Linux terminal with this Pac-man clone.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md new file mode 100644 index 0000000000..3bd36352a4 --- /dev/null +++ b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) +[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Head to the arcade in your Linux terminal with this Pac-man clone +====== +Want to recreate the magic of your favorite arcade game? Today's command-line toy will transport you back in time. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) + +Welcome back to another day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what command-line toys are all about. Basically, they're games and simple diversions that help you have fun at the terminal. + +Some are new, and some are old classics. We hope you enjoy. + +Today's toy, MyMan, is a fun clone of the classic arcade game [Pac-Man][1]. (You didn't think this was going to be about the [similarly-named][2] Linux package manager, did you?) If you're anything like me, you spent more than your fair share of quarters trying to hit a high score Pac-Man back in the day, and still give it a go whenever you get a chance. + +MyMan isn't the only Pac-Man clone for the Linux terminal, but it's the one I chose to include because 1) I like its visual style, which rings true to the original and 2) it's conveniently packaged for my Linux distribution so it was an easy install. But you should check out your other options as well. Here's [another one][3] that looks like it may be promising, but I haven't tried it. + +Since MyMan was packaged for Fedora, installation was as simple as: + +``` +$ dnf install myman +``` + +MyMan is made available under an MIT license and you can check out the source code on [SourceForge][4]. +![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [The Linux terminal is no one-trick pony][5], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-myman + +作者:[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://en.wikipedia.org/wiki/Pac-Man +[2]: https://wiki.archlinux.org/index.php/pacman +[3]: https://github.com/YoctoForBeaglebone/pacman4console +[4]: https://myman.sourceforge.io/ +[5]: https://opensource.com/article/18/12/linux-toy-ponysay From d2f845b4078949550748fcb3cfedfe4d8c7989f8 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 12:08:07 +0800 Subject: [PATCH 0218/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20The=20Linux=20t?= =?UTF-8?q?erminal=20is=20no=20one-trick=20pony?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...The Linux terminal is no one-trick pony.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/tech/20181214 The Linux terminal is no one-trick pony.md diff --git a/sources/tech/20181214 The Linux terminal is no one-trick pony.md b/sources/tech/20181214 The Linux terminal is no one-trick pony.md new file mode 100644 index 0000000000..28964b249c --- /dev/null +++ b/sources/tech/20181214 The Linux terminal is no one-trick pony.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Linux terminal is no one-trick pony) +[#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +The Linux terminal is no one-trick pony +====== +Bring the magic of My Little Pony to your Linux command line. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-ponysay.png?itok=ehl6pTr_) + +Welcome to another day of the 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. + +Reader [Lori][1] made the suggestion of today's toy in a comment on my previous article on [cowsay][2]: + +"Hmmm, I've been playing with something called ponysay which seems to be a full-color variant on your cowsay." + +Intrigued, I had to check it out, and I was not disappointed with what I found. + +In a nutshell, **[ponysay][3]** is exactly that: a rewrite of **cowsay** that includes many full-color characters from [My Little Pony][4], that you can use to output phrases at the Linux command line. It's actually a really well-done project, that features over 400 characters and character combinations, and is incredibly well documented in a [78-page PDF][5] covering full usage. + +To install **ponysay** , you'll want to check out the project [README][6] to select the installation method that works best for your distribution and situation. Since ponysay didn't appear to be packaged for my distribution, Fedora, I opted to try out the Docker container image, but do what works best for you; installation from source may also work for you. + +I was curious to try out [**podman**][7] as a drop-in replacement for **docker** for a casual container users, and for me at least, it just worked! + +``` +$ podman run -ti --rm mpepping/ponysay 'Ponytastic' +``` + +The outputs are amazing, and I challenge you to try it out and let me know your favorite. Here was one of mine: + +![](https://opensource.com/sites/default/files/uploads/linux-toy-ponysay-output.png) + +It's developers chose to write the code in [Pony][8]! (Update: Sadly, I was wrong about this. It's written in Python, though GitHub believes it to be Pony because of the file extensions.) Ponysay is licensed under the GPL version 3, and you can pick up its source code [on GitHub][3]. + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Relax by the fire at your Linux terminal][9], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-ponysay + +作者:[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/users/n8chz +[2]: https://opensource.com/article/18/12/linux-toy-cowsay +[3]: https://github.com/erkin/ponysay +[4]: https://en.wikipedia.org/wiki/My_Little_Pony +[5]: https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true +[6]: https://github.com/erkin/ponysay/blob/master/README.md +[7]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers +[8]: https://opensource.com/article/18/5/pony +[9]: https://opensource.com/article/18/12/linux-toy-aafire From f58b4fd6bb05818338e59a0ed222dcab7d49a194 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 12:12:37 +0800 Subject: [PATCH 0219/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Relax=20by=20th?= =?UTF-8?q?e=20fire=20at=20your=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...elax by the fire at your Linux terminal.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/tech/20181213 Relax by the fire at your Linux terminal.md diff --git a/sources/tech/20181213 Relax by the fire at your Linux terminal.md b/sources/tech/20181213 Relax by the fire at your Linux terminal.md new file mode 100644 index 0000000000..f9a53fc4c4 --- /dev/null +++ b/sources/tech/20181213 Relax by the fire at your Linux terminal.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Relax by the fire at your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Relax by the fire at your Linux terminal +====== +Chestnuts roasting on an open command prompt? Why not, with this fun Linux toy. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-aafire.png?itok=pAttiVvG) + +Welcome back. Here we are, just past the halfway mark at day 13 of our 24 days of Linux command-line toys. If this is your first visit to the series, see the link to the previous article at the bottom of this one, and take a look back to learn what it's all about. In short, our command-line toys are anything that's a fun diversion at the terminal. + +Maybe some are familiar, and some aren't. Either way, we hope you have fun. + +If you're in the northern hemisphere outside of the tropics, perhaps winter is starting to rear its frigid face outside. At least it is where I live. And some I'd love nothing more than to curl up by the fire with a cup of tea and my favorite book (or a digital equivalent). + +The bad news is my house lacks a fireplace. The good news is that I can still pretend, thanks to the Linux terminal and today's command-line toy, **aafire**. + +On my system, I found **aafire** packed with **aalib** , a delightful library for converting visual images into the style of ASCII art and making it available at your terminal (or elsewhere). **aalib** enables all sorts of fun graphics at the Linux terminal, so we may revisit a toy or two that make use of it before the end of our series. On Fedora, this meant installation was as simple as: + +``` +$ sudo dnf install aalib +``` + +Then, it was simple to launch with the **aafire** command. By default, **aalib** attempted to draw to my GUI, so I had to manually override it to keep my fire in the terminal (this is a command-line series, after all). Fortunately, it comes with a [curses][1] driver, so this meant I just had to run the following to get my fire going: + +``` +$ aafire -driver curses +``` +![](https://opensource.com/sites/default/files/uploads/linux-toy-aafire-animated.gif) +You can find out more about the **aa-lib** library and download the source on [Sourceforge][2], under an LGPLv2 license. + +Do you have a favorite command-line toy that you think I ought to include? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Patch into The Matrix at the Linux command line][3] , and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-aafire + +作者:[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://en.wikipedia.org/wiki/Curses_(programming_library) +[2]: http://aa-project.sourceforge.net/aalib/ +[3]: https://opensource.com/article/18/12/linux-toy-cmatrix From ffdf4eb68ae6fed5fd3ec6a83c4dae451d764ead Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 12:13:29 +0800 Subject: [PATCH 0220/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Solve=20a=20puz?= =?UTF-8?q?zle=20at=20the=20Linux=20command=20line=20with=20nudoku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e at the Linux command line with nudoku.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md diff --git a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md new file mode 100644 index 0000000000..7822a0cb98 --- /dev/null +++ b/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solve a puzzle at the Linux command line with nudoku) +[#]: via: (https://opensource.com/article/18/12/linux-toy-nudoku) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Solve a puzzle at the Linux command line with nudoku +====== +Sudokus are simple logic games that can be enjoyed just about anywhere, including in your Linux terminal. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nudoku.png?itok=OS2o4Rot) + +Welcome back to another installment in our 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. + +Every year for Christmas, my mother-in-law gives my wife a Sudoku calendar. It sits on our coffee table for the year to follow. Each day is a separate sheet (except for Saturday and Sunday, that are combined onto one page), with the idea being that you have a new puzzle every day while also having a functioning calendar. + +The problem, in practice, is that it's a great pad of puzzles but not a great calendar because it turns out some days are harder than others and we just don't get through them at the necessary rate of one a day. Then, we may have a week's worth that gets batched on a lazy Sunday. + +Since I've already given you a [calendar][1] as a part of this series, I figure it's only fair to give you a Sudoku puzzle as well, except our command-line versions are decoupled so there's no pressure to complete exactly one a day. + +I found **nudoku** in my default repositories on Fedora, so installing it was as simple as: + +``` +$ sudo dnf install nudoku +``` + +Once installed, just invoke **nudoku** by name to launch it, and it should be fairly self-explanatory from there. If you've never played Sudoku before, it's fairly simple: You need to make sure that each row, each column, and each of the nine 3x3 squares that make up the large square each have one of every digit, 1-9. + +You can find **nudoku** 's c source code [on GitHub][2] under a GPLv3 license. +![](https://opensource.com/sites/default/files/uploads/linux-toy-nudoku-animated.gif) +Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, 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, [Use your Linux terminal to celebrate a banner][3] [year][3], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-nudoku + +作者:[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-cal +[2]: https://github.com/jubalh/nudoku +[3]: https://opensource.com/article/18/12/linux-toy-figlet From 10c05348c60c871ebdbf8ecd0f7148325613f0dc Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 12:16:37 +0800 Subject: [PATCH 0221/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Use=20your=20Li?= =?UTF-8?q?nux=20terminal=20to=20celebrate=20a=20banner=20year?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nux terminal to celebrate a banner year.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md diff --git a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md new file mode 100644 index 0000000000..da3f36b00f --- /dev/null +++ b/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use your Linux terminal to celebrate a banner year) +[#]: via: (https://opensource.com/article/18/12/linux-toy-figlet) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Use your Linux terminal to celebrate a banner year +====== +Need make sure your command is heard? Pipe it to a banner and it won't be missed. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) + + +Hello again for another installment in our 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 toy if **figlet** , a utility for printing text in banner form across your Linux terminal. + +You'll likely find **figlet** packaged in your standard repositories. For me on Fedora, this meant installation was as simple as: + +``` +$ sudo dnf install figlet +``` + +After that, simply use the program's name to invoke it. You can either use it interactively, or, pipe some text to it, as below: + +``` +echo "Hello world" | figlet + _   _      _ _                            _     _ +| | | | ___| | | ___   __      _____  _ __| | __| | +| |_| |/ _ \ | |/ _ \  \ \ /\ / / _ \| '__| |/ _` | +|  _  |  __/ | | (_) |  \ V  V / (_) | |  | | (_| | +|_| |_|\___|_|_|\___/    \_/\_/ \___/|_|  |_|\__,_| +``` + +There are a number of different font options available for **figlet**. To see the options available to you, try the command **showfigfonts**. For me, this displayed over a dozen. I've copied out a few of my favorites below. + +``` +block : +                                            +_|        _|                      _|         +_|_|_|    _|    _|_|      _|_|_|  _|  _|     +_|    _|  _|  _|    _|  _|        _|_|       +_|    _|  _|  _|    _|  _|        _|  _|     +_|_|_|    _|    _|_|      _|_|_|  _|    _|   + + +bubble : +  _   _   _   _   _   _   + / \ / \ / \ / \ / \ / \ +( b | u | b | b | l | e ) + \_/ \_/ \_/ \_/ \_/ \_/ + + +lean : +                                      +    _/                               +   _/    _/_/      _/_/_/  _/_/_/     +  _/  _/_/_/_/  _/    _/  _/    _/   + _/  _/        _/    _/  _/    _/     +_/    _/_/_/    _/_/_/  _/    _/   + + +script : +                          +               o           + ,   __   ,_        _ _|_ +/ \_/    /  |  |  |/ \_|   + \/ \___/   |_/|_/|__/ |_/ +                 /|       +                 \|       +``` + +You can find out more about **figlet** on the project's [homepage][1]. The version I downloaded was made available as open source under an MIT license. + +You'll find that **figlet** isn't the only banner-printer available for the Linux terminal. Another option that you may choose to check out is [toilet][2], which comes with its own set of ASCII-art style printing options. + +Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, 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, [Take a swim at your Linux terminal with asciiquarium][3], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-figlet + +作者:[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]: http://www.figlet.org/ +[2]: http://caca.zoy.org/wiki/toilet +[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium From 338b81eae6b865eda25a22f006d52263a63f369c Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 12:17:50 +0800 Subject: [PATCH 0222/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Take=20a=20swim?= =?UTF-8?q?=20at=20your=20Linux=20terminal=20with=20asciiquarium?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...t your Linux terminal with asciiquarium.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md diff --git a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md new file mode 100644 index 0000000000..d8253849ea --- /dev/null +++ b/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Take a swim at your Linux terminal with asciiquarium) +[#]: via: (https://opensource.com/article/18/12/linux-toy-asciiquarium) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Take a swim at your Linux terminal with asciiquarium +====== +Darling it's better, when your command line is wetter, thanks to ASCII. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-asciiquarium.png?itok=ZhJ9P2Ft) + +We're now nearing the end of our 24-day-long Linux command-line toys advent calendar. Just one week left after today! 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 fishy one. Say hello to **asciiquarium** , an undersea adventure for your terminal. I found **asciiquarium** in my Fedora repositories, so installing it was as simple as: + +``` +$ sudo dnf install asciiquarium +``` + +If you're running a different distribution, chances are it's packaged for you too. Just run **asciiquarium** at your terminal to feel happy as a clam. The project has been translated outside of the terminal as well, with screensavers of all of the aquatic pals being made for several non-Linux operating systems, and even an Android live wallpaper version is floating around out there. + +Visit the **asciiquarium** [homepage][1] for more information or to download the Perl source code. The project is open source under a GPL version 2 license. And if you want to learn more about how open source, open data, and open science are making a difference in the actual oceans, take a moment to go learn about the [Ocean Health Index][2]. +![](https://opensource.com/sites/default/files/uploads/linux-toy-asciiquarium-animated.gif) +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, [Schedule a visit with the Emacs psychiatrist][3], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-asciiquarium + +作者:[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://robobunny.com/projects/asciiquarium/html/ +[2]: https://opensource.com/article/18/12/protecting-world-oceans +[3]: https://opensource.com/article/18/12/linux-toy-eliza From e766f5a3aa5578ff038e74d8010e6489efe83367 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 12:18:48 +0800 Subject: [PATCH 0223/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Schedule=20a=20?= =?UTF-8?q?visit=20with=20the=20Emacs=20psychiatrist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ule a visit with the Emacs psychiatrist.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..6d72cda348 --- /dev/null +++ b/sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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] +译者:[译者ID](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://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 359ed1745fb21edfd6753183db5196e6dd5ff079 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 12:58:39 +0800 Subject: [PATCH 0224/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20open?= =?UTF-8?q?=20source=20your=20Python=20library?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... How to open source your Python library.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 sources/tech/20181219 How to open source your Python library.md diff --git a/sources/tech/20181219 How to open source your Python library.md b/sources/tech/20181219 How to open source your Python library.md new file mode 100644 index 0000000000..cf59688484 --- /dev/null +++ b/sources/tech/20181219 How to open source your Python library.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to open source your Python library) +[#]: via: (https://opensource.com/article/18/12/tips-open-sourcing-python-libraries) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +How to open source your Python library +====== +This 12-step checklist will ensure a successful launch. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) + +You wrote a Python library. I'm sure it's amazing! Wouldn't it be neat if it was easy for people to use it? Here is a checklist of things to think about and concrete steps to take when open sourcing your Python library. + +### 1\. Source + +Put the code up on [GitHub][1], where most open source projects happen and where it is easiest for people to submit pull requests. + +### 2\. License + +Choose an open source license. A good, permissive default is the [MIT License][2]. If you have specific requirements, Creative Common's [Choose a License][3] can guide you through the alternatives. Most importantly, there are three rules to keep in mind when choosing a license: + + * Don't create your own license. + * Don't create your own license. + * Don't create your own license. + + + +### 3\. README + +Put a file called README.rst, formatted with ReStructured Text, at the top of your tree. + +GitHub will render ReStructured Text just as well as Markdown, and ReST plays better with Python's documentation ecosystem. + +### 4\. Tests + +Write tests. This is not useful just for you: it is useful for people who want to make patches that avoid breaking related functionality. + +Tests help collaborators collaborate. + +Usually, it is best if they are runnable with [**pytest**][4]. There are other test runners—but very little reason to use them. + +### 5\. Style + +Enforce style with a linter: PyLint, Flake8, or Black with **\--check**. Unless you use Black, make sure to specify configuration options in a file checked into source control. + +### 6\. API documentation + +Use docstrings to document modules, functions, classes, and methods. + +There are a few styles you can use. I prefer the [Google-style docstrings][5], but [ReST docstrings][6] are an option. + +Both Google-style and ReST docstrings can be processed by Sphinx to integrate API documentation with prose documentation. + +### 7\. Prose documentation + +Use [Sphinx][7]. (Read [our article on it][8].) A tutorial is useful, but it is also important to specify what this thing is, what it is good for, what it is bad for, and any special considerations. + +### 8\. Building + +Use **tox** or **nox** to automatically run your tests and linter and build the documentation. These tools support a "dependency matrix." These matrices tend to explode fast, but try to test against a reasonable sample, such as Python versions, versions of dependencies, and possibly optional dependencies you install. + +### 9\. Packaging + +Use [setuptools][9]. Write a **setup.py** and a **setup.cfg**. If you support both Python 2 and 3, specify universal wheels in the **setup.cfg**. + +One thing **tox** or **nox** should do is build a wheel and run tests against the installed wheel. + +Avoid C extensions. If you absolutely need them for performance or binding reasons, put them in a separate package. Properly packaging C extensions deserves its own post. There are a lot of gotchas! + +### 10\. Continuous integration + +### 11\. Versions + +Use a public continuous integration runner. [TravisCI][10] and [CircleCI][11] offer free tiers for open source projects. Configure GitHub or other repo to require passing checks before merging pull requests, and you'll never have to worry about telling people to fix their tests or their style in code reviews. + +Use either [SemVer][12] or [CalVer][13]. There are many tools to help manage versions: [incremental][14], [bumpversion][15], and [setuptools_scm][16] are all packages on PyPI that help manage versions for you. + +### 12\. Release + +Release by running **tox** or **nox** and using **twine** to upload the artifacts to PyPI. You can do a "test upload" by running [DevPI][17]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/tips-open-sourcing-python-libraries + +作者:[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://github.com/ +[2]: https://en.wikipedia.org/wiki/MIT_License +[3]: https://choosealicense.com/ +[4]: https://docs.pytest.org/en/latest/ +[5]: https://github.com/google/styleguide/blob/gh-pages/pyguide.md +[6]: https://www.python.org/dev/peps/pep-0287/ +[7]: http://www.sphinx-doc.org/en/master/ +[8]: https://opensource.com/article/18/11/building-custom-workflows-sphinx +[9]: https://pypi.org/project/setuptools/ +[10]: https://travis-ci.org/ +[11]: https://circleci.com/ +[12]: https://semver.org/ +[13]: https://calver.org/ +[14]: https://pypi.org/project/incremental/ +[15]: https://pypi.org/project/bumpversion/ +[16]: https://pypi.org/project/setuptools_scm/ +[17]: https://opensource.com/article/18/7/setting-devpi From e9e3ac094bea90525634b4f08b161462d1006769 Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Fri, 21 Dec 2018 13:21:30 +0800 Subject: [PATCH 0225/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180604 4 Firefox extensions worth checking out.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180604 4 Firefox extensions worth checking out.md b/sources/tech/20180604 4 Firefox extensions worth checking out.md index 2091afe6fe..2e6a22274b 100644 --- a/sources/tech/20180604 4 Firefox extensions worth checking out.md +++ b/sources/tech/20180604 4 Firefox extensions worth checking out.md @@ -1,3 +1,4 @@ +translated by lixinyuxx 4 Firefox extensions worth checking out ====== From c4788d46b1fc35b33b06c2397da23534f0b3502a Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Fri, 21 Dec 2018 14:17:20 +0800 Subject: [PATCH 0226/4278] Update 20180419 5 guiding principles you should know before you design a microservice.md --- ...rinciples you should know before you design a microservice.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20180419 5 guiding principles you should know before you design a microservice.md b/sources/talk/20180419 5 guiding principles you should know before you design a microservice.md index a74dbd26af..fae228867e 100644 --- a/sources/talk/20180419 5 guiding principles you should know before you design a microservice.md +++ b/sources/talk/20180419 5 guiding principles you should know before you design a microservice.md @@ -1,3 +1,4 @@ +translated by lixinyuxx 5 guiding principles you should know before you design a microservice ====== From 31ee603fe7cf978b0ea2410df44ea905197c2518 Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Fri, 21 Dec 2018 14:20:51 +0800 Subject: [PATCH 0227/4278] Update 20180625 The life cycle of a software bug.md --- sources/tech/20180625 The life cycle of a software bug.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180625 The life cycle of a software bug.md b/sources/tech/20180625 The life cycle of a software bug.md index cacceb7a15..0f45d7a355 100644 --- a/sources/tech/20180625 The life cycle of a software bug.md +++ b/sources/tech/20180625 The life cycle of a software bug.md @@ -1,3 +1,4 @@ +translated by lixinyuxx The life cycle of a software bug ====== From aa63af0092018b6e5e0c14a259c6985907039a05 Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Fri, 21 Dec 2018 14:24:38 +0800 Subject: [PATCH 0228/4278] Update 20180319 6 common questions about agile development practices for teams.md --- ...mmon questions about agile development practices for teams.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20180319 6 common questions about agile development practices for teams.md b/sources/talk/20180319 6 common questions about agile development practices for teams.md index 0de7cda81c..ef472374b4 100644 --- a/sources/talk/20180319 6 common questions about agile development practices for teams.md +++ b/sources/talk/20180319 6 common questions about agile development practices for teams.md @@ -1,3 +1,4 @@ +translated by lixinyuxx 6 common questions about agile development practices for teams ====== From ae65416d979ac55a7820ed6f6b5e8c27e68afb78 Mon Sep 17 00:00:00 2001 From: jlztan Date: Fri, 21 Dec 2018 16:04:26 +0800 Subject: [PATCH 0229/4278] =?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 --- ...at is PPA- Everything You Need to Know About PPA in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md index 194dc31ef3..d0132aebf8 100644 --- a/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md +++ b/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (jlztan) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4219fe486ee2ab37f312740be93e7373ec5ee6bc Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 16:18:33 +0800 Subject: [PATCH 0230/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Tips=20for=20us?= =?UTF-8?q?ing=20Flood=20Element=20for=20performance=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...g Flood Element for performance testing.md | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 sources/tech/20181214 Tips for using Flood Element for performance testing.md diff --git a/sources/tech/20181214 Tips for using Flood Element for performance testing.md b/sources/tech/20181214 Tips for using Flood Element for performance testing.md new file mode 100644 index 0000000000..90994b0724 --- /dev/null +++ b/sources/tech/20181214 Tips for using Flood Element for performance testing.md @@ -0,0 +1,180 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tips for using Flood Element for performance testing) +[#]: via: (https://opensource.com/article/18/12/tips-flood-element-testing) +[#]: author: (Nicole van der Hoeven https://opensource.com/users/nicolevanderhoeven) + +Tips for using Flood Element for performance testing +====== +Get started with this powerful, intuitive load testing tool. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn) + +In case you missed it, there’s a new performance test tool on the block: [Flood Element][1]. It’s a scalable, browser-based tool that allows you to write scripts in JavaScript that interact with web pages like a real user would. + +Browser Level Users is a [newer approach to load testing][2] that overcomes many of the common challenges we hear about traditional methods of testing. It offers: + + * Scripting that is akin to common functional tools like Selenium and easier to learn + * More realistic results that are based on true browser performance rather than API response + * The ability to test against all components of your web app, including things like JavaScript that are rendered via the browser + + + +Given the above benefits, it’s a no-brainer to check out Flood Element for your web load testing, especially if you have struggled with existing tools like JMeter or HP LoadRunner. + +Pairing Element with [Flood][3] turns it into a pretty powerful load test tool. We have a [great guide here][4] that you can follow if you’d like to get started. I’ve been using and testing Element for several months now, and I’d like to share some tips I’ve learned along the way. + +### Initializing your script + +You can always start from scratch, but the quickest way to get started is to type `element init myfirstelementtest` from your terminal, filling in your preferred project name. + +You’ll then be asked to type the title of your test as well as the URL you’d like to script against. After a minute, you’ll see that a new directory has been created: + +![](https://opensource.com/sites/default/files/uploads/image_1_-_new_directory.png) + +Element will automatically create a file called **test.ts**. This file contains the skeleton of a script, along with some sample code to help you find a button and then click on it. But before you open it, let’s move on to… + +### Choosing the right text editor + +Scripting in Element is already pretty simple, but two things that help are syntax highlighting and code completion. Syntax highlighting will greatly improve the experience of learning a new test tool like Element, and code completion will make your scripting lightning-fast as you become more experienced. My text editor of choice is [Visual Studio Code][5], which has both of those features. It’s slick and clean, and it does the job. + +Syntax highlighting is when the text editor intelligently changes the font color of your code according to its role in the programming language you’re using. Here’s a screenshot of the **test.ts** file we generated earlier in VS Code to show you what I mean: + +![](https://opensource.com/sites/default/files/uploads/image_2_test.ts_.png) + +This makes it easier to make sense of the code at a glance: Comments are in green, values and labels are in orange, etc. + +Code completion is when you start to type something, and VS Code helpfully opens a context menu with suggestions for methods you can use. + +![][6] + +I love this because it means I don’t need to remember the exact name of the method. It also suggests names of variables you’ve already defined and highlights code that doesn’t make sense. This will help to make your tests more maintainable and readable for others, which is a great benefit as you look to scale your testing out in the future. + +![](https://opensource.com/sites/default/files/image-4-element-visible-copy.gif) + +### Taking screenshots + +One of the most powerful features of Element is its ability to take screenshots. I find it immensely useful when debugging because sometimes it’s just easier to see what’s going on visually. With protocol-based tools, debugging can be a much more involved and technical process. + +There are two ways to take screenshots in Element: + + 1. Add a setting to automatically take a screenshot when an error is encountered. You can do this by setting `screenshotOnFailure` to "true" in `TestSettings`: + + + +``` +export const settings: TestSettings = { +        device: Device.iPadLandscape, +        userAgent: 'flood-chrome-test', +        clearCache: true, +        disableCache: true, +        screenshotOnFailure: true, +} +``` + + 2. Explicitly take a screenshot at a particular point in the script. You can do this by adding + + + +``` +await browser.takeScreenshot() +``` + +to your code. + +### Viewing screenshots + +Once you’ve taken screenshots within your tests, you will probably want to view them and know that they will be stored for future safekeeping. Whether you are running your test locally on have uploaded it to Flood to run with increased concurrency, Flood Element has you covered. + +**Locally run tests** + +Screenshots will be saved as .jpg files in a timestamped folder corresponding to your run. It should look something like this: **…myfirstelementtest/tmp/element-results/test/2018-11-20T135700.595Z/flood/screenshots/**. The screenshots will be uniquely named so that new screenshots, even for the same step, don’t overwrite older ones. + +However, I rarely need to look up the screenshots in that folder because I prefer to see them in iTerm2 for MacOS. iTerm is an alternative to the terminal that works particularly well with Element. When you take a screenshot, iTerm actually shows it in-line: + +![](https://opensource.com/sites/default/files/uploads/image_5_iterm_inline.png) + +**Tests run in Flood** + +Running an Element script on Flood is ideal when you need larger concurrency. Rather than accessing your screenshot locally, Flood will centralize the images into your account, so the images remain even after the cloud load injectors are destroyed. You can get to the screenshot files by downloading Archived Results: + +![](https://opensource.com/sites/default/files/image_6_archived_results.png) + +You can also click on a step on the dashboard to see a filmstrip of your test: + +![](https://opensource.com/sites/default/files/uploads/image_7_filmstrip_view.png) + +### Using logs + +You may need to check out the logs for more technical debugging, especially when the screenshots don’t tell the whole story. Again, whether you are running your test locally or have uploaded it to Flood to run with increased concurrency, Flood Element has you covered. + +**Locally run tests** + +You can print to the console by typing, for example: `console.log('orderValues = ’ + orderValues)` + +This will print the value of the variable `orderValues` at that point in the script. You would see this in your terminal if you’re running Element locally. + +**Tests run in Flood** + +If you’re running the script on Flood, you can either download the log (in the same Archived Results zipped file mentioned earlier) or click on the Logs tab: + +![](https://opensource.com/sites/default/files/uploads/image_8_logs_tab.png) + +### Fun with flags + +Element comes with a few flags that give you more control over how the script is run locally. Here are a few of my favorites: + +**Headless flag** + +When in doubt, run Element in non-headless mode to see the script actually opening the web app on Chrome and interacting with the page. This is only possible locally, but there’s nothing like actually seeing for yourself what’s happening in real time instead of relying on screenshots and logs after the fact. To enable this mode, add the flag when running your test: + +``` +element run myfirstelementtest.ts --no-headless +``` + +**Watch flag** + +Element will automatically close the browser window when it encounters an error or finishes the iteration. Adding `--watch` will leave the browser window open and then monitor the script. As soon as the script is saved, it will automatically run it in the same window from the beginning. Simply add this flag like the above example: + +``` +--watch +``` + +**Dev tools flag** + +This opens a browser instance and runs the script with the Chrome Dev Tools open, allowing you to find locators for the next action you want to script. Simply add this flag as in the first example: + +``` +--dev-tools +``` + +For more flags, use `element run --help`. + +### Try Element + +You’ve just gotten a crash course on Flood Element and are ready to get started. [Download Element][1] to start writing functional test scripts and reusing them as load test scripts on Flood. If you don’t have a Flood account, you can easily sign up for a free trial [on the Flood website][7]. + +We’re proud to contribute to the open source community and can’t wait to have you try this new addition to the Flood line. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/tips-flood-element-testing + +作者:[Nicole van der Hoeven][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/nicolevanderhoeven +[b]: https://github.com/lujun9972 +[1]: https://element.flood.io/ +[2]: https://flood.io/blog/why-you-should-load-test-with-browsers/ +[3]: https://flood.io/ +[4]: https://help.flood.io/getting-started-with-load-testing/step-by-step-guide-flood-element +[5]: https://code.visualstudio.com/ +[6]: https://flood.io/wp-content/uploads/2018/11/vscode-codecompletion2.gif +[7]: https://flood.io/load-performance-testing-tool/free-load-testing-trial/ From cedb354f0f0a64212d1656705e6c1824d7e63683 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 16:19:41 +0800 Subject: [PATCH 0231/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=208=20tips=20to?= =?UTF-8?q?=20help=20non-techies=20move=20to=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... tips to help non-techies move to Linux.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/talk/20181217 8 tips to help non-techies move to Linux.md diff --git a/sources/talk/20181217 8 tips to help non-techies move to Linux.md b/sources/talk/20181217 8 tips to help non-techies move to Linux.md new file mode 100644 index 0000000000..14a645e0a7 --- /dev/null +++ b/sources/talk/20181217 8 tips to help non-techies move to Linux.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 tips to help non-techies move to Linux) +[#]: via: (https://opensource.com/article/18/12/help-non-techies) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +8 tips to help non-techies move to Linux +====== +Help your friends dump their proprietary operating systems and make the move to open source. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/people_team_community_group.png?itok=Nc_lTsUK) + +Back in 2016, I took down the shingle for my technology coaching business. Permanently. Or so I thought. + +Over the last 10 months, a handful of friends and acquaintances have pulled me back into that realm. How? With their desire to dump That Other Operating System™ and move to Linux. + +This has been an interesting experience, in no small part because most of the people aren't at all technical. They know how to use a computer to do what they need to do. Beyond that, they're not interested in delving deeper. That said, they were (and are) attracted to Linux for a number of reasons—probably because I constantly prattle on about it. + +While bringing them to the Linux side of the computing world, I learned a few things about helping non-techies move to Linux. If someone asks you to help them make the jump to Linux, these eight tips can help you. + +### 1\. Be honest about Linux. + +Linux is great. It's not perfect, though. It can be perplexing and sometimes frustrating for new users. It's best to prepare the person you're helping with a short pep talk. + +What should you talk about? Briefly explain what Linux is and how it differs from other operating systems. Explain what you can and _can't_ do with it. Let them know some of the pain points they might encounter when using Linux daily. + +If you take a bit of time to [ease them into][1] Linux and open source, the switch won't be as jarring. + +### 2\. It's not about you. + +It's easy to fall into what I call the _power user fallacy_ : the idea that everyone uses technology the same way you do. That's rarely, if ever, the case. + +This isn't about you. It's not about your needs or how you use a computer. It's about the person you're helping's needs and intentions. Their needs, especially if they're not particularly technical, will be different from yours. + +It doesn't matter if Ubuntu or Elementary or Manjaro aren't your distros of choice. It doesn't matter if you turn your nose up at window managers like GNOME, KDE, or Pantheon in favor of i3 or Ratpoison. The person you're helping might think otherwise. + +Put your needs and prejudices aside and help them find the right Linux distribution for them. Find out what they use their computer for and tailor your recommendations for a distribution or three based on that. + +### 3\. Not everyone's a techie. + +And not everyone wants to be. Everyone I've helped move to Linux in the last 10 months has no interest in compiling kernels or code nor in editing and tweaking configuration files. Most of them will never crack open a terminal window. I don't expect them to be interested in doing any of that in the future, either. + +Guess what? There's nothing wrong with that. Maybe they won't _get the most out of_ Linux (whatever that means) by not embracing their inner geeks. Not everyone will want to take on challenges of, say, installing and configuring Slackware or Arch. They need something that will work out of the box. + +### 4\. Take stock of their hardware. + +In an ideal world, we'd all have tricked-out, high-powered laptops or desktops with everything maxed out. Sadly, that world doesn't exist. + +That probably includes the person you're helping move to Linux. They may have slightly (maybe more than slightly) older hardware that they're comfortable with and that works for them. Hardware that they might not be able to afford to upgrade or replace. + +Also, remember that not everyone needs a system for heavy-duty development or gaming or audio and video production. They just need a computer for browsing the web, editing photos, running personal productivity software, and the like. + +One person I recently helped adopt Linux had an Acer Aspire 1 laptop with 4GB of RAM and a 64GB SSD. That helped inform my recommendations, which revolved around a few lightweight Linux distributions. + +### 5\. Help them test-drive some distros. + +The [DistroWatch][2] database contains close to 900 Linux distributions. You should be able to find three to five Linux distributions to recommend. Make a short list of the distributions you think would be a good fit for them. Also, point them to reviews so they can get other perspectives on those distributions. + +When it comes time to take those Linux distributions for a spin, don't just hand someone a bunch of flash drives and walk away. You might be surprised to learn that most people have never run a live Linux distribution or installed an operating system. Any operating system. Beyond plugging the flash drives in, they probably won't know what to do. + +Instead, show them how to [create bootable flash drives][3] and set up their computer's BIOS to start from those drives. Then, let them spend some time running the distros off the flash drives. That will give them a rudimentary feel for the distros and their window managers' quirks. + +### 6\. Walk them through an installation. + +Running a live session with a flash drive tells someone only so much. They need to work with a Linux distribution for a couple or three weeks to really form an opinion of it and to understand its quirks and strengths. + +There's a myth that Linux is difficult to install. That might have been true back in the mid-1990s, but today most Linux distributions are easy to install. You follow a few graphical prompts and let the software do the rest. + +For someone who's never installed any operating system, installing Linux can be a bit daunting. They might not know what to choose when, say, they're asked which filesystem to use or whether or not to encrypt their hard disk. + +Guide them through at least one installation. While you should let them do most of the work, be there to answer questions. + +### 7\. Be prepared to do a couple of installs. + +As I mentioned a paragraph or two ago, using a Linux distribution for two weeks gives someone ample time to regularly interact with it and see if it can be their daily driver. It often works out. Sometimes, though, it doesn't. + +Remember the person with the Acer Aspire 1 laptop? She thought Xubuntu was the right distribution for her. After a few weeks of working with it, that wasn't the case. There wasn't a technical reason—Xubuntu ran smoothly on her laptop. It was just a matter of feel. Instead, she switched back to the first distro she test drove: [MX Linux][4]. She's been happily using MX ever since. + +### 8\. Teach them to fish. + +You can't always be there to be the guiding hand. Or to be the mechanic or plumber who can fix any problems the person encounters. You have a life, too. + +Once they've settled on a Linux distribution, explain that you'll offer a helping hand for two or three weeks. After that, they're on their own. Don't completely abandon them. Be around to help with big problems, but let them know they'll have to learn to do things for themselves. + +Introduce them to websites that can help them solve their problems. Point them to useful articles and books. Doing that will help make them more confident and competent users of Linux—and of computers and technology in general. + +### Final thoughts + +Helping someone move to Linux from another, more familiar operating system can be a challenge—a challenge for them and for you. If you take it slowly and follow the advice in this article, you can make the process smoother. + +Do you have other tips for helping a non-techie switch to Linux? Feel free to share them by leaving a comment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/help-non-techies + +作者:[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/business/15/2/ato2014-lightning-talks-scott-nesbitt +[2]: https://distrowatch.com +[3]: https://opensource.com/article/18/7/getting-started-etcherio +[4]: https://opensource.com/article/18/2/mx-linux-17-distro-beginners From bb8278b5a0f8eb7b68e066c86a7d1a68467f51cc Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 16:21:18 +0800 Subject: [PATCH 0232/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20The=20Rise=20an?= =?UTF-8?q?d=20Demise=20of=20RSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181218 The Rise and Demise of RSS.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/talk/20181218 The Rise and Demise of RSS.md diff --git a/sources/talk/20181218 The Rise and Demise of RSS.md b/sources/talk/20181218 The Rise and Demise of RSS.md new file mode 100644 index 0000000000..e260070c5c --- /dev/null +++ b/sources/talk/20181218 The Rise and Demise of RSS.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Rise and Demise of RSS) +[#]: via: (https://twobithistory.org/2018/12/18/rss.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +The Rise and Demise of RSS +====== + +This post was originally published on [September 16th, 2018][1]. What follows is a revision that includes additional information gleaned from interviews with Ramanathan Guha, Ian Davis, Dan Libby, and Kevin Werbach. + +About a decade ago, the average internet user might well have heard of RSS. Really Simple Syndication, or Rich Site Summary—what the acronym stands for depends on who you ask—is a standard that websites and podcasts can use to offer a feed of content to their users, one easily understood by lots of different computer programs. Today, though RSS continues to power many applications on the web, it has become, for most people, an obscure technology. + +The story of how this happened is really two stories. The first is a story about a broad vision for 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. + +In the late 1990s, in the go-go years between Netscape’s IPO and the Dot-com crash, everyone could see that the web was going to be an even bigger deal than it already was, even if they didn’t know exactly how it was going to get there. One theory was that the web was about to be revolutionized by syndication. The web, originally built to enable a simple transaction between two parties—a client fetching a document from a single host server—would be broken open by new standards that could be used to repackage and redistribute entire websites through a variety of channels. Kevin Werbach, writing for Release 1.0, a newsletter influential among investors in the 1990s, predicted that syndication “would evolve into the core model for the Internet economy, allowing businesses and individuals to retain control over their online personae while enjoying the benefits of massive scale and scope.” + +He invited his readers to imagine a future in which fencing aficionados, rather than going directly to an “online sporting goods site” or “fencing equipment retailer,” could buy a new épée directly through e-commerce widgets embedded into their favorite website about fencing. Just like in the television world, where big networks syndicate their shows to smaller local stations, syndication on the web would allow businesses and publications to reach consumers through a multitude of intermediary sites. This would mean, as a corollary, that consumers would gain significant control over where and how they interacted with any given business or publication on the web. + +RSS was one of the standards that promised to deliver this syndicated future. To Werbach, RSS was “the leading example of a lightweight syndication protocol.” Another contemporaneous article called RSS the first protocol to realize the potential of XML. It was going to be a way for both users and content aggregators to create their own customized channels out of everything the web had to offer. And yet, two decades later, after the rise of social media and Google’s decision to shut down Google Reader, RSS appears to be [a slowly dying technology][2], now used chiefly by podcasters, programmers with tech blogs, and the occasional journalist. Though of course some people really do still rely on RSS readers, stubbornly adding an RSS feed to your blog, even in 2018, is a political statement. That little tangerine bubble has become a wistful symbol of defiance against a centralized web increasingly controlled by a handful of corporations, a web that hardly resembles the syndicated web of Werbach’s imagining. + +The future once looked so bright for RSS. What happened? Was its downfall inevitable, or was it precipitated by the bitter infighting that thwarted the development of a single RSS standard? + +### Muddied Water + +RSS was invented twice. This meant it never had an obvious owner, a state of affairs that spawned endless debate and acrimony. But it also suggests that RSS was an important idea whose time had come. + +In 1998, Netscape was struggling to envision a future for itself. Its flagship product, the Netscape Navigator web browser—once preferred by over 80 percent of web users—was quickly losing ground to Microsoft’s Internet Explorer. So Netscape decided to compete in a new arena. In May, a team was brought together to start work on what was known internally as “Project 60.” Two months later, Netscape announced “My Netscape,” a web portal that would fight it out with other portals like Yahoo, MSN, and Excite. + +The following year, in March, Netscape announced an addition to the My Netscape portal called the “My Netscape Network.” My Netscape users could now customize their My Netscape page so that it contained “channels” featuring the most recent headlines from sites around the web. As long as your favorite website published a special file in a format dictated by Netscape, you could add that website to your My Netscape page, typically by clicking an “Add Channel” button that participating websites were supposed to add to their interfaces. A little box containing a list of linked headlines would then appear. + +![A My Netscape Network Channel][3] A My Netscape Network channel for Mozilla.org, as it might look to users +about to add it to their My Netscape page. + +The special file that participating websites had to publish was an RSS file. In the My Netscape Network announcement, Netscape explained that RSS stood for “RDF Site Summary.” This was somewhat of a misnomer. RDF, or the Resource Description Framework, is basically a grammar for describing certain properties of arbitrary resources. (See [my article about the Semantic Web][4] if that sounds really exciting to you.) In 1999, a draft specification for RDF was being considered by the World Wide Web Consortium (W3C), the web’s main standards body. Though RSS was supposed to be based on RDF, the example RSS document Netscape actually released didn’t use any RDF tags at all. In a document that accompanied the Netscape RSS specification, Dan Libby, one of the specification’s authors, explained that “in this release of MNN, Netscape has intentionally limited the complexity of the RSS format.” The specification was given the 0.90 version number, the idea being that subsequent versions would bring RSS more in line with the W3C’s XML specification and the evolving draft of the RDF specification. + +RSS had been created by Libby and two other Netscape employees, Eckart Walther and Ramanathan Guha. According to an email to me from Guha, he and Walther cooked up RSS in the beginning with some input from Libby; after AOL bought Netscape in 1998, he and Walther left and it became Libby’s responsibility. Before Netscape, Guha had worked for Apple, where he came up with something called the Meta Content Framework. MCF was a format for representing metadata about anything from web pages to local files. Guha demonstrated its power by developing an application called [HotSauce][5] that visualized relationships between files as a network of nodes suspended in 3D space. Immediately after leaving Apple for Netscape, Guha worked with a Netscape consultant named Tim Bray, who in a post on his blog said that he and Guha eventually produced an XML-based version of MCF that in turn became the foundation for the W3C’s RDF draft. It’s no surprise, then, that Guha, Walther, and Libby were keen to build on Guha’s prior work and incorporate RDF into RSS. But Libby later wrote that the original vision for an RDF-based RSS was pared back because of time constraints and the perception that RDF was “‘too complex’ for the ‘average user.’” + +While Netscape was trying to win eyeballs in what became known as the “portal wars,” elsewhere on the web a new phenomenon known as “weblogging” was being pioneered. One of these pioneers was Dave Winer, CEO of a company called UserLand Software, which developed early content management systems that made blogging accessible to people without deep technical fluency. Winer ran his own blog, [Scripting News][6], which today is one of the oldest blogs on the internet. More than a year before Netscape announced My Netscape Network, on December 15, 1997, Winer published a post announcing that the blog would now be available in XML as well as HTML. + +Dave Winer’s XML format became known as the Scripting News format. It was supposedly similar to Microsoft’s Channel Definition Format (a “push technology” standard submitted to the W3C in March, 1997), but I haven’t been able to find a file in the original format to verify that claim. Like Netscape’s RSS, it structured the content of Winer’s blog so that it could be understood by other software applications. When Netscape released RSS 0.90, Winer and UserLand Software began to support both formats. But Winer believed that Netscape’s format was “woefully inadequate” and “missing the key thing web writers and readers need.” It could only represent a list of links, whereas the Scripting News format could represent a series of paragraphs, each containing one or more links. + +In June 1999, two months after Netscape’s My Netscape Network announcement, Winer introduced a new version of the Scripting News format, called ScriptingNews 2.0b1. Winer claimed that he decided to move ahead with his own format only after trying but failing to get anyone at Netscape to care about RSS 0.90’s deficiencies. The new version of the Scripting News format added several items to the `
` element that brought the Scripting News format to parity with RSS. But the two formats continued to differ in that the Scripting News format, which Winer nicknamed the “fat” syndication format, could include entire paragraphs and not just links. + +Netscape got around to releasing RSS 0.91 the very next month. The updated specification was a major about-face. RSS no longer stood for “RDF Site Summary”; it now stood for “Rich Site Summary.” All the RDF—and there was almost none anyway—was stripped out. Many of the Scripting News tags were incorporated. In the text of the new specification, Libby explained: + +> RDF references removed. RSS was originally conceived as a metadata format providing a summary of a website. Two things have become clear: the first is that providers want more of a syndication format than a metadata format. The structure of an RDF file is very precise and must conform to the RDF data model in order to be valid. This is not easily human-understandable and can make it difficult to create useful RDF files. The second is that few tools are available for RDF generation, validation and processing. For these reasons, we have decided to go with a standard XML approach. + +Winer was enormously pleased with RSS 0.91, calling it “even better than I thought it would be.” UserLand Software adopted it as a replacement for the existing ScriptingNews 2.0b1 format. For a while, it seemed that RSS finally had a single authoritative specification. + +### The Great Fork + +A year later, the RSS 0.91 specification had become woefully inadequate. There were all sorts of things people were trying to do with RSS that the specification did not address. There were other parts of the specification that seemed unnecessarily constraining—each RSS channel could only contain a maximum of 15 items, for example. + +By that point, RSS had been adopted by several more organizations. Other than Netscape, which seems to have lost interest after RSS 0.91, the big players were Dave Winer’s UserLand Software; O’Reilly Net, which ran an RSS aggregator called Meerkat; and Moreover.com, which also ran an RSS aggregator focused on news. Via mailing list, representatives from these organizations and others regularly discussed how to improve on RSS 0.91. But there were deep disagreements about what those improvements should look like. + +The mailing list in which most of the discussion occurred was called the Syndication mailing list. [An archive of the Syndication mailing list][7] is still available. It is an amazing historical resource. It provides a moment-by-moment account of how those deep disagreements eventually led to a political rupture of the RSS community. + +On one side of the coming rupture was Winer. Winer was impatient to evolve RSS, but he wanted to change it only in relatively conservative ways. In June, 2000, he published his own RSS 0.91 specification on the UserLand website, meant to be a starting point for further development of RSS. It made no significant changes to the 0.91 specification published by Netscape. Winer claimed in a blog post that accompanied his specification that it was only a “cleanup” documenting how RSS was actually being used in the wild, which was needed because the Netscape specification was no longer being maintained. In the same post, he argued that RSS had succeeded so far because it was simple, and that by adding namespaces (a way to explicitly distinguish between different RSS vocabularies) or RDF back to the format—some had suggested this be done in the Syndication mailing list—it “would become vastly more complex, and IMHO, at the content provider level, would buy us almost nothing for the added complexity.” In a message to the Syndication mailing list sent around the same time, Winer suggested that these issues were important enough that they might lead him to create a fork: + +> I’m still pondering how to move RSS forward. I definitely want ICE-like stuff in RSS2, publish and subscribe is at the top of my list, but I am going to fight tooth and nail for simplicity. I love optional elements. I don’t want to go down the namespaces and schema road, or try to make it a dialect of RDF. I understand other people want to do this, and therefore I guess we’re going to get a fork. I have my own opinion about where the other fork will lead, but I’ll keep those to myself for the moment at least. + +Arrayed against Winer were several other people, including Rael Dornfest of O’Reilly, Ian Davis (responsible for a search startup called Calaba), and a precocious, 14-year-old Aaron Swartz. This is the same Aaron Swartz that would later co-found Reddit and become famous for his hacktivism. (In 2000, according to an email to me from Davis, his dad often accompanied him to technology meetups.) Dornfest, Davis, and Swartz all thought that RSS needed namespaces in order to accommodate the many different things everyone wanted to do with it. On another mailing list hosted by O’Reilly, Davis proposed a namespace-based module system, writing that such a system would “make RSS as extensible as we like rather than packing in new features that over-complicate the spec.” The “namespace camp” believed that RSS would soon be used for much more than the syndication of blog posts, so namespaces, rather than being a complication, were the only way to keep RSS from becoming unmanageable as it supported more and more use cases. + +At the root of this disagreement about namespaces was a deeper disagreement about what RSS was even for. Winer had invented his Scripting News format to syndicate the posts he wrote for his blog. Netscape had released RSS as “RDF Site Summary” because it was a way of recreating a site in miniature within the My Netscape online portal. Some people felt that Netscape’s original vision should be honored. Writing to the Syndication mailing list, Davis explained his view that RSS was “originally conceived as a way of building mini sitemaps,” and that now he and others wanted to expand RSS “to encompass more types of information than simple news headlines and to cater for the new uses of RSS that have emerged over the last 12 months.” This was a sensible point to make because the goal of the Netscape RSS project in the beginning was even loftier than Davis suggests: Guha told me that he wanted to create a technology that could support not just website channels but feeds about arbitrary entities such as, for example, Madonna. Further developing RSS so that it could do this would indeed be in keeping with that original motivation. But Davis’ argument also overstates the degree to which there was a unified vision at Netscape by the time the RSS specification was published. According to Libby, who I talked to via email, there was eventually contention between a “Let’s Build the Semantic Web” group and “Let’s Make This Simple for People to Author” group even within Netscape. + +For his part, Winer argued that Netscape’s original goals were irrelevant because his Scripting News format was in fact the first RSS and it had been meant for a very different purpose. Given that the people most involved in the development of RSS disagreed about who had created RSS and why, a fork seems to have been inevitable. + +The fork happened after Dornfest announced a proposed RSS 1.0 specification and formed the RSS-DEV Working Group—which would include Davis, Swartz, and several others but not Winer—to get it ready for publication. In the proposed specification, RSS once again stood for “RDF Site Summary,” because RDF had been added back in to represent metadata properties of certain RSS elements. The specification acknowledged Winer by name, giving him credit for popularizing RSS through his “evangelism.” But it also argued that RSS could not be improved in the way that Winer was advocating. Just adding more elements to RSS without providing for extensibility with a module system would “sacrifice scalability.” The specification went on to define a module system for RSS based on XML namespaces. + +Winer felt that it was “unfair” that the RSS-DEV Working Group had arrogated the “RSS 1.0” name for themselves. In another mailing list about decentralization, he wrote that he had “recently had a standard stolen by a big name,” presumably meaning O’Reilly, which had convened the RSS-DEV Working Group. Other members of the Syndication mailing list also felt that the RSS-DEV Working Group should not have used the name “RSS” without unanimous agreement from the community on how to move RSS forward. But the Working Group stuck with the name. Dan Brickley, another member of the RSS-DEV Working Group, defended this decision by arguing that “RSS 1.0 as proposed is solidly grounded in the original RSS vision, which itself had a long heritage going back to MCF (an RDF precursor) and related specs (CDF etc).” He essentially felt that the RSS 1.0 effort had a better claim to the RSS name than Winer did, since RDF had originally been a part of RSS. The RSS-DEV Working Group published a final version of their specification in December. That same month, Winer published his own improvement to RSS 0.91, which he called RSS 0.92, on UserLand’s website. RSS 0.92 made several small optional improvements to RSS, among which was the addition of the `` tag soon used by podcasters everywhere. RSS had officially forked. + +The fork might have been avoided if a better effort had been made to include Winer in the RSS-DEV Working Group. He obviously belonged there. He was a prominent contributor to the Syndication mailing list and responsible for much of RSS’ popularity, as the members of the Working Group themselves acknowledged. But, as Davis wrote in an email to me, Winer “wanted control and wanted RSS to be his legacy so was reluctant to work with us.” Tim O’Reilly, founder and CEO of O’Reilly, explained in a UserLand discussion group in September, 2000 that Winer basically refused to participate: + +> A group of people involved in RSS got together to start thinking about its future evolution. Dave was part of the group. When the consensus of the group turned in a direction he didn’t like, Dave stopped participating, and characterized it as a plot by O’Reilly to take over RSS from him, despite the fact that Rael Dornfest of O’Reilly was only one of about a dozen authors of the proposed RSS 1.0 spec, and that many of those who were part of its development had at least as long a history with RSS as Dave had. + +To this, Winer said: + +> I met with Dale [Dougherty] two weeks before the announcement, and he didn’t say anything about it being called RSS 1.0. I spoke on the phone with Rael the Friday before it was announced, again he didn’t say that they were calling it RSS 1.0. The first I found out about it was when it was publicly announced. +> +> Let me ask you a straight question. If it turns out that the plan to call the new spec “RSS 1.0” was done in private, without any heads-up or consultation, or for a chance for the Syndication list members to agree or disagree, not just me, what are you going to do? +> +> UserLand did a lot of work to create and popularize and support RSS. We walked away from that, and let your guys have the name. That’s the top level. If I want to do any further work in Web syndication, I have to use a different name. Why and how did that happen Tim? + +I have not been able to find a discussion in the Syndication mailing list about using the RSS 1.0 name prior to the announcement of the RSS 1.0 proposal. Winer, in a message to me, said that he was not trying to control RSS and just wanted to use it in his products. + +RSS would fork again in 2003, when several developers frustrated with the bickering in the RSS community sought to create an entirely new format. These developers created Atom, a format that did away with RDF but embraced XML namespaces. Atom would eventually be specified by [a proposed IETF standard][8]. After the introduction of Atom, there were three competing versions of RSS: Winer’s RSS 0.92 (updated to RSS 2.0 in 2002 and renamed “Really Simple Syndication”), the RSS-DEV Working Group’s RSS 1.0, and Atom. + +### Decline + +The proliferation of competing RSS specifications may have hampered RSS in other ways that I’ll discuss shortly. But it did not stop RSS from becoming enormously popular during the 2000s. By 2004, the New York Times had started offering its headlines in RSS and had written an article explaining to the layperson what RSS was and how to use it. Google Reader, the RSS aggregator ultimately used by millions, was launched in 2005. By 2013, RSS seemed popular enough that the New York Times, in its obituary for Aaron Swartz, called the technology “ubiquitous.” For a while, before a third of the planet had signed up for Facebook, RSS was simply how many people stayed abreast of news on the internet. + +The New York Times published Swartz’ obituary in January 2013. By that point, though, RSS had actually turned a corner and was well on its way to becoming an obscure technology. Google Reader was shut down in July 2013, ostensibly because user numbers had been falling “over the years.” This prompted several articles from various outlets declaring that RSS was dead. But people had been declaring that RSS was dead for years, even before Google Reader’s shuttering. Steve Gillmor, writing for TechCrunch in May 2009, advised that “it’s time to get completely off RSS and switch to Twitter” because “RSS just doesn’t cut it anymore.” He pointed out that Twitter was basically a better RSS feed, since it could show you what people thought about an article in addition to the article itself. It allowed you to follow people and not just channels. Gillmor told his readers that it was time to let RSS recede into the background. He ended his article with a verse from Bob Dylan’s “Forever Young.” + +Today, RSS is not dead. But neither is it anywhere near as popular as it once was. Lots of people have offered explanations for why RSS lost its broad appeal. Perhaps the most persuasive explanation is exactly the one offered by Gillmor in 2009. Social networks, just like RSS, provide a feed featuring all the latest news on the internet. Social networks took over from RSS because they were simply better feeds. They also provide more benefits to the companies that own them. Some people have accused Google, for example, of shutting down Google Reader in order to encourage people to use Google+. Google might have been able to monetize Google+ in a way that it could never have monetized Google Reader. Marco Arment, the creator of Instapaper, wrote on his blog in 2013: + +> Google Reader is just the latest casualty of the war that Facebook started, seemingly accidentally: the battle to own everything. While Google did technically “own” Reader and could make some use of the huge amount of news and attention data flowing through it, it conflicted with their far more important Google+ strategy: they need everyone reading and sharing everything through Google+ so they can compete with Facebook for ad-targeting data, ad dollars, growth, and relevance. + +So both users and technology companies realized that they got more out of using social networks than they did out of RSS. + +Another theory is that RSS was always too geeky for regular people. Even the New York Times, which seems to have been eager to adopt RSS and promote it to its audience, complained in 2006 that RSS is a “not particularly user friendly” acronym coined by “computer geeks.” Before the RSS icon was designed in 2004, websites like the New York Times linked to their RSS feeds using little orange boxes labeled “XML,” which can only have been intimidating. The label was perfectly accurate though, because back then clicking the link would take a hapless user to a page full of XML. [This great tweet][9] captures the essence of this explanation for RSS’ demise. Regular people never felt comfortable using RSS; it hadn’t really been designed as a consumer-facing technology and involved too many hurdles; people jumped ship as soon as something better came along. + +RSS might have been able to overcome some of these limitations if it had been further developed. Maybe RSS could have been extended somehow so that friends subscribed to the same channel could syndicate their thoughts about an article to each other. Maybe browser support could have been improved. But whereas a company like Facebook was able to “move fast and break things,” the RSS developer community was stuck trying to achieve consensus. When they failed to agree on a single standard, effort that could have gone into improving RSS was instead squandered on duplicating work that had already been done. Davis told me, for example, that Atom would not have been necessary if the members of the Syndication mailing list had been able to compromise and collaborate, and “all that cleanup work could have been put into RSS to strengthen it.” So if we are asking ourselves why RSS is no longer popular, a good first-order explanation is that social networks supplanted it. If we ask ourselves why social networks were able to supplant it, then the answer may be that the people trying to make RSS succeed faced a problem much harder than, say, building Facebook. As Dornfest wrote to the Syndication mailing list at one point, “currently it’s the politics far more than the serialization that’s far from simple.” + +So today we are left with centralized silos of information. Even so, the syndicated web that Werbach foresaw in 1999 has been realized, just not in the way he thought it would be. After all, The Onion is a publication that relies on syndication through Facebook and Twitter the same way that Seinfeld relied on syndication to rake in millions after the end of its original run. I asked Werbach what he thinks about this and he more or less agrees. He told me that RSS, on one level, was clearly a failure, because it isn’t now “a technology that is really the core of the whole blogging world or content world or world of assembling different elements of things into sites.” But, on another level, “the whole social media revolution is partly about the ability to aggregate different content and resources” in a manner reminiscent of RSS and his original vision for a syndicated web. To Werbach, “it’s the legacy of RSS, even if it’s not built on RSS.” + +Unfortunately, syndication on the modern web still only happens through one of a very small number of channels, meaning that none of us “retain control over our online personae” the way that Werbach imagined we would. One reason this happened is garden-variety corporate rapaciousness—RSS, an open format, didn’t give technology companies the control over data and eyeballs that they needed to sell ads, so they did not support it. But the more mundane reason is that centralized silos are just easier to design than common standards. Consensus is difficult to achieve and it takes time, but without consensus spurned developers will go off and create competing standards. The lesson here may be that if we want to see a better, more open web, we have to get better at not screwing each other over. + +If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][10] on Twitter or subscribe to the [RSS feed][11] to make sure you know when a new post is out. + +Previously on TwoBitHistory… + +> I've long wondered if the Unix commands on my Macbook are built from the same code that they were built from 20 or 30 years ago. The answer, it turns, out, is "kinda"! +> +> My latest post, on how the implementation of cat has changed over the years: +> +> — TwoBitHistory (@TwoBitHistory) [November 12, 2018][12] + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2018/12/18/rss.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://twobithistory.org/2018/09/16/the-rise-and-demise-of-rss.html +[2]: https://trends.google.com/trends/explore?date=all&geo=US&q=rss +[3]: https://twobithistory.org/images/mnn-channel.gif +[4]: https://twobithistory.org/2018/05/27/semantic-web.html +[5]: http://web.archive.org/web/19970703020212/http://mcf.research.apple.com:80/hs/screen_shot.html +[6]: http://scripting.com +[7]: https://groups.yahoo.com/neo/groups/syndication/info +[8]: https://tools.ietf.org/html/rfc4287 +[9]: https://twitter.com/mgsiegler/status/311992206716203008 +[10]: https://twitter.com/TwoBitHistory +[11]: https://twobithistory.org/feed.xml +[12]: https://twitter.com/TwoBitHistory/status/1062114484209311746?ref_src=twsrc%5Etfw From c12558dba34b6a2bf64a6f7a6c10fdde55dfefbc Mon Sep 17 00:00:00 2001 From: zjon Date: Fri, 21 Dec 2018 16:28:31 +0800 Subject: [PATCH 0233/4278] 20171012 7 Best eBook Readers for Linux has translated 20171012 7 Best eBook Readers for Linux has translated --- ...20171012 7 Best eBook Readers for Linux.md | 190 ------------------ ...20171012 7 Best eBook Readers for Linux.md | 182 +++++++++++++++++ 2 files changed, 182 insertions(+), 190 deletions(-) delete mode 100644 sources/tech/20171012 7 Best eBook Readers for Linux.md create mode 100644 translated/tech/20171012 7 Best eBook Readers for Linux.md diff --git a/sources/tech/20171012 7 Best eBook Readers for Linux.md b/sources/tech/20171012 7 Best eBook Readers for Linux.md deleted file mode 100644 index 9f69c6decb..0000000000 --- a/sources/tech/20171012 7 Best eBook Readers for Linux.md +++ /dev/null @@ -1,190 +0,0 @@ -zjon is translating -7 Best eBook Readers for Linux -====== -**Brief:** In this article, we are covering some of the best ebook readers for Linux. These apps give a better reading experience and some will even help in managing your ebooks. - -![Best eBook readers for Linux][1] - -Lately, the demand for digital books has increased as people find it more comfortable in reading a book on their handheld devices, Kindle or PC. When it comes to the Linux users, there are various ebook apps that will serve your purpose in reading and organizing your ebook collections. - -In this article, we have compiled seven best ebook readers for Linux. These ebook readers are best suited for pdf, epubs and other ebook formats. - -## Best eBook readers for Linux - -I have provided installation instructions for Ubuntu as I am using Ubuntu right now. If you use [non-Ubuntu Linux distributions][2], you can find most of these eBook applications in the software repositories of your distro. - -### 1. Calibre - -[Calibre][3] is one of the most popular eBook apps for Linux. To be honest, it's a lot more than just a simple eBook reader. It's a complete eBook solution. You can even [create professional eBooks with Calibre][4]. - -With a powerful eBook manager and easy to use interface, it features creation and editing of an eBook. Calibre supports a variety of formats and syncing with other ebook readers. It also lets you convert one eBook format to another with ease. - -The biggest drawback of Calibre is that it's too heavy on resources and that makes it a difficult choice as a standalone eBook reader. - -![Calibre][5] - -#### Features - - * Managing eBook: Calibre allows sorting and grouping eBooks by managing metadata. You can download metadata for an eBook from various sources or create and edit the existing field. - * Supports all major eBook formats: Calibre supports all major eBook formats and is compatible with various e-readers. - * File conversion: You can convert any ebook format to another one with the option of changing the book style, creating a table of content or improving margins while converting. You can convert your personal documents to an ebook too. - * Download magazines from the web: Calibre can deliver stories from various news sources or through RSS feed. - * Share and backup your library: It gives an option of hosting your eBook collection over its server which you can share with your friends or acccess from anywhere, using any device. Backup and import/export feature allows you to keep your collection safe and easy portability. - - - -#### Installation - -You can find it in the software repository of all major Linux distributions. For Ubuntu, search for it in Software Center or use he command below: - -`sudo apt-get install calibre` - -### 2. FBReader - -![FBReader: eBook reader for Linux][6] - -[FBReader][7] is an open source, lightweight, multi-platform ebook reader supporting various formats like ePub, fb2, mobi, rtf, html etc. It includes access to popular network libraries from where you can download ebooks for free or buy one. - -FBReader is highly customizable with options to choose colors, fonts, page-turning animations, bookmarks and dictionaries. - -#### Features - - * Supports a variety of file formats and devices like Android, iOS, Windows, Mac and more. - * Synchronize book collection, reading positions and bookmarks. - * Manage your library online by adding any book from your Linux desktop to all your devices. - * Web browser access to your stored collection. - * Supports storage of books in Google Drive and organizing of books by authors, series or other attributes. - - - -#### Installation - -You can install FBReader ebook reader from the official repository or by typing the below command in terminal. -``` -sudo apt-get install fbreader -``` - -Or, you can grab a .deb package from [here][8] and install it on your Debian based distributions. - -### 3. Okular - -[Okular][9] is another open source and cross-platform document viewer developed by KDE and is shipped as part of the KDE Application release. - -![Okular][10] - -#### Features - - * Okular supports various document formats like PDF, Postscript, DjVu, CHM, XPS, ePub and others. - * Supports features like commenting on PDF documents, highlighting and drawing different shapes etc. - * These changes are saved separately without modifying the original PDF file. - * Text from an eBook can be extracted to a text file and has an inbuilt text reading service called Jovie. - - - -Note: While checking the app, I did discover that the app doesn't support ePub file format in Ubuntu and its derivatives. The other distribution users can still utilize it's full potential. - -#### Installation - -Ubuntu users can install it by typing below command in Terminal : -``` -sudo apt-get install okular -``` - -### 4. Lucidor - -Lucidor is a handy e-book reader supporting epub file formats and catalogs in OPDS formats. It also features organizing the collection of e-books in local bookcase, searching and downloading from the internet and converting web feeds and web pages into e-books. - -Lucidor is XULRunner application giving you a look of Firefox with tabbed layout and behaves like it while storing data and configurations. It's the simplest ebook reader among the list and includes configurations like text justifications and scrolling options. - -![lucidor][11] - -You can look out for the definition from Wiktionary.org by selecting a word and right click > lookup word options. It also includes options to Web feeds or web pages as e-books. - -You can download and install the deb or RPM package from [here.][12] - -### 5. Bookworm - -![Bookworm eBook reader for Linux][13] - -Bookworm is another free and open source ebook reader supporting different file formats like epub, pdf, mobi, cbr and cbz. I wrote a dedicated article on features and installation for Bookworm apps, read it here: [Bookworm: A Simple yet Magnificent eBook Reader for Linux][14] - -#### Installation -``` -sudo apt-add-repository ppa:bookworm-team/bookworm -sudo apt-get update -sudo apt-get install bookworm -``` - -### 6. Easy Ebook Viewer - -[Easy Ebook Viewer][15] is another fantastic GTK Python app for reading ePub files. With features like basic chapter navigation, continuing from the last reading positions, importing from other ebook file formats, chapter jumping and more, Easy Ebook Viewer is a simple and minimalist ePub reader. - -![Easy-Ebook-Viewer][16] - -The app is still in its initial stage and has support for only ePub files. - -#### Installation - -You can install Easy Ebook Viewer by downloading the source code from [github][17] and compiling it yourself along with the dependencies. Alternatively, the following terminal commands will do the exact same job. -``` -sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi -git clone https://github.com/michaldaniel/Ebook-Viewer.git -cd Ebook-Viewer/ -sudo make install -``` - -After successful completion of the above steps, you can launch it from the Dash. - -### 7. Buka - -[Buka][18] is mostly an ebook manager with a simple and clean user interface. It currently supports PDF formats and is designed to help the user focus more on the content. With all the basic features of pdf reader, Buka lets you navigate through arrow keys, has zoom options and you can view 2 pages side by side. - -You can create separate lists of your PDF files and switch between them easily. Buka also provides a built-in translation tool but you need an active internet connection to use the feature. - -![Buka][19] - -#### Installation - -You can download an AppImage from the [official download page.][20] If you are not aware of it, read [how to use AppImage in Linux][21]. Alternatively, you can install it from the command line: -``` -sudo snap install buka -``` - -### Final Words - -Personally, I find Calibre best suited for my needs. Also, Bookworm looks promising to me and I am using it more often these days. Though, the selection of an ebook application totally depends on your preference. - -Which ebook app do you use? Let us know in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-ebook-readers-linux/ - -作者:[Ambarish Kumar][a] -译者:[译者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/ambarish/ -[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png -[2]:https://itsfoss.com/non-ubuntu-beginner-linux/ -[3]:https://www.calibre-ebook.com -[4]:https://itsfoss.com/create-ebook-calibre-linux/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg -[7]:https://fbreader.org -[8]:https://fbreader.org/content/fbreader-beta-linux-desktop -[9]:https://okular.kde.org/ -[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png -[12]:http://lucidor.org/lucidor/download.php -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg -[14]:https://itsfoss.com/bookworm-ebook-reader-linux/ -[15]:https://github.com/michaldaniel/Ebook-Viewer -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg -[17]:https://github.com/michaldaniel/Ebook-Viewer.git -[18]:https://github.com/oguzhaninan/Buka -[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png -[20]:https://github.com/oguzhaninan/Buka/releases -[21]:https://itsfoss.com/use-appimage-linux/ diff --git a/translated/tech/20171012 7 Best eBook Readers for Linux.md b/translated/tech/20171012 7 Best eBook Readers for Linux.md new file mode 100644 index 0000000000..89a222ea26 --- /dev/null +++ b/translated/tech/20171012 7 Best eBook Readers for Linux.md @@ -0,0 +1,182 @@ +Linux 7 个最佳电子书阅读器 +====== +**摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 + +![最佳 Linux 电子书阅读器][1] + +最近,随着人们发现在手持设备,Kindle 或者 PC 上阅读更佳舒适,对电子图书的需求有所增加。谈到 Linux 用户,有各种电子书应用满足你阅读和整理电子书的需求。 + +在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf,epubs 和其他电子书格式。 + +## 最佳 Linux 电子书阅读器 + +我提供 Ubuntu 安装说明,因为我现在使用。如果你使用[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 + +### 1. Calibre + +[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建私人电子][4] + +通过强大的电子书管理和易用的接口,它具有创建和编辑电子书。Calibre 支持多种格式和与其他电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 + +Calibre 最大的缺点是,资源上太沉重,让它成为一个艰难的选择作为一个独立的电子阅读器。 + +![Calibre][5] + +#### 特性 + + * 管理电子书:Calibre 通过管理云数据允许存储和分组电子书。你能下载一本电子书的元数据从各种来源或创建和编辑现有的字段。 + * 支持所有主流电子书格式: Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 + * 文件转换: 在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 + * 从 web 下载杂志期刊:Calibre 能从各种新闻源或者通过 RSS 订阅源传递故事。 + * 分享和备份你的电子图书馆:它提供了一个选项,托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性允许你保证你的收藏安全和方便携带。 + +#### 安装 + +你能在主流 Linux 发行版的软件库中找到它。对于 Ubuntu,在软件中心搜索它或者使用下面的命令: + +`sudo apt-get install calibre` + +### 2. FBReader + +![FBReader: Linux 电子书阅读器][6] + +[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub,fb2,mobi,rtf,html 等。它包含一些允许访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 + +#### 特性 + + * 支持多种文件格式和设备比如 Android,iOS,Windows,Mac 和更多。 + * 同步书籍收藏,阅读位置和书签。 + * 在线管理你图书馆中从你的 Linux 桌面添加到所有设备的任何书。 + * 支持 Web 浏览器允许你的存储集。 + * 支持 Google Drive 做书籍的存储和通过作者,系列或其他属性整理书籍。 + +#### 安装 + +你能从官方库或者在终端中输入一下命令安装 FBReader 电子阅读器。 +``` +sudo apt-get install fbreader +``` + +或者你能从[这里][8]抓取一个以 .deb 包并在你的基于 Debian 发行版的系统上安装它。 + +### 3. Okular + +[Okular][9] 是另一个开源的基于 KDE 开发的跨平台文档查看器,它已经作为 KDE 应用发布的一部分了。 + +![Okular][10] + +#### 特性 + + * Okular 支持多种文档格式像 PDF,Postscript,DjVu,DHM,XPS,ePub 和其他。 + * 支持在 PDF 文档中评论,高亮和绘制不通的形状等。 + * 无需修改原始 PDF 文件分别保存这些更改。 + * 电子书中的文本能被提取到一个文本文件,这个内置文本阅读服务叫 Jovie。 + +备注:检查应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 + +#### 安装 + +Ubuntu 用户可以在终端中键入下面的命令来安装它: +``` +sudo apt-get install okular +``` + +### 4. Lucidor + +Lucidor 是一个易用的支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有电子书集合在本地书柜里,搜索和下载互联网和 web 订阅和网页转换成电子书的功能。 + +Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项卡式布局,和存储数据和配置时的展现。他是列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 + +![lucidor][11] + +你可以通过选择单词并右击 > 查找单词来查找 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 + +你能从[这里][12]下载和安装 deb 或者 RPM 包。 + +### 5. Bookworm + +![Bookworm Linux 电子阅读器][13] + +Bookworm 是另一个支持多种文件格式诸如 epub, pdf, mobi, cbr and cbz 的免费开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读: [Bookworm: 一个简单而强大的 Linux 电子阅读器][14] + +#### 安装 +``` +sudo apt-add-repository ppa:bookworm-team/bookworm +sudo apt-get update +sudo apt-get install bookworm +``` + +### 6. Easy Ebook Viewer + +[Easy Ebook Viewer][15] 是另外一个用于读取 ePub 文件的很棒的 GTK python 应用.具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. + +![Easy-Ebook-Viewer][16] + +这个应用仍然处于初始阶段,只支持ePub文件。 + +#### 安装 + +你可以从 [github][17] 下载源代码和自己编译以及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 +``` +sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi +git clone https://github.com/michaldaniel/Ebook-Viewer.git +cd Ebook-Viewer/ +sudo make install +``` + +成功完成上述步骤后,你可以从Dash启动它。 + +### 7. Buka + +Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 pdf 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看 2 页。 + +你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 + +![Buka][19] + +#### 安装 + +你能从[官方下载页面][20]下载一个 AppImage。如果你不知道,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: +``` +sudo snap install buka +``` + +### 结束语 + +就我个人而言,我发现 Calibre 最适合我的需要。当然,Bookworm 看起来很有前途,这几天我经常使用它。不过,电子书应用的选择完全取决于你的喜好。 + +你使用哪个电子书应用呢?在下面的评论中让我们知道。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-ebook-readers-linux/ + +作者:[Ambarish Kumar][a] +译者:[zjon](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/ambarish/ +[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png +[2]:https://itsfoss.com/non-ubuntu-beginner-linux/ +[3]:https://www.calibre-ebook.com +[4]:https://itsfoss.com/create-ebook-calibre-linux/ +[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg +[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg +[7]:https://fbreader.org +[8]:https://fbreader.org/content/fbreader-beta-linux-desktop +[9]:https://okular.kde.org/ +[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg +[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png +[12]:http://lucidor.org/lucidor/download.php +[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg +[14]:https://itsfoss.com/bookworm-ebook-reader-linux/ +[15]:https://github.com/michaldaniel/Ebook-Viewer +[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg +[17]:https://github.com/michaldaniel/Ebook-Viewer.git +[18]:https://github.com/oguzhaninan/Buka +[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png +[20]:https://github.com/oguzhaninan/Buka/releases +[21]:https://itsfoss.com/use-appimage-linux/ From 84055453586a2a5118f5d790e14c1e852e4db091 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 16:31:08 +0800 Subject: [PATCH 0234/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Working=20with?= =?UTF-8?q?=20tarballs=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20181217 Working with tarballs on Linux.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/tech/20181217 Working with tarballs on Linux.md diff --git a/sources/tech/20181217 Working with tarballs on Linux.md b/sources/tech/20181217 Working with tarballs on Linux.md new file mode 100644 index 0000000000..29d7b6002f --- /dev/null +++ b/sources/tech/20181217 Working with tarballs on Linux.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Working with tarballs on Linux) +[#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Working with tarballs on Linux +====== +![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg) + +The word “tarball” is often used to describe the type of file used to back up a select group of files and join them into a single file. The name comes from the **.tar** file extension and the **tar** command that is used to group together the files into a single file that is then sometimes compressed to make it smaller for its move to another system. + +Tarballs are often used to back up personal or system files in place to create an archive, especially prior to making changes that might have to be reversed. Linux sysadmins, for example, will often create a tarball containing a series of configuration files before making changes to an application just in case they have to reverse those changes. Extracting the files from a tarball that’s sitting in place will generally be faster than having to retrieve the files from backups. + +### How to create a tarball on Linux + +You can create a tarball and compress it in a single step if you use a command like this one: + +``` +$ tar -cvzf PDFs.tar.gz *.pdf +``` + +The result in this case is a compressed (gzipped) file that contains all of the PDF files that are in the current directory. The compression is optional, of course. A slightly simpler command would just put all of the PDF files into an uncompressed tarball: + +``` +$ tar -cvf PDFs.tar *.pdf +``` + +Note that it’s the **z** in that list of options that causes the file to be compressed or “zipped”. The **c** specifies that you are creating the file and the **v** (verbose) indicates that you want some feedback while the command is running. Omit the **v** if you don't want to see the files listed. + +Another common naming convention is to give zipped tarballs the extension **.tgz** instead of the double extension **.tar.gz** as shown in this command: + +``` +$ tar cvzf MyPDFs.tgz *.pdf +``` + +### How to extract files from a tarball + +To extract all of the files from a gzipped tarball, you would use a command like this: + +``` +$ tar -xvzf file.tar.gz +``` + +If you use the .tgz naming convention, that command would look like this: + +``` +$ tar -xvzf MyPDFs.tgz +``` + +To extract an individual file from a gzipped tarball, you do almost the same thing but add the file name: + +``` +$ tar -xvzf PDFs.tar.gz ShenTix.pdf +ShenTix.pdf +ls -l ShenTix.pdf +-rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf +``` + +You can even delete files from a tarball if the tarball is not compressed. For example, if we wanted to remove tile file that we extracted above from the PDFs.tar.gz file, we would do it like this: + +``` +$ gunzip PDFs.tar.gz +$ ls -l PDFs.tar +-rw-rw-r-- 1 shs shs 10700800 Dec 15 11:51 PDFs.tar +$ tar -vf PDFs.tar --delete ShenTix.pdf +$ ls -l PDFs.tar +-rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar +``` + +Notice that we shaved a little space off the tar file while deleting the ShenTix.pdf file. We can then compress the file again if we want: + +``` +$ gzip -f PDFs.tar +ls -l PDFs.tar.gz +-rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John +``` + +The versatility of the command line options makes working with tarballs easy and very convenient. + +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/3328840/linux/working-with-tarballs-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world From f61819dcf5b8b4c315deb1c7d060440b695ec21b Mon Sep 17 00:00:00 2001 From: zjon Date: Fri, 21 Dec 2018 16:33:09 +0800 Subject: [PATCH 0235/4278] update title updatetitle --- ...20171012 7 Best eBook Readers for Linux.md | 182 ++++++++++++++++++ ...20171012 7 Best eBook Readers for Linux.md | 2 +- 2 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 sources/tech/20171012 7 Best eBook Readers for Linux.md diff --git a/sources/tech/20171012 7 Best eBook Readers for Linux.md b/sources/tech/20171012 7 Best eBook Readers for Linux.md new file mode 100644 index 0000000000..520c9c4533 --- /dev/null +++ b/sources/tech/20171012 7 Best eBook Readers for Linux.md @@ -0,0 +1,182 @@ +7 个最佳 Linux 电子书阅读器 +====== +**摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 + +![最佳 Linux 电子书阅读器][1] + +最近,随着人们发现在手持设备,Kindle 或者 PC 上阅读更佳舒适,对电子图书的需求有所增加。谈到 Linux 用户,有各种电子书应用满足你阅读和整理电子书的需求。 + +在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf,epubs 和其他电子书格式。 + +## 最佳 Linux 电子书阅读器 + +我提供 Ubuntu 安装说明,因为我现在使用。如果你使用[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 + +### 1. Calibre + +[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建私人电子][4] + +通过强大的电子书管理和易用的接口,它具有创建和编辑电子书。Calibre 支持多种格式和与其他电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 + +Calibre 最大的缺点是,资源上太沉重,让它成为一个艰难的选择作为一个独立的电子阅读器。 + +![Calibre][5] + +#### 特性 + + * 管理电子书:Calibre 通过管理云数据允许存储和分组电子书。你能下载一本电子书的元数据从各种来源或创建和编辑现有的字段。 + * 支持所有主流电子书格式: Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 + * 文件转换: 在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 + * 从 web 下载杂志期刊:Calibre 能从各种新闻源或者通过 RSS 订阅源传递故事。 + * 分享和备份你的电子图书馆:它提供了一个选项,托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性允许你保证你的收藏安全和方便携带。 + +#### 安装 + +你能在主流 Linux 发行版的软件库中找到它。对于 Ubuntu,在软件中心搜索它或者使用下面的命令: + +`sudo apt-get install calibre` + +### 2. FBReader + +![FBReader: Linux 电子书阅读器][6] + +[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub,fb2,mobi,rtf,html 等。它包含一些允许访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 + +#### 特性 + + * 支持多种文件格式和设备比如 Android,iOS,Windows,Mac 和更多。 + * 同步书籍收藏,阅读位置和书签。 + * 在线管理你图书馆中从你的 Linux 桌面添加到所有设备的任何书。 + * 支持 Web 浏览器允许你的存储集。 + * 支持 Google Drive 做书籍的存储和通过作者,系列或其他属性整理书籍。 + +#### 安装 + +你能从官方库或者在终端中输入一下命令安装 FBReader 电子阅读器。 +``` +sudo apt-get install fbreader +``` + +或者你能从[这里][8]抓取一个以 .deb 包并在你的基于 Debian 发行版的系统上安装它。 + +### 3. Okular + +[Okular][9] 是另一个开源的基于 KDE 开发的跨平台文档查看器,它已经作为 KDE 应用发布的一部分了。 + +![Okular][10] + +#### 特性 + + * Okular 支持多种文档格式像 PDF,Postscript,DjVu,DHM,XPS,ePub 和其他。 + * 支持在 PDF 文档中评论,高亮和绘制不通的形状等。 + * 无需修改原始 PDF 文件分别保存这些更改。 + * 电子书中的文本能被提取到一个文本文件,这个内置文本阅读服务叫 Jovie。 + +备注:检查应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 + +#### 安装 + +Ubuntu 用户可以在终端中键入下面的命令来安装它: +``` +sudo apt-get install okular +``` + +### 4. Lucidor + +Lucidor 是一个易用的支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有电子书集合在本地书柜里,搜索和下载互联网和 web 订阅和网页转换成电子书的功能。 + +Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项卡式布局,和存储数据和配置时的展现。他是列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 + +![lucidor][11] + +你可以通过选择单词并右击 > 查找单词来查找 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 + +你能从[这里][12]下载和安装 deb 或者 RPM 包。 + +### 5. Bookworm + +![Bookworm Linux 电子阅读器][13] + +Bookworm 是另一个支持多种文件格式诸如 epub, pdf, mobi, cbr and cbz 的免费开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读: [Bookworm: 一个简单而强大的 Linux 电子阅读器][14] + +#### 安装 +``` +sudo apt-add-repository ppa:bookworm-team/bookworm +sudo apt-get update +sudo apt-get install bookworm +``` + +### 6. Easy Ebook Viewer + +[Easy Ebook Viewer][15] 是另外一个用于读取 ePub 文件的很棒的 GTK python 应用.具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. + +![Easy-Ebook-Viewer][16] + +这个应用仍然处于初始阶段,只支持ePub文件。 + +#### 安装 + +你可以从 [github][17] 下载源代码和自己编译以及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 +``` +sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi +git clone https://github.com/michaldaniel/Ebook-Viewer.git +cd Ebook-Viewer/ +sudo make install +``` + +成功完成上述步骤后,你可以从Dash启动它。 + +### 7. Buka + +Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 pdf 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看 2 页。 + +你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 + +![Buka][19] + +#### 安装 + +你能从[官方下载页面][20]下载一个 AppImage。如果你不知道,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: +``` +sudo snap install buka +``` + +### 结束语 + +就我个人而言,我发现 Calibre 最适合我的需要。当然,Bookworm 看起来很有前途,这几天我经常使用它。不过,电子书应用的选择完全取决于你的喜好。 + +你使用哪个电子书应用呢?在下面的评论中让我们知道。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-ebook-readers-linux/ + +作者:[Ambarish Kumar][a] +译者:[zjon](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/ambarish/ +[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png +[2]:https://itsfoss.com/non-ubuntu-beginner-linux/ +[3]:https://www.calibre-ebook.com +[4]:https://itsfoss.com/create-ebook-calibre-linux/ +[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg +[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg +[7]:https://fbreader.org +[8]:https://fbreader.org/content/fbreader-beta-linux-desktop +[9]:https://okular.kde.org/ +[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg +[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png +[12]:http://lucidor.org/lucidor/download.php +[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg +[14]:https://itsfoss.com/bookworm-ebook-reader-linux/ +[15]:https://github.com/michaldaniel/Ebook-Viewer +[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg +[17]:https://github.com/michaldaniel/Ebook-Viewer.git +[18]:https://github.com/oguzhaninan/Buka +[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png +[20]:https://github.com/oguzhaninan/Buka/releases +[21]:https://itsfoss.com/use-appimage-linux/ diff --git a/translated/tech/20171012 7 Best eBook Readers for Linux.md b/translated/tech/20171012 7 Best eBook Readers for Linux.md index 89a222ea26..520c9c4533 100644 --- a/translated/tech/20171012 7 Best eBook Readers for Linux.md +++ b/translated/tech/20171012 7 Best eBook Readers for Linux.md @@ -1,4 +1,4 @@ -Linux 7 个最佳电子书阅读器 +7 个最佳 Linux 电子书阅读器 ====== **摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 From c39a24272d1dafb19525906c334f66a11b713cc9 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 16:34:50 +0800 Subject: [PATCH 0236/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Insync:=20The?= =?UTF-8?q?=20Hassleless=20Way=20of=20Using=20Google=20Drive=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...less Way of Using Google Drive on Linux.md | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 sources/tech/20181218 Insync- The Hassleless Way of Using Google Drive on Linux.md diff --git a/sources/tech/20181218 Insync- The Hassleless Way of Using Google Drive on Linux.md b/sources/tech/20181218 Insync- The Hassleless Way of Using Google Drive on Linux.md new file mode 100644 index 0000000000..c10e7ae4ed --- /dev/null +++ b/sources/tech/20181218 Insync- The Hassleless Way of Using Google Drive on Linux.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Insync: The Hassleless Way of Using Google Drive on Linux) +[#]: via: (https://itsfoss.com/insync-linux-review/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Insync: The Hassleless Way of Using Google Drive on Linux +====== + +Using Google Drive on Linux is a pain and you probably already know that. There is no official desktop client of Google Drive for Linux. It’s been [more than six years since Google promised Google Drive on Linux][1] but it doesn’t seem to be happening. + +In the absence of the official Google Drive client on Linux, you have no option other than trying the alternatives. I have already discussed a number of [tools that allow you to use Google Drive on Linux][2]. One of those to[ols is][3] Insync, and in my opinion, this is your best bet for a native Google Drive experience on desktop Linux. + +Note that Insync is not an open source software. Heck, it is not even free to use. + +But it has so many features that it becomes an essential tool for those Linux users who rely heavily on Google Drive. + +I briefly discussed Insync in the old article about [Google Drive and Linux][2]. In this article, I’ll discuss Insync features in detail. + +### Insync brings native Google Drive experience to Linux desktop + +![Use insync to access Google Drive in Linux][4] + +The core competency of Insync is syncing your Google Drive, but the app is much more than that. It has features to help you maximize and control your productivity, your Google Drive and your files such as: + + * Cross-platform access (supports Linux, Windows and macOS) + * Easy multiple Google Drive accounts access + * Choose your syncing location. Sync files to your hard drive, external drives and NAS! + * Support for features like file matching, symlink and ignore list + + + +Let me show you some of the main features in action: + +#### Cross-platform in true sense + +Insync claims to run the same app across all operating systems i.e., Linux, Windows, and macOS. That means that you can access the same UI across different OSes, making it easy for you to manage your files across multiple machines. + +![The UI of Insync and the default location of the Insync folder.][5]The UI of Insync and the default location of the Insync folder. + +#### Multiple Google account management + +Insync interface allows you to manage multiple Google Drive accounts seamlessly. You can easily switch between several accounts just by clicking your Google account. + +![Switching between multiple Google accounts in Insync][6]Switching between multiple Google accounts + +#### Custom sync folders + +Customize the way you sync your files and folders. You can easily set your syncing destination anywhere on your machine including external drive and network drives. + +![Customize sync location in Insync][7]Customize sync location + +The selective syncing mode also allows you to easily select a number of files and folders you’d want to sync (or unsync) in your local machine. This includes selectively syncing files within folders. + +![Selective synchronization in Insync][8]Selective synchronization + +It has features like file matching and ‘ignore list’ to help you filter files you don’t want to sync or files that you already have on your machine. + +![File matching feature in Insync][9]Avoids duplication of files + +The ‘ignore list’ allows you to set rules to exclude certain type of files from synchronization. + +![Selective syncing based on rules in Insync][10]Selective syncing based on rules + +If you prefer to work out of the desktop, you have an “Add to Insync” feature that will allow you to add any local file to your Drive. + +![Sync files right from your desktop][11]Sync files right from your desktop + +Insync also supports symlinks for those with workflows that use symbolic links. To learn more about Insync and symlinks, you can refer to [this article.][12] + +#### Exclusive features for Linux + +Insync supports the most commonly used 64-bit Linux distributions like **Ubuntu, Debian and Fedora**. You can check out the full list of distribution support [here][13]. + +Insync also has [headless][14] support for those looking to sync through the command line interface. This is perfect if you use a distro that is not fully supported by the GUI app or if you are working with servers or if you simply prefer the CLI. + +![Insync CLI][15]Command Line Interface + +You can learn more about installing and running Insync headless [here][16]. + +### Insync pricing and special discount + +Insync is a premium tool and it comes with a [price tag][17]. You have 2 licenses to choose from: + + * **Prime** is priced at $29.99 per Google account. You’ll get access to: cross-platform syncing, multiple accounts access and **support**. + * **Teams** is priced at $49.99 per Google account. You’ll be able to access all the Prime features + Team Drives syncing + + + +It’s a one-time fee which means once you buy it, you don’t have to pay it again. In a world where everything is paid monthly, it’s refreshing to pay for software that is still one-time! + +Each Google account has a 15-day free trial that will allow you to test the full suite of features, including [Team Drives][18] syncing. + +If you think it’s a bit expensive for your budget, I have good news for you. As an It’s FOSS reader, you get Insync at 25% discount. + +Just use the code ITSFOSS25 at checkout time and you will get 25% immediate discount on any license. Isn’t it cool? + +If you are not certain yet, you can try Insync free for 15 days. And if you think it’s worth the money, purchase the license with **ITSFOSS25** coupon code. + +You can download Insync from their website. + +I have used Insync from the time when it was available for free and I have always liked it. They have added more features over the time and improved its UI and performance. Overall, it’s a nice-to-have application if you use Google Drive a lot and do not mind paying for the efforts of the developers. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/insync-linux-review/ + +作者:[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://abevoelker.github.io/how-long-since-google-said-a-google-drive-linux-client-is-coming/ +[2]: https://itsfoss.com/use-google-drive-linux/ +[3]: https://www.insynchq.com +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/google-drive-linux-insync.jpeg?resize=800%2C450&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/insync_interface.jpeg?fit=800%2C501&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/insync_multiple_google_account.jpeg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/insync_folder_settings.png?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/insync_selective_sync.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/insync_file_matching.jpeg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/insync_ignore_list_1.png?ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/add-to-insync-shortcut.jpeg?ssl=1 +[12]: https://help.insynchq.com/key-features-and-syncing-explained/syncing-superpowers/using-symlinks-on-google-drive-with-insync +[13]: https://www.insynchq.com/downloads +[14]: https://en.wikipedia.org/wiki/Headless_software +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/11/insync_cli.jpeg?fit=800%2C478&ssl=1 +[16]: https://help.insynchq.com/installation-on-windows-linux-and-macos/advanced/linux-controlling-insync-via-command-line-cli +[17]: https://www.insynchq.com/pricing +[18]: https://gsuite.google.com/learning-center/products/drive/get-started-team-drive/#!/ From 8771b92c553f2585ebb69a727d5d87511d345322 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 16:41:30 +0800 Subject: [PATCH 0237/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=206=20tips=20and?= =?UTF-8?q?=20tricks=20for=20using=20KeePassX=20to=20secure=20your=20passw?= =?UTF-8?q?ords?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...using KeePassX to secure your passwords.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20181217 6 tips and tricks for using KeePassX to secure your passwords.md diff --git a/sources/tech/20181217 6 tips and tricks for using KeePassX to secure your passwords.md b/sources/tech/20181217 6 tips and tricks for using KeePassX to secure your passwords.md new file mode 100644 index 0000000000..ad688a7820 --- /dev/null +++ b/sources/tech/20181217 6 tips and tricks for using KeePassX to secure your passwords.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 tips and tricks for using KeePassX to secure your passwords) +[#]: via: (https://opensource.com/article/18/12/keepassx-security-best-practices) +[#]: author: (Michael McCune https://opensource.com/users/elmiko) + +6 tips and tricks for using KeePassX to secure your passwords +====== +Get more out of your password manager by following these best practices. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum) + +Our increasingly interconnected digital world makes security an essential and common discussion topic. We hear about [data breaches][1] with alarming regularity and are often on our own to make informed decisions about how to use technology securely. Although security is a deep and nuanced topic, there are some easy daily habits you can keep to reduce your attack surface. + +Securing passwords and account information is something that affects anyone today. Technologies like [OAuth][2] help make our lives simpler by reducing the number of accounts we need to create, but we are still left with a staggering number of places where we need new, unique information to keep our records secure. An easy way to deal with the increased mental load of organizing all this sensitive information is to use a password manager like [KeePassX][3]. + +In this article, I will explain the importance of keeping your password information secure and offer suggestions for getting the most out of KeePassX. For an introduction to KeePassX and its features, I highly recommend Ricardo Frydman's article "[Managing passwords in Linux with KeePassX][4]." + +### Why are unique passwords important? + +Using a different password for each account is the first step in ensuring that your accounts are not vulnerable to shared information leaks. Generating new credentials for every account is time-consuming, and it is extremely common for people to fall into the trap of using the same password on several accounts. The main problem with reusing passwords is that you increase the number of accounts an attacker could access if one of them experiences a credential breach. + +It may seem like a burden to create new credentials for each account, but the few minutes you spend creating and recording this information will pay for itself many times over in the event of a data breach. This is where password management tools like KeePassX are invaluable for providing convenience and reliability in securing your logins. + +### 3 tips for getting the most out of KeePassX + +I have been using KeePassX to manage my password information for many years, and it has become a primary resource in my digital toolbox. Overall, it's fairly simple to use, but there are a few best practices I've learned that I think are worth highlighting. + + 1. Add the direct login URL for each account entry. KeePassX has a very convenient shortcut to open the URL listed with an entry. (It's Control+Shift+U on Linux.) When creating a new account entry for a website, I spend some time to locate the site's direct login URL. Although most websites have a login widget in their navigation toolbars, they also usually have direct pages for login forms. By putting this URL into the URL field on the account entry setup form, I can use the shortcut to directly open the login page in my browser. + +![](https://opensource.com/sites/default/files/uploads/keepassx-tip1.png) + + 2. Use the Notes field to record extra security information. In addition to passwords, most websites will ask several questions to create additional authentication factors for an account. I use the Notes sections in my account entries to record these additional factors. + +![](https://opensource.com/sites/default/files/uploads/keepassx-tip2.png) + + 3. Turn on automatic database locking. In the **Application Settings** under the **Tools** menu, there is an option to lock the database after a period of inactivity. Enabling this option is a good common-sense measure, similar to enabling a password-protected screen lock, that will help ensure your password database is not left open and unprotected if someone else gains access to your computer. + +![](https://opensource.com/sites/default/files/uploads/keepassx_application-settings.png) + +### Food for thought + +Protecting your accounts with better password practices and daily habits is just the beginning. Once you start using a password manager, you need to consider issues like protecting the password database file and ensuring you don't forget or lose the master credentials. + +The cloud-native world of disconnected devices and edge computing makes having a central password store essential. The practices and methodologies you adopt will help minimize your risk while you explore and work in the digital world. + + 1. Be aware of retention policies when storing your database in the cloud. KeePassX's database has an open format used by several tools on multiple platforms. Sooner or later, you will want to transfer your database to another device. As you do this, consider the medium you will use to transfer the file. The best option is to use some sort of direct transfer between devices, but this is not always convenient. Always think about where the database file might be stored as it winds its way through the information superhighway; an email may get cached on a server, an object store may move old files to a trash folder. Learn about these interactions for the platforms you are using before deciding where and how you will share your database file. + + 2. Consider the source of truth for your database while you're making edits. After you share your database file between devices, you might need to create accounts for new services or change information for existing services while using a device. To ensure your information is always correct across all your devices, you need to make sure any edits you make on one device end up in all copies of the database file. There is no easy solution to this problem, but you might think about making all edits from a single device or storing the master copy in a location where all your devices can make edits. + + 3. Do you really need to know your passwords? This is more of a philosophical question that touches on the nature of memorable passwords, convenience, and secrecy. I hardly look at passwords as I create them for new accounts; in most cases, I don't even click the "Show Password" checkbox. There is an idea that you can be more secure by not knowing your passwords, as it would be impossible to compel you to provide them. This may seem like a worrisome idea at first, but consider that you can recover or reset passwords for most accounts through alternate verification methods. When you consider that you might want to change your passwords on a semi-regular basis, it almost makes more sense to treat them as ephemeral information that can be regenerated or replaced. + + + + +Here are a few more ideas to consider as you develop your best practices. + +I hope these tips and tricks have helped expand your knowledge of password management and KeePassX. You can find tools that support the KeePass database format on nearly every platform. If you are not currently using a password manager or have never tried KeePassX, I highly recommend doing so now! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/keepassx-security-best-practices + +作者:[Michael McCune][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/elmiko +[b]: https://github.com/lujun9972 +[1]: https://vigilante.pw/ +[2]: https://en.wikipedia.org/wiki/OAuth +[3]: https://www.keepassx.org/ +[4]: https://opensource.com/business/16/5/keepassx From 89340410b931c436b1e7565b2ad2eff5dcca1e34 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 16:42:35 +0800 Subject: [PATCH 0238/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=204=20cool=20new?= =?UTF-8?q?=20projects=20to=20try=20in=20COPR=20for=20December=202018?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ojects to try in COPR for December 2018.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md diff --git a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md new file mode 100644 index 0000000000..9dc8b3390f --- /dev/null +++ b/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for December 2018) +[#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) +[#]: author: (Dominik Turecek https://fedoramagazine.org) + +4 cool new projects to try in COPR for December 2018 +====== +![](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. + +### MindForger + +[MindForger][2] is a Markdown editor and a notebook. In addition to features you’d expect from a Markdown editor, MindForger lets you split a single file into multiple notes. It’s easy to organize the notes and move them around between files, as well as search through them. I’ve been using MindForger for some time for my study notes, so it’s nice that it’s available through COPR now.![][3] + +#### Installation instructions + +The repo currently provides MindForger for Fedora 29 and Rawhide. To install MindForger, use these commands: + +``` +sudo dnf copr enable deadmozay/mindforger +sudo dnf install mindforger +``` + +### Clingo + +[Clingo][4] is a program for solving logical problems using [answer set programming][5] (ASP) modeling language. With ASP, you can declaratively describe a problem as a logical program that Clingo then solves. As a result, Clingo produces solutions to the problem in the form of logical models, called answer sets. + +#### Installation instructions + +The repo currently provides Clingo for Fedora 28 and 29. To install Clingo, use these commands: + +``` +sudo dnf copr enable timn/clingo +sudo dnf install clingo +``` + +### SGVrecord + +[SGVrecord][6] is a simple tool for recording your screen. It allows you to either capture the whole screen or select just a part of it. Furthermore, it is possible to make the record with or without sound. Sgvrecord produces files in WebM format.![][7] + +#### Installation instructions + +The repo currently provides SGVrecord for Fedora 28, 29, and Rawhide. To install SGVrecord, use these commands: + +``` +sudo dnf copr enable youssefmsourani/sgvrecord +sudo dnf install sgvrecord +``` + +### Watchman + +[Watchman][8] is a service for monitoring and recording when changes are done to files. +You can specify directory trees for Watchman to monitor, as well as define actions +that are triggered when specified files are changed. + +#### Installation instructions + +The repo currently provides Watchman for Fedora 29 and Rawhide. To install Watchman, use these commands: + +``` +sudo dnf copr enable eklitzke/watchman +sudo dnf install watchman +``` + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-try-copr-december-2018/ + +作者:[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.mindforger.com/ +[3]: https://fedoramagazine.org/wp-content/uploads/2018/12/mindforger.png +[4]: https://potassco.org/clingo/ +[5]: https://en.wikipedia.org/wiki/Answer_set_programming +[6]: https://github.com/yucefsourani/sgvrecord +[7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png +[8]: https://facebook.github.io/watchman/ From e64177708c5b39b098722086a7ed82c46ff65493 Mon Sep 17 00:00:00 2001 From: Auk7F7 <34982730+Auk7F7@users.noreply.github.com> Date: Fri, 21 Dec 2018 16:43:15 +0800 Subject: [PATCH 0239/4278] Update 20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md --- ...udit - A Tool To Check Vulnerable Packages In Arch Linux.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md index 3f77bee3d1..d359a4f57c 100644 --- a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md +++ b/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( Auk7F7) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux) @@ -7,7 +7,6 @@ [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) [#]: url: ( ) -translating by Auk7F7 Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux ====== From 46bad7ca22b757d16f411b8ccbc03d19cc813977 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Fri, 21 Dec 2018 16:54:45 +0800 Subject: [PATCH 0240/4278] hankchow translating --- sources/tech/20181219 How to open source your Python library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181219 How to open source your Python library.md b/sources/tech/20181219 How to open source your Python library.md index cf59688484..e4d6adf3c6 100644 --- a/sources/tech/20181219 How to open source your Python library.md +++ b/sources/tech/20181219 How to open source your Python library.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1972e2fafdf7a438ceaf523eca15f98170203fb9 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 16:59:08 +0800 Subject: [PATCH 0241/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Inst?= =?UTF-8?q?all=20Rust=20Programming=20Language=20In=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tall Rust Programming Language In Linux.md | 179 ++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 sources/tech/20181214 How To Install Rust Programming Language In Linux.md diff --git a/sources/tech/20181214 How To Install Rust Programming Language In Linux.md b/sources/tech/20181214 How To Install Rust Programming Language In Linux.md new file mode 100644 index 0000000000..074c41e9f9 --- /dev/null +++ b/sources/tech/20181214 How To Install Rust Programming Language In Linux.md @@ -0,0 +1,179 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Install Rust Programming Language In Linux) +[#]: via: (https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +How To Install Rust Programming Language In Linux +====== + +Rust is often called rust-lang. + +Rust is a general-purpose, multi-paradigm, modern, cross-platform, and open source systems programming language sponsored by Mozilla Research. + +It was designed to be achieve a goals such as safety, speed, and concurrency. + +Rust is syntactically similar to C++,[14] but its designers intend it to provide better memory safety while still maintaining performance. + +Rust is currently used in many organization such as Firefox, Chef, Dropbox, Oracle, GNOME, etc,. + +### How to Install Runs Language in Linux? + +There are many ways we can install Rust but below is the officially recommended way to install it. + +``` +$ curl https://sh.rustup.rs -sSf | sh +info: downloading installer + +Welcome to Rust! + +This will download and install the official compiler for the Rust programming +language, and its package manager, Cargo. + +It will add the cargo, rustc, rustup and other commands to Cargo's bin +directory, located at: + + /home/daygeek/.cargo/bin + +This path will then be added to your PATH environment variable by modifying the +profile files located at: + + /home/daygeek/.profile + /home/daygeek/.bash_profile + +You can uninstall at any time with rustup self uninstall and these changes will +be reverted. + +Current installation options: + + default host triple: x86_64-unknown-linux-gnu + default toolchain: stable + modify PATH variable: yes + +1) Proceed with installation (default) +2) Customize installation +3) Cancel installation +>1 + +info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' +info: latest update on 2018-12-06, rust version 1.31.0 (abe02cefd 2018-12-04) +info: downloading component 'rustc' + 77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s +info: downloading component 'rust-std' + 54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s +info: downloading component 'cargo' + 4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s +info: downloading component 'rust-docs' + 8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s +info: installing component 'rustc' +info: installing component 'rust-std' +info: installing component 'cargo' +info: installing component 'rust-docs' +info: default toolchain set to 'stable' + + stable installed - rustc 1.31.0 (abe02cefd 2018-12-04) + + +Rust is installed now. Great! + +To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH +environment variable. Next time you log in this will be done automatically. + +To configure your current shell run source $HOME/.cargo/env +``` + +Run the following command to configure your current shell. + +``` +$ source $HOME/.cargo/env +``` + +Run the following command to verify the installed Rust version. + +``` +$ rustc --version +rustc 1.31.0 (abe02cefd 2018-12-04) +``` + +### How To Test Rust programming language? + +Once you installed Rust follow the below steps to check whether Rust programe language is working fine or not. + +``` +$ mkdir ~/projects +$ cd ~/projects +$ mkdir hello_world +$ cd hello_world +``` + +Create a file and add the below code and save the file. Make sure, Rust files always end in a .rs extension. + +``` +$ vi 2g.rs + +fn main() { + println!("Hello, It's 2DayGeek.com - Best Linux Practical Blog!"); +} +``` + +Run the following command to compile the rust code. + +``` +$ rustc 2g.rs +``` + +The above command will create a executable Rust program file in the same directory. + +``` +$ ls -lh +total 3.9M +-rwxr-xr-x 1 daygeek daygeek 3.9M Dec 14 11:09 2g +-rw-r--r-- 1 daygeek daygeek 86 Dec 14 11:09 2g.rs +``` + +Run the Rust executable file to get the output. + +``` +$ ./2g +Hello, It's 2DayGeek.com - Best Linux Practical Blog! +``` + +Yup! that’s working fine. + +To update Rust to latest version. + +``` +$ rustup update +info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' +info: checking for self-updates + + stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04) +``` + +Run the following command to remove the Rust package from your system. + +``` +$ rustup self uninstall +``` + +Once you uninstalled the Rust package, remove the Rust project directory. + +``` +$ rm -fr ~/projects +``` +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ + +作者:[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 From eb5a7af2f0bf8a5f671483e84417c16e53a7553a Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 17:01:00 +0800 Subject: [PATCH 0242/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20TLP=20=E2=80=93?= =?UTF-8?q?=20An=20Advanced=20Power=20Management=20Tool=20That=20Improve?= =?UTF-8?q?=20Battery=20Life=20On=20Linux=20Laptop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...at Improve Battery Life On Linux Laptop.md | 745 ++++++++++++++++++ 1 file changed, 745 insertions(+) create mode 100644 sources/tech/20181212 TLP - An Advanced Power Management Tool That Improve Battery Life On Linux Laptop.md diff --git a/sources/tech/20181212 TLP - An Advanced Power Management Tool That Improve Battery Life On Linux Laptop.md b/sources/tech/20181212 TLP - An Advanced Power Management Tool That Improve Battery Life On Linux Laptop.md new file mode 100644 index 0000000000..e1e6a7f25e --- /dev/null +++ b/sources/tech/20181212 TLP - An Advanced Power Management Tool That Improve Battery Life On Linux Laptop.md @@ -0,0 +1,745 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (TLP – An Advanced Power Management Tool That Improve Battery Life On Linux Laptop) +[#]: via: (https://www.2daygeek.com/tlp-increase-optimize-linux-laptop-battery-life/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +TLP – An Advanced Power Management Tool That Improve Battery Life On Linux Laptop +====== + +Laptop battery is highly optimized for Windows OS, that i had realized when i was using Windows OS in my laptop but it’s not same for Linux. + +Over the years Linux has improved a lot for battery optimization but still we need make some necessary things to improve laptop battery life in Linux. + +When i think about battery life, i got few options for that but i felt TLP is a better solutions for me so, i’m going with it. + +In this tutorial we are going to discuss about TLP in details to improve battery life. + +We had written three articles previously in our site about **[laptop battery saving utilities][1]** for Linux **[PowerTOP][2]** and **[Battery Charging State][3]**. + +### What is TLP? + +[TLP][4] is a free opensource advanced power management tool that improve your battery life without making any configuration change. + +Since it comes with a default configuration already optimized for battery life, so you may just install and forget it. + +Also, it is highly customizable to fulfill your specific requirements. TLP is a pure command line tool with automated background tasks. It does not contain a GUI. + +TLP runs on every laptop brand. Setting the battery charge thresholds is available for IBM/Lenovo ThinkPads only. + +All TLP settings are stored in `/etc/default/tlp`. The default configuration provides optimized power saving out of the box. + +The following TLP settings is available for customization and you need to make the necessary changes accordingly if you want it. + +### TLP Features + + * Kernel laptop mode and dirty buffer timeouts + * Processor frequency scaling including “turbo boost” / “turbo core” + * Limit max/min P-state to control power dissipation of the CPU + * HWP energy performance hints + * Power aware process scheduler for multi-core/hyper-threading + * Processor performance versus energy savings policy (x86_energy_perf_policy) + * Hard disk advanced power magement level (APM) and spin down timeout (per disk) + * AHCI link power management (ALPM) with device blacklist + * PCIe active state power management (PCIe ASPM) + * Runtime power management for PCI(e) bus devices + * Radeon graphics power management (KMS and DPM) + * Wifi power saving mode + * Power off optical drive in drive bay + * Audio power saving mode + * I/O scheduler (per disk) + * USB autosuspend with device blacklist/whitelist (input devices excluded automatically) + * Enable or disable integrated wifi, bluetooth or wwan devices upon system startup and shutdown + * Restore radio device state on system startup (from previous shutdown). + * Radio device wizard: switch radios upon network connect/disconnect and dock/undock + * Disable Wake On LAN + * Integrated WWAN and bluetooth state is restored after suspend/hibernate + * Untervolting of Intel processors – requires kernel with PHC-Patch + * Battery charge thresholds – ThinkPads only + * Recalibrate battery – ThinkPads only + + + +### How to Install TLP in Linux + +TLP package is available in most of the distributions official repository so, use the distributions **[Package Manager][5]** to install it. + +For **`Fedora`** system, use **[DNF Command][6]** to install TLP. + +``` +$ sudo dnf install tlp tlp-rdw +``` + +ThinkPads require an additional packages. + +``` +$ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm +$ sudo dnf install http://repo.linrunner.de/fedora/tlp/repos/releases/tlp-release.fc$(rpm -E %fedora).noarch.rpm +$ sudo dnf install akmod-tp_smapi akmod-acpi_call kernel-devel +``` + +Install smartmontool to display S.M.A.R.T. data in tlp-stat. + +``` +$ sudo dnf install smartmontools +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][7]** or **[APT Command][8]** to install TLP. + +``` +$ sudo apt install tlp tlp-rdw +``` + +ThinkPads require an additional packages. + +``` +$ sudo apt-get install tp-smapi-dkms acpi-call-dkms +``` + +Install smartmontool to display S.M.A.R.T. data in tlp-stat. + +``` +$ sudo apt-get install smartmontools +``` + +When the official package becomes outdated for Ubuntu based systems then use the following PPA repository which provides an up-to-date version. Run the following commands to install TLP using the PPA. + +``` +$ sudo apt-get install tlp tlp-rdw +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][9]** to install TLP. + +``` +$ sudo pacman -S tlp tlp-rdw +``` + +ThinkPads require an additional packages. + +``` +$ pacman -S tp_smapi acpi_call +``` + +Install smartmontool to display S.M.A.R.T. data in tlp-stat. + +``` +$ sudo pacman -S smartmontools +``` + +Enable TLP & TLP-Sleep service on boot for Arch Linux based systems. + +``` +$ sudo systemctl enable tlp.service +$ sudo systemctl enable tlp-sleep.service +``` + +You should also mask the following services to avoid conflicts and assure proper operation of TLP’s radio device switching options for Arch Linux based systems. + +``` +$ sudo systemctl mask systemd-rfkill.service +$ sudo systemctl mask systemd-rfkill.socket +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][10]** to install TLP. + +``` +$ sudo yum install tlp tlp-rdw +``` + +Install smartmontool to display S.M.A.R.T. data in tlp-stat. + +``` +$ sudo yum install smartmontools +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][11]** to install TLP. + +``` +$ sudo zypper install TLP +``` + +Install smartmontool to display S.M.A.R.T. data in tlp-stat. + +``` +$ sudo zypper install smartmontools +``` + +After successfully TLP installed, use the following command to start the service. + +``` +$ systemctl start tlp.service +``` + +To show battery information. + +``` +$ sudo tlp-stat -b +or +$ sudo tlp-stat --battery + +--- TLP 1.1 -------------------------------------------- + ++++ Battery Status +/sys/class/power_supply/BAT0/manufacturer = SMP +/sys/class/power_supply/BAT0/model_name = L14M4P23 +/sys/class/power_supply/BAT0/cycle_count = (not supported) +/sys/class/power_supply/BAT0/energy_full_design = 60000 [mWh] +/sys/class/power_supply/BAT0/energy_full = 48850 [mWh] +/sys/class/power_supply/BAT0/energy_now = 48850 [mWh] +/sys/class/power_supply/BAT0/power_now = 0 [mW] +/sys/class/power_supply/BAT0/status = Full + +Charge = 100.0 [%] +Capacity = 81.4 [%] +``` + +To show disk information. + +``` +$ sudo tlp-stat -d +or +$ sudo tlp-stat --disk + +--- TLP 1.1 -------------------------------------------- + ++++ Storage Devices +/dev/sda: + Model = WDC WD10SPCX-24HWST1 + Firmware = 02.01A02 + APM Level = 128 + Status = active/idle + Scheduler = mq-deadline + + Runtime PM: control = on, autosuspend_delay = (not available) + + SMART info: + 4 Start_Stop_Count = 18787 + 5 Reallocated_Sector_Ct = 0 + 9 Power_On_Hours = 606 [h] + 12 Power_Cycle_Count = 1792 + 193 Load_Cycle_Count = 25775 + 194 Temperature_Celsius = 31 [°C] + + ++++ AHCI Link Power Management (ALPM) +/sys/class/scsi_host/host0/link_power_management_policy = med_power_with_dipm +/sys/class/scsi_host/host1/link_power_management_policy = med_power_with_dipm +/sys/class/scsi_host/host2/link_power_management_policy = med_power_with_dipm +/sys/class/scsi_host/host3/link_power_management_policy = med_power_with_dipm + ++++ AHCI Host Controller Runtime Power Management +/sys/bus/pci/devices/0000:00:17.0/ata1/power/control = on +/sys/bus/pci/devices/0000:00:17.0/ata2/power/control = on +/sys/bus/pci/devices/0000:00:17.0/ata3/power/control = on +/sys/bus/pci/devices/0000:00:17.0/ata4/power/control = on +``` + +To show PCI device information. + +``` +$ sudo tlp-stat -e +or +$ sudo tlp-stat --pcie + +--- TLP 1.1 -------------------------------------------- + ++++ Runtime Power Management +Device blacklist = (not configured) +Driver blacklist = amdgpu nouveau nvidia radeon pcieport + +/sys/bus/pci/devices/0000:00:00.0/power/control = auto (0x060000, Host bridge, skl_uncore) +/sys/bus/pci/devices/0000:00:01.0/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:02.0/power/control = auto (0x030000, VGA compatible controller, i915) +/sys/bus/pci/devices/0000:00:14.0/power/control = auto (0x0c0330, USB controller, xhci_hcd) +/sys/bus/pci/devices/0000:00:16.0/power/control = auto (0x078000, Communication controller, mei_me) +/sys/bus/pci/devices/0000:00:17.0/power/control = auto (0x010601, SATA controller, ahci) +/sys/bus/pci/devices/0000:00:1c.0/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:1c.2/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:1c.3/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:1d.0/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:1f.0/power/control = auto (0x060100, ISA bridge, no driver) +/sys/bus/pci/devices/0000:00:1f.2/power/control = auto (0x058000, Memory controller, no driver) +/sys/bus/pci/devices/0000:00:1f.3/power/control = auto (0x040300, Audio device, snd_hda_intel) +/sys/bus/pci/devices/0000:00:1f.4/power/control = auto (0x0c0500, SMBus, i801_smbus) +/sys/bus/pci/devices/0000:01:00.0/power/control = auto (0x030200, 3D controller, nouveau) +/sys/bus/pci/devices/0000:07:00.0/power/control = auto (0x080501, SD Host controller, sdhci-pci) +/sys/bus/pci/devices/0000:08:00.0/power/control = auto (0x028000, Network controller, iwlwifi) +/sys/bus/pci/devices/0000:09:00.0/power/control = auto (0x020000, Ethernet controller, r8168) +/sys/bus/pci/devices/0000:0a:00.0/power/control = auto (0x010802, Non-Volatile memory controller, nvme) +``` + +To show graphics card information. + +``` +$ sudo tlp-stat -g +or +$ sudo tlp-stat --graphics + +--- TLP 1.1 -------------------------------------------- + ++++ Intel Graphics +/sys/module/i915/parameters/enable_dc = -1 (use per-chip default) +/sys/module/i915/parameters/enable_fbc = 1 (enabled) +/sys/module/i915/parameters/enable_psr = 0 (disabled) +/sys/module/i915/parameters/modeset = -1 (use per-chip default) +``` + +To show Processor information. + +``` +$ sudo tlp-stat -p +or +$ sudo tlp-stat --processor + +--- TLP 1.1 -------------------------------------------- + ++++ Processor +CPU model = Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz + +/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu2/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu3/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu3/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu4/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu4/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu4/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu4/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu4/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu5/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu5/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu5/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu5/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu5/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu6/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu6/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu6/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu6/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu6/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu7/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu7/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu7/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu7/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/intel_pstate/min_perf_pct = 22 [%] +/sys/devices/system/cpu/intel_pstate/max_perf_pct = 100 [%] +/sys/devices/system/cpu/intel_pstate/no_turbo = 0 +/sys/devices/system/cpu/intel_pstate/turbo_pct = 33 [%] +/sys/devices/system/cpu/intel_pstate/num_pstates = 28 + +x86_energy_perf_policy: program not installed. + +/sys/module/workqueue/parameters/power_efficient = Y +/proc/sys/kernel/nmi_watchdog = 0 + ++++ Undervolting +PHC kernel not available. +``` + +To show system data information. + +``` +$ sudo tlp-stat -s +or +$ sudo tlp-stat --system + +--- TLP 1.1 -------------------------------------------- + ++++ System Info +System = LENOVO Lenovo ideapad Y700-15ISK 80NV +BIOS = CDCN35WW +Release = "Manjaro Linux" +Kernel = 4.19.6-1-MANJARO #1 SMP PREEMPT Sat Dec 1 12:21:26 UTC 2018 x86_64 +/proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-4.19-x86_64 root=UUID=69d9dd18-36be-4631-9ebb-78f05fe3217f rw quiet resume=UUID=a2092b92-af29-4760-8e68-7a201922573b +Init system = systemd +Boot mode = BIOS (CSM, Legacy) + ++++ TLP Status +State = enabled +Last run = 11:04:00 IST, 596 sec(s) ago +Mode = battery +Power source = battery +``` + +To show temperatures and fan speed information. + +``` +$ sudo tlp-stat -t +or +$ sudo tlp-stat --temp + +--- TLP 1.1 -------------------------------------------- + ++++ Temperatures +CPU temp = 36 [°C] +Fan speed = (not available) +``` + +To show USB device data information. + +``` +$ sudo tlp-stat -u +or +$ sudo tlp-stat --usb + +--- TLP 1.1 -------------------------------------------- + ++++ USB +Autosuspend = disabled +Device whitelist = (not configured) +Device blacklist = (not configured) +Bluetooth blacklist = disabled +Phone blacklist = disabled +WWAN blacklist = enabled + +Bus 002 Device 001 ID 1d6b:0003 control = auto, autosuspend_delay_ms = 0 -- Linux Foundation 3.0 root hub (hub) +Bus 001 Device 003 ID 174f:14e8 control = auto, autosuspend_delay_ms = 2000 -- Syntek (uvcvideo) +Bus 001 Device 002 ID 17ef:6053 control = on, autosuspend_delay_ms = 2000 -- Lenovo (usbhid) +Bus 001 Device 004 ID 8087:0a2b control = auto, autosuspend_delay_ms = 2000 -- Intel Corp. (btusb) +Bus 001 Device 001 ID 1d6b:0002 control = auto, autosuspend_delay_ms = 0 -- Linux Foundation 2.0 root hub (hub) +``` + +To show warnings. + +``` +$ sudo tlp-stat -w +or +$ sudo tlp-stat --warn + +--- TLP 1.1 -------------------------------------------- + +No warnings detected. +``` + +Status report with configuration and all active settings. + +``` +$ sudo tlp-stat + +--- TLP 1.1 -------------------------------------------- + ++++ Configured Settings: /etc/default/tlp +TLP_ENABLE=1 +TLP_DEFAULT_MODE=AC +TLP_PERSISTENT_DEFAULT=0 +DISK_IDLE_SECS_ON_AC=0 +DISK_IDLE_SECS_ON_BAT=2 +MAX_LOST_WORK_SECS_ON_AC=15 +MAX_LOST_WORK_SECS_ON_BAT=60 +CPU_HWP_ON_AC=balance_performance +CPU_HWP_ON_BAT=balance_power +SCHED_POWERSAVE_ON_AC=0 +SCHED_POWERSAVE_ON_BAT=1 +NMI_WATCHDOG=0 +ENERGY_PERF_POLICY_ON_AC=performance +ENERGY_PERF_POLICY_ON_BAT=power +DISK_DEVICES="sda sdb" +DISK_APM_LEVEL_ON_AC="254 254" +DISK_APM_LEVEL_ON_BAT="128 128" +SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance" +SATA_LINKPWR_ON_BAT="med_power_with_dipm max_performance" +AHCI_RUNTIME_PM_TIMEOUT=15 +PCIE_ASPM_ON_AC=performance +PCIE_ASPM_ON_BAT=powersave +RADEON_POWER_PROFILE_ON_AC=default +RADEON_POWER_PROFILE_ON_BAT=low +RADEON_DPM_STATE_ON_AC=performance +RADEON_DPM_STATE_ON_BAT=battery +RADEON_DPM_PERF_LEVEL_ON_AC=auto +RADEON_DPM_PERF_LEVEL_ON_BAT=auto +WIFI_PWR_ON_AC=off +WIFI_PWR_ON_BAT=on +WOL_DISABLE=Y +SOUND_POWER_SAVE_ON_AC=0 +SOUND_POWER_SAVE_ON_BAT=1 +SOUND_POWER_SAVE_CONTROLLER=Y +BAY_POWEROFF_ON_AC=0 +BAY_POWEROFF_ON_BAT=0 +BAY_DEVICE="sr0" +RUNTIME_PM_ON_AC=on +RUNTIME_PM_ON_BAT=auto +RUNTIME_PM_DRIVER_BLACKLIST="amdgpu nouveau nvidia radeon pcieport" +USB_AUTOSUSPEND=0 +USB_BLACKLIST_BTUSB=0 +USB_BLACKLIST_PHONE=0 +USB_BLACKLIST_PRINTER=1 +USB_BLACKLIST_WWAN=1 +RESTORE_DEVICE_STATE_ON_STARTUP=0 + ++++ System Info +System = LENOVO Lenovo ideapad Y700-15ISK 80NV +BIOS = CDCN35WW +Release = "Manjaro Linux" +Kernel = 4.19.6-1-MANJARO #1 SMP PREEMPT Sat Dec 1 12:21:26 UTC 2018 x86_64 +/proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-4.19-x86_64 root=UUID=69d9dd18-36be-4631-9ebb-78f05fe3217f rw quiet resume=UUID=a2092b92-af29-4760-8e68-7a201922573b +Init system = systemd +Boot mode = BIOS (CSM, Legacy) + ++++ TLP Status +State = enabled +Last run = 11:04:00 IST, 684 sec(s) ago +Mode = battery +Power source = battery + ++++ Processor +CPU model = Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz + +/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu2/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu3/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu3/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu4/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu4/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu4/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu4/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu4/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu5/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu5/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu5/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu5/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu5/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu6/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu6/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu6/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu6/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu6/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/cpu7/cpufreq/scaling_driver = intel_pstate +/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor = powersave +/sys/devices/system/cpu/cpu7/cpufreq/scaling_available_governors = performance powersave +/sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq = 800000 [kHz] +/sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq = 3500000 [kHz] +/sys/devices/system/cpu/cpu7/cpufreq/energy_performance_preference = balance_power +/sys/devices/system/cpu/cpu7/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power + +/sys/devices/system/cpu/intel_pstate/min_perf_pct = 22 [%] +/sys/devices/system/cpu/intel_pstate/max_perf_pct = 100 [%] +/sys/devices/system/cpu/intel_pstate/no_turbo = 0 +/sys/devices/system/cpu/intel_pstate/turbo_pct = 33 [%] +/sys/devices/system/cpu/intel_pstate/num_pstates = 28 + +x86_energy_perf_policy: program not installed. + +/sys/module/workqueue/parameters/power_efficient = Y +/proc/sys/kernel/nmi_watchdog = 0 + ++++ Undervolting +PHC kernel not available. + ++++ Temperatures +CPU temp = 42 [°C] +Fan speed = (not available) + ++++ File System +/proc/sys/vm/laptop_mode = 2 +/proc/sys/vm/dirty_writeback_centisecs = 6000 +/proc/sys/vm/dirty_expire_centisecs = 6000 +/proc/sys/vm/dirty_ratio = 20 +/proc/sys/vm/dirty_background_ratio = 10 + ++++ Storage Devices +/dev/sda: + Model = WDC WD10SPCX-24HWST1 + Firmware = 02.01A02 + APM Level = 128 + Status = active/idle + Scheduler = mq-deadline + + Runtime PM: control = on, autosuspend_delay = (not available) + + SMART info: + 4 Start_Stop_Count = 18787 + 5 Reallocated_Sector_Ct = 0 + 9 Power_On_Hours = 606 [h] + 12 Power_Cycle_Count = 1792 + 193 Load_Cycle_Count = 25777 + 194 Temperature_Celsius = 31 [°C] + + ++++ AHCI Link Power Management (ALPM) +/sys/class/scsi_host/host0/link_power_management_policy = med_power_with_dipm +/sys/class/scsi_host/host1/link_power_management_policy = med_power_with_dipm +/sys/class/scsi_host/host2/link_power_management_policy = med_power_with_dipm +/sys/class/scsi_host/host3/link_power_management_policy = med_power_with_dipm + ++++ AHCI Host Controller Runtime Power Management +/sys/bus/pci/devices/0000:00:17.0/ata1/power/control = on +/sys/bus/pci/devices/0000:00:17.0/ata2/power/control = on +/sys/bus/pci/devices/0000:00:17.0/ata3/power/control = on +/sys/bus/pci/devices/0000:00:17.0/ata4/power/control = on + ++++ PCIe Active State Power Management +/sys/module/pcie_aspm/parameters/policy = powersave + ++++ Intel Graphics +/sys/module/i915/parameters/enable_dc = -1 (use per-chip default) +/sys/module/i915/parameters/enable_fbc = 1 (enabled) +/sys/module/i915/parameters/enable_psr = 0 (disabled) +/sys/module/i915/parameters/modeset = -1 (use per-chip default) + ++++ Wireless +bluetooth = on +wifi = on +wwan = none (no device) + +hci0(btusb) : bluetooth, not connected +wlp8s0(iwlwifi) : wifi, connected, power management = on + ++++ Audio +/sys/module/snd_hda_intel/parameters/power_save = 1 +/sys/module/snd_hda_intel/parameters/power_save_controller = Y + ++++ Runtime Power Management +Device blacklist = (not configured) +Driver blacklist = amdgpu nouveau nvidia radeon pcieport + +/sys/bus/pci/devices/0000:00:00.0/power/control = auto (0x060000, Host bridge, skl_uncore) +/sys/bus/pci/devices/0000:00:01.0/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:02.0/power/control = auto (0x030000, VGA compatible controller, i915) +/sys/bus/pci/devices/0000:00:14.0/power/control = auto (0x0c0330, USB controller, xhci_hcd) +/sys/bus/pci/devices/0000:00:16.0/power/control = auto (0x078000, Communication controller, mei_me) +/sys/bus/pci/devices/0000:00:17.0/power/control = auto (0x010601, SATA controller, ahci) +/sys/bus/pci/devices/0000:00:1c.0/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:1c.2/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:1c.3/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:1d.0/power/control = auto (0x060400, PCI bridge, pcieport) +/sys/bus/pci/devices/0000:00:1f.0/power/control = auto (0x060100, ISA bridge, no driver) +/sys/bus/pci/devices/0000:00:1f.2/power/control = auto (0x058000, Memory controller, no driver) +/sys/bus/pci/devices/0000:00:1f.3/power/control = auto (0x040300, Audio device, snd_hda_intel) +/sys/bus/pci/devices/0000:00:1f.4/power/control = auto (0x0c0500, SMBus, i801_smbus) +/sys/bus/pci/devices/0000:01:00.0/power/control = auto (0x030200, 3D controller, nouveau) +/sys/bus/pci/devices/0000:07:00.0/power/control = auto (0x080501, SD Host controller, sdhci-pci) +/sys/bus/pci/devices/0000:08:00.0/power/control = auto (0x028000, Network controller, iwlwifi) +/sys/bus/pci/devices/0000:09:00.0/power/control = auto (0x020000, Ethernet controller, r8168) +/sys/bus/pci/devices/0000:0a:00.0/power/control = auto (0x010802, Non-Volatile memory controller, nvme) + ++++ USB +Autosuspend = disabled +Device whitelist = (not configured) +Device blacklist = (not configured) +Bluetooth blacklist = disabled +Phone blacklist = disabled +WWAN blacklist = enabled + +Bus 002 Device 001 ID 1d6b:0003 control = auto, autosuspend_delay_ms = 0 -- Linux Foundation 3.0 root hub (hub) +Bus 001 Device 003 ID 174f:14e8 control = auto, autosuspend_delay_ms = 2000 -- Syntek (uvcvideo) +Bus 001 Device 002 ID 17ef:6053 control = on, autosuspend_delay_ms = 2000 -- Lenovo (usbhid) +Bus 001 Device 004 ID 8087:0a2b control = auto, autosuspend_delay_ms = 2000 -- Intel Corp. (btusb) +Bus 001 Device 001 ID 1d6b:0002 control = auto, autosuspend_delay_ms = 0 -- Linux Foundation 2.0 root hub (hub) + ++++ Battery Status +/sys/class/power_supply/BAT0/manufacturer = SMP +/sys/class/power_supply/BAT0/model_name = L14M4P23 +/sys/class/power_supply/BAT0/cycle_count = (not supported) +/sys/class/power_supply/BAT0/energy_full_design = 60000 [mWh] +/sys/class/power_supply/BAT0/energy_full = 51690 [mWh] +/sys/class/power_supply/BAT0/energy_now = 50140 [mWh] +/sys/class/power_supply/BAT0/power_now = 12185 [mW] +/sys/class/power_supply/BAT0/status = Discharging + +Charge = 97.0 [%] +Capacity = 86.2 [%] +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/tlp-increase-optimize-linux-laptop-battery-life/ + +作者:[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/check-laptop-battery-status-and-charging-state-in-linux-terminal/ +[2]: https://www.2daygeek.com/powertop-monitors-laptop-battery-usage-linux/ +[3]: https://www.2daygeek.com/monitor-laptop-battery-charging-state-linux/ +[4]: https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html +[5]: https://www.2daygeek.com/category/package-management/ +[6]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[7]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[8]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[9]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[10]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[11]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ From ac3e44e5b9e5ef0cae6e8020e47d0cf2eaccbba9 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 17:18:46 +0800 Subject: [PATCH 0243/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=204=20Unique=20Te?= =?UTF-8?q?rminal=20Emulators=20for=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 4 Unique Terminal Emulators for Linux.md | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..04110b670e --- /dev/null +++ b/sources/tech/20181204 4 Unique Terminal Emulators for Linux.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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) From fbc982cce4ebcc088161997d1b87e313020e4104 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 17:26:20 +0800 Subject: [PATCH 0244/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20resolutions?= =?UTF-8?q?=20for=20open=20source=20project=20maintainers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ons for open source project maintainers.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/talk/20181212 5 resolutions for open source project maintainers.md diff --git a/sources/talk/20181212 5 resolutions for open source project maintainers.md b/sources/talk/20181212 5 resolutions for open source project maintainers.md new file mode 100644 index 0000000000..122cc3f2d2 --- /dev/null +++ b/sources/talk/20181212 5 resolutions for open source project maintainers.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 resolutions for open source project maintainers) +[#]: via: (https://opensource.com/article/18/12/resolutions-open-source-project-maintainers) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +5 resolutions for open source project maintainers +====== +No matter how you say it, good communication is essential to strong open source communities. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/spark_sparkler_fire_new_year_idea.png?itok=rnyMpVP8) + +I'm generally not big on New Year's resolutions. I have no problem with self-improvement, of course, but I tend to anchor around other parts of the calendar. Even so, there's something about taking down this year's free calendar and replacing it with next year's that inspires some introspection. + +In 2017, I resolved to not share articles on social media until I'd read them. I've kept to that pretty well, and I'd like to think it has made me a better citizen of the internet. For 2019, I'm thinking about resolutions to make me a better open source software maintainer. + +Here are some resolutions I'll try to stick to on the projects where I'm a maintainer or co-maintainer. + +### 1\. Include a code of conduct + +Jono Bacon included "not enforcing the code of conduct" in his article "[7 mistakes you're probably making][1]." Of course, to enforce a code of conduct, you must first have a code of conduct. I plan on defaulting to the [Contributor Covenant][2], but you can use whatever you like. As with licenses, it's probably best to use one that's already written instead of writing your own. But the important thing is to find something that defines how you want your community to behave, whatever that looks like. Once it's written down and enforced, people can decide for themselves if it looks like the kind of community they want to be a part of. + +### 2\. Make the license clear and specific + +You know what really stinks? Unclear licenses. "This software is licensed under the GPL" with no further text doesn't tell me much. Which version of the [GPL][3]? Do I get to pick? For non-code portions of a project, "licensed under a Creative Commons license" is even worse. I love the [Creative Commons licenses][4], but there are several different licenses with significantly different rights and obligations. So, I will make it very clear which variant and version of a license applies to my projects. I will include the full text of the license in the repo and a concise note in the other files. + +Sort of related to this is using an [OSI][5]-approved license. It's tempting to come up with a new license that says exactly what you want it to say, but good luck if you ever need to enforce it. Will it hold up? Will the people using your project understand it? + +### 3\. Triage bug reports and questions quickly + +Few things in technology scale as poorly as open source maintainers. Even on small projects, it can be hard to find the time to answer every question and fix every bug. But that doesn't mean I can't at least acknowledge the person. It doesn't have to be a multi-paragraph reply. Even just labeling the GitHub issue shows that I saw it. Maybe I'll get to it right away. Maybe I'll get to it a year later. But it's important for the community to see that, yes, there is still someone here. + +### 4\. Don't push features or bug fixes without accompanying documentation + +For as much as my open source contributions over the years have revolved around documentation, my projects don't reflect the importance I put on it. There aren't many commits I can push that don't require some form of documentation. New features should obviously be documented at (or before!) the time they're committed. But even bug fixes should get an entry in the release notes. If nothing else, a push is a good opportunity to also make a commit to improving the docs. + +### 5\. Make it clear when I'm abandoning a project + +I'm really bad at saying "no" to things. I told the editors I'd write one or two articles for [Opensource.com][6] and here I am almost 60 articles later. Oops. But at some point, the things that once held my interests no longer do. Maybe the project is unnecessary because its functionality got absorbed into a larger project. Maybe I'm just tired of it. But it's unfair to the community (and potentially dangerous, as the recent [event-stream malware injection][7] showed) to leave a project in limbo. Maintainers have the right to walk away whenever and for whatever reason, but it should be clear that they have. + +Whether you're an open source maintainer or contributor, if you know other resolutions project maintainers should make, please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/resolutions-open-source-project-maintainers + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/8/mistakes-open-source-avoid +[2]: https://www.contributor-covenant.org/ +[3]: https://opensource.org/licenses/gpl-license +[4]: https://creativecommons.org/share-your-work/licensing-types-examples/ +[5]: https://opensource.org/ +[6]: http://Opensource.com +[7]: https://arstechnica.com/information-technology/2018/11/hacker-backdoors-widely-used-open-source-software-to-steal-bitcoin/ From 1853cb8d91423c81742a97afb339f6d154255f3e Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Dec 2018 17:29:48 +0800 Subject: [PATCH 0245/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Podman=20and=20?= =?UTF-8?q?user=20namespaces:=20A=20marriage=20made=20in=20heaven?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...r namespaces- A marriage made in heaven.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/tech/20181213 Podman and user namespaces- A marriage made in heaven.md diff --git a/sources/tech/20181213 Podman and user namespaces- A marriage made in heaven.md b/sources/tech/20181213 Podman and user namespaces- A marriage made in heaven.md new file mode 100644 index 0000000000..adc14c6111 --- /dev/null +++ b/sources/tech/20181213 Podman and user namespaces- A marriage made in heaven.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Podman and user namespaces: A marriage made in heaven) +[#]: via: (https://opensource.com/article/18/12/podman-and-user-namespaces) +[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan) + +Podman and user namespaces: A marriage made in heaven +====== +Learn how to use Podman to run containers in separate user namespaces. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/architecture_structure_planning_design_.png?itok=KL7dIDct) + +[Podman][1], part of the [libpod][2] library, enables users to manage pods, containers, and container images. In my last article, I wrote about [Podman as a more secure way to run containers][3]. Here, I'll explain how to use Podman to run containers in separate user namespaces. + +I have always thought of [user namespace][4], primarily developed by Red Hat's Eric Biederman, as a great feature for separating containers. User namespace allows you to specify a user identifier (UID) and group identifier (GID) mapping to run your containers. This means you can run as UID 0 inside the container and UID 100000 outside the container. If your container processes escape the container, the kernel will treat them as UID 100000. Not only that, but any file object owned by a UID that isn't mapped into the user namespace will be treated as owned by "nobody" (65534, kernel.overflowuid), and the container process will not be allowed access unless the object is accessible by "other" (world readable/writable). + +If you have a file owned by "real" root with permissions [660][5], and the container processes in the user namespace attempt to read it, they will be prevented from accessing it and will see the file as owned by nobody. + +### An example + +Here's how that might work. First, I create a file in my system owned by root. + +``` +$ sudo bash -c "echo Test > /tmp/test" +$ sudo chmod 600 /tmp/test +$ sudo ls -l /tmp/test +-rw-------. 1 root root 5 Dec 17 16:40 /tmp/test +``` + +Next, I volume-mount the file into a container running with a user namespace map 0:100000:5000. + +``` +$ sudo podman run -ti -v /tmp/test:/tmp/test:Z --uidmap 0:100000:5000 fedora sh +# id +uid=0(root) gid=0(root) groups=0(root) +# ls -l /tmp/test +-rw-rw----. 1 nobody nobody 8 Nov 30 12:40 /tmp/test +# cat /tmp/test +cat: /tmp/test: Permission denied +``` + +The **\--uidmap** setting above tells Podman to map a range of 5000 UIDs inside the container, starting with UID 100000 outside the container (so the range is 100000-104999) to a range starting at UID 0 inside the container (so the range is 0-4999). Inside the container, if my process is running as UID 1, it is 100001 on the host + +Since the real UID=0 is not mapped into the container, any file owned by root will be treated as owned by nobody. Even if the process inside the container has **CAP_DAC_OVERRIDE** , it can't override this protection. **DAC_OVERRIDE** enables root processes to read/write any file on the system, even if the process was not owned by root or world readable or writable. + +User namespace capabilities are not the same as capabilities on the host. They are namespaced capabilities. This means my container root has capabilities only within the container—really only across the range of UIDs that were mapped into the user namespace. If a container process escaped the container, it wouldn't have any capabilities over UIDs not mapped into the user namespace, including UID=0. Even if the processes could somehow enter another container, they would not have those capabilities if the container uses a different range of UIDs. + +Note that SELinux and other technologies also limit what would happen if a container process broke out of the container. + +### Using `podman top` to show user namespaces + +We have added features to **podman top** to allow you to examine the usernames of processes running inside a container and identify their real UIDs on the host. + +Let's start by running a sleep container using our UID mapping. + +``` +$ sudo podman run --uidmap 0:100000:5000 -d fedora sleep 1000 +``` + +Now run **podman top** : + +``` +$ sudo podman top --latest user huser +USER   HUSER +root   100000 + +$ ps -ef | grep sleep +100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +``` + +Notice **podman top** reports that the user process is running as root inside the container but as UID 100000 on the host (HUSER). Also the **ps** command confirms that the sleep process is running as UID 100000. + +Now let's run a second container, but this time we will choose a separate UID map starting at 200000. + +``` +$ sudo podman run --uidmap 0:200000:5000 -d fedora sleep 1000 +$ sudo podman top --latest user huser +USER   HUSER +root   200000 + +$ ps -ef | grep sleep +100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +200000   23644 23632  1 08:08 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +``` + +Notice that **podman top** reports the second container is running as root inside the container but as UID=200000 on the host. + +Also look at the **ps** command—it shows both sleep processes running: one as 100000 and the other as 200000. + +This means running the containers inside separate user namespaces gives you traditional UID separation between processes, which has been the standard security tool of Linux/Unix from the beginning. + +### Problems with user namespaces + +For several years, I've advocated user namespace as the security tool everyone wants but hardly anyone has used. The reason is there hasn't been any filesystem support or a shifting file system. + +In containers, you want to share the **base** image between lots of containers. The examples above use the Fedora base image in each example. Most of the files in the Fedora image are owned by real UID=0. If I run a container on this image with the user namespace 0:100000:5000, by default it sees all of these files as owned by nobody, so we need to shift all of these UIDs to match the user namespace. For years, I've wanted a mount option to tell the kernel to remap these file UIDs to match the user namespace. Upstream kernel storage developers continue to investigate and make progress on this feature, but it is a difficult problem. + + +Podman can use different user namespaces on the same image because of automatic [chowning][6] built into [containers/storage][7] by a team led by Nalin Dahyabhai. Podman uses containers/storage, and the first time Podman uses a container image in a new user namespace, container/storage "chowns" (i.e., changes ownership for) all files in the image to the UIDs mapped in the user namespace and creates a new image. Think of this as the **fedora:0:100000:5000** image. + +When Podman runs another container on the image with the same UID mappings, it uses the "pre-chowned" image. When I run the second container on 0:200000:5000, containers/storage creates a second image, let's call it **fedora:0:200000:5000**. + +Note if you are doing a **podman build** or **podman commit** and push the newly created image to a container registry, Podman will use container/storage to reverse the shift and push the image with all files chowned back to real UID=0. + +This can cause a real slowdown in creating containers in new UID mappings since the **chown** can be slow depending on the number of files in the image. Also, on a normal [OverlayFS][8], every file in the image gets copied up. The normal Fedora image can take up to 30 seconds to finish the chown and start the container. + +Luckily, the Red Hat kernel storage team, primarily Vivek Goyal and Miklos Szeredi, added a new feature to OverlayFS in kernel 4.19. The feature is called **metadata only copy-up**. If you mount an overlay filesystem with **metacopy=on** as a mount option, it will not copy up the contents of the lower layers when you change file attributes; the kernel creates new inodes that include the attributes with references pointing at the lower-level data. It will still copy up the contents if the content changes. This functionality is available in the Red Hat Enterprise Linux 8 Beta, if you want to try it out. + +This means container chowning can happen in a couple of seconds, and you won't double the storage space for each container. + +This makes running containers with tools like Podman in separate user namespaces viable, greatly increasing the security of the system. + +### Going forward + +I want to add a new flag, like **\--userns=auto** , to Podman that will tell it to automatically pick a unique user namespace for each container you run. This is similar to the way SELinux works with separate multi-category security (MCS) labels. If you set the environment variable **PODMAN_USERNS=auto** , you won't even need to set the flag. + +Podman is finally allowing users to run containers in separate user namespaces. Tools like [Buildah][9] and [CRI-O][10] will also be able to take advantage of user namespaces. For CRI-O, however, Kubernetes needs to understand which user namespace will run the container engine, and the upstream is working on that. + +In my next article, I will explain how to run Podman as non-root in a user namespace. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/podman-and-user-namespaces + +作者:[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://podman.io/ +[2]: https://github.com/containers/libpod +[3]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers +[4]: http://man7.org/linux/man-pages/man7/user_namespaces.7.html +[5]: https://chmodcommand.com/chmod-660/ +[6]: https://en.wikipedia.org/wiki/Chown +[7]: https://github.com/containers/storage +[8]: https://en.wikipedia.org/wiki/OverlayFS +[9]: https://buildah.io/ +[10]: http://cri-o.io/ From 1a70f8d07deb2cac814ad349136a3c13f5c912c8 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Fri, 21 Dec 2018 20:44:38 +0800 Subject: [PATCH 0246/4278] Translated by qhwdw --- ...2 How to Build a Netboot Server, Part 2.md | 127 +++++++++--------- 1 file changed, 63 insertions(+), 64 deletions(-) rename {sources => translated}/tech/20181212 How to Build a Netboot Server, Part 2.md (63%) diff --git a/sources/tech/20181212 How to Build a Netboot Server, Part 2.md b/translated/tech/20181212 How to Build a Netboot Server, Part 2.md similarity index 63% rename from sources/tech/20181212 How to Build a Netboot Server, Part 2.md rename to translated/tech/20181212 How to Build a Netboot Server, Part 2.md index 1d1ce2f68f..8887d84ba1 100644 --- a/sources/tech/20181212 How to Build a Netboot Server, Part 2.md +++ b/translated/tech/20181212 How to Build a Netboot Server, Part 2.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () [#]: subject: (How to Build a Netboot Server, Part 2) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -How to Build a Netboot Server, Part 2 +如何构建一台网络引导服务器(第二部分) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot2-816x345.jpg) -The article [How to Build a Netboot Server, Part 1][1] showed you how to create a netboot image with a “liveuser” account whose home directory lives in volatile memory. Most users probably want to preserve files and settings across reboots, though. So this second part of the netboot series shows how to reconfigure the netboot image from part one so that [Active Directory][2] user accounts can log in and their home directories can be automatically mounted from a NFS server. +在 [如何构建一台网络引导服务器(第一部分)][1] 的文章中,我们展示了如何创建一个网络引导镜像,在那个镜像中使用了一个名为 “liveuser” 帐户,它的 home 目录位于内存中,重启后 home 中的内容将全部消失。然而很多用户都希望机器重启后保存他们的文件和设置。因此,在本系列的第二部分,我们将向你展示如何在第一部分的基础上,重新配置网络引导镜像,使它能够使用 [活动目录][2] 中的用户帐户进行登陆,然后能够从一个 NFS 服务器上自动挂载他们的 home 目录。 -Part 3 of this series will show how to make an interactive and centrally-configurable iPXE boot menu for the netboot clients. +本系列的第三部分,我们将向你展示网络引导客户端如何与中心化配置的 iPXE 引导菜单进行交互。 -### Setup NFS4 Home Directories with KRB5 Authentication +### 设置使用 KRB5 认证的 NFS4 Home 目录 -Follow the directions from the previous post “[Share NFS Home Directories Securely with Kerberos][3],” then return here. +按以前的文章 “[使用 Kerberos 强化共享的 NFS Home 目录安全性][3]” 的指导来做这个设置。 -### Remove the Liveuser Account +### 删除 Liveuser 帐户 -Remove the “liveuser” account created in part one of this series: +删除本系列文章第一部分中创建的 “liveuser” 帐户: ``` $ sudo -i @@ -31,9 +31,9 @@ $ sudo -i # for i in passwd shadow group gshadow; do sed -i '/^liveuser:/d' /fc28/etc/$i; done ``` -### Configure NTP, KRB5 and SSSD +### 配置 NTP、KRB5 和 SSSD -Next, we will need to duplicate the NTP, KRB5, and SSSD configuration that we set up on the server in the client image so that the same accounts will be available: +接下来,我们需要将 NTP、KRB5、和 SSSD 的配置文件复制进客户端使用的镜像中,以便于它们能够使用同一个帐户: ``` # MY_HOSTNAME=$(> /fc28/etc/$i; done ``` -### Join Active Directory +### 连接活动目录 -Next, you’ll perform a chroot to join the client image to Active Directory. Begin by deleting any pre-existing computer account with the same name your netboot image will use: +接下来,你将执行一个 chroot 将客户端镜像连接到活动目录。从删除预置在网络引导镜像中相同的计算机帐户开始: ``` # MY_USERNAME=jsmith @@ -73,20 +73,20 @@ Next, you’ll perform a chroot to join the client image to Active Directory. Be # adcli delete-computer "${MY_CLIENT_HOSTNAME%%.*}" -U "$MY_USERNAME" ``` -Also delete the krb5.keytab file from the netboot image if it exists: +在网络引导镜像中如果有 krb5.keytab 文件,也删除它: ``` # rm -f /fc28/etc/krb5.keytab ``` -Perform a chroot into the netboot image: +在网络引导镜像中执行一个 chroot 操作: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done # chroot /fc28 /usr/bin/bash --login ``` -Perform the join: +执行一个 join 操作: ``` # MY_USERNAME=jsmith @@ -97,7 +97,7 @@ Perform the join: # adcli join $MY_DOMAIN --login-user="$MY_USERNAME" --computer-name="${MY_HOSTNAME%%.*}" --host-fqdn="$MY_HOSTNAME" --user-principal="host/$MY_HOSTNAME@$MY_REALM" --domain-ou="$MY_OU" ``` -Now log out of the chroot and clear the root user’s command history: +现在登出 chroot,并清除命令历史: ``` # logout @@ -105,9 +105,9 @@ Now log out of the chroot and clear the root user’s command history: # > /fc28/root/.bash_history ``` -### Install and Configure PAM Mount +### 安装和配置 PAM Mount -We want our clients to automatically mount the user’s home directory when they log in. To accomplish this, we’ll use the “pam_mount” module. Install and configure pam_mount: +我们希望客户端登入后自动挂载它的 home 目录。为实现这个目的,我们将要使用 “pam_mount” 模块。安装和配置 pam_mount: ``` # dnf install -y --installroot=/fc28 pam_mount @@ -123,7 +123,7 @@ We want our clients to automatically mount the user’s home directory when they END ``` -Reconfigure PAM to use pam_mount: +重新配置 PAM 去使用 pam_mount: ``` # dnf install -y patch @@ -152,24 +152,24 @@ END # chroot /fc28 authselect select custom/sssd with-pammount --force ``` -Also ensure the NFS server’s hostname is always resolvable from the client: +另外,要确保从客户端上总是可解析 NFS 服务器的主机名: ``` # MY_IP=$(host -t A $MY_HOSTNAME | awk '{print $4}') # echo "$MY_IP $MY_HOSTNAME ${MY_HOSTNAME%%.*}" >> /fc28/etc/hosts ``` -Optionally, allow all users to run sudo: +可选,允许所有用户去使用 sudo: ``` # echo '%users ALL=(ALL) NOPASSWD: ALL' > /fc28/etc/sudoers.d/users ``` -### Convert the NFS Root to an iSCSI Backing-Store +### 转换 NFS Root 到一个 iSCSI 背后的存储 -Current versions of nfs-utils may have difficulty establishing a second connection from the client back to the NFS server for home directories when an nfsroot connection is already established. The client hangs when attempting to access the home directory. So, we will work around the problem by using a different protocol (iSCSI) for sharing our netboot image. +在一个 nfsroot 连接建立之后,目前版本的 nfs-utils 可能很难为 home 目录维护一个从客户端到 NFS 服务器的二次连接。当尝试去访问 home 目录时,客户端将被挂住。因此,为了网络引导镜像可共享使用,我们将使用一个不同的协议(iSCSI)来解决这个问题。 -First chroot into the image to reconfigure its initramfs for booting from an iSCSI root: +首先 chroot 到镜像中,去重新配置它的 initramfs,让它从一个 iSCSI root 中去引导: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done @@ -186,18 +186,18 @@ First chroot into the image to reconfigure its initramfs for booting from an iSC # > /fc28/root/.bash_history ``` -The qedi driver broke iscsi during testing, so it’s been disabled here. +在测试时,qedi 驱动会破坏 iscsi,因此我们将它禁用。 -Next, create a fc28.img [sparse file][4]. This file serves as the iSCSI target’s backing store: +接着,创建一个 fc28.img 的 [稀疏文件][4]。这个稀疏文件代表 iSCSI 目标的背后存储: ``` # FC28_SIZE=$(du -ms /fc28 | cut -f 1) # dd if=/dev/zero of=/fc28.img bs=1MiB count=0 seek=$(($FC28_SIZE*2)) ``` -(If you have one available, a separate partition or disk drive can be used instead of creating a file.) +(如果你有一个可使用的稀疏文件、一个单独的分区或磁盘驱动器,就可以代替它了,不用再去创建这个稀疏文件了。) -Next, format the image with a filesystem, mount it, and copy the netboot image into it: +接着,使用一个文件系统去格式化镜像、挂载它、然后将网络引导镜像复制进去: ``` # mkfs -t xfs -L NETROOT /fc28.img @@ -207,19 +207,19 @@ Next, format the image with a filesystem, mount it, and copy the netboot image i # umount $TEMP_MNT ``` -During testing using SquashFS, the client would occasionally stutter. It seems that SquashFS does not perform well when doing random I/O from a multiprocessor client. (See also [The curious case of stalled squashfs reads][5].) If you want to improve throughput performance with filesystem compression, [ZFS][6] is probably a better option. +在使用 SquashFS 测试时,客户端偶尔会出现小状况。似乎是因为 SquashFS 在多处理器客户端上没法执行一个随机 I/O。(更多内容见 [squashfs 读取卡顿的奇怪案例][5])。如果你希望使用一个压缩文件系统来提升吞吐性能,[ZFS][6] 或许是个很好的选择。 -If you need extremely high throughput from the iSCSI server (say, for hundreds of clients), it might be possible to [load balance][7] a [Ceph][8] cluster. For more information, see [Load Balancing Ceph Object Gateway Servers with HAProxy and Keepalived][9]. +如果你对 iSCSI 服务器的吞吐性能要求非常高(比如,成百上千的客户端要连接它),可能需要使用带 [负载均衡][7] 的 [Ceph][8] 集群了。更多相关内容,请查看 [使用 HAProxy 和 Keepalived 负载均衡的 Ceph 对象网关][9]。 -### Install and Configure iSCSI +### 安装和配置 iSCSI -Install the scsi-target-utils package which will provide the iSCSI daemon for serving our image out to our clients: +为了给我们的客户端提供网络引导镜像,安装 scsi-target-utils 包: ``` # dnf install -y scsi-target-utils ``` -Configure the iSCSI daemon to serve the fc28.img file: +配置 iSCSI 守护程序去提供 fc28.img 文件: ``` # MY_REVERSE_HOSTNAME=$(echo $MY_HOSTNAME | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_HOSTNAME}) @@ -231,9 +231,9 @@ Configure the iSCSI daemon to serve the fc28.img file: END ``` -The leading iqn. is expected by /usr/lib/dracut/modules.d/40network/net-lib.sh. +通过 /usr/lib/dracut/modules.d/40network/net-lib.sh 来指示预期的 iqn。 -Add an exception to the firewall and enable and start the service: +添加一个防火墙例外,并启用和启动这个服务: ``` # firewall-cmd --add-service=iscsi-target @@ -242,13 +242,13 @@ Add an exception to the firewall and enable and start the service: # systemctl start tgtd.service ``` -You should now be able to see the image being shared with the tgtadm command: +你现在应该能够使用 tatadm 命令看到这个共享后的镜像: ``` # tgtadm --mode target --op show ``` -The above command should output something similar to the following: +上述命令的输出应该类似如下的内容: ``` Target 1: iqn.edu.example.server-01:fc28 @@ -290,7 +290,7 @@ Target 1: iqn.edu.example.server-01:fc28 ALL ``` -We can now remove the NFS share that we created in part one of this series: +现在,我们可以去删除本系列文章的第一部分中创建的 NFS 共享了: ``` # rm -f /etc/exports.d/fc28.exports @@ -300,11 +300,11 @@ We can now remove the NFS share that we created in part one of this series: # sed -i '/^\/fc28 /d' /etc/fstab ``` -You can also delete the /fc28 filesystem, but you may want to keep it for performing future updates. +你也可以删除 /fc28 文件系统,但为了以后进一步更新,你可能需要保留它。 -### Update the ESP to use the iSCSI Kernel +### 更新 ESP 去使用 iSCSI 内核 -Ipdate the ESP to contain the iSCSI-enabled initramfs: +更新 ESP 去包含启用了 iSCSI 的 initramfs: ``` $ rm -vf $HOME/esp/linux/*.fc28.* @@ -313,7 +313,7 @@ $ cp $(find /fc28/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $MY_KRNL) $ cp $(find /fc28/boot -name 'init*' | grep -m 1 $MY_KRNL) $HOME/esp/linux/initramfs-$MY_KRNL.img ``` -Update the boot.cfg file to pass the new root and netroot parameters: +更新 boot.cfg 文件去传递新的 root 和 netroot 参数: ``` $ MY_NAME=server-01.example.edu @@ -322,52 +322,52 @@ $ MY_ADDR=$(host -t A $MY_NAME | awk '{print $4}') $ sed -i "s! root=[^ ]*! root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc28-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc28!" $HOME/esp/linux/boot.cfg ``` -Now you just need to copy the updated files from your $HOME/esp/linux directory out to the ESPs of all your client systems. You should see results similar to what is shown in the below screenshot: +现在,你只需要从 $HOME/esp/linux 目录中复制更新后的文件到所有客户端系统的 ESP 中。你应该会看到类似下面屏幕截图的结果: ![][10] -### Upgrading the Image +### 更新镜像 -First, make a copy of the current image: +首先,复制出一个当前镜像的副本: ``` # cp -a /fc28 /fc29 ``` -Chroot into the new copy of the image: +Chroot 进入到镜像的新副本: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc29/$i; done # chroot /fc29 /usr/bin/bash --login ``` -Allow updating the kernel: +允许更新内核: ``` # sed -i 's/^exclude=kernel-\*$/#exclude=kernel-*/' /etc/dnf/dnf.conf ``` -Perform the upgrade: +执行升级: ``` # dnf distro-sync -y --releasever=29 ``` -Prevent the kernel from being updated: +阻止更新过的内核被再次更新: ``` # sed -i 's/^#exclude=kernel-\*$/exclude=kernel-*/' /etc/dnf/dnf.conf ``` -The above command is optional, but saves you from having to copy a new kernel out to the clients if you add or update a few packages in the image at some future time. +上述命令是可选的,但是在以后,如果在镜像中添加和更新了几个包,在你的客户端之外保存有一个最新内核的副本,会在关键时刻对你非常有帮助。 -Clean up dnf’s package cache: +清理 dnf 的包缓存: ``` # dnf clean all ``` -Exit the chroot and clear root’s command history: +退出 chroot 并清理 root 的命令历史: ``` # logout @@ -375,7 +375,7 @@ Exit the chroot and clear root’s command history: # > /fc29/root/.bash_history ``` -Create the iSCSI image: +创建 iSCSI 镜像: ``` # FC29_SIZE=$(du -ms /fc29 | cut -f 1) @@ -387,7 +387,7 @@ Create the iSCSI image: # umount $TEMP_MNT ``` -Define a new iSCSI target that points to our new image and export it: +定义一个新的 iSCSI 目标,指向到新的镜像并导出它: ``` # MY_HOSTNAME=$( Date: Fri, 21 Dec 2018 22:32:27 +0800 Subject: [PATCH 0247/4278] Translating by qhwdw --- ...th PGP - Part 4- Moving Your Master Key to Offline Storage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/sources/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md index df00e7e05e..30c1bba4d5 100644 --- a/sources/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md +++ b/sources/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md @@ -1,3 +1,4 @@ +Translating by qhwdw Protecting Code Integrity with PGP — Part 4: Moving Your Master Key to Offline Storage ====== From 9ff115581de2af14e4a2ecf7db3fefa052eaedeb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 22 Dec 2018 00:20:55 +0800 Subject: [PATCH 0248/4278] PRF:20180710 Users, Groups, and Other Linux Beasts.md @MjSeven --- ...0 Users, Groups, and Other Linux Beasts.md | 59 ++++++++++++------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/translated/tech/20180710 Users, Groups, and Other Linux Beasts.md b/translated/tech/20180710 Users, Groups, and Other Linux Beasts.md index 477d317d9f..65cbacecb2 100644 --- a/translated/tech/20180710 Users, Groups, and Other Linux Beasts.md +++ b/translated/tech/20180710 Users, Groups, and Other Linux Beasts.md @@ -1,51 +1,58 @@ -用户,组和其他 Linux 用户 +用户、组及其它 Linux 特性 ====== +> Linux 和其他类 Unix 操作系统依赖于用户组,而不是逐个为用户分配权限和特权。一个组就是你想象的那样:一群在某种程度上相关的用户。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/flamingo-2458782_1920.jpg?itok=_gkzGGx5) -到这个阶段,[在看到如何操作目录或文件夹之后][1],但在让自己一头扎进文件之前,我们必须重新审视 _权限_, _users_ 和 _group_。幸运的是,[有一个网站上已经有了一个优秀而全面的教程,包括了权限][2],所以你应该去立刻阅读它。简而言之,你使用权限来确定谁可以对文件和目录执行操作,以及他们可以对每个文件和目录执行什么操作 -- 从中读取,写入,擦除等等。 +到这个阶段,[在看到如何操作目录或文件夹之后][1],但在让自己一头扎进文件之前,我们必须重新审视 _权限_、_用户_ 和 _组_。幸运的是,[有一个网站上已经有了一个优秀而全面的教程,讲到了权限][2],所以你应该去立刻阅读它。简而言之,你使用权限来确定谁可以对文件和目录执行操作,以及他们可以对每个文件和目录执行什么操作 —— 从中读取、写入、移动、擦除等等。 -要尝试本教程涵盖的所有内容,你需要在系统上创建新用户。让我们实践起来,为每一个需要借用你电脑的人创建一个用户,我们称之为 _guest 账户_。 +要尝试本教程涵盖的所有内容,你需要在系统上创建新用户。让我们实践起来,为每一个需要借用你电脑的人创建一个用户,我们称之为 `guest` 账户。 -**警告:** _例如,如果你错误地删除了自己的用户和目录,那么创建,特别是删除用户以及主目录会严重损坏系统。你可能不想在你日常的工作机中练习,那么请在另一台机器或者虚拟机上练习。无论你是否想要安全地练习,经常备份你的东西总是一个好主意。检查备份是否正常工作,为你自己以后避免很多咬牙切齿的事情。_ +**警告:** 例如,如果你错误地删除了自己的用户和目录,那么创建用户,特别是删除用户以及主目录会严重损坏系统。你可能不想在你日常的工作机中练习,那么请在另一台机器或者虚拟机上练习。无论你是否想要安全地练习,经常备份你的东西总是一个好主意。检查备份是否正常工作,为你自己以后避免很多咬牙切齿的事情。 ### 一个新用户 你可以使用 `useradd` 命令来创建一个新用户。使用超级用户或 root 权限运行 `useradd`,即使用 `sudo` 或 `su`,这具体取决于你的系统,你可以: + ``` sudo useradd -m guest ``` 然后输入你的密码。或者也可以这样: + ``` su -c "useradd -m guest" ``` 然后输入 root 或超级用户的密码。 -(_为了简洁起见,我们将从现在开始假设你使用 `sudo` 获得超级用户或 root 权限。_) +( _为了简洁起见,我们将从现在开始假设你使用 `sudo` 获得超级用户或 root 权限。_ ) -通过使用 `-m` 参数,`useradd` 将为新用户创建一个主目录。你可以通过列出 _/home/guest_ 来查看其内容。 +通过使用 `-m` 参数,`useradd` 将为新用户创建一个主目录。你可以通过列出 `/home/guest` 来查看其内容。 然后你可以使用以下命令来为新用户设置密码: + ``` sudo passwd guest ``` -或者你也可以使用 `adduser`,这是一个交互式的命令,它会询问你一些问题,包括你要为用户分配的 shell(是的,不止一个),你希望其主目录在哪里,你希望他们属于哪些组(有关这点稍后会讲到)等等。在运行 `adduser` 结束时,你可以设置密码。注意,默认情况下,在许多发行版中都没有安装 `adduser`,但安装了 `useradd`。 +或者你也可以使用 `adduser`,这是一个交互式的命令,它会询问你一些问题,包括你要为用户分配的 shell(是的,shell 有不止一种),你希望其主目录在哪里,你希望他们属于哪些组(有关这点稍后会讲到)等等。在运行 `adduser` 结束时,你可以设置密码。注意,默认情况下,在许多发行版中都没有安装 `adduser`,但安装了 `useradd`。 顺便说一下,你可以使用 `userdel` 来移除一个用户: + ``` sudo userdel -r guest ``` -使用 `-r` 选项,`userdel` 不仅删除了 _guest_ 用户,还删除了他们的主目录和邮件中的条目(如果有的话)。 +使用 `-r` 选项,`userdel` 不仅删除了 `guest` 用户,还删除了他们的主目录和邮件中的条目(如果有的话)。 -### home 中的内容 +### 主目录中的内容 -谈到用户的主目录,它依赖于你所使用的发行版。你可能已经注意到,当你使用 `-m` 选项时,`useradd` 使用子目录填充用户的目录,包括音乐,文档和诸如此类的内容以及各种各样的隐藏文件。要查看 guest 主目录中的所有内容,运行 `sudo ls -la /home/guest`。 +谈到用户的主目录,它依赖于你所使用的发行版。你可能已经注意到,当你使用 `-m` 选项时,`useradd` 使用子目录填充用户的目录,包括音乐、文档和诸如此类的内容以及各种各样的隐藏文件。要查看 `guest` 主目录中的所有内容,运行 `sudo ls -la /home/guest`。 + +进入新用户目录的内容通常是由 `/etc/skel` 架构目录确定的。有时它可能是一个不同的目录。要检查正在使用的目录,运行: -进入新用户目录的内容通常是由 _/etc/skel_ 架构目录确定的。有时它可能是一个不同的目录。要检查正在使用的目录,运行: ``` useradd -D GROUP=100 @@ -57,31 +64,36 @@ SKEL=/etc/skel CREATE_MAIL_SPOOL=no ``` -这给你一些额外的有趣信息,但你现在感兴趣的是 `SKEL=/etc/skel` 这一行,在这种情况下,按照惯例,它指向 _/etc/skel/_。 +这会给你一些额外的有趣信息,但你现在感兴趣的是 `SKEL=/etc/skel` 这一行,在这种情况下,按照惯例,它指向 `/etc/skel/`。 + +由于 Linux 中的所有东西都是可定制的,因此你可以更改那些放入新创建的用户目录的内容。试试这样做:在 `/etc/skel/` 中创建一个新目录: -由于 Linux 中的所有东西都是可定制的,因此你可以更改那些放入新创建的用户目录的内容。试试这样做:在 _/etc/skel/_ 中创建一个新目录: ``` sudo mkdir /etc/skel/Documents ``` 然后创建一个包含欢迎消息的文件,并将其复制过来: + ``` sudo cp welcome.txt /etc/skel/Documents ``` -现在删除 guest 账户: +现在删除 `guest` 账户: + ``` sudo userdel -r guest ``` 再次创建: + ``` sudo useradd -m guest ``` -嘿 presto!(to 校正:这个 presto 是什么?)你的 _Documents/_ 目录和 _welcome.txt_ 文件神奇地出现在了 guest 的主目录中。 +嘿!你的 `Documents/` 目录和 `welcome.txt` 文件神奇地出现在了 `guest` 的主目录中。 + +你还可以在创建用户时通过编辑 `/etc/default/useradd` 来修改其他内容。我的看起来像这样: -你还可以在创建用户时通过编辑 _/etc/default/useradd_ 来修改其他内容。我的看起来像这样: ``` GROUP=users HOME=/home @@ -96,11 +108,12 @@ CREATE_MAIL_SPOOL=no ### 群组心态 -Linux 和其他类 Unix 操作系统依赖于 _groups_,而不是逐个为用户分配权限和特权。一个组就是你想象的那样:一群在某种程度上相关的用户。在你的系统上可能有一组允许使用打印机的用户,他们属于 _lp_(即 "_line printer_")组。传统上 _wheel_ 组的成员是唯一可以通过使用 _su_ 成为超级用户或 root 的成员。_network_ 用户组可以启动或关闭网络。还有许多诸如此类的。 +Linux 和其他类 Unix 操作系统依赖于用户组,而不是逐个为用户分配权限和特权。一个组就是你想象的那样:一群在某种程度上相关的用户。在你的系统上可能有一组允许使用打印机的用户,他们属于 `lp`(即 “_line printer_”)组。传统上 `wheel` 组的成员是唯一可以通过使用 `su` 成为超级用户或 root 的成员。`network` 用户组可以启动或关闭网络。还有许多诸如此类的。 不同的发行版有不同的组,具有相同或相似名称的组具有不同的权限,这也取决于你使用的发行版。因此,如果你在前一段中读到的内容与你系统中的内容不匹配,不要感到惊讶。 -不管怎样g,要查看系统中有哪些组,你可以使用: +不管怎样,要查看系统中有哪些组,你可以使用: + ``` getent group ``` @@ -108,18 +121,20 @@ getent group `getent` 命令列出了某些系统数据库的内容。 要查找当前用户所属的组,尝试: + ``` groups ``` -当你使用 `useradd` 创建新用户时,除非你另行指定,否则用户讲只属于一个组:他们自己。一个 _guest_ 用户属于 _guest_ 组。组使用户有权管理自己的东西,仅此而已。 +当你使用 `useradd` 创建新用户时,除非你另行指定,否则用户将只属于一个组:他们自己。`guest` 用户属于 `guest` 组。组使用户有权管理自己的东西,仅此而已。 你可以使用 `groupadd` 命令创建新组,然后添加用户: + ``` sudo groupadd photos ``` -例如,这将创建 _photos_ 组。下一次,我们将使用它来构建一个共享目录,该组的所有成员都可以读取和写入,我们将更多地了解权限和特权。敬请关注! +例如,这将创建 `photos` 组。下一次,我们将使用它来构建一个共享目录,该组的所有成员都可以读取和写入,我们将更多地了解权限和特权。敬请关注! -------------------------------------------------------------------------------- @@ -129,11 +144,11 @@ via: https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-li 作者:[Paul Brown][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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/) 荣誉推出 [a]:https://www.linux.com/users/bro66 -[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux +[1]:https://linux.cn/article-10066-1.html [2]:https://www.linux.com/learn/understanding-linux-file-permissions [3]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From d6be9d773c9e6e45dda19970cd90a6e7030eabd2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 22 Dec 2018 00:21:31 +0800 Subject: [PATCH 0249/4278] PUB:20180710 Users, Groups, and Other Linux Beasts.md @MjSeven https://linux.cn/article-10370-1.html --- .../20180710 Users, Groups, and Other Linux Beasts.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180710 Users, Groups, and Other Linux Beasts.md (100%) diff --git a/translated/tech/20180710 Users, Groups, and Other Linux Beasts.md b/published/20180710 Users, Groups, and Other Linux Beasts.md similarity index 100% rename from translated/tech/20180710 Users, Groups, and Other Linux Beasts.md rename to published/20180710 Users, Groups, and Other Linux Beasts.md From f6cc86ebfa1572029a17ca13162337f3b79f3d5b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 22 Dec 2018 09:51:55 +0800 Subject: [PATCH 0250/4278] PRF:20181115 3 best practices for continuous integration and deployment.md @ChiZelin --- ...r continuous integration and deployment.md | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/translated/tech/20181115 3 best practices for continuous integration and deployment.md b/translated/tech/20181115 3 best practices for continuous integration and deployment.md index 0706d70544..dcb4bd7c26 100644 --- a/translated/tech/20181115 3 best practices for continuous integration and deployment.md +++ b/translated/tech/20181115 3 best practices for continuous integration and deployment.md @@ -1,31 +1,33 @@ -持续集成与部署的3个最佳实践 +持续集成与部署的 3 个最佳实践 ====== -了解自动化,使用 Git 存储库以及参数化 Jenkins 管道。 + +> 了解自动化,使用 Git 存储库以及参数化 Jenkins 管道。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) 本文涵盖了三个关键主题:自动化 CI/CD 配置、使用 Git 存储库处理常见的 CI/CD 工件、参数化 Jenkins 管道。 ### 术语 -首先,我们定义一些术语。**CI/CD** 是允许团队快速自动化测试、打包、部署其应用程序的实践。它通常通过利用名为 **[Jenkins][1]** 的服务器来实现,该服务器充当 CI/CD 协调器。Jenkins 侦听特定输入(通常是代码签入后的 Git hook),并在触发时启动管道。 +首先,我们定义一些术语。**CI/CD** 是允许团队快速自动化测试、打包、部署其应用程序的实践。它通常通过利用名为 [Jenkins][1] 的服务器来实现,该服务器充当 CI/CD 协调器。Jenkins 侦听特定输入(通常是代码签入后的 Git 挂钩),并在触发时启动一个管道。 -**pipeline** 由开发和/或运营团队编写的代码组成,这些代码指导 Jenkins 在 CI/CD 过程中采取哪些操作。这个流水线通常类似于“构建我的代码,然后测试我的代码,如果这些测试通过,则把我的应用程序部署到下一个最高环境(通常是开发、测试或生产环境)”。组织通常具有更复杂的流水线,并入了诸如工件存储库和代码分析器之类的工具,但是这提供了一个高级示例。 +管道pipeline 由开发和/或运营团队编写的代码组成,这些代码指导 Jenkins 在 CI/CD 过程中采取哪些操作。这个流水线通常类似于“构建我的代码,然后测试我的代码,如果这些测试通过,则把我的应用程序部署到下一个最高环境(通常是开发、测试或生产环境)”。组织通常具有更复杂的管道,并入了诸如工件存储库和代码分析器之类的工具,这里提供了一个高级示例。 现在我们了解了关键术语,让我们深入研究一些最佳实践。 -### 1\. 自动化是关键 +### 1、自动化是关键 要在 PaaS 上运行 CI/CD,需要在集群上配置适当的基础设施。在这个例子中,我将使用 [OpenShift][2]。 -"Hello, World" 的实现很容易实现。简单地运行 **oc new-app jenkins- ** 和 voilà, 你已经准备好运行 Jenkins 服务器了。然而,在企业中的使用要复杂得多。除了 Jenkins 服务器之外,管理员通常还需要部署代码分析工具(如 SonarQube)和构件库(如 Nexus)。然后,它们必须创建管道来执行 CI/CD 和 Jenkins 从服务器,以减少主服务器的负载。这些实体中的大多数都由 OpenShift 资源支持,需要创建这些资源来部署所需的 CI/CD 基础设施。 +“Hello, World” 的实现很容易实现。简单地运行 `oc new-app jenkins-`,然后,你就有了一个已经就绪的运行中的 Jenkins 服务器了。然而,在企业中的使用要复杂得多。除了 Jenkins 服务器之外,管理员通常还需要部署代码分析工具(如 SonarQube)和工件库(如 Nexus)。然后,它们必须创建管道来执行 CI/CD 和 Jenkins 从服务器,以减少主服务器的负载。这些实体中的大多数都由 OpenShift 资源支持,需要创建这些资源来部署所需的 CI/CD 基础设施。 -最后,部署 CI/CD 组件所需要的手动步骤可能是需要被重复的,并且你可能不想成为执行那些重复步骤的人。为了确保结果能够像以前一样快速、无错误和准确地产生,应该在创建基础设施的方式中结合自动化方法。这可以是一个 Ansible 剧本、一个 Bash 脚本,或者任何您希望自动化 CI/CD 基础设施部署的其他方式。我已经使用 [Ansible][3] 和 [OpenShift-Applier][4] 角色来自动化我的实现。您可能会发现这些工具很有价值,或者您可能会发现其他一些对您和组织更有效的工具。无论哪种方式,您都将发现自动化显著地减少了重新创建 CI/CD 组件所需的工作量。 +最后,部署 CI/CD 组件所需要的手动步骤可能是需要重复进行的,而且你可能不想成为执行那些重复步骤的人。为了确保结果能够像以前一样快速、无错误和准确地产生,应该在创建基础设施的方式中结合自动化方法。这可以是一个 Ansible 剧本、一个 Bash 脚本,或者任何您希望自动化 CI/CD 基础设施部署的其它方式。我已经使用 [Ansible][3] 和 [OpenShift-Applier][4] 角色来自动化我的实现。您可能会发现这些工具很有价值,或者您可能会发现其他一些对您和组织更有效的工具。无论哪种方式,您都将发现自动化显著地减少了重新创建 CI/CD 组件所需的工作量。 -#### 配置Jenkins主服务器 +#### 配置 Jenkins 主服务器 -除了一般的“自动化”之外,我想单独介绍一下 Jenkins 主服务器,并讨论管理员如何利用 OpenShift 来自动化配置 Jenkins。来自 [Red Hat Container Catalog][5] 的 Jenkins 映像已经安装了 [OpenShift-Sync plugin][6]。在 [视频][7] 中,我们将讨论如何使用这个插件来创建 Jenkins 管道和从设备。 +除了一般的“自动化”之外,我想单独介绍一下 Jenkins 主服务器,并讨论管理员如何利用 OpenShift 来自动化配置 Jenkins。来自 [Red Hat Container Catalog][5] 的 Jenkins 镜像已经安装了 [OpenShift-Sync plugin][6]。在 [该视频][7] 中,我们将讨论如何使用这个插件来创建 Jenkins 管道和从设备。 -要创建 Jenkins 流水线,请创建一个类似于下面的 OpenShift BuildConfig: +要创建 Jenkins 管道,请创建一个类似于下面的 OpenShift BuildConfig: ``` apiVersion: v1 @@ -43,7 +45,7 @@ spec:       type: JenkinsPipeline ``` -OpenShift-Sync 插件将注意到已经创建了带有 **jenkinsPipelineStrategy** 策略的 BuildConfig,并将其转换为 Jenkins 管道,从 Git 源指定的 Jenkins 文件中提取。也可以使用内联 Jenkinsfile,而不是从 Git 存储库中提取。有关更多信息,请参阅[文档][8]。 +OpenShift-Sync 插件将注意到已经创建了带有 `jenkinsPipelineStrategy` 策略的 BuildConfig,并将其转换为 Jenkins 管道,从 Git 源指定的 Jenkinsfile 中提取。也可以使用内联 Jenkinsfile,而不是从 Git 存储库中提取。有关更多信息,请参阅[文档][8]。 要创建 Jenkins 从站,请创建一个 OpenShift ImageStream,它从以下定义开始: @@ -55,12 +57,12 @@ metadata:     slave-label: jenkins-slave     labels:       role: jenkins-slave -… +... ``` -注意在这个 ImageStream 中定义的元数据。OpenShift-Sync 插件将把带有标签 **role: jenkins-slave** 的任何ImageStream 转换为 Jenkins 从站。Jenkins 从站将以 **slave-label** 注释中的值命名。 +注意在这个 ImageStream 中定义的元数据。OpenShift-Sync 插件将把带有标签 `role: jenkins-slave` 的任何 ImageStream 转换为 Jenkins 从站。Jenkins 从站将以 `slave-label` 注释中的值命名。 -ImageStreams 对于简单的 Jenkins 从属配置工作得很好,但是一些团队会发现有必要配置一些细节详情,比如资源限制、准备就绪和活动性探测,以及实例帽。这就是 ConfigMap 发挥作用的地方: +ImageStreams 对于简单的 Jenkins 从属配置工作得很好,但是一些团队会发现有必要配置一些细节详情,比如资源限制、准备就绪和活动性探测,以及实例上限。这就是 ConfigMap 发挥作用的地方: ``` apiVersion: v1 @@ -74,21 +76,21 @@ data:     ``` -注意,仍然需要角色:jenkins-slave 标签来将 ConfigMap 转换为 Jenkins slave。Kubernetes pod 模板由一长段 XML 组成,它将根据组织的喜好配置每个细节。要查看此 XML,以及有关将 ImageStreams 和 ConfigMaps 转换为 Jenkins 从属的更多信息,请参阅[文档][9]。 +注意,仍然需要角色:`jenkins-slave` 标签来将 ConfigMap 转换为 Jenkins 从站。Kubernetes pod 模板由一长段 XML 组成,它将根据组织的喜好配置每个细节。要查看此 XML,以及有关将 ImageStreams 和 ConfigMaps 转换为 Jenkins 从站的更多信息,请参阅[文档][9]。 请注意上面所示的三个示例,其中没有一个操作需要管理员对 Jenkins 控制台进行手动更改。通过使用 OpenShift 资源,可以简单的自动化方式配置 Jenkins。 -### 2\. 分享就是关心 +### 2、分享就是关爱 -第二个最佳实践是维护一个公共 CI/CD 工件的 Git 存储库。主要思想是防止团队重新发明轮子。假设您的团队需要执行到 OpenShift 环境的蓝色/绿色部署,作为管道 CD 阶段的一部分。负责编写流水线的团队成员可能不是 OpenShift 专家,也不可能具有从头开始编写此功能的能力。幸运的是,有人已经编写了一个将此功能合并到一个公共 CI/CD 存储库中的函数,因此您的团队可以使用该函数而不是花时间编写一个函数。 +第二个最佳实践是维护一个公共 CI/CD 工件的 Git 存储库。主要思想是防止团队重新发明轮子。假设您的团队需要执行到 OpenShift 环境的蓝/绿部署,作为管道 CD 阶段的一部分。负责编写管道的团队成员可能不是 OpenShift 专家,也不可能具有从头开始编写此功能的能力。幸运的是,有人已经编写了一个将此功能合并到一个公共 CI/CD 存储库中的函数,因此您的团队可以使用该函数而不是花时间编写一个函数。 -为了更进一步,您的组织可能决定维护整个管道。您可能会发现团队正在编写具有相似功能的流水线。对于那些团队来说,使用来自公共存储库的参数化管道要比从头开始编写自己的管道更有效。 +为了更进一步,您的组织可能决定维护整个管道。您可能会发现团队正在编写具有相似功能的管道。对于那些团队来说,使用来自公共存储库的参数化管道要比从头开始编写自己的管道更有效。 -### 3\. 少即是多 +### 3、少即是多 正如我在前一节中提到的,第三个也是最后一个最佳实践是参数化您的 CI/CD 管道。参数化将防止过多的管道,使您的 CI/CD 系统更容易维护。假设我有多个区域可以部署应用程序。如果没有参数化,我需要为每个区域设置单独的管道。 -要参数化作为 OpenShift 构建配置编写的管道,请将 **env** 节添加到配置: +要参数化一个作为 OpenShift 构建配置编写的管道,请将 `env` 节添加到配置: ``` ... @@ -103,9 +105,9 @@ spec:     type: JenkinsPipeline ``` -使用此配置,我可以传递 **REGION** 参数管道以将我的应用程序部署到指定区域。 +使用此配置,我可以传递 `REGION` 参数给管道以将我的应用程序部署到指定区域。 -这有一个[视频][7]提供了一个更实质性的情况,其中参数化是必须的。一些组织决定把他们的 CI/CD 管道分割成单独的 CI 和 CD 管道,通常是因为在部署之前有一些审批过程。假设我有四个映像和三个不同的环境要部署。如果没有参数化,我需要12个 CD 管道来允许所有部署可能性。这会很快失去控制。为了使 CD 流水线的维护更容易,组织会发现将映像和环境参数化以便允许一个流水线执行多个流水线的工作会更好。 +这有一个[视频][7]提供了一个更实质性的情况,其中参数化是必须的。一些组织决定把他们的 CI/CD 管道分割成单独的 CI 和 CD 管道,通常是因为在部署之前有一些审批过程。假设我有四个镜像和三个不同的环境要部署。如果没有参数化,我需要 12 个 CD 管道来允许所有部署可能性。这会很快失去控制。为了使 CD 流水线的维护更容易,组织会发现将镜像和环境参数化以便允许一个流水线执行多个流水线的工作会更好。 ### 总结 @@ -120,7 +122,7 @@ via: https://opensource.com/article/18/11/best-practices-cicd 作者:[Austin Dewey][a] 选题:[lujun9972][b] 译者:[ChiZelin](https://github.com/ChiZelin) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ce87014d8bf3389133f112890f0dc615e0f62f5b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 22 Dec 2018 09:52:33 +0800 Subject: [PATCH 0251/4278] PUB:20181115 3 best practices for continuous integration and deployment.md @ChiZelin https://linux.cn/article-10371-1.html --- ... 3 best practices for continuous integration and deployment.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181115 3 best practices for continuous integration and deployment.md (100%) diff --git a/translated/tech/20181115 3 best practices for continuous integration and deployment.md b/published/20181115 3 best practices for continuous integration and deployment.md similarity index 100% rename from translated/tech/20181115 3 best practices for continuous integration and deployment.md rename to published/20181115 3 best practices for continuous integration and deployment.md From 7f591fb8429bfc305297884650d1ce453ecb3dba Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sat, 22 Dec 2018 11:58:14 +0800 Subject: [PATCH 0252/4278] Translated by qhwdw --- ...ving Your Master Key to Offline Storage.md | 168 ------------------ ...ving Your Master Key to Offline Storage.md | 167 +++++++++++++++++ 2 files changed, 167 insertions(+), 168 deletions(-) delete mode 100644 sources/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md create mode 100644 translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md diff --git a/sources/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/sources/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md deleted file mode 100644 index 30c1bba4d5..0000000000 --- a/sources/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md +++ /dev/null @@ -1,168 +0,0 @@ -Translating by qhwdw -Protecting Code Integrity with PGP — Part 4: Moving Your Master Key to Offline Storage -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/industry-1920.jpg?itok=gI3QraS8) -In this tutorial series, we're providing practical guidelines for using PGP. You can catch up on previous articles here: - -[Part 1: Basic Concepts and Tools][1] - -[Part 2: Generating Your Master Key][2] - -[Part 3: Generating PGP Subkeys][3] - -Here in part 4, we continue the series with a look at how and why to move your master key from your home directory to offline storage. Let's get started. - -### Checklist - - * Prepare encrypted detachable storage (ESSENTIAL) - - * Back up your GnuPG directory (ESSENTIAL) - - * Remove the master key from your home directory (NICE) - - * Remove the revocation certificate from your home directory (NICE) - - - - -#### Considerations - -Why would you want to remove your master [C] key from your home directory? This is generally done to prevent your master key from being stolen or accidentally leaked. Private keys are tasty targets for malicious actors -- we know this from several successful malware attacks that scanned users' home directories and uploaded any private key content found there. - -It would be very damaging for any developer to have their PGP keys stolen -- in the Free Software world, this is often tantamount to identity theft. Removing private keys from your home directory helps protect you from such events. - -##### Back up your GnuPG directory - -**!!!Do not skip this step!!!** - -It is important to have a readily available backup of your PGP keys should you need to recover them (this is different from the disaster-level preparedness we did with paperkey). - -##### Prepare detachable encrypted storage - -Start by getting a small USB "thumb" drive (preferably two!) that you will use for backup purposes. You will first need to encrypt them: - -For the encryption passphrase, you can use the same one as on your master key. - -##### Back up your GnuPG directory - -Once the encryption process is over, re-insert the USB drive and make sure it gets properly mounted. Find out the full mount point of the device, for example by running the mount command (under Linux, external media usually gets mounted under /media/disk, under Mac it's /Volumes). - -Once you know the full mount path, copy your entire GnuPG directory there: -``` -$ cp -rp ~/.gnupg [/media/disk/name]/gnupg-backup - -``` - -(Note: If you get any Operation not supported on socket errors, those are benign and you can ignore them.) - -You should now test to make sure everything still works: -``` -$ gpg --homedir=[/media/disk/name]/gnupg-backup --list-key [fpr] - -``` - -If you don't get any errors, then you should be good to go. Unmount the USB drive and distinctly label it, so you don't blow it away next time you need to use a random USB drive. Then, put in a safe place -- but not too far away, because you'll need to use it every now and again for things like editing identities, adding or revoking subkeys, or signing other people's keys. - -##### Remove the master key - -The files in our home directory are not as well protected as we like to think. They can be leaked or stolen via many different means: - - * By accident when making quick homedir copies to set up a new workstation - - * By systems administrator negligence or malice - - * Via poorly secured backups - - * Via malware in desktop apps (browsers, pdf viewers, etc) - - * Via coercion when crossing international borders - - - - -Protecting your key with a good passphrase greatly helps reduce the risk of any of the above, but passphrases can be discovered via keyloggers, shoulder-surfing, or any number of other means. For this reason, the recommended setup is to remove your master key from your home directory and store it on offline storage. - -###### Removing your master key - -Please see the previous section and make sure you have backed up your GnuPG directory in its entirety. What we are about to do will render your key useless if you do not have a usable backup! - -First, identify the keygrip of your master key: -``` -$ gpg --with-keygrip --list-key [fpr] - -``` - -The output will be something like this: -``` -pub rsa4096 2017-12-06 [C] [expires: 2019-12-06] - 111122223333444455556666AAAABBBBCCCCDDDD - Keygrip = AAAA999988887777666655554444333322221111 -uid [ultimate] Alice Engineer -uid [ultimate] Alice Engineer -sub rsa2048 2017-12-06 [E] - Keygrip = BBBB999988887777666655554444333322221111 -sub rsa2048 2017-12-06 [S] - Keygrip = CCCC999988887777666655554444333322221111 - -``` - -Find the keygrip entry that is beneath the pub line (right under the master key fingerprint). This will correspond directly to a file in your home .gnupg directory: -``` -$ cd ~/.gnupg/private-keys-v1.d -$ ls -AAAA999988887777666655554444333322221111.key -BBBB999988887777666655554444333322221111.key -CCCC999988887777666655554444333322221111.key - -``` - -All you have to do is simply remove the .key file that corresponds to the master keygrip: -``` -$ cd ~/.gnupg/private-keys-v1.d -$ rm AAAA999988887777666655554444333322221111.key - -``` - -Now, if you issue the --list-secret-keys command, it will show that the master key is missing (the # indicates it is not available): -``` -$ gpg --list-secret-keys -sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] - 111122223333444455556666AAAABBBBCCCCDDDD -uid [ultimate] Alice Engineer -uid [ultimate] Alice Engineer -ssb rsa2048 2017-12-06 [E] -ssb rsa2048 2017-12-06 [S] - -``` - -##### Remove the revocation certificate - -Another file you should remove (but keep in backups) is the revocation certificate that was automatically created with your master key. A revocation certificate allows someone to permanently mark your key as revoked, meaning it can no longer be used or trusted for any purpose. You would normally use it to revoke a key that, for some reason, you can no longer control -- for example, if you had lost the key passphrase. - -Just as with the master key, if a revocation certificate leaks into malicious hands, it can be used to destroy your developer digital identity, so it's better to remove it from your home directory. -``` -cd ~/.gnupg/openpgp-revocs.d -rm [fpr].rev - -``` - -Next time, you'll learn how to secure your subkeys as well. Stay tuned. - -Learn more about Linux through the free ["Introduction to Linux" ][4]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage - -作者:[Konstantin Ryabitsev][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/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md new file mode 100644 index 0000000000..8ca36884d9 --- /dev/null +++ b/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md @@ -0,0 +1,167 @@ +用 PGP 保护代码完整性(四):将主密钥移到离线存储中 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/industry-1920.jpg?itok=gI3QraS8) +在本系列教程中,我们为使用 PGP 提供了一个实用指南。你可以从下面的链接中查看前面的文章: + +[第一部分:基本概念和工具][1] + +[第二部分:生成你的主密钥][2] + +[第三部分:生成 PGP 子密钥][3] + +这是本系列教程的第四部分,我们继续本教程,我们将谈一谈如何及为什么要将主密钥从你的 Home 目录移到离线存储中。现在开始我们的教程。 + +### 清单 + + * 准备一个加密的可移除的存储(必要) + + * 备份你的 GnuPG 目录(必要) + + * 从你的 Home 目录中删除主密钥(推荐) + + * 从你的 Home 目录中删除吊销证书(推荐) + + + + +#### Considerations + +为什么要从你的 Home 目录中删除你的主密钥 [C] ?这样做的主要原因是防止你的主密钥失窃或意外泄露。对于心怀不轨的人来说,私钥对他们具有很大的诱惑力 —— 我们知道有几个恶意软件成功地实现了扫描用户的 Home 目录并将发现的任何私钥内容上传。 + +对于任何开发者来说,私钥失窃是非常危险的事情 —— 在自由软件的世界中,这无疑是身份证明失窃。从你的 Home 目录中删除私钥将帮你防范这类事件的发生。 + +##### 备份你的 GnuPG 目录 + +**!!!绝对不要跳过这一步!!!** + +备份你的 PGP 密钥将让你在需要的时候很容易地恢复它们,这很重要!(这与我们做的使用 paperkey 的灾难级备份是不一样的)。 + +##### 准备可移除的加密存储 + +我们从取得一个(最好是两个)小型的 USB “拇指“ 驱动器(可加密 U 盘)开始,我们将用它来做备份。你首先需要去加密它们: + +加密密码可以使用与主密钥相同的密码。 + +##### 备份你的 GnuPG 目录 + +加密过程结束之后,重新插入 USB 驱动器并确保它能够正常挂载。你可以通过运行 `mount` 命令去找到设备挂载点的完全路径。(在 Linux 下,外置介质一般挂载在 /media/disk 下,Mac 一般在它的 /Volumes 下) + +你知道了挂载点的全路径后,将你的整个 GnuPG 的目录复制进去: +``` +$ cp -rp ~/.gnupg [/media/disk/name]/gnupg-backup + +``` + +(注意:如果出现任何套接字不支持的错误,没有关系,直接忽略它们。) + +现在,用如下的命令去测试一下,确保它们能够正常地工作: +``` +$ gpg --homedir=[/media/disk/name]/gnupg-backup --list-key [fpr] + +``` + +如果没有出现任何错误,说明一切正常。弹出这个 USB 驱动器并给它粘上一个明确的标签,以便于你下次需要它时能够很快找到它。接着,将它放到一个安全的 —— 但不要太远 —— 的地方,因为从现在起,你需要偶尔使用它来做一些像编辑身份信息、添加或吊销子证书、或签署其它人的密钥这样的事情。 + +##### 删除主密钥 + +我们 Home 目录中的文件并没有像我们所想像的那样受到保护。它们可能会通过许多不同的方式被泄露或失窃: + + * 通过快速复制来配置一个新工作站时的偶尔事故 + + * 通过系统管理员的疏忽或恶意操作 + + * 通过安全性欠佳的备份 + + * 通过桌面应用中的恶意软件(浏览器、pdf 查看器等等) + + * 通过跨境胁迫 + + + + +使用一个很好的密码来保护你的密钥是降低上述风险的一个很好方法,但是密码能够通过键盘记录器、背后窥视、或其它方式被发现。基于以上原因,我们建议去配置一个从你的 Home 目录上可移除的主密钥,将它保存在一个离线存储中。 + +###### 删除主密钥 + +**请查看前面的节,确保你有完整的你的 GnuPG 目录的一个备份。如果你没有一个可用的备份,下面所做的操作将会使你的主密钥失效!!!** + +首先,识别你的主密钥的 keygrip: +``` +$ gpg --with-keygrip --list-key [fpr] + +``` + +它的输出应该像下面这样: +``` +pub rsa4096 2017-12-06 [C] [expires: 2019-12-06] + 111122223333444455556666AAAABBBBCCCCDDDD + Keygrip = AAAA999988887777666655554444333322221111 +uid [ultimate] Alice Engineer +uid [ultimate] Alice Engineer +sub rsa2048 2017-12-06 [E] + Keygrip = BBBB999988887777666655554444333322221111 +sub rsa2048 2017-12-06 [S] + Keygrip = CCCC999988887777666655554444333322221111 + +``` + +找到 pub 行下方的 keygrip 条目(就在主密钥指纹的下方)。它与你的 Home 目录下 `.gnupg` 目录下的一个文件是一致的: +``` +$ cd ~/.gnupg/private-keys-v1.d +$ ls +AAAA999988887777666655554444333322221111.key +BBBB999988887777666655554444333322221111.key +CCCC999988887777666655554444333322221111.key + +``` + +现在你做的全部操作就是简单地删除与主密钥 keygrip 一致的 `.key` 文件: +``` +$ cd ~/.gnupg/private-keys-v1.d +$ rm AAAA999988887777666655554444333322221111.key + +``` + +现在,如果运行 --list-secret-keys 命令将出现问题,它将显示主密钥丢失(# 表示不可用): +``` +$ gpg --list-secret-keys +sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] + 111122223333444455556666AAAABBBBCCCCDDDD +uid [ultimate] Alice Engineer +uid [ultimate] Alice Engineer +ssb rsa2048 2017-12-06 [E] +ssb rsa2048 2017-12-06 [S] + +``` + +##### 删除吊销证书 + +你应该去删除的另一个文件是吊销证书(**删除之前,确保你的备份中有它**),它是使用你的主密钥自动创建的。吊销证书允许一些人去永久标记你的证书为吊销状态,这意味着它无论在任何用途中将不再被使用或信任。一般是使用它来吊销由于某些原因不再受控的一个密钥 —— 比如,你丢失了密钥密码。 + +与使用主密钥一样,如果一个吊销证书泄露到恶意者手中,他们能够使用它去破坏你的开发者数字身份,因此,最好是从你的 Home 目录中删除它。 +``` +cd ~/.gnupg/openpgp-revocs.d +rm [fpr].rev + +``` + +在下一篇文章中,你将学习如何保护你的子密钥。敬请期待。 + +从来自 Linux 基金会和 edX 的免费课程 [“Linux 入门" ][4] 中学习更多 Linux 知识。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage + +作者:[Konstantin Ryabitsev][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/mricon +[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools +[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key +[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 22fce8a05011eb6382039c69021e153b7a91f081 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sat, 22 Dec 2018 12:03:45 +0800 Subject: [PATCH 0253/4278] Translating by qhwdw --- ...ity with PGP - Part 5- Moving Subkeys to a Hardware Device.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md index ac862ff64e..8463598b4c 100644 --- a/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md +++ b/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @@ -1,3 +1,4 @@ +Translating by qhwdw Protecting Code Integrity with PGP — Part 5: Moving Subkeys to a Hardware Device ====== From 69ca64dc5dbde7f012857a84669c3d5b33f5adaa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 22 Dec 2018 18:16:25 +0800 Subject: [PATCH 0254/4278] PRF:20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md @geekpi --- ...on Ubuntu and Other Linux Distributions.md | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md b/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md index 886d5ce5e8..f365ce1f32 100644 --- a/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md +++ b/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install Putty on Ubuntu and Other Linux Distributions) @@ -10,11 +10,11 @@ 如何在 Ubuntu 和其他 Linux 发行版上安装 Putty ====== -如果我没错,[Putty][1] 可能是 Windows 最受欢迎的 SSH 客户端。 +如果我没弄错,[Putty][1] 可能是 Windows 最受欢迎的 SSH 客户端。 -I在 IT 公司中,开发环境通常在远程 Linux 系统上,而开发人员则使用 Windows 作为本地系统。Putty 用于从 Windows 机器连接到远程 Linux 系统。 +在 IT 公司中,开发环境通常在远程 Linux 系统上,而开发人员则使用 Windows 作为本地系统。Putty 用于从 Windows 机器连接到远程 Linux 系统。 -Putty 不仅限于 Windows。你也可以在 Linux 和 macOS 上使用此开源软件。 +Putty 不是限定于 Windows 的。你也可以在 Linux 和 macOS 上使用此开源软件。 但是等等!当你已经拥有“真正的” Linux 终端时,为什么要在 Linux 上使用单独的 SSH 客户端?这有几个想在 Linux 上使用 Putty 的原因。 @@ -22,8 +22,6 @@ Putty 不仅限于 Windows。你也可以在 Linux 和 macOS 上使用此开源 * 你发现很难手动编辑 SSH 配置文件以保存各种 SSH 会话。你更喜欢 Putty 图形化保存 SSH 连接的方式。 * 你想通过连接到原始套接字和串口进行调试。 - - 无论是什么原因,如果你想在 Ubuntu 或任何其他 Linux 上使用 Putty,你当然可以这样做。让我告诉你如何做到。 ### 在 Ubuntu Linux 上安装 Putty @@ -38,7 +36,7 @@ Putty 不仅限于 Windows。你也可以在 Linux 和 macOS 上使用此开源 sudo add-apt-repository universe ``` -启用 universe 存储库后,应使用以下命令更新 Ubuntu: +启用 universe 仓库后,应使用以下命令更新 Ubuntu: ``` sudo apt update @@ -56,13 +54,13 @@ sudo apt install putty ![Putty in Linux][3] -当你输入远程系统的[主机名][4]或 IP 地址并连接到它时,Putty 将使用你主目录中已保存的 SSH 密钥。 +当你输入远程系统的[主机名][4]或 IP 地址并连接到它时,Putty 将使用你已保存在主目录中的 SSH 密钥。 ![Using Putty in Ubuntu Linux][5] ### 在其他 Linux 发行版上安装 Putty -[Putty 可用于 Debian][6],所以你只需要使用 apt-get 或 aptitude 来安装它。 +[Putty 可用于 Debian][6],所以你只需要使用 `apt-get` 或 `aptitude` 来安装它。 ``` sudo apt-get install putty @@ -82,7 +80,7 @@ sudo pacman -S putty 请记住,Putty 是一款开源软件。如果你真的想要,你也可以通过源代码安装它。你可以从下面的链接获取 Putty 的源代码。 -[下载 Putty 源代码][8] +- [下载 Putty 源代码][8] 我一直喜欢原生 Linux 终端而不是像 Putty 这样的 SSH 客户端。我觉得 GNOME 终端或 [Terminator][7] 更有家的感觉。但是,在 Linux 中使用默认终端或 Putty 是个人选择。 @@ -95,7 +93,7 @@ via: https://itsfoss.com/putty-linux/ 作者:[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/) 荣誉推出 @@ -108,4 +106,4 @@ via: https://itsfoss.com/putty-linux/ [5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/putty-interface-ubuntu-1.jpeg?resize=800%2C430&ssl=1 [6]: https://packages.debian.org/jessie/putty [7]: https://launchpad.net/terminator -[8]: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html \ No newline at end of file +[8]: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html From 372c6927d49946ebc6d969176688f45a56815c16 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 22 Dec 2018 18:18:58 +0800 Subject: [PATCH 0255/4278] PUB:20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md @geekpi https://linux.cn/article-10373-1.html --- ...o Install Putty on Ubuntu and Other Linux Distributions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md (98%) diff --git a/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md b/published/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md similarity index 98% rename from translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md rename to published/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md index f365ce1f32..980eb43558 100644 --- a/translated/tech/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md +++ b/published/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10373-1.html) [#]: subject: (How to Install Putty on Ubuntu and Other Linux Distributions) [#]: via: (https://itsfoss.com/putty-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From deda2a3e472aa3f494d9fdc630c7d60ab1037f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Sat, 22 Dec 2018 19:45:31 +0800 Subject: [PATCH 0256/4278] Update and rename sources/tech/20180130 Graphics and music tools for game development.md to translated/tech/20180130 Graphics and music tools for game development.md --- ...cs and music tools for game development.md | 180 ------------------ ...cs and music tools for game development.md | 177 +++++++++++++++++ 2 files changed, 177 insertions(+), 180 deletions(-) delete mode 100644 sources/tech/20180130 Graphics and music tools for game development.md create mode 100644 translated/tech/20180130 Graphics and music tools for game development.md diff --git a/sources/tech/20180130 Graphics and music tools for game development.md b/sources/tech/20180130 Graphics and music tools for game development.md deleted file mode 100644 index db2cd04f3b..0000000000 --- a/sources/tech/20180130 Graphics and music tools for game development.md +++ /dev/null @@ -1,180 +0,0 @@ -robsean translating -Graphics and music tools for game development -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Life_opengame.png?itok=JPxruL3k) - -In early October, our club, [Geeks and Gadgets][1] from Marshall University, participated in the inaugural [Open Jam][2], a game jam that celebrated the best of open source tools. Game jams are events where participants work as teams to develop computer games for fun. Jams tend to be very short--only three days long--and very exhausting. Opensource.com [announced][3] Open Jam in late August, and more than [three dozen games][4] were entered into the competition. - -Our club likes to create and use open source software in our projects, so Open Jam was naturally the jam we wanted to participate in. Our submission was an experimental game called [Mark My Words][5]. We used a variety of free and open source (FOSS) tools to develop it; in this article we'll discuss some of the tools we used and potential stumbling blocks to be aware of. - -### Audio tools - -#### MilkyTracker - -[MilkyTracker][6] is one of the best software packages available for composing old-style video game music. It is an example of a [music tracker][7], a powerful MOD and XM file creator with a characteristic grid-based pattern editor. We used it to compose most of the musical pieces in our game. One of the great things about this program is that it consumed much less disk space and RAM than most of our other tools. Even so, MilkyTracker is still extremely powerful. - -![](https://opensource.com/sites/default/files/u128651/mtracker.png) - -The user interface took a while to get used to, so here are some pointers for any musician who wants to try out MilkyTracker: - - * Go to Config > Misc. and set the edit mode control style to "MilkyTracker." This will give you modern keyboard shortcuts for almost everything - * Undo with Ctrl+Z - * Redo with Ctrl+Y - * Toggle pattern-edit mode with the Spacebar - * Delete the previous note with the Backspace key - * Insert a row with the Insert key - * By default, a note will continue playing until it is replaced on that channel. You can end a note explicitly by inserting a KeyOff note with the backquote (`) key - * You will have to create or find samples before you can start composing. We recommend finding [Creative Commons][8] licensed samples at websites such as [Freesound][9] or [ccMixter][10] - - - -In addition, keep the [MilkyTracker documentation page][11] handy. It contains links to numerous tutorials and manuals. A good starting point is the [MilkyTracker Guide][12] on the project's wiki. - -#### LMMS - -Two of our musicians used the versatile and modern music creation tool [LMMS][13]. It comes with a library of cool samples and effects, plus a variety of flexible plugins for generating unique sounds. The learning curve for LMMS was surprisingly low, in part due to the nice beat/bassline editor. - -![](https://opensource.com/sites/default/files/u128651/lmms_plugins.png) - -We have one suggestion for musicians trying out LMMS: Use the plugins. For [chiptune][14]-style music, we recommend [sfxr][15], [BitInvader][16], and [FreeBoy][17]. For other styles, [ZynAddSubFX][18] is a good choice. It comes with a wide range of synthesized instruments that can be altered however you see fit. - -### Graphics tools - -#### Tiled - -[Tiled][19] is a popular tilemap editor in open source game development. We used it to assemble consistent, retro-looking backgrounds for our in-game scenes. - -![](https://opensource.com/sites/default/files/u128651/tiled.png) - -Tiled can export maps as XML, JSON, or as flattened images. It is stable and cross-platform. - -One of Tiled's features, which we did not use during the jam, allows you to define and place arbitrary game objects, such as coins and powerups, onto the map. All you have to do is load the object's graphics as a tileset, then place them using Insert Tile. - -Overall, Tiled is a stellar piece of software that we recommend for any project that needs a map editor. - -#### Piskel - -[Piskel][20] is a pixel art editor whose source code is licensed under the [Apache License, Version 2.0][21]. We used Piskel for almost all our graphical assets during the jam, and we will certainly be using it in future projects as well. - -Two features of Piskel that helped us immensely during the jam are onion skin and spritesheet exporting. - -##### Onion skin - -The onion skin feature will make Piskel show a ghostly overlay of the previous and next frames of your animation as you edit, like this: - -![](https://opensource.com/sites/default/files/u128651/onionshow.gif) - -Onion skin is handy because it serves as a drawing guide and helps you maintain consistent shapes and volumes on your characters throughout the animation process. To enable it, just click the onion-shaped icon underneath the preview window on the top-right of the screen. - -![](https://opensource.com/sites/default/files/u128651/onionenable.png) - -##### Spritesheet exporting - -Piskel's ability to export animations as a spritesheet was also very helpful. A spritesheet is a single raster image that contains all the frames of an animation. For example, here is a spritesheet we exported from Piskel: - -![](https://opensource.com/sites/default/files/u128651/sprite-artist.png) - -The spritesheet consists of two frames. One frame is in the top half of the image and the other frame is in the bottom half of the image. Spritesheets greatly simplify a game's code by enabling an entire animation to be loaded from a single file. Here is an animated version of the above spritesheet: - -![](https://opensource.com/sites/default/files/u128651/sprite-artist-anim.gif) - -##### Unpiskel.py - -There were several times during the jam when we wanted to batch convert Piskel files into PNGs. Since the Piskel file format is based on JSON, we wrote a small GPLv3-licensed Python script called [unpiskel.py][22] to do the conversion. - -It is invoked like this: -``` - - -python unpiskel.py input.piskel -``` - -The script will extract the PNG data frames and layers from a Piskel file (here `input.piskel`) and store them in their own files. The files follow the pattern `NAME_XX_YY.png` where `NAME` is the truncated name of the Piskel file, `XX` is the frame number, and `YY` is the layer number. - -Because the script can be invoked from a shell, it can be used on a whole list of files. -``` -for f in *.piskel; do python unpiskel.py "$f"; done -``` - -### Python, Pygame, and cx_Freeze - -#### Python and Pygame - -We used the [Python][23] language to make our game. It is a scripting language that is commonly used for text processing and desktop app development. It can also be used for game development, as projects like [Angry Drunken Dwarves][24] and [Ren'Py][25] have shown. Both of these projects use a Python library called [Pygame][26] to display graphics and produce sound, so we decided to use this library in Open Jam, too. - -Pygame turned out to be both stable and featureful, and it was great for the arcade-style game we were creating. The library's speed was fast enough at low resolutions, but its CPU-only rendering starts to slow down at higher resolutions. This is because Pygame does not use hardware-accelerated rendering. However, the infrastructure is there for developers to take full advantage of OpenGL. - -If you're looking for a good 2D game programming library, Pygame is one to keep your eye on. Its website has [a good tutorial][27] to get started. Be sure to check it out! - -#### cx_Freeze - -Prepping our game for distribution was interesting. We knew that Windows users were unlikely to have a Python installation, and asking them to install it would have been too much. On top of that, they would have had to also install Pygame, which is not an intuitive task on Windows. - -One thing was clear: We had to put our game into a more convenient form. Many of the other Open Jam participants used the proprietary game engine Unity, which enabled their games to be played in the web browser. This made them extremely convenient to play. Convenience was one thing our game didn't have even a sliver of. But, thanks to a vibrant Python ecosystem, we had options. Tools exist to help Python programmers prepare their programs for distribution on Windows. The two that we considered were [cx_Freeze][28] and [Pygame2exe][29] (which uses [py2exe][30]). We decided on cx_Freeze because it was cross-platform. - -In cx_Freeze, you can pack a single-script game for distribution just by running a command like this in the shell: -``` -cxfreeze main.py --target-dir dist -``` - -This invocation of `cxfreeze` will take your script (here `main.py`) and the Python interpreter on your system and bundle them up into the `dist` directory. Once this is done, all you have to do is manually copy your game's data files into the `dist` directory. You will find that the `dist` directory contains an executable file that can be run to start your game. - -There is a more involved way to use cx_Freeze that allows you to automate the copying of data files, but we found the straightforward invocation of `cxfreeze` to be good enough for our needs. Thanks to this tool, we made our game a little more convenient to play. - -### Celebrating open source - -Open Jam is important because it celebrates the open source model of software development. This is an opportunity to analyze the current state of open source tools and what we need to work on in the future. Game jams are perhaps the best time for game devs to try to push their tools to the limit, to learn what must be improved for the good of future game devs. - -Open source tools enable people to explore their creativity without compromising their freedom and without investing money upfront. Although we might not become professional game developers, we were still able to get a small taste of it with our short, experimental game called [Mark My Words][5]. It is a linguistically themed game that depicts the evolution of a fictional writing system throughout its history. There were many other delightful submissions to Open Jam, and they are all worth checking out. Really, [go look][31]! - -Before closing, we would like to thank all the [club members who participated][32] and made this experience truly worthwhile. We would also like to thank [Michael Clayton][33], [Jared Sprague][34], and [Opensource.com][35] for hosting Open Jam. It was a blast. - -Now, we have some questions for readers. Are you a FOSS game developer? What are your tools of choice? Be sure to leave a comment below! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/graphics-music-tools-game-dev - -作者:[Charlie Murphy][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/rsg167 -[1]:http://mugeeks.org/ -[2]:https://itch.io/jam/open-jam-1 -[3]:https://opensource.com/article/17/8/open-jam-announcement -[4]:https://opensource.com/article/17/11/open-jam -[5]:https://mugeeksalpha.itch.io/mark-omy-words -[6]:http://milkytracker.titandemo.org/ -[7]:https://en.wikipedia.org/wiki/Music_tracker -[8]:https://creativecommons.org/ -[9]:https://freesound.org/ -[10]:http://ccmixter.org/view/media/home -[11]:http://milkytracker.titandemo.org/documentation/ -[12]:https://github.com/milkytracker/MilkyTracker/wiki/MilkyTracker-Guide -[13]:https://lmms.io/ -[14]:https://en.wikipedia.org/wiki/Chiptune -[15]:https://github.com/grimfang4/sfxr -[16]:https://lmms.io/wiki/index.php?title=BitInvader -[17]:https://lmms.io/wiki/index.php?title=FreeBoy -[18]:http://zynaddsubfx.sourceforge.net/ -[19]:http://www.mapeditor.org/ -[20]:https://www.piskelapp.com/ -[21]:https://github.com/piskelapp/piskel/blob/master/LICENSE -[22]:https://raw.githubusercontent.com/MUGeeksandGadgets/MarkMyWords/master/tools/unpiskel.py -[23]:https://www.python.org/ -[24]:https://www.sacredchao.net/~piman/angrydd/ -[25]:https://renpy.org/ -[26]:https://www.Pygame.org/ -[27]:http://Pygame.org/docs/tut/PygameIntro.html -[28]:https://anthony-tuininga.github.io/cx_Freeze/ -[29]:https://Pygame.org/wiki/Pygame2exe -[30]:http://www.py2exe.org/ -[31]:https://itch.io/jam/open-jam-1/entries -[32]:https://github.com/MUGeeksandGadgets/MarkMyWords/blob/3e1e8aed12ebe13acccf0d87b06d4f3bd124b9db/README.md#credits -[33]:https://twitter.com/mwcz -[34]:https://twitter.com/caramelcode -[35]:https://opensource.com/ diff --git a/translated/tech/20180130 Graphics and music tools for game development.md b/translated/tech/20180130 Graphics and music tools for game development.md new file mode 100644 index 0000000000..1cdb157bc4 --- /dev/null +++ b/translated/tech/20180130 Graphics and music tools for game development.md @@ -0,0 +1,177 @@ +用于游戏开发的图形和音乐工具 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Life_opengame.png?itok=JPxruL3k) + +在十月初,我们的俱乐部,来自马歇尔大学的 [Geeks and Gadgets][1] , 参加就职 [Open Jam][2], 一个游戏 jam ,庆祝最好的开源工具。游戏 jams 是参与者为娱乐像团队协作的来开发计算机游戏的事件。Jams 倾向于非常简短--仅三天时间长--并非常让人精疲力尽。Opensource.com 在八月下旬 [宣布][3] Open Jam ,更多 [three dozen games][4] 进入到竞赛中。 + +我们的俱乐部希望在我们的工程中创建和使用开放源码软件,所以 Open Jam 自然是我们想要参与的 jam 。我们的提交的文件是一个实验性的名称为 [Mark My Words][5] 的游戏。我们使用多种自由和开放源码 (FOSS) 工具来开发它;在这篇文章中,我们将讨论一些我们使用和意识到有潜在的障碍物的工具。 + +### 音频工具 + +#### MilkyTracker + +[MilkyTracker][6] 是最好的可用于构成旧样式电子游戏音乐的软件包中的一个。它是一个 [music tracker][7] 的一个示例,一个强大的带有特殊的基于网格的图形编辑器的 MOD 和 XM 文件创建器。在我们的游戏中,我们使用它来构成大多数的音乐片段。这个程序最好的特点是,它比我们其它的大多数工具消耗更少的硬盘空间和 RAM 。虽然如此,MilkyTracker 仍然非常强大。 + +![](https://opensource.com/sites/default/files/u128651/mtracker.png) + +用户界面需要一会来习惯,这里有对一些想试用MilkyTracker的音乐家的一些提示: + + * 转到 Config > Misc. ,设置 edit 模式控制样式为 "MilkyTracker." 这将给你几乎所有的现代键盘快捷方式 + * 撤销 Ctrl+Z + * 重做 Ctrl+Y + * 切换 pattern-edit 模式 空格键 + * 删除先前的注释 退格键 + * 插入一行 Insert键 + * 默认情况下,一个注释将持续作用,直到它在这频道上被替换。你可以明确地结束一个注释,通过使用一个反引号 (`) 键插入一个 KeyOff 注释 + * 在你开始谱写乐曲前,你将不得不创建或查找示例。我们建议在网站上查找 [Creative Commons][8] 协议的示例,例如 [Freesound][9] 或 [ccMixter][10] + + + +另外,保持 [MilkyTracker 文档页面][11] 在手边。它含有数不清的教程和手册的链接。一个好的开始点是在该项目 wiki 上的 [MilkyTracker 指南][12] 。 + +#### LMMS + +我们中的两个音乐家使用多用途和现代音乐创建工具 [LMMS][13] 。它带来一个绝妙的示例和效果库,加一个灵活的多种多样的插件来生成独特的声音。 The learning curve for LMMS 的学习曲线令人吃惊的低,在某种程度上是因为友好的节拍/低音线编辑器。 + +![](https://opensource.com/sites/default/files/u128651/lmms_plugins.png) + +我们对音乐家有一个建议,尝试 LMMS:使用插件。 对于 [chiptune][14]-样式音乐,我们推荐 [sfxr][15] ,[BitInvader][16] ,和 [FreeBoy][17] 。对于其它样式, [ZynAddSubFX][18] 是一个好的选择。它带来一个宽波段的可以被你任意更改的人工合成工具。 + +### 图形工具 + +#### Tiled + +在开放源码游戏开发中,[Tiled][19] 是一个流行的组件地图类(tilemap)编辑器。我们使用它为来为我们在游戏场景中组合连续的,复古的背景。 + +![](https://opensource.com/sites/default/files/u128651/tiled.png) + +Tiled 可以导出地图为 XM L,JSON ,或平坦的图像。它是稳定的和跨平台的。 + +Tiled 的特征一,在 jam 期间,我们不能使用, 允许你定义和随意的放置游戏对象,例如硬币和永久能力提升道具到地图上。你需要做的全部是加载对象的图像为一个平铺显示集,然后使用插入平铺显示放置它们。 + +一般来说,对于一些需要一个地图编辑器的工程,Tiled 是我们建议软件的一个主要的部分。 + +#### Piskel + +[Piskel][20] 是一个像素艺术编辑器,它的源文件代码是在 [Apache 协议, 版本 2.0][21] 协议下。在 jam 期间,我们对我们的大多数的图像资源使用 Piskel ,我们当然也将在未来的工程中使用它。 + +Piskel 的特征二,在 jam 的 onion skin和Spritesheet导出期间极大地帮助我们。 + +##### Onion skin + +onion skin 特征将使 Piskel 显示你编辑的动画的前一帧和后一帧的一个幽灵似的覆盖物,像这样: + +![](https://opensource.com/sites/default/files/u128651/onionshow.gif) + +Onion skin 是便于使用的,因为它适合作为一个绘制指南和在动画进程期间帮助你维护在你的角色上连续的图形和声音。为启用它,只需要在屏幕的右上方预览窗体的下面单击 onion-shaped 图标。 + +![](https://opensource.com/sites/default/files/u128651/onionenable.png) + +##### Spritesheet 导出 + +Piskel 的能力是导出动画为一个 spritesheet ,也是非常有用的。一个 spritesheet 是一个单个光栅图象,它包含一个动画的所有的帧。例如,这是一个我们从 Piskel 导出的 spritesheet : + +![](https://opensource.com/sites/default/files/u128651/sprite-artist.png) + +spritesheet 包含两幅帧。一幅帧是图像的上半部分,另一帧是图像的下半部分。Spritesheets 通过启用一个完整的动画来从单个文件加载,大大地简化一个游戏的代码。这是上面的 spritesheet 的一个动画版本: + +![](https://opensource.com/sites/default/files/u128651/sprite-artist-anim.gif) + +##### Unpiskel.py + +在 jam 期间,我们很多次想批量转换 Piskel 文件到 PNG 文件。尽管 Piskel 文件格式基于 JSON ,我们写一个小的 GPLv3 协议的称为 [unpiskel.py][22] 的 Python 脚本来做转换。 + +它像这样被引用: +``` +python unpiskel.py input.piskel +``` + +这个脚本将从一个 Piskel 文件(这里 `input.piskel`)中提取 PNG 数据帧和层,并存储它们在它们拥有的文件中。这些文件采用模式 `NAME_XX_YY.png` ,在这里 `NAME` 是 Piskel 文件的缩减名称,`XX` 是帧的编号,`YY` 是层的编号。 + +因为脚本可以从一个 shell 中引用,它可以被使用在文件的整个列表中。 +``` +for f in *.piskel; do python unpiskel.py "$f"; done +``` + +### Python, Pygame, 和 cx_Freeze + +#### Python 和 Pygame + +我们使用 [Python][23] 语言来自制作我们的游戏。它是一个脚本语言,通常被用于文本处理和桌面应用程序开发。它也可以用于游戏开发,例如工程,像 [Angry Drunken Dwarves][24] 和 [Ren'Py][25] 已经显示。这两个工程都使用一个称为 [Pygame][26] 的 Python 库来显示图形和产生声音,所以我们也决定在 Open Jam 中使用这个库。 + +Pygame 被证明是既稳定又富有特色,并且它对我们创建的街机游戏来说是优秀的。在低分辨率时,库的速度足够快的,但是在高分辨率时,它的仅 CPU 渲染开始变慢。这是因为 Pygame 不使用硬件加速渲染。然而,开发者可以充分利用 OpenGL 基础设施。 + +如果你正在寻找一个好的 2D 游戏编程库,Pygame 是值得密切注意的一个。它的网站有 [一个好的教程][27] 来开始。务必看看它! + +#### cx_Freeze + +准备发行我们的游戏是有趣的。我们知道,Windows 用户不喜欢有一个 Python 安装,并且要求他们来安装它可能很过分。除此之外,他们也可能不得不安装 Pygame ,在 Windows 上,这不是一个简单的工作。 + +有一件事很清楚:我们不得不放置我们的游戏到一个更方便的结构中。很多其他的 Open Jam 参与者使用专有的游戏引擎 Unity ,它能够使它们的游戏在网页浏览器中来玩。这使得它们非常方便地来玩。便利性是一个我们的游戏恰巧一丝的都没有的东西。但是,感谢生机勃勃的 Python 生态系统,我们有选择。在 Windows 上现有的工具帮助 Python 程序员准备发行他们的游戏。我们考虑的两个是 [cx_Freeze][28] 和 [Pygame2exe][29] (它使用 [py2exe][30])。我们下决心在 cx_Freeze 上,因为它是跨平台的。 + +在 cx_Freeze 中,你可以为发行版打包一个单个脚本游戏,只要在shell运行一个命令,像这样: +``` +cxfreeze main.py --target-dir dist +``` + +`cxfreeze` 的这个调用将拿你的脚本(这里 `main.py`) 和在你系统上的 Python 解释器,并捆绑定它们到 `dist` 目录。一旦完成它,你需要做的是手动复制你的游戏的数据文件到 `dist` 目录。你将发现,`dist` 目录包含一个可以运行来开始你的游戏的可执行文件。 + +这里有更复杂难解的方法来使用 cx_Freeze ,允许你自动地复制数据文件,但是我们发现简单的调用 `cxfreeze` 足够我们的需要。感谢这个工具,我们使我们的游戏稍微便利的运行。 + +### 庆祝开放源码 + +Open Jam 是重要的,因为它庆祝软件开发的开放源码模式。这是来分析开放源码工具的当前状态和我们在未来工作中需求的一个机会。,对于游戏开发者来设法推动它们的工具的使用范围,学习必需提高未来游戏开发者的益处,游戏 jams 或许是最好的时间。 + +开放源码工具使人们能够探索他们的创造性,而不妥协他们的自由和前期的投资。尽管我们可能不能成为专业的游戏开发者,我们仍然能获取它的一段小的体验,使用我们简短的,实验性的称为 [Mark My Words][5] 的游戏。它是一个语言学方面地的有特定主题的游戏,它描述一个小说写作系统在它历史期间的演化。Open Jam 有一些令人愉快的提交,并且它们是值得校核。真的, [去看看][31] ! + +在结束前,我们想要感谢所有的 [参加俱乐部的成员][32],使这次经历真正的有价值。我们也想要感谢 [Michael Clayton][33],[Jared Sprague][34] 和 [Opensource.com][35] 主办 open Jam。它是一次欢乐。 + +现在,我们对读者有一些问题。你是一个 FOSS 游戏开发者吗?你选择的工具是什么?务必在下面留下一个评论! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/graphics-music-tools-game-dev + +作者:[Charlie Murphy][a] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/rsg167 +[1]:http://mugeeks.org/ +[2]:https://itch.io/jam/open-jam-1 +[3]:https://opensource.com/article/17/8/open-jam-announcement +[4]:https://opensource.com/article/17/11/open-jam +[5]:https://mugeeksalpha.itch.io/mark-omy-words +[6]:http://milkytracker.titandemo.org/ +[7]:https://en.wikipedia.org/wiki/Music_tracker +[8]:https://creativecommons.org/ +[9]:https://freesound.org/ +[10]:http://ccmixter.org/view/media/home +[11]:http://milkytracker.titandemo.org/documentation/ +[12]:https://github.com/milkytracker/MilkyTracker/wiki/MilkyTracker-Guide +[13]:https://lmms.io/ +[14]:https://en.wikipedia.org/wiki/Chiptune +[15]:https://github.com/grimfang4/sfxr +[16]:https://lmms.io/wiki/index.php?title=BitInvader +[17]:https://lmms.io/wiki/index.php?title=FreeBoy +[18]:http://zynaddsubfx.sourceforge.net/ +[19]:http://www.mapeditor.org/ +[20]:https://www.piskelapp.com/ +[21]:https://github.com/piskelapp/piskel/blob/master/LICENSE +[22]:https://raw.githubusercontent.com/MUGeeksandGadgets/MarkMyWords/master/tools/unpiskel.py +[23]:https://www.python.org/ +[24]:https://www.sacredchao.net/~piman/angrydd/ +[25]:https://renpy.org/ +[26]:https://www.Pygame.org/ +[27]:http://Pygame.org/docs/tut/PygameIntro.html +[28]:https://anthony-tuininga.github.io/cx_Freeze/ +[29]:https://Pygame.org/wiki/Pygame2exe +[30]:http://www.py2exe.org/ +[31]:https://itch.io/jam/open-jam-1/entries +[32]:https://github.com/MUGeeksandGadgets/MarkMyWords/blob/3e1e8aed12ebe13acccf0d87b06d4f3bd124b9db/README.md#credits +[33]:https://twitter.com/mwcz +[34]:https://twitter.com/caramelcode +[35]:https://opensource.com/ From fb1bdd6d48ef62ce095f5724c4bc52f4dab3c4c0 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sat, 22 Dec 2018 21:29:44 +0800 Subject: [PATCH 0257/4278] Translated by qhwdw --- ... 5- Moving Subkeys to a Hardware Device.md | 304 ------------------ ... 5- Moving Subkeys to a Hardware Device.md | 304 ++++++++++++++++++ 2 files changed, 304 insertions(+), 304 deletions(-) delete mode 100644 sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md create mode 100644 translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md diff --git a/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md deleted file mode 100644 index 8463598b4c..0000000000 --- a/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md +++ /dev/null @@ -1,304 +0,0 @@ -Translating by qhwdw -Protecting Code Integrity with PGP — Part 5: Moving Subkeys to a Hardware Device -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pgp-keys.jpg?itok=aS6IWGpq) - -In this tutorial series, we're providing practical guidelines for using PGP. If you missed the previous article, you can catch up with the links below. But, in this article, we'll continue our discussion about securing your keys and look at some tips for moving your subkeys to a specialized hardware device. - -[Part 1: Basic Concepts and Tools][1] - -[Part 2: Generating Your Master Key][2] - -[Part 3: Generating PGP Subkeys][3] - -[Part 4: Moving Your Master Key to Offline Storage][4] - -### Checklist - - * Get a GnuPG-compatible hardware device (NICE) - - * Configure the device to work with GnuPG (NICE) - - * Set the user and admin PINs (NICE) - - * Move your subkeys to the device (NICE) - - - - -### Considerations - -Even though the master key is now safe from being leaked or stolen, the subkeys are still in your home directory. Anyone who manages to get their hands on those will be able to decrypt your communication or fake your signatures (if they know the passphrase). Furthermore, each time a GnuPG operation is performed, the keys are loaded into system memory and can be stolen from there by sufficiently advanced malware (think Meltdown and Spectre). - -The best way to completely protect your keys is to move them to a specialized hardware device that is capable of smartcard operations. - -#### The benefits of smartcards - -A smartcard contains a cryptographic chip that is capable of storing private keys and performing crypto operations directly on the card itself. Because the key contents never leave the smartcard, the operating system of the computer into which you plug in the hardware device is not able to retrieve the private keys themselves. This is very different from the encrypted USB storage device we used earlier for backup purposes -- while that USB device is plugged in and decrypted, the operating system is still able to access the private key contents. Using external encrypted USB media is not a substitute to having a smartcard-capable device. - -Some other benefits of smartcards: - - * They are relatively cheap and easy to obtain - - * They are small and easy to carry with you - - * They can be used with multiple devices - - * Many of them are tamper-resistant (depends on manufacturer) - - - - -#### Available smartcard devices - -Smartcards started out embedded into actual wallet-sized cards, which earned them their name. You can still buy and use GnuPG-capable smartcards, and they remain one of the cheapest available devices you can get. However, actual smartcards have one important downside: they require a smartcard reader, and very few laptops come with one. - -For this reason, manufacturers have started providing small USB devices, the size of a USB thumb drive or smaller, that either have the microsim-sized smartcard pre-inserted, or that simply implement the smartcard protocol features on the internal chip. Here are a few recommendations: - - * [Nitrokey Start][5]: Open hardware and Free Software: one of the cheapest options for GnuPG use, but with fewest extra security features - - * [Nitrokey Pro][6]: Similar to the Nitrokey Start, but is tamper-resistant and offers more security features (but not U2F, see the Fido U2F section of the guide) - - * [Yubikey 4][7]: Proprietary hardware and software, but cheaper than Nitrokey Pro and comes available in the USB-C form that is more useful with newer laptops; also offers additional security features such as U2F - - - - -Our recommendation is to pick a device that is capable of both smartcard functionality and U2F, which, at the time of writing, means a Yubikey 4. - -#### Configuring your smartcard device - -Your smartcard device should Just Work (TM) the moment you plug it into any modern Linux or Mac workstation. You can verify it by running: -``` -$ gpg --card-status - -``` - -If you didn't get an error, but a full listing of the card details, then you are good to go. Unfortunately, troubleshooting all possible reasons why things may not be working for you is way beyond the scope of this guide. If you are having trouble getting the card to work with GnuPG, please seek support via your operating system's usual support channels. - -##### PINs don't have to be numbers - -Note, that despite having the name "PIN" (and implying that it must be a "number"), neither the user PIN nor the admin PIN on the card need to be numbers. - -Your device will probably have default user and admin PINs set up when it arrives. For Yubikeys, these are 123456 and 12345678, respectively. If those don't work for you, please check any accompanying documentation that came with your device. - -##### Quick setup - -To configure your smartcard, you will need to use the GnuPG menu system, as there are no convenient command-line switches: -``` -$ gpg --card-edit -[...omitted...] -gpg/card> admin -Admin commands are allowed -gpg/card> passwd - -``` - -You should set the user PIN (1), Admin PIN (3), and the Reset Code (4). Please make sure to record and store these in a safe place -- especially the Admin PIN and the Reset Code (which allows you to completely wipe the smartcard). You so rarely need to use the Admin PIN, that you will inevitably forget what it is if you do not record it. - -Getting back to the main card menu, you can also set other values (such as name, sex, login data, etc), but it's not necessary and will additionally leak information about your smartcard should you lose it. - -#### Moving the subkeys to your smartcard - -Exit the card menu (using "q") and save all changes. Next, let's move your subkeys onto the smartcard. You will need both your PGP key passphrase and the admin PIN of the card for most operations. Remember, that [fpr] stands for the full 40-character fingerprint of your key. -``` -$ gpg --edit-key [fpr] - -Secret subkeys are available. - -pub rsa4096/AAAABBBBCCCCDDDD - created: 2017-12-07 expires: 2019-12-07 usage: C - trust: ultimate validity: ultimate -ssb rsa2048/1111222233334444 - created: 2017-12-07 expires: never usage: E -ssb rsa2048/5555666677778888 - created: 2017-12-07 expires: never usage: S -[ultimate] (1). Alice Engineer -[ultimate] (2) Alice Engineer - -gpg> - -``` - -Using --edit-key puts us into the menu mode again, and you will notice that the key listing is a little different. From here on, all commands are done from inside this menu mode, as indicated by gpg>. - -First, let's select the key we'll be putting onto the card -- you do this by typing key 1 (it's the first one in the listing, our [E] subkey): -``` -gpg> key 1 - -``` - -The output should be subtly different: -``` -pub rsa4096/AAAABBBBCCCCDDDD - created: 2017-12-07 expires: 2019-12-07 usage: C - trust: ultimate validity: ultimate -ssb* rsa2048/1111222233334444 - created: 2017-12-07 expires: never usage: E -ssb rsa2048/5555666677778888 - created: 2017-12-07 expires: never usage: S -[ultimate] (1). Alice Engineer -[ultimate] (2) Alice Engineer - -``` - -Notice the * that is next to the ssb line corresponding to the key -- it indicates that the key is currently "selected." It works as a toggle, meaning that if you type key 1 again, the * will disappear and the key will not be selected any more. - -Now, let's move that key onto the smartcard: -``` -gpg> keytocard -Please select where to store the key: - (2) Encryption key -Your selection? 2 - -``` - -Since it's our [E] key, it makes sense to put it into the Encryption slot. When you submit your selection, you will be prompted first for your PGP key passphrase, and then for the admin PIN. If the command returns without an error, your key has been moved. - -**Important:** Now type key 1 again to unselect the first key, and key 2 to select the [S] key: -``` -gpg> key 1 -gpg> key 2 -gpg> keytocard -Please select where to store the key: - (1) Signature key - (3) Authentication key -Your selection? 1 - -``` - -You can use the [S] key both for Signature and Authentication, but we want to make sure it's in the Signature slot, so choose (1). Once again, if your command returns without an error, then the operation was successful. - -Finally, if you created an [A] key, you can move it to the card as well, making sure first to unselect key 2. Once you're done, choose "q": -``` -gpg> q -Save changes? (y/N) y - -``` - -Saving the changes will delete the keys you moved to the card from your home directory (but it's okay, because we have them in our backups should we need to do this again for a replacement smartcard). - -##### Verifying that the keys were moved - -If you perform --list-secret-keys now, you will see a subtle difference in the output: -``` -$ gpg --list-secret-keys -sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] - 111122223333444455556666AAAABBBBCCCCDDDD -uid [ultimate] Alice Engineer -uid [ultimate] Alice Engineer -ssb> rsa2048 2017-12-06 [E] -ssb> rsa2048 2017-12-06 [S] - -``` - -The > in the ssb> output indicates that the subkey is only available on the smartcard. If you go back into your secret keys directory and look at the contents there, you will notice that the .key files there have been replaced with stubs: -``` -$ cd ~/.gnupg/private-keys-v1.d -$ strings *.key - -``` - -The output should contain shadowed-private-key to indicate that these files are only stubs and the actual content is on the smartcard. - -#### Verifying that the smartcard is functioning - -To verify that the smartcard is working as intended, you can create a signature: -``` -$ echo "Hello world" | gpg --clearsign > /tmp/test.asc -$ gpg --verify /tmp/test.asc - -``` - -This should ask for your smartcard PIN on your first command, and then show "Good signature" after you run gpg --verify. - -Congratulations, you have successfully made it extremely difficult to steal your digital developer identity! - -### Other common GnuPG operations - -Here is a quick reference for some common operations you'll need to do with your PGP key. - -In all of the below commands, the [fpr] is your key fingerprint. - -#### Mounting your master key offline storage - -You will need your master key for any of the operations below, so you will first need to mount your backup offline storage and tell GnuPG to use it. First, find out where the media got mounted, for example, by looking at the output of the mount command. Then, locate the directory with the backup of your GnuPG directory and tell GnuPG to use that as its home: -``` -$ export GNUPGHOME=/media/disk/name/gnupg-backup -$ gpg --list-secret-keys - -``` - -You want to make sure that you see sec and not sec# in the output (the # means the key is not available and you're still using your regular home directory location). - -##### Updating your regular GnuPG working directory - -After you make any changes to your key using the offline storage, you will want to import these changes back into your regular working directory: -``` -$ gpg --export | gpg --homedir ~/.gnupg --import -$ unset GNUPGHOME - -``` - -#### Extending key expiration date - -The master key we created has the default expiration date of 2 years from the date of creation. This is done both for security reasons and to make obsolete keys eventually disappear from keyservers. - -To extend the expiration on your key by a year from current date, just run: -``` -$ gpg --quick-set-expire [fpr] 1y - -``` - -You can also use a specific date if that is easier to remember (e.g. your birthday, January 1st, or Canada Day): -``` -$ gpg --quick-set-expire [fpr] 2020-07-01 - -``` - -Remember to send the updated key back to keyservers: -``` -$ gpg --send-key [fpr] - -``` - -#### Revoking identities - -If you need to revoke an identity (e.g., you changed employers and your old email address is no longer valid), you can use a one-liner: -``` -$ gpg --quick-revoke-uid [fpr] 'Alice Engineer ' - -``` - -You can also do the same with the menu mode using gpg --edit-key [fpr]. - -Once you are done, remember to send the updated key back to keyservers: -``` -$ gpg --send-key [fpr] - -``` - -Next time, we'll look at how Git supports multiple levels of integration with PGP. - -Learn more about Linux through the free ["Introduction to Linux" ][8]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device - -作者:[KONSTANTIN RYABITSEV][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/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://shop.nitrokey.com/shop/product/nitrokey-start-6 -[6]:https://shop.nitrokey.com/shop/product/nitrokey-pro-3 -[7]:https://www.yubico.com/product/yubikey-4-series/ -[8]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md new file mode 100644 index 0000000000..8dadad1193 --- /dev/null +++ b/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @@ -0,0 +1,304 @@ +用 PGP 保护代码完整性(五):将子密钥移到一个硬件设备中 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pgp-keys.jpg?itok=aS6IWGpq) + +在本系列教程中,我们将提供一个使用 PGP 的实用指南。如果你没有看过前面的文章,你可以通过下面的链接去查看。在这篇文章中,我们将继续讨论如何保护你的密钥,谈一谈将你的子密钥移到一个专门的硬件设备中的一些技巧。 + +[第一部分:基本概念和工具][1] + +[第二部分:生成你的主密钥][2] + +[第三部分:生成 PGP 子密钥][3] + +[第四部分:将主密钥移到离线存储中][4] + +### 清单 + + * 取得一个 GnuPG 兼容的硬件设备(必要) + + * 配置 GnuPG 在设备上工作(必要) + + * 设置 user 和 admin 的 PIN(必要) + + * 移动子密钥到设备中(必要) + + + + +### 考虑事项 + +虽然现在主密钥已经不用担心泄露或失窃了,但子密钥仍然在你的 Home 目录中。任何得到它的人都能够解密你的通讯或假冒你的签名(如果他们知道密钥的密码)。并且,每次执行一个 GnuPG 操作都要将密钥加载到操作系统内存中,这将使一些更高级的恶意软件有机会得到你的密钥(想想 Meltdown 和 Spectre)。 + +完全保护密钥的最好方式就是,将它移到一个专门的硬件设备中,这种硬件设备是一个可操作的智能卡。 + +#### 智能卡的好处 + +一个智能卡包含一个加密芯片,它能够存储私钥,并且直接在智能卡内部执行秘密操作。因为密钥内容从来没有离开过智能卡,计算机操作系统并不能检索你插入的智能卡上的私钥。这与前面用于备份目的的加密 USB 存储是不同的 —— 虽然 USB 设备也是插入并解密的,但操作系统是能够去访问私钥内容的。使用外置的加密 USB 介质并不能代替智能卡设备的功能。 + +智能卡的一些其它好处: + + * 它们很便宜且易于获得 + + * 它们小巧且易于携带 + + * 它们可以用于多种设备上 + + * 它们中的很多都具有防篡改功能(取决于制造商) + + + + +#### 可用的智能卡设备 + +智能卡最初是嵌入到真实钱包大小的卡中,故而得名智能卡。你总是可以买到并使用 GnuPG 功能的智能卡,并且它们是你能得到的最便宜的可用设备之一。但是,事实上智能卡有一个很重要的缺点:它们需要一个智能卡读卡器,只有极小数的笔记本电脑上有这种读卡器。 + +由于这个原因,制造商开始推出小型 USB 设备,它的大小和 U 盘类似,内置有微型智能卡,并且在芯片上简单地实现了智能卡协议特性。下面推荐几个这样的设备: + + * [Nitrokey Start][5]:开源硬件和自由软件,可用于 GnuPG 的最便宜的选择之一,但是额外的安全特性很少。 + + * [Nitrokey Pro][6]:类似于 Nitrokey Start,它提供防篡改及更多的安全特性(但没有 U2F,具体查看指南的 U2F 节)。 + + * [Yubikey 4][7]:专利硬件和软件,但比 Nitrokey Pro 便宜,并且可以用在最新的笔记本电脑上的 USB-C 接口;也提供像 U2F 这样的额外的安全特性。 + + + + +我们推荐选一个同时具备智能卡功能和 U2F 的设备,在写这篇文章时,只能选择 Yubikey 4。 + +#### 配置智能卡设备 + +你的智能卡设备插入任何一台现代的 Linux 或 Mac 工作站上都应该能正常工作。你可以通过运行如下的命令去验证它: +``` +$ gpg --card-status + +``` + +如果你没有收到错误,有一个完整的卡列表,就表示一切正常。不幸的是,排除为什么设备不能正常工作的所有可能原因,已经超出了本指南的范围。如果你的智能卡使用 GnuPG 时有问题,请通过你的操作系统的常见支持通道寻求支持。 + +##### PIN 不一定是数字 + +注意,尽管名为 “PIN”(暗示你它必须是一个“数字”),不论是 user PIN 还是 admin PIN 都不必非要是数字。 + +当你收到一个新设备时,它可能设置有一个默认的 user 和 admin PIN,对于 Yubikeys,它分别是 123456 和 12345678。如果它们的 PIN 不是默认的,请查看设备附带的说明书。 + +##### 快速设置 + +为配置你的智能卡,你需要使用 GnuPG 菜单系统,因此这里并没有更方便的命令行开关: +``` +$ gpg --card-edit +[...omitted...] +gpg/card> admin +Admin commands are allowed +gpg/card> passwd + +``` + +你应该去设置 user PIN (1)、admin PIN (3)、和 Reset Code (4)。请确保把它们记录并保存到一个安全的地方 —— 尤其是 Admin PIN 和 Reset Code(它允许你去擦除整个智能卡内容)。你很少使用到 Admin PIN,因此如果你不记录下来,很可能会忘掉它。 + +返回到智能卡主菜单,你也可以设置其它值(比如名字、性别、登入日期、等等),但是这些都不是必需的,一旦你的智能卡丢失了,将导致额外的信息泄露。 + +#### 将子密钥移到你的智能卡中 + +退出卡菜单(使用 “q” 命令)保存所有更改。接下来,我们将你的子密钥移到智能卡中。将需要用到你的 PGP 密钥的密码,在大多数的智能卡操作中都将用到 admin PIN。记住,那个 [fpr] 表示你的密钥的完整的 40 个字符的指纹。 +``` +$ gpg --edit-key [fpr] + +Secret subkeys are available. + +pub rsa4096/AAAABBBBCCCCDDDD + created: 2017-12-07 expires: 2019-12-07 usage: C + trust: ultimate validity: ultimate +ssb rsa2048/1111222233334444 + created: 2017-12-07 expires: never usage: E +ssb rsa2048/5555666677778888 + created: 2017-12-07 expires: never usage: S +[ultimate] (1). Alice Engineer +[ultimate] (2) Alice Engineer + +gpg> + +``` + +使用 --edit-key 再次进入到菜单模式,你将注意到那个密钥清单有一点小差别。从现在开始,所有的命令都是在这个菜单模式下运行,它用 gpg> 提示符来表示。 + +首先,我们来选择移到智能卡中的密钥 —— 你可以通过键入 `key 1`(它表示选择清单中的第一个密钥)来实现: +``` +gpg> key 1 + +``` + +这个输出会有一点细微的差别: +``` +pub rsa4096/AAAABBBBCCCCDDDD + created: 2017-12-07 expires: 2019-12-07 usage: C + trust: ultimate validity: ultimate +ssb* rsa2048/1111222233334444 + created: 2017-12-07 expires: never usage: E +ssb rsa2048/5555666677778888 + created: 2017-12-07 expires: never usage: S +[ultimate] (1). Alice Engineer +[ultimate] (2) Alice Engineer + +``` + +注意与密钥对应的 ssb 行旁边的 `*` —— 它表示这是当前选定的密钥。它是可切换的,意味着如果你再次输入 `key 1`,这个 `*` 将消失,这个密钥将不再被选中。 + +现在,我们来将密钥移到智能卡中: +``` +gpg> keytocard +Please select where to store the key: + (2) Encryption key +Your selection? 2 + +``` + +由于它是我们的 [E] 密钥,把它移到加密区中是有很有意义的。当你提交了你的选择之后,将会被提示输入你的 PGP 密钥的保护密码,接下来输入智能卡的 admin PIN。如果命令没有返回错误,表示你的密钥已经被移到智能卡中了。 + +**重要:** 现在再次输入 `key 1` 去取消选中第一个密钥,并输入 `key 2` 去选择 [S] 密钥: + +``` +gpg> key 1 +gpg> key 2 +gpg> keytocard +Please select where to store the key: + (1) Signature key + (3) Authentication key +Your selection? 1 + +``` + +你可以使用 [S] 密钥同时做签名和验证,但是我们希望确保它在签名区,因此,我们选择 (1)。完成后,如果你的命令没有返回错误,表示操作已成功。 + +最后,如果你创建了一个 [A] 密钥,你也可以将它移到智能卡中,但是你需要先取消选中 `key 2`。完成后,选择 “q": +``` +gpg> q +Save changes? (y/N) y + +``` + +保存变更将把你的子密钥移到智能卡后,把你的 Home 目录中的相应子密钥删除(没有关系,因为我们的备份中还有,如果更换了智能卡,你需要再做一遍)。 + +##### 验证移动后的密钥 + +现在,如果你执行一个` --list-secret-keys` 操作,你将看到一个稍有不同的输出: +``` +$ gpg --list-secret-keys +sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] + 111122223333444455556666AAAABBBBCCCCDDDD +uid [ultimate] Alice Engineer +uid [ultimate] Alice Engineer +ssb> rsa2048 2017-12-06 [E] +ssb> rsa2048 2017-12-06 [S] + +``` + +在 ssb> 的输出中的 `>` 表示子密钥仅在智能卡上有效。如果你进入到你的密钥目录中,查看目录的内容,你将会看到那个 `.key` 文件已经被存根替换: +``` +$ cd ~/.gnupg/private-keys-v1.d +$ strings *.key + +``` + +这个输出将包含一个影子私钥,它表示那个文件仅是个存根,真正的内容在智能卡中。 + +#### 验证智能卡的功能 + +验证智能卡能否如期正常运行,你可以通过创建一个签名来验证: +``` +$ echo "Hello world" | gpg --clearsign > /tmp/test.asc +$ gpg --verify /tmp/test.asc + +``` + +首次运行这个命令时将询问你智能卡的 PIN,在你运行 `gpg —verify` 之后,它将显示 "Good signature”。 + +祝贺你,你已经成功将窃取你的开发者数字身份变得更加困难了! + +### 其它常见 GnuPG 操作 + +下面是使用你的 PGP 密钥需要做的一些常见操作的快速指南。 + +在下面的所有命令中,[fpr] 表示你的密钥指纹。 + +#### 挂载主密钥离线存储 + +下面的一些操作将需要你的主密钥,因此首先需要去挂载你的主密钥离线存储,并告诉 GnuPG 去使用它。首先,找出介质挂载路径,可以通过查看 mount 命令的输出找到它。接着,设置你的 GnuPG 目录为你的介质上备份的目录,并告诉 GnuPG 将那个目录做为它的 Home: +``` +$ export GNUPGHOME=/media/disk/name/gnupg-backup +$ gpg --list-secret-keys + +``` + +确保你在输出中看到的是 `sec` 而不是 `sec#`(这个 `#` 表示密钥不可用,仍然使用的是惯常的那个 Home 目录)。 + +##### 更新你惯常使用的那个 GnuPG 工作目录 + +在你的离线存储上做了任何更改之后,你应该将这些更改同步应用到你惯常使用的工作目录中: +``` +$ gpg --export | gpg --homedir ~/.gnupg --import +$ unset GNUPGHOME + +``` + +#### 延长密钥过期日期 + +我们创建的主密钥的默认过期日期是自创建之日起两年后。这样做都是为安全考虑,这样将使淘汰密钥最终从密钥服务器上消失。 + +延长你的密钥过期日期,从当前日期延长一年,只需要运行如下命令: +``` +$ gpg --quick-set-expire [fpr] 1y + +``` + +如果为了好记住,你也可以使用一个特定日期(比如,你的生日、1 月 1 日、或加拿大国庆日): +``` +$ gpg --quick-set-expire [fpr] 2020-07-01 + +``` + +记得将更新后的密钥发送到密钥服务器: +``` +$ gpg --send-key [fpr] + +``` + +#### 吊销身份 + +如果你需要吊销一个身份(比如,你换了雇主并且旧的邮件地址不再有效了),你可以使用一行命令搞定: +``` +$ gpg --quick-revoke-uid [fpr] 'Alice Engineer ' + +``` + +你也可以通过使用 `gpg --edit-key [fpr]` 在菜单模式下完成同样的事情。 + +完成后,记得将更新后的密钥发送到密钥服务器上: +``` +$ gpg --send-key [fpr] + +``` + +下一篇文章中,我们将谈谈 Git 如何支持 PGP 的多级别集成。 + +通过来自 Linux 基金会和 edX 的免费课程 [“Linux 入门" ][8]学习更多 Linux 知识。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device + +作者:[KONSTANTIN RYABITSEV][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/mricon +[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools +[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key +[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage +[5]:https://shop.nitrokey.com/shop/product/nitrokey-start-6 +[6]:https://shop.nitrokey.com/shop/product/nitrokey-pro-3 +[7]:https://www.yubico.com/product/yubikey-4-series/ +[8]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 094a0a8c8cc37d0748475fe4d422d4018feabf34 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sat, 22 Dec 2018 21:35:28 +0800 Subject: [PATCH 0258/4278] Translating by qhwdw --- ...cting Code Integrity with PGP - Part 6- Using PGP with Git.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md index 0169d96ad6..d0de1b6c0f 100644 --- a/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md +++ b/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @@ -1,3 +1,4 @@ +Translating by qhwdw Protecting Code Integrity with PGP — Part 6: Using PGP with Git ====== From 7d5b9e753274aab22f31187b8fd2d99ed9ca0099 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 15:12:44 +0800 Subject: [PATCH 0259/4278] PRF:20181205 Bash Variables- Environmental and Otherwise.md @HankChow --- ... Variables- Environmental and Otherwise.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md b/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md index c6786eef15..952300bbb4 100644 --- a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md +++ b/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md @@ -1,28 +1,30 @@ Bash 环境变量的那些事 ====== +> 初学者可以在此教程中了解环境变量。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/wynand-van-poortvliet-40467-unsplash.jpg?itok=tr6Eb4N0) -bash 变量,尤其是讨厌的环境变量,已经是一个老生常谈的话题了。我们也更应该对它有一个详细的了解,让它为我们所用。 +bash 变量,尤其是讨厌的*环境变量*,已经是一个老生常谈的话题了。我们也更应该对它有一个详细的了解,让它为我们所用。 下面就打开终端,开始吧。 ### 环境变量 -`HOME` 除了是你脱下帽子惬意休息的地方,同时也是 Linux 中的一个变量,它是当前用户主目录的路径: +`HOME` (LCTT 译注:双关语)除了是你脱下帽子惬意休息的地方,同时也是 Linux 中的一个变量,它是当前用户主目录的路径: ``` echo $HOME ``` -以上这个命令会显示当前用户的主目录路径,通常都在 `/home/` 下。 +以上这个命令会显示当前用户的主目录路径,通常都在 `/home/` 下。 -顾名思义,一个变量的值并不是固定的。实际上,Linux 系统中每一个用户的 `HOME` 变量都是不一样的,当然你也可以这样自行更改 `HOME` 变量的值: +顾名思义,变量的值是可以根据上下文变化的。实际上,Linux 系统中每一个用户的 `HOME` 变量都是不一样的,当然你也可以这样自行更改 `HOME` 变量的值: ``` HOME=/home//Documents ``` -以上这个命令将会把 `HOME` 变量设置为 `/home//Documents` 目录。 +以上这个命令将会把 `HOME` 变量设置为你的 `Documents` 目录。 其中有三点需要留意: @@ -45,7 +47,7 @@ $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin ``` -每两个目录之间使用冒号(`:`)分隔。如果某个应用程序的所在目录不在 `PATH` 变量中,那么运行的时候就需要声明应用程序的目录让 shell 能够找到。 +每两个目录之间使用冒号 `:` 分隔。如果某个应用程序的所在目录不在 `PATH` 变量中,那么运行的时候就需要声明应用程序的目录让 shell 能够找到。 ``` /home//bin/my_program.sh @@ -67,9 +69,9 @@ PATH=$PATH:$HOME/bin 然后 `/home//bin/` 目录就会出现在 `PATH` 变量中了。但正如之前所说,这个变更只会在当前的 shell 生效,当前的 shell 一旦关闭,环境变量的值就又恢复原状了。 -如果要让变更对当前用户持续生效,就不能在 shell 中直接执行对应的变更,而是应该将这些变更操作卸载每次启动 shell 时都会运行的文件当中。这个文件就是当前用户主目录中的 `.bashrc` 文件。文件名前面的点号表明这是一个隐藏文件,执行普通的 `ls` 命令是不会将这个文件显示出来的,但只要在 `ls` 命令中加入 `-a` 参数就可以看到这个文件了。 +如果要让变更对当前用户持续生效,就不能在 shell 中直接执行对应的变更,而是应该将这些变更操作写在每次启动 shell 时都会运行的文件当中。这个文件就是当前用户主目录中的 `.bashrc` 文件。文件名前面的点号表明这是一个隐藏文件,执行普通的 `ls` 命令是不会将这个文件显示出来的,但只要在 `ls` 命令中加入 `-a` 参数就可以看到这个文件了。 -你可以使用诸如 [kate][1]、[gedit][2]、[nano][3] 或者 [vim][4] 这些文本编辑器来打开 `.bashrc` 文件(但不要用 LibreOffice Writer,它是一个文字处理软件,跟前面几个文字编辑器并不一个量级的东西)。打开 `.bashrc` 文件之后,你会看见里面放置了一些 shell 命令,是用于为当前用户设置环境的。 +你可以使用诸如 [kate][1]、[gedit][2]、[nano][3] 或者 [vim][4] 这些文本编辑器来打开 `.bashrc` 文件(但不要用 LibreOffice Writer,它是一个文字处理软件,跟前面几个文字编辑器完全不同)。打开 `.bashrc` 文件之后,你会看见里面放置了一些 shell 命令,是用于为当前用户设置环境的。 在文件的末尾添加新行并输入以下内容: @@ -97,13 +99,13 @@ source .bashrc new_variable="Hello" ``` -然后可以用一下的方式读取到已定义变量的值: +然后可以用以下的方式读取到已定义变量的值: ``` echo $new_variable ``` -程序的正常工作离不开各种变量,例如要将某个选项设置为 on,又或者让程序找到所需的代码库,都需要使用变量。在 bash 中运行程序的时候会生成一个子 shell,这个子 shell 和执行原程序的父 shell 并不是完全一样的,只是继承了父 shell 的部分内容,而且默认是不继承父 shell 中的变量的。因为变量默认情况下是局部变量,出于安全原因,一个 shell 中的局部变量不会被另一个 shell 读取到,即使是子 shell 也不可以。 +程序的正常工作离不开各种变量,例如要将某个选项设置为打开,又或者让程序找到所需的代码库,都需要使用变量。在 bash 中运行程序的时候会生成一个子 shell,这个子 shell 和执行原程序的父 shell 并不是完全一样的,只是继承了父 shell 的部分内容,而且默认是不继承父 shell 中的变量的。因为变量默认情况下是局部变量,出于安全原因,一个 shell 中的局部变量不会被另一个 shell 读取到,即使是子 shell 也不可以。 下面举一个例子。首先定义一个变量: @@ -198,7 +200,7 @@ via: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-o 作者:[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/) 荣誉推出 From 43535b61e5c30e20ff0bb28a74bdff9e293590c3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 15:15:30 +0800 Subject: [PATCH 0260/4278] PUB:20181205 Bash Variables- Environmental and Otherwise.md @HankChow https://linux.cn/article-10374-1.html --- .../20181205 Bash Variables- Environmental and Otherwise.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181205 Bash Variables- Environmental and Otherwise.md (100%) diff --git a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md b/published/20181205 Bash Variables- Environmental and Otherwise.md similarity index 100% rename from translated/tech/20181205 Bash Variables- Environmental and Otherwise.md rename to published/20181205 Bash Variables- Environmental and Otherwise.md From 37d608098239f29b1b25b9a70b8b8a930c7b2a45 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 15:36:44 +0800 Subject: [PATCH 0261/4278] PRF:20180717 11 Uses for a Raspberry Pi Around the Office.md @geekpi --- ...es for a Raspberry Pi Around the Office.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md b/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md index 88e7fbd86a..e5cb91b108 100644 --- a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md +++ b/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (11 Uses for a Raspberry Pi Around the Office) @@ -12,9 +12,9 @@ 我知道你在想什么:树莓派只能用在修修补补、原型设计和个人爱好中。它实际不能用在业务中。 -毫无疑问,这台电脑的处理能力相对较低、易损坏的 SD 卡、缺乏电池备份以及支持的 DIY 性质,这意味着它不会是一个能在任何时候执行最关键的操作的[专业的已安装和已配置的商业服务器][1]的可行替代,。 +毫无疑问,这台电脑的处理能力相对较低、易损坏的 SD 卡、缺乏电池备份以及支持的 DIY 性质,这意味着它不会是一个能在任何时候执行最关键的操作的[专业的、已安装好、配置好的商业服务器][1]的可行替代品。 -但是它电路板便宜、功耗很小、很小几乎适合任何地方、无限灵活 - 这实际上是处理办公室一些基本任务的好方法。 +但是它电路板便宜、功耗很小、小到几乎适合任何地方、无限灵活 —— 这实际上是处理办公室一些基本任务的好方法。 而且,更好的是,已经有一些人完成了这些项目并很乐意分享他们是如何做到的。 @@ -22,11 +22,11 @@ 每次在浏览器中输入网站地址或者点击链接时,都需要将域名转换为数字 IP 地址,然后才能显示内容。 -通常这意味着向互联网上某处 DNS 服务器发出请求 - 但你可以通过本地处理来加快浏览速度。 +通常这意味着向互联网上某处 DNS 服务器发出请求 —— 但你可以通过本地处理来加快浏览速度。 你还可以分配自己的子域,以便本地访问办公室中的计算机。 -[这里是如何让这它工作。][2] +[这里了解它是如何工作的。][2] ### 厕所占用标志 @@ -34,37 +34,37 @@ 这对于那些等待的人来说很烦人,花在处理它上面的时间会耗费你在办公室的工作效率。 -我想你希望在办公室里也悬挂飞机上有的标志。 +我想你希望在办公室里也悬挂飞机上那个厕所有人的标志。 -[Occu-pi][3] 是一个更简单的解决方案,使用磁性开关和树莓派来判断螺栓何时关闭并在 Slack 频道中更新厕所在使用中 - 这意味着整个办公室的人都可以看一眼电脑或者移动设备知道是否有空闲的隔间。 +[Occu-pi][3] 是一个非常简单的解决方案,使用磁性开关和树莓派来判断螺栓何时关闭,并在 Slack 频道中更新“厕所在使用中” —— 这意味着整个办公室的人都可以看一眼电脑或者移动设备知道是否有空闲的隔间。 ### 针对黑客的蜜罐陷阱 黑客破坏了网络的第一个线索是一些事情变得糟糕,这应该会吓到大多数企业主。 -这就是可以用到蜜罐的地方:一台没有任何服务的计算机位于你的网络,将特定端口打开伪装成黑客喜欢的目标。 +这就是可以用到蜜罐的地方:一台没有任何服务的计算机位于你的网络,将特定端口打开,伪装成黑客喜欢的目标。 安全研究人员经常在网络外部部署蜜罐,以收集攻击者正在做的事情的数据。 但对于普通的小型企业来说,这些作为一种绊脚石部署在内部更有用。因为普通用户没有真正的理由想要连接到蜜罐,所以任何发生的登录尝试都是正在进行捣乱的非常好的指示。 -这可以提供对外部人员入侵的预警,并且可信赖的内部人员也没有任何好处。 +这可以提供对外部人员入侵的预警,并且也可以提供对值得信赖的内部人员的预警。 -在较大的客户端/服务器网络中,将它作为虚拟机运行可能更为实际。但是在无线路由器上运行的点对点的小型办公室/家庭办公网络中,[HoneyPi][4] 之类的东西是一个很小的防盗报警器。 +在较大的客户端/服务器网络中,将它作为虚拟机运行可能更为实用。但是在无线路由器上运行的点对点的小型办公室/家庭办公网络中,[HoneyPi][4] 之类的东西是一个很小的防盗报警器。 ### 打印服务器 -网络连接的打印机更方便。 +联网打印机更方便。 -但更换所有打印机可能会很昂贵 - 特别是如果你对它们感到满意的话。 +但更换所有打印机可能会很昂贵 —— 特别是如果你对现有的打印机感到满意的话。 [将树莓派设置为打印服务器][5]可能会更有意义。 -### 网络附加存储 (NAS) +### 网络附加存储(NAS) 将硬盘变为 NAS 是树莓派最早的实际应用之一,并且它仍然是最好的之一。 -[这是如何使用树莓派创建NAS。][6] +[这是如何使用树莓派创建 NAS。][6] ### 工单服务器 @@ -74,13 +74,13 @@ ### 数字标牌 -无论是用于活动、广告、菜单还是其他任何东西,许多企业都需要一种显示数字标牌的方式 - 而树莓派的廉价和省电使其成为一个非常有吸引力的选择。 +无论是用于活动、广告、菜单还是其他任何东西,许多企业都需要一种显示数字标牌的方式 —— 而树莓派的廉价和省电使其成为一个非常有吸引力的选择。 [这有很多可供选择的选项。] [8] ### 目录和信息亭 -[FullPageOS][9] 是一个基于 Raspbian 的 Linux 发行版,它直接引导到 Chromium 的全屏版本 - 这非常适合导购、图书馆目录等。 +[FullPageOS][9] 是一个基于 Raspbian 的 Linux 发行版,它直接引导到 Chromium 的全屏版本 —— 这非常适合导购、图书馆目录等。 ### 基本的内联网 Web 服务器 @@ -96,7 +96,7 @@ Kali Linux 是专为探测网络安全漏洞而构建的操作系统。通过将 [你可以在这里找到树莓派镜像的种子链接。][11] -绝对小心只在你自己的网络或你有权对它安全审计的网络中使用它 - 使用此方法来破解其他网络是严重的犯罪行为。 +绝对要小心只在你自己的网络或你有权对它安全审计的网络中使用它 —— 使用此方法来破解其他网络是严重的犯罪行为。 ### VPN 服务器 @@ -104,15 +104,15 @@ Kali Linux 是专为探测网络安全漏洞而构建的操作系统。通过将 你可以订阅任意数量的商业 VPN 服务,并且你可以在云中安装自己的服务,但是在办公室运行一个 VPN,这样你也可以从任何地方访问本地网络。 -对于轻度使用 - 比如偶尔的商务旅行 - 树莓派是一种强大的,节约能源的设置 VPN 服务器的方式。(首先要检查一下你的路由器是不是不支持这个功能,许多路由器是支持的。) +对于轻度使用 —— 比如偶尔的商务旅行 —— 树莓派是一种强大的,节约能源的设置 VPN 服务器的方式。(首先要检查一下你的路由器是不是不支持这个功能,许多路由器是支持的。) [这是如何在树莓派上安装 OpenVPN。][12] ### 无线咖啡机 -啊,美味:美味的饮料还是公司内工作效率的支柱。 +啊,美味:好喝的饮料是神赐之物,也是公司内工作效率的支柱。 -那么, 为什么不[将办公室的咖啡机变成可以精确控制温度和无线连接的智能咖啡机呢?][13] +那么,为什么不[将办公室的咖啡机变成可以精确控制温度和无线连接的智能咖啡机呢?][13] -------------------------------------------------------------------------------- @@ -121,7 +121,7 @@ via: https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-of 作者:[James Mawson][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/) 荣誉推出 @@ -139,4 +139,4 @@ via: https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-of [10]: https://maker.pro/raspberry-pi/projects/raspberry-pi-web-server [11]: https://www.offensive-security.com/kali-linux-arm-images/ [12]: https://medium.freecodecamp.org/running-your-own-openvpn-server-on-a-raspberry-pi-8b78043ccdea -[13]: https://www.techradar.com/au/how-to/how-to-build-your-own-smart-coffee-machine \ No newline at end of file +[13]: https://www.techradar.com/au/how-to/how-to-build-your-own-smart-coffee-machine From e62b11d81ddb3ebabb66b9b537bd5544c3e3023e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 15:37:25 +0800 Subject: [PATCH 0262/4278] PUB:20180717 11 Uses for a Raspberry Pi Around the Office.md @geekpi https://linux.cn/article-10375-1.html --- .../20180717 11 Uses for a Raspberry Pi Around the Office.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180717 11 Uses for a Raspberry Pi Around the Office.md (99%) diff --git a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md b/published/20180717 11 Uses for a Raspberry Pi Around the Office.md similarity index 99% rename from translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md rename to published/20180717 11 Uses for a Raspberry Pi Around the Office.md index e5cb91b108..cb5b51fe98 100644 --- a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md +++ b/published/20180717 11 Uses for a Raspberry Pi Around the Office.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10375-1.html) [#]: subject: (11 Uses for a Raspberry Pi Around the Office) [#]: via: (https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-office/) [#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) From 6ab2e0d4518025ade17db9302932cfd4cb448e11 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sun, 23 Dec 2018 16:52:51 +0800 Subject: [PATCH 0263/4278] Translated by qhwdw --- ...y with PGP - Part 6- Using PGP with Git.md | 319 ------------------ ...y with PGP - Part 6- Using PGP with Git.md | 318 +++++++++++++++++ 2 files changed, 318 insertions(+), 319 deletions(-) delete mode 100644 sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md create mode 100644 translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md diff --git a/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md deleted file mode 100644 index d0de1b6c0f..0000000000 --- a/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md +++ /dev/null @@ -1,319 +0,0 @@ -Translating by qhwdw -Protecting Code Integrity with PGP — Part 6: Using PGP with Git -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/global-network.jpg?itok=h_hhZc36) -In this tutorial series, we're providing practical guidelines for using PGP, including basic concepts and generating and protecting your keys. If you missed the previous articles, you can catch up below. In this article, we look at Git's integration with PGP, starting with signed tags, then introducing signed commits, and finally adding support for signed pushes. - -[Part 1: Basic Concepts and Tools][1] - -[Part 2: Generating Your Master Key][2] - -[Part 3: Generating PGP Subkeys][3] - -[Part 4: Moving Your Master Key to Offline Storage][4] - -[Part 5: Moving Subkeys to a Hardware Device][5] - -One of the core features of Git is its decentralized nature -- once a repository is cloned to your system, you have full history of the project, including all of its tags, commits and branches. However, with hundreds of cloned repositories floating around, how does anyone verify that the repository you downloaded has not been tampered with by a malicious third party? You may have cloned it from GitHub or some other official-looking location, but what if someone had managed to trick you? - -Or what happens if a backdoor is discovered in one of the projects you've worked on, and the "Author" line in the commit says it was done by you, while you're pretty sure you had [nothing to do with it][6]? - -To address both of these issues, Git introduced PGP integration. Signed tags prove the repository integrity by assuring that its contents are exactly the same as on the workstation of the developer who created the tag, while signed commits make it nearly impossible for someone to impersonate you without having access to your PGP keys. - -### Checklist - - * Understand signed tags, commits, and pushes (ESSENTIAL) - - * Configure git to use your key (ESSENTIAL) - - * Learn how tag signing and verification works (ESSENTIAL) - - * Configure git to always sign annotated tags (NICE) - - * Learn how commit signing and verification works (ESSENTIAL) - - * Configure git to always sign commits (NICE) - - * Configure gpg-agent options (ESSENTIAL) - - - - -### Considerations - -Git implements multiple levels of integration with PGP, first starting with signed tags, then introducing signed commits, and finally adding support for signed pushes. - -#### Understanding Git Hashes - -Git is a complicated beast, but you need to know what a "hash" is in order to have a good grasp on how PGP integrates with it. We'll narrow it down to two kinds of hashes: tree hashes and commit hashes. - -##### Tree hashes - -Every time you commit a change to a repository, git records checksum hashes of all objects in it -- contents (blobs), directories (trees), file names and permissions, etc, for each subdirectory in the repository. It only does this for trees and blobs that have changed with each commit, so as not to re-checksum the entire tree unnecessarily if only a small part of it was touched. - -Then it calculates and stores the checksum of the toplevel tree, which will inevitably be different if any part of the repository has changed. - -##### Commit hashes - -Once the tree hash has been created, git will calculate the commit hash, which will include the following information about the repository and the change being made: - - * The checksum hash of the tree - - * The checksum hash of the tree before the change (parent) - - * Information about the author (name, email, time of authorship) - - * Information about the committer (name, email, time of commit) - - * The commit message - - - - -##### Hashing function - -At the time of writing, git still uses the SHA1 hashing mechanism to calculate checksums, though work is under way to transition to a stronger algorithm that is more resistant to collisions. Note, that git already includes collision avoidance routines, so it is believed that a successful collision attack against git remains impractical. - -#### Annotated tags and tag signatures - -Git tags allow developers to mark specific commits in the history of each git repository. Tags can be "lightweight" \-- more or less just a pointer at a specific commit, or they can be "annotated," which becomes its own object in the git tree. An annotated tag object contains all of the following information: - - * The checksum hash of the commit being tagged - - * The tag name - - * Information about the tagger (name, email, time of tagging) - - * The tag message - - - - -A PGP-signed tag is simply an annotated tag with all these entries wrapped around in a PGP signature. When a developer signs their git tag, they effectively assure you of the following: - - * Who they are (and why you should trust them) - - * What the state of their repository was at the time of signing: - - * The tag includes the hash of the commit - - * The commit hash includes the hash of the toplevel tree - - * Which includes hashes of all files, contents, and subtrees - * It also includes all information about authorship - - * Including exact times when changes were made - - - - -When you clone a git repository and verify a signed tag, that gives you cryptographic assurance that all contents in the repository, including all of its history, are exactly the same as the contents of the repository on the developer's computer at the time of signing. - -#### Signed commits - -Signed commits are very similar to signed tags -- the contents of the commit object are PGP-signed instead of the contents of the tag object. A commit signature also gives you full verifiable information about the state of the developer's tree at the time the signature was made. Tag signatures and commit PGP signatures provide exact same security assurances about the repository and its entire history. - -#### Signed pushes - -This is included here for completeness' sake, since this functionality needs to be enabled on the server receiving the push before it does anything useful. As we saw above, PGP-signing a git object gives verifiable information about the developer's git tree, but not about their intent for that tree. - -For example, you can be working on an experimental branch in your own git fork trying out a promising cool feature, but after you submit your work for review, someone finds a nasty bug in your code. Since your commits are properly signed, someone can take the branch containing your nasty bug and push it into master, introducing a vulnerability that was never intended to go into production. Since the commit is properly signed with your key, everything looks legitimate and your reputation is questioned when the bug is discovered. - -Ability to require PGP-signatures during git push was added in order to certify the intent of the commit, and not merely verify its contents. - -#### Configure git to use your PGP key - -If you only have one secret key in your keyring, then you don't really need to do anything extra, as it becomes your default key. - -However, if you happen to have multiple secret keys, you can tell git which key should be used ([fpr] is the fingerprint of your key): -``` -$ git config --global user.signingKey [fpr] - -``` - -NOTE: If you have a distinct gpg2 command, then you should tell git to always use it instead of the legacy gpg from version 1: -``` -$ git config --global gpg.program gpg2 - -``` - -#### How to work with signed tags - -To create a signed tag, simply pass the -s switch to the tag command: -``` -$ git tag -s [tagname] - -``` - -Our recommendation is to always sign git tags, as this allows other developers to ensure that the git repository they are working with has not been maliciously altered (e.g. in order to introduce backdoors). - -##### How to verify signed tags - -To verify a signed tag, simply use the verify-tag command: -``` -$ git verify-tag [tagname] - -``` - -If you are verifying someone else's git tag, then you will need to import their PGP key. Please refer to the "Trusted Team communication" document in the same repository for guidance on this topic. - -##### Verifying at pull time - -If you are pulling a tag from another fork of the project repository, git should automatically verify the signature at the tip you're pulling and show you the results during the merge operation: -``` -$ git pull [url] tags/sometag - -``` - -The merge message will contain something like this: -``` -Merge tag 'sometag' of [url] - -[Tag message] - -# gpg: Signature made [...] -# gpg: Good signature from [...] - -``` - -#### Configure git to always sign annotated tags - -Chances are, if you're creating an annotated tag, you'll want to sign it. To force git to always sign annotated tags, you can set a global configuration option: -``` -$ git config --global tag.forceSignAnnotated true - -``` - -Alternatively, you can just train your muscle memory to always pass the -s switch: -``` -$ git tag -asm "Tag message" tagname - -``` - -#### How to work with signed commits - -It is easy to create signed commits, but it is much more difficult to incorporate them into your workflow. Many projects use signed commits as a sort of "Committed-by:" line equivalent that records code provenance -- the signatures are rarely verified by others except when tracking down project history. In a sense, signed commits are used for "tamper evidence," and not to "tamper-proof" the git workflow. - -To create a signed commit, you just need to pass the -S flag to the git commit command (it's capital -S due to collision with another flag): -``` -$ git commit -S - -``` - -Our recommendation is to always sign commits and to require them of all project members, regardless of whether anyone is verifying them (that can always come at a later time). - -##### How to verify signed commits - -To verify a single commit you can use verify-commit: -``` -$ git verify-commit [hash] - -``` - -You can also look at repository logs and request that all commit signatures are verified and shown: -``` -$ git log --pretty=short --show-signature - -``` - -##### Verifying commits during git merge - -If all members of your project sign their commits, you can enforce signature checking at merge time (and then sign the resulting merge commit itself using the -S flag): -``` -$ git merge --verify-signatures -S merged-branch - -``` - -Note, that the merge will fail if there is even one commit that is not signed or does not pass verification. As it is often the case, technology is the easy part -- the human side of the equation is what makes adopting strict commit signing for your project difficult. - -##### If your project uses mailing lists for patch management - -If your project uses a mailing list for submitting and processing patches, then there is little use in signing commits, because all signature information will be lost when sent through that medium. It is still useful to sign your commits, just so others can refer to your publicly hosted git trees for reference, but the upstream project receiving your patches will not be able to verify them directly with git. - -You can still sign the emails containing the patches, though. - -#### Configure git to always sign commits - -You can tell git to always sign commits: -``` -git config --global commit.gpgSign true - -``` - -Or you can train your muscle memory to always pass the -S flag to all git commit operations (this includes --amend). - -#### Configure gpg-agent options - -The GnuPG agent is a helper tool that will start automatically whenever you use the gpg command and run in the background with the purpose of caching the private key passphrase. This way you only have to unlock your key once to use it repeatedly (very handy if you need to sign a bunch of git operations in an automated script without having to continuously retype your passphrase). - -There are two options you should know in order to tweak when the passphrase should be expired from cache: - - * default-cache-ttl (seconds): If you use the same key again before the time-to-live expires, the countdown will reset for another period. The default is 600 (10 minutes). - - * max-cache-ttl (seconds): Regardless of how recently you've used the key since initial passphrase entry, if the maximum time-to-live countdown expires, you'll have to enter the passphrase again. The default is 30 minutes. - - - - -If you find either of these defaults too short (or too long), you can edit your ~/.gnupg/gpg-agent.conf file to set your own values: -``` -# set to 30 minutes for regular ttl, and 2 hours for max ttl -default-cache-ttl 1800 -max-cache-ttl 7200 - -``` - -##### Bonus: Using gpg-agent with ssh - -If you've created an [A] (Authentication) key and moved it to the smartcard, you can use it with ssh for adding 2-factor authentication for your ssh sessions. You just need to tell your environment to use the correct socket file for talking to the agent. - -First, add the following to your ~/.gnupg/gpg-agent.conf: -``` -enable-ssh-support - -``` - -Then, add this to your .bashrc: -``` -export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - -``` - -You will need to kill the existing gpg-agent process and start a new login session for the changes to take effect: -``` -$ killall gpg-agent -$ bash -$ ssh-add -L - -``` - -The last command should list the SSH representation of your PGP Auth key (the comment should say cardno:XXXXXXXX at the end to indicate it's coming from the smartcard). - -To enable key-based logins with ssh, just add the ssh-add -L output to ~/.ssh/authorized_keys on remote systems you log in to. Congratulations, you've just made your ssh credentials extremely difficult to steal. - -As a bonus, you can get other people's PGP-based ssh keys from public keyservers, should you need to grant them ssh access to anything: -``` -$ gpg --export-ssh-key [keyid] - -``` - -This can come in super handy if you need to allow developers access to git repositories over ssh. Next time, we'll provide tips for protecting your email accounts as well as your PGP keys. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git - -作者:[KONSTANTIN RYABITSEV][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/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device -[6]:https://github.com/jayphelps/git-blame-someone-else diff --git a/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md new file mode 100644 index 0000000000..ba010bb0ec --- /dev/null +++ b/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @@ -0,0 +1,318 @@ +保护代码完整性(六):在 Git 上使用 PGP +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/global-network.jpg?itok=h_hhZc36) +在本系列教程中,我们提供了一个使用 PGP 的实用指南,包括基本概念和工具、生成和保护你的密钥。如果你错过了前面的文章,你可以查看下面的链接。在这篇文章中,我们谈一谈在 Git 中如何集成 PGP、使用签名的标签,然后介绍签名提交,最后添加签名推送的支持。 + +[第一部分:基本概念和工具][1] + +[第二部分:生成你的主密钥][2] + +[第三部分:生成 PGP 子密钥][3] + +[第四部分:将主密钥移到离线存储中][4] + +[第五部分:将子密钥移到硬件设备中][5] + +Git 的核心特性之一就是它的去中心化本质 —— 一旦仓库克隆到你的本地系统,你就拥有了项目的完整历史,包括所有的标签、提交和分支。然而由于存在着成百上千的克隆仓库,如何才能验证你下载的仓库没有被恶意的第三方做过篡改?你可以从 GitHub 或一些貌似官方的位置来克隆它们,但是如果有些人故意欺骗了你怎么办? + +或者在你参与的一些项目上发现了后门,而 "Author" 行显示是你干的,然而你很确定 [不是你干的][6],会发生什么情况? + +为解决上述问题,Git 添加了 PGP 集成。签名的标签通过确认它的内容与创建这个标签的开发者的工作站上的内容完全一致来证明仓库的完整性,而签名的提交几乎是不可能在不访问你的 PGP 密钥的情况下能够假冒你。 + +### 清单 + + * 了解签名的标签、提交、和推送(必要) + + * 配置 git 使用你的密钥(必要) + + * 学习如何签名标签和验证工作(必要) + + * 配置 git 总是签名注释的标签(推荐) + + * 学习如何签名提交和验证工作(必要) + + * 配置 git 总是签名提交(推荐) + + * 配置 gpg-agent 选项(必要) + + + + +### 考虑事项 + +Git 实现了 PGP 的多级集成,首先从签名标签开始,接着介绍签名提交,最后添加签名推送的支持。 + +#### 了解 Git 哈希 + +Git 是一个复杂的东西,为了你能够更好地掌握它如何集成 PGP,你需要了解什么是”哈希“。我们将它归纳为两种类型的哈希:树哈希和提交哈希。 + +##### 树哈希 + +每次你向仓库提交一个变更,对于仓库中的每个子目录,git 都会记录它里面所有对象的校验和哈希 —— 内容(blobs)、目录(trees)、文件名和许可等等。它只对每次提交中发生变更的树和内容做此操作,这样在只变更树的一小部分时就不必去重新计算整个树的校验和。 + +然后再计算和存储处于顶级的树的校验和,这样如果仓库的任何一部分发生变化,校验和将不可避免地发生变化。 + +##### 提交哈希 + +一旦创建了树哈希,git 将计算提交哈希,它将包含有关仓库和变更的下列信息: + + * 树哈希的校验和 + + * 变更前树哈希的校验和(父级) + + * 有关作者的信息(名字、email、创作时间) + + * 有关提交者的信息(名字、email、提交时间) + + * 提交信息 + + + + +##### 哈希函数 + +在写这篇文章时,虽然研究一种更强大的、抗碰撞的算法的工作正在进行,但 git 仍然使用的是 SHA1 哈希机制去计算校验和。注意,git 已经包含了碰撞防范程序,因此认为对 git 成功进行碰撞攻击仍然是不可行的。 + +#### 注释的标签和标签签名 + +在每个 Git 仓库中,标签允许开发者标记特定的提交。标签可以是 “轻量级的” —— 几乎只是一个特定提交上的指针,或者它们可以是 “注释的”,它成为 git 树中自己的项目。一个注释的标签对象包含所有下列的信息: + + * 成为标签的提交哈希的校验和 + + * 标签名字 + + * 关于打标签的人的信息(名字、email、打标签时间) + + * 标签信息 + + + + +一个 PGP 签名的标签是一个带有将所有这些条目封装进一个 PGP 签名的注释标签。当开发者签名他们的 git 标签时,他们实际上是向你保证了如下的信息: + + * 他们是谁(以及他们为什么应该被信任) + + * 他们在签名时的仓库状态是什么样: + + * 标签包含提交的哈希 + + * 提交哈希包含了顶级树的哈希 + + * 顶级哈希包含了所有文件、内容和子树的哈希 + * 它也包含有关作者的所有信息 + + * 包含变更发生时的精确时间 + + + + +当你克隆一个仓库并验证一个签名标签时,就是向你以密码方式保证仓库中的所有内容、包括所有它的历史,与开发者签名时在它的计算机上的仓库完全一致。 + +#### 签名的提交 + +签名的提交与签名的标签非常类似 —— 提交对象的内容是 PGP 签名过的,而不是标签对象的内容。一个提交签名也给你提供了开发者签名时,开发者树上的全部可验证信息。标签签名和提交 PGP 签名提供了有关仓库和它的完整历史的完全一致的安全保证。 + +#### 签名的推送 + +为了完整起见,在这里包含了签名的推送这一功能,因为在你使用这个功能之前,需要在接收推送的服务器上先启用它。正如我们在上面所说过的,PGP 签名一个 git 对象就是提供了开发者的 git 树当时的可验证信息,但不提供开发者对那个树意图相关的信息。 + +比如,你可以在你自己 fork 的 git 仓库的一个实验分支上尝试一个很酷的特性,为了评估它,你提交了你的工作,但是有人在你的代码中发现了一个恶意的 bug。由于你的提交是经过正确签名的,因此有人可能将包含有恶意 bug 的分支推入到 master 分支中,从而在生产系统中引入一个漏洞。由于提交是经过你的密钥正确签名的,所以一切看起来都是合理合法的,而当 bug 被发现时,你的声誉就会因此而受到影响。 + +在 `git push` 时,为了验证提交的意图而不仅仅是验证它的内容,添加了要求 PGP 推送签名的功能。 + +#### 配置 git 使用你的 PGP 密钥 + +如果在你的钥匙环上只有一个密钥,那么你就不需要再做额外的事了,因为它是你的默认密钥。 + +然而,如果你有多个密钥,那么你必须要告诉 git 去使用哪一个密钥。([fpr] 是你的密钥的指纹): +``` +$ git config --global user.signingKey [fpr] + +``` + +注意:如果你有一个不同的 gpg2 命令,那么你应该告诉 git 总是去使用它,而不是传统的版本 1 的 gpg: +``` +$ git config --global gpg.program gpg2 + +``` + +#### 如何使用签名标签 + +创建一个签名的标签,只要传递一个简单地 -s 开关给 tag 命令即可: +``` +$ git tag -s [tagname] + +``` + +我们建议始终对 git 标签签名,这样让其它的开发者确信他们使用的 git 仓库没有被恶意地修改过(比如,引入后门): + +##### 如何验证签名的标签 + +验证一个签名的标签,只需要简单地使用 verify-tag 命令即可: +``` +$ git verify-tag [tagname] + +``` + +如果你要验证其他人的 git 标签,那么就需要你导入他的 PGP 公钥。请参考 “可信任的团队沟通” 一文中关于此主题的指导。 + +##### 在拉取时验证 + +如果你从项目仓库的其它 fork 中拉取一个标签,git 将自动验证签名,并在合并操作时显示结果: +``` +$ git pull [url] tags/sometag + +``` + +合并信息将包含类似下面的内容: +``` +Merge tag 'sometag' of [url] + +[Tag message] + +# gpg: Signature made [...] +# gpg: Good signature from [...] + +``` + +#### 配置 git 始终签名注释的标签 + +很可能的是,你正在创建一个带注释的标签,你应该去签名它。强制 git 始终签名带注释的标签,你可以设置一个全局配置选项: +``` +$ git config --global tag.forceSignAnnotated true + +``` + +或者,你始终记得每次都传递一个 -s 开关: +``` +$ git tag -asm "Tag message" tagname + +``` + +#### 如何使用签名提交 + +创建一个签名提交很容易,但是将它纳入到你的工作流中却很困难。许多项目使用签名提交作为一种 "Committed-by:” 的等价行,它记录了代码来源 —— 除了跟踪项目历史外,签名很少有人去验证。在某种意义上,签名的提交用于 ”篡改证据“,而不是 git 工作流的 ”篡改证明“。 + +为创建一个签名的提交,你只需要 `git commit` 命令传递一个 -S 标志即可(由于它与另一个标志冲突,所以改为大写的 -S): +``` +$ git commit -S + +``` + +我们建议始终使用签名提交,并要求项目所有成员都这样做,这样其它人就可以验证它们(下面就讲到如何验证)。 + +##### 如何去验证签名的提交 + +验证签名的提交需要使用 verify-commit 命令: +``` +$ git verify-commit [hash] + +``` + +你也可以查看仓库日志,要求所有提交签名是被验证和显示的: +``` +$ git log --pretty=short --show-signature + +``` + +##### 在 git merge 时验证提交 + +如果项目的所有成员都签名了他们的提交,你可以在合并时强制进行签名检查(然后使用 -S 标志对合并操作本身进行签名): +``` +$ git merge --verify-signatures -S merged-branch + +``` + +注意,如果有一个提交没有签名或验证失败,将导致合并操作失败。通常情况下,技术是最容易的部分 —— 而人的因素使得项目中很难采用严格的提交验证。 + +##### 如果你的项目在补丁管理上采用邮件列表 + +如果你的项目在提交和处理补丁时使用一个邮件列表,那么一般很少使用签名提交,因为通过那种方式发送时,签名信息将会丢失。对提交进行签名仍然是非常有用的,这样引用你托管在公开 git 树的其他人就能以它作为参考,但是上游项目接收你的补丁时,仍然不能直接使用 git 去验证它们。 + +尽管,你仍然可以签名包含补丁的电子邮件。 + +#### 配置 git 始终签名提交 + +你可以告诉 git 总是签名提交: +``` +git config --global commit.gpgSign true + +``` + +或者你每次都记得给 `git commit` 操作传递一个 -S 标志(包括 —amend)。 + +#### 配置 gpg-agent 选项 + +GnuPG agent 是一个守护工具,它能在你使用 gpg 命令时随时自动启动,并运行在后台来缓存私钥的密码。这种方式让你只需要解锁一次密钥就可以重复地使用它(如果你需要在一个自动脚本中签署一组 git 操作,而不需要重复输入密钥,这种方式就很方便)。 + +为了调整缓存中的密钥过期时间,你应该知道这两个选项: + + * default-cache-ttl(秒):如果在 time-to-live 过期之前再次使用同一个密钥,这个倒计时将重置成另一个倒计时周期。缺省值是 600(10 分钟)。 + + * max-cache-ttl(秒):自首次密钥输入以后,不论最近一次使用密钥是什么时间,只要最大值的 time-to-live 倒计时过期,你将被要求再次输入密码。它的缺省值是 30 分钟。 + + + + +如果你认为这些缺省值过短(或过长),你可以编辑 ~/.gnupg/gpg-agent.conf 文件去设置你自己的值: +``` +# set to 30 minutes for regular ttl, and 2 hours for max ttl +default-cache-ttl 1800 +max-cache-ttl 7200 + +``` + +##### 额外好处:与 ssh 一起使用 gpg-agent + +如果你创建了一个 [A](验证)密钥,并将它移到了智能卡,你可以将它用到 ssh 上,为你的 ssh 会话添加一个双因子验证。为了与 agent 沟通你只需要告诉你的环境去使用正确的套接字文件即可。 + +首先,添加下列行到你的 ~/.gnupg/gpg-agent.conf 文件中: +``` +enable-ssh-support + +``` + +接着,添加下列行到你的 .bashrc 文件中: +``` +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + +``` + +为了让改变生效,你需要 kill 掉正在运行的 gpg-agent 进程,并重新启动一个新的登入会话: +``` +$ killall gpg-agent +$ bash +$ ssh-add -L + +``` + +最后的命令将列出代表你的 PGP Auth 密钥的 SSH(注释应该会在结束的位置显示: cardno:XXXXXXXX,表示它来自智能卡)。 + +为了启用 ssh 的基于密钥的登入,只需要在你要登入的远程系统上添加 `ssh-add -L` 的输出到 ~/.ssh/authorized_keys 中。祝贺你,这将使你的 SSH 登入凭据更难以窃取。 + +作为一个福利,你可以从公共密钥服务器上下载其它人的基于 PGP 的 ssh 公钥,这样就可以赋予他登入 ssh 的权利: +``` +$ gpg --export-ssh-key [keyid] + +``` + +如果你有让开发人员通过 ssh 来访问 git 仓库的需要,这将让你非常方便。下一篇文章,我们将提供像保护你的密钥那样保护电子邮件帐户的小技巧。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git + +作者:[KONSTANTIN RYABITSEV][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/mricon +[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools +[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key +[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage +[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device +[6]:https://github.com/jayphelps/git-blame-someone-else From eebbca924755a5389ea83de42162505386db02f8 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 23 Dec 2018 19:44:35 +0800 Subject: [PATCH 0264/4278] Translatng by MjSeven --- .../20180716 Users, Groups and Other Linux Beasts- Part 2.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md index b164bb6cf5..b6d2552264 100644 --- a/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md +++ b/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md @@ -1,3 +1,4 @@ +Translating by MjSeven Users, Groups and Other Linux Beasts: Part 2 ====== ![](https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2) From fe7f9a5b237dcf71bc0ab103d715f14b114f676e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 20:54:35 +0800 Subject: [PATCH 0265/4278] PRF:20171111 A CEOs Guide to Emacs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @oneforalone 翻译辛苦了,我用了比较长的时间才算是初步校对完。希望你可以看看我的校对是否合适。此外,角注的内容,你没有翻译,这个部分也应该翻译一下。这篇是挺有 价值的文章。 --- .../tech/20171111 A CEOs Guide to Emacs.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index 9ddbab89d2..d7a5f8ad0d 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -123,7 +123,7 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] #### 字体及风格 -我推荐在 Emacs 中使用很棒的字体系列。它们可以使用不同的括号、0和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1\.5 倍的行间距,并在代码和数据中使用它们适应比例的字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我我将我的 `.emacs` 设置位根据使用的机器的名称,并配置适当的屏幕机字体。代码如下: +我推荐在 Emacs 中使用漂亮的字体族。它们可以使用不同的括号、0 和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1.5 倍的行间距,并在代码和数据中使用不等宽字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我将我的 `.emacs` 设置为根据使用的机器的名称来相应配置屏幕。代码如下: ``` ;; set up fonts for different OSes. OSX toggles to full screen. @@ -140,9 +140,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] (set-face-attribute 'default nil :font myfont :height 104))) ``` -您应该将你的 Emacs 副本中 `system-name` 的值替换成你使用命令 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个,但是 Windows 和 Emacs 并不真正喜欢对方,当我尝试这个时,它总是不稳定。相反,我只是在启动后手动全屏。 +您应该将你的 Emacs 中的 `system-name` 的值替换成你通过 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个,但是 Windows 和 Emacs 并不真正喜欢对方,当我尝试这个时,它总是不稳定。相反,我只能在启动后手动全屏。 -我还建议去掉 Emacs 中在 90 年代获得的难看的工具栏,当时最酷的事情是在应用程序中使用工具栏。我还去掉了一些其他的 `chrome`,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中,来去掉工具栏和滚动条,但要保留菜单 (在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): +我还建议去掉 Emacs 中的上世纪 90 年代出现的难看工具栏,当时最酷的事情是在应用程序中使用工具栏。我还去掉了一些其它的“电镀层”,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中来去掉工具栏和滚动条,但要保留菜单(在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): ``` (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) @@ -152,9 +152,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] #### Org 模式 -我基本上 `Org` 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。`Org` 最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,`Org` 主要是一种处理结构中内容的方式。在 `Org` 模式中有标题和副标题等,它们的作用就像一个大纲。`Org` 允许你展开或隐藏文本内容,还可以重新排列文本。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 +我基本上是在 Org 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。Org 模式最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,Org 模式主要是一种处理结构中内容的方式。在 Org 模式中有标题和副标题等,它们的作用就像一个大纲。Org 模式允许你展开或隐藏大纲树,还可以重新排列该树。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 -`Org` 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,`LaTeX/PDF` 输出也很好。`Org` 能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下,然后再在你的 `.emacs` 文件中添加如下代码,如果你想要它基于文档的结构进行缩进并在打开时全部展开的话: +Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,LaTeX/PDF 输出也很好。Org 模式能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下,并且如果你想要它基于文档的结构进行缩进并在打开时全部展开的话,在你的 `.emacs` 文件中添加如下代码: ``` ;; set up org mode @@ -163,15 +163,15 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] (setq org-directory "~/org") ``` -最后一行是让 `Org` 知道在哪里查找要包含在议程和其他事情中的文件。我把 `Org` 保存在我的主目录中,也就是说,像前面介绍的一样,它是 Dropbox 目录的一个符号链接。 +最后一行是让 Org 模式知道在哪里查找要包含在议程和其他事情中的文件。我把 Org 模式保存在我的主目录中,也就是说,像前面介绍的一样,它是 Dropbox 目录的一个符号链接。 -我有一个总是在缓冲区中打开的 `stuff.org` 文件。我把它当作记事本。`Org` 使得提取待办事项和有期限的事情变得很容易。当你在内联 `Lisp` 代码并在需要计算它时,它特别有用。拥有包含内容的代码非常方便。同样,你可以使用 Emacs 访问实际的计算机,这是一种解放。 +我有一个总是在缓冲区中打开的 `stuff.org` 文件。我把它当作记事本。Org 模式使得提取待办事项和有期限的事情变得很容易。当你能够内联 Lisp 代码并在需要计算它时,它特别有用。拥有包含内容的代码非常方便。同样,你可以使用 Emacs 访问实际的计算机,这是一种解放。 -##### 用 `Org` 模式进行发布 +##### 用 Org 模式进行发布 -我关心的是文档的外观和格式。我我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。`Org` 对将 `LaTeX` 生成 PDF 支持的很好, `LaTeX` 有自己的学习曲线,但是做简单的事情非常简单。 +我关心的是文档的外观和格式化。我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。Org 模式对将 LaTeX 生成 PDF 支持的很好,LaTeX 虽然也有学习曲线,但是做简单的事情非常简单。 -如果你想使用字体和样式,而不是典型的 `LaTeX` 字体和样式,你需要做些事。首先,你要用到 `XeLaTeX`,这样就可以使用普通的系统字体,而不是 `LaTeX` 的特殊字体。接下来,您需要将一下代码添加到 `.emacs` 中: +如果你想使用字体和样式,而不是典型的 LaTeX 字体和样式,你需要做些事。首先,你要用到 XeLaTeX,这样就可以使用普通的系统字体,而不是 LaTeX 的特殊字体。接下来,您需要将以下代码添加到 `.emacs` 中: ``` (setq org-latex-pdf-process @@ -179,7 +179,7 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] "xelatex -interaction nonstopmode %f")) ``` -我把这个放在 `.emacs` 中 `Org` 配置部分的末尾来保持整洁。这让你在从 `Org` 发布时使用更多格式化选项。例如,我经常使用: +我把这个放在 `.emacs` 中 Org 模式配置部分的末尾来保持整洁。这让你在从 Org 模式发布时可以使用更多格式化选项。例如,我经常使用: ``` #+LaTeX_HEADER: \usepackage{fontspec} @@ -193,11 +193,11 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] 这些都可以在你的 `.org` 文件中找到。我们的公司规定的正文字体是 `Maison Neue`,但你也可以在这写上任何适当的东西。我强烈反对使用 `Maison Neue`。它是一种糟糕的字体,任何人都不应该使用它。 -这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 `LaTeX` 一样。在我看来这还不错,但是字体很无聊,而且有点奇怪。此外,如果你使用标准格式,人们会认为他们正在阅读的东西是或假装是一篇学术论文。别怪我没提醒你。 +这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 LaTeX 一样。在我看来这还不错,但是字体很平淡,而且有点奇怪。此外,如果你使用标准格式,人们会觉得他们正在阅读的东西是、或者假装是一篇学术论文。别怪我没提醒你。 -#### `Ace Jump` 模式 +#### Ace Jump 模式 -如果你想使用的话,这是个辅助而不是主要功能。它的工作原理有点像 Jef Raskin 的 `Leap` 功能[^9] 。 按下 `C-c` `C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `Lisp` 目录下,并在 `.emacs` 文件添加如下代码: +这是个辅助而不是主要功能,但是或许你想使用。它的工作原理有点像之前的 Jef Raskin 的 Leap 功能[^9] 。 按下 `C-c C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `lisp` 目录下,并在 `.emacs` 文件添加如下代码: ``` ;; set up ace-jump-mode @@ -208,7 +208,7 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] ### 更多 -这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除编程(或编程)之外你对 Emacs 的使用,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来引入其他特性或模式。我很确定我将会向你展示如何在 Emacs 和 `Ludwig` 模式下使用 `Fugue`,因为我会将它发展成比代码突出显示更有用的东西。把你的想法发到 [@fugueHQ][41] 上。 +这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除了编程之外(或用于编程)你对 Emacs 的使用情况,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的老板式想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来介绍其它特性或模式。我很确定我将会向你展示如何在 Emacs 和 Ludwig 模式下使用 Fugue,因为我会将它发展成比代码高亮更有用的东西。请把你的想法发到 [@fugueHQ][41] 上。 [^1]: If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. @@ -225,9 +225,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] via: https://blog.fugue.co/2015-11-11-guide-to-emacs.html -作者:[Josh Stella ][a] +作者:[Josh Stella][a] 译者:[oneforalone](https://github.com/oneforalone) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9684a00296651f93a2977db69d73664e6b617c31 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 23 Dec 2018 22:18:41 +0800 Subject: [PATCH 0266/4278] Translating by qhwdw --- ...de Integrity with PGP - Part 7- Protecting Online Accounts.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md index 8ebb9af3f6..1c5cf7ff09 100644 --- a/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md +++ b/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @@ -1,3 +1,4 @@ +Translating by qhwdw Protecting Code Integrity with PGP — Part 7: Protecting Online Accounts ====== From 1fcee3b5fe7bc5fedd9cf439938612e493d88139 Mon Sep 17 00:00:00 2001 From: alim0x Date: Sun, 23 Dec 2018 22:27:21 +0800 Subject: [PATCH 0267/4278] [translated]20181211 DevOps is for everyone --- .../talk/20181121 DevOps is for everyone.md | 75 ------------------- .../talk/20181121 DevOps is for everyone.md | 74 ++++++++++++++++++ 2 files changed, 74 insertions(+), 75 deletions(-) delete mode 100644 sources/talk/20181121 DevOps is for everyone.md create mode 100644 translated/talk/20181121 DevOps is for everyone.md diff --git a/sources/talk/20181121 DevOps is for everyone.md b/sources/talk/20181121 DevOps is for everyone.md deleted file mode 100644 index 256a4e9fc3..0000000000 --- a/sources/talk/20181121 DevOps is for everyone.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (alim0x) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (DevOps is for everyone) -[#]: via: (https://opensource.com/article/18/11/how-non-engineer-got-devops) -[#]: author: (Dawn Parych https://opensource.com/users/dawnparzych) -[#]: url: ( ) - -DevOps is for everyone -====== - -A non-engineer explains why you don't need to be a developer or an operations person to fall for DevOps. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1) - -I've never held a job as a developer nor in operations—so what am I doing writing an article about [DevOps][1]? I've always been interested in computers and technology. I also have a passion for people, psychology, and helping others. When I first heard about DevOps, the concept piqued my interest, as it seemed to merge many of the things I was interested in, even if I don't write code. - -My first computer was a TRS-80, and I loved writing BASIC programs on it. I took the only two computer programming classes my high school offered. A few years later, I started a computer company. I made custom mailing labels, stationery, and built a database to store addresses. - -The problem was I didn't enjoy writing code. I wanted to teach and to help people, and I didn't see writing code as an opportunity to do this. Yes, technology can help people and change lives, but writing code didn't spark my passion. I need to feel excited about my work and do something I love. - - * The culture, not the code - * The journey, not the result - * Building an environment where everybody can continuously improve - * Communicating and collaborating, not working independently - - - -I found that I love DevOps. To me, DevOps is about: - -Ultimately, DevOps is about being part of a community working towards the same goal. DevOps merges psychology, people, and technology. DevOps isn't a job title; it is a philosophy for life and work. - -### Finding my people - -Almost four years ago, I attended my first [DevOpsDays][2] conference in Seattle. I felt like I had found my people. I felt welcomed and accepted, even though I work in marketing and don't have a computer science degree. I could geek out over psychology and technology. - -At DevOpsDays, I learned about the ["Three Ways" of DevOps][3]—flow, feedback, and continuous experimentation and learning—and new (to me) concepts such as Kaizen and Kaikaku. As I learned, I found myself saying things like, "I do this! I didn't know there was a name for this!" - -[Kaizen][4] is the practice of continuous improvement and learning. Small, incremental changes over time can yield significant results. I found parallels between this and Carol Dweck's idea of a [growth mindset][5]. People aren't born experts. Becoming skilled at something takes time, practice, and often failure. Recognizing incremental improvement is necessary to make sure we don't give up. - -[Kaikaku][6], on the other hand, is the notion that small changes over time sometimes won't work, and you need to make a radical or disruptive change. Quitting a job without having a new one lined up or moving to a new city can be pretty disruptive—yes, I've done both. But these radical changes can reap great rewards. I might not have learned about DevOps if I hadn't quit my job and taken some time off. Once I decided to return to work, I kept hearing about DevOps and started researching it. This led me to attend my first DevOpsDays, where I began to see all my passions come together. Since then, I have presented at five DevOpsDays and regularly write about DevOps topics. - -### Putting the Three Ways to work - -Change is hard and learning something new can be scary. The Three Ways of DevOps provide a framework for managing change. For example: How is information flowing? What is driving you to make a change? Once you know a change is needed, how do you get feedback about whether the changes you are making are the right changes? How do you know if you're making progress? Feedback is essential and should include both positive and constructive elements. The hard part is making sure the constructive elements don't outweigh the positive. - -For me, the third Way—continuous experimentation and learning—is the most important part of DevOps. Having an environment where people are free to experiment and take risks can lead to unexpected outcomes. Sometimes those outcomes are good, sometimes not so good—and that's OK. Creating an environment where it is acceptable if things don't work out encourages people to take risks. We should all strive to continuously experiment and learn something new on a regular basis. - -The Three Ways of DevOps provides a method of trying something, getting feedback, and learning from our mistakes. A few years ago, my son told me, "I don't ever want to be the best at something, because then I can't learn from my mistakes." We all make mistakes, and learning from them helps us grow and improve. We aren't willing to make mistakes if our culture doesn't support experimentation and learning. - -### Being part of the community - -I've worked in technology for over 20 years and often felt like an outsider until I found the DevOps community. If you're like me—passionate about technology but not the engineering or operations side of things—you can still be a part of DevOps, even if you work in sales, marketing, product marketing, technical writing, support, and more. DevOps is for everyone. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/11/how-non-engineer-got-devops - -作者:[Dawn Parych][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/dawnparzych -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/resources/devops -[2]: https://www.devopsdays.org/ -[3]: https://itrevolution.com/the-three-ways-principles-underpinning-devops/ -[4]: https://en.wikipedia.org/wiki/Kaizen -[5]: https://en.wikipedia.org/wiki/Mindset#Fixed_and_growth -[6]: https://en.wikipedia.org/wiki/Kaikaku diff --git a/translated/talk/20181121 DevOps is for everyone.md b/translated/talk/20181121 DevOps is for everyone.md new file mode 100644 index 0000000000..778656640d --- /dev/null +++ b/translated/talk/20181121 DevOps is for everyone.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: (alim0x) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (DevOps is for everyone) +[#]: via: (https://opensource.com/article/18/11/how-non-engineer-got-devops) +[#]: author: (Dawn Parych https://opensource.com/users/dawnparzych) +[#]: url: ( ) + +所有人的 DevOps +====== + +让一名非工程师来解释为什么你不必成为一位开发者或运维就能爱上 DevOps。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1) + +我没有过开发或运维的工作——那怎么我在写一篇关于 [DevOps][1] 的文章?我一直都对计算机和技术有兴趣。我还对社群、心理学以及帮助他人充满热情。当我第一次听到 DevOps 时,这个概念激起了我的兴趣,因为它看起来融合了很多我感兴趣的东西,即便我是不写代码的。 + +我的第一台电脑是 TRS-80,我喜欢在上面编写 BASIC 程序。我只上过两门我的高中开设的计算机编程课程。若干年后,我创办了一家计算机公司。我定制邮件标签和信纸,并建立了一个数据库来存储地址。 + +问题是我并不能从写代码中获得享受。我想要教育和帮助人们,我没法将写代码看作这样的一个机会。是的,技术可以帮助人们并改变生活,但是写代码没有点燃我的热情。我需要对我的工作感到兴奋并做我喜欢的事情。 + + * 文化,而不是代码 + * 过程,而不是结果 + * 建立一个所有人可以持续提升的环境 + * 沟通与合作,而不是独立工作 + + +我发现我爱 DevOps。对我而言,DevOps 指的是: + +归根结底,DevOps 是指成为社区工作的一部分,实现共同的目标。DevOps 融合了心理学、社群、技术。DevOps 不是一个职位名称,它是一种生活和工作的哲学。 + +### 找到我的社群 + +快四年前,我在西雅图参加了我的第一个 [DevOps 日][2] 会议。我感觉我找到了我的社群。我觉得受到了欢迎和接受,尽管我从事营销工作而且没有计算机科学文凭。我可以从心理学和技术中寻找乐趣。 + +在 DevOps 日,我学到了 [DevOps“三步工作法”][3]——流动,反馈,持续实验和学习——以及新(对我而言)的概念,如Kaizen(改善)和Kaikaku(改革)。随着我的学习深入,我发现我在说这样的话,“我是这样做的!我都不知道这样做还有个名字!” + +[Kaizen(改善)][4]是持续改进和学习的实践。小的量变积累随着时间的推移可以引起质变。我发现它和卡罗尔.德韦克的[成长型思维][5]的想法很相似。人们不是生来就是专家。在某方面拥有经验需要花费时间,练习,以及常常还有失败。承认增量的改善对确保我们不会放弃是很有必要的。 + +另一方面,[Kaikaku(改革)][6]的概念是指,长时间的小的改变有时不能起作用,你需要做一些完全的或破坏性的改变。在没有找到下份工作前就辞职或移居新城市就足够有破坏性——是的,两者我都做过。但这些彻底的改变收获巨大。如果我没有辞职并休息一段时间,我也许不会接触到 DevOps。等我决定继续工作的时候,我一直听到 DevOps,我开始研究它。这引导我参加了我的第一个 DevOps 日,从那里我开始看到我的所有热情开始聚集。从那时起,我已经参加了五次 DevOps 日活动,并且定期撰写关于 DevOps 话题的文章。 + +### 将三步工作法用到工作中 + +改变是困难的,学习新事物可以听起来很吓人。DevOps 的三步工作法提供了一个管理改变的框架。比如:信息流动是怎样的?是什么驱动着你做出改变?一旦你认为一个改变是必需的,你如何获得这个改变是否正确的反馈?你如何知道你在取得进展?反馈是必要的,并且应该包含积极和有建设性的要素。困难的地方在于保证建设性的要素不要重于积极要素。 + +对我而言,第三步——持续实验和学习——是 DevOps 最重要的部分。有一个可以自由地实验和冒险的环境,人们可以获得意想不到的结果。有时这些结果是好的,有时不是太好——但这没事。创建一个可以接受失败结果的环境可以鼓励人们冒险。我们都应该力争定期的持续实验和学习。 + +DevOps 的三步工作法提供了一个尝试,获得反馈,以及从错误中获取经验的方法。几年前,我的儿子告诉我,“我从来就没想做到最好,因为那样我就没法从我的错误中学到东西了。”我们都会犯错,从中获得经验帮助我们成长和改善。如果我们的文化不支持尝试和学习,我们就不会愿意去犯错。 + +### 成为社区的一部分 + +我已经在技术领域工作了超过 20 年,直到我发现 DevOps 社区前,我还经常感觉自己是个外行。如果你像我一样——对技术充满热情,但不是工程和运维那方面——你仍然可以成为 DevOps 的一部分,即便你从事的是销售、营销、产品营销、技术写作、支持或其他工作。DevOps 是属于所有人的。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/how-non-engineer-got-devops + +作者:[Dawn Parych][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/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/resources/devops +[2]: https://www.devopsdays.org/ +[3]: https://itrevolution.com/the-three-ways-principles-underpinning-devops/ +[4]: https://en.wikipedia.org/wiki/Kaizen +[5]: https://en.wikipedia.org/wiki/Mindset#Fixed_and_growth +[6]: https://en.wikipedia.org/wiki/Kaikaku From d71dd1f80d916eb41ffb1b3372a120d441e1f534 Mon Sep 17 00:00:00 2001 From: amwps290 Date: Sun, 23 Dec 2018 22:49:09 +0800 Subject: [PATCH 0268/4278] Update 20181217 Take a swim at your Linux terminal with asciiquarium.md --- ...1217 Take a swim at your Linux terminal with asciiquarium.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md index d8253849ea..63741b5ccd 100644 --- a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md +++ b/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( amwps290) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6ad5b97e7aaf3f41b96c9c212519c2c26485451c Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Mon, 24 Dec 2018 00:33:34 +0800 Subject: [PATCH 0269/4278] translated over translated over --- ... with challenge-response authentication.md | 185 ------------------ ... with challenge-response authentication.md | 182 +++++++++++++++++ 2 files changed, 182 insertions(+), 185 deletions(-) delete mode 100644 sources/tech/20181022 Improve login security with challenge-response authentication.md create mode 100644 translated/tech/20181022 Improve login security with challenge-response authentication.md diff --git a/sources/tech/20181022 Improve login security with challenge-response authentication.md b/sources/tech/20181022 Improve login security with challenge-response authentication.md deleted file mode 100644 index ff5cdba354..0000000000 --- a/sources/tech/20181022 Improve login security with challenge-response authentication.md +++ /dev/null @@ -1,185 +0,0 @@ -translating by hopefully2333 - -Improve login security with challenge-response authentication -====== - -![](https://fedoramagazine.org/wp-content/uploads/2018/10/challenge-response-816x345.png) - -### Introduction - -Today, Fedora offers multiple ways to improve the secure authentication of our user accounts. Of course it has the familiar user name and password to login. It also offers additional authentication options such as biometric, fingerprint, smart card, one-time password, and even challenge-response authentication. - -Each authentication method has clear pros and cons. That, in itself, could be a topic for a rather lengthy article. Fedora Magazine has covered a few of these options previously: - - -+ [Using the YubiKey4 with Fedora][1] -+ [Fedora 28: Better smart card support in OpenSSH][2] - - -One of the most secure methods in modern Fedora releases is offline hardware challenge-response. It’s also one of the easiest to deploy. Here’s how. - -### Challenge-response authentication - -Technically, when you provide a password, you’re responding to a user name challenge. The offline challenge response covered here requires your user name first. Next, Fedora challenges you to provide an encrypted physical hardware token. The token responds to the challenge with another encrypted key it stores via the Pluggable Authentication Modules (PAM) framework. Finally, Fedora prompts you for the password. This prevents someone from just using a found hardware token, or just using a user name and password without the correct encrypted key. - -This means that in addition to your user name and password, you must have previously registered one or more encrypted hardware tokens with the OS. And you have to provide that physical hardware token to be able to authenticate with your user name. - -Some challenge-response methods, like one time passwords (OTP), take an encrypted code key on the hardware token, and pass that key across the network to a remote authentication server. The server then tells Fedora’s PAM framework if it’s is a valid token for that user name. This is great if the authentication server(s) are on the local network. The downside is if the network connection is down or you’re working remote without a network connection, you can’t use this remote authentication method. You could be locked out of the system until you can connect through the network to the server. - -Sometimes a workplace requires use of Yubikey One Time Passwords (OTP) configuration. However, on home or personal systems you may prefer a local challenge-response configuration. Everything is local, and the method requires no remote network calls. The following process works on Fedora 27, 28, and 29. - -### Preparation - -#### Hardware token keys - -First you need a secure hardware token key. Specifically, this process requires a Yubikey 4, Yubikey NEO, or a recently released Yubikey 5 series device which also supports FIDO2. You should purchase two of them to provide a backup in case one becomes lost or damaged. You can use these keys on numerous workstations. The simpler FIDO or FIDO U2F only versions don’t work for this process, but are great for online services that use FIDO. - -#### Backup, backup, and backup - -Next, make a backup of all your important data. You may want to test the configuration in a Fedora 27/28/29 cloned VM to make sure you understand the process before setting up your personal workstation. - -#### Updating and installing - -Now make sure Fedora is up to date. Then install the required Fedora Yubikey packages via these dnf commands: - -``` -$ sudo dnf upgrade -$ sudo dnf install ykclient* ykpers* pam_yubico* -$ cd -``` - -If you’re in a VM environment, such as Virtual Box, make sure the Yubikey device is inserted in a USB port, and enable USB access to the Yubikey in the VM control. - -### Configuring Yubikey - -Verify that your user account has access to the USB Yubikey: - -``` -$ ykinfo -v -version: 3.5.0 -``` - -If the YubiKey is not detected, the following error message appears: - -``` -Yubikey core error: no yubikey present -``` - -Next, initialize each of your new Yubikeys with the following ykpersonalize command. This sets up the Yubikey configuration slot 2 with a Challenge Response using the HMAC-SHA1 algorithm, even with less than 64 characters. If you have already setup your Yubikeys for challenge-response, you don’t need to run ykpersonalize again. - -``` -ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -oserial-api-visible -``` - -Some users leave the YubiKey in their workstation while using it, and even use challenge-response for virtual machines. However, for more security you may prefer to manually trigger the Yubikey to respond to challenge. - -To add that manual challenge button trigger, add the -ochal-btn-trig flag. This flag causes the Yubikey to flash the yubikey LED on a request. It waits for you to press the button on the hardware key area within 15 seconds to produce the response key. - -``` -$ ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -ochal-btn-trig -oserial-api-visible -``` - -Do this for each of your new hardware keys, only once per key. Once you have programmed your keys, store the Yubikey configuration to ~/.yubico with the following command: - -``` -$ ykpamcfg -2 -v -debug: util.c:222 (check_firmware_version): YubiKey Firmware version: 4.3.4 - -Sending 63 bytes HMAC challenge to slot 2 -Sending 63 bytes HMAC challenge to slot 2 -Stored initial challenge and expected response in '/home/chuckfinley/.yubico/challenge-9992567'. -``` - -If you are setting up multiple keys for backup purposes, configure all the keys the same, and store each key’s challenge-response using the ykpamcfg utility. If you run the command ykpersonalize on an existing registered key, you must store the configuration again. - -### Configuring /etc/pam.d/sudo - -Now to verify this configuration worked, **in the same terminal window** you’ll setup sudo to require the use of the Yubikey challenge-response. Insert the following line into the /etc/pam.d/sudo file: - -``` -auth required pam_yubico.so mode=challenge-response -``` - -Insert the above auth line into the file above the auth include system-auth line. Then save the file and exit the editor. In a default Fedora 29 setup, /etc/pam.d/sudo should now look like this: - -``` -#%PAM-1.0 -auth required pam_yubico.so mode=challenge-response -auth include system-auth -account include system-auth -password include system-auth -session optional pam_keyinit.so revoke -session required pam_limits.so -session include system-auth -``` - -**Keep this original terminal window open** , and test by opening another new terminal window. In the new terminal window type: - -``` -$ sudo echo testing -``` - -You should notice the LED blinking on the key. Tap the Yubikey button and you should see a prompt for your sudo password. After you enter your password, you should see “testing” echoed in the terminal screen. - -Now test to ensure a correct failure. Start another terminal window and remove the Yubikey from the USB port. Verify that sudo no longer works without the Yubikey with this command: - -``` -$ sudo echo testing fail -``` - -You should immediately be prompted for the sudo password. Even if you enter the password, it should fail. - -### Configuring Gnome Desktop Manager - -Once your testing is complete, now you can add challenge-response support for the graphical login. Re-insert your Yubikey into the USB port. Next you’ll add the following line to the /etc/pam.d/gdm-password file: - -``` -auth required pam_yubico.so mode=challenge-response -``` - -Open a terminal window, and issue the following command. You can use another editor if desired: - -``` -$ sudo vi /etc/pam.d/gdm-password -``` - -You should see the yubikey LED blinking. Press the yubikey button, then enter the password at the prompt. - -Modify the /etc/pam.d/gdm-password file to add the new auth line above the existing line auth substack password-auth. The top of the file should now look like this: - -``` -auth [success=done ignore=ignore default=bad] pam_selinux_permit.so -auth required pam_yubico.so mode=challenge-response -auth substack password-auth -auth optional pam_gnome_keyring.so -auth include postlogin - -account required pam_nologin.so -``` - -Save the changes and exit the editor. If you use vi, the key sequence is to hit the **Esc** key, then type wq! at the prompt to save and exit. - -### Conclusion - -Now log out of GNOME. With the Yubikey inserted into the USB port, click on your user name in the graphical login. The Yubikey LED begins to flash. Touch the button, and you will be prompted for your password. - -If you lose the Yubikey, you can still use the secondary backup Yubikey in addition to your set password. You can also add additional Yubikey configurations to your user account. - -If someone gains access to your password, they still can’t login without your physical hardware Yubikey. Congratulations! You’ve now dramatically increased the security of your workstation login. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/login-challenge-response-authentication/ - -作者:[nabooengineer][a] -选题:[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/nabooengineer/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/using-the-yubikey4-with-fedora/ -[2]: https://fedoramagazine.org/fedora-28-better-smart-card-support-openssh/ - diff --git a/translated/tech/20181022 Improve login security with challenge-response authentication.md b/translated/tech/20181022 Improve login security with challenge-response authentication.md new file mode 100644 index 0000000000..1d227c2839 --- /dev/null +++ b/translated/tech/20181022 Improve login security with challenge-response authentication.md @@ -0,0 +1,182 @@ +通过询问-响应身份认证提高登陆安全 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/10/challenge-response-816x345.png) + +### 介绍 + +今天,Fedora 提供了多种方式来提高我们账户的身份认证的安全性。当然,它有我们熟悉的用户名密码登陆,它也同样提供了其他的身份认证选项,比如生物识别、指纹、智能卡、一次性密码,甚至是询问-响应身份认证。 + +每种认证方式都有明确的优缺点。这点本身就可以成为一篇相当冗长的文章的主题。Fedora 杂志之前就已经介绍过了这其中的一些选项: + + ++ [Using the YubiKey4 with Fedora][1] ++ [Fedora 28: Better smart card support in OpenSSH][2] + + +在现在的 Fedora 版本中,最安全的方法之一就是离线硬件询问-响应。它也同样是最容易部署的方法之一。下面是具体方法: + +### 询问-响应认证 + +从技术上来讲,当你输入密码的时候,你就正在响应用户名询问。离线的询问、响应包含了这些部分:首先是需要你的用户名,接下来,Fedora 会要你提供一个加密的物理硬件的令牌。令牌会将另一个通过可插入式身份认证模块(PAM)框架进行存储的加密密钥来响应询问。最后,Fedora 才会提示你输入密码。这可以防止其他人仅仅使用了找到的硬件令牌,或是只使用了账户名密码而没有正确的加密密钥。 + +这意味着除了你的账户名密码之外,你必须事先在你的操作系统中注册了一个或多个加密硬件令牌。你必须保证你的物理硬件令牌能够匹配你的用户名。 + +一些询问-响应的方法,比如一次性密码(OTP),在硬件令牌上获取加密代码密钥,然后将这个密钥通过网络传输到远程身份认证服务器。然后这个服务器会告诉 Fedora 的 PAM 框架,这是否是该用户的一个有效令牌。如果身份认证服务器在本地网络上,这个方法非常好。但它的缺点是如果网络连接断开或是你在没有网的远程端工作。你会被锁在系统之外,直到你能通过网络连接到身份认证服务器。 + +有时候,生产环境会需要通过 Yubikey 使用一次性密码(OTP)设置,然而,在家庭或个人的系统上,你可能更喜欢询问-响应设置。一切都是本地的,这种方法不需要通过远程网络呼叫。下面这些过程适用于 Fedora 27、28和29. + +### 准备 + +#### 硬件令牌密钥 + +首先,你需要一个安全的硬件令牌密钥。具体来说,这个过程需要一个 Yubikey 4,Yubikey NEO,或者是最近发布的、同样支持 FIDO2 的 Yubikey 5 系列设备。你应该购买它们中的两个来有一个备份,以避免其中一个丢失或遭到损坏。你可以在不同的工作地点使用这些密钥。较为简单的 FIDO 和 FIDO U2F 版本不适用与这个过程,但是非常适合使用 FIDO 的在线服务。 + +#### 备份、备份,以及备份 + +接下来,为你所有的重要数据制作备份,你可能想在克隆在 VM 里的 Fedora 27/28/29 里测试配置,来确保你在设置你自己的个人工作环境之前理解这个过程。 + +#### 升级,然后安装 + +现在,确定你的 Fedora 是最新的,然后通过 dnf 命令安装所需要的 Fedora Yubikey 包。 + +``` +$ sudo dnf upgrade +$ sudo dnf install ykclient* ykpers* pam_yubico* +$ cd +``` + +如果你使用的是 VM 环境,例如 Virtual Box,确保 Yubikey 设备已经插进了 USB 口,然后允许 VM 控制的 USB 访问 Yubikey。 + +### 配置 Yubikey + +通过 USB Yubikey 验证你的账户: + +``` +$ ykinfo -v +version: 3.5.0 +``` + +如果 Yubikey 没有被检测到,会出现下面这些错误信息: + +``` +Yubikey core error: no yubikey present +``` + +接下来,通过下面这些 ykpersonalize 命令初始化你每个新的 Yubikeys。使用 HMAC-SHA1 算法进行询问响应,以此来设置 Yubikey 配置插槽 2。即使少于 64 个字符,如果你已经为询问响应设置好了你的 Yubikey。你就不需要再运行 ykpersonalize 了。 + +``` +ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -oserial-api-visible +``` + +一些用户在使用的时候将 YubiKey 留在了工作环境里,甚至对虚拟机使用了询问响应。然而,为了更好的安全性,你可能会更愿意使用手动触发 YubiKey 来响应询问。 + +要添加手动询问按钮触发器,请添加 -ochal-btn-trig 标记,这个标记可以在请求中使得 Yubikey 闪烁 Yubikey LED。等待你在 15 秒内按下硬件密钥区域上的按钮来生成响应密钥。 + +``` +$ ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -ochal-btn-trig -oserial-api-visible +``` + +为你的每个新的硬件密钥执行此操作。每个密钥执行以此,使用下面的命令将 Yubikey 配置存储到 ~/.yubico: + +``` +$ ykpamcfg -2 -v +debug: util.c:222 (check_firmware_version): YubiKey Firmware version: 4.3.4 + +Sending 63 bytes HMAC challenge to slot 2 +Sending 63 bytes HMAC challenge to slot 2 +Stored initial challenge and expected response in '/home/chuckfinley/.yubico/challenge-9992567'. +``` + +如果你要设置多个密钥用于备份。请将所有的密钥设置为相同,然后使用 ykpamcfg utility 存储每个密钥的询问-响应。如果你在一个已经存在的注册密钥上运行 ykpersonalize 命令,你就必须再次存储配置信息。 + +### 配置 /etc/pam.d/sudo + +现在要去验证配置是否有效,在相同的终端窗口中,你需要设置 sudo 来要求使用 Yubikey 的询问-响应。将下面这几行插入到 /etc/pam.d/sudo 文件中。 + +``` +auth required pam_yubico.so mode=challenge-response +``` + +将上面的 auth 行插入到 auth 文件中的 system-auth 行的上面,然后保存并退出编辑器。在默认的 Fedora 29 设置中,/etc/pam.d/sudo 应该像下面这样: + +``` +#%PAM-1.0 +auth required pam_yubico.so mode=challenge-response +auth include system-auth +account include system-auth +password include system-auth +session optional pam_keyinit.so revoke +session required pam_limits.so +session include system-auth +``` + +保持原始终端窗口打开,然后打开一个新的终端窗口进行测试,在新的终端窗口中输入: + +``` +$ sudo echo testing +``` + +你应该注意到了 key 上的 LED 在闪烁。点击 Yubikey 按钮,你应该会看见一个输入 sudo 密码的提示。在你输入你的密码之后,你应该会在终端屏幕上看见 ”testing“ 的字样。 + +现在去测试确保正常的失败,启动另一个终端窗口,并从 USB 插口中拔掉 Yubikey。使用下面这条命令验证,在没有 Yubikey 的情况下,sudo 是否会不再正常工作。 + +``` +$ sudo echo testing fail +``` +你应该立刻被提示输入 sudo 密码,即使你输入了正确密码,登陆也应该失败。 + +### 设置 Gnome 桌面管理 + +一旦你的测试完成后,你就可以为图形登陆添加询问-响应支持了。将你的 Yubikey 再次插入进 USB 插口中。然后将下面这几行添加到 /etc/pam.d/gdm-password 文件中: + +``` +auth required pam_yubico.so mode=challenge-response +``` + +打开一个终端窗口,然后运行下面这些命令。如果需要,你可以使用其他的编辑器: + +``` +$ sudo vi /etc/pam.d/gdm-password +``` + +你应该看到 yubikey 上的 LED 在闪烁,按下 yubikey 按钮,然后在提示符出输入密码。 + +修改 /etc/pam.d/gdm-password 文件,在已有的 password-auth 上添加新的 auth 行。这个文件的顶部应该像下面这样: + +``` +auth [success=done ignore=ignore default=bad] pam_selinux_permit.so +auth required pam_yubico.so mode=challenge-response +auth substack password-auth +auth optional pam_gnome_keyring.so +auth include postlogin + +account required pam_nologin.so +``` + +保存更改并退出编辑器,如果你使用的是 vi,输入键是按 Esc 键,然后在提示符出输入 wq! 来保存并退出。 + +### 结论 + +现在注销 GNOME。将 Yubikey 插入到 USB 口,在图形登陆界面上点击你的用户名。Yubikey LED 会开始闪烁。触摸那个按钮,你会被提示输入你的密码。 + +如果你丢失了 Yubikey,除了重置密码之外,你还可以使用备份的 Yubikey。你还可以给你的账户增加额外的 Yubikey 配置。 + +如果有其他人获得了你的密码,他们在没有你的物理硬件 Yubikey 的情况下,仍然不能登陆。恭喜!你已经显著提高了你的工作环境登陆的安全性了。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/login-challenge-response-authentication/ + +作者:[nabooengineer][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://fedoramagazine.org/author/nabooengineer/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/using-the-yubikey4-with-fedora/ +[2]: https://fedoramagazine.org/fedora-28-better-smart-card-support-openssh/ + From 0ee2f3d8cd5f8c5ca38a63afebb5a36ab705e880 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 24 Dec 2018 08:53:01 +0800 Subject: [PATCH 0270/4278] translated --- ...Locally As Virtual File System In Linux.md | 135 ----------------- ...Locally As Virtual File System In Linux.md | 136 ++++++++++++++++++ 2 files changed, 136 insertions(+), 135 deletions(-) delete mode 100644 sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md create mode 100644 translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md diff --git a/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md deleted file mode 100644 index ae559de4c6..0000000000 --- a/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md +++ /dev/null @@ -1,135 +0,0 @@ -translating---geekpi - -Dbxfs – Mount Dropbox Folder Locally As Virtual File System In Linux -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/dbxfs-720x340.png) - -A while ago, we summarized all the possible ways to **[mount Google drive locally][1]** as a virtual file system and access the files stored in the google drive from your Linux operating system. Today, we are going to learn to mount Dropbox folder in your local file system using **dbxfs** utility. The dbxfs is used to mount your Dropbox folder locally as a virtual filesystem in Unix-like operating systems. While it is easy to [**install Dropbox client**][2] in Linux, this approach slightly differs from the official method. It is a command line dropbox client and requires no disk space for access. The dbxfs application is free, open source and written for Python 3.5+. - -### Installing dbxfs - -The dbxfs officially supports Linux and Mac OS. However, it should work on any POSIX system that provides a **FUSE-compatible library** or has the ability to mount **SMB** shares. Since it is written for Python 3.5, it can installed using **pip3** package manager. Refer the following guide if you haven’t installed PIP yet. - -And, install FUSE library as well. - -On Debian-based systems, run the following command to install FUSE: - -``` -$ sudo apt install libfuse2 - -``` - -On Fedora: - -``` -$ sudo dnf install fuse - -``` - -Once you installed all required dependencies, run the following command to install dbxfs utility: - -``` -$ pip3 install dbxfs - -``` - -### Mount Dropbox folder locally - -Create a mount point to mount your dropbox folder in your local file system. - -``` -$ mkdir ~/mydropbox - -``` - -Then, mount the dropbox folder locally using dbxfs utility as shown below: - -``` -$ dbxfs ~/mydropbox - -``` - -You will be asked to generate an access token: - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-1.png) - -To generate an access token, just navigate to the URL given in the above output from your web browser and click **Allow** to authenticate Dropbox access. You need to log in to your dropbox account to complete authorization process. - -A new authorization code will be generated in the next screen. Copy the code and head back to your Terminal and paste it into cli-dbxfs prompt to finish the process. - -You will be then asked to save the credentials for future access. Type **Y** or **N** whether you want to save or decline. And then, you need to enter a passphrase twice for the new access token. - -Finally, click **Y** to accept **“/home/username/mydropbox”** as the default mount point. If you want to set different path, type **N** and enter the location of your choice. - -[![Generate access token 2][3]][4] - -All done! From now on, you can see your Dropbox folder is locally mounted in your filesystem. - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/Dropbox-in-file-manager.png) - -### Change Access Token Storage Path - -By default, the dbxfs application will store your Dropbox access token in the system keyring or an encrypted file. However, you might want to store it in a **gpg** encrypted file or something else. If so, get an access token by creating a personal app on the [Dropbox developers app console][5]. - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/access-token.png) - -Once the app is created, click **Generate** button in the next button. This access token can be used to access your Dropbox account via the API. Don’t share your access token with anyone. - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/Create-a-new-app.png) - -Once you created an access token, encrypt it using any encryption tools of your choice, such as [**Cryptomater**][6], [**Cryptkeeper**][7], [**CryptGo**][8], [**Cryptr**][9], [**Tomb**][10], [**Toplip**][11] and [**GnuPG**][12] etc., and store it in your preferred location. - -Next edit the dbxfs configuration file and add the following line in it: - -``` -"access_token_command": ["gpg", "--decrypt", "/path/to/access/token/file.gpg"] - -``` - -You can find the dbxfs configuration file by running the following command: - -``` -$ dbxfs --print-default-config-file - -``` - -For more details, refer dbxfs help section: - -``` -$ dbxfs -h - -``` - -As you can see, mounting Dropfox folder locally in your file system using Dbxfs utility is no big deal. As far tested, dbxfs just works fine as expected. Give it a try if you’re interested to see how it works and let us know about your experience in the comment section below. - -And, that’s all for now. Hope this was useful. More good stuff to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-file-system-in-linux/ - -作者:[SK][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://www.ostechnix.com/author/sk/ -[1]: https://www.ostechnix.com/how-to-mount-google-drive-locally-as-virtual-file-system-in-linux/ -[2]: https://www.ostechnix.com/install-dropbox-in-ubuntu-18-04-lts-desktop/ -[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[4]: http://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-2.png -[5]: https://dropbox.com/developers/apps -[6]: https://www.ostechnix.com/cryptomator-open-source-client-side-encryption-tool-cloud/ -[7]: https://www.ostechnix.com/how-to-encrypt-your-personal-foldersdirectories-in-linux-mint-ubuntu-distros/ -[8]: https://www.ostechnix.com/cryptogo-easy-way-encrypt-password-protect-files/ -[9]: https://www.ostechnix.com/cryptr-simple-cli-utility-encrypt-decrypt-files/ -[10]: https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/ -[11]: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ -[12]: https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/ diff --git a/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md new file mode 100644 index 0000000000..889fb00ac8 --- /dev/null +++ b/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @@ -0,0 +1,136 @@ +Dbxfs - 在 Linux 中本地挂载 Dropbox 文件夹作为虚拟文件系统 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/dbxfs-720x340.png) + +不久前,我们总结了所有**[在本地挂载 Google Drive][1]**作为虚拟文件系统,并从 Linux 系统访问存储在 Google Drive 中的文件的方法。今天,我们将学习使用 **dbxfs**将 Dropbox 文件夹挂载到本地文件系统中。dbxfs 用于在类 Unix 操作系统中本地挂载 Dropbox 文件夹作为虚拟文件系统。虽然在 Linux 中很容易[**安装 Dropbox 客户端**][2],但这种方法与官方方法略有不同。它是一个命令行 dropbox 客户端,且无需磁盘空间即可访问。dbxfs 是免费、开源的,并且是用 Python 3.5+ 编写的。 + +### 安装 dbxfs + +dbxfs 官方支持 Linux 和 Mac OS。但是,它应该适用于任何提供 **FUSE 兼容库**或能够挂载 **SMB** 共享的 POSIX 系统。由于它是用 Python 3.5 编写的,因此可以使用 **pip3** 包管理器进行安装。如果尚未安装 PIP,请参阅以下指南。 + +[如何使用 pip 管理 Python 包][13] + +并且也要安装 FUSE 库。 + +在基于 Debian 的系统上,运行以下命令以安装 FUSE: + +``` +$ sudo apt install libfuse2 + +``` + +在 Fedora 上: + +``` +$ sudo dnf install fuse + +``` + +安装完所有必需的依赖项后,运行以下命令以安装 dbxfs: + +``` +$ pip3 install dbxfs + +``` + +### 在本地挂载 Dropbox 文件夹 + +创建一个挂载点以将 Dropbox 文件夹挂载到本地文件系统中。 + +``` +$ mkdir ~/mydropbox + +``` + +然后,使用 dbxfs 在本地挂载 dropbox 文件夹,如下所示: + +``` +$ dbxfs ~/mydropbox + +``` + +你将被要求生成一个访问令牌: + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-1.png) + +要生成访问令牌,只需在 Web 浏览器中输入上面输出的 URL,然后单击**允许** 以授权 Dropbox 访问。你需要登录 Dropbox 帐户才能完成授权过程。 + +下一个页面将生成新的授权码。复制代码并返回终端将其粘贴到 cli-dbxfs 提示符中以完成该过程。 + +然后,系统会要求你保存凭据以供将来访问。无论你是要保存还是拒绝,输入 **Y** 或 **N**。然后,你需要为新的访问令牌输入两次密码。 + +最后,输入 **Y** 接受 **“/home/username/mydropbox”** 作为默认挂载点。如果你要设置不同的路径,输入 **N** 并输入你选择的位置。 + +[![Generate access token 2][3]][4] + +完成了!从现在开始,你可以看到你的 Dropbox 文件夹已挂载到本地文件系统中。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/Dropbox-in-file-manager.png) + +### 更改访问令牌存储路径 + +默认情况下,dbxfs 会将 Dropbox 访问令牌存储在系统密钥环或加密文件中。但是,你可能希望将其存储在 **gpg** 加密文件或其他地方。如果是这样,请在 [Dropbox 开发者应用控制台][5]上创建个人应用来获取访问令牌。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/access-token.png) + +创建应用后,单击下一步中的**生成**按钮。此令牌可用于通过 API 访问你的 Dropbox 帐户。不要与任何人共享你的访问令牌。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/Create-a-new-app.png) + +创建访问令牌后,使用任何你选择的加密工具对其进行加密,例如 [**Cryptomater**][6]、[**Cryptkeeper**][7]、[**CryptGo**][8]、[**Cryptr**][9]、[**Tomb**][10]、[**Toplip**][11] 和 [**GnuPG**][12] 等,并在你喜欢的位置保存。 + +接下来编辑 dbxfs 配置文件并添加以下行: + +``` +"access_token_command": ["gpg", "--decrypt", "/path/to/access/token/file.gpg"] + +``` + +你可以通过运行以下命令找到 dbxfs 配置文件: + +``` +$ dbxfs --print-default-config-file + +``` + +有关更多详细信息,请参阅 dbxfs 帮助: + +``` +$ dbxfs -h + +``` + +如你所见,使用 dbxfs 在你的文件系统中本地挂载 Dropfox 文件夹没什么大不了的。经过测试,dbxfs 如常工作。如果你有兴趣了解它是如何工作的,请尝试一下,并在下面的评论栏告诉我们你的体验。 + +就是这些了。希望这篇文章有用。还有更多好东西。敬请期待! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-file-system-in-linux/ + +作者:[SK][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://www.ostechnix.com/author/sk/ +[1]: https://www.ostechnix.com/how-to-mount-google-drive-locally-as-virtual-file-system-in-linux/ +[2]: https://www.ostechnix.com/install-dropbox-in-ubuntu-18-04-lts-desktop/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: http://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-2.png +[5]: https://dropbox.com/developers/apps +[6]: https://www.ostechnix.com/cryptomator-open-source-client-side-encryption-tool-cloud/ +[7]: https://www.ostechnix.com/how-to-encrypt-your-personal-foldersdirectories-in-linux-mint-ubuntu-distros/ +[8]: https://www.ostechnix.com/cryptogo-easy-way-encrypt-password-protect-files/ +[9]: https://www.ostechnix.com/cryptr-simple-cli-utility-encrypt-decrypt-files/ +[10]: https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/ +[11]: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ +[12]: https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/ +[13]:https://www.ostechnix.com/manage-python-packages-using-pip/ \ No newline at end of file From 9028d7c70ec81862b3df219fa8cf66ac8ea58c17 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 24 Dec 2018 09:03:09 +0800 Subject: [PATCH 0271/4278] translated --- ...0181214 How To Install Rust Programming Language In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181214 How To Install Rust Programming Language In Linux.md b/sources/tech/20181214 How To Install Rust Programming Language In Linux.md index 074c41e9f9..c39e037d6d 100644 --- a/sources/tech/20181214 How To Install Rust Programming Language In Linux.md +++ b/sources/tech/20181214 How To Install Rust Programming Language In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 62c118328fbf2b163c1253624448c165e4cd47c8 Mon Sep 17 00:00:00 2001 From: zjon Date: Mon, 24 Dec 2018 09:54:35 +0800 Subject: [PATCH 0272/4278] Delete 20171012 7 Best eBook Readers for Linux.md delete 20171012 7 Best eBook Readers for Linux.md from sources dir --- ...20171012 7 Best eBook Readers for Linux.md | 182 ------------------ 1 file changed, 182 deletions(-) delete mode 100644 sources/tech/20171012 7 Best eBook Readers for Linux.md diff --git a/sources/tech/20171012 7 Best eBook Readers for Linux.md b/sources/tech/20171012 7 Best eBook Readers for Linux.md deleted file mode 100644 index 520c9c4533..0000000000 --- a/sources/tech/20171012 7 Best eBook Readers for Linux.md +++ /dev/null @@ -1,182 +0,0 @@ -7 个最佳 Linux 电子书阅读器 -====== -**摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 - -![最佳 Linux 电子书阅读器][1] - -最近,随着人们发现在手持设备,Kindle 或者 PC 上阅读更佳舒适,对电子图书的需求有所增加。谈到 Linux 用户,有各种电子书应用满足你阅读和整理电子书的需求。 - -在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf,epubs 和其他电子书格式。 - -## 最佳 Linux 电子书阅读器 - -我提供 Ubuntu 安装说明,因为我现在使用。如果你使用[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 - -### 1. Calibre - -[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建私人电子][4] - -通过强大的电子书管理和易用的接口,它具有创建和编辑电子书。Calibre 支持多种格式和与其他电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 - -Calibre 最大的缺点是,资源上太沉重,让它成为一个艰难的选择作为一个独立的电子阅读器。 - -![Calibre][5] - -#### 特性 - - * 管理电子书:Calibre 通过管理云数据允许存储和分组电子书。你能下载一本电子书的元数据从各种来源或创建和编辑现有的字段。 - * 支持所有主流电子书格式: Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 - * 文件转换: 在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 - * 从 web 下载杂志期刊:Calibre 能从各种新闻源或者通过 RSS 订阅源传递故事。 - * 分享和备份你的电子图书馆:它提供了一个选项,托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性允许你保证你的收藏安全和方便携带。 - -#### 安装 - -你能在主流 Linux 发行版的软件库中找到它。对于 Ubuntu,在软件中心搜索它或者使用下面的命令: - -`sudo apt-get install calibre` - -### 2. FBReader - -![FBReader: Linux 电子书阅读器][6] - -[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub,fb2,mobi,rtf,html 等。它包含一些允许访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 - -#### 特性 - - * 支持多种文件格式和设备比如 Android,iOS,Windows,Mac 和更多。 - * 同步书籍收藏,阅读位置和书签。 - * 在线管理你图书馆中从你的 Linux 桌面添加到所有设备的任何书。 - * 支持 Web 浏览器允许你的存储集。 - * 支持 Google Drive 做书籍的存储和通过作者,系列或其他属性整理书籍。 - -#### 安装 - -你能从官方库或者在终端中输入一下命令安装 FBReader 电子阅读器。 -``` -sudo apt-get install fbreader -``` - -或者你能从[这里][8]抓取一个以 .deb 包并在你的基于 Debian 发行版的系统上安装它。 - -### 3. Okular - -[Okular][9] 是另一个开源的基于 KDE 开发的跨平台文档查看器,它已经作为 KDE 应用发布的一部分了。 - -![Okular][10] - -#### 特性 - - * Okular 支持多种文档格式像 PDF,Postscript,DjVu,DHM,XPS,ePub 和其他。 - * 支持在 PDF 文档中评论,高亮和绘制不通的形状等。 - * 无需修改原始 PDF 文件分别保存这些更改。 - * 电子书中的文本能被提取到一个文本文件,这个内置文本阅读服务叫 Jovie。 - -备注:检查应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 - -#### 安装 - -Ubuntu 用户可以在终端中键入下面的命令来安装它: -``` -sudo apt-get install okular -``` - -### 4. Lucidor - -Lucidor 是一个易用的支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有电子书集合在本地书柜里,搜索和下载互联网和 web 订阅和网页转换成电子书的功能。 - -Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项卡式布局,和存储数据和配置时的展现。他是列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 - -![lucidor][11] - -你可以通过选择单词并右击 > 查找单词来查找 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 - -你能从[这里][12]下载和安装 deb 或者 RPM 包。 - -### 5. Bookworm - -![Bookworm Linux 电子阅读器][13] - -Bookworm 是另一个支持多种文件格式诸如 epub, pdf, mobi, cbr and cbz 的免费开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读: [Bookworm: 一个简单而强大的 Linux 电子阅读器][14] - -#### 安装 -``` -sudo apt-add-repository ppa:bookworm-team/bookworm -sudo apt-get update -sudo apt-get install bookworm -``` - -### 6. Easy Ebook Viewer - -[Easy Ebook Viewer][15] 是另外一个用于读取 ePub 文件的很棒的 GTK python 应用.具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. - -![Easy-Ebook-Viewer][16] - -这个应用仍然处于初始阶段,只支持ePub文件。 - -#### 安装 - -你可以从 [github][17] 下载源代码和自己编译以及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 -``` -sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi -git clone https://github.com/michaldaniel/Ebook-Viewer.git -cd Ebook-Viewer/ -sudo make install -``` - -成功完成上述步骤后,你可以从Dash启动它。 - -### 7. Buka - -Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 pdf 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看 2 页。 - -你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 - -![Buka][19] - -#### 安装 - -你能从[官方下载页面][20]下载一个 AppImage。如果你不知道,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: -``` -sudo snap install buka -``` - -### 结束语 - -就我个人而言,我发现 Calibre 最适合我的需要。当然,Bookworm 看起来很有前途,这几天我经常使用它。不过,电子书应用的选择完全取决于你的喜好。 - -你使用哪个电子书应用呢?在下面的评论中让我们知道。 - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-ebook-readers-linux/ - -作者:[Ambarish Kumar][a] -译者:[zjon](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://itsfoss.com/author/ambarish/ -[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png -[2]:https://itsfoss.com/non-ubuntu-beginner-linux/ -[3]:https://www.calibre-ebook.com -[4]:https://itsfoss.com/create-ebook-calibre-linux/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg -[7]:https://fbreader.org -[8]:https://fbreader.org/content/fbreader-beta-linux-desktop -[9]:https://okular.kde.org/ -[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png -[12]:http://lucidor.org/lucidor/download.php -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg -[14]:https://itsfoss.com/bookworm-ebook-reader-linux/ -[15]:https://github.com/michaldaniel/Ebook-Viewer -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg -[17]:https://github.com/michaldaniel/Ebook-Viewer.git -[18]:https://github.com/oguzhaninan/Buka -[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png -[20]:https://github.com/oguzhaninan/Buka/releases -[21]:https://itsfoss.com/use-appimage-linux/ From 30d258a85352887e90efd5e04f636340b46a4674 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 12:38:13 +0800 Subject: [PATCH 0273/4278] PRF:20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @qhwdw --- ...mputing with Open Source Cirq Framework.md | 83 +++++++++---------- 1 file changed, 40 insertions(+), 43 deletions(-) diff --git a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md index fcbc89e77c..c1be5d0ddf 100644 --- a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md +++ b/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @@ -1,24 +1,25 @@ 量子计算的开源框架 Cirq 介绍 ====== + 我们即将讨论的内容正如标题所示,本文通过使用 Cirq 的一个开源视角,尝试去了解我们已经在量子计算领域取得多大的成就,和该领域的发展方向,以加快科学和技术研究。 -首先,我们将引领你进入量子计算的世界。在我们深入了解 Cirq 在未来的量子计算中扮演什么样的重要角色之前,我们将尽量向你解释其背后的基本概念。Cirq,你最近可能听说过,在这个领域中已经发生了重大新闻,在 Open Science 上的文章中,我们将去尝试找出答案。 +首先,我们将引领你进入量子计算的世界。在我们深入了解 Cirq 在未来的量子计算中扮演什么样的重要角色之前,我们将尽量向你解释其背后的基本概念。你最近可能听说过,在这个领域中有件重大新闻,就是 Cirq。在这篇开放科学栏目的文章中,我们将去尝试找出答案。 - +- [How it Works - Quantum Computing](https://www.youtube.com/WVv5OAR4Nik) -在我们开始了解量子计算之前,必须先去了解“量子”这个术语,量子是已知的 [亚原子粒子][1] 中最小的物质。[量子][2] 这个词来自拉丁语 Quantus,意思是 “有多少”,在下面的短视频链接中有描述: +在我们开始了解量子计算之前,必须先去了解“量子”这个术语,量子是已知的 [亚原子粒子][1] 中最小的物质。[量子][2]Quantum 这个词来自拉丁语 Quantus,意思是 “有多小”,在下面的短视频链接中有描述: - +- [What is a quantum Why is it significant](https://www.youtube.com/-pUOxVsxu3o) -为了易于我们理解量子计算,我们将量子计算与经典计算Classical Computing(也有译做传统计算)进行比较。经典计算是指设计用于工作的、正在使用的计算机,正如你现在用于阅读本文的设备,就是我们所谓的经典计算设备。 +为了易于我们理解量子计算,我们将量子计算Quantum Computing经典计算Classical Computing(LCTT 译注:也有译做“传统计算”)进行比较。经典计算是指今天的传统计算机如何设计工作的,正如你现在用于阅读本文的设备,就是我们所谓的经典计算设备。 ### 经典计算 -经典计算是描述计算机如何工作的另一种方式。它们通过一个二进制系统工作,即信息使用 1 或 0 来存储。经典计算机不会理解除 1 或 0 之外的任何其它东西。 +经典计算只是描述计算机如何工作的另一种方式。它们通过一个二进制系统工作,即信息使用 1 或 0 来存储。经典计算机不会理解除 1 或 0 之外的任何其它东西。 -直白来说,在计算机内部一个晶体管只能是开(1)或关(0)。我们输入的任何信息都被转换为无数个 1 和 0,所以计算机只能理解和存储 1 和 0。所有的东西都只能用无数个 1 和 0 的组合来表示。 +直白来说,在计算机内部一个晶体管只能是开(1)或关(0)。我们输入的任何信息都被转换为无数个 1 和 0,以便计算机能理解和存储。所有的东西都只能用无数个 1 和 0 的组合来表示。 - +- [Why Do Computers Use 1s and 0s Binary and Transistors Explained](https://www.youtube.com/Xpk67YzOn5w) ### 量子计算 @@ -26,39 +27,39 @@ 请注意,叠加和纠缠 [不是同一个现象][4]。 - +- [How Do Quantum Computers Work!](https://www.youtube.com/jiXuVIEg10Q) ![][5] -就像在经典计算中,我们有比特bit,在量子计算中,我们相应也有量子比特qubits(或 Quantum bits)。想了解它们二者之间的巨大差异之处,请查看这个 [页面][6],从那里的图片中可以得到答案。 +就像在经典计算中,我们有比特bit,在量子计算中,我们相应也有量子比特qubit(即 Quantum bit)。想了解它们二者之间的巨大差异之处,请查看这个 [页面][6],从那里的图片中可以得到答案。 量子计算机并不是来替代我们的经典计算机的。但是,有一些非常巨大的任务用我们的经典计算机是无法完成的,而那些正是量子计算机大显身手的好机会。下面链接的视频详细描述了上述情况,同时也描述了量子计算机的原理。 - +- [Quantum Computers Explained – Limits of Human Technology](https://www.youtube.com/JhHMJCUmq28) 下面的视频全面描述了量子计算领域到目前为止的最新进展: - +- [Quantum Computing 2018 Update](https://www.youtube.com/CeuIop_j2bI) ### 嘈杂中型量子 -根据最新更新的(2018 年 7 月 31 日)研究论文,术语 “Noisy” 是指由于对量子比特未能完全控制所产生的不准确性。正是这种不准确性严重制约了量子设备短期内实现其目标。 +根据最新更新的(2018 年 7 月 31 日)研究论文,术语 “嘈杂Noisy” 是指由于对量子比特未能完全控制所产生的不准确性。正是这种不准确性在短期内严重制约了量子设备实现其目标。 -“中型” 指的是在接下来的几年中,量子计算机将要实现的量子规模大小,届时,量子比特的数目将可能从 50 到几百个不等。50 个量子比特是一个重大的量程碑,因为它将超越现有的最强大的 [超级计算机][8] 的 [暴力][7] 模拟能力。更多信息请阅读 [这里的][9] 论文。 +“中型” 指的是在接下来的几年中,量子计算机将要实现的量子规模大小,届时,量子比特的数目将可能从 50 到几百个不等。50 个量子比特是一个重大的量程碑,因为它将超越现有的最强大的 [超级计算机][8] 的 [暴力破解][7] 所能比拟的计算能力。更多信息请阅读 [这里的][9] 论文。 随着 Cirq 出现,许多事情将会发生变化。 ### Cirq 是什么? -Cirq 是一个 python 框架,它用于创建、编辑和调用我们前面讨论的嘈杂中型量子(NISQ)。换句话说,Cirq 能够解决挑战,去改善精确度和降低量子计算中的噪声。 +Cirq 是一个 Python 框架,它用于创建、编辑和调用我们前面讨论的嘈杂中型量子(NISQ)。换句话说,Cirq 能够解决挑战,去改善精确度和降低量子计算中的噪声。 Cirq 并不需要必须有一台真实的量子计算机。Cirq 能够使用一个类似模拟器的界面去执行量子电路模拟。 -Cirq 的前进步伐越来越快了,[Zapata][10] 是使用它的首批用户之一,Zapata 是由来自哈佛大学的一群专注于量子计算的科学家在去年成立的。 +Cirq 的前进步伐越来越快了,[Zapata][10] 是使用它的首批用户之一,Zapata 是由来自哈佛大学的专注于量子计算的[一群科学家][11]在去年成立的。 ### Linux 上使用 Cirq 入门 -开源的 [Cirq 库][12] 开发者建议将它安装在像 [virtualenv][14] 这样的一个 [虚拟 python 环境][13] 中。在 Linux 上的开发者安装指南可以在 [这里][15] 找到。 +开源的 [Cirq 库][12] 开发者建议将它安装在像 [virtualenv][14] 这样的一个 [虚拟 Python 环境][13] 中。在 Linux 上的开发者安装指南可以在 [这里][15] 找到。 但我们在 Ubuntu 16.04 的系统上成功地安装和测试了 Python3 的 Cirq 库,安装步骤如下: @@ -66,43 +67,41 @@ Cirq 的前进步伐越来越快了,[Zapata][10] 是使用它的首批用户 ![Cirq Framework for Quantum Computing in Linux][16] -首先,我们需要 pip 或 pip3 去安装 Cirq。[Pip][17] 是推荐用于安装和管理 Python 包的工具。 +首先,我们需要 `pip` 或 `pip3` 去安装 Cirq。[Pip][17] 是推荐用于安装和管理 Python 包的工具。 对于 Python 3.x 版本,Pip 能够用如下的命令来安装: + ``` sudo apt-get install python3-pip - ``` Python3 包能够通过如下的命令来安装: + ``` pip3 install - ``` 我们继续去使用 Pip3 为 Python3 安装 Cirq 库: + ``` pip3 install cirq - ``` #### 启用 Plot 和 PDF 生成(可选) -可选系统的依赖没有安装的,可以使用 pip 去安装它: +可选系统的依赖没有被 Pip 安装的,可以使用如下命令去安装它: + ``` sudo apt-get install python3-tk texlive-latex-base latexmk - ``` * python3-tk 是 Python 自有的启用了绘图功能的图形库 * texlive-latex-base 和 latexmk 启动了 PDF 输出功能。 - - 最后,我们使用如下的命令和代码成功测试了 Cirq: + ``` python3 -c 'import cirq; print(cirq.google.Foxtail)' - ``` 我们得到的输出如下图: @@ -113,27 +112,27 @@ python3 -c 'import cirq; print(cirq.google.Foxtail)' 我们也配置了一个 Python IDE [PyCharm][19] 去测试同样的结果: -因为在我们的 Linux 系统上为 Python3 安装了 Cirq,我们在 IDE 中配置项目解释器路径: +因为在我们的 Linux 系统上为 Python3 安装了 Cirq,我们在 IDE 中配置项目解释器路径为: + ``` /usr/bin/python3 - ``` ![][20] -在上面的输出中,你可能注意到我们刚设置的项目解释器路径与测试程序文件(test.py)的路径显示在一起。退出代码 0 表示程序已经成功退出,没有错误。 +在上面的输出中,你可能注意到我们刚设置的项目解释器路径与测试程序文件(`test.py`)的路径显示在一起。退出代码 0 表示程序已经成功退出,没有错误。 -因此,那是一个现成的 IDE 环境,你可以导入 Cirq 库去开始使用 Python 去编程和模拟量子电路。 +因此,那是一个已经就绪的 IDE 环境,你可以导入 Cirq 库去开始使用 Python 去编程和模拟量子电路。 #### Cirq 使用入门 Criq 入门的一个好的开端就是它 GitHub 页面上的 [示例][21]。 -Cirq 的开发者在 GitHub 上已经放了学习 [教程][22]。如果你想认真地学习量子计算,他们推荐你去看一本非常好的书,它是[由 Nielsen 和 Chuang 写的名为 “量子计算和量子信息“][23]。 +Cirq 的开发者在 GitHub 上已经放置了学习 [教程][22]。如果你想认真地学习量子计算,他们推荐你去看一本非常好的书,它是[由 Nielsen 和 Chuang 写的名为 《量子计算和量子信息》][23]。 #### OpenFermion-Cirq -[OpenFermion][24] 是一个开源库,它是为了在量子计算机上模拟获取和操纵代表的费米系统(包含量子化学)。根据 [粒子物理学][26] 理论,按照 [费米— 狄拉克统计][27],费米系统与 [费米子][25] 的产生相关。 +[OpenFermion][24] 是一个开源库,它是为了在量子计算机上模拟获取和操纵代表的费米系统(包含量子化学)。根据 [粒子物理学][26] 理论,按照 [费米—狄拉克统计][27],费米系统与 [费米子][25] 的产生相关。 OpenFermion 被称为从事 [量子化学][29] 的化学家和研究人员的 [一个极好的实践工具][28]。量子化学主要专注于 [量子力学][30] 在物理模型和化学系统实验中的应用。量子化学也被称为 [分子量子力学][31]。 @@ -141,7 +140,7 @@ Cirq 的出现使 OpenFermion 通过提供程序和工具去扩展功能成为 #### Google Bristlecone -2018 年 3 月 5 日,在洛杉矶举行的一年一度的 [美国物理学会会议][33] 上,Google 发布了 [Bristlecone][32],这是他们的最新的量子处理器。这个 [基于门的超导系统][34] 为 Google 提供了一个测试平台,用以研究 [量子比特技术][37] 的 [系统错误率][35] 和 [扩展性][36] ,以及在量子 [仿真][38]、[优化][39]、和 [机器学习][40] 方面的应用。 +2018 年 3 月 5 日,在洛杉矶举行的一年一度的 [美国物理学会会议][33] 上,Google 发布了 [Bristlecone][32],这是他们的最新的量子处理器。这个 [基于门的超导系统][34] 为 Google 提供了一个测试平台,用以研究 [量子比特技术][37] 的 [系统错误率][35] 和 [扩展性][36] ,以及在量子 [仿真][38]、[优化][39] 和 [机器学习][40] 方面的应用。 Google 希望在不久的将来,能够制造出它的 [云可访问][41] 的 72 个量子比特的 Bristlecone 量子处理器。Bristlecone 将越来越有能力完成一个经典超级计算机无法在合理时间内完成的任务。 @@ -154,11 +153,9 @@ Cirq 将允许我们去: * 在设备上放置适当的门 * 并调度这个门的时刻 +### 开放科学关于 Cirq 的观点 - -### Open Science 关于 Cirq 的观点 - -我们知道 Cirq 是在 GitHub 上开源的,它除了在 Open Science 社区之外,特别是那些专注于量子研究的人们,都可以高效率地合作,通过开发新方法,去降低现有量子模型中的错误率和提升精确度,以解决目前在量子计算中所面临的挑战。 +我们知道 Cirq 是在 GitHub 上开源的,在开源科学社区之外,特别是那些专注于量子研究的人们,都可以通过高效率地合作,通过开发新方法,去降低现有量子模型中的错误率和提升精确度,以解决目前在量子计算中所面临的挑战。 如果 Cirq 不走开源模型的路线,事情可能变得更具挑战。一个伟大的创举可能就此错过,我们可能在量子计算领域止步不前。 @@ -170,7 +167,7 @@ Cirq 将允许我们去: 最后,我们看了两个示例 OpenFermion 和 Bristlecone,介绍了在量子计算中,Cirq 在开发研究中具有什么样的基本优势。最后我们以 Open Science 社区的视角对 Cirq 进行了一些精彩的思考,结束了我们的话题。 -我们希望能以一种易于理解的方式向你介绍量子计算框架 Cirq 的使用。如果你有与此相关的任何反馈,请在下面的评论区告诉我们。感谢阅读,希望我们能在 Open Science 的下一篇文章中再见。 +我们希望能以一种易于理解的方式向你介绍量子计算框架 Cirq 的使用。如果你有与此相关的任何反馈,请在下面的评论区告诉我们。感谢阅读,希望我们能在开放科学栏目的下一篇文章中再见。 -------------------------------------------------------------------------------- @@ -179,7 +176,7 @@ via: https://itsfoss.com/qunatum-computing-cirq-framework/ 作者:[Avimanyu Bandyopadhyay][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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/) 荣誉推出 @@ -188,7 +185,7 @@ via: https://itsfoss.com/qunatum-computing-cirq-framework/ [2]:https://en.wikipedia.org/wiki/Quantum [3]:https://www.clerro.com/guide/491/quantum-superposition-and-entanglement-explained [4]:https://physics.stackexchange.com/questions/148131/can-quantum-entanglement-and-quantum-superposition-be-considered-the-same-phenom -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/bit-vs-qubit.jpg +[5]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/bit-vs-qubit.jpg?w=576&ssl=1 [6]:http://www.rfwireless-world.com/Terminology/Difference-between-Bit-and-Qubit.html [7]:https://en.wikipedia.org/wiki/Proof_by_exhaustion [8]:https://www.explainthatstuff.com/how-supercomputers-work.html @@ -199,11 +196,11 @@ via: https://itsfoss.com/qunatum-computing-cirq-framework/ [13]:https://itsfoss.com/python-setup-linux/ [14]:https://virtualenv.pypa.io [15]:https://cirq.readthedocs.io/en/latest/install.html#installing-on-linux -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-framework-linux.jpeg +[16]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/cirq-framework-linux.jpeg [17]:https://pypi.org/project/pip/ -[18]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-test-output.jpg +[18]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/cirq-test-output.jpg [19]:https://itsfoss.com/install-pycharm-ubuntu/ -[20]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-tested-on-pycharm.jpg +[20]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/cirq-tested-on-pycharm.jpg [21]:https://github.com/quantumlib/Cirq/tree/master/examples [22]:https://github.com/quantumlib/Cirq/blob/master/docs/tutorial.md [23]:http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf From 8708ba3fc8c0d68f354c3c589d9d1b83eb5517e1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 12:38:46 +0800 Subject: [PATCH 0274/4278] PUB:20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @qhwdw https://linux.cn/article-10376-1.html --- ...uction to Quantum Computing with Open Source Cirq Framework.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md (100%) diff --git a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/published/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md similarity index 100% rename from translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md rename to published/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md From 4f808d9693a13f8b54a964f4663290b2c768c62c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 12:54:29 +0800 Subject: [PATCH 0275/4278] PRF:20181212 Aliases- DIY Shell Commands.md @HankChow --- .../20181212 Aliases- DIY Shell Commands.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/tech/20181212 Aliases- DIY Shell Commands.md b/translated/tech/20181212 Aliases- DIY Shell Commands.md index d7d0c9d096..cbce2581af 100644 --- a/translated/tech/20181212 Aliases- DIY Shell Commands.md +++ b/translated/tech/20181212 Aliases- DIY Shell Commands.md @@ -1,9 +1,10 @@ 命令别名:定义自己的命令 ====== +> 学习如何创建别名:你可以将太长或难以记忆的命令打包成你自己构建的命令。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jodi-mucha-540841-unsplash.jpg?itok=n1d1VDUV) -命令别名Alias在 Linux shell 中指的是将一些太长或者太难记的多个命令组合起来,成为一个由用户自定义构建的命令。 +命令别名Alias在 Linux shell 中指的是将一些太长或者太难记的多个命令组合起来,成为一个由用户自己构建的命令。 可以通过 `alias` 命令来创建命令别名。在 `alias` 后面跟上想要创建的别名名称、一个等号(`=`),以及希望使用这个别名来执行的命令,这样一个命令别名就创建好了。举个例子,`ls` 命令在默认情况下是不会对输出的内容进行着色的,这样就不能让用户一眼分辨出目录、文件和连接了。对此,可以创建这样一个命令别名,在输出目录内容的时候为输出内容着色: @@ -11,7 +12,7 @@ alias lc='ls --color=auto' ``` -其中 `lc` 是自定义的命令别名,代表“list with color”的意思。在创建命令别名的时候,需要先确认使用的别名是不是已经有对应的命令了,如果有的话,原本的命令就会被覆盖掉了。注意,定义命令别名的时候,`=` 两端是没有空格的。当运行 `lc` 的时候,就相当于执行了 `ls --color` 命令。 +其中 `lc` 是自定义的命令别名,代表 “list with color” 的意思。在创建命令别名的时候,需要先确认使用的别名是不是已经有对应的命令了,如果有的话,原本的命令就会被覆盖掉了。注意,定义命令别名的时候,`=` 两端是没有空格的。当运行 `lc` 的时候,就相当于执行了 `ls --color` 命令。 此后,执行 `lc` 列出目录内容的时候,就会输出带有着色的内容了。 @@ -25,9 +26,7 @@ alias lc='ls --color=auto' * `alias cp='cp -i'`:`-i` 参数代表“交互interactive”。在使用 `cp` 命令复制文件的时候,可能会无意中覆盖现有的文件,在使用了 `-i` 参数之后,`cp` 命令会在一些关键操作前向用户发出询问。 * `alias free='free -m'`:在 `free` 命令后面加上 `-m` 参数,就可以将输出的内存信息以 MiB 这个更方面阅读和计算的单位输出,而不是默认的 Byte 单位。 - - -你使用的发行版自带的命令别名可能多多少少和上面有些差别。但你都可以在命令前面加上 `\` 修饰符来使用命令的最基本形式。例如: +你使用的发行版自带的命令别名可能多多少少和上面有些差别。但你都可以在命令前面加上 `\` 修饰符来使用命令的最基本形式(而不是别名)。例如: ``` \free @@ -41,7 +40,7 @@ alias lc='ls --color=auto' 执行的就是不带有`--color=auto` 参数的 `ls`。 -如果想要持久地保存命令别名,可以在 `.bashrc` 文件中进行修改。 +如果想要持久地保存命令别名,可以在 `.bashrc` 文件中进行修改,而它[来源于我们的 /etc/skel 目录][1]。 ### 使用命令别名纠正错误 @@ -62,7 +61,7 @@ alias move='mv' 也可以在尚未完全熟悉 Linux 的时候用得顺手。 -还有一种情况,就是在经常出现输入错误的场合中做出容错,例如 Administration 这个单词就很难快速正确地输入,因此很多用户都会设置 +还有一种情况,就是在经常出现输入错误的场合中做出容错,例如,对于我来说, Administration 这个单词就很难快速正确地输入,因此很多用户都会设置类似这样的别名: ``` alias sl='ls' @@ -74,7 +73,7 @@ alias sl='ls' alias gerp='echo "You did it *again*!"; grep' ``` - `grep` 命令最基本的用途就是在文件中查找字符串,在熟悉这个命令之后,它一定是最常用的命令之一,因此输入错误导致不得不重输命令就很令人抓狂。 +`grep` 命令最基本的用途就是在文件中查找字符串,在熟悉这个命令之后,它一定是最常用的命令之一,因此输入错误导致不得不重输命令就很令人抓狂。 在上面 `gerp` 的例子中,包含的不只是一条命令,而是两条。第一条命令 `echo "You did it *again*!"` 输出了一条提醒用户拼写错误的消息,然后使用分号(`;`)把两条命令隔开,再往后才是 `grep` 这一条正确的命令。 @@ -82,16 +81,16 @@ alias gerp='echo "You did it *again*!"; grep' ``` $ gerp -R alias /etc/skel/.bashrc -You did it *again*! - alias ls='ls --color=auto' - alias grep='grep --colour=auto' - alias egrep='egrep --colour=auto' - alias fgrep='fgrep --colour=auto' +You did it *again*! + alias ls='ls --color=auto' + alias grep='grep --colour=auto' + alias egrep='egrep --colour=auto' + alias fgrep='fgrep --colour=auto' alias cp="cp -i" alias df='df -h' alias free='free -m' -alias np='nano -w PKGBUILD' -alias more=less +alias np='nano -w PKGBUILD' +alias more=less shopt -s expand_aliases ``` @@ -112,12 +111,12 @@ via: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands 作者:[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/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts -[2]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise +[1]: https://linux.cn/article-10370-1.html +[2]: https://linux.cn/article-10374-1.html From cafad9ce13f9798efe68b08260e8eb40f4574de9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 12:54:52 +0800 Subject: [PATCH 0276/4278] PUB:20181212 Aliases- DIY Shell Commands.md @HankChow https://linux.cn/article-10377-1.html --- .../tech => published}/20181212 Aliases- DIY Shell Commands.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181212 Aliases- DIY Shell Commands.md (100%) diff --git a/translated/tech/20181212 Aliases- DIY Shell Commands.md b/published/20181212 Aliases- DIY Shell Commands.md similarity index 100% rename from translated/tech/20181212 Aliases- DIY Shell Commands.md rename to published/20181212 Aliases- DIY Shell Commands.md From 3882e486275897ba08622fb9c212fd6bd6508a4d Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 24 Dec 2018 13:33:18 +0800 Subject: [PATCH 0277/4278] Translating How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 00864bffa9..85d88129e7 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -77,45 +77,45 @@ apt list --upgradable ### 通过 GUI 更新 Ubuntu[适用于桌面用户] -If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. +如果你使用桌面版 Ubuntu,你并不需要为了更新系统而打开终端。你可以仍可以使用命令行更新,但这只是一个选择。 -In the menu, look for ‘Software Updater’ and run it. +在菜单力,找到 `Software Updater` 并运行它。 -![Run Software Updater in Ubuntu][8] +![在 Ubuntu 中运行 Software Updater][8] -It will check if there are updates available for your system. +它将检查你的系统是否有可用的更新。 -![Checking if updates are available for Ubuntu][9] +![检查 Ubuntu 是否有可用更新][9] -If there are updates available, it will give provide you with options to install the updates. +如果有可用的更新,它将给你提供安装更新的选择。 -![Install Updates via Update Manager in Ubuntu][10] +![在 Ubuntu 中通过更新管理器安装更新][10] -Click on Install Now, it may ask for your password. +现在,点击 `Install`,它可能会向你询问密码。 -![Installing Updates in Ubuntu Linux via GUI][11] +![通过 GUI 在 Ubuntu Linux 中安装更新][11] -Once you enter your password, it will start installing the updates. +一旦你输入你的密码,它将开始安装更新。 -![Updating Ubuntu via GUI][12] +![通过 GUI 更新 Ubuntu][12] -In some cases, you may need to reboot the system for the installed updates to work properly. You’ll be notified at the end of the update if you need to restart the system. +在某些情况下,你可能需要重启系统才能使已安装的更新正常工作。如果需要重启系统,你将在更新结束时收到通知。 -![Updating Ubuntu via GUI][12] +![通过 GUI 更新 Ubuntu][12] -You can choose to restart later if you don’t want to reboot your system straightaway. +如果你不希望马上重启你的系统,可以选择稍后重启。 -![Installing updates via GUI in Ubuntu][13] +![通过 GUI 在 Ubuntu 中安装更新][13] -Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. +提示:如果 `software updater` 返回一个错误,你需要在终端是使用命令 `sudo apt update`。输出的最后几行将包含真正的错误信息。你可以在因特网上搜索该错误并解决问题。 ### 更新 Ubuntu 时要记住几件事 -You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. +你刚学习了如何更新你的 Ubuntu 系统。如果你感兴趣,你还需要了解一些关于 Ubuntu 更新的内容。 #### 更新后清理 -Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: +你的系统将会有一些更新后不再需要的软件包。你可用使用这条命令删除这些软件包并[释放空间][14]: ``` sudo apt autoremove From 567491369fe42af7b7434d18e9d19a7d53573254 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 13:43:13 +0800 Subject: [PATCH 0278/4278] PRF:20181022 Improve login security with challenge-response authentication.md @hopefully2333 --- ... with challenge-response authentication.md | 68 +++++++++---------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/translated/tech/20181022 Improve login security with challenge-response authentication.md b/translated/tech/20181022 Improve login security with challenge-response authentication.md index 1d227c2839..7b360ab755 100644 --- a/translated/tech/20181022 Improve login security with challenge-response authentication.md +++ b/translated/tech/20181022 Improve login security with challenge-response authentication.md @@ -1,36 +1,34 @@ -通过询问-响应身份认证提高登陆安全 +通过询问-响应身份认证提高桌面登录安全 ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/10/challenge-response-816x345.png) ### 介绍 -今天,Fedora 提供了多种方式来提高我们账户的身份认证的安全性。当然,它有我们熟悉的用户名密码登陆,它也同样提供了其他的身份认证选项,比如生物识别、指纹、智能卡、一次性密码,甚至是询问-响应身份认证。 +今天,Fedora 提供了多种方式来提高我们账户的身份认证的安全性。当然,它有我们熟悉的用户名密码登录方式,它也同样提供了其他的身份认证选项,比如生物识别、指纹、智能卡、一次性密码,甚至是询问-响应challenge-response身份认证。 每种认证方式都有明确的优缺点。这点本身就可以成为一篇相当冗长的文章的主题。Fedora 杂志之前就已经介绍过了这其中的一些选项: +- [在 Fedora 中使用 YubiKey4][1] +- [Fedora 28:在 OpenSSH 中更好的支持智能卡][2] -+ [Using the YubiKey4 with Fedora][1] -+ [Fedora 28: Better smart card support in OpenSSH][2] - - -在现在的 Fedora 版本中,最安全的方法之一就是离线硬件询问-响应。它也同样是最容易部署的方法之一。下面是具体方法: +在现在的 Fedora 版本中,最安全的方法之一就是离线硬件询问-响应。它也同样是最容易部署的方法之一。下面是具体方法。 ### 询问-响应认证 -从技术上来讲,当你输入密码的时候,你就正在响应用户名询问。离线的询问、响应包含了这些部分:首先是需要你的用户名,接下来,Fedora 会要你提供一个加密的物理硬件的令牌。令牌会将另一个通过可插入式身份认证模块(PAM)框架进行存储的加密密钥来响应询问。最后,Fedora 才会提示你输入密码。这可以防止其他人仅仅使用了找到的硬件令牌,或是只使用了账户名密码而没有正确的加密密钥。 +从技术上来讲,当你输入密码的时候,你就正在响应用户名询问。离线的询问、响应包含了这些部分:首先是需要你的用户名,接下来,Fedora 会要你提供一个加密的物理硬件的令牌。令牌会把另一个其存储的加密密钥通过可插入式身份认证Pluggable Authentication Module模块(PAM)框架来响应询问。最后,Fedora 才会提示你输入密码。这可以防止其他人仅仅使用了找到的硬件令牌,或是只使用了账户名密码而没有正确的加密密钥。 这意味着除了你的账户名密码之外,你必须事先在你的操作系统中注册了一个或多个加密硬件令牌。你必须保证你的物理硬件令牌能够匹配你的用户名。 -一些询问-响应的方法,比如一次性密码(OTP),在硬件令牌上获取加密代码密钥,然后将这个密钥通过网络传输到远程身份认证服务器。然后这个服务器会告诉 Fedora 的 PAM 框架,这是否是该用户的一个有效令牌。如果身份认证服务器在本地网络上,这个方法非常好。但它的缺点是如果网络连接断开或是你在没有网的远程端工作。你会被锁在系统之外,直到你能通过网络连接到身份认证服务器。 +一些询问-响应的方法,比如一次性密码(OTP),在硬件令牌上获取加密的代码密钥,然后将这个密钥通过网络传输到远程身份认证服务器。然后这个服务器会告诉 Fedora 的 PAM 框架,这是否是该用户的一个有效令牌。如果身份认证服务器在本地网络上,这个方法非常好。但它的缺点是如果网络连接断开或是你在没有网的远程端工作。你会被锁在系统之外,直到你能通过网络连接到身份认证服务器。 -有时候,生产环境会需要通过 Yubikey 使用一次性密码(OTP)设置,然而,在家庭或个人的系统上,你可能更喜欢询问-响应设置。一切都是本地的,这种方法不需要通过远程网络呼叫。下面这些过程适用于 Fedora 27、28和29. +有时候,生产环境会采用通过 Yubikey 使用一次性密码(OTP)的设置,然而,在家庭或个人的系统上,你可能更喜欢询问-响应设置。一切都是本地的,这种方法不需要通过远程网络调用。下面这些过程适用于 Fedora 27、28 和 29. ### 准备 #### 硬件令牌密钥 -首先,你需要一个安全的硬件令牌密钥。具体来说,这个过程需要一个 Yubikey 4,Yubikey NEO,或者是最近发布的、同样支持 FIDO2 的 Yubikey 5 系列设备。你应该购买它们中的两个来有一个备份,以避免其中一个丢失或遭到损坏。你可以在不同的工作地点使用这些密钥。较为简单的 FIDO 和 FIDO U2F 版本不适用与这个过程,但是非常适合使用 FIDO 的在线服务。 +首先,你需要一个安全的硬件令牌密钥。具体来说,这个过程需要一个 Yubikey 4、Yubikey NEO,或者是最近发布的、同样支持 FIDO2 的 Yubikey 5 系列设备。你应该购买它们中的两个,一个做备份,以避免其中一个丢失或遭到损坏。你可以在不同的工作地点使用这些密钥。较为简单的 FIDO 和 FIDO U2F 版本不适用于这个过程,但是非常适合使用 FIDO 的在线服务。 #### 备份、备份,以及备份 @@ -38,19 +36,18 @@ #### 升级,然后安装 -现在,确定你的 Fedora 是最新的,然后通过 dnf 命令安装所需要的 Fedora Yubikey 包。 +现在,确定你的 Fedora 是最新的,然后通过 `dnf` 命令安装所需要的 Fedora Yubikey 包。 ``` $ sudo dnf upgrade $ sudo dnf install ykclient* ykpers* pam_yubico* -$ cd ``` -如果你使用的是 VM 环境,例如 Virtual Box,确保 Yubikey 设备已经插进了 USB 口,然后允许 VM 控制的 USB 访问 Yubikey。 +如果你使用的是 VM 环境,例如 Virtual Box,确保 Yubikey 设备已经插进了 USB 口,然后允许 VM 控制的 USB 访问 Yubikey。 ### 配置 Yubikey -通过 USB Yubikey 验证你的账户: +确认你的账户访问到了 USB Yubikey: ``` $ ykinfo -v @@ -63,21 +60,21 @@ version: 3.5.0 Yubikey core error: no yubikey present ``` -接下来,通过下面这些 ykpersonalize 命令初始化你每个新的 Yubikeys。使用 HMAC-SHA1 算法进行询问响应,以此来设置 Yubikey 配置插槽 2。即使少于 64 个字符,如果你已经为询问响应设置好了你的 Yubikey。你就不需要再运行 ykpersonalize 了。 +接下来,通过下面这些 `ykpersonalize` 命令初始化你每个新的 Yubikey。这将设置 Yubikey 配置插槽 2 使用 HMAC-SHA1 算法(即使少于 64 个字符)进行询问响应。如果你已经为询问响应设置好了你的 Yubikey。你就不需要再次运行 `ykpersonalize` 了。 ``` ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -oserial-api-visible ``` -一些用户在使用的时候将 YubiKey 留在了工作环境里,甚至对虚拟机使用了询问响应。然而,为了更好的安全性,你可能会更愿意使用手动触发 YubiKey 来响应询问。 +一些用户在使用的时候将 YubiKey 留在了他们的工作站上,甚至用于对虚拟机进行询问-响应。然而,为了更好的安全性,你可能会更愿意使用手动触发 YubiKey 来响应询问。 -要添加手动询问按钮触发器,请添加 -ochal-btn-trig 标记,这个标记可以在请求中使得 Yubikey 闪烁 Yubikey LED。等待你在 15 秒内按下硬件密钥区域上的按钮来生成响应密钥。 +要添加手动询问按钮触发器,请添加 `-ochal-btn-trig` 选项,这个选项可以使得 Yubikey 在请求中闪烁其 LED。等待你在 15 秒内按下硬件密钥区域上的按钮来生成响应密钥。 ``` $ ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -ochal-btn-trig -oserial-api-visible ``` -为你的每个新的硬件密钥执行此操作。每个密钥执行以此,使用下面的命令将 Yubikey 配置存储到 ~/.yubico: +为你的每个新的硬件密钥执行此操作。每个密钥执行一次。完成编程之后,使用下面的命令将 Yubikey 配置存储到 `~/.yubico`: ``` $ ykpamcfg -2 -v @@ -88,17 +85,17 @@ Sending 63 bytes HMAC challenge to slot 2 Stored initial challenge and expected response in '/home/chuckfinley/.yubico/challenge-9992567'. ``` -如果你要设置多个密钥用于备份。请将所有的密钥设置为相同,然后使用 ykpamcfg utility 存储每个密钥的询问-响应。如果你在一个已经存在的注册密钥上运行 ykpersonalize 命令,你就必须再次存储配置信息。 +如果你要设置多个密钥用于备份,请将所有的密钥设置为相同,然后使用 `ykpamcfg` 工具存储每个密钥的询问-响应。如果你在一个已经存在的注册密钥上运行 `ykpersonalize` 命令,你就必须再次存储配置信息。 ### 配置 /etc/pam.d/sudo -现在要去验证配置是否有效,在相同的终端窗口中,你需要设置 sudo 来要求使用 Yubikey 的询问-响应。将下面这几行插入到 /etc/pam.d/sudo 文件中。 +现在要去验证配置是否有效,**在同一个终端窗口中**,你需要设置 `sudo` 来要求使用 Yubikey 的询问-响应。将下面这几行插入到 `/etc/pam.d/sudo` 文件中。 ``` auth required pam_yubico.so mode=challenge-response ``` -将上面的 auth 行插入到 auth 文件中的 system-auth 行的上面,然后保存并退出编辑器。在默认的 Fedora 29 设置中,/etc/pam.d/sudo 应该像下面这样: +将上面的 `auth` 行插入到文件中的 `auth include system-auth` 行的上面,然后保存并退出编辑器。在默认的 Fedora 29 设置中,`/etc/pam.d/sudo` 应该像下面这样: ``` #%PAM-1.0 @@ -111,24 +108,25 @@ session required pam_limits.so session include system-auth ``` -保持原始终端窗口打开,然后打开一个新的终端窗口进行测试,在新的终端窗口中输入: +**保持这个初始的终端窗口打开**,然后打开一个新的终端窗口进行测试,在新的终端窗口中输入: ``` $ sudo echo testing ``` -你应该注意到了 key 上的 LED 在闪烁。点击 Yubikey 按钮,你应该会看见一个输入 sudo 密码的提示。在你输入你的密码之后,你应该会在终端屏幕上看见 ”testing“ 的字样。 +你应该注意到了 Yubikey 上的 LED 在闪烁。点击 Yubikey 按钮,你应该会看见一个输入 `sudo` 密码的提示。在你输入你的密码之后,你应该会在终端屏幕上看见 “testing” 的字样。 -现在去测试确保正常的失败,启动另一个终端窗口,并从 USB 插口中拔掉 Yubikey。使用下面这条命令验证,在没有 Yubikey 的情况下,sudo 是否会不再正常工作。 +现在去测试确保失败也正常,启动另一个终端窗口,并从 USB 插口中拔掉 Yubikey。使用下面这条命令验证,在没有 Yubikey 的情况下,`sudo` 是否会不再正常工作。 ``` $ sudo echo testing fail ``` -你应该立刻被提示输入 sudo 密码,即使你输入了正确密码,登陆也应该失败。 -### 设置 Gnome 桌面管理 +你应该立刻被提示输入 `sudo` 密码,但即使你输入了正确密码,登录也应该失败。 -一旦你的测试完成后,你就可以为图形登陆添加询问-响应支持了。将你的 Yubikey 再次插入进 USB 插口中。然后将下面这几行添加到 /etc/pam.d/gdm-password 文件中: +### 设置 Gnome 桌面管理器(GDM) + +一旦你的测试完成后,你就可以为图形登录添加询问-响应支持了。将你的 Yubikey 再次插入进 USB 插口中。然后将下面这几行添加到 `/etc/pam.d/gdm-password` 文件中: ``` auth required pam_yubico.so mode=challenge-response @@ -140,9 +138,9 @@ auth required pam_yubico.so mode=challenge-response $ sudo vi /etc/pam.d/gdm-password ``` -你应该看到 yubikey 上的 LED 在闪烁,按下 yubikey 按钮,然后在提示符出输入密码。 +你应该看到 Yubikey 上的 LED 在闪烁,按下 Yubikey 按钮,然后在提示符处输入密码。 -修改 /etc/pam.d/gdm-password 文件,在已有的 password-auth 上添加新的 auth 行。这个文件的顶部应该像下面这样: +修改 `/etc/pam.d/gdm-password` 文件,在已有的 `auth substack password-auth` 行上添加新的行。这个文件的顶部应该像下面这样: ``` auth [success=done ignore=ignore default=bad] pam_selinux_permit.so @@ -154,15 +152,15 @@ auth include postlogin account required pam_nologin.so ``` -保存更改并退出编辑器,如果你使用的是 vi,输入键是按 Esc 键,然后在提示符出输入 wq! 来保存并退出。 +保存更改并退出编辑器,如果你使用的是 vi,输入键是按 `Esc` 键,然后在提示符处输入 `wq!` 来保存并退出。 ### 结论 -现在注销 GNOME。将 Yubikey 插入到 USB 口,在图形登陆界面上点击你的用户名。Yubikey LED 会开始闪烁。触摸那个按钮,你会被提示输入你的密码。 +现在注销 GNOME。将 Yubikey 插入到 USB 口,在图形登录界面上点击你的用户名。Yubikey LED 会开始闪烁。触摸那个按钮,你会被提示输入你的密码。 -如果你丢失了 Yubikey,除了重置密码之外,你还可以使用备份的 Yubikey。你还可以给你的账户增加额外的 Yubikey 配置。 +如果你丢失了 Yubikey,除了重置密码之外,你还可以使用备份的 Yubikey。你还可以给你的账户增加额外的 Yubikey 配置。 -如果有其他人获得了你的密码,他们在没有你的物理硬件 Yubikey 的情况下,仍然不能登陆。恭喜!你已经显著提高了你的工作环境登陆的安全性了。 +如果有其他人获得了你的密码,他们在没有你的物理硬件 Yubikey 的情况下,仍然不能登录。恭喜!你已经显著提高了你的工作环境登录的安全性了。 -------------------------------------------------------------------------------- @@ -171,7 +169,7 @@ via: https://fedoramagazine.org/login-challenge-response-authentication/ 作者:[nabooengineer][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 e0856a2eb56d29dbcfb0d410e229a6f46764f8a2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 13:43:35 +0800 Subject: [PATCH 0279/4278] PUB:20181022 Improve login security with challenge-response authentication.md @hopefully2333 https://linux.cn/article-10378-1.html --- ...prove login security with challenge-response authentication.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181022 Improve login security with challenge-response authentication.md (100%) diff --git a/translated/tech/20181022 Improve login security with challenge-response authentication.md b/published/20181022 Improve login security with challenge-response authentication.md similarity index 100% rename from translated/tech/20181022 Improve login security with challenge-response authentication.md rename to published/20181022 Improve login security with challenge-response authentication.md From bd6dbed6ea649bc2509275249cd441e0ab01a8f1 Mon Sep 17 00:00:00 2001 From: Ryze-Borgia <42087725+Ryze-Borgia@users.noreply.github.com> Date: Mon, 24 Dec 2018 15:38:39 +0800 Subject: [PATCH 0280/4278] Update and rename sources/talk/20180128 Getting Linux Jobs.md to translated/talk/20180128 Getting Linux Jobs.md --- sources/talk/20180128 Getting Linux Jobs.md | 99 ------------------- .../talk/20180128 Getting Linux Jobs.md | 94 ++++++++++++++++++ 2 files changed, 94 insertions(+), 99 deletions(-) delete mode 100644 sources/talk/20180128 Getting Linux Jobs.md create mode 100644 translated/talk/20180128 Getting Linux Jobs.md diff --git a/sources/talk/20180128 Getting Linux Jobs.md b/sources/talk/20180128 Getting Linux Jobs.md deleted file mode 100644 index 4cb79e9834..0000000000 --- a/sources/talk/20180128 Getting Linux Jobs.md +++ /dev/null @@ -1,99 +0,0 @@ -translating by ryze-borgia -Getting Linux Jobs -====== - -In a qualitative review of job posting websites, even highly skilled Linux administrators would be hamstrung to succeed in getting to the stage of an interview. - -All of this results in hundreds of decent and skilled people being snubbed without cause simply because today's job market requires a few extra tools to increase the odds. - -I have two colleagues and a cousin who have all received certifications with RedHat, managed quite extensive server rooms, and received earnest recommendations from former employers. - -All of these skills, certifications and experience come to naught as they apply to employer ads that are crudely constructed by someone hurriedly cutting and pasting snippets of "skill words" from a list of technical terms. - -Not surprisingly, today's politeness has gone the way of the bird, and a **non-response** from companies posting ads seems to be the new way of communicating. - -Unfortunately, it also means that these recruiters/HR personnel probably did **not** get the best candidate. - -The reason I can say this with such conviction is because of the type of buffoonery that takes place so often when creating job ads in the first place. - -Walter, another [Reallylinux.com][3] guest writer, presented how [**Job Want Ads Have Gone Mad**][4]. - -Perhaps he's right. However, I believe every Linux job seeker can avoid pitfalls of a job hunt by keeping in mind **three key facts** about job ads. - -First, few advertisements for Linux administrators are exclusively about Linux. - -Bear in mind the occasional Linux system administrator job, where you would actually be using Linux on servers. Instead, many jobs that rise up on a "Linux administrator" search are actually referring to a plethora of 'NX operating systems. - -For example, here is a quote from a **"Linux Administrator"** job posting: -This role will provide support for build system integration, especially operating system installation support for BSD applications... - -Or another ad declares in the bowels of its content: -Windows administration experience required. - -Ironically, if you show up to interview for any of these types of jobs and focus on Linux, they probably will not choose you. - -Even more importantly, if you simply include Linux as your expertise, they may not even bother with your resume, because they can't tell the difference between UNIX, BSD, Linux, etc. - -As a result, if you are conscientious and only include Linux on your resume, you are automatically out. But change that Linux to UNIX/Linux and you end up getting a bit farther in the human resources bureaucracy. - -I had two colleagues that ended up changing this on their resumes and getting a much better hit ratio for interviews, which were still slim pickings because most job ads are tailored with some particular person already in mind. The main intent behind such job ads being a cover for the ass of the department making the claim of having an open job. - -Second, the only person at the company who cares at all about the system administrator position is the technical lead/manager hiring for the slot. Others at the company, including the HR contact or the management could not care less. - -I remember sitting in a board room as a fly on the wall, hearing one executive vice president refer to server administrators as "dime a dozen geeks." How wrong they are to suggest this. - -Ironically, one day should the mail system fail, or the PBX connectivity hiccup, or perhaps core business files disappear from the intranet, these same executives are the first to get on the phone and threaten to fire the system admins. - -Perhaps if they would stop leaving so many hot air telephone messages, or filling their emails with 35MB photographs of another vice president's fishing trip and wife, the servers wouldn't be so problematic. - -Be aware that a Linux administrator ad, or any job posting for server administrator is placed because someone at the TECHNICAL level sees an urgent need for staffing. You're not going to get any empathy talking to HR or any leader of the company. Instead, take the time to find out who the hiring technical manager is and try to telephone them. - -You can always call them directly because you have some "specific technical questions" you know the HR person could not answer. This opens the dialogue with the person who actually cares that the position is filled and ensures you get a foot in because you took the time for personal contact, even if it was a 60 second phone call. - -What if the HR beauracracy won't let you through? - -Start asking as many tech questions as possible direct to the HR hiring contact, such as how their Linux clusters are setup and do they run VMs exclusively? Anything relatively technical will send these HR people in a tizzy and allow you the question: "may I contact the technical manager of the team?" - -If the response is a fluffy "maybe" or "I'll get back to you on that" they already filled the slot in their mind with someone else two weeks earlier, such as the HR staff member's fiance. They simply wanted it to look less like nepotism and more like indeterminism with a dash of egoism. - -``` -"They simply wanted it to look less like nepotism and more like indeterminism with a dash of egoism." -``` - -So take the time to find out who is the direct TECHNICAL leader hiring for the position and talk to them. It can make a difference and get you past some of the baloney. - -Third, few job ads today include any semblance of reality. - -I've seen enough ads requiring a junior system administrator with expertise that senior level experts don't have, to know the plan is to list the blue sky wish list and then find out who applies. - -In this situation, the Linux administrator ad you apply for, should include some key phrases for which you already have experience or certifications. - -The trick is to so overload your resume with the key phrases that MATCH their ad, it becomes almost impossible for them to determine which phrases you left out. - -This doesn't necessarily translate to a job, but it often adds enough intrigue to get you an interview, which now a days is a major step. - -By understanding and applying these three techniques, hopefully those seeking Linux administrator jobs have a head start on those who have only a slim chance in hell. - -Even if these tips don't get you interviews right away, you can use the experience and awareness when you go to the next trade show, or company sponsored technical conference. - -I strongly recommend you regularly attend these as well, especially if they are reasonably close, as they always provide a kick start to networking. - -Remember that job networking now a days is a pseudonym for "getting the gossip on which companies are actually hiring and which ones are just lying about jobs to give the appearance of growth for shareholders." - - - --------------------------------------------------------------------------------- - -via: http://reallylinux.com/docs/gettinglinuxjobs.shtml - -作者:[Andrea W.Codingly][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://reallylinux.com -[1]:http://www.reallylinux.com -[2]:http://reallylinux.com/docs/linuxrecessionproof.shtml -[3]:http://reallylinux.com -[4]:http://reallylinux.com/docs/wantadsmad.shtml diff --git a/translated/talk/20180128 Getting Linux Jobs.md b/translated/talk/20180128 Getting Linux Jobs.md new file mode 100644 index 0000000000..1f7b5791af --- /dev/null +++ b/translated/talk/20180128 Getting Linux Jobs.md @@ -0,0 +1,94 @@ +Linux 求职建议 +====== + +通过对招聘网站数据的仔细研究,我们发现,即使是非常有经验的 Linux 程序员,也很难在面试中表现的很出色。 + +这就导致了很多优秀并且有经验的人找不到合适的工作,所以我们可能需要一些手段来提高自己的竞争力。 + +我有两个同事和一个表哥,他们都有 RedHat 认证,管理过比较大的服务器机房,也都收到过老员工的推荐。 + +可是,在他们应聘的时候,所有的这些证书、本身的能力、工作经验好像都没有起到任何作用,他们面对的是一些 +从术语列表中临时挑选的一些技术词汇片段所组成的问题。 + +现如今,礼貌变得过时了,**不回应**变成了公司招人时最好的沟通方式。 + +这同样也意味着大多公司的招聘或者人事可能会**错过**非常优秀的应聘者。 + +我之所以敢说的如此肯定,是因为现在招聘广告大多数看上去都非常的滑稽。 + +Walter ,[Reallylinux.com][3] 另一位特约撰稿人,发表过一篇关于 [招聘广告疯掉了][4] 的文章。 + +他说的没错,可是我认为 Linux 工作应聘者可以通过注意招聘广告的**三个关键词**避免落入陷阱。 + +首先,很少会有 Linux 领域的招聘广告只对 Linux 有要求 。 + +一定要注意 Linux 相关工作的工作场合,公司很有可能会要求你在服务器上跑 Linux ,另外,通过 “Linux” 搜索得到的结果有很多实际上是会涉及到 NX (数字化产品开发系统)的。 + +举个例子,现在有一则关于 **Linux 管理员招聘** 的招聘广告: +参与建立系统集成,尤其是 BSD 应用的系统安装... + +或者有一些其他的要求: +有 Windows 系统管理经验的 + +最为讽刺的是,如果你在应聘面试的时候表现出精通 Linux 的话,你可能不会被聘用。 + +另外,如果你直接把 Linux 写在你的特长或者专业上,他们可能都不会仔细看你的简历,因为他们根本区分不了 UNIX, BSD, Linux。 + +最终的结果就是,如果你只在简历上写了 Linux ,你可能会被直接掉,但是如果你改成 UNIX/Linux 的话,可能会走得更远。 + +我有两个同事最后修改了他们的简历,然后获得了更好的面试机会,但是依旧没有被聘用,因为大多数招聘广告其实已经内定人员了,这些招聘信息被放出来仅仅是为了表现出他们有招聘的想法。 + +第二点,公司里真正需要了解系统管理的只有特聘的科技主管,其他人包括人事或管理层根本不关心这个。 + +我记得有一次开会的时候,听见一个执行副总裁把服务器管理人员说成“一毛钱一打的人”,这种想法是多么的奇怪啊。 + +讽刺的是,等到邮件系统出故障,交换机连接时不时会断开,或者核心商业文件从企业内网中消失的时候,这些总裁又是最先打电话给系统管理员的。 + +或许如果他们不整天说些空话,或者不往邮件里塞满妻子的照片和旅行途中的照片的话,服务器可能就不会崩溃。 + +在找工作的时候一定要关注招聘 Linux 运维或者服务器管理人员的广告,因为这种一般都是在公司技术层有迫切的需求的时候才会有的。你也不需要和人事或者公司高层聊什么,搞清楚谁要招聘然后打电话给他们。 + +你需要直接联系他们因为有些技术问题人事是解决不了的,即使你只有 60 秒的时间可以和他们交流,你也必须抓住这个机会和真正有需求并且懂技术的人沟通。 + +那如果人事不让你进怎么办呢? + +记得问人事一些技术性问题,比如说他们的 Linux 群组是如何建立的,能不能独立运行虚拟机。这些技术性的问题会让人事变得不耐烦,最后让你有机会问出“我能不能直接联系你们团队的技术人员”。 + +如果对方的回答是“应该可以”或者“稍后回复你”,那么他们可能已经在两周前就已经计划好了找一个人来填补这个空缺,比如说人事部员工的未婚夫。他们只是不希望看起来太像裙带主义,而是带有一点利己主义的不确定主义。 + +所以一定要记得花点时间弄清楚到底谁是发布招聘广告的直接技术负责人然后和他们聊一聊,这可能会让你少一番胡扯并且让你更有可能应聘成功。 + +第三点,现在的广告很少有完全真实的内容了。 + +我以前见过一个招聘具有高级专家所不具备的专门知识的初级系统管理员的广告,计划是列出公司的发展计划蓝图,然后找到应聘者。 + +在这种情况下,你应聘 Linux 管理员职位应该提供几个关键性信息,例如工作经验和相关证书。 + +诀窍在于,在你的简历中给出与他们的招聘信息相匹配的关键词,这样他们就基本找不到你存在的问题。 + +这并不一定会让你成功找到一份工作,但它可以让你获得一次面试机会,这也算是一个巨大的进步。 + +通过理解和应用以上三点,或许可以让那些寻求 Linux 管理员工作的人能够比那些在地狱中只有一线希望的人有一个好的开始。 + +即使这些建议不能让你马上得到面试机会,你也可以利用这些经验和意识去参加贸易展或公司主办的技术会议等活动。 + +我强烈建议你们也经常参加这种活动,尤其是当它们时间比较接近的时候,可以给你一个扩展人脉的机会。 + +请记住,如今的“求职网日”已经失去了原来的意义了,现在只是可以用来获取“哪些公司实际上在招聘、哪些公司只是为了给股东带来增长的表象而在工作方面撒谎”的小道消息。 + + +-------------------------------------------------------------------------------- + +via: http://reallylinux.com/docs/gettinglinuxjobs.shtml + +作者:[Andrea W.Codingly][a] +译者:[Ryze-Borgia](https://github.com/Ryze-Borgia) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://reallylinux.com +[1]:http://www.reallylinux.com +[2]:http://reallylinux.com/docs/linuxrecessionproof.shtml +[3]:http://reallylinux.com +[4]:http://reallylinux.com/docs/wantadsmad.shtml From 128cf37c5433db41731ee4c9fec303cde41282de Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Mon, 24 Dec 2018 17:07:37 +0800 Subject: [PATCH 0281/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成删除原文 20180826 How to Install and Use FreeDOS on VirtualBox.md --- ...o Install and Use FreeDOS on VirtualBox.md | 156 ------------------ 1 file changed, 156 deletions(-) delete mode 100644 sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md diff --git a/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md deleted file mode 100644 index f6d36e718b..0000000000 --- a/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md +++ /dev/null @@ -1,156 +0,0 @@ -WangYueScream Tanslating ---------------- -How to Install and Use FreeDOS on VirtualBox -====== -This step-by-step guide shows you how to install FreeDOS on VirtualBox in Linux. - -### Installing FreeDOS on VirtualBox in Linux - - - -In November of 2017, I [interviewed Jim Hall][1] about the history behind the [FreeDOS project][2]. Today, I’m going to tell you how to install and use FreeDOS. Please note: I will be using [VirtualBox][3] 5.2.14 on [Solus][4]. - -Note: I used Solus as the host operating system for this tutorial because it is very easy to setup. One thing you should keep in mind is that Solus’ Software Center contains two versions of VirtualBox: `virtualbox` and `virtualbox-current`. Solus gives you the option to use the linux-lts kernel and the linux-current kernel. `virtualbox`is modified for linux-lts and `virtualbox-current` is for linux-current. - -#### Step 1 – Create New Virtual Machine - -![][5] - -Once you open VirtualBox, press the “New” button to create a new virtual machine. You can name it whatever you want, I just use “FreeDOS”. You can use the label to specify what version of FreeDOS you are installing. You also need to select the type and version of the operating system you will be installing. Select “Other” and “DOS”. - -#### Step 2 – Select Memory Size - -![][6] - -The next dialog box will ask you how much of the host computer’s memory you want to make available to FreeDOS. The default is 32MB. Don’t change it. Back in the day, this would be a huge amount of RAM for a DOS machine. If you need to, you can increase it later by right-clicking on the virtual machine you created for FreeDOS and selecting Settings -> System. - -![][7] - -#### Step 3 – Create Virtual Hard Disk - -![][8] - -Next, you will be asked to create a virtual hard drive where FreeDOS and its files will be stored. Since you haven’t created one yet, just click “Create”. - -The next dialog box will ask you what hard disk file type you want to use. This default (VirtualBox Disk Image) works just fine. Click “Next”. - -The next question you will encounter is how you want the virtual disk to act. Do you want it to start small and gradually grow to its full size as you create files and install programs? Then choose dynamically allocated. If you prefer that the virtual hard drive (vhd) is created at full size, then choose fixed size. Dynamically allocated is nice if you don’t plan to use the whole vhd or if you don’t have very much free space on your hard drive. (Keep in mind that while the size of a dynamically allocated vhd increases as you add files, it will not drop when you remove files.) I prefer dynamically allocated, but you can choose the option that serves your needs best and click “Next”. - -![][9] - -Now, you can choose the size and location of the vhd. 500 MB should be plenty of space. Remember most of the programs you will be using will be text-based, thus fairly small. Once you make your adjustments, click Create, - -#### Step 4 – Attach .iso file - -Before we continue, you will need to [download][10] the FreeDOS .iso file. You will need to choose the CDROM “standard” installer. - -![][11] - -Once the file has been downloaded, return to VirtualBox. Select your virtual machine and open the settings. You can do this by either right-clicking on the virtual machine and selecting “Settings” or highlight the virtual machine and click the “Settings” button. - -Now, click the “Storage” tab. Under “Storage Devices”, select the CD icon. (It should say “Empty” next to it.) In the “Attributes” panel on the right, click on the CD icon and select the location of the .iso file you just downloaded. - -Note: Typically, after you install an operating system on VirtualBox you can delete the original .iso file. Not with FreeDOS. You need the .iso file if you want to install applications via the FreeDOS package manager. I generally keep the ,iso file attached the virtual machine in case I want to install something. If you do that, you have to make sure that you tell FreeDOS you want to boot from the hard drive each time you boot it up because it defaults to the attached CD/iso. If you forget to attach the .iso, don’t worry. You can do so by selecting “Devices” on the top of your FreeDOS virtual machine window. The .iso files are listed under “Optical Drives”. - -#### Step 5 – Install FreeDOS - -![][12] - -Now that we’ve completed all of the preparations, let’s install FreeDOS. - -First, you need to be aware of a bug in the most recent version of VirtualBox. If you start the virtual machine that we just created and select “Install to harddisk” when the FreeDOS welcome screen appears, you will see an unending, scrolling mass of machine code. I’ve only run into this issue recently and it affects both the Linux and Windows versions of VirtualBox. (I know first hand.) - -To get around this, you need to make a simple edit. When you see the FreeDOS welcome screen, press Tab. (Make sure that the “Install to harddrive” option is selected.) Type the word `raw` after “fdboot.img” and hit Enter. The FreeDOS installer will then start. - -![][13] - -The first part of the installer will handle formatting your virtual drive. Once formatting is completed, the installer will reboot. When the FreeDOS welcome screen appears again, you will have to re-enter the `raw` comment you used earlier. - -Make sure that you select “Yes” on all of the questions in the installer. One important question that doesn’t have a “Yes” or “No” answer is: “What FreeDOS packages do you want to install?. The two options are “Base packages” or “Full installation”. Base packages are for those who want a DOS experience most like the original MS-DOS. The Full installation includes a bunch of tools and utilities to improve DOS. - -At the end of the installation, you will be given the option to reboot or stay on DOS. Select “reboot”. - -#### Step 6 – Setup Networking - -Unlike the original DOS, FreeDOS can access the internet. You can install new packages and update the ones already you have installed. In order to use networking, you need to install several applications in FreeDOS. - -![][14] - -First, boot into your newly created FreeDOS virtual machine. At the FreeDOS selection screen, select “Boot from System harddrive”. - -![][15] - -Now, to access the FreeDOS package manager, type `fdimples`. You can navigate around the package manager with the arrow keys and select categories or packages with the space bar. From the “Networking” category, you need to select `fdnet`. The FreeDOS Project also recommends installing `mtcp` and `wget`. Hit “Tab” several times until “OK” is selected and press “Enter”. Once the installation is complete, type `reboot` and hit enter. After the system reboots, boot to your system drive. If the network installation was successful, you will see several new messages at the terminal listing your network information. - -![][16] - -##### Note - -Sometimes the default VirtualBox setup doesn’t work. If that happens, close your FreeDOS VirtualBox window. Right-click your virtual machine from the main VirtualBox screen and select “Settings”. The default VirtualBox network setting is “NAT”. Change it to “Bridged Adapter” and retry installing the FreeDOS packages. It should work now. - -#### Step 7 – Basic Usage of FreeDOS - -##### Commons Commands - -Now that you have installed FreeDOS, let’s look at a few basic commands. If you have ever used the Command Prompt on Windows, you will be familiar with some of these commands. - - * `DIR`– display the contents of the current directory - * `CD` – change the directory you are currently in - * `COPY OLD.TXT NEW.TXT`– copy files - * `TYPE TEST.TXT` – display content of file - * `DEL TEST.TXT` – delete file - * `XCOPY DIR NEWDIR` – copy directory and all of its contents - * `EDIT TEST.TXT`– edit a file - * `MKDIR NEWDIR` – create a new directory - * `CLS` – clear the screen - - - -You can find more basic DOS commands on the web or the [handy cheat sheet][17] created by Jim Hall. - -##### Running a Program - -Running program on FreeDos is fairly easy. When you install an application with the `fdimples` package manager, be sure to note where the .EXE file of the application is located. This is shown in the application’s details. To run the application, you generally need to navigate to the application folder and type the application’s name. - -For example, FreeDOS has an editor named `FED` that you can install. After installing it, all you need to do is navigate to `C:\FED` and type `FED`. - -Sometimes a program, such as Pico, is stored in the `\bin` folder. These programs can be called up from any folder. - -Games usually have an .EXE program or two that you have to run before you can play the game. These setup file usually fix sound, video, or control issues. - -If you run into problems that this tutorial didn’t cover, don’t forget to visit the [home of FreeDOS][2]. They have a wiki and several other support options. - -Have you ever used FreeDOS? What tutorials would you like to see in the future? 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][18]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-freedos/ - -作者:[John Paul][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/john/ -[1]:https://itsfoss.com/interview-freedos-jim-hall/ -[2]:http://www.freedos.org/ -[3]:https://www.virtualbox.org/ -[4]:https://solus-project.com/home/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-1.jpg -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-2.jpg -[7]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-3.jpg -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-4.jpg -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-6.jpg -[10]:http://www.freedos.org/download/ -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-7.jpg -[12]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-8.png -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-9.png -[14]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-10.png -[15]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-11.png -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-12.png -[17]:https://opensource.com/article/18/6/freedos-commands-cheat-sheet -[18]:http://reddit.com/r/linuxusersgroup From 8b3c24fd40630f9140b48981cd0897ddefdb6c20 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Mon, 24 Dec 2018 17:08:51 +0800 Subject: [PATCH 0282/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 20180826 How to Install and Use FreeDOS on VirtualBox.md 翻译完成添加译文 --- ...o Install and Use FreeDOS on VirtualBox.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md diff --git a/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md new file mode 100644 index 0000000000..e8b0d30183 --- /dev/null +++ b/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md @@ -0,0 +1,157 @@ + +如何在 VirtualBox 上安装并使用 FreeDOS? +====== +这份指南将带你如何一步一步在 Linux 平台下利用 VirtualBox 安装 FreeDOS。 + +### Linux 下借助 VirtualBox 安装 FreeDOS + + + +2017 年的 11 月份,我[采访了 Jim Hall][1] 关于 [FreeDOS project][2] 背后的历史故事。今天,我将告诉你如何安装并使用 FreeDOS。需要注意到是:我将在 [Solus][4](一种针对家庭用户的 Linux 桌面发行版)下使用 5.2.14 版本的 [VirtualBox][3] 来完成这些操作。 + +注意:在本教程我将使用 Solus 作为主机系统因为它很容易设置。另一个你需要注意的事情是 Solus 的软件中心有两个版本的 VirtualBox:`virtualbox` 和 `virtualbox-current`。Solus 会让你选择是使用 linux-lts 内核还是 linux-current 内核。最终区别就是,`virtualbox` 适用于 linux-lts 而 `virtualbx-current` 适用于 linux-current。 + + +#### 第一步 – 创建新的虚拟机 + +![][5] + +当你打开 VirtualBox,点击 "New" 按钮来新建一个虚拟机。你可以自定义这台虚拟机的名字,我将它命名为 “FreeDOS”。你也可以在标注栏内指明你正在安装的 FreeDOS 的版本。你还需要选择你将要安装的操作系统的类型和版本。选择 “Other” 下的 “DOS”。 + +#### 第二步 – 设置内存大小 + +![][6] + +下一个对话框会问你要给 FreeDOS 主机分配多少可用的内存空间。默认分配 32 MB。不必更改它。在 DOS 系统盛行的年代,32 MB 大小的内存对于一台搭载 FreeDOS 的机器已经很足够了。如果你有需要,你可以通过对你针对 FreeDOS 新建的虚拟机右键并选择 Setting -> Symtem 来增加内存。 + +![][7] + +#### 第三步 – 创建虚拟硬盘 + +![][8] + +下一步,你会被要求创建一个虚拟硬盘用来存储 FreeDOS 和它的文件。如果你还没有创建,只需要点击 “Create”。 + +下一个对话框会问你想用什么磁盘文件类型。默认的类型 (VirtualBox Disk Image) 效果就挺好。点击 “Next”。 + +下一个你遇到的问题是你想虚拟硬盘以何种方式创建。你是否希望虚拟硬盘占据的空间刚开始很小然后会随着你创建文件和安装软件逐渐增加直至达到你设置的上限?那么选择动态分配。如果你更喜欢虚拟硬盘 (VHD) 按照既定大小直接创建,选择固定大小即可。如果你不打算使用整个 VHD 或者你的硬盘空余空间不是太足够,那么动态分配是个很不错的分配方式。(需要注意的是,动态分配的虚拟硬盘占据的空间会随着你增加文件而增加,但不会因为你删除文件而变小) 我个人更喜欢动态分配,但你可以根据实际需要来选择最合适你的分配类型然后点击 “Next”。 + +![][9] + +现在,你可以选择虚拟磁盘的大小和位置。500 MB 已经很足够了。需要注意的是很多你之后用到的程序都是基于文本的,这意味着它们占据的空间非常小。在你做好这些调整后,点击 Creat。 + + +#### 第四步 – 关联 .iso 文件 + +在我们继续之前,你需要[下载][10] FreeDOS 的 .iso 文件。你需要选择 CDROM 格式的 “standard” 安装程序。 + +![][11] + +当文件下载完毕后,返回到 VirtualBox。选中你的虚拟机并打开设置。你可以通过对虚拟机右键并选中 “Setting” 或者 选中虚拟机并点击 “Setting” 按钮。 + +接下来,点击 “Storage” 选项卡。在 “Storage Devices” 下面,选中 CD 图标。(它应该会在图标旁边显示 “Empty”。) 在右边的 “Attribute” 面板,点中 CD 图标然后在对应路径选中你刚下载的 .iso 文件。 + +提示:通常,在你通过 VirtualBox 安装完一个操作系统后你就可以删除对应的 .iso 文件了。但这并不适合 FreeDOS 。如果你想通过 FreeDOS 的包管理器来安装应用程序,你需要这个 .iso 文件。我通常会让这个 .iso 文件连接到虚拟机以便我安装一些程序。如果你也这么做了,你必须要确认下你让 FreeDOS 虚拟机每次启动的时候是从硬盘启动因为虚拟机的默认设置是从已关联的 .iso 文件启动。如果你忘了关联 .iso 文件,也不用担心。你可以通过选择 FreeDOS 虚拟机窗口上方的 “Devices” 来关联。然后就会发现 .iso 文件列在 “Optical Drives”。 + + +#### 第五步 – 安装 FreeDOS + +![][12] + +既然我们已经完成了所有的准备工作,让我们来开始安装 FreeDOS 吧。 + +首先,你需要知道关于最新版本的 VirtualBox 的一个 bug。当我们创建好虚拟硬盘然后选中 “Install to harddisk” 后,如果你开启虚拟机你会发现在 FreeDOS 的欢迎界面出现过后就是不断滚动无群无尽的机器代码。我最近就遇到过这个问题而且不管是 Linux 还是 Windows 平台的 VirtualBox 都会碰到这个问题。(我知道解决办法。) + +为了避开这个问题,你需要做一个简单的修改。当你看到 FreeDOS 的欢迎界面的时候,按下 Tab 键。(确认 “Install to harddrive” 已经选中。)在 “fdboot.img” 之后输入 `raw` 然后按下 Enter 键。接下来就会启动 FreeDOS 的安装程序。 + +![][13] + +安装程序会首先处理你的虚拟磁盘的格式化。当格式化完成后,安装程序会重启。当 FreeDOS 的欢迎界面再次出现的时候,你不得不重新输入 `raw` 就像你之前输入的内容那样。 + +要确保在安装过程中你遇到的所有问题你选的都是 “Yes”。但也要注意有一个很重要的问题:“What FreeDOS packages do you want to install?” 的答案并不是 “Yes” 或者 “No”。答案有两个选择分别是 “Base packages” 和 “Full installation”。“Base packages” 针对的是想体验类似原始的 MS-DOS 环境的人群。“Full installation” 则包括了一系列工具和实用的程序来提升 DOS。 + +在整个安装过程的最后,你可以选择重启或者继续停留在 DOS。选择“reboot”。 + +#### 第六步 – 设置网络 + +不同于原始的 DOS,FreeDOS 可以访问互联网。你可以安装新的软件包或者更新你已经安装的软件包。要想使用网络,你还需要在 FreeDOS 安装些应用程序。 + +![][14] + +首先,启动进入你新创建的 FreeDOS 虚拟机。在 FreeDOS 的选择界面,选中 “Boot from System harddrive”。 + +![][15] + +现在,你可以通过输入 `fdimples` 来访问 FreeDOS 的软件包管理工具。你也可以借助方向键来浏览软件包管理器然后用空格键选择类别或者软件包。在 “Networking” 类别中,你需要选中 `fdnet`。FreeDOS project 推荐也安装 `mtcp` 和 `wget`。多次点击 “Tab” 键直到选中 “OK” 然后在按下 “Enter” 键。安装完成后,输入 `reboot` 并按下 “Enter” 键确认执行。系统重启后,引导你的系统驱动。如果网络安装成功的话,你会在终端看到一些关于你的网络信息的新消息。 + +![][16] + +##### 注意 + +有时候 VirtualBox 的默认设置并没有生效。如果遇到这种情况,先关闭你的 FreeDOS 虚拟机窗口。在 VirtualBox 主界面右键你的虚拟机并选中 “Setting”。VirtualBox 默认的网络设置是 “NAT”。将它改为 “Bridged Adapter” 后再尝试安装 FreeDOS 的软件包。现在就应该能正常运作了。 + + +#### 第七步 – FreeDOS 的基本使用 + +##### 常见命令 + +既然你已经成功安装了 FreeDOS,让我们来看些基础命令。如果你已经在 Windows 平台使用过命令提示符,那么你会发现有很多命令都是相似的。 + + * `DIR`– 显示当前目录的内容 + * `CD` – 改变当前所在的目录 + * `COPY OLD.TXT NEW.TXT`– 复制文件 + * `TYPE TEST.TXT` – 显示文件内容 + * `DEL TEST.TXT` – 删除文件 + * `XCOPY DIR NEWDIR` – 复制目录及目录下的所有内容 + * `EDIT TEST.TXT`– 编辑一个文件 + * `MKDIR NEWDIR` – 创建一个新目录 + * `CLS` – 清除屏幕 + +你可以借助互联网或者 Jim Hall 所创建的 [handy cheat sheet][17] 来找到更多基本的 DOS 命令。 + +##### 运行一个程序 + +在 FreeDOS 上运行程序相当简单。需要注意的是当你借助 `fdimples` 软件包管理器来安装一个应用程序的时候,要确保你指定了待安装程序的 .EXE 文件的路径。这个路径会在应用程序的详细信息中显示。要想运行程序,通常你还需要进入到程序所在文件夹并输入该程序的名字。 + +例如,FreeDOS 中你可以安装一个叫 `FED` 的编辑器。安装完成后,你还需要做的就是进入 `C:\FED` 这个文件夹下并输入 `FED`。 + +对于位于 `\bin` 这个文件夹的程序,比如 Pico。这些程序可以在任意文件夹中被调用。 + +对于游戏通常会有一个或者两个 .EXE 程序,你玩游戏之前不得不先运行它们。这些设置文件通常能够修复你遇到的声音,视频,或者控制问题。 + +如果你遇到一些本教程中没指出的问题,别忘记访问 [home of FreeDOS][2] 来寻求解决办法。他们有一个 wiki 和一些其他的支持选项。 + +你使用过 FreeDOS 吗?你还想看关于 FreeDOS 哪些方面的教程?请在下面的评论区告诉我们。 + +如果你觉得本篇文章很有趣,请花一分钟的时间将它分享在你的社交媒体,Hacker News 或者 [Reddit][18]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-freedos/ + +作者:[John Paul][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[WangYueScream](https://github.com/WangYueScream) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[1]:https://itsfoss.com/interview-freedos-jim-hall/ +[2]:http://www.freedos.org/ +[3]:https://www.virtualbox.org/ +[4]:https://solus-project.com/home/ +[5]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-1.jpg?w=787&ssl=1 +[6]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-2.jpg?w=792&ssl=1 +[7]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-3.jpg?w=797&ssl=1 +[8]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-4.jpg?w=684&ssl=1 +[9]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-6.jpg?w=705&ssl=1 +[10]:http://www.freedos.org/download/ +[11]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-7.jpg?w=800&ssl=1 +[12]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-8.png?w=789&ssl=1 +[13]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-9.png?w=748&ssl=1 +[14]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-10.png?w=792&ssl=1 +[15]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-11.png?w=739&ssl=1 +[16]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-12.png?w=744&ssl=1 +[17]:https://opensource.com/article/18/6/freedos-commands-cheat-sheet +[18]:http://reddit.com/r/linuxusersgroup From 5bacf6d82b9f66e3d93bc42b59769865298aa829 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 17:37:49 +0800 Subject: [PATCH 0283/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20The=20Linux=20c?= =?UTF-8?q?ommand=20line=20can=20fetch=20fun=20from=20afar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ux command line can fetch fun from afar.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20181223 The Linux command line can fetch fun from afar.md diff --git a/sources/tech/20181223 The Linux command line can fetch fun from afar.md b/sources/tech/20181223 The Linux command line can fetch fun from afar.md new file mode 100644 index 0000000000..3b5e77fa27 --- /dev/null +++ b/sources/tech/20181223 The Linux command line can fetch fun from afar.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Linux command line can fetch fun from afar) +[#]: via: (https://opensource.com/article/18/12/linux-toy-remote) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +The Linux command line can fetch fun from afar +====== +Use these tools to access weather, reading material, and more from remote locations. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi) + +We're almost to the end 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 (or actually, collection of toys) is a little different. So far I've mostly tried to focus on toys that are self-contained, and completely usable under an open source license. But I've gotten some great suggestions from readers which utilize an open source tool to access something remotely that may or may not be open source. Today, I'll round up a few of those. + +The first one is a total classic: use Telnet to watch an ASCII-rendition of Star Wars. Chances are that Telnet is already installed on your system, so all you'll need to do is run: + +``` +$ telnet towel.blinkenlights.nl +``` + +I feel like I first saw this one over a decade ago, so it's a bit amazing to me that it's still alive and online. If you've never watched it, set aside some time and go check it out. You won't regret it. + +![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png) + +Next, Opensource.com contributor [Manuel Dewald][2] suggested a way to fetch your local weather from the terminal. It's easy, and only requires that you have **curl** (or, well, **** **wget** ) installed. + +``` +$ curl wttr.in +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png) + +Finally, while you can spend the holidays reading your favorite sites (including Opensource.com) from your favorite [command-line web browser][3], there are a few of my favorite sites that are more easily browsed with a dedicated client. Two of these include Reddit and Hacker News, for which there are clients that have been recommended to me that you may wish to try, mostly available under open source licenses. I've poked around with [haxor-news][4] (Hacker News) and [rtv][5] (Reddit), and both seem pretty cool. + +Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, 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, [Watch YouTube videos at the Linux terminal][6], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-remote + +作者:[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/ntlx +[3]: https://opensource.com/article/16/12/web-browsers-linux-command-line +[4]: https://github.com/donnemartin/haxor-news +[5]: https://github.com/michael-lazar/rtv +[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl From ce9506bca4f84d991f8a05d611e89897e8a8f95e Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:02:11 +0800 Subject: [PATCH 0284/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=207=20CI/CD=20too?= =?UTF-8?q?ls=20for=20sysadmins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181220 7 CI-CD tools for sysadmins.md | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 sources/talk/20181220 7 CI-CD tools for sysadmins.md diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md new file mode 100644 index 0000000000..d645cf2561 --- /dev/null +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +7 CI/CD tools for sysadmins +====== +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 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. + +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. + +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]. + +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. + +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. + +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. + +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. + +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. + +### 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. + +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. + +### 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. + +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. + +### 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 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 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 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. + +### 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 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. + +### 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. + +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. + +### 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 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. + +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 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/cicd-tools-sysadmins + +作者:[Dan Barker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/barkerd427 +[b]: https://github.com/lujun9972 +[1]: https://www.ansible.com/ +[2]: https://www.chef.io/ +[3]: https://puppet.com/ +[4]: https://github.com/test-kitchen/test-kitchen +[5]: https://www.merriam-webster.com/dictionary/ephemeral +[6]: https://en.wikipedia.org/wiki/Idempotence +[7]: https://mjml.io/ +[8]: https://gitlab.com/devopskc/newsletter/blob/master/.gitlab-ci.yml +[9]: https://gitlab.com/devopskc/newsletter/blob/master/index/index.html +[10]: https://gitlab.com/devopskc/newsletter/blob/master/html-to-pdf.js +[11]: https://gitlab.com/devopskc/newsletter/blob/master/populate-index.js +[12]: https://devopskc.com/ +[13]: https://en.wikipedia.org/wiki/Directed_acyclic_graph +[14]: https://www.spinnaker.io/ +[15]: https://jenkins.io/ +[16]: https://martinfowler.com/books/dsl.html +[17]: http://groovy-lang.org/ +[18]: https://about.gitlab.com/product/continuous-integration/ +[19]: https://gitlab.com/gitlab-org/gitlab-ce/ +[20]: https://about.gitlab.com/2017/09/27/gitlab-leader-continuous-integration-forrester-wave/ +[21]: https://github.com/gliderlabs/herokuish +[22]: https://www.gocd.org/getting-started/part-3/#value_stream_map +[23]: https://docs.gocd.org/current/advanced_usage/pipelines_as_code.html +[24]: https://docs.travis-ci.com/ +[25]: https://github.com/travis-ci/travis-ci +[26]: https://github.com/travis-ci/kubernetes-config +[27]: https://jenkins.io/blog/2018/08/31/shifting-gears/ +[28]: https://jenkins.io/projects/jcasc/ +[29]: https://github.com/jenkinsci/jep/blob/master/jep/300/README.adoc +[30]: https://danbarker.codes/talk/lisa17-becoming-plumber-building-deployment-pipelines/ +[31]: https://jenkins-x.io/ +[32]: https://concourse-ci.org/ +[33]: https://github.com/concourse/concourse +[34]: https://docs.screwdriver.cd/cluster-management/kubernetes +[35]: https://github.com/screwdriver-cd/screwdriver-chart From 8942b1cc62d410fcf30597ce1758fc72bf997925 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:03:38 +0800 Subject: [PATCH 0285/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Buil?= =?UTF-8?q?d=20a=20Netboot=20Server,=20Part=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1 How to Build a Netboot Server, Part 3.md | 284 ++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 sources/tech/20181221 How to Build a Netboot Server, Part 3.md diff --git a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md b/sources/tech/20181221 How to Build a Netboot Server, Part 3.md new file mode 100644 index 0000000000..7c4501b58b --- /dev/null +++ b/sources/tech/20181221 How to Build a Netboot Server, Part 3.md @@ -0,0 +1,284 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Build a Netboot Server, Part 3) +[#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +How to Build a Netboot Server, Part 3 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot3-816x345.jpg) + +The [How to Build a Netboot Server, Part 1][1] article provided a minimal [iPXE][2] boot script for your netboot image. Many users probably have a local operating system that they want to use in addition to the netboot image. But switching bootloaders using the typical workstation’s BIOS can be cumbersome. This part of the series shows how to set up some more complex iPXE configurations. These allow the end user to easily choose which operating system they want to boot. They also let the system administrator manage the boot menus from a central server. + +### An interactive iPXE boot menu + +The commands below redefine the netboot image’s boot.cfg as an interactive iPXE boot menu with a 5 second countdown timer: + +``` +$ MY_FVER=29 +$ MY_KRNL=$(ls -c /fc$MY_FVER/lib/modules | head -n 1) +$ MY_DNS1=192.0.2.91 +$ MY_DNS2=192.0.2.92 +$ MY_NAME=server-01.example.edu +$ MY_EMAN=$(echo $MY_NAME | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_NAME}) +$ MY_ADDR=$(host -t A $MY_NAME | awk '{print $4}') +$ cat << END > $HOME/esp/linux/boot.cfg +#!ipxe + +set timeout 5000 + +:menu +menu iPXE Boot Menu +item --key 1 lcl 1. Microsoft Windows 10 +item --key 2 f$MY_FVER 2. RedHat Fedora $MY_FVER +choose --timeout \${timeout} --default lcl selected || goto shell +set timeout 0 +goto \${selected} + +:failed +echo boot failed, dropping to shell... +goto shell + +:shell +echo type 'exit' to get the back to the menu +set timeout 0 +shell +goto menu + +:lcl +exit + +:f$MY_FVER +kernel --name kernel.efi \${prefix}/vmlinuz-$MY_KRNL initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=$MY_DNS1 nameserver=$MY_DNS2 root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc$MY_FVER-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc$MY_FVER console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img \${prefix}/initramfs-$MY_KRNL.img +boot || goto failed +END +``` + +The above menu has five sections: + + * **menu** defines the actual menu that will be shown on the screen. + * **failed** notifies the user that something went wrong and drops the user to a shell so they can troubleshot the problem. + * **shell** provides an interactive command prompt. You can reach it either by pressing the **Esc** key while at the boot menu or if the “boot” command returns with a failure code. + * **lcl** contains a single command that tells iPXE to exit and return control back to the BIOS. Whatever you want to boot by default (e.g. the workstation’s local hard drive) **must** be listed as the next boot item right after iPXE in your workstation’s BIOS. + * **f29** contains the same netboot code used earlier but with the final exit replaced with goto failed. + + + +Copy the updated boot.cfg from your $HOME/esp/linux directory out to the ESPs of all your client systems. If all goes well, you should see results similar to the image below: + +![][3] + +### A server hosted boot menu + +Another feature you can add to the netboot server is the ability to manage all the client boot menus from one central location. This feature can be especially useful when rolling out a new version of the OS. It lets you perform a sort of [atomic transaction][4] to switch all clients over to the new OS after you’ve copied the new kernel and initramfs out to the ESPs of all the clients. + +Install Mojolicious: + +``` +$ sudo -i +# dnf install -y perl-Mojolicious +``` + +Define the “bootmenu” app: + +``` +# mkdir /opt/bootmenu +# cat << END > /opt/bootmenu/bootmenu.pl +#!/usr/bin/env perl +use Mojolicious::Lite; +use Mojolicious::Plugins; + +plugin 'Config'; + +get '/menu'; + +app->start; +END +# chmod 755 /opt/bootmenu/bootmenu.pl +``` + +Define the configuration file for the bootmenu app: + +``` +# cat << END > /opt/bootmenu/bootmenu.conf +{ + hypnotoad => { + listen => ['http://*:80'], + pid_file => '/run/bootmenu/bootmenu.pid', + } +} +END +``` + +This is an extremely simple Mojolicious application that listens on port 80 and only answers to /menu requests. If you want a quick introduction to what Mojolicious can do, run man Mojolicious::Guides::Growing to view the manual. Use the **Q** key to quit the manual. + +Move boot.cfg over to our netboot app as a template named menu.html.ep: + +``` +# mkdir /opt/bootmenu/templates +# mv $HOME/esp/linux/boot.cfg /opt/bootmenu/templates/menu.html.ep +``` + +Define a systemd service to manage the bootmenu app: + +``` +# cat << END > /etc/systemd/system/bootmenu.service +[Unit] +Description=Serves iPXE Menus over HTTP +After=network-online.target + +[Service] +Type=forking +DynamicUser=true +RuntimeDirectory=bootmenu +PIDFile=/run/bootmenu/bootmenu.pid +ExecStart=/usr/bin/hypnotoad /opt/bootmenu/bootmenu.pl +ExecReload=/usr/bin/hypnotoad /opt/bootmenu/bootmenu.pl +AmbientCapabilities=CAP_NET_BIND_SERVICE +KillMode=process + +[Install] +WantedBy=multi-user.target +END +``` + +Add an exception for the HTTP service to the local firewall and start the bootmenu service: + +``` +# firewall-cmd --add-service http +# firewall-cmd --runtime-to-permanent +# systemctl enable bootmenu.service +# systemctl start bootmenu.service +``` + +Test it with wget: + +``` +$ sudo dnf install -y wget +$ MY_BOOTMENU_SERVER=server-01.example.edu +$ wget -q -O - http://$MY_BOOTMENU_SERVER/menu +``` + +The above command should output something similar to the following: + +``` +#!ipxe + +set timeout 5000 + +:menu +menu iPXE Boot Menu +item --key 1 lcl 1. Microsoft Windows 10 +item --key 2 f29 2. RedHat Fedora 29 +choose --timeout ${timeout} --default lcl selected || goto shell +set timeout 0 +goto ${selected} + +:failed +echo boot failed, dropping to shell... +goto shell + +:shell +echo type 'exit' to get the back to the menu +set timeout 0 +shell +goto menu + +:lcl +exit + +:f29 +kernel --name kernel.efi ${prefix}/vmlinuz-4.19.4-300.fc29.x86_64 initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.0.2.91 nameserver=192.0.2.92 root=/dev/disk/by-path/ip-192.0.2.158:3260-iscsi-iqn.edu.example.server-01:fc29-lun-1 netroot=iscsi:192.0.2.158::::iqn.edu.example.server-01:fc29 console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img ${prefix}/initramfs-4.19.4-300.fc29.x86_64.img +boot || goto failed +``` + +Now that the boot menu server is working, rebuild the ipxe.efi bootloader with an init script that points to it. + +First, update the init.ipxe script created in part one of this series: + +``` +$ MY_BOOTMENU_SERVER=server-01.example.edu +$ cat << END > $HOME/ipxe/init.ipxe +#!ipxe + +dhcp || exit +set prefix file:///linux +chain http://$MY_BOOTMENU_SERVER/menu || exit +END +``` + +Now, rebuild the boot loader: + +``` +$ cd $HOME/ipxe/src +$ make clean +$ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe +``` + +Copy the updated bootloader to your ESP: + +``` +$ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi +``` + +After you’ve copied the updated bootloader to all your clients, you can make future updates to the boot menu simply by editing /opt/bootmenu/templates/menu.html.ep and running: + +``` +$ sudo systemctl restart bootmenu.service +``` + +### Making further changes + +If the boot menu server is working properly, you’ll longer need the the boot.cfg file on your client systems. + +For example, re-add the Fedora 28 image to the boot menu: + +``` +$ sudo -i +# MY_FVER=28 +# MY_KRNL=$(ls -c /fc$MY_FVER/lib/modules | head -n 1) +# MY_DNS1=192.0.2.91 +# MY_DNS2=192.0.2.92 +# MY_NAME=$(> /opt/bootmenu/templates/menu.html.ep + +:f$MY_FVER +kernel --name kernel.efi \${prefix}/vmlinuz-$MY_KRNL initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=$MY_DNS1 nameserver=$MY_DNS2 root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc$MY_FVER-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc$MY_FVER console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img \${prefix}/initramfs-$MY_KRNL.img +boot || goto failed +END +# sed -i "/item --key 2/a item --key 3 f$MY_FVER 3. RedHat Fedora $MY_FVER" /opt/bootmenu/templates/menu.html.ep +# systemctl restart bootmenu.service +``` + +If all goes well, your clients should see results similar to the image below the next time they boot: + +![][5] + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ +[2]: https://ipxe.org/ +[3]: https://fedoramagazine.org/wp-content/uploads/2018/11/netboot-menu-1024x641.png +[4]: https://en.wikipedia.org/wiki/Atomicity_(database_systems) +[5]: https://fedoramagazine.org/wp-content/uploads/2018/11/netboot-menu-updated-1024x641.png From c970813fb07650d8caea5de0d5bff7b5014c4f0b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:06:26 +0800 Subject: [PATCH 0286/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Inst?= =?UTF-8?q?all=20Microsoft=20.NET=20Core=20SDK=20On=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nstall Microsoft .NET Core SDK On Linux.md | 337 ++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100644 sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md diff --git a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md new file mode 100644 index 0000000000..728db3b7be --- /dev/null +++ b/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -0,0 +1,337 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Install Microsoft .NET Core SDK On Linux) +[#]: via: (https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Install Microsoft .NET Core SDK On Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/NET-Core-SDK-720x340.png) + +The **.NET Core** is a free, cross platform and open source framework developed by Microsoft to build desktop applications, mobile apps, web apps, IoT apps and gaming apps etc. If you’re dotnet developer coming from Windows platform, .NET core helps you to setup your development environment easily on any Linux and Unix-like operating systems. This step by step guide explains how to install Microsoft .NET Core SDK on Linux and how to write your first app using .Net. + +### Install Microsoft .NET Core SDK On Linux + +The .NET core supports GNU/Linux, Mac OS and Windows. .Net core can be installed on popular GNU/Linux operating systems including Debian, Fedora, CentOS, Oracle Linux, RHEL, SUSE/openSUSE, and Ubuntu. As of writing this guide, the latest .NET core version was **2.2**. + +On **Debian 9** , you can install .NET Core SDK as shown below. + +First of all, you need to register Microsoft key and add .NET repository by running the following commands: + +``` +$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg +$ sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ +$ wget -q https://packages.microsoft.com/config/debian/9/prod.list +$ sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list +$ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg +$ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list +``` + +After registering the key and adding the repository, install .NET SDK using commands: + +``` +$ sudo apt-get update +$ sudo apt-get install dotnet-sdk-2.2 +``` + +**On Debian 8:** + +Add Microsoft key and enable .NET repository: + +``` +$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg +$ sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ +$ wget -q https://packages.microsoft.com/config/debian/8/prod.list +$ sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list +$ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg +$ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list +``` + +Install .NET SDK: + +``` +$ sudo apt-get update +$ sudo apt-get install dotnet-sdk-2.2 +``` + +**On Fedora 28:** + +Add Microsoft key and enable .NET repository: + +``` +$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc +$ wget -q https://packages.microsoft.com/config/fedora/27/prod.repo +$ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo +$ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo +``` + +Now, Install .NET SDK: + +``` +$ sudo dnf update +$ sudo dnf install dotnet-sdk-2.2 +``` + +On **Fedora 27** , add the key and repository using commands: + +``` +$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc +$ wget -q https://packages.microsoft.com/config/fedora/27/prod.repo +$ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo +$ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo +``` + +And install .NET SDK using commands: + +``` +$ sudo dnf update +$ sudo dnf install dotnet-sdk-2.2 +``` + +**On CentOS/Oracle Linux:** + +Add Microsoft key and enable .NET core repository: + +``` +$ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm +``` + +Update the repositories and install .NET SDK: + +``` +$ sudo yum update +$ sudo yum install dotnet-sdk-2.2 +``` + +**On openSUSE Leap:** + +Add key, enable repository and install necessary dependencies using the following commands: + +``` +$ sudo zypper install libicu +$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc +$ wget -q https://packages.microsoft.com/config/opensuse/42.2/prod.repo +$ sudo mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo +$ sudo chown root:root /etc/zypp/repos.d/microsoft-prod.repo +``` + +Update the repositories and Install .NET SDK using commands: + +``` +$ sudo zypper update +$ sudo zypper install dotnet-sdk-2.2 +``` + +**On Ubuntu 18.04 LTS:** + +Register the Microsoft key and .NET core repository using commands: + +``` +$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb +$ sudo dpkg -i packages-microsoft-prod.deb +``` + +Enable ‘Universe’ repository using: + +``` +$ sudo add-apt-repository universe +``` + +Then, install .NET Core SDK using command: + +``` +$ sudo apt-get install apt-transport-https +$sudo apt-get update +$ sudo apt-get install dotnet-sdk-2.2 +``` + +**On Ubuntu 16.04 LTS:** + +Register Microsoft key and .NET repository using commands: + +``` +$ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb +$ sudo dpkg -i packages-microsoft-prod.deb +``` + +And then, Install .NET core SDK: + +``` +$ sudo apt-get install apt-transport-https +$ sudo apt-get update +$ sudo apt-get install dotnet-sdk-2.2 +``` + +### Create Your First App + +We have successfully installed .Net Core SDK in our Linux box. It is time to create our first app using dotnet. + +For the purpose of this guide, I am going to create a new app called **“ostechnixApp”**. To do so, simply run the following command: + +``` +$ dotnet new console -o ostechnixApp +``` + +**Sample output:** + +``` +Welcome to .NET Core! +--------------------- +Learn more about .NET Core: https://aka.ms/dotnet-docs +Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs + +Telemetry +--------- +The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell. + +Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry + +ASP.NET Core +------------ +Successfully installed the ASP.NET Core HTTPS Development Certificate. +To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other platforms refer to the platform specific documentation. +For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. +Getting ready... +The template "Console Application" was created successfully. + +Processing post-creation actions... +Running 'dotnet restore' on ostechnixApp/ostechnixApp.csproj... +Restoring packages for /home/sk/ostechnixApp/ostechnixApp.csproj... +Generating MSBuild file /home/sk/ostechnixApp/obj/ostechnixApp.csproj.nuget.g.props. +Generating MSBuild file /home/sk/ostechnixApp/obj/ostechnixApp.csproj.nuget.g.targets. +Restore completed in 894.27 ms for /home/sk/ostechnixApp/ostechnixApp.csproj. + +Restore succeeded. +``` + +As you can see in the above output, .Net has created a new application of type console. The parameter -o creates a directory named “ostechnixApp” where you store your app data with all necessary files. + +Let us switch to ostechnixApp directory and see what’s in there. + +``` +$ cd ostechnixApp/ +$ ls +obj ostechnixApp.csproj Program.cs +``` + +As you there are three files named **ostechnixApp.csproj** and **Program.cs** and one directory named **obj**. By default, the Program.cs file will contain the code to run the ‘Hello World’ program in the console. Let us have a look at the code. + +``` +$ cat Program.cs +using System; + +namespace ostechnixApp +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} +``` + +To run the newly created app, simply run the following command: + +``` +$ dotnet run +Hello World! +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/run-dotnet.png) + +Simple, isn’t it? Yes, it is! Now, you can write your code in the **Program.cs** file and run it as shown above. + +Alternatively, you can create a new directory, for example mycode, using commands: + +``` +$ mkdir ~/.mycode + +$ cd mycode/ +``` + +…and make that as your new development environment by running the following command: + +``` +$ dotnet new console +``` + +Sample output: + +``` +The template "Console Application" was created successfully. + +Processing post-creation actions... +Running 'dotnet restore' on /home/sk/mycode/mycode.csproj... +Restoring packages for /home/sk/mycode/mycode.csproj... +Generating MSBuild file /home/sk/mycode/obj/mycode.csproj.nuget.g.props. +Generating MSBuild file /home/sk/mycode/obj/mycode.csproj.nuget.g.targets. +Restore completed in 331.87 ms for /home/sk/mycode/mycode.csproj. + +Restore succeeded. +``` + +The above command will create two files named **mycode.csproj** and **Program.cs** and one directory named **obj**. Open the Program.cs file in your favorite editor, delete or modify the existing ‘hello world’ code with your own code. + +Once the code is written, save and close the Program.cs file and run the app using command: + +``` +$ dotnet run +``` + +To check the installed .NET core SDK version, simply run: + +``` +$ dotnet --version +2.2.101 +``` + +To get help, run: + +``` +$ dotnet --help +``` + +### Get Microsoft Visual Studio Code Editor + +To write the code, you can use your favorite editors of your choice. Microsoft has also its own editor named “ **Microsoft Visual Studio Code** ” with support for .NET. It is an open source, lightweight and powerful source code editor. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Python, PHP, Go) and runtimes (such as .NET and Unity). It is a cross-platform code editor, so you can use it in Microsoft Windows, GNU/Linux, and Mac OS X. You can use it if you’re interested. + +To know how to install and use it on Linux, please refer the following guide. + +[Install Microsoft Visual Studio Code In Linux][3] + +[**This page**][1] has some basic tutorials to learn .NET Core and .NET Core SDK tools using Visual Studio Code editor. Go and check them to learn more. + +### Telemetry + +By default, the .NET core SDK will collect the usage data using a feature called **‘Telemetry’**. The collected data is anonymous and shared to the development team and community under the [Creative Commons Attribution License][2]. So the .NET team will understand how the tools are used and decide how they can be improved over time. If you don’t want to share your usage information, you can simply opt-out of telemetry by setting the **DOTNET_CLI_TELEMETRY_OPTOUT** environment variable to **‘1’** or **‘true’** using your favorite shell. + +And, that’s all. You know how to install .NET Core SDK on various Linux platforms and how to create a basic app using it. TO learn more about .NET usage, refer the links given at the end of this guide. + +More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-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://docs.microsoft.com/en-us/dotnet/core/tutorials/index +[2]: https://creativecommons.org/licenses/by/4.0/ +[3]: https://www.ostechnix.com/install-microsoft-visual-studio-code-linux/ From dfe81d4ea0255144219dbbbaee1b93915ecb2a96 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:12:10 +0800 Subject: [PATCH 0287/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20PowerTOP=20?= =?UTF-8?q?=E2=80=93=20Monitors=20Power=20Usage=20and=20Improve=20Laptop?= =?UTF-8?q?=20Battery=20Life=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nd Improve Laptop Battery Life in Linux.md | 411 ++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md 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 new file mode 100644 index 0000000000..a615ffc73a --- /dev/null +++ b/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md @@ -0,0 +1,411 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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/) + +PowerTOP – Monitors Power Usage and Improve Laptop Battery Life in Linux +====== + +We all know, we almost 80-90% migrated from PC (Desktop) to laptop. + +But one thing we want from a laptop, it’s long battery life and we want to use every drop of power. + +So it’s good to know where our power is going and getting waste. + +You can use the powertop utility to see what’s drawing power when your system’s not plugged in. + +You need to run the powertop utility in terminal with super user privilege. + +It will access the hardware and measure power usage. + +### What is PowerTOP + +PowerTOP is a Linux tool to diagnose issues with power consumption and power management. + +It was developed by Intel to enable various power-saving modes in kernel, userspace, and hardware. + +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. + +``` +$ sudo dnf install powertop +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][3]** or **[APT Command][4]** to install PowerTOP. + +``` +$ sudo apt install powertop +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][5]** to install PowerTOP. + +``` +$ sudo pacman -S powertop +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install PowerTOP. + +``` +$ sudo yum install powertop +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install PowerTOP. + +``` +$ sudo zypper install powertop +``` + +### How To Access PowerTOP + +PowerTOP requires super user privilege so, run as root to use PowerTOP utility on your Linux system. + +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 + +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + +The battery reports a discharge rate of 12.6 W +The power consumed was 259 J +The estimated remaining time is 1 hours, 52 minutes + +Summary: 1692.9 wakeups/second, 0.0 GPU ops/seconds, 0.0 VFS ops/sec and 54.9% CPU use + + Usage Events/s Category Description + 9.3 ms/s 529.4 Timer tick_sched_timer + 378.5 ms/s 139.8 Process [PID 2991] /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 8314 -prefMapSize 173895 -schedulerPrefs 00 + 7.5 ms/s 141.7 Timer hrtimer_wakeup + 3.3 ms/s 102.7 Process [PID 1527] /usr/lib/firefox/firefox --new-window + 11.6 ms/s 69.1 Process [PID 1568] /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 173895 -schedulerPrefs 0001, + 6.2 ms/s 59.0 Process [PID 1496] /usr/lib/firefox/firefox --new-window + 2.1 ms/s 59.6 Process [PID 2466] /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 1.8 ms/s 52.3 Process [PID 2052] /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 1.8 ms/s 50.8 Process [PID 3034] /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 8314 -prefMapSize 173895 -schedulerPrefs 00 + 3.6 ms/s 48.4 Process [PID 3009] /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 8314 -prefMapSize 173895 -schedulerPrefs 00 + 7.5 ms/s 46.2 Process [PID 2996] /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 8314 -prefMapSize 173895 -schedulerPrefs 00 + 25.2 ms/s 33.6 Process [PID 1528] /usr/lib/firefox/firefox --new-window + 5.7 ms/s 32.2 Interrupt [7] sched(softirq) + 2.1 ms/s 32.2 Process [PID 1811] /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 19.7 ms/s 25.0 Process [PID 1794] /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 1.9 ms/s 31.5 Process [PID 1596] /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 173895 -schedulerPrefs 0001, + 3.1 ms/s 29.9 Process [PID 1535] /usr/lib/firefox/firefox --new-window + 7.1 ms/s 28.2 Process [PID 1488] /usr/lib/firefox/firefox --new-window + 1.8 ms/s 29.5 Process [PID 1762] /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 8.8 ms/s 23.3 Process [PID 1121] /usr/bin/gnome-shell + 1.2 ms/s 21.8 Process [PID 1657] /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 920 -prefMapSize 173895 -schedulerPrefs 000 + 13.3 ms/s 13.9 Process [PID 1746] /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 2.7 ms/s 11.1 Process [PID 3410] /usr/lib/gnome-terminal-server + 3.8 ms/s 10.8 Process [PID 1057] /usr/lib/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty + 3.1 ms/s 9.8 Process [PID 1629] /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 920 -prefMapSize 173895 -schedulerPrefs 000 + 0.9 ms/s 6.7 Interrupt [136] xhci_hcd + 278.0 us/s 6.4 Process [PID 414] [irq/141-iwlwifi] + 128.7 us/s 5.7 Process [PID 1] /sbin/init + 118.5 us/s 5.2 Process [PID 10] [rcu_preempt] + 49.0 us/s 4.7 Interrupt [0] HI_SOFTIRQ + 459.3 us/s 3.1 Interrupt [142] i915 + 2.1 ms/s 2.3 Process [PID 3451] powertop + 8.4 us/s 2.7 kWork intel_atomic_helper_free_state_ + 1.2 ms/s 1.8 kWork intel_atomic_commit_work + 374.2 us/s 2.1 Interrupt [9] acpi + 42.1 us/s 1.8 kWork intel_atomic_cleanup_work + 3.5 ms/s 0.25 kWork delayed_fput + 238.0 us/s 1.5 Process [PID 907] /usr/lib/upowerd + 17.7 us/s 1.5 Timer intel_uncore_fw_release_timer + 26.4 us/s 1.4 Process [PID 576] [i915/signal:0] + 19.8 us/s 1.3 Timer watchdog_timer_fn + 1.1 ms/s 0.00 Process [PID 206] [kworker/7:2] + 2.4 ms/s 0.00 Interrupt [1] timer(softirq) + 13.4 us/s 0.9 Process [PID 9] [ksoftirqd/0] + + 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. + +### Idle Stats Tab + +It displays various information about the processor. + +``` +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + + + Package | Core | CPU 0 CPU 4 + | | C0 active 6.7% 7.2% + | | POLL 0.0% 0.1 ms 0.0% 0.1 ms + | | C1E 1.2% 0.2 ms 1.6% 0.3 ms +C2 (pc2) 7.5% | | +C3 (pc3) 25.2% | C3 (cc3) 0.7% | C3 0.5% 0.2 ms 0.6% 0.1 ms +C6 (pc6) 0.0% | C6 (cc6) 7.1% | C6 6.6% 0.5 ms 6.3% 0.5 ms +C7 (pc7) 0.0% | C7 (cc7) 59.8% | C7s 0.0% 0.0 ms 0.0% 0.0 ms +C8 (pc8) 0.0% | | C8 33.9% 1.6 ms 32.3% 1.5 ms +C9 (pc9) 0.0% | | C9 2.1% 3.4 ms 0.7% 2.8 ms +C10 (pc10) 0.0% | | C10 39.5% 4.7 ms 41.4% 4.7 ms + + | Core | CPU 1 CPU 5 + | | C0 active 8.3% 7.2% + | | POLL 0.0% 0.0 ms 0.0% 0.1 ms + | | C1E 1.3% 0.2 ms 1.4% 0.3 ms + | | + | C3 (cc3) 0.5% | C3 0.5% 0.2 ms 0.4% 0.2 ms + | C6 (cc6) 6.0% | C6 5.3% 0.5 ms 4.7% 0.5 ms + | C7 (cc7) 59.3% | C7s 0.0% 0.8 ms 0.0% 1.0 ms + | | C8 27.2% 1.5 ms 23.8% 1.4 ms + | | C9 1.6% 3.0 ms 0.5% 3.0 ms + | | C10 44.5% 4.7 ms 52.2% 4.6 ms + + | Core | CPU 2 CPU 6 + | | C0 active 11.2% 8.4% + | | POLL 0.0% 0.0 ms 0.0% 0.0 ms + | | C1E 1.4% 0.4 ms 1.3% 0.3 ms + | | + | C3 (cc3) 0.3% | C3 0.2% 0.1 ms 0.4% 0.2 ms + | C6 (cc6) 4.0% | C6 3.7% 0.5 ms 4.3% 0.5 ms + | C7 (cc7) 54.2% | C7s 0.0% 0.0 ms 0.0% 1.0 ms + | | C8 20.0% 1.5 ms 20.7% 1.4 ms + | | C9 1.0% 3.4 ms 0.4% 3.8 ms + | | C10 48.8% 4.6 ms 52.3% 5.0 ms + + | Core | CPU 3 CPU 7 + | | C0 active 8.8% 8.1% + | | POLL 0.0% 0.1 ms 0.0% 0.0 ms + | | C1E 1.2% 0.2 ms 1.2% 0.2 ms + | | + | C3 (cc3) 0.6% | C3 0.6% 0.2 ms 0.4% 0.2 ms + | C6 (cc6) 7.0% | C6 7.5% 0.5 ms 4.4% 0.5 ms + | C7 (cc7) 56.8% | C7s 0.0% 0.0 ms 0.0% 0.9 ms + | | C8 29.4% 1.4 ms 23.8% 1.4 ms + | | C9 1.1% 2.7 ms 0.7% 3.9 ms + | | C10 41.0% 4.0 ms 50.0% 4.8 ms + + + Exit | / Navigate | +``` + +### Frequency Stats Tab + +It displays the frequency of CPU. + +``` +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + + + Package | Core | CPU 0 CPU 4 + | | Average 930 MHz 1101 MHz +Idle | Idle | Idle + + | Core | CPU 1 CPU 5 + | | Average 1063 MHz 979 MHz + | Idle | Idle + + | Core | CPU 2 CPU 6 + | | Average 976 MHz 942 MHz + | Idle | Idle + + | Core | CPU 3 CPU 7 + | | Average 924 MHz 957 MHz + | Idle | Idle + +``` + +### Device Stats Tab + +It displays power usage information against only devices. + +``` +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + + +The battery reports a discharge rate of 13.8 W +The power consumed was 280 J + + Usage Device name + 46.7% CPU misc + 46.7% DRAM + 46.7% CPU core + 19.0% Display backlight + 0.0% Audio codec hwC0D0: Realtek + 0.0% USB device: Lenovo EasyCamera (160709000341) + 100.0% PCI Device: Intel Corporation HD Graphics 530 + 100.0% Radio device: iwlwifi + 100.0% PCI Device: O2 Micro, Inc. SD/MMC Card Reader Controller + 100.0% PCI Device: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 100.0% USB device: Lenovo Wireless Optical Mouse N100 + 100.0% PCI Device: Intel Corporation Wireless 8260 + 100.0% PCI Device: Intel Corporation HM170/QM170 Chipset SATA Controller [AHCI Mode] + 100.0% Radio device: btusb + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #4 + 100.0% USB device: xHCI Host Controller + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller + 100.0% PCI Device: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #3 + 100.0% PCI Device: Samsung Electronics Co Ltd NVMe SSD Controller SM951/PM951 + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #2 + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #9 + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family SMBus + 26.1 pkts/s Network interface: wlp8s0 (iwlwifi) + 0.0% USB device: usb-device-8087-0a2b + 0.0% runtime-reg-dummy + 0.0% Audio codec hwC0D2: Intel + 0.0 pkts/s Network interface: enp9s0 (r8168) + 0.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller + 0.0% PCI Device: Intel Corporation HM170 Chipset LPC/eSPI Controller + 0.0% PCI Device: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) + 0.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 + 0.0% PCI Device: NVIDIA Corporation GM107M [GeForce GTX 960M] + 0.0% I2C Adapter (i2c-8): nvkm-0000:01:00.0-bus-0005 + 0.0% runtime-PNP0C14:00 + 0.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller + 0.0% runtime-PNP0C0C:00 + 0.0% USB device: xHCI Host Controller + 0.0% runtime-ACPI000C:00 + 0.0% runtime-regulatory.0 + 0.0% runtime-PNP0C14:01 + 0.0% runtime-vesa-framebuffer.0 + 0.0% runtime-coretemp.0 + 0.0% runtime-alarmtimer + + 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 + + +>> Bad Enable SATA link power management for host2 + Bad Enable SATA link power management for host3 + Bad Enable SATA link power management for host0 + Bad Enable SATA link power management for host1 + Bad VM writeback timeout + Bad Autosuspend for USB device Lenovo Wireless Optical Mouse N100 [1-2] + Good Bluetooth device interface status + Good Enable Audio codec power management + Good NMI watchdog should be turned off + Good Runtime PM for I2C Adapter i2c-7 (nvkm-0000:01:00.0-bus-0002) + Good Autosuspend for unknown USB device 1-11 (8087:0a2b) + Good Runtime PM for I2C Adapter i2c-3 (i915 gmbus dpd) + Good Autosuspend for USB device Lenovo EasyCamera [160709000341] + Good Runtime PM for I2C Adapter i2c-1 (i915 gmbus dpc) + Good Runtime PM for I2C Adapter i2c-12 (nvkm-0000:01:00.0-bus-0009) + Good Autosuspend for USB device xHCI Host Controller [usb1] + Good Runtime PM for I2C Adapter i2c-13 (nvkm-0000:01:00.0-aux-000a) + Good Runtime PM for I2C Adapter i2c-2 (i915 gmbus dpb) + Good Runtime PM for I2C Adapter i2c-8 (nvkm-0000:01:00.0-bus-0005) + Good Runtime PM for I2C Adapter i2c-15 (nvkm-0000:01:00.0-aux-000c) + Good Runtime PM for I2C Adapter i2c-16 (nvkm-0000:01:00.0-aux-000d) + Good Runtime PM for I2C Adapter i2c-5 (nvkm-0000:01:00.0-bus-0000) + Good Runtime PM for I2C Adapter i2c-0 (SMBus I801 adapter at 6040) + Good Runtime PM for I2C Adapter i2c-11 (nvkm-0000:01:00.0-bus-0008) + Good Runtime PM for I2C Adapter i2c-14 (nvkm-0000:01:00.0-aux-000b) + Good Autosuspend for USB device xHCI Host Controller [usb2] + Good Runtime PM for I2C Adapter i2c-9 (nvkm-0000:01:00.0-bus-0006) + Good Runtime PM for I2C Adapter i2c-10 (nvkm-0000:01:00.0-bus-0007) + Good Runtime PM for I2C Adapter i2c-6 (nvkm-0000:01:00.0-bus-0001) + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller + Good Runtime PM for PCI Device Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #9 + Good Runtime PM for PCI Device Intel Corporation HD Graphics 530 + Good Runtime PM for PCI Device Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #3 + Good Runtime PM for PCI Device O2 Micro, Inc. SD/MMC Card Reader Controller + Good Runtime PM for PCI Device Intel Corporation HM170 Chipset LPC/eSPI Controller + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 + Good Runtime PM for PCI Device Samsung Electronics Co Ltd NVMe SSD Controller SM951/PM951 + Good Runtime PM for PCI Device Intel Corporation HM170/QM170 Chipset SATA Controller [AHCI Mode] + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #2 + Good Runtime PM for PCI Device Intel Corporation Wireless 8260 + Good Runtime PM for PCI Device Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #4 + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family SMBus + Good Runtime PM for PCI Device NVIDIA Corporation GM107M [GeForce GTX 960M] + + Exit | Toggle tunable | Window refresh +``` + +### How To Generate PowerTop HTML Report + +Run the following command to generate the PowerTop HTML report. + +``` +$ sudo powertop --html=powertop.html +modprobe cpufreq_stats failedLoaded 100 prior measurements +Cannot load from file /var/cache/powertop/saved_parameters.powertop +File will be loaded after taking minimum number of measurement(s) with battery only +RAPL device for cpu 0 +RAPL Using PowerCap Sysfs : Domain Mask f +RAPL device for cpu 0 +RAPL Using PowerCap Sysfs : Domain Mask f +Devfreq not enabled +glob returned GLOB_ABORTED +Cannot load from file /var/cache/powertop/saved_parameters.powertop +File will be loaded after taking minimum number of measurement(s) with battery only +Preparing to take measurements +To show power estimates do 182 measurement(s) connected to battery only +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. +![][9] + +### Auto-Tune mode + +This feature sets all tunable options from `BAD` to `GOOD` which increase the laptop battery life in Linux. + +``` +$ sudo powertop --auto-tune +modprobe cpufreq_stats failedLoaded 210 prior measurements +Cannot load from file /var/cache/powertop/saved_parameters.powertop +File will be loaded after taking minimum number of measurement(s) with battery only +RAPL device for cpu 0 +RAPL Using PowerCap Sysfs : Domain Mask f +RAPL device for cpu 0 +RAPL Using PowerCap Sysfs : Domain Mask f +Devfreq not enabled +glob returned GLOB_ABORTED +Cannot load from file /var/cache/powertop/saved_parameters.powertop +File will be loaded after taking minimum number of measurement(s) with battery only +To show power estimates do 72 measurement(s) connected to battery only +Leaving PowerTOP +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/powertop-monitors-laptop-battery-usage-linux/ + +作者:[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/category/package-management/ +[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/ +[8]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[9]: https://www.2daygeek.com/wp-content/uploads/2015/07/powertop-html-output.jpg From ede5c1de34601550ad3f9c779fc2c0676d2462f6 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:13:33 +0800 Subject: [PATCH 0288/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Watch=20YouTube?= =?UTF-8?q?=20videos=20at=20the=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ch YouTube videos at the Linux terminal.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20181222 Watch YouTube videos at the Linux terminal.md diff --git a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md new file mode 100644 index 0000000000..d2ba12dbeb --- /dev/null +++ b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Watch YouTube videos at the Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Watch YouTube videos at the Linux terminal +====== +Thought video content was just for your GUI? Think again. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a) + +We're almost to the end 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 we're going to double-down on yesterday's toy, [MPlayer][2], and add in one more, [**youtube-dl**][3]. + +As its name would imply, **youtube-dl** is a command-line utility for downloading YouTube videos, but it can capture video from a number of other sites as well, and it's a really quite full-featured application with [thorough documentation][4] to make video acquisition easy. A note: please don't use **youtube-dl** in any context that would violate the copyright laws in your jurisdiction. + +**youtube-dl** is licensed under a public domain dedication known as [the][5] [Unlicense][5] that's similar to Creative Common's [CC0][6]. There are some interesting [legal opinions][7] out there about where public domain dedication fits into the open source landscape, but it's generally considered compatible with existing open source licenses even by organizations who don't recommend its use. + +In its simplest form, we're going to use **youtube-dl** to grab a video for playback in our terminal. First, [install][8] it using a method appropriate for your distribution. For me, in Fedora, it was packaged in my repositories, so installation was as simple as: + +``` +$ sudo dnf install youtube-dl +``` + +Then, let's grab a video. YouTube allows you to search by license, so today, we're going to take a look at a fireplace [video][9] from [Gemmy's Videos][10] available under a Creative Commons attribution license. For YouTube videos, you can download with the file ID alone, like this, and we'll specify an output file name as well. I intentionally picked a short video, since long videos can get quite large! + +``` +$ youtube-dl pec8P5K4s8c -o fireplace.mp4 +``` + +If you didn't install [MPlayer][2] yesterday, go ahead and do that, and you may need to install **libcaca** for your system as well if you did not install it previously. If you just use MPlayer to launch the video from the command line as-is ( **$** **mplayer fireplace.webm** ), it will play, but in a window all of its own; not exactly what we were going for. + +First, I set my **libcaca** settings to force it to use **ncurses** **** as the display driver, keeping the output in my terminal, with: + +``` +$ export CACA_DRIVER=ncurses +``` + +Then, I zoomed way out in my terminal (the more "pixels", the better), and played the file with the following (forcing the use of **libcaca** and silencing text output from MPlayer): + +``` +$ mplayer -really-quiet -vo caca fireplace.mp4 +``` + +And, there you go! +![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif) + +Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, 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, [Listen to the radio at the Linux terminal][2], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-youtube-dl + +作者:[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/article/18/12/linux-toy-mplayer +[3]: https://rg3.github.io/youtube-dl/ +[4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme +[5]: https://unlicense.org/ +[6]: https://creativecommons.org/share-your-work/public-domain/cc0/ +[7]: https://opensource.org/faq#public-domain +[8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation +[9]: https://www.youtube.com/watch?v=pec8P5K4s8c +[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A From 064d04c6b62c113c2970bd1ace0409e68ce6e60b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:15:07 +0800 Subject: [PATCH 0289/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20A=20Tale=20of?= =?UTF-8?q?=20HTTP/2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20181222 A Tale of HTTP-2.md | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20181222 A Tale of HTTP-2.md diff --git a/sources/tech/20181222 A Tale of HTTP-2.md b/sources/tech/20181222 A Tale of HTTP-2.md new file mode 100644 index 0000000000..5484e67148 --- /dev/null +++ b/sources/tech/20181222 A Tale of HTTP-2.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Tale of HTTP/2) +[#]: via: (https://veronneau.org/a-tale-of-http2.html) +[#]: author: (Louis-Philippe Véronneau https://veronneau.org/) + +A Tale of HTTP/2 +====== + +Around a month ago, someone mentioned the existence of [HTTP/2][1] in an IRC channel I lurk in. For some reason, I had never heard of it and some of the features of this new protocol (like mutiplexing requests without having to open multiple TCP connections) seemed cool. + +To be honest, I had just finished re-writing the Puppet code that manages our backup procedures and enabling HTTP/2 seemed like a productive way to procrastinate before moving on to an another large project. How hard could this be? + +Turns out it took me around 25 hours of work... Sit back and put on comfortable slippers, for this is a tale of HTTP/2! + +[![The Yule Log][2]][3] + +### Cursed Be the HTTP/1.1 + +When I first looked up how to enable HTTP/2 on Apache it seemed a pretty simple task. The documentation mentioned loading the `http2` module and making sure to prioritise the new protocol via a configuration file like this one: + +``` +Protocols h2 h2c http/1.1 + +H2Push on +H2PushPriority core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated after +H2PushPriority text/css before +H2PushPriority image/jpeg after 32 +H2PushPriority image/png after 32 +H2PushPriority application/javascript interleaved +``` + +This would of course have been too easy. Even if everything in Apache was set up properly, websites kept being served as HTTP/1.1. I was obviously doing something right though, since my websites were now sending a new HTTP header: `Upgrade: h2, h2c`. + +After wasting a good deal of time debugging TLS ciphers (HTTP/2 is [incompatible with TLS 1.1][4]), I finally found out the problem was that we weren't using the right multi-processing module for Apache. + +Turns out Apache won't let you serve HTTP/2 while using `mpm_prefork` (the default MPM), as it is not supported by `mod_http2`. Even though there are two other MPM you can use with Apache, only `mpm_prefork` supports `mod_php`. Suddenly, adding support for HTTP/2 meant switching all our webapps built in PHP to PHP-FPM... + +### Down the Rabbit Hole + +![A clip from Alice in Wonderlands][5] + +For the longest time, a close friend has been trying to convince me of the virtues of [PHP-FPM][6]. As great as it looked on paper, I never really did anything about it. It seemed so ... complicated. Regular ol' `mod_php` did the trick just fine and other things required my attention. + +This whole HTTP/2 thing turned out to be the perfect excuse for me to dive into it after all. Once I understood how FPM pools worked, it was actually pretty easy to set up. Since I had to rewrite the Puppet profiles we're using to deploy websites, also I took that opportunity to harden a bunch of things left and right. + +PHP-FPM let's you run websites under different Unix users for added separation. On top of that, I decided it was time for PHP code on our servers to be ran in read-only mode and had to tweak a bunch of things for our Wordpress, Nextcloud, KanBoard and Drupal instances to stop complaining about it. + +After too much time passed automating tasks in Puppet, I finally was able to turn off `mod_php` and `mpm_prefork` everywhere and to enable `mpm_event` and `mod_http2`. The speed bonus offered by PHP-FPM and HTTP/2 is nice, but more than anything I'm happy this whole ordeal forced me to harden the way our Apache servers deal with PHP. + +![Victory!][7] + +-------------------------------------------------------------------------------- + +via: https://veronneau.org/a-tale-of-http2.html + +作者:[Louis-Philippe Véronneau][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://veronneau.org/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/HTTP/2 +[2]: https://veronneau.org/media/blog/2018-12-22/yule_log.jpg (The Yule Log) +[3]: https://commons.wikimedia.org/wiki/File:The_Yule_Log.jpg +[4]: https://http2.github.io/http2-spec/#TLSUsage +[5]: https://veronneau.org/media/blog/2018-12-22/mod_php.gif (A clip from Alice in Wonderlands) +[6]: https://wiki.apache.org/httpd/PHP-FPM +[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) From 88f18f9a0c8618915ab90ec9db8ca5bcb2b7a521 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:18:45 +0800 Subject: [PATCH 0290/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20dete?= =?UTF-8?q?ct=20automatically=20generated=20emails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...o detect automatically generated emails.md | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 sources/tech/20181222 How to detect automatically generated emails.md diff --git a/sources/tech/20181222 How to detect automatically generated emails.md b/sources/tech/20181222 How to detect automatically generated emails.md new file mode 100644 index 0000000000..23b509a77b --- /dev/null +++ b/sources/tech/20181222 How to detect automatically generated emails.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to detect automatically generated emails) +[#]: via: (https://arp242.net/weblog/autoreply.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +How to detect automatically generated emails +====== + +### How to detect automatically generated emails + + +When you send out an auto-reply from an email system you want to take care to not send replies to automatically generated emails. At best, you will get a useless delivery failure. At words, you will get an infinite email loop and a world of chaos. + +Turns out that reliably detecting automatically generated emails is not always easy. Here are my observations based on writing a detector for this and scanning about 100,000 emails with it (extensive personal archive and company archive). + +### Auto-submitted header + +Defined in [RFC 3834][1]. + +This is the ‘official’ standard way to indicate your message is an auto-reply. You should **not** send a reply if `Auto-Submitted` is present and has a value other than `no`. + +### X-Auto-Response-Suppress header + +Defined [by Microsoft][2] + +This header is used by Microsoft Exchange, Outlook, and perhaps some other products. Many newsletters and such also set this. You should **not** send a reply if `X-Auto-Response-Suppress` contains `DR` (“Suppress delivery reports”), `AutoReply` (“Suppress auto-reply messages other than OOF notifications”), or `All`. + +### List-Id and List-Unsubscribe headers + +Defined in [RFC 2919][3] + +You usually don’t want to send auto-replies to mailing lists or news letters. Pretty much all mail lists and most newsletters set at least one of these headers. You should **not** send a reply if either of these headers is present. The value is unimportant. + +### Feedback-ID header + +Defined [by Google][4]. + +Gmail uses this header to identify mail newsletters, and uses it to generate statistics/reports for owners of those newsletters. You should **not** send a reply if this headers is present; the value is unimportant. + +### Non-standard ways + +The above methods are well-defined and clear (even though some are non-standard). Unfortunately some email systems do not use any of them :-( Here are some additional measures. + +#### Precedence header + +Not really defined anywhere, mentioned in [RFC 2076][5] where its use is discouraged (but this header is commonly encountered). + +Note that checking for the existence of this field is not recommended, as some ails use `normal` and some other (obscure) values (this is not very common though). + +My recommendation is to **not** send a reply if the value case-insensitively matches `bulk`, `auto_reply`, or `list`. + +#### Other obscure headers + +A collection of other (somewhat obscure) headers I’ve encountered. I would recommend **not** sending an auto-reply if one of these is set. Most mails also set one of the above headers, but some don’t (but it’s not very common). + + * `X-MSFBL`; can’t really find a definition (Microsoft header?), but I only have auto-generated mails with this header. + + * `X-Loop`; not really defined anywhere, and somewhat rare, but sometimes it’s set. It’s most often set to the address that should not get emails, but `X-Loop: yes` is also encountered. + + * `X-Autoreply`; fairly rare, and always seems to have a value of `yes`. + + + + +#### Email address + +Check if the `From` or `Reply-To` headers contains `noreply`, `no-reply`, or `no_reply` (regex: `^no.?reply@`). + +#### HTML only + +If an email only has a HTML part, but no text part it’s a good indication this is an auto-generated mail or newsletter. Pretty much all mail clients also set a text part. + +#### Delivery failures + +Many delivery failure messages don’t really indicate that they’re failures. Some ways to check this: + + * `From` contains `mailer-daemon` or `Mail Delivery Subsystem` + + + +Many mail libraries leave some sort of footprint, and most regular mail clients override this with their own data. Checking for this seems to work fairly well. + + * `X-Mailer: Microsoft CDO for Windows 2000` – Set by some MS software; I can only find it on autogenerated mails. Yes, it’s still used in 2015. + + * `Message-ID` header contains `.JavaMail.` – I’ve found a few (5 on 50k) regular messages with this, but not many; the vast majority (thousends) of messages are news-letters, order confirmations, etc. + + * `^X-Mailer` starts with `PHP`. This should catch both `X-Mailer: PHP/5.5.0` and `X-Mailer: PHPmailer blah blah`. The same as `JavaMail` applies. + + * `X-Library` presence; only [Indy][6] seems to set this. + + * `X-Mailer` starts with `wdcollect`. Set by some Plesk mails. + + * `X-Mailer` starts with `MIME-tools`. + + + + +### Final precaution: limit the number of replies + +Even when following all of the above advice, you may still encounter an email program that will slip through. This can very dangerous, as email systems that simply `IF email THEN send_email` have the potential to cause infinite email loops. + +For this reason, I recommend keeping track of which emails you’ve sent an autoreply to and rate limiting this to at most n emails in n minutes. This will break the back-and-forth chain. + +We use one email per five minutes, but something less strict will probably also work well. + +### What you need to set on your auto-response + +The specifics for this will vary depending on what sort of mails you’re sending. This is what we use for auto-reply mails: + +``` +Auto-Submitted: auto-replied +X-Auto-Response-Suppress: All +Precedence: auto_reply +``` + +### Feedback + +You can mail me at [martin@arp242.net][7] or [create a GitHub issue][8] for feedback, questions, etc. + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/autoreply.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]: http://tools.ietf.org/html/rfc3834 +[2]: https://msdn.microsoft.com/en-us/library/ee219609(v=EXCHG.80).aspx +[3]: https://tools.ietf.org/html/rfc2919) +[4]: https://support.google.com/mail/answer/6254652?hl=en +[5]: http://www.faqs.org/rfcs/rfc2076.html +[6]: http://www.indyproject.org/index.en.aspx +[7]: mailto:martin@arp242.net +[8]: https://github.com/Carpetsmoker/arp242.net/issues/new From a5904dada661270b96bb72413f35cac575a936a8 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:24:25 +0800 Subject: [PATCH 0291/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Top=2011=20best?= =?UTF-8?q?=20Image=20Viewer=20for=20Ubuntu=20and=20other=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Image Viewer for Ubuntu and other Linux.md | 344 ++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md diff --git a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md new file mode 100644 index 0000000000..5aea9702e7 --- /dev/null +++ b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -0,0 +1,344 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 11 best Image Viewer for Ubuntu and other Linux) +[#]: via: (https://itsfoss.com/image-viewers-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Top 11 best Image Viewer for Ubuntu and other Linux +====== + +It is probably a good idea to stick with the default system image viewer unless you want a specific feature (that’s missing) or if you crave for better user experience. + +However, if you like to experiment, you may try out different image viewers. You could end up loving the new user experience of viewing the images or get hooked on to the extra features offered. + +In this article, we have mentioned every kind of image viewers ranging from the simplest to the most advanced tool available for Ubuntu or any other Linux distro. + +### Best Image Viewers for Linux + +![Best image viewers for Ubuntu and other Linux distributions][1] + +**Note:** You should be able to find these image viewers listed in your software center or AppCenter. If you don’t find it there, we’ve mentioned the instructions for manual installation as well. + +#### 1. Nomacs + +![nomacs image viewer][2] + +**What’s good about it?** + + * Simple & Fast UI + * Image adjustment tools (color & size) + * Geolocation of the image + * Metadata information panel + * LAN Synchronization + * Fullscreen mode + + + +A free and open source image viewer that does not come baked with any fancy features. However, Nomacs does support most of the common image file formats if you want to use it. + +The user interface is very simple but it does offer some essential features for image adjustment (color, brightness, resize, crop, & cut). In addition to that, it also supports fullscreen mode, histogram, and a lot of different panels that you can toggle for metadata, edit history, and more such information. + +**How do I install it?** + +You can find it listed in the software center/AppCenter for easy installation. If you want to install it via terminal, you can take a look at their [GitHub page][3] or type in the command below: + +``` +sudo apt install nomacs +``` + +#### 2. Eye Of Gnome +![eye of gnome][4] + +**What’s good about it?** + + * A dead simple image viewer + * Slideshow style (if that’s what you like) + * An image viewer tailored for GNOME desktop environment + + + +This is a classic image viewer developed as a part of The GNOME Project a lot of years ago. Do note that this isn’t actively maintained anymore. But, it still works on Ubuntu’s latest LTS release and several other Linux distros. + +If you want a dead simple image viewer where you browse through the images in a slideshow-type UI and get the meta info in the sidebar, Eye of GNOME should be your choice. One of the best for GNOME desktop environment! + +**How do I install it?** + +To manually install it on Ubuntu (or Ubuntu-based Linux distros) type in the following command: + +``` +sudo apt install eog +``` + +For other distros and source, you should follow the [GitHub page.][5] + +#### 3. Eye Of MATE Image Viewer + +![eye of mate image viewer][6] + +**What’s good about it?** + + * A simple image viewer + * Plugins supported + * An image viewer tailored for MATE desktop environment + + + +Yet another simple image viewer with the basic functionalities of slideshow view and rotating images. + +Even if doesn’t support any image manipulation feature, it does support numerous image file formats and can handle big image files. + +**How do I install it?** + +For Ubuntu/Ubuntu-based distros, type in the following command: + +``` +sudo apt install eom +``` + +If you need help for other distros and the source, follow their [GitHub page][7]. + +#### 4. Geeqie +![geeqie image viewer][8] + +**What’s good about it?** + + * A flexible image manager that supports plugins (you’ll find other image viewers supported as well) + * Information about the color profile + + + +Geeqie is an impressive image manager and viewer. It supports other image viewers as plugins but does not offer any image manipulation tools. + +If you need to know the color profile, image info, and manage/view a collection of images. It should be a good choice for that. + +**How do I install it?** + +Type in the terminal: + +``` +sudo apt install geeqie +``` + +For the source, you can refer the [GitHub page][9]. + +#### 5. gThumb Image Viewer + +![gthumb image viewer][10] + +**What’s good about it?** + + * An all-in-one image viewer with the ability to manage, edit and view the images + * Reset EXIF orientation + * Convert image formats + * Find duplicate images + + + +gThumb is an amazing image viewer with a lot of features. You get an impressive user interface to view/manage your images along with the basic image manipulation tools (crop, resize, color, and so on.) + +You can also add comments to an image or reset the EXIF orientation info. It also gives you the ability to find duplicate images and convert image formats. + +**How do I install it?** + +You can enter this command in the terminal: + +``` +sudo apt install gthumb +``` + +If that doesn’t work, head to the [GitHub page][11] for more info. + +#### 6. Gwenview +![gwenview image viewer][12] + +**What’s good about it?** + + * A basic image viewer with common image manipulation tools to rotate and resize + * Feature extension using KIPI plugins + + + +Gwenview is just another basic image viewer tailored for KDE desktop environment. However, you can install it on other desktop environments as well. + +If you utilize the Konqueror web browser, you can use it as an embedded image viewer. Here, you can add comments/description to the image as well. In addition, it supports [KIPI][13] plugins. + +**How do I install it?** + +Type the following in the terminal to install it: + +``` +sudo apt install gwenview +``` + +For the source, check out their [GitHub page][14]. + +#### 7. Mirage + +![mirage image viewer][15] + +**What’s good about it?** + + * Customizable interface even it is a basic UI + * Basic image manipulation tools + * Command-line access + + + +If you want a decent image viewer along with the ability to access it via command line, a fullscreen mode, slideshow mode, basic editing tools to resize/crop/rotate/flip, and a configurable interface – Mirage would be the simplest option. + +It is a very fast and capable image viewer that supports a lot of image formats that include png, jpg, svg, xpm, gif, bmp, and tifff. + +**How do I install it?** + +You need to type in the following: + +``` +sudo apt install mirage +``` + +For the source code and other installation instructions, refer the [GitHub page][16]. + +#### 8. KPhotoAlbum +![][17] + +**What’s good about it?** + + * Perfect image manager to tag and manage the pictures + * Demo databases + * Image compression + * Merge/Remove images to/from Stack + + + +KPhotoAlbum is not exactly a dedicated image viewer but a photo manager to tag and manage the pictures you’ve got. + +You can opt for slideshows to view the image along with the ability to compress images and search them using the labels/tags. + +**How do I install it?** + +You can install it via the terminal by typing in: + +``` +sudo apt kphotoalbum +``` + +In either case, you can check for the [official instructions on their website][18] to get it installed on your Linux distro. + +#### 9. Shotwell + +![shotwell][19] + +**What’s good about it?** + + * Red-eye correction tool + * Upload photos to Facebook, Flickr, etc. + * Supports RAW file formats as well + + + +Shotwell is a feature-rich photo manager. You can view and manage your photos. Although you do not get all the basic image manipulation tools baked in it – you can easily crop and enhance your photos in a single click (auto brightness/contrast adjustments). + +**How do I install it?** + +Go to the terminal and enter the following (Ubuntu/Ubuntu-based distros): + +sudo apt install shotwell + +For more information, check out their [GitHub page][20]. + +#### 10. Ristretto + +![ristretto][21] + +**What’s good about it?** + + * A dead simple image viewer + * Fullscreen mode & Slideshow + + + +A very straightforward image viewer where you just get the ability to zoom, view in fullscreen mode and view the images as a slideshow. + +It is tailored for Xfce desktop environment – but you can install it anywhere. + +**How do I install it?** + +Even though it’s built for Xfce desktop environment, you can install it on any Ubuntu/Ubuntu-based distro by typing the following command in the terminal: + +``` +sudo apt install ristretto +``` +#### 11. digiKam + +![digikam image viewer][22] + +**What’s good about it?** + + * An all-in-one image viewer with advanced photo management features (editing/managing/viewing) + * Batch Queue Manager + * [Light Table][23] + + + +digiKam is an advanced photo manager with some additional image manipulation tools. You get the ability to configure the database using SQLite or MySQL. + +To enhance your experience of viewing images, it lets you choose the reduced version of images while you preview them. So, that becomes super fast even if you have a lot of images. You get several import/export options via Google, Facebook, Imgur, and so on. If you want a feature-rich image viewer, this is the one you should have installed. + +**How do I install it?** + +Type in the following command: + +``` +sudo apt install digikam +``` + +For more information, visit their [GitHub page][24]. + +### Wrapping Up + +So, no matter whether you want a different user experience or a rich set of features and powerful tools to manage your photos – there’s something everyone. + +Which image viewer do you prefer to use? Is it the system’s default viewer? + +Let us know in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/image-viewers-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://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/best-image-viewers-linux.png?resize=800%2C450&ssl=1 +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/nomacs-image-viewer.jpg?resize=800%2C455&ssl=1 +[3]: https://github.com/nomacs/nomacs +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/eye-of-gnome-image-viewer.jpg?resize=800%2C470&ssl=1 +[5]: https://github.com/GNOME/eog +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/eye-of-mate-image-viewer.jpg?resize=800%2C464&ssl=1 +[7]: https://github.com/mate-desktop/eom +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/geeqie-image-viewer.jpg?resize=800%2C444&ssl=1 +[9]: https://github.com/BestImageViewer/geeqie +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/gthumb-image-viewer.jpg?resize=800%2C515&ssl=1 +[11]: https://github.com/GNOME/gthumb +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/gwenview-image-viewer.jpg?resize=800%2C517&ssl=1 +[13]: https://en.wikipedia.org/wiki/KDE_Image_Plugin_Interface +[14]: https://github.com/KDE/gwenview +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/mirage-image-viewer.jpg?resize=800%2C475&ssl=1 +[16]: https://github.com/xiongchiamiov/Mirage +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/kphotoalbum-viewer.jpg?fit=800%2C522&ssl=1 +[18]: https://www.kphotoalbum.org/download/ +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/shotwell-image-viewer.jpg?resize=800%2C473&ssl=1 +[20]: https://github.com/GNOME/shotwell +[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/ristretto-image-viewer.jpg?resize=800%2C437&ssl=1 +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/digitkam-image-viewer.jpg?resize=800%2C550&ssl=1 +[23]: https://docs.kde.org/trunk5/en/extragear-graphics/digikam/using-lighttable.html +[24]: https://github.com/KDE/digikam From 4a8a185e089337c534547e94d6146f02cfa90697 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:28:03 +0800 Subject: [PATCH 0292/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Large=20files?= =?UTF-8?q?=20with=20Git:=20LFS=20and=20git-annex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Large files with Git- LFS and git-annex.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/tech/20181221 Large files with Git- LFS and git-annex.md 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 new file mode 100644 index 0000000000..29a76f810f --- /dev/null +++ b/sources/tech/20181221 Large files with Git- LFS and git-annex.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Large files with Git: LFS and git-annex) +[#]: via: (https://anarc.at/blog/2018-12-21-large-files-with-git/) +[#]: author: (Anarc.at https://anarc.at/) + +Large files with Git: LFS and git-annex +====== + +Git does not handle large files very well. While there is work underway to handle large repositories through the [commit graph work][2], Git's internal design has remained surprisingly constant throughout its history, which means that storing large files into Git comes with a significant and, ultimately, prohibitive performance cost. Thankfully, other projects are helping Git address this challenge. This article compares how Git LFS and git-annex address this problem and should help readers pick the right solution for their needs. + +### The problem with large files + +As readers probably know, Linus Torvalds wrote Git to manage the history of the kernel source code, which is a large collection of small files. Every file is a "blob" in Git's object store, addressed by its cryptographic hash. A new version of that file will store a new blob in Git's history, with no deduplication between the two versions. The pack file format can store binary deltas between similar objects, but if many objects of similar size change in a repository, that algorithm might fail to properly deduplicate. In practice, large binary files (say JPEG images) have an irritating tendency of changing completely when even the smallest change is made, which makes delta compression useless. + +There have been different attempts at fixing this in the past. In 2006, Torvalds worked on [improving the pack-file format][3] to reduce object duplication between the index and the pack files. Those changes were eventually reverted because, as Nicolas Pitre [put it][4]: "that extra loose object format doesn't appear to be worth it anymore". + +Then in 2009, [Caca Labs][5] worked on improving the `fast-import` and `pack-objects` Git commands to do special handling for big files, in an effort called [git-bigfiles][6]. Some of those changes eventually made it into Git: for example, since [1.7.6][7], Git will stream large files directly to a pack file instead of holding them all in memory. But files are still kept forever in the history. + +An example of trouble I had to deal with is for the Debian security tracker, which follows all security issues in the entire Debian history in a single file. That file is around 360,000 lines for a whopping 18MB. The resulting repository takes 1.6GB of disk space and a local clone takes 21 minutes to perform, mostly taken up by Git resolving deltas. Commit, push, and pull are noticeably slower than a regular repository, taking anywhere from a few seconds to a minute depending one how old the local copy is. And running annotate on that large file can take up to ten minutes. So even though that is a simple text file, it's grown large enough to cause significant problems for Git, which is otherwise known for stellar performance. + +Intuitively, the problem is that Git needs to copy files into its object store to track them. Third-party projects therefore typically solve the large-files problem by taking files out of Git. In 2009, Git evangelist Scott Chacon released [GitMedia][8], which is a Git filter that simply takes large files out of Git. Unfortunately, there hasn't been an official release since then and it's [unclear][9] if the project is still maintained. The next effort to come up was [git-fat][10], first released in 2012 and still maintained. But neither tool has seen massive adoption yet. If I would have to venture a guess, it might be because both require manual configuration. Both also require a custom server (rsync for git-fat; S3, SCP, Atmos, or WebDAV for GitMedia) which limits collaboration since users need access to another service. + +### Git LFS + +That was before GitHub [released][11] Git Large File Storage (LFS) in August 2015. Like all software taking files out of Git, LFS tracks file hashes instead of file contents. So instead of adding large files into Git directly, LFS adds a pointer file to the Git repository, which looks like this: + +``` +version https://git-lfs.github.com/spec/v1 +oid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393 +size 12345 +``` + +LFS then uses Git's smudge and clean filters to show the real file on checkout. Git only stores that small text file and does so efficiently. The downside, of course, is that large files are not version controlled: only the latest version of a file is kept in the repository. + +Git LFS can be used in any repository by installing the right hooks with `git lfs install` then asking LFS to track any given file with `git lfs track`. This will add the file to the `.gitattributes` file which will make Git run the proper LFS filters. It's also possible to add patterns to the `.gitattributes` file, of course. For example, this will make sure Git LFS will track MP3 and ZIP files: + +``` +$ cat .gitattributes +*.mp3 filter=lfs -text +*.zip filter=lfs -text +``` + +After this configuration, we use Git normally: `git add`, `git commit`, and so on will talk to Git LFS transparently. + +The actual files tracked by LFS are copied to a path like `.git/lfs/objects/{OID-PATH}`, where `{OID-PATH}` is a sharded file path of the form `OID[0:2]/OID[2:4]/OID` and where `OID` is the content's hash (currently SHA-256) of the file. This brings the extra feature that multiple copies of the same file in the same repository are automatically deduplicated, although in practice this rarely occurs. + +Git LFS will copy large files to that internal storage on `git add`. When a file is modified in the repository, Git notices, the new version is copied to the internal storage, and the pointer file is updated. The old version is left dangling until the repository is pruned. + +This process only works for new files you are importing into Git, however. If a Git repository already has large files in its history, LFS can fortunately "fix" repositories by retroactively rewriting history with [git lfs migrate][12]. This has all the normal downsides of rewriting history, however --- existing clones will have to be reset to benefit from the cleanup. + +LFS also supports [file locking][13], which allows users to claim a lock on a file, making it read-only everywhere except in the locking repository. This allows users to signal others that they are working on an LFS file. Those locks are purely advisory, however, as users can remove other user's locks by using the `--force` flag. LFS can also [prune][14] old or unreferenced files. + +The main [limitation][15] of LFS is that it's bound to a single upstream: large files are usually stored in the same location as the central Git repository. If it is hosted on GitHub, this means a default quota of 1GB storage and bandwidth, but you can purchase additional "packs" to expand both of those quotas. GitHub also limits the size of individual files to 2GB. This [upset][16] some users surprised by the bandwidth fees, which were previously hidden in GitHub's cost structure. + +While the actual server-side implementation used by GitHub is closed source, there is a [test server][17] provided as an example implementation. Other Git hosting platforms have also [implemented][18] support for the LFS [API][19], including GitLab, Gitea, and BitBucket; that level of adoption is something that git-fat and GitMedia never achieved. LFS does support hosting large files on a server other than the central one --- a project could run its own LFS server, for example --- but this will involve a different set of credentials, bringing back the difficult user onboarding that affected git-fat and GitMedia. + +Another limitation is that LFS only supports pushing and pulling files over HTTP(S) --- no SSH transfers. LFS uses some [tricks][20] to bypass HTTP basic authentication, fortunately. This also might change in the future as there are proposals to add [SSH support][21], resumable uploads through the [tus.io protocol][22], and other [custom transfer protocols][23]. + +Finally, LFS can be slow. Every file added to LFS takes up double the space on the local filesystem as it is copied to the `.git/lfs/objects` storage. The smudge/clean interface is also slow: it works as a pipe, but buffers the file contents in memory each time, which can be prohibitive with files larger than available memory. + +### git-annex + +The other main player in large file support for Git is git-annex. We [covered the project][24] back in 2010, shortly after its first release, but it's certainly worth discussing what has changed in the eight years since Joey Hess launched the project. + +Like Git LFS, git-annex takes large files out of Git's history. The way it handles this is by storing a symbolic link to the file in `.git/annex`. We should probably credit Hess for this innovation, since the Git LFS storage layout is obviously inspired by git-annex. The original design of git-annex introduced all sorts of problems however, especially on filesystems lacking symbolic-link support. So Hess has implemented different solutions to this problem. Originally, when git-annex detected such a "crippled" filesystem, it switched to [direct mode][25], which kept files directly in the work tree, while internally committing the symbolic links into the Git repository. This design turned out to be a little confusing to users, including myself; I have managed to shoot myself in the foot more than once using this system. + +Since then, git-annex has adopted a different v7 mode that is also based on smudge/clean filters, which it called "[unlocked files][26]". Like Git LFS, unlocked files will double disk space usage by default. However it is possible to reduce disk space usage by using "thin mode" which uses hard links between the internal git-annex disk storage and the work tree. The downside is, of course, that changes are immediately performed on files, which means previous file versions are automatically discarded. This can lead to data loss if users are not careful. + +Furthermore, git-annex in v7 mode suffers from some of the performance problems affecting Git LFS, because both use the smudge/clean filters. Hess actually has [ideas][27] on how the smudge/clean interface could be improved. He proposes changing Git so that it stops buffering entire files into memory, allows filters to access the work tree directly, and adds the hooks he found missing (for `stash`, `reset`, and `cherry-pick`). Git-annex already implements some tricks to work around those problems itself but it would be better for those to be implemented in Git natively. + +Being more distributed by design, git-annex does not have the same "locking" semantics as LFS. Locking a file in git-annex means protecting it from changes, so files need to actually be in the "unlocked" state to be editable, which might be counter-intuitive to new users. In general, git-annex has some of those unusual quirks and interfaces that often come with more powerful software. + +And git-annex is much more powerful: it not only addresses the "large-files problem" but goes much further. For example, it supports "partial checkouts" --- downloading only some of the large files. I find that especially useful to manage my video, music, and photo collections, as those are too large to fit on my mobile devices. Git-annex also has support for location tracking, where it knows how many copies of a file exist and where, which is useful for archival purposes. And while Git LFS is only starting to look at transfer protocols other than HTTP, git-annex already supports a [large number][28] through a [special remote protocol][29] that is fairly easy to implement. + +"Large files" is therefore only scratching the surface of what git-annex can do: I have used it to build an [archival system for remote native communities in northern Québec][30], while others have built a [similar system in Brazil][31]. It's also used by the scientific community in projects like [GIN][32] and [DataLad][33], which manage terabytes of data. Another example is the [Japanese American Legacy Project][34] which manages "upwards of 100 terabytes of collections, transporting them from small cultural heritage sites on USB drives". + +Unfortunately, git-annex is not well supported by hosting providers. GitLab [used to support it][35], but since it implemented Git LFS, it [dropped support for git-annex][36], saying it was a "burden to support". Fortunately, thanks to git-annex's flexibility, it may eventually be possible to treat [LFS servers as just another remote][37] which would make git-annex capable of storing files on those servers again. + +### Conclusion + +Git LFS and git-annex are both mature and well maintained programs that deal efficiently with large files in Git. LFS is easier to use and is well supported by major Git hosting providers, but it's less flexible than git-annex. + +Git-annex, in comparison, allows you to store your content anywhere and espouses Git's distributed nature more faithfully. It also uses all sorts of tricks to save disk space and improve performance, so it should generally be faster than Git LFS. Learning git-annex, however, feels like learning Git: you always feel you are not quite there and you can always learn more. It's a double-edged sword and can feel empowering for some users and terrifyingly hard for others. Where you stand on the "power-user" scale, along with project-specific requirements will ultimately determine which solution is the right one for you. + +Ironically, after thorough evaluation of large-file solutions for the Debian security tracker, I ended up proposing to rewrite history and [split the file by year][38] which improved all performance markers by at least an order of magnitude. As it turns out, keeping history is critical for the security team so any solution that moves large files outside of the Git repository is not acceptable to them. Therefore, before adding large files into Git, you might want to think about organizing your content correctly first. But if large files are unavoidable, the Git LFS and git-annex projects allow users to keep using most of their current workflow. + +> This article [first appeared][39] in the [Linux Weekly News][40]. + +-------------------------------------------------------------------------------- + +via: https://anarc.at/blog/2018-12-21-large-files-with-git/ + +作者:[Anarc.at][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://anarc.at/ +[b]: https://github.com/lujun9972 +[1]: https://anarc.at/blog/ +[2]: https://github.com/git/git/blob/master/Documentation/technical/commit-graph.txt +[3]: https://public-inbox.org/git/Pine.LNX.4.64.0607111010320.5623@g5.osdl.org/ +[4]: https://public-inbox.org/git/alpine.LFD.0.99.0705091422130.24220@xanadu.home/ +[5]: http://caca.zoy.org/ +[6]: http://caca.zoy.org/wiki/git-bigfiles +[7]: https://public-inbox.org/git/7v8vsnz2nc.fsf@alter.siamese.dyndns.org/ +[8]: https://github.com/alebedev/git-media +[9]: https://github.com/alebedev/git-media/issues/15 +[10]: https://github.com/jedbrown/git-fat +[11]: https://blog.github.com/2015-04-08-announcing-git-large-file-storage-lfs/ +[12]: https://github.com/git-lfs/git-lfs/blob/master/docs/man/git-lfs-migrate.1.ronn +[13]: https://github.com/git-lfs/git-lfs/wiki/File-Locking +[14]: https://github.com/git-lfs/git-lfs/blob/master/docs/man/git-lfs-prune.1.ronn +[15]: https://github.com/git-lfs/git-lfs/wiki/Limitations +[16]: https://medium.com/@megastep/github-s-large-file-storage-is-no-panacea-for-open-source-quite-the-opposite-12c0e16a9a91 +[17]: https://github.com/git-lfs/lfs-test-server +[18]: https://github.com/git-lfs/git-lfs/wiki/Implementations%0A +[19]: https://github.com/git-lfs/git-lfs/tree/master/docs/api +[20]: https://github.com/git-lfs/git-lfs/blob/master/docs/api/authentication.md +[21]: https://github.com/git-lfs/git-lfs/blob/master/docs/proposals/ssh_adapter.md +[22]: https://tus.io/ +[23]: https://github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md +[24]: https://lwn.net/Articles/419241/ +[25]: http://git-annex.branchable.com/direct_mode/ +[26]: https://git-annex.branchable.com/tips/unlocked_files/ +[27]: http://git-annex.branchable.com/todo/git_smudge_clean_interface_suboptiomal/ +[28]: http://git-annex.branchable.com/special_remotes/ +[29]: http://git-annex.branchable.com/special_remotes/external/ +[30]: http://isuma-media-players.readthedocs.org/en/latest/index.html +[31]: https://github.com/RedeMocambos/baobaxia +[32]: https://web.gin.g-node.org/ +[33]: https://www.datalad.org/ +[34]: http://www.densho.org/ +[35]: https://docs.gitlab.com/ee/workflow/git_annex.html +[36]: https://gitlab.com/gitlab-org/gitlab-ee/issues/1648 +[37]: https://git-annex.branchable.com/todo/LFS_API_support/ +[38]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908678#52 +[39]: https://lwn.net/Articles/774125/ +[40]: http://lwn.net/ From 3051b5772bb5aef0b5a6cb4bcce8db27adc7d725 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:29:18 +0800 Subject: [PATCH 0293/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Listen=20to=20t?= =?UTF-8?q?he=20radio=20at=20the=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...sten to the radio at the Linux terminal.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20181221 Listen to the radio at the Linux terminal.md diff --git a/sources/tech/20181221 Listen to the radio at the Linux terminal.md b/sources/tech/20181221 Listen to the radio at the Linux terminal.md new file mode 100644 index 0000000000..268ba37568 --- /dev/null +++ b/sources/tech/20181221 Listen to the radio at the Linux terminal.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Listen to the radio at the Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-mplayer) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Listen to the radio at the Linux terminal +====== +MPlayer is an extremely versatile open source media player that can be surprisingly useful at the Linux command line. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-mplayer.png?itok=6iTm3Xi7) + +You've found your way to our 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. 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. + +There are many ways to listen to music at the command line; if you've got media stored locally, **cmus** is a great option, but there are [plenty of others][1] as well. + +Lots of times when I'm at the terminal, though, I'd really rather just zone out and not pay close attention to picking each song, and let someone else do the work. While I've got plenty of playlists that work for just such a purpose, after a while, even though go stale, and I'll switch over to an internet radio station. + +Today's toy, MPlayer, is a versatile multimedia player that will support just about any media format you throw at it. If MPlayer is not already installed, you can probably find it packaged for your distribution. On Fedora, I found it in [RPM Fusion][2] (be aware that this is not an "official" repository for Fedora, so exercise caution): + +``` +$ sudo dnf install mplayer +``` + +MPlayer has a slew of command-line options to set depending on your situation. I wanted to listen to the local college radio station here in Raleigh ([88.1 WKNC,][3] they're pretty good!), and so after grabbing the streaming URL from their website, all that took to get my radio up and running, no GUI or web player needed, was: + +``` +$ mplayer -nocache -afm ffmpeg http://wknc.sma.ncsu.edu:8000/wknchd1.mp3 +``` + +MPlayer is open source under the GPLv3, and you can find out more about the project and download source code from the project's [website][4]. + +As I mentioned in yesterday's article, I'm trying to use a screenshot of each toy as the lead image for each article, but as we moved into the world of audio, I had to fudge it a little. So today's image was created from a public domain icon of a radio tower using **img2txt** , which is provided by the **libcaca** package. + +Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, 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, [Let you Linux terminal speak its mind][5], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-mplayer + +作者:[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/life/16/8/3-command-line-music-players-linux +[2]: https://rpmfusion.org/ +[3]: https://wknc.org/index.php +[4]: http://www.mplayerhq.hu/ +[5]: https://opensource.com/article/18/12/linux-toy-espeak From 0d058dbd84f57bb0cae635a3861a1557e97f9341 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:34:17 +0800 Subject: [PATCH 0294/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20An=20Easy=20Way?= =?UTF-8?q?=20To=20Remove=20Programs=20Installed=20From=20Source=20In=20Li?= =?UTF-8?q?nux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Programs Installed From Source In Linux.md | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md diff --git a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md new file mode 100644 index 0000000000..7e3378b4e3 --- /dev/null +++ b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) +[#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +An Easy Way To Remove Programs Installed From Source In Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/stow-1-720x340.jpg) + +Not all programs available in the official or third-party repositories, so you can’t install them using the regular package managers. Some times, you have to install the programs by manually compiling from source. As you may already know, when you install programs from source, the package files will be copied to multiple locations, such as **/usr/local/bin** , **/usr/local/etc/** , on the filesystem. If the installed program from source doesn’t have a built-in uninstaller, it is going to be a tedious task to remove the packages when you don’t need it anymore. You may need to spend couple (or several) minutes to find those package files and remove them manually. This is what I have been doing up until I stumbled upon a utility named **“GNU Stow”**. Thankfully, Stow has a fantastic way to easily manage programs installed from source. + +To quote the official website, + +> **GNU Stow is a symlink farm manager which takes distinct packages of software and/or data located in separate directories on the filesystem, and makes them appear to be installed in the same place.** + +To put this simply, Stow helps you to keep the package files organized in a way to easily manageable. In this method, the files will not be copied to multiple locations. Instead, all files are saved in a specific folder, usually under the program name itself, and Stow creates symbolic links to all the programs’ files into the appropriate places. For example, **/usr/local/bin** could contain symlinks to files within **/usr/local/stow/vim/bin** , **/usr/local/stow/python/bin** etc., and likewise recursively for any other subdirectories such as **…/share** , **…/man** , and so on. In this tutorial, I will show you how to easily manage programs installed from source using Stow with a practical example. Read on. + +### Installing GNU Stow + +GNU Stow is available in the default repositories of popular Linux operating systems. + +On **Arch Linux** and its variants, run the following command to install Stow. + +``` +$ sudo pacman -S stow +``` + +On **Debian** , **Ubuntu** , **Linux Mint** : + +``` +$ sudo apt install stow +``` + +On **Fedora** : + +``` +$ sudo dnf install stow +``` + +On **RHEL/CentOS** : + +``` +$ sudo yum install epel-release + +$ sudo yum install stow +``` + +### Easily Remove Programs Installed From Source In Linux + +As I already mentioned earlier, all program files of a package will be saved in a root folder located in **/usr/local/stow/**. Under this root or parent directory, each package will be saved in its own private sub-directory. For example, if we install Vim editor from source, all program files and directories related to Vim will be saved under **/usr/local/stow/vim** folder. If you install python from source, all files related to python will be kept under **/usr/local/stow/python** and so on. + +Let me install a program, for example **hello** , from source. + +First download the ‘hello’ program’s tarball. + +``` +$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz +``` + +Extract the downloaded tarball using command: + +``` +$ tar -zxvf hello-2.10.tar.gz +``` + +The above command will create a directory named ‘hello-2.10’ in the current working directory and extract all contents in it. + +Switch to the extracted directory: + +``` +$ cd hello-2.10/ +``` + +Run the following command with –prefix option. + +``` +$ ./configure --prefix=/usr/local/stow/hello +``` + +The above command will save the build files in the specified location i.e **/usr/local/stow/hello** in our case. + +Finally, build and install the hello program using the following commands: + +``` +$ make + +$ sudo make install +``` + +That’s it. The hello program has been installed in **/usr/local/stow/hello/** location. You can verify it with ‘ls’ command as shown below. + +``` +$ ls /usr/local/stow/hello/ +bin share +``` + +Finally, go to the **/usr/local/stow/** directory and run the following command to generate the necessary symlinks. + +``` +$ cd /usr/local/stow/ + +$ sudo stow hello +``` + +All done! + +What just happened is all the files and directories contained in the hello package have been symlinked to the directory **/usr/local/**. In other words, **/usr/local/stow/hello/bin** has been symlinked to **/usr/local/bin** and **/usr/local/stow/hello/share** has been symlinked to **/usr/local/share** and **/usr/local/stow/hello/share/man** has been symlinked to **/usr/local/share/man** and so on. + +You can verify them using ‘ls’ command: + +``` +$ ls /usr/local/bin/ +hello +``` + +Let us check if the hello program is working or not using command: + +``` +$ hello +Hello, world! +``` + +Yeah, it is working!! + +Similarly, you can install programs as described above under its own sub-directory. + +Here is the contents of the Stow root directory: + +``` +$ tree /usr/local/stow/ +``` + +![][2] + +See? The hello program is installed /usr/local/stow/hello/ location. Like wise, all packages will be kept under their own directory. + +Here comes the main part. Let us remove the hello program. To do so, go to **/usr/local/stow/** directory: + +``` +$ cd /usr/local/stow/ +``` + +..and run the following command: + +``` +$ sudo stow --delete hello +``` + +The hello program has just been removed. You can verify if it is really removed using command: + +``` +$ hello +-bash: /usr/local/bin/hello: No such file or directory +``` + +![][3] + +See? Hello program is removed! + +Please note that Stow has removed the symlinks only. All program files and directories related to hello program are still available in **/usr/local/stow/hello** folder. So, you can install the hello program again without having to download the actual source file. If you don’t want it anymore, simply delete the folder. + +``` +$ sudo rm -fr /usr/local/stow/hello/ +``` + +To know more details about Stow, refer the man pages. + +``` +$ man stow +``` + + +Stow helps you to uninstall the programs as easily as you install them. If you are wondering how to effectively manage a lot of programs installed from source, GNU Stow is one such program to make this task a lot easier. Give it a try, you won’t be disappointed. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-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/2018/12/tree-command.png +[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/hello-world.png From 662d780561106a788e782e5a47b07e1469a0c9e4 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:40:13 +0800 Subject: [PATCH 0295/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Top=206=20open?= =?UTF-8?q?=20source=20desktop=20email=20clients?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Top 6 open source desktop email clients.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20180119 Top 6 open source desktop email clients.md diff --git a/sources/tech/20180119 Top 6 open source desktop email clients.md b/sources/tech/20180119 Top 6 open source desktop email clients.md new file mode 100644 index 0000000000..7493714453 --- /dev/null +++ b/sources/tech/20180119 Top 6 open source desktop email clients.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 6 open source desktop email clients) +[#]: via: (https://opensource.com/business/18/1/desktop-email-clients) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Top 6 open source desktop email clients +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_mail.png?itok=XTkwePLK) + +This article was originally published on October 8, 2015, and has been updated to reflect new information and project changes. + +Mobile and web technologies still haven't made the desktop obsolete, and despite some regular claims to the contrary, desktop clients don't seem to be going away anytime soon. + +And with good reason. For many, the preference for a native application (and corresponding native performance), easy offline use, a vast array of plugins, and meeting security needs will long outweigh pressures to switch to a webmail email client. Whether you're sticking with a desktop email client because of a corporate mandate or just personal preference, there are still many great options to choose from. And just because you may be stuck on Windows doesn't mean Outlook is your only option; many open source clients are cross-platform. + +In this roundup, we take a quick look at six open source options for desktop email, share a little bit about each, and provide you with some options you may want to try yourself. + +### Thunderbird + +For many years, Mozilla [Thunderbird][1] was the king of the open source email clients. It was available on all major platforms, and it had great success alongside Mozilla's now-flagship project, Firefox. Thunderbird has been around for over a decade and was immediately popular from the start, receiving over a million downloads in its first 10 days of public release. + +In recent years, the thunder behind Thunderbird got a little quieter, and in mid-2017 the project announced it would move off Mozilla's infrastructure, but keep the Mozilla Foundation as its legal and fiscal home. Several [new hires][2] were made to advance the project, with plans to bring in new developers to fix lingering issues and transform the codebase to be based on web technologies. + +Thunderbird is full-featured, with a number of well-supported plugins adding everything from calendar support to advanced address book integration, and many specialized features including theming and large file management. Out of the box, it supports POP and IMAP email syncing, spam filtering, and many other features you would expect, and it works flawlessly across Windows, macOS, and Linux. + +Thunderbird is made available under the [Mozilla Public License][3]. + +![Thunderbird][4] + +### Claws Mail + +[Claws Mail][5], a fork of [Sylpheed][6], is a fast and flexible alternative that might be appealing to anyone concerned about performance and minimal resource usage. It's a good option, for example, if you're working within the limited processing and memory capacity of a [Raspberry Pi][7], for example. + +But even for those with virtually unlimited computing resources to throw at a mail client, Claws Mail might be a good option. It's flexible, probably more so than Thunderbird or some of the other options in this list, and it has a number of plugins available for those who want to extend it. And it prides itself on being fast and reliable, too, in addition to sporting a simple interface that's perhaps ideal for new users. + +Claws Mail is based on the GTK+ framework and made available under the [GPL][8]. + +![](https://opensource.com/sites/default/files/images/business-uploads/desktop-email-claws.png) + +### Evolution + +If you're a user of the popular Fedora or Debian distributions, you're probably already familiar with the next option on our list, [Evolution][9]. Evolution is an official part of the GNOME project, but it didn't start out that way. Originally developed at Ximian, and later Novell, Evolution was designed from the ground up to be an enterprise-ready email application. + +To this end, Evolution supports Exchange Server and a number of other email setups you might find in a corporate environment. It's also a full personal information manager (PIM), sporting a calendar, task list, contact manager, and note taking application, in addition to handling your email. Even if it's not the default mail application in your distribution, you might want to take a look if you're interested in these features or the included spam filtering, GNU Privacy Guard (GPG) support, integration with LibreOffice, or a slew of other features. + +Evolution is made available as open source under the [LGPL][10]. + +![](https://opensource.com/sites/default/files/images/business-uploads/desktop-email-evolution.png) + +### Geary + +[Geary][11] is a project originally developed by Yorba Foundation, which made a number of different GNOME software tools. Geary supports a number of popular webmail services as the mail backend through IMAP. + +Geary doesn't have a lot of features compared to some other clients on this list, but its simple interface might be appealing to users frustrated with unnecessary complexity in other email programs. Geary is available under the [LGPL][10]. + +![](https://opensource.com/sites/default/files/images/business-uploads/desktop-email-geary.png) + +### KMail + +[KMail][12] is the mail component of [Kontact][13], the personal information manager included with KDE. KMail supports a variety of email protocols, including IMAP, SMTP, and POP3, and through its integration with the other Kontact components, it could be considered a complete groupware suite. Despite its Linux routes, a Windows build is also available. + +With its long history, KMail has developed most of the features you would expect to find in a modern mail program. While it fits nicely into the KDE group of applications, some may find its interface clunky compared to others. But give it a try and see what you think. + +KMail is made available under the [GPL][14]. + +![](https://opensource.com/sites/default/files/images/business-uploads/desktop-email-kmail.png) + +### Mailspring + +[Mailspring][15], the new kid on the block, is a relaunch of the now-defunct Nylas Mail by one of the original authors. It replaces Nylas' JavaScript sync engine with a C++ core, which is said to minimize the application's RAM and power demands, and removes heavy dependencies to add speed. Its features include a unified inbox, support for IMAP (but not ActiveSync), Gmail-style search, themes, and message translation. + +Mailspring is available for macOS, Windows, and Linux, and it's licensed under [GPLv3][16]. + +![Mailspring][17] + +Of course, there are many more options above and beyond these, including the full-featured PIM [Zimbra Desktop][18] or one of the [lightweight alternatives][19] like [GNUMail][20] that might be the best choice for your situation. What's your favorite open source desktop email client? And with webmail as the first choice of many users, what do you see as the role of the desktop email client in the years to come? Let us know in the comments below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/business/18/1/desktop-email-clients + +作者:[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://www.mozilla.org/en-US/thunderbird/ +[2]: https://blog.mozilla.org/thunderbird/2017/12/new-thunderbird-releases-and-new-thunderbird-staff/ +[3]: https://www.mozilla.org/en-US/MPL/ +[4]: https://opensource.com/sites/default/files/u128651/desktop-email-thunderbird57.png (Thunderbird) +[5]: http://www.claws-mail.org/ +[6]: http://sylpheed.sraoss.jp/en/ +[7]: https://opensource.com/resources/what-raspberry-pi +[8]: http://www.claws-mail.org/COPYING +[9]: https://wiki.gnome.org/Apps/Evolution +[10]: http://www.gnu.org/licenses/lgpl-3.0.en.html +[11]: https://wiki.gnome.org/Apps/Geary +[12]: https://userbase.kde.org/KMail +[13]: https://userbase.kde.org/Kontact +[14]: http://www.gnu.org/licenses/gpl-3.0.en.html +[15]: https://getmailspring.com/ +[16]: https://github.com/Foundry376/Mailspring/blob/master/LICENSE.md +[17]: https://opensource.com/sites/default/files/u128651/desktop-email-mailspring.png (Mailspring) +[18]: https://www.zimbra.com/open-source-email-overview/ +[19]: https://opensource.com/article/17/7/email-alternatives-thunderbird +[20]: http://wiki.gnustep.org/index.php/GNUMail From cbbad162bd7b49b10533e1138ca58c3c69065f82 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:44:28 +0800 Subject: [PATCH 0296/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Fragmentation?= =?UTF-8?q?=20is=20Why=20Linux=20Hasn=E2=80=99t=20Succeeded=20on=20Desktop?= =?UTF-8?q?:=20Linus=20Torvalds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...t Succeeded on Desktop- Linus Torvalds.md" | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 "sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" diff --git "a/sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" "b/sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" new file mode 100644 index 0000000000..e2d519439a --- /dev/null +++ "b/sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fragmentation is Why Linux Hasn’t Succeeded on Desktop: Linus Torvalds) +[#]: via: (https://itsfoss.com/desktop-linux-torvalds/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Fragmentation is Why Linux Hasn’t Succeeded on Desktop: Linus Torvalds +====== + +**Brief: Linus Torvalds has finally spoken his mind over why Linux that rules the servers and the clouds has not succeeded on the desktop front.** + +![Linus Torvalds voices his opinion on why desktop Linux didn't succeed][1] + +Too many cooks spoil the broth. + +Too many choices overwhelm the consumer/customer/user. + +Too many desktop choices held Linux back from succeeding as a desktop operating system? Linux creator Linus Torvalds certainly thinks so. + +In an interview with [TFiR][2], Torvalds expressed his views on the ‘failure’ of desktop Linux. + +> I still wish we were better at having a standardize desktop that goes across all the distributions… It’s not a kernel issue. It’s more of a personal annoyance how the fragmentation of the different vendors have, I think, held the desktop back a bit. + +You can watch the entire interview on [TFiR’s YouTube channel][3]. It’s a short video where Torvalds has expressed his views on desktop Linux and Chromebooks. + + + +### Chromebooks and Android are the future of desktop Linux! + +When I met Jim Zemlin, executive director of the Linux Foundation, at Open Source Summit in 2017, I asked him why Linux Foundation doesn’t work on creating an affordable Linux laptop for masses. Jim answered that Chromebooks are essentially Linux desktop and they are doing exactly that so there is no need of going after a new entry-level Linux laptop. + +Interestingly, Torvalds also puts his weight behind Chromebooks (and Android). + +> It seems to be that Chromebooks and Android are the paths towards the desktop. + +In case you didn’t know, [Chromebooks will soon be able to run native Debian apps][4]. Using Chromebook will give a slightly better ‘Linux feel’. For now, Chromebooks and Chrome OS are nowhere close to the traditional desktop feel despite the fact they run on top of the Linux kernel. + +### What do you think? + +I, along with many other Linux users, have felt the same reason behind the not-so-successful state of the desktop Linux. There are too many choices available when it comes to desktop Linux and this is overwhelming to the new users to the extent that they just avoid using it. + +Do I feel vindicated that Torvalds thinks the same? Kind of. + +What do you think? Do you agree with the opinion that the fragmentation held back desktop Linux? Or do you think that the multitude of choices symbolize the freedom Linux provides to the users? Share your view with us. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/desktop-linux-torvalds/ + +作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/torvalds-why-desktop-linux-failed.jpeg?resize=800%2C450&ssl=1 +[2]: https://www.tfir.io/ +[3]: https://www.youtube.com/watch?v=VHFdoFKDuQA +[4]: https://itsfoss.com/linux-apps-chromebook/ From 3ff4c04288d14c9e67c63a300eb8670e70681339 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Mon, 24 Dec 2018 22:24:37 +0800 Subject: [PATCH 0297/4278] Translated by qhwdw --- ...GP - Part 7- Protecting Online Accounts.md | 147 ------------------ ...GP - Part 7- Protecting Online Accounts.md | 145 +++++++++++++++++ 2 files changed, 145 insertions(+), 147 deletions(-) delete mode 100644 sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md create mode 100644 translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md diff --git a/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md deleted file mode 100644 index 1c5cf7ff09..0000000000 --- a/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md +++ /dev/null @@ -1,147 +0,0 @@ -Translating by qhwdw -Protecting Code Integrity with PGP — Part 7: Protecting Online Accounts -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/online-pgp.jpg?itok=BWc_Bk6q) -So far in this tutorial series, we've provided practical guidelines for using PGP, including basic concepts and steps for generating and protecting your keys. If you missed the previous articles, you can catch up below. In this final article, we offer additional guidance for protecting your online accounts, which is of paramount importance today. - -[Part 1: Basic Concepts and Tools][1] - -[Part 2: Generating Your Master Key][2] - -[Part 3: Generating PGP Subkeys][3] - -[Part 4: Moving Your Master Key to Offline Storage][4] - -[Part 5: Moving Subkeys to a Hardware Device][5] - -[Part 6: Using PGP with Git][6] - -### Checklist - - * Get a U2F-capable device (ESSENTIAL) - - * Enable 2-factor authentication for your online accounts (ESSENTIAL) - - * GitHub/GitLab - - * Google - - * Social media - - * Use U2F as primary mechanism, with TOTP as fallback (ESSENTIAL) - - - - -#### Considerations - -You may have noticed how a lot of your online developer identity is tied to your email address. If someone can gain access to your mailbox, they would be able to do a lot of damage to you personally, and to your reputation as a free software developer. Protecting your email accounts is just as important as protecting your PGP keys. - -##### Two-factor authentication with Fido U2F - -[Two-factor authentication][7] is a mechanism to improve account security by requiring a physical token in addition to a username and password. The goal is to make sure that even if someone steals your password (via keylogging, shoulder surfing, or other means), they still wouldn't be able to gain access to your account without having in their possession a specific physical device ("something you have" factor). - -The most widely known mechanisms for 2-factor authentication are: - - * SMS-based verification - - * Time-based One-Time Passwords (TOTP) via a smartphone app, such as the "Google Authenticator" or similar solutions - - * Hardware tokens supporting Fido U2F - - - - -SMS-based verification is easiest to configure, but has the following important downsides: it is useless in areas without signal (e.g. most building basements), and can be defeated if the attacker is able to intercept or divert SMS messages, for example by cloning your SIM card. - -TOTP-based multi-factor authentication offers more protection than SMS, but has important scaling downsides (there are only so many tokens you can add to your smartphone app before finding the correct one becomes unwieldy). Plus, there's no avoiding the fact that your secret key ends up stored on the smartphone itself -- which is a complex, globally connected device that may or may not have been receiving timely security patches from the manufacturer. - -Most importantly, neither TOTP nor SMS methods protect you from phishing attacks -- if the phisher is able to steal both your account password and the 2-factor token, they can replay them on the legitimate site and gain access to your account. - -[Fido U2F][8] is a standard developed specifically to provide a mechanism for 2-factor authentication and to combat credential phishing. The U2F protocol will store each site's unique key on the USB token and will prevent you from accidentally giving the attacker both your password and your one-time token if you try to use it on anything other than the legitimate website. - -Both Chrome and Firefox support U2F 2-factor authentication, and hopefully other browsers will soon follow. - -##### Get a token capable of Fido U2F - -There are [many options available][9] for hardware tokens with Fido U2F support, but if you're already ordering a smartcard-capable physical device, then your best option is a Yubikey 4, which supports both. - -##### Enable 2-factor authentication on your online accounts - -You definitely want to enable this option on the email provider you are using (especially if it is Google, which has excellent support for U2F). Other sites where this functionality should be enabled are: - - * GitHub: it probably occurred to you when you uploaded your PGP public key that if anyone else is able to gain access to your account, they can replace your key with their own. If you publish code on GitHub, you should take care of your account security by protecting it with U2F-backed authentication. - - * GitLab: for the same reasons as above. - - * Google: if you have a google account, you will be surprised how many sites allow logging in with Google authentication instead of site-specific credentials. - - * Facebook: same as above, a lot of online sites offer the option to authenticate using a Facebook account. You should 2-factor protect your Facebook account even if you do not use it. - - * Other sites, as you deem necessary. See [dongleauth.info][10] for inspiration. - - - - -##### Configure TOTP failover, if possible - -Many sites will allow you to configure multiple 2-factor mechanisms, and the recommended setup is: - - * U2F token as the primary mechanism - - * TOTP phone app as the secondary mechanism - - - - -This way, even if you lose your U2F token, you should be able to re-gain access to your account. Alternatively, you can enroll multiple U2F tokens (e.g. you can get another cheap token that only does U2F and use it for backup reasons). - -### Further reading - -By this point you have accomplished the following important tasks: - - 1. Created your developer identity and protected it using PGP cryptography. - - 2. Configured your environment so your identity is not easily stolen by moving your master key offline and your subkeys to an external hardware device. - - 3. Configured your git environment to ensure that anyone using your project is able to verify the integrity of the repository and its entire history. - - 4. Secured your online accounts using 2-factor authentication. - - - - -You are already in a good place, but you should also read up on the following topics: - - * How to secure your team communication (see the document in this repository). Decisions regarding your project development and governance require just as much careful protection as any committed code, if not so. Make sure that your team communication is trusted and the integrity of all decisions is verified. - - * How to secure your workstation (see the document in this repository). Your goal is to minimize risky behaviour that would cause your project code to be contaminated, or your developer identity to be stolen. - - * How to write secure code (see various documentation related to the programming languages and libraries used by your project). Bad, insecure code is still bad, insecure code even if there is a PGP signature on the commit that introduced it. - - - - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-7-protecting-online-accounts - -作者:[Konstantin Ryabitsev][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device -[6]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git -[7]:https://en.wikipedia.org/wiki/Multi-factor_authentication -[8]:https://en.wikipedia.org/wiki/Universal_2nd_Factor -[9]:http://www.dongleauth.info/dongles/ -[10]:http://www.dongleauth.info/ diff --git a/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md new file mode 100644 index 0000000000..4cf1f321c1 --- /dev/null +++ b/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @@ -0,0 +1,145 @@ +保护代码完整性(七):保护在线帐户 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/online-pgp.jpg?itok=BWc_Bk6q) +到目前为止,本系列教程已经提供了 PGP 的实用指南,包括基本概念和工具、生成和保护你的密钥的步骤。如果你错过了前面的文章,可以通过下面的链接查看。在本系列的最后一篇文章中,我们将为你保护在线帐户提供一个额外的指南,保护在线帐户是当今非常重要的一件事情。 + +[第一部分:基本概念和工具][1] + +[第二部分:生成你的主密钥][2] + +[第三部分:生成 PGP 子密钥][3] + +[第四部分:将主密钥移到离线存储中][4] + +[第五部分:将子密钥移到硬件设备中][5] + +[第六部分:在 Git 中使用 PGP][6] + +### 清单 + + * 取得一个具备 U2F 功能的设备(必要) + + * 为你的在线帐户启用双因子认证(必要) + + * GitHub/GitLab + + * Google + + * 社交媒体 + + * 使用 U2F 作为主验证机制,使用 TOTP 作为备选(必要) + + + + +#### 考虑事项 + +你可能注意到,很多在线开发者身份是捆绑了你的 email 地址。如果有人能够访问你的邮箱,他们就能够去做一些对你会产生危害的事情,进而会损害你作为自由软件开发者的声誉。应该像保护你的 PGP 密钥那样保护你的 email 地址。 + +##### 使用 Fido U2F 的双因子认证 + +[双因子认证][7] 是一种提升帐户安全性的机制,它除了要求用户名和密码之外,还要求一个物理令牌。它的目标是即便在有人窃取了你的密码(通过按键记录器、肩窥攻击、或其它方式)的情况下,仍然能确保你的帐户安全,他们在没有得到你的一个专用的物理设备(“必备”的那个因子)的情况下,始终不能获取你的帐户。 + +广为人知的双因子认证机制有: + + * 基于 SMS 的验证 + + * 借助智能手机应用的基于时间的一次性令牌(TOTP),比如 "Google Authenticator" 或类似解决方案 + + * 支持 Fido U2F 的硬件令牌 + + + + +基于 SMS 的验证很容易配置,但是它有如下的缺点:它在没有手机信号的地方无法使用(比如,建筑物的地下室),并且如果攻击者能够阻断或转向 SMS 信息,这种方式可能就会失败,比如通过克隆你的 SIM 卡。 + +基于 TOTP 的多因子认证提供了比 SMS 更好的安全保护,但它也有一些重要的缺点(在你能够找到一个合适的令牌之前,你只能在智能手机中添加那么多令牌)。此外,还不能避免一个事实,那就是你的密钥最终还是保存在你的智能手机中 —— 它是一个复杂的、全球连接的设备,它有可能还没有及时从制造商那儿收到安全补丁。 + +更重要的是,不论是使用 TOTP 还是 SMS 的方法保护你免受诱骗攻击 —— 如果诱骗攻击者能够窃取你的帐户密码和双因子令牌,他们就可以在合法的站点上使用它们,访问你的帐户。 + +[Fido U2F][8] 是一个按标准开发的专用设备,它能够提供双因子认证机制来对付诱骗攻击。U2F 协议在 USB 令牌中保存每个站点的的唯一密钥,如果你在任何合法站点以外的地方尝试使用它,它将阻止你,以防范偶然让攻击者获得你的密码和一次性令牌。 + +Chrome 和 Firefox 都支持 U2F 双因子认证,希望其它浏览器也能够提供对 U2F 的支持。 + +##### 获得一个支持 Fido U2F 功能的令牌 + +支持 U2F 的硬件令牌的 [可选目标很多][9],但如果你已经订购了一个支持智能卡的物理设备,那么你最好的选择就是 Yubikey 4,它两者都支持。 + +##### 启用你的在线帐户的双因子认证 + +你要确定你想去启用的选项,你的 email 提供商已经使用了(特别是 Google,它对 U2F 的支持非常好)。其它的站点这个功能应该是启用了: + + * GitHub:当你上传你的 PGP 公钥时,你应该要想到,如果其他人能够获得访问你的帐户,他们可以用他们自己的 PGP 公钥替换掉你的 PGP 公钥。如果在 GitHub 上发布代码,你应该使用 U2F 认证来保护你的帐户安全。 + + * GitLab:理由同上 + + * Google:如果你有 google 帐户,你就惊奇地发现,许多帐户都允许以 Google 帐户来代替站点专用的认证来登入它们。 + + * Facebook:理由同上,许多在线站点都提供一个选择让你以 Facebook 的帐户来认证。即便你不使用 Facebook 也应该使用双因子认证来保护你的 Facebook 帐户。 + + * 你认为必要的其它站点。查看 [dongleauth.info][10] 去找找灵感。 + + + + +##### 如有可能,配置 TOTP 作为备选 + +许多站点都允许你配置多个双因子认证机制,推荐的设置是: + + * U2F 令牌作为主认证机制 + + * TOTP 手机 app 作为辅助认证机制 + + + + +通过这种方式,即便你丢失了你的 U2F 令牌,你仍然能够重新获取对你的帐户的访问。或者,你可以注册多个 U2F 令牌(即:你可以用一个便宜的令牌仅用它做 U2F,并且将它用作备份)。 + +### 延伸阅读 + +到目前为止,你已经完成了下列的重要任务: + + 1. 创建你的开发者身份并使用 PGP 加密来保护它。 + + 2. 通过将你的主密钥移到一个离线存储中并将子密钥移到一个外置硬件设备中的方式来配置你的环境,让窃取你的身份变得极为困难。 + + 3. 配置你的 Git 环境去确保任何使用你项目的人都能够验证仓库的完整性和它的整个历史。 + + 4. 使用双因子认证强化你的在线帐户。 + + + + +在安全保护方面,你已经做的很好了,但是你还应该去阅读以下的主题: + + * 如何去强化你的团队沟通(在这个仓库中查看相关文档)。你的项目开发和治理决策的要求应该和保护提交代码那样去保护,如果不这样做,应该确保你的团队沟通是可信任的,并且所有决策的完整性是可验证的。 + + * 如何去强化你的工作站的安全(在这个仓库中查看相关文档)。你的目标是最小化可能导致项目代码被污染的危险或你的开发者身份被窃的行为。 + + * 如何写出安全的代码(查看相关编程语言和你项目所使用的库的各种文档)。即便引入它的提交代码上有一个 PGP 签名,糟糕的、不安全的代码仍然是糟糕的、不安全的代码! + + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-7-protecting-online-accounts + +作者:[Konstantin Ryabitsev][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) +选题:[lujun9972](https://github.com/lujun9972) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/mricon +[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools +[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key +[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage +[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device +[6]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git +[7]:https://en.wikipedia.org/wiki/Multi-factor_authentication +[8]:https://en.wikipedia.org/wiki/Universal_2nd_Factor +[9]:http://www.dongleauth.info/dongles/ +[10]:http://www.dongleauth.info/ From 3357a9baa663287c5414b4ee36aa147489ecb5e0 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Mon, 24 Dec 2018 22:36:18 +0800 Subject: [PATCH 0298/4278] Translating by qhwdw --- sources/tech/20181221 How to Build a Netboot Server, Part 3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md b/sources/tech/20181221 How to Build a Netboot Server, Part 3.md index 7c4501b58b..08c1a8a12e 100644 --- a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md +++ b/sources/tech/20181221 How to Build a Netboot Server, Part 3.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f252552cf222439d5c004a7e1e36a4cf24263f2c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 23:49:40 +0800 Subject: [PATCH 0299/4278] PRF:20181123 How to Build a Netboot Server, Part 1.md @qhwdw --- ...3 How to Build a Netboot Server, Part 1.md | 169 +++++++++--------- 1 file changed, 84 insertions(+), 85 deletions(-) diff --git a/translated/tech/20181123 How to Build a Netboot Server, Part 1.md b/translated/tech/20181123 How to Build a Netboot Server, Part 1.md index f2711ac3d1..1888f4ab2b 100644 --- a/translated/tech/20181123 How to Build a Netboot Server, Part 1.md +++ b/translated/tech/20181123 How to Build a Netboot Server, Part 1.md @@ -1,47 +1,51 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: -[#]: publisher: +[#]: reviewer: (wxy) +[#]: publisher: ( ) [#]: subject: (How to Build a Netboot Server, Part 1) - [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) +[#]: url: ( ) -[#]: url: - -如何构建一台网络引导服务器(第一部分) -====== +如何构建一台网络引导服务器(一) +====== ![](https://fedoramagazine.org/wp-content/uploads/2018/11/build-netboot-816x345.jpg) -有些计算机网络需要在各个物理机器上维护相同的软件和配置。学校的计算机实验室就是这样的一个环境。一台 [网络引导][1] 服务器能够被配置为基于网络去提供一个完整的操作系统,以便于客户端计算机从一个中央位置获取配置。本教程将向你展示构建一台网络引导服务器的一种方法。 +有些计算机网络需要在各个物理机器上维护相同的软件和配置。学校的计算机实验室就是这样的一个环境。 [网络引导][1] 服务器能够被配置为基于网络去提供一个完整的操作系统,以便于客户端计算机从一个中央位置获取配置。本教程将向你展示构建一台网络引导服务器的一种方法。 -本教程的第一部分将包括创建一台网络引导服务器和镜像。第二部分将展示如何去添加 Kerberos 验证的 home 目录到网络引导配置中。 +本教程的第一部分将包括创建一台网络引导服务器和镜像。第二部分将展示如何去添加 Kerberos 验证的家目录到网络引导配置中。 ### 初始化配置 -首先去下载 Fedora 服务器的 [netinst][2] 镜像,将它刻录到一张光盘上,然后它将引导服务器去重新格式化。我们只需要一个典型的 Fedora Server 的“最小化安装”来作为我们的开端,安装完成后,我们可以使用命令行去添加我们需要的任何额外的包。 +首先去下载 Fedora 服务器的 [netinst][2] 镜像,将它刻录到一张光盘上,然后用它引导服务器来重新格式化。我们只需要一个典型的 Fedora Server 的“最小化安装”来作为我们的开端,安装完成后,我们可以使用命令行去添加我们需要的任何额外的包。 ![][3] > 注意:本教程中我们将使用 Fedora 28。其它版本在“最小化安装”中包含的包可能略有不同。如果你使用的是不同的 Fedora 版本,如果一个预期的文件或命令不可用,你可能需要做一些调试。 -最小化安装的 Fedora Server 运行起来之后,以 root 用户登入并设置主机名字: +最小化安装的 Fedora Server 运行起来之后,以 root 用户登入: -```javascript +``` +$ sudo -i +``` + +并设置主机名字: + +``` $ MY_HOSTNAME=server-01.example.edu $ hostnamectl set-hostname $MY_HOSTNAME ``` > 注意:Red Hat 建议静态和临时名字应都要与这个机器在 DNS 中的完全合格域名相匹配,比如 host.example.com([了解主机名字][4])。 > -> 注意:本指南为了你“复制粘贴”友好。需要自定义的任何值都声明为一个 MY_* 变量,在你运行剩余命令之前,你可能需要调整它。如果你注销之后,变量的赋值将被清除。 +> 注意:本指南为了方便“复制粘贴”。需要自定义的任何值都声明为一个 `MY_*` 变量,在你运行剩余命令之前,你可能需要调整它。如果你注销之后,变量的赋值将被清除。 > -> 注意:Fedora 28 Server 在默认情况下往往会转储大量的日志到控制台上。你可以通过运行命令:sysctl -w kernel.printk=0 去禁用控制台日志输出。 +> 注意:Fedora 28 Server 在默认情况下往往会转储大量的日志到控制台上。你可以通过运行命令:`sysctl -w kernel.printk=0` 去禁用控制台日志输出。 接下来,我们需要在我们的服务器上配置一个静态网络地址。运行下面的一系列命令将找到并重新配置你的默认网络连接: -```javascript +``` $ MY_DNS1=192.0.2.91 $ MY_DNS2=192.0.2.92 $ MY_IP=192.0.2.158 @@ -66,7 +70,7 @@ nmcli con up br0-slave0 END ``` -> 注意:上面最后的一组命令被封装到一个 “nohup” 脚本中,因为它将临时禁用网络。这个 nohup 命令将允许 nmcli 命令去完成运行,直到你的 SSH 连接断开。注意,连接恢复可能需要 10 秒左右的时间,如果你改变了服务器 IP 地址,你将需要重新启动一个新的 SSH 连接。 +> 注意:上面最后的一组命令被封装到一个 `nohup` 脚本中,因为它将临时禁用网络。这个 `nohup` 命令可以让 `nmcli` 命令运行完成,即使你的 SSH 连接断开。注意,连接恢复可能需要 10 秒左右的时间,如果你改变了服务器 IP 地址,你将需要重新启动一个新的 SSH 连接。 > > 注意:上面的网络配置在默认的连接之上创建了一个 [网桥][5],这样我们在后面的测试中就可以直接运行一个虚拟机实例。如果你不想在这台服务器上去直接测试网络引导镜像,你可以跳过创建网桥的命令,并直接在你的默认网络连接上配置静态 IP 地址。 @@ -80,26 +84,26 @@ $ dnf install -y nfs-utils 为发布 NFS 去创建一个顶级的 [伪文件系统][6],然后在你的网络上共享它: -```javascript +``` $ MY_SUBNET=192.0.2.0 $ mkdir /export $ echo "/export -fsid=0,ro,sec=sys,root_squash $MY_SUBNET/$MY_PREFIX" > /etc/exports ``` -SELinux 将干扰网络引导服务器的运行。在本教程中我们将不涉及为它配置例外的部分,因此我们直接禁用它: +SELinux 会干扰网络引导服务器的运行。为它配置例外规则超出了本教程中,因此我们这里直接禁用它: -```javascript +``` $ sed -i '/GRUB_CMDLINE_LINUX/s/"$/ audit=0 selinux=0"/' /etc/default/grub $ grub2-mkconfig -o /boot/grub2/grub.cfg $ sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux $ setenforce 0 ``` -> 注意:编辑 grub 命令行应该是不需要的,但在测试过程中发现,简单地编辑 /etc/sysconfig/selinux 被证明重启后是无效的,因此再次确保设置了 “selinux=0” 标志。 +> 注意:应该不需要编辑 grub 命令行,但我们在测试过程中发现,直接编辑 `/etc/sysconfig/selinux` 被证明重启后是无效的,因此这样做再次确保设置了 `selinux=0` 标志。 -现在,在本地防火墙中为 NFS 服务添加一个例外,然后启动 NFS 服务: +现在,在本地防火墙中为 NFS 服务添加一个例外规则,然后启动 NFS 服务: -```javascript +``` $ firewall-cmd --add-service nfs $ firewall-cmd --runtime-to-permanent $ systemctl enable nfs-server.service @@ -116,76 +120,70 @@ $ systemctl start nfs-server.service $ mkdir /fc28 ``` -使用 “dnf” 命令在新目录下用几个基础包去构建镜像: +使用 `dnf` 命令在新目录下用几个基础包去构建镜像: -```javascript +``` $ dnf -y --releasever=28 --installroot=/fc28 install fedora-release systemd passwd rootfiles sudo dracut dracut-network nfs-utils vim-minimal dnf ``` -在上面的命令中省略了很重要的 “kernel” 包。在它们被安装完成之前,我们需要去调整一下 “initramfs” 镜像中包含的驱动程序集,“kernel” 首次安装时将自动构建这个镜像。尤其是,我们需要禁用 “hostonly” 模式,以便于 initramfs 镜像能够在各种硬件平台上正常工作,并且我们还需要添加对网络和 NFS 的支持: +在上面的命令中省略了很重要的 `kernel` 包。在它们被安装完成之前,我们需要去调整一下 `initramfs` 镜像中包含的驱动程序集,`kernel` 首次安装时将自动构建这个镜像。尤其是,我们需要禁用 `hostonly` 模式,以便于 `initramfs` 镜像能够在各种硬件平台上正常工作,并且我们还需要添加对网络和 NFS 的支持: -```javascript +``` $ echo 'hostonly=no' > /fc28/etc/dracut.conf.d/hostonly.conf $ echo 'add_dracutmodules+=" network nfs "' > /fc28/etc/dracut.conf.d/netboot.conf ``` -现在,安装 kernel: +现在,安装 `kernel` 包: -```javascript +``` $ dnf -y --installroot=/fc28 install kernel ``` -设置一个阻止 kernel 被更新的规则: +设置一个阻止 `kernel` 包被更新的规则: -```javascript +``` $ echo 'exclude=kernel-*' >> /fc28/etc/dnf/dnf.conf ``` 设置 locale: -```javascript +``` $ echo 'LANG="en_US.UTF-8"' > /fc28/etc/locale.conf ``` > 注意:如果 locale 没有正确配置,一些程序(如 GNOME Terminal)将无法正常工作。 -root 用户密码留空: - -```javascript -$ sed -i 's/^root:\*/root:/' /fc28/etc/shadow -``` - 设置客户端的主机名字: -```javascript +``` $ MY_CLIENT_HOSTNAME=client-01.example.edu $ echo $MY_CLIENT_HOSTNAME > /fc28/etc/hostname ``` 禁用控制台日志输出: -```javascript +``` $ echo 'kernel.printk = 0 4 1 7' > /fc28/etc/sysctl.d/00-printk.conf ``` -定义网络引导镜像中的本地 “liveuser” 用户: +定义网络引导镜像中的本地 `liveuser` 用户: -```javascript +``` $ echo 'liveuser:x:1000:1000::/home/liveuser:/bin/bash' >> /fc28/etc/passwd $ echo 'liveuser::::::::' >> /fc28/etc/shadow $ echo 'liveuser:x:1000:' >> /fc28/etc/group $ echo 'liveuser:!::' >> /fc28/etc/gshadow ``` -在 sudo 中启用 “liveuser”: +允许 `liveuser` 使用 `sudo`: -```javascript +``` $ echo 'liveuser ALL=(ALL) NOPASSWD: ALL' > /fc28/etc/sudoers.d/liveuser ``` -启用自动 home 目录创建: +启用自动创建家目录: -```livescript +``` $ dnf install -y --installroot=/fc28 authselect oddjob-mkhomedir $ echo 'dirs /home' > /fc28/etc/rwtab.d/home $ chroot /fc28 authselect select sssd with-mkhomedir --force @@ -194,19 +192,19 @@ $ chroot /fc28 systemctl enable oddjobd.service 由于多个客户端将会同时挂载我们的镜像,我们需要去配置镜像工作在只读模式中: -```livescript +``` $ sed -i 's/^READONLY=no$/READONLY=yes/' /fc28/etc/sysconfig/readonly-root ``` 配置日志输出到内存而不是持久存储中: -```livescript +``` $ sed -i 's/^#Storage=auto$/Storage=volatile/' /fc28/etc/systemd/journald.conf ``` 配置 DNS: -```livescript +``` $ MY_DNS1=192.0.2.91 $ MY_DNS2=192.0.2.92 $ cat << END > /fc28/etc/resolv.conf @@ -215,9 +213,9 @@ nameserver $MY_DNS2 END ``` -解决编写本教程时存在的只读 root 挂载 bug([BZ1542567][7]): +绕开编写本教程时存在的根目录只读挂载的 bug([BZ1542567][7]): -```livescript +``` $ echo 'dirs /var/lib/gssproxy' > /fc28/etc/rwtab.d/gssproxy $ cat << END > /fc28/etc/rwtab.d/systemd dirs /var/lib/systemd/catalog @@ -227,7 +225,7 @@ END 最后,为我们镜像创建 NFS 文件系统,并将它共享到我们的子网中: -```livescript +``` $ mkdir /export/fc28 $ echo '/fc28 /export/fc28 none bind 0 0' >> /etc/fstab $ mount /export/fc28 @@ -237,20 +235,20 @@ $ exportfs -vr ### 创建引导加载器 -现在,我们已经有了可以进行网络引导的操作系统,我们需要一个引导加载器去从客户端系统上启动它。在本教程中我们使用的是 [iPXE][8]. +现在,我们已经有了可以进行网络引导的操作系统,我们需要一个引导加载器去从客户端系统上启动它。在本教程中我们使用的是 [iPXE][8]。 -> 注意:本节和接下来的节 — 使用 QEMU 测试 — 能在另外一台单独的计算机上来完成;它们不需要在网络引导服务器上来运行。 +> 注意:本节和接下来的节使用 QEMU 测试,也能在另外一台单独的计算机上来完成;它们并不需要在网络引导服务器上来运行。 -安装 git 并使用它去下载 iPXE: +安装 `git` 并使用它去下载 iPXE: -```livescript +``` $ dnf install -y git $ git clone http://git.ipxe.org/ipxe.git $HOME/ipxe ``` 现在我们需要去为我们的引导加载器创建一个指定的启动脚本: -```livescript +``` $ cat << 'END' > $HOME/ipxe/init.ipxe #!ipxe @@ -264,19 +262,19 @@ END 启动 “file” 下载协议: -```livescript +``` $ echo '#define DOWNLOAD_PROTO_FILE' > $HOME/ipxe/src/config/local/general.h ``` 安装 C 编译器以及相关的工具和库: -```livescript +``` $ dnf groupinstall -y "C Development Tools and Libraries" ``` 构建引导加载器: -```livescript +``` $ cd $HOME/ipxe/src $ make clean $ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe @@ -284,7 +282,7 @@ $ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe 记下新编译的引导加载器的存储位置。我们将在接下来的节中用到它: -```livescript +``` $ IPXE_FILE="$HOME/ipxe/src/bin-x86_64-efi/ipxe.efi" ``` @@ -292,13 +290,13 @@ $ IPXE_FILE="$HOME/ipxe/src/bin-x86_64-efi/ipxe.efi" 这一节是可选的,但是你需要去复制下面显示在物理机器上的 [EFI 系统分区][9] 的布局,在网络引导时需要去配置它们。 -> 注意:如果你想实现一个完全的无盘系统,你也可以复制那个文件到一个 TFTP 服务器,然后从 DHCP 上引用那台服务器。 +> 注意:如果你想实现一个完全的无盘系统,你也可以复制那个文件到一个 TFTP 服务器,然后从 DHCP 上指向那台服务器。 为了使用 QEMU 去测试我们的引导加载器,我们继续去创建一个仅包含一个 EFI 系统分区和我们的启动文件的、很小的磁盘镜像。 从创建 EFI 系统分区所需要的目录布局开始,然后把我们在前面节中创建的引导加载器复制进去: -```livescript +``` $ mkdir -p $HOME/esp/efi/boot $ mkdir $HOME/esp/linux $ cp $IPXE_FILE $HOME/esp/efi/boot/bootx64.efi @@ -306,13 +304,13 @@ $ cp $IPXE_FILE $HOME/esp/efi/boot/bootx64.efi 下面的命令将识别我们的引导加载器镜像正在使用的内核版本,并将它保存到一个变量中,以备后续的配置命令去使用它: -```livescript +``` $ DEFAULT_VER=$(ls -c /fc28/lib/modules | head -n 1) ``` 定义我们的客户端计算机将使用的引导配置: -```livescript +``` $ MY_DNS1=192.0.2.91 $ MY_DNS2=192.0.2.92 $ MY_NFS4=server-01.example.edu @@ -329,14 +327,14 @@ END 复制 Linux 内核并分配 initramfs 给 EFI 系统分区: -```livescript +``` $ cp $(find /fc28/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $DEFAULT_VER) $HOME/esp/linux/vmlinuz-$DEFAULT_VER $ cp $(find /fc28/boot -name 'init*' | grep -m 1 $DEFAULT_VER) $HOME/esp/linux/initramfs-$DEFAULT_VER.img ``` 我们最终的目录布局应该看起来像下面的样子: -```livescript +``` esp ├── efi │   └── boot @@ -347,17 +345,17 @@ esp └── vmlinuz-4.18.18-200.fc28.x86_64 ``` -使用 QEMU 去使用我们的 EFI 系统分区,我们需要去创建一个小的 “uefi.img” 磁盘镜像来包含它,然后将它连接到 QEMU 作为主引导驱动器。 +要让 QEMU 去使用我们的 EFI 系统分区,我们需要去创建一个小的 `uefi.img` 磁盘镜像来包含它,然后将它连接到 QEMU 作为主引导驱动器。 开始安装必需的工具: -```livescript +``` $ dnf install -y parted dosfstools ``` -现在创建 “uefi.img” 文件,并将 “esp” 目录中文件复制进去: +现在创建 `uefi.img` 文件,并将 `esp` 目录中的文件复制进去: -```livescript +``` $ ESP_SIZE=$(du -ks $HOME/esp | cut -f 1) $ dd if=/dev/zero of=$HOME/uefi.img count=$((${ESP_SIZE}+5000)) bs=1KiB $ UEFI_DEV=$(losetup --show -f $HOME/uefi.img) @@ -370,54 +368,55 @@ $ umount $HOME/mnt $ losetup -d ${UEFI_DEV} ``` -> 注意:在物理计算机上,你只需要从 “esp” 目录中复制文件到计算机上已存在的 EFI 系统分区中。你不需要使用 “uefi.img” 文件去引导物理计算机。 +> 注意:在物理计算机上,你只需要从 `esp` 目录中复制文件到计算机上已存在的 EFI 系统分区中。你不需要使用 `uefi.img` 文件去引导物理计算机。 > -> 注意:在一个物理计算机上,如果文件名已存在,你可以重命名 “bootx64.efi” 文件,如果你重命名了它,就需要去编辑计算机的 BIOS 设置,并添加重命令后的 efi 文件到引导列表中。 +> 注意:在一个物理计算机上,如果文件名已存在,你可以重命名 `bootx64.efi` 文件,如果你重命名了它,就需要去编辑计算机的 BIOS 设置,并添加重命令后的 efi 文件到引导列表中。 接下来我们需要去安装 qemu 包: -```livescript +``` $ dnf install -y qemu-system-x86 ``` 允许 QEMU 访问我们在本教程“初始化配置”一节中创建的网桥: -```livescript +``` $ echo 'allow br0' > /etc/qemu/bridge.conf ``` -创建一个 “OVMF_VARS.fd” 镜像的副本去保存我们虚拟机的持久 BIOS 配置: +创建一个 `OVMF_VARS.fd` 镜像的副本去保存我们虚拟机的持久 BIOS 配置: -```livescript +``` $ cp /usr/share/edk2/ovmf/OVMF_VARS.fd $HOME ``` 现在,启动虚拟机: -```livescript +``` $ qemu-system-x86_64 -machine accel=kvm -nographic -m 1024 -drive if=pflash,format=raw,unit=0,file=/usr/share/edk2/ovmf/OVMF_CODE.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=$HOME/OVMF_VARS.fd -drive if=ide,format=raw,file=$HOME/uefi.img -net bridge,br=br0 -net nic,model=virtio ``` 如果一切顺利,你将看到类似下图所示的结果: ![][10] -你可以使用 “shutdown” 命令关闭虚拟机回到我们的服务器上: -```livescript +你可以使用 `shutdown` 命令关闭虚拟机回到我们的服务器上: + +``` $ sudo shutdown -h now ``` -> 注意:如果出现了错误或虚拟机挂住了,你可能需要启动一个新的 SSH 会话去连接服务器,使用 “kill” 命令去终止 “qemu-system-x86_64” 进程。 +> 注意:如果出现了错误或虚拟机挂住了,你可能需要启动一个新的 SSH 会话去连接服务器,使用 `kill` 命令去终止 `qemu-system-x86_64` 进程。 ### 镜像中添加包 -镜像中添加包应该是一个很简单的问题,在服务器上 chroot 进镜像,然后运行 “dnf install ”。 +镜像中添加包应该是一个很简单的问题,在服务器上 `chroot` 进镜像,然后运行 `dnf install `。 在网络引导镜像中并不限制你能安装什么包。一个完整的图形化安装应该能够完美地工作。 下面是一个如何将最小化安装的网络引导镜像变成完整的图形化安装的示例: -```livescript +``` $ for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done $ chroot /fc28 /usr/bin/bash --login $ dnf -y groupinstall "Fedora Workstation" @@ -430,9 +429,9 @@ $ logout $ for i in run sys proc dev/shm dev/pts dev; do umount /fc28/$i; done ``` -可选,你可能希望去启用 “liveuser” 用户的自动登陆: +可选地,你可能希望去启用 `liveuser` 用户的自动登录: -```livescript +``` $ sed -i '/daemon/a AutomaticLoginEnable=true' /fc28/etc/gdm/custom.conf $ sed -i '/daemon/a AutomaticLogin=liveuser' /fc28/etc/gdm/custom.conf ``` @@ -444,7 +443,7 @@ via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ 作者:[Gregory Bartholomew][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 7af8488185a01b1db58102d771e956ea6111ee55 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 23:50:47 +0800 Subject: [PATCH 0300/4278] PUB:20181123 How to Build a Netboot Server, Part 1.md @qhwdw https://linux.cn/article-10379-1.html --- .../20181123 How to Build a Netboot Server, Part 1.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181123 How to Build a Netboot Server, Part 1.md (99%) diff --git a/translated/tech/20181123 How to Build a Netboot Server, Part 1.md b/published/20181123 How to Build a Netboot Server, Part 1.md similarity index 99% rename from translated/tech/20181123 How to Build a Netboot Server, Part 1.md rename to published/20181123 How to Build a Netboot Server, Part 1.md index 1888f4ab2b..ac64617de8 100644 --- a/translated/tech/20181123 How to Build a Netboot Server, Part 1.md +++ b/published/20181123 How to Build a Netboot Server, Part 1.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (How to Build a Netboot Server, Part 1) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10379-1.html) 如何构建一台网络引导服务器(一) ====== From 0a6c32e789f12bfc6c40d519657a2d228eee6f02 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 00:28:46 +0800 Subject: [PATCH 0301/4278] PRF:20180912 How to turn on an LED with Fedora IoT.md @ScarboroughCoral --- ...2 How to turn on an LED with Fedora IoT.md | 87 ++++++++----------- 1 file changed, 36 insertions(+), 51 deletions(-) diff --git a/translated/tech/20180912 How to turn on an LED with Fedora IoT.md b/translated/tech/20180912 How to turn on an LED with Fedora IoT.md index 59bbc1280b..f72d8cb0bc 100644 --- a/translated/tech/20180912 How to turn on an LED with Fedora IoT.md +++ b/translated/tech/20180912 How to turn on an LED with Fedora IoT.md @@ -1,116 +1,105 @@ -# 如何使用 Fedora IoT 开启 LED 灯 +如何使用 Fedora IoT 点亮 LED 灯 +====== ![](https://fedoramagazine.org/wp-content/uploads/2018/08/LED-IoT-816x345.jpg) -你喜欢 Fedora、容器和树莓派吗?这三者结合操控 LED 会怎么样?本文介绍的是 Fedora IoT,将展示如何在树莓派上安装预览镜像。还将学习如何与 GPIO 交互以开启 LED。 +如果你喜欢 Fedora、容器,而且有一块树莓派,那么这三者结合操控 LED 会怎么样?本文介绍的是 Fedora IoT,将展示如何在树莓派上安装预览镜像。还将学习如何与 GPIO 交互以点亮 LED。 ### 什么是 Fedora IoT? -Fedora IoT 是当前 Fedora 项目的目标之一,计划成为一个完整的 Fedora 版本。Fedora IoT 将是一个在ARM(目前仅限 aarch64)例如树莓派,以及 x86_64 架构设备上运行的系统。 +Fedora IoT 是当前 Fedora 项目的目标之一,计划成为一个完整的 Fedora 版本。Fedora IoT 将是一个在 ARM(目前仅限 aarch64)设备上(例如树莓派),以及 x86_64 架构上运行的系统。 ![][1] -Fedora IoT 基于 OSTree 开发, 就像[Fedora Silverblue][2] 和以往的 [Atomic Host][3]. +Fedora IoT 基于 OSTree 开发,就像 [Fedora Silverblue][2] 和以往的 [Atomic Host][3]。 ### 下载和安装 Fedora IoT -官方 Fedora IoT 镜像将和 Fedora 29 一起发布。但是在此期间你可以下载 [Fedora 28-based 镜像][4] 来进行这个实验。 +官方 Fedora IoT 镜像将和 Fedora 29 一起发布。但是在此期间你可以下载 [基于 Fedora 28 的镜像][4] 来进行这个实验。(LCTT 译注:截止至本译文发布,[Fedora 29 已经发布了][11],但是 IoT 版本并未随同发布,或许会在 Fedora 30 一同发布?) -你有两种方法来安装这个系统:使用 dd 命令闪存SD卡,或者使用 fedora-arm-installer 工具。Fedora 的 Wiki 里面提供了更多关于[设置物理设备][5] 的信息来开发 IoT。另外,你可能需要调整第三个分区的大小。 +你有两种方法来安装这个系统:要么使用 `dd` 命令烧录 SD 卡,或者使用 `fedora-arm-installer` 工具。Fedora 的 Wiki 里面提供了为 IoT [设置物理设备][5] 的更多信息。另外,你可能需要调整第三个分区的大小。 -把 SD 卡插入到设备并运行,需要创建一个用户来完成安装。这个步骤需要串行连接或带键盘的 HDMI 显示器来与设备进行交互。 +把 SD 卡插入到设备后,你需要创建一个用户来完成安装。这个步骤需要串行连接或一个 HDMI 显示器和键盘来与设备进行交互。 当系统安装完成后,下一步就是要设置网络连接。使用你刚才创建的用户登录系统,可以使用下列方式之一完成网络连接设置: -- 如果你需要手动配置你的网络,可能需要执行类似如下命令,需要保证设置正确的网络地址: +* 如果你需要手动配置你的网络,可能需要执行类似如下命令,需要保证设置正确的网络地址: -``` + ``` $ nmcli connection add con-name cable ipv4.addresses \ 192.168.0.10/24 ipv4.gateway 192.168.0.1 \ connection.autoconnect true ipv4.dns "8.8.8.8,1.1.1.1" \ type ethernet ifname eth0 ipv4.method manual - ``` -- 如果你网络上运行着 DHCP 服务,可能需要类似如下命令: +* 如果你网络上运行着 DHCP 服务,可能需要类似如下命令: -``` + ``` $ nmcli con add type ethernet con-name cable ifname eth0 ``` - - -### **Fedora 中的 GPIO 接口** +### Fedora 中的 GPIO 接口 许多关于 Linux 上 GPIO 的教程都关注传统的 GPIO sysfis 接口。这个接口已经不推荐使用了,并且上游 Linux 内核社区由于安全和其他问题的缘故打算完全删除它。 -Fedora 已经不将这个传统的接口编译到内核了,因此在系统上没有 /sys/class/gpio 这个文件。此教程使用一个上游内核提供的一个新的字符设备 /dev/gpiochipN 。这是目前和 GPIO 交互的方式。 +Fedora 已经不将这个传统的接口编译到内核了,因此在系统上没有 `/sys/class/gpio` 这个文件。此教程使用一个上游内核提供的一个新的字符设备 `/dev/gpiochipN` 。这是目前和 GPIO 交互的方式。 -为了和这个新设备进行交互,你需要使用一个库和一系列命令行界面工具。公共命令行工具比如说 echo 和 cat 在此设备上无法正常工作。 +为了和这个新设备进行交互,你需要使用一个库和一系列命令行界面的工具。常用的命令行工具比如说 `echo` 和 `cat` 在此设备上无法正常工作。 你可以通过安装 libgpiod-utils 包来安装命令行界面工具。python3-libgpiod 包提供了相应的 Python 库。 -### **使用 Podman 来创建一个容器** +### 使用 Podman 来创建一个容器 -[Podman][6] 是一个容器运行环境,其命令行界面类似于Docker。Podman的一大优势是它不会在后台运行任何守护进程。这对于资源有限的设备尤其有用。Podman 还允许您使用 systemd 单元文件启动容器化服务。此外,它还有许多其他功能。 +[Podman][6] 是一个容器运行环境,其命令行界面类似于 Docker。Podman 的一大优势是它不会在后台运行任何守护进程。这对于资源有限的设备尤其有用。Podman 还允许您使用 systemd 单元文件启动容器化服务。此外,它还有许多其他功能。 我们使用如下两步来创建一个容器: -``` 1. 创建包含所需包的分层镜像。 2. 使用分层镜像创建一个新容器。 -``` - - -首先创建一个 Dockerfile 文件,内容如下。这些内容告诉 podman 基于可使用的最新 Fedora 镜像来构建我们的分层镜像。然后就是更新系统和安装一些软件包: +首先创建一个 Dockerfile 文件,内容如下。这些内容告诉 Podman 基于可使用的最新 Fedora 镜像来构建我们的分层镜像。然后就是更新系统和安装一些软件包: ``` FROM fedora:latest RUN dnf -y update RUN dnf -y install libgpiod-utils python3-libgpiod - ``` 这样你就完成了镜像的生成前的配置工作,这个镜像基于最新的 Fedora,而且包含了和 GPIO 交互的软件包。 -现在你就可以运行下方命令来构建你的基本镜像了: +现在你就可以运行如下命令来构建你的基本镜像了: ``` $ sudo podman build --tag fedora:gpiobase -f ./Dockerfile - ``` 你已经成功创建了你的自定义镜像。这样以后你就可以不用每次都重新搭建环境了,而是基于你创建的镜像来完成工作。 ### 使用 Podman 完成工作 -为了确认当前的镜像,可以运行下方命令: +为了确认当前的镜像是否就绪,可以运行如下命令: ``` $ sudo podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/fedora gpiobase 67a2b2b93b4b 10 minutes ago 488MB docker.io/library/fedora latest c18042d7fac6 2 days ago 300MB - ``` -现在,启动容器并进行一些实际的实验。 容器通常是隔离的,无法访问主机系统,包括GPIO接口。 因此需要在启动容器时将其挂载在容器内。 可以使用以下命令中的 -device 选项来解决: +现在,启动容器并进行一些实际的实验。容器通常是隔离的,无法访问主机系统,包括 GPIO 接口。因此需要在启动容器时将其挂载在容器内。可以使用以下命令中的 `-device` 选项来解决: ``` $ sudo podman run -it --name gpioexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash - ``` -运行之后就进入了正在运行的容器中。 在继续之前,这里有一些容器命令。 输入 exit 或者按下 **Ctrl+D** 来退出容器。 +运行之后就进入了正在运行的容器中。在继续之前,这里有一些容器命令。输入 `exit` 或者按下 `Ctrl+D` 来退出容器。 -显示所有存在的容器可以运行如下命令: +显示所有存在的容器可以运行如下命令,这包括当前没有运行的,比如你刚刚创建的那个: ``` $ sudo podman container ls -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 64e661d5d4e8 localhost/fedora:gpiobase /bin/bash 37 seconds ago Exited (0) Less than a second ago gpioexperiment - ``` 使用如下命令创建一个新的容器: @@ -127,55 +116,50 @@ $ sudo podman rm newexperiment ``` -### **开启 LED 灯** +### 点亮 LED 灯 -现在可以使用已创建的容器。 如果容器已经退出,请使用以下命令再次启动它: +现在可以使用已创建的容器。如果已经从容器退出,请使用以下命令再次启动它: ``` $ sudo podman start -ia gpioexperiment - ``` -如前所述,可以使用 Fedora 中 libgpiod-utils 包提供的 CLI 工具。 要列出可用的 GPIO 芯片可以使用如下命令: +如前所述,可以使用 Fedora 中 libgpiod-utils 包提供的命令行工具。要列出可用的 GPIO 芯片可以使用如下命令: ``` $ gpiodetect gpiochip0 [pinctrl-bcm2835] (54 lines) - ``` -要获取特定芯片的公开列表,请运行: +要获取特定芯片的连线列表,请运行: ``` $ gpioinfo gpiochip0 - ``` -请注意,物理引脚数与前一个命令打印的行数之间没有相关性。 重要的是 BCM 编号,如 [pinout.xyz][7] 所示。 建议不要使用没有相应 BCM 编号的线路。 +请注意,物理引脚数与前一个命令所打印的连线数之间没有相关性。重要的是 BCM 编号,如 [pinout.xyz][7] 所示。建议不要使用没有相应 BCM 编号的连线。 -现在,将 LED 连接到物理引脚40,也就是 BCM 21。请记住:LED的短腿(负极,称为阴极)必须连接到带有330欧姆电阻的树莓派的 GND 引脚, 并且长腿(阳极)到物理引脚40。 +现在,将 LED 连接到物理引脚 40,也就是 BCM 21。请记住:LED 的短腿(负极,称为阴极)必须连接到带有 330 欧姆电阻的树莓派的 GND 引脚, 并且长腿(阳极)到物理引脚 40。 -运行以下命令打开LED。,按下 **Ctrl + C ** 关闭: +运行以下命令点亮 LED,按下 `Ctrl + C` 关闭: ``` $ gpioset --mode=wait gpiochip0 21=1 - ``` -要点亮一段时间,请添加 -b(在后台运行)和 -s NUM(多少秒)参数,如下所示。 例如,要点亮 LED 5秒钟,运行如下命令: +要点亮一段时间,请添加 `-b`(在后台运行)和 `-s NUM`(多少秒)参数,如下所示。 例如,要点亮 LED 5 秒钟,运行如下命令: ``` $ gpioset -b -s 5 --mode=time gpiochip0 21=1 - ``` -另一个有用的命令是 gpioget。 它可以获得引脚的状态(高或低),可用于检测按钮和开关。 +另一个有用的命令是 `gpioget`。 它可以获得引脚的状态(高或低),可用于检测按钮和开关。 ![Closeup of LED connection with GPIO][8] -### **总结** +### 总结 -你也可以使用 Python 操控 LED - [这里有一些例子][9]。 也可以在容器内使用 i2c 设备。 此外,Podman 与此 Fedora 版本并不严格相关。 你可以在任何现有的 Fedora Edition 上安装它,或者在 Fedora 中使用两个基于 OSTree 的新系统进行尝试:[Fedora Silverblue][2] 和 [Fedora CoreOS][10]。 +你也可以使用 Python 操控 LED —— [这里有一些例子][9]。 也可以在容器内使用 i2c 设备。 此外,Podman 与此 Fedora 版本并不严格相关。你可以在任何现有的 Fedora 版本上安装它,或者在 Fedora 中使用两个基于 OSTree 的新系统进行尝试:[Fedora Silverblue][2] 和 [Fedora CoreOS][10]。 ------ @@ -184,7 +168,7 @@ via: https://fedoramagazine.org/turnon-led-fedora-iot/ 作者:[Alessio Ciregia][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[ScarboroughCoral](https://github.com/ScarboroughCoral) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -199,3 +183,4 @@ via: https://fedoramagazine.org/turnon-led-fedora-iot/ [8]: https://fedoramagazine.org/wp-content/uploads/2018/08/breadboard-1024x768.png [9]: https://github.com/brgl/libgpiod/tree/master/bindings/python/examples [10]: https://coreos.fedoraproject.org/ +[11]: https://fedoramagazine.org/announcing-fedora-29/ From 0b47390027f6c47b7aaeb9eda119c43a61515d79 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 00:29:13 +0800 Subject: [PATCH 0302/4278] PUB:20180912 How to turn on an LED with Fedora IoT.md @ScarboroughCoral https://linux.cn/article-10380-1.html --- .../20180912 How to turn on an LED with Fedora IoT.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180912 How to turn on an LED with Fedora IoT.md (100%) diff --git a/translated/tech/20180912 How to turn on an LED with Fedora IoT.md b/published/20180912 How to turn on an LED with Fedora IoT.md similarity index 100% rename from translated/tech/20180912 How to turn on an LED with Fedora IoT.md rename to published/20180912 How to turn on an LED with Fedora IoT.md From 861c58e526212cae696ef929fc33c0a4af3f91dc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 01:31:15 +0800 Subject: [PATCH 0303/4278] PRF:20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @jlztan --- ...tmas In Linux Way With These Wallpapers.md | 79 ++++++++++++------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md index 3c282ce7d5..5bd416a424 100644 --- a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md +++ b/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @@ -1,24 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (jlztan) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Celebrate Christmas In Linux Way With These Wallpapers) [#]: via: (https://itsfoss.com/christmas-linux-wallpaper/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) [#]: url: ( ) -使用这些壁纸以 Linux 的方式庆祝圣诞节 +以 Linux 的方式庆祝圣诞节 ====== -当前正是假日季节,很多人可能已经在庆祝圣诞节了。我代表 It's FOSS 团队祝你圣诞快乐,新年快乐。 +当前正是假日季,很多人可能已经在庆祝圣诞节了。祝你圣诞快乐,新年快乐。 -为了延续节日氛围,我将向你展示一些非常棒的圣诞主题 [Linux壁纸][1]。在呈现这些壁纸之前,先来看一棵 Linux 终端下的圣诞树。 +为了延续节日氛围,我将向你展示一些非常棒的圣诞主题的 [Linux 壁纸][1]。在呈现这些壁纸之前,先来看一棵 Linux 终端下的圣诞树。 + +### 让你的桌面飘雪(针对 GNOME 用户) + +- [Let it Snow on Your Linux Desktop](https://youtu.be/1QI1ludzZuA) + +如果您在 Ubuntu 18.04 或任何其他 Linux 发行版中使用 GNOME 桌面,您可以使用一个小的 [GNOME 扩展][55]并在桌面上飘雪。 + +您可以从软件中心或 GNOME 扩展网站获取此 gsnow 扩展。我建议您阅读一些关于[使用 GNOME 扩展][55]的内容。 + +安装此扩展程序后,您会在顶部面板上看到一个小雪花图标。 如果您单击一次,您会看到桌面屏幕上的小絮状物掉落。 + +![](https://itsfoss.com/wp-content/uploads/2018/12/snowfall-on-linux-desktop-1.webm) + +你可以再次点击该图标来禁止雪花落下。 ### 在 Linux 终端下显示圣诞树 -圣诞树的效果如 [这个页面](https://giphy.com/embed/xUNda6KphvbpYxL3tm) 所示。 +![Display Christmas Tree in Linux Terminal](https://i.giphy.com/xUNda6KphvbpYxL3tm.gif) -使用以下命令在终端中显示一棵动画圣诞树: +如果你想要在终端里显示一个动画的圣诞树,你可以使用如下命令: ``` curl https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh | bash @@ -40,7 +54,7 @@ perl -MCPAN -e 'install Acme::POE::Tree' 你可以阅读 [原文][5] 来了解更多信息。 -## 下载 Linux 圣诞主题壁纸 +### 下载 Linux 圣诞主题壁纸 所有这些 Linux 圣诞主题壁纸都是由 Mark Riedesel 制作的,你可以在 [他的网站][6] 上找到很多其他艺术品。 @@ -48,87 +62,95 @@ perl -MCPAN -e 'install Acme::POE::Tree' 注意一个小地方,这里显示的图片都是高度压缩的,因此你要通过图片下方提供的链接进行下载。 +![Christmas Linux Wallpaper][56] + +*[下载此壁纸][57]* + ![Christmas Linux Wallpaper][7] -[下载此壁纸][8] +*[下载此壁纸][8]* [![Christmas Linux Wallpapers][9]][10] -[下载此壁纸][11] +*[下载此壁纸][11]* [![Christmas Linux Wallpapers][12]][13] -[下载此壁纸][14] +*[下载此壁纸][14]* [![Christmas Linux Wallpapers][15]][16] -[下载此壁纸][17] +*[下载此壁纸][17]* [![Christmas Linux Wallpapers][18]][19] -[下载此壁纸][20] +*[下载此壁纸][20]* [![Christmas Linux Wallpapers][21]][22] -[下载此壁纸][23] +*[下载此壁纸][23]* [![Christmas Linux Wallpapers][24]][25] -[下载此壁纸][26] +*[下载此壁纸][26]* [![Christmas Linux Wallpapers][27]][28] -[下载此壁纸][29] +*[下载此壁纸][29]* [![Christmas Linux Wallpapers][30]][31] -[下载此壁纸][32] +*[下载此壁纸][32]* [![Christmas Linux Wallpapers][33]][34] -[下载此壁纸][35] +*[下载此壁纸][35]* [![Christmas Linux Wallpapers][36]][37] -[下载此壁纸][38] +*[下载此壁纸][38]* [![Christmas Linux Wallpapers][39]][40] -[下载此壁纸][41] +*[下载此壁纸][41]* [![Christmas Linux Wallpapers][42]][43] -[下载此壁纸][44] +*[下载此壁纸][44]* [![Christmas Linux Wallpapers][45]][46] -[下载此壁纸][47] +*[下载此壁纸][47]* [![Christmas Linux Wallpapers][48]][49] -[下载此壁纸][50] +*[下载此壁纸][50]* ### 福利:Linux 圣诞颂歌 这是给你的一份福利,给像我们一样的 Linux 爱好者的关于 Linux 的圣诞颂歌。 -在 [计算机世界的一篇文章][51] 中,[Sandra Henry-Stocker][52] 分享了这些圣诞颂歌。摘录片段如下: +在 [《计算机世界》的一篇文章][51] 中,[Sandra Henry-Stocker][52] 分享了这些圣诞颂歌。摘录片段如下: 这一段用的 [Chestnuts Roasting on an Open Fire][53] 的曲调: -> Running merrily on open source +> Running merrily on open source +> > With users happy as can be +> > We’re using Linux and getting lots done + > And happy everything is free 这一段用的 [The Twelve Days of Christmas][54] 的曲调: -> On my first day with Linux, my admin gave to me a password and a login ID +> On my first day with Linux, my admin gave to me a password and a login ID +> > On my second day with Linux my admin gave to me two new commands and a password and a login ID 在 [这里][51] 阅读完整的颂歌。 -祝你享受 Linux! +Linux 快乐! ------ @@ -137,7 +159,7 @@ via: https://itsfoss.com/christmas-linux-wallpaper/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[jlztan](https://github.com/jlztan) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -197,3 +219,6 @@ via: https://itsfoss.com/christmas-linux-wallpaper/ [52]: https://twitter.com/bugfarm [53]: https://www.youtube.com/watch?v=dhzxQCTCI3E [54]: https://www.youtube.com/watch?v=oyEyMjdD2uk +[55]: https://itsfoss.com/gnome-shell-extensions/ +[56]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2018.jpeg?w=800&ssl=1 +[57]: http://www.klowner.com/wallery/christmas_tux_2018/download/ChristmasTux2018_4K_3840x2160.png From f4d4fcbd6a1450f476790a478e07b485f56987f7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 01:32:10 +0800 Subject: [PATCH 0304/4278] PUB:20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @jlztan https://linux.cn/article-10381-1.html --- ... Celebrate Christmas In Linux Way With These Wallpapers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md (99%) diff --git a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md similarity index 99% rename from translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md rename to published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md index 5bd416a424..3aa2e6f3ea 100644 --- a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md +++ b/published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (jlztan) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Celebrate Christmas In Linux Way With These Wallpapers) [#]: via: (https://itsfoss.com/christmas-linux-wallpaper/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10381-1.html) 以 Linux 的方式庆祝圣诞节 ====== From b79701152bd84f5d8ba01c4737947967656861f9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Dec 2018 08:44:40 +0800 Subject: [PATCH 0305/4278] translated --- ...1208 Play Tetris at your Linux terminal.md | 57 ------------------- ...1208 Play Tetris at your Linux terminal.md | 57 +++++++++++++++++++ 2 files changed, 57 insertions(+), 57 deletions(-) delete mode 100644 sources/tech/20181208 Play Tetris at your Linux terminal.md create mode 100644 translated/tech/20181208 Play Tetris at your Linux terminal.md diff --git a/sources/tech/20181208 Play Tetris at your Linux terminal.md b/sources/tech/20181208 Play Tetris at your Linux terminal.md deleted file mode 100644 index db1fe62c24..0000000000 --- a/sources/tech/20181208 Play Tetris at your Linux terminal.md +++ /dev/null @@ -1,57 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Play Tetris at your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-tetris) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Play Tetris at your Linux terminal -====== - -Recreate the magic of the 1980s with everyone's favorite tile-matching game, Tetris. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-tetris.png?itok=_UXtpgzN) - -Thanks for joining us for today's installment of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game or any simple diversion that helps you have fun at the terminal. - -It's quite possible that some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -I promised when I started this series I'd be including games, but so far I've neglected to, so let's fix that with today's selection: Tetris. - -Tetris and I are almost exactly the same age, having first come into the world in the summer of 1984. Instead of rural North Carolina, though, Tetris originated in Moscow in what was at the time the Soviet Union. - -After taking the world by storm, Tetris was cloned many, many times. I would suspect you could find a Tetris clone for just about any operating system in any language you looked for. Seriously, go look. There are some fun ones out there. - -The [version][1] I'm bringing you for today's command-line toy is [written in Haskell,][1] and it's one of the better-done versions I've seen, with on-screen preview, score, help, and a clean look. - -If you're willing to run a compiled binary from an untrusted source (I wouldn't recommend it), you can grab that directly, but for a safer approach, it's also easy to use a containerized version with [dex][2], or to install from source with [stack][3]. - -This particular Tetris clone is by Sam Tay and available under a BSD license. [Check it out][1]! - -![](https://opensource.com/sites/default/files/uploads/linux-toy-tetris-animated.gif) - -If you've got your own favorite Tetris clone (or maybe you've written your own?), let us know! - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Plan your own holiday calendar at the Linux command line][4], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-tetris - -作者:[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://github.com/samtay/tetris -[2]: https://github.com/dockerland/dex -[3]: https://docs.haskellstack.org/en/stable/README/#how-to-install -[4]: https://opensource.com/article/18/12/linux-toy-cal diff --git a/translated/tech/20181208 Play Tetris at your Linux terminal.md b/translated/tech/20181208 Play Tetris at your Linux terminal.md new file mode 100644 index 0000000000..110990cc61 --- /dev/null +++ b/translated/tech/20181208 Play Tetris at your Linux terminal.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Play Tetris at your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-tetris) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端上玩俄罗斯方块 +====== + +用每个人最喜欢的砖块配对游戏俄罗斯方块重新创造 20 世纪 80 年代的魔力。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-tetris.png?itok=_UXtpgzN) + +感谢你来浏览我们今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己,什么是命令行玩具。即使我不太确定,但一般来说,它可能是一个游戏或任何消遣,可以帮助你在终端获得乐趣。 + +很可能你们中的一些人之前会看到过我们日历中的各种选择,但我们希望每个人至少遇到一件新事物。 + +我承诺在我开始这个系列时,我会介绍游戏,但到目前为止,我忽略了它,所以我们今天的选择就是游戏:俄罗斯方块。 + +俄罗斯方块和我差不多年纪,都在 1984 年夏天来到世界。不过,俄罗斯方块不是来自北卡罗来纳州的农村地区,而是来自当时苏联的莫斯科。。 + +在风靡世界之后,俄罗斯方块被克隆过很多次。我怀疑你可以找到任何你想找的任何语言、操作系统的俄罗斯方块的克隆。说真的,去看看吧。会有一些有趣的。 + +我今天带来的命令行[版本][1]是[用 Haskell 编写]的,它是我见过的做得更好的版本之一,有屏幕预览、得分、帮助、干净的外观。 + +如果你愿意从不受信任的来源运行已编译的二进制文件(我不推荐它),你可以直接获取它,但有个更安全的方法,使用 [dex][2] 的容器化版本也很容易,或者使用 [stack][3] 从源代码安装。 + +这个俄罗斯方块克隆版是由 Sam Tay 编写的,并且在 BSD 许可证下。[请看这里][1]! + +![](https://opensource.com/sites/default/files/uploads/linux-toy-tetris-animated.gif) + +如果你有自己喜欢的俄罗斯方块克隆版(或者你自己写的?),请告诉我们! + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +查看昨天的玩具,[在 Linux 命令行中计划你自己的假期日历][4],明天再回来查看! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-tetris + +作者:[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://github.com/samtay/tetris +[2]: https://github.com/dockerland/dex +[3]: https://docs.haskellstack.org/en/stable/README/#how-to-install +[4]: https://opensource.com/article/18/12/linux-toy-cal \ No newline at end of file From 4f3d40b41af408e55a32f63aaacfb6da58c1b084 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Dec 2018 09:00:02 +0800 Subject: [PATCH 0306/4278] Rename \20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md to 20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md --- ...on is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" => sources/talk/20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md (100%) diff --git "a/sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" b/sources/talk/20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md similarity index 100% rename from "sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" rename to sources/talk/20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md From 4a1613b4caef0c54d8fde93b3e4c3870fb3b7ac6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Dec 2018 09:04:33 +0800 Subject: [PATCH 0307/4278] translating --- .../tech/20181221 Listen to the radio at the Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181221 Listen to the radio at the Linux terminal.md b/sources/tech/20181221 Listen to the radio at the Linux terminal.md index 268ba37568..1d4b241ccb 100644 --- a/sources/tech/20181221 Listen to the radio at the Linux terminal.md +++ b/sources/tech/20181221 Listen to the radio at the Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a6af6f8bc235092736ed32104a87ead725d4aef1 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 25 Dec 2018 13:36:29 +0800 Subject: [PATCH 0308/4278] Translating How to Update Ubuntu. --- ...buntu -Terminal - GUI Methods- It-s FOSS.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 85d88129e7..13d393b381 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -121,25 +121,25 @@ apt list --upgradable sudo apt autoremove ``` -#### 在 Ubuntu Server 中热修复内核以避免重启 +#### 在 Ubuntu Server 中内核热修复以避免重启 -In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. +如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将是一个问题。 -[Live patching][15] feature allows the patching of Linux kernel while the kernel is still running. In other words, you don’t have to reboot your system. +[热修复][15]功能允许Linux内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。 -If you manage servers, you may want to [enable live patching in Ubuntu][16]. +如果你在管理服务器,你可能需要[在 Ubuntu 中启用热修复][16]。 #### 版本升级是不同的 -The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). +本文讨论的更新是使你安装的 Ubuntu 保持最新。它不包括[版本升级][17](例如从 Ubuntu 16.04 升级到 18.04)。 -[Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. +[Ubuntu 版本][18] 升级完全是另一回事。它更新整个操作系统核心。你需要在这个漫长的过程开始前做好备份。 ### 总结 -I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. +我希望你喜欢这个关于 Ubuntu 系统更新的教程并学到一些新东西。 -If you have any questions, please fee free to ask. If you are an experienced Linux users and have some tip that can make this tutorial more useful, please share it with the rest of us. +如果你有其他问题,请随时提出。如果你是一位经验丰富的 Linux 用户并且有些更好的技巧,请同我们分享。 -------------------------------------------------------------------------------- @@ -147,7 +147,7 @@ via: https://itsfoss.com/update-ubuntu/ 作者:[Abhishek Prakash][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 71af7c7c1083d003517db5621245fd2f95b3a9f4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 14:48:05 +0800 Subject: [PATCH 0309/4278] PRF:20180623 The IBM 029 Card Punch.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @wwhio 翻译的很棒!经典的文章。 --- .../talk/20180623 The IBM 029 Card Punch.md | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/translated/talk/20180623 The IBM 029 Card Punch.md b/translated/talk/20180623 The IBM 029 Card Punch.md index e13a10593c..07002cef6e 100644 --- a/translated/talk/20180623 The IBM 029 Card Punch.md +++ b/translated/talk/20180623 The IBM 029 Card Punch.md @@ -1,46 +1,49 @@ IBM 029 型打孔机 ====== -我知道这很学院派,可一行超过 80 个字符的代码还是让我抓狂。我也在网上见过不少人认为即在现代视网膜屏幕下也应当采用行长度为 80 个字符的标准,可他们都不理解我对破坏这一标准的怒火,就算 1 个字符也不行。 -在这一标准的黄金时期,一行代码的长度几乎不会超过 80 个字符的限制。在那时,这一限制是物理的,没有第 81 列用于存放第 81 个字符。每一个试图把函数名起的又长又臭的程序员都会在短暂的愉悦后迎来更多的麻烦,而这仅仅时因为没有足够的空间放下整个函数的声明。 +我知道这很学院派,可一行超过 80 个字符的代码还是让我抓狂。我也在网上见过不少人认为即使在现代的视网膜屏幕下也应当采用行长度为 80 个字符的标准,可他们都不理解我对破坏这一标准的怒火,就算多 1 个字符也不行。 -这一黄金时期也是打孔卡编程时期。在 20 世纪 60 年代, IBM 打孔卡的特性,也就是打孔卡的长度为 80 个字符成为了打孔卡的标准。这一标准在后来的电传打字机和哑终端时期得以延续,并逐渐成为操作系统中隐藏的细节。时至今日,即使我们用上了更大、更好的屏幕,偏向于使用更长的标识符而不是类似 `iswcntrl()` 这样令人难以猜测的函数名,可当你打开新的终端模拟器窗口时,默认的宽度依然是 80 个字符。 +在这一标准的黄金时期,一行代码的长度几乎不会超过 80 个字符的限制。在那时,这一限制是物理的,没有第 81 列用于存放第 81 个字符。每一个试图把函数名起的又长又臭的程序员都会在短暂的愉悦后迎来更多的麻烦,而这仅仅是因为没有足够的空间放下整个函数的声明。 -从 Quora 上的很多问题中可以发现,很多人并不能想象如何使用打孔卡给计算机编程。我承认,在很长的一段时间里我也不能理解卡编程成是如何工作的,因为这让我想到有很多劳工不停的给这些打孔卡打孔。当然,这是一个误解,程序员不需要亲自给打孔卡打孔,就像是火车调度员不用亲自扳道岔。程序员们有打孔机(也被称为键控打孔机key punches),这让他们可以使用打字机式的键盘给打孔卡打孔。这样的设备在 19 世纪 90 年代时就已经不是什么新技术了。 +这一黄金时期也是打孔卡punch card编程时期。在 20 世纪 60 年代,IBM 打孔卡设立了标准,这个标准就是打孔卡的宽度为 80 列。这个 80 列标准在后来的电传打字机和哑终端时期得以延续,并逐渐成为操作系统中隐藏的细节。时至今日,即使我们用上了更大、更好的屏幕,偏向于使用更长的标识符而不是类似 `iswcntrl()` 这样令人难以猜测的函数名,可当你打开新的终端模拟器窗口时,默认的宽度依然是 80 个字符。 + +从 Quora 上的很多问题中可以发现,很多人并不能想象如何使用打孔卡给计算机编程。我承认,在很长的一段时间里我也不能理解打孔卡编程是如何工作的,因为这让我想到就像劳工一样不停的给这些打孔卡打孔。当然,这是一个误解,程序员不需要亲自给打孔卡打孔,就像是火车调度员不用亲自扳道岔。程序员们有打孔机card punch machines(也被称为键控打孔机key punches),这让他们可以使用打字机式的键盘给打孔卡打孔。这样的设备在 19 世纪 90 年代时就已经不是什么新技术了。 那时,最为广泛使用的打孔机之一便是 IBM 029 型打孔机。就算在今天,它也许是最棒的打孔机。 ![][1] -IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件发售的。 System/360 是计算系统与外设所组成的一个系列,在 20 世纪 60 年代晚期,它几乎垄断了整个大型计算机市场。就像其它 System/360 外设一样, 029 型打孔机也是个大块头。那时,计算机和家具的界限还很模糊,但 029 型打孔机可不是那种会占领你的整张桌子的机器。它改进自 026 型打孔机,增加了新的字符支持,如括号,总体上也更加安静。与前辈 026 型所展出 20 世纪 40 年代的圆形按钮与工业化的样貌相比, 029 型的按键方正扁平、功能按键还有酷炫的蓝色高亮提示。它的另一个重要买点是它能够在数字区numeric fields左侧自动的填充 0 ,这证明了 JavaScript 程序员不是第一批懒得自己做左填充left-padding的程序员。 -(译者注:这项功能需要额外的 4 张 [标准模块系统卡SMS card](https://en.wikipedia.org/wiki/IBM_Standard_Modular_System)才能使用。例如设置数字区域长度为 6 列时,操作员只需要输入 73 ,打孔机会自动填充起始位置上的 4 个 0 ,故最终输出 000073。[更多信息](https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch)) +IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件发售的。System/360 是计算系统与外设所组成的一个系列,在 20 世纪 60 年代晚期,它几乎垄断了整个大型计算机市场。就像其它 System/360 外设一样,029 型打孔机也是个大块头。那时,计算机和家具的界限还很模糊,但 029 型打孔机可不是那种会占领你的整张桌子的机器。它改进自 026 型打孔机,增加了新的字符支持,如括号,总体上也更加安静。与前辈 026 型所展出 20 世纪 40 年代的圆形按钮与工业化的样貌相比,029 型的按键方正扁平、功能按键还有酷炫的蓝色高亮提示。它的另一个重要买点是它能够在数字区numeric field左侧自动的填充 0 ,这证明了 JavaScript 程序员不是第一批懒得自己做左填充left-padding的程序员。(LCTT 译注:这项功能需要额外的 4 张 [标准模块系统卡](https://en.wikipedia.org/wiki/IBM_Standard_Modular_System)SMS card才能使用。例如设置数字区域长度为 6 列时,操作员只需要输入 73 ,打孔机会自动填充起始位置上的 4 个 0 ,故最终输出 000073。[更多信息](https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch)) -等等!你说的是 IBM 在 1964 年发布了全新的打孔机?你知道那张在贝尔实验室拍摄的 Unix 之父正在使用电传打字机的照片吗?那是哪一年的来着?1970?打孔机不是应该在 20 世纪 60 年代中期到晚期时就过时了吗?是的,你也许会奇怪,为什么直到 1984 年, IBM 的产品目录中才出现 029 型打孔机的身影。事实上,直到 20 世纪 70 年代,大多数程序员仍然在使用打孔卡编程。其实二战期间就已经有人在用电传打字机了,可那时并没能普及。客观的讲,电传打字机几乎和打孔卡一样古老。也许和你想象的恰恰相反,并不是电传打字机本身限制了他的普及,而是计算时间。人们拒绝使用电传打字机的原因是,它是可交互的,它和计算机使用“在线”的传输方式"online" mode of communication。在以 Unix 为代表的分时操作系统被发明前,你和电脑的交互会被任何人的使用而打断,而这一点延迟通常意味着几千美元的损失。所以程序员们普遍选择离线地使用打孔机编程,再将打孔卡放入大型计算机中,作为批任务batch job执行。在那时,还没有即廉价又可靠的存储设备,可打孔卡的廉价优势已经足够让他成为那时最流行的数据存储方式了。那时的程序是书架上一落的打孔卡而不是硬盘里的一堆文件。 +等等!你说的是 IBM 在 1964 年发布了全新的打孔机?你知道那张在贝尔实验室拍摄的 Unix 之父正在使用电传打字机的照片吗?那是哪一年的来着?1970?打孔机不是应该在 20 世纪 60 年代中期到晚期时就过时了吗?是的,你也许会奇怪,为什么直到 1984 年,IBM 的产品目录中还会出现 029 型打孔机的身影 [^1]。事实上,直到 20 世纪 70 年代,大多数程序员仍然在使用打孔卡编程。其实二战期间就已经有人在用电传打字机了,可那时并没能普及。客观的讲,电传打字机几乎和打孔卡一样古老。也许和你想象的恰恰相反,并不是电传打字机本身限制了它的普及,而是计算时间。人们拒绝使用电传打字机的原因是,它是可交互的,它和计算机使用“在线”的传输方式"online" mode of communication。在以 Unix 为代表的分时操作系统被发明前,你和电脑的交互会被任何人的使用而打断,而这一点延迟通常意味着几千美元的损失。所以程序员们普遍选择离线地使用打孔机编程,再将打孔卡放入大型计算机中,作为批任务batch job执行。在那时,还没有即廉价又可靠的存储设备,可打孔卡的廉价优势已经足够让它成为那时最流行的数据存储方式了。那时的程序是书架上一摞打孔卡而不是硬盘里的一堆文件。 -那么实际使用 IBM 029 型打孔机是个什么样子呢?这很难向没有实际看过打孔卡的人解释。一张打孔卡通常有12行80列。打孔卡下面是从 1 到 9 的数字行digit rows,打孔卡上的每一列都有这些行所对应的数字。最上面的三行是空间行"zone" rows,通常由两行空白行和一行 0 行组成。第 12 行是打孔卡最顶层的行,接下来是 11 行,随后是从数字 0 到 9 所在的行。这个有点让人感到困惑的顺序的原因是打孔卡的上边缘被称为12 边12 edge、下边缘被称为 9 边9 edge。那时,为了让打孔卡便于整理,常常会剪去打孔卡的一个角。 +那么实际使用 IBM 029 型打孔机是个什么样子呢?这很难向没有实际看过打孔卡的人解释。一张打孔卡通常有 12 行 80 列。打孔卡下面是从 1 到 9 的数字行digit rows,打孔卡上的每一列都有这些行所对应的数字。最上面的三行是空间行"zone" rows,通常由两行空白行和一行 0 行组成。第 12 行是打孔卡最顶部的行,接下来是 11 行,随后是从数字 0 到 9 所在的行。这个有点让人感到困惑的顺序的原因是打孔卡的上边缘被称为12 边12 edge、下边缘被称为 9 边9 edge。那时,为了让打孔卡便于整理,常常会剪去打孔卡的一个角。 ![][2] -(译者注:可参考[EBCDIC 编码](https://zh.wikipedia.org/wiki/EBCDIC)) -在打孔卡发明之初,孔洞的形状是圆形的,但是 IBM 最终意识到如果使用窄长方形作为孔洞,一张卡就可以放下更多的列了。每一列中孔洞的不同组合就可以表达不同的字符。像 029 型这样的拥有人性化设计的打孔机除了完成本质的打孔任务外,还会在打孔卡最上方打印出每一列所对应的字符。输入是数字就在对应的数字行上打孔。输入的是字母或符号就用一个在空间列的孔和一或俩个在数字列的孔的组合表示,例如字母 A 就用一个在第 12 空间行的空和一个数字 1 所在行的孔表示。这是一种顺序编码,在第一台打孔机被发明后,也叫 Hollerith 编码。这种编码只能表示相对较小的一套字符集,小写字母就没有包含在这套字符集中,但它的优势在于保留了打孔卡的结构强度。如果直接使用二进制编码,打孔卡可能会因为孔洞过于密集而断裂。 +(LCTT 译注:可参考[EBCDIC 编码](https://zh.wikipedia.org/wiki/EBCDIC)) -打孔卡也有不同。在 20 世纪 60 年代,80 列虽然是标准,但表达的方式不一定相同。基础打孔卡是无标注的,但用于 COBOL 编程的打孔卡会把最后的 8 列保留,供标识数保存使用。这一标识数可以在打孔卡被打乱 (例如一叠打孔卡掉在地上了) 后用于自动排序。此外,第 7 列被用于表示本张打孔卡上的是否是上一张打孔卡一起构成一条语句。也就是说当你真的对 80 字符的限制感到绝望的时候,还可以用两张卡甚至更多的卡拼接成一条长语句。用于 FORTRAN 编程的打孔卡和 COBOL 打孔卡类似,但是定义的列不同。大学里使用的打孔卡通常会由其计算机中心加上水印,其他的设计则会在如 [1976 年美国独立 200 周年][3] 的特殊场合才会加入。 +在打孔卡发明之初,孔洞的形状是圆形的,但是 IBM 最终意识到如果使用窄长方形作为孔洞,一张卡就可以放下更多的列了。每一列中孔洞的不同组合就可以表达不同的字符。像 029 型这样的拥有人性化设计的打孔机除了完成本质的打孔任务外,还会在打孔卡最上方打印出每一列所对应的字符。输入是数字就在对应的数字行上打孔。输入的是字母或符号就用一个在空间列的孔和一或俩个在数字列的孔的组合表示,例如字母 A 就用一个在第 12 空间行的空和一个数字 1 所在行的孔表示。这是一种顺序编码,在第一台打孔机被发明后,也叫 Hollerith 编码。这种编码只能表示相对较小的一套字符集,小写字母就没有包含在这套字符集中。如今一些聪明的工程师可能想知道为什么打卡不干脆使用二进制编码 —— 毕竟,有 12 行,你可以编码超过 4000 个字符。 使用 Hollerith 编码是因为它确保在单个列中出现不超过三个孔。这保留了卡的结构强度。二进制编码会带来太多的孔,会因为孔洞过于密集而断裂。 -最终,这些打孔卡都要被计算机读取和计算。 IBM 出售的 System/360 大型计算机的外设 IBM 2540 可以以每分钟 1000 张打孔卡的速度读取这些卡片。IBM 2540 使用电刷扫过每张打孔卡,电刷通过孔洞就可以接触到卡片后面的金属板完成一次读取。一旦读取完毕, System/360 大型计算机就会把每张打孔卡上的数据使用一种定长的 8 位编码保存,这种编码是扩展的二进制十数交换码Extended Binary Coded Decimal Interchange Code,简写为 EBCDIC 编码。它的源自于早期打孔卡所使用的 BCDIDC 编码,这一 6 位编码使用低 4 位表示数字行,高 2 位表示空间行。程序员们在打孔卡上编写玩程序后,会把卡片们交给计算机操作员,操作员们会把这些卡片放入 IBM 2540 ,再把打印结果交给程序员。那时的程序员大多都没有见过计算机长什么样。 +打孔卡也有不同。在 20 世纪 60 年代,80 列虽然是标准,但表达的方式不一定相同。基础打孔卡是无标注的,但用于 COBOL 编程的打孔卡会把最后的 8 列保留,供标识数保存使用。这一标识数可以在打孔卡被打乱 (例如一叠打孔卡掉在地上了) 后用于自动排序。此外,第 7 列被用于表示本张打孔卡上的是否与上一张打孔卡一起构成一条语句。也就是说当你真的对 80 字符的限制感到绝望的时候,还可以用两张卡甚至更多的卡拼接成一条长语句。用于 FORTRAN 编程的打孔卡和 COBOL 打孔卡类似,但是定义的列不同。大学里使用的打孔卡通常会由其计算机中心加上水印,其它的设计则会在如 [1976 年美国独立 200 周年][3] 的特殊场合才会加入。 -程序员们真正能见到的是很多打孔机。 029 型打孔机虽然不是计算机,但这并不意味着它不是一台复杂的机器。看看这个由密歇根大学University of Michigan在 1967 年制作的[教学视频][4],你就能更好的理解使用一台 029 型打孔机是什么情形了。我会尽可能在这里总结这段视频,但如果你不去亲自看看的话,你会错过许多惊奇和感叹。 +最终,这些打孔卡都要被计算机读取和计算。IBM 出售的 System/360 大型计算机的外设 IBM 2540 可以以每分钟 1000 张打孔卡的速度读取这些卡片[^2] 。IBM 2540 使用电刷扫过每张打孔卡,电刷通过孔洞就可以接触到卡片后面的金属板完成一次读取。一旦读取完毕,System/360 大型计算机就会把每张打孔卡上的数据使用一种定长的 8 位编码保存,这种编码是扩增二进式十进交换码Extended Binary Coded Decimal Interchange Code,简写为 EBCDIC 编码。它是一种二进制编码,可以追溯自早期打孔卡所使用的 BCDIDC 编码 —— 其 6 位编码使用低 4 位表示数字行,高 2 位表示空间行。程序员们在打孔卡上编写完程序后,会把卡片们交给计算机操作员,操作员们会把这些卡片放入 IBM 2540 ,再把打印结果交给程序员。那时的程序员大多都没有见过计算机长什么样。 + +程序员们真正能见到的是很多打孔机。029 型打孔机虽然不是计算机,但这并不意味着它不是一台复杂的机器。看看这个由密歇根大学University of Michigan计算机中心在 1967 年制作的[教学视频][4],你就能更好的理解使用一台 029 型打孔机是什么情形了。我会尽可能在这里总结这段视频,但如果你不去亲自看看的话,你会错过许多惊奇和感叹。 029 型打孔机的结构围绕着一个打孔卡穿过机器的 U 形轨道开始。使用打孔机时,右手边也就是 U 形轨道的右侧顶部是进卡卡槽hopper,使用前通常在里面放入一叠未使用的打孔卡。虽然 029 型打孔机主要使用 80 列打孔卡,但在需要的情况下也可以使用更小号的打孔卡。在打孔机的使用过程中,打孔卡离开轨道右上端的进卡卡槽,顺着 U 形轨道移动并最终进入左上端的出卡卡槽stacker。这一流程可以保证出卡卡槽中的打孔卡按打孔时的先后顺序排列。 -029 型打孔机的开关在桌面下膝盖高度的位置。在开机后,连按两次 “装入FEED” 键让机器自动将打孔卡从进卡卡槽中取出并移动到机器内。 U 形轨道的底部是打孔机的核心区域,它由三个部分组成:右侧是等待区,中间是打孔操作区,左侧是阅读区。连按两次 “装入” 键,机器就会把一张打孔卡装入打孔机的打孔操作区,另一张打孔卡进入等待区。在打孔操作区上方有一个列数指示器来显示当前打孔所在的列的位置。这时,每按下一个按键,机器就会在打孔卡对应的位置打孔并在卡片的顶部打印按键对应的字符,随后将打孔卡向左移动一列。如果一张卡片的 80 列全部被打上了数据,这张卡片会被打孔操作区自动释放并进入阅读区,同时,一张新的打孔卡会被装入打孔操作区。如果没有打完全部的 80 列,可以使用 “释放REL (for release)” 键完成上面的操作。 +029 型打孔机的开关在桌面下膝盖高度的位置。在开机后,连按两次 “装入FEED” 键让机器自动将打孔卡从进卡卡槽中取出并移动到机器内。 U 形轨道的底部是打孔机的核心区域,它由三个部分组成:右侧是等待区,中间是打孔操作区,左侧是阅读区。连按两次 “装入” 键,机器就会把一张打孔卡装入打孔机的打孔操作区,另一张打孔卡进入等待区。在打孔操作区上方有一个列数指示器来显示当前打孔所在的列的位置。这时,每按下一个按键,机器就会在打孔卡对应的位置打孔并在卡片的顶部打印按键对应的字符,随后将打孔卡向左移动一列。如果一张卡片的 80 列全部被打上了数据,这张卡片会被打孔操作区自动释放并进入阅读区,同时,一张新的打孔卡会被装入打孔操作区。如果没有打完全部的 80 列,可以使用 “释放REL” 键完成上面的操作。 -在打孔卡上打印对应的字符这一设计让人很容易分辨出错误。但就像密歇根大学的视频中警告的那样,打孔卡上修正一个错误可不像擦掉一个打印的字符然后再写上一个新的那样容易,因为计算机只会根据卡片上的孔来读取信息。因为被打出的孔不能被复原unpunched,所以并不能直接退回一列然后再打上一个新的字符。打出更多的孔也只能让这一列的组合变成一个无效字符。 IBM 029 型打孔机上虽然有一个可以让打孔卡回退一列的退格按键,但这个按键被放置在机器上而非在键盘上。这样的设计也许是为了阻止这个按键的使用,因为实际上很少有用户需要这个功能。 +在打孔卡上打印对应的字符这一设计让人很容易分辨出错误。但就像密歇根大学的视频中警告的那样,打孔卡上修正一个错误可不像擦掉一个打印的字符然后再写上一个新的那样容易,因为计算机只会根据卡片上的孔来读取信息。因为被打出的孔不能被复原unpunched,所以并不能直接退回一列然后再打上一个新的字符。打出更多的孔也只能让这一列的组合变成一个无效字符。IBM 029 型打孔机上虽然有一个可以让打孔卡回退一列的退格按键,但这个按键被放置在机器上而非在键盘上。这样的设计也许是为了阻止这个按键的使用,因为实际上很少有用户需要这个功能。 -实际上,只有废弃错误的打孔卡再在新的打孔卡上重新打孔这一种修正错误的方式。这就是阅读区的用武之处了。当你发现打孔卡上的第 68 列出错时,你需要在新的打孔卡上小心的给前 67 列打孔,然后给第 68 列打上正确的字母。另一种操作方式是把带有错误信息的打孔卡放在阅读区,同时在打孔操作区载入一张新的打孔卡,然后按下 “重复DUP (for duplicate)” 按键直到列数指示器显示 68 列。这时按下正确的字符来修正错误。阅读区和重复按键使得 029 型打孔机很容易复制打孔卡上的内容。当然,这一功能的使用可能有各种各样的原因,但改错是最常见的。 +实际上,只有废弃错误的打孔卡再在新的打孔卡上重新打孔这一种修正错误的方式。这就是阅读区的用武之处了。当你发现打孔卡上的第 68 列出错时,你需要在新的打孔卡上小心的给前 67 列重新打孔,然后给第 68 列打上正确的字母。另一种操作方式是把带有错误信息的打孔卡放在阅读区,同时在打孔操作区载入一张新的打孔卡,然后按下 “重复DUP” 按键直到列数指示器显示 68 列。这时按下正确的字符来修正错误。阅读区和重复按键使得 029 型打孔机很容易复制打孔卡上的内容。当然,这一功能的使用可能有各种各样的原因,但改错是最常见的。 + +(LCTT 译注:有一种说法是“补丁”这个用于对已经发布的软件进行修复的术语来源于对打孔纸带或打孔卡上打错的孔贴上补丁的做法。可能对于长长的一卷打孔纸带来说,由于个别字母的错误而整个废弃成本过高,会采用“补丁”的方式;而对于这种单张式的打孔卡来说,重新打印一张正确的更为方便。) “重复”按键允许 029 型打孔机的操作员手动调用重复的函数。但是 029 型打孔机还可以设置为自动重复。当用于记录数据而不是编程时,这项功能十分有效。举个例子,当用打孔卡来记录大学生的信息时,每张卡片上都需要输入学生的宿舍楼的名字,如果发现所输入信息的学生都在同一栋楼,就可以使用 029 型打孔机的自动重复功能来完成宿舍楼名称的填写。 -像这样的自动化操作可以通过打孔卡给 029 型打孔机编程控制。安装打孔卡的圆柱形装置drum就在 U 形轨道中间部分的右上角。通过使用 029 型在打孔卡上写下程序,然后把打孔卡的装入圆柱形装置,再将其安装到打孔机内后,就完成了一次给 029 型打孔机的编程任务。用户可以通过这种方式对打孔卡的每一列都按需要定义不同的自动化操作。029 型打孔机允许指定某些列重复上一张打孔卡相同位置的字符,这就是它能更快的输入学生信息的理由。它还允许指定某些列只能输入数字或者字母,指定特定的列为空或者到某一列时就直接跳过一整张打孔卡。这样的可编程特性使它在输入拥有固定格式的数据时效率很高。密歇根大学制作的[进阶教学视频][5]包括了给 029 型打孔机编程的过程,如果你已经掌握了它的基础操作,就快去看看吧。 +像这样的自动化操作可以通过程序鼓program drum编程到 029 型打孔机里面。程序鼓就安装在打孔操作区上方的 U 形轨道中间部分的右上角。通过在打孔卡上写下程序,然后把打孔卡装入程序鼓中,就完成了一次给 029 型打孔机的编程任务。用户可以通过这种方式对打孔卡的每一列都按需要定义不同的自动化操作。029 型打孔机允许指定某些列重复上一张打孔卡相同位置的字符,这就是它能更快的输入学生信息的理由。它还允许指定某些列只能输入数字或者字母,指定特定的列为空或者到某一列时就直接跳过一整张打孔卡。编程鼓使它在打孔特定列有特殊含义的固定模式卡片时很容易。密歇根大学制作的另一个[进阶教学视频][5]包括了给 029 型打孔机编程的过程,如果你已经掌握了它的基础操作,就快去看看吧。 这会儿,无论你是否看了密歇根大学制作的视频,都会感叹打孔机的操作之简便。虽然修正错误的过程很乏味,但除此之外,操作一台打孔机并不像想象的那样复杂。我甚至可以想象打孔卡之间的无缝切换让 COBOL 和 FORTRAN 程序员忘记了他们的程序是打在不同的打孔卡上而不是写在一个连续的文本文件内。另一方面,思考一下打孔机是如何影响编程语言的发展也是很有趣的,虽然它仅仅是一台输入设备。结构化编程最终会出现并鼓励程序员把整个代码块视为一个整体,但可以想象打孔卡程序员们强调每一行的作用且难以认同结构化编程的场景。同时你能够理解他们为什么不把代码块闭合所使用的括号放在单独的一行,只是因为这样会浪费打孔卡。 @@ -48,6 +51,9 @@ IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件 喜欢吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][7] 或者订阅我们的 [RSS][8],这样你就能在第一时间收到新文章的通知。 +[^1]: “IBM 29 Card Punch,” IBM Archives, accessed June 23, 2018, https://www-03.ibm.com/ibm/history/exhibits/vintage/vintage_4506VV4002.html. +[^2]: IBM, IBM 2540 Component Description and Operation Procedures (Rochester, MN: IBM Product Publications, 1965), September 06, 2009, accessed June 23, 2018, http://bitsavers.informatik.uni-stuttgart.de/pdf/ibm/25xx/A21-9033-1_2540_Card_Punch_Component_Description_1965.pdf. + -------------------------------------------------------------------------------- via: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html @@ -55,7 +61,7 @@ via: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html 作者:[Two-Bit History][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 441afeddb9a87fdf9b6dbf9d24e3fc9e3aefcd03 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 14:48:32 +0800 Subject: [PATCH 0310/4278] PUB:20180623 The IBM 029 Card Punch.md @wwhio https://linux.cn/article-10382-1.html --- {translated/talk => published}/20180623 The IBM 029 Card Punch.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180623 The IBM 029 Card Punch.md (100%) diff --git a/translated/talk/20180623 The IBM 029 Card Punch.md b/published/20180623 The IBM 029 Card Punch.md similarity index 100% rename from translated/talk/20180623 The IBM 029 Card Punch.md rename to published/20180623 The IBM 029 Card Punch.md From 4948a9861a515121340154a44b4b5bf65f3a8cee Mon Sep 17 00:00:00 2001 From: amwps290 Date: Tue, 25 Dec 2018 21:10:16 +0800 Subject: [PATCH 0311/4278] Delete 20181217 Take a swim at your Linux terminal with asciiquarium.md --- ...t your Linux terminal with asciiquarium.md | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md diff --git a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md deleted file mode 100644 index 63741b5ccd..0000000000 --- a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md +++ /dev/null @@ -1,48 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( amwps290) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Take a swim at your Linux terminal with asciiquarium) -[#]: via: (https://opensource.com/article/18/12/linux-toy-asciiquarium) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Take a swim at your Linux terminal with asciiquarium -====== -Darling it's better, when your command line is wetter, thanks to ASCII. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-asciiquarium.png?itok=ZhJ9P2Ft) - -We're now nearing the end of our 24-day-long Linux command-line toys advent calendar. Just one week left after today! 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 fishy one. Say hello to **asciiquarium** , an undersea adventure for your terminal. I found **asciiquarium** in my Fedora repositories, so installing it was as simple as: - -``` -$ sudo dnf install asciiquarium -``` - -If you're running a different distribution, chances are it's packaged for you too. Just run **asciiquarium** at your terminal to feel happy as a clam. The project has been translated outside of the terminal as well, with screensavers of all of the aquatic pals being made for several non-Linux operating systems, and even an Android live wallpaper version is floating around out there. - -Visit the **asciiquarium** [homepage][1] for more information or to download the Perl source code. The project is open source under a GPL version 2 license. And if you want to learn more about how open source, open data, and open science are making a difference in the actual oceans, take a moment to go learn about the [Ocean Health Index][2]. -![](https://opensource.com/sites/default/files/uploads/linux-toy-asciiquarium-animated.gif) -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, [Schedule a visit with the Emacs psychiatrist][3], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-asciiquarium - -作者:[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://robobunny.com/projects/asciiquarium/html/ -[2]: https://opensource.com/article/18/12/protecting-world-oceans -[3]: https://opensource.com/article/18/12/linux-toy-eliza From b7feec1a6143dffedd57a04d4dbe7441b3dfe9f0 Mon Sep 17 00:00:00 2001 From: amwps290 Date: Tue, 25 Dec 2018 21:13:26 +0800 Subject: [PATCH 0312/4278] Create 20181217 Take a swim at your Linux terminal with asciiquarium.md --- ...t your Linux terminal with asciiquarium.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md diff --git a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md new file mode 100644 index 0000000000..04ba82841c --- /dev/null +++ b/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -0,0 +1,51 @@ +[#]: collector: "lujun9972" +[#]: translator: " amwps290" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Take a swim at your Linux terminal with asciiquarium" +[#]: via: "https://opensource.com/article/18/12/linux-toy-asciiquarium" +[#]: author: "Jason Baker https://opensource.com/users/jason-baker" + +# 使用 asciiquarium 在你的终端里探索海洋的秘密 + +亲爱的,当您的命令行变得更湿润的时候会更好。这多亏了 ASCII。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-asciiquarium.png?itok=ZhJ9P2Ft) + +现在,我们即将数完长达 24 天的 Linux 命令行玩具倒数日历。离今天只剩一周了!如果这是您第一次访问本系列文章,那么您可能会问自己什么是命令行玩具。我们一边走,一边说,但一般来说,这可能是一个游戏,或者可以帮助你在终端玩得开心的任何简单的娱乐活动。 + +你们其中的一些人可能已经在以前的系列文章中看到了各种各样的命令行玩具。但是,我们希望每个人都能够获得一个新玩具。 + +今天的玩具有一点鱼的味道。先和 **asciiquarium** 打个招呼,一个在你终端里海底冒险的玩具。我是在我的 Fedora 仓库里发现 asciiquarium 的,因此安装它非常容易: + +``` +$ sudo dnf install asciiquarium +``` + +如果您正在运行不同的发行版,那么它也可能已经为您打包。 只需在您的终端中运行 **asciiquarium** 即可感受到蛤蜊的快乐。 该项目也在终端之外进行了“翻译”,所有水族伙伴的屏保都是为非 Linux 操作系统制作的,甚至还有一个 Android 动态壁纸版本。 + +访问 **asciiquarium** [主页][1]了解更多信息或下载 Perl 源代码。 该项目是 GPL 第 2 版许可证下的开源项目。 如果你想更多地了解开源,开放数据和开放科学如何在实际的海洋中发挥作用,请花点时间去了解[海洋健康指数][2]。 + +![](https://opensource.com/sites/default/files/uploads/linux-toy-asciiquarium-animated.gif) + + +你觉得我应该介绍一下你最喜欢的命令行玩具吗?时间不多了,但我还是想听听你的建议。请在下面的评论中告诉我,我会查阅的。让我知道你对今天的娱乐有什么看法。 + +一定要看看昨天的玩具,[安排一次与 Emacs 精神病医生的访问][3],明天再来看另一个玩具! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-asciiquarium + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[amwps290](https://github.com/amwps290) +校对:[校对者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://robobunny.com/projects/asciiquarium/html/ +[2]: https://opensource.com/article/18/12/protecting-world-oceans +[3]: https://opensource.com/article/18/12/linux-toy-eliza From 75ad593185d633f2465bf9d65dd2512d0494154c Mon Sep 17 00:00:00 2001 From: amwps290 Date: Tue, 25 Dec 2018 21:49:24 +0800 Subject: [PATCH 0313/4278] Update 20171114 Finding Files with mlocate- Part 2.md --- sources/tech/20171114 Finding Files with mlocate- Part 2.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20171114 Finding Files with mlocate- Part 2.md b/sources/tech/20171114 Finding Files with mlocate- Part 2.md index 19c546a917..7a99b3793a 100644 --- a/sources/tech/20171114 Finding Files with mlocate- Part 2.md +++ b/sources/tech/20171114 Finding Files with mlocate- Part 2.md @@ -1,3 +1,4 @@ +translating by amwps290 Finding Files with mlocate: Part 2 ====== From ca79380c77093ceef4ad9c53feaa6e71745ecd7c Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 25 Dec 2018 22:01:13 +0800 Subject: [PATCH 0314/4278] zhs852 is translating --- .../tech/20181213 Relax by the fire at your Linux terminal.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20181213 Relax by the fire at your Linux terminal.md b/sources/tech/20181213 Relax by the fire at your Linux terminal.md index f9a53fc4c4..7eae421047 100644 --- a/sources/tech/20181213 Relax by the fire at your Linux terminal.md +++ b/sources/tech/20181213 Relax by the fire at your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,6 +7,8 @@ [#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) +zhs852 is translating. + Relax by the fire at your Linux terminal ====== Chestnuts roasting on an open command prompt? Why not, with this fun Linux toy. From 5f03c1fc10ecd3f1ae32aa5add57034fe44f2a39 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 22:17:47 +0800 Subject: [PATCH 0315/4278] PRF:20171012 7 Best eBook Readers for Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zjon 翻译后,应该再次阅读以保证通顺。 --- ...20171012 7 Best eBook Readers for Linux.md | 102 +++++++++--------- 1 file changed, 54 insertions(+), 48 deletions(-) diff --git a/translated/tech/20171012 7 Best eBook Readers for Linux.md b/translated/tech/20171012 7 Best eBook Readers for Linux.md index 520c9c4533..346eed6bb6 100644 --- a/translated/tech/20171012 7 Best eBook Readers for Linux.md +++ b/translated/tech/20171012 7 Best eBook Readers for Linux.md @@ -1,63 +1,65 @@ 7 个最佳 Linux 电子书阅读器 ====== -**摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 + +**摘要:** 本文中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳的阅读体验甚至可以管理你的电子书。 ![最佳 Linux 电子书阅读器][1] -最近,随着人们发现在手持设备,Kindle 或者 PC 上阅读更佳舒适,对电子图书的需求有所增加。谈到 Linux 用户,有各种电子书应用满足你阅读和整理电子书的需求。 +最近,随着人们发现在手持设备、Kindle 或者 PC 上阅读更加舒适,对电子图书的需求有所增加。至于 Linux 用户,也有各种电子书应用满足你阅读和整理电子书的需求。 -在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf,epubs 和其他电子书格式。 +在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf、epub 和其他电子书格式。 -## 最佳 Linux 电子书阅读器 - -我提供 Ubuntu 安装说明,因为我现在使用。如果你使用[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 +我提供的是 Ubuntu 安装说明,因为我现在使用它。如果你使用的是[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 ### 1. Calibre -[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建私人电子][4] +[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建专业的电子书][4]。 -通过强大的电子书管理和易用的接口,它具有创建和编辑电子书。Calibre 支持多种格式和与其他电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 +通过强大的电子书管理和易用的界面,它提供了创建和编辑电子书的功能。Calibre 支持多种格式和与其它电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 -Calibre 最大的缺点是,资源上太沉重,让它成为一个艰难的选择作为一个独立的电子阅读器。 +Calibre 最大的缺点是,资源消耗太多,因此作为一个独立的电子阅读器来说是一个艰难的选择。 ![Calibre][5] #### 特性 - * 管理电子书:Calibre 通过管理云数据允许存储和分组电子书。你能下载一本电子书的元数据从各种来源或创建和编辑现有的字段。 - * 支持所有主流电子书格式: Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 - * 文件转换: 在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 + * 管理电子书:Calibre 通过管理元数据来排序和分组电子书。你能从各种来源下载一本电子书的元数据或创建和编辑现有的字段。 + * 支持所有主流电子书格式:Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 + * 文件转换:在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 * 从 web 下载杂志期刊:Calibre 能从各种新闻源或者通过 RSS 订阅源传递故事。 - * 分享和备份你的电子图书馆:它提供了一个选项,托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性允许你保证你的收藏安全和方便携带。 + * 分享和备份你的电子图书馆:它提供了一个选项,可以托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性可以确保你的收藏安全和方便携带。 #### 安装 你能在主流 Linux 发行版的软件库中找到它。对于 Ubuntu,在软件中心搜索它或者使用下面的命令: -`sudo apt-get install calibre` +``` +sudo apt-get install calibre +``` ### 2. FBReader ![FBReader: Linux 电子书阅读器][6] -[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub,fb2,mobi,rtf,html 等。它包含一些允许访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 +[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub、fb2、mobi、rtf、html 等。它包括了一些可以访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 #### 特性 - * 支持多种文件格式和设备比如 Android,iOS,Windows,Mac 和更多。 - * 同步书籍收藏,阅读位置和书签。 - * 在线管理你图书馆中从你的 Linux 桌面添加到所有设备的任何书。 - * 支持 Web 浏览器允许你的存储集。 - * 支持 Google Drive 做书籍的存储和通过作者,系列或其他属性整理书籍。 + * 支持多种文件格式和设备比如 Android、iOS、Windows、Mac 和更多。 + * 同步书集、阅读位置和书签。 + * 在线管理你图书馆,可以从你的 Linux 桌面添加任何书到所有设备。 + * 支持 Web 浏览器访问你的书集。 + * 支持将书籍存储在 Google Drive ,可以通过作者,系列或其他属性整理书籍。 #### 安装 -你能从官方库或者在终端中输入一下命令安装 FBReader 电子阅读器。 +你能从官方库或者在终端中输入以下命令安装 FBReader 电子阅读器。 + ``` sudo apt-get install fbreader ``` -或者你能从[这里][8]抓取一个以 .deb 包并在你的基于 Debian 发行版的系统上安装它。 +或者你能从[这里][8]抓取一个以 .deb 包,并在你的基于 Debian 发行版的系统上安装它。 ### 3. Okular @@ -67,29 +69,30 @@ sudo apt-get install fbreader #### 特性 - * Okular 支持多种文档格式像 PDF,Postscript,DjVu,DHM,XPS,ePub 和其他。 - * 支持在 PDF 文档中评论,高亮和绘制不通的形状等。 - * 无需修改原始 PDF 文件分别保存这些更改。 - * 电子书中的文本能被提取到一个文本文件,这个内置文本阅读服务叫 Jovie。 + * Okular 支持多种文档格式像 PDF、Postscript、DjVu、CHM、XPS、ePub 和其他。 + * 支持在 PDF 文档中评论、高亮和绘制不同的形状等。 + * 无需修改原始 PDF 文件,分别保存上述这些更改。 + * 电子书中的文本能被提取到一个文本文件,并且有个名为 Jovie 的内置文本阅读服务。 -备注:检查应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 +备注:查看这个应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统中不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 #### 安装 Ubuntu 用户可以在终端中键入下面的命令来安装它: + ``` sudo apt-get install okular ``` ### 4. Lucidor -Lucidor 是一个易用的支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有电子书集合在本地书柜里,搜索和下载互联网和 web 订阅和网页转换成电子书的功能。 +Lucidor 是一个易用的、支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有在本地书架里组织电子书集、从互联网搜索和下载,和将 Web 订阅和网页转换成电子书的功能。 -Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项卡式布局,和存储数据和配置时的展现。他是列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 +Lucidor 是 XULRunner 应用程序,它向您展示了具有类似火狐的选项卡式布局,和存储数据和配置时的行为。它是这个列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 ![lucidor][11] -你可以通过选择单词并右击 > 查找单词来查找 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 +你可以通过选择单词并右击“查找单词”来查找该单词在 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 你能从[这里][12]下载和安装 deb 或者 RPM 包。 @@ -97,9 +100,10 @@ Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项 ![Bookworm Linux 电子阅读器][13] -Bookworm 是另一个支持多种文件格式诸如 epub, pdf, mobi, cbr and cbz 的免费开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读: [Bookworm: 一个简单而强大的 Linux 电子阅读器][14] +Bookworm 是另一个支持多种文件格式诸如 epub、pdf、mobi、cbr 和 cbz 的自由开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读:[Bookworm:一个简单而强大的 Linux 电子阅读器][14] #### 安装 + ``` sudo apt-add-repository ppa:bookworm-team/bookworm sudo apt-get update @@ -108,15 +112,16 @@ sudo apt-get install bookworm ### 6. Easy Ebook Viewer -[Easy Ebook Viewer][15] 是另外一个用于读取 ePub 文件的很棒的 GTK python 应用.具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. +[Easy Ebook Viewer][15] 是又一个用于读取 ePub 文件的很棒的 GTK Python 应用。具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. ![Easy-Ebook-Viewer][16] -这个应用仍然处于初始阶段,只支持ePub文件。 +这个应用仍然处于初始阶段,只支持 ePub 文件。 #### 安装 -你可以从 [github][17] 下载源代码和自己编译以及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 +你可以从 [GitHub][17] 下载源代码,并自己编译它及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 + ``` sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi git clone https://github.com/michaldaniel/Ebook-Viewer.git @@ -124,19 +129,20 @@ cd Ebook-Viewer/ sudo make install ``` -成功完成上述步骤后,你可以从Dash启动它。 +成功完成上述步骤后,你可以从 Dash 启动它。 ### 7. Buka -Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 pdf 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看 2 页。 +Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 PDF 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看两页。 -你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 +你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka 也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 ![Buka][19] #### 安装 -你能从[官方下载页面][20]下载一个 AppImage。如果你不知道,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: +你能从[官方下载页面][20]下载一个 AppImage。如果你不知道如何做,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: + ``` sudo snap install buka ``` @@ -153,30 +159,30 @@ sudo snap install buka via: https://itsfoss.com/best-ebook-readers-linux/ 作者:[Ambarish Kumar][a] -译者:[zjon](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[zjon](https://github.com/zjon) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://itsfoss.com/author/ambarish/ -[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png +[1]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/10/best-ebook-readers-linux.png [2]:https://itsfoss.com/non-ubuntu-beginner-linux/ [3]:https://www.calibre-ebook.com [4]:https://itsfoss.com/create-ebook-calibre-linux/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg +[5]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg +[6]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg [7]:https://fbreader.org [8]:https://fbreader.org/content/fbreader-beta-linux-desktop [9]:https://okular.kde.org/ -[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png +[10]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/Okular-800x435.jpg +[11]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/lucidor-2.png [12]:http://lucidor.org/lucidor/download.php -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg +[13]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg [14]:https://itsfoss.com/bookworm-ebook-reader-linux/ [15]:https://github.com/michaldaniel/Ebook-Viewer -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg +[16]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg [17]:https://github.com/michaldaniel/Ebook-Viewer.git [18]:https://github.com/oguzhaninan/Buka -[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png +[19]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/Buka2-800x555.png [20]:https://github.com/oguzhaninan/Buka/releases [21]:https://itsfoss.com/use-appimage-linux/ From 7359ce880cbe791ae06b95f4d0d1ac78d0417945 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 22:20:12 +0800 Subject: [PATCH 0316/4278] PUB:20171012 7 Best eBook Readers for Linux.md @zjon https://linux.cn/article-10383-1.html --- .../tech => published}/20171012 7 Best eBook Readers for Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171012 7 Best eBook Readers for Linux.md (100%) diff --git a/translated/tech/20171012 7 Best eBook Readers for Linux.md b/published/20171012 7 Best eBook Readers for Linux.md similarity index 100% rename from translated/tech/20171012 7 Best eBook Readers for Linux.md rename to published/20171012 7 Best eBook Readers for Linux.md From 2244788472742c5dd92fd8836da7e68cc96cbe19 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Tue, 25 Dec 2018 22:59:31 +0800 Subject: [PATCH 0317/4278] Translated by qhwdw --- ...1 How to Build a Netboot Server, Part 3.md | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) rename {sources => translated}/tech/20181221 How to Build a Netboot Server, Part 3.md (59%) diff --git a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md b/translated/tech/20181221 How to Build a Netboot Server, Part 3.md similarity index 59% rename from sources/tech/20181221 How to Build a Netboot Server, Part 3.md rename to translated/tech/20181221 How to Build a Netboot Server, Part 3.md index 08c1a8a12e..e174248f62 100644 --- a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md +++ b/translated/tech/20181221 How to Build a Netboot Server, Part 3.md @@ -1,22 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () [#]: subject: (How to Build a Netboot Server, Part 3) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -How to Build a Netboot Server, Part 3 +如何构建一台网络引导服务器(第三部分) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot3-816x345.jpg) -The [How to Build a Netboot Server, Part 1][1] article provided a minimal [iPXE][2] boot script for your netboot image. Many users probably have a local operating system that they want to use in addition to the netboot image. But switching bootloaders using the typical workstation’s BIOS can be cumbersome. This part of the series shows how to set up some more complex iPXE configurations. These allow the end user to easily choose which operating system they want to boot. They also let the system administrator manage the boot menus from a central server. +在 [如何构建一台网络引导服务器(第一部分)][1] 的文章中,我们提供了一个极简的 [iPXE][2] 引导脚本来引导你的网络引导镜像。许多用户除了使用网络引导镜像外,可能在机器本地也有一个操作系统。但是使用常见的工作站的 BIOS 去切换引导加载器是很笨拙的。在本系列文件的第三部分,我们将向你展示如何设置一个更复杂的 iPXE 配置。它将允许终端用户以更容易的方式去选择引导哪个操作系统。它也可以配置为让系统管理员从一台中央服务器来统一管理引导菜单。 -### An interactive iPXE boot menu +### 一个交互式 iPXE 引导菜单 -The commands below redefine the netboot image’s boot.cfg as an interactive iPXE boot menu with a 5 second countdown timer: +下面这些命令重定义了网络引导镜像的 boot.cfg 来作为一个交互式的 iPXE 引导菜单,并使用了一个 5 秒倒计时的定时器: ``` $ MY_FVER=29 @@ -59,32 +59,33 @@ boot || goto failed END ``` -The above menu has five sections: +上述菜单有五个节: - * **menu** defines the actual menu that will be shown on the screen. - * **failed** notifies the user that something went wrong and drops the user to a shell so they can troubleshot the problem. - * **shell** provides an interactive command prompt. You can reach it either by pressing the **Esc** key while at the boot menu or if the “boot” command returns with a failure code. - * **lcl** contains a single command that tells iPXE to exit and return control back to the BIOS. Whatever you want to boot by default (e.g. the workstation’s local hard drive) **must** be listed as the next boot item right after iPXE in your workstation’s BIOS. - * **f29** contains the same netboot code used earlier but with the final exit replaced with goto failed. + * **menu** 定义了显示在屏幕上的实际菜单内容。 + * **failed** 提示用户发生了错误,并将用户带到 shell 以错误错误。 + * **shell** 提供了交互式命令提示符。你可以在引导菜单出现时按下 **Esc** 键进入,或者是 + “boot” 命令失败时也会进入到命令提示符。 + * **lcl** 包含一个提供给 iPXE 退出的简单命令,以及返还控制权给 BIOS。在 iPXE 之后,无论你希望缺省引导的设备(即:工作站的本地硬件)是什么,都必须在你的工作站的 BIOS 中正确地作为下一个引导设备列出来。 + * **f29** 包含前面文章提到同一个网络引导代码,但使用最终的退出代码来替换掉 goto failed。 -Copy the updated boot.cfg from your $HOME/esp/linux directory out to the ESPs of all your client systems. If all goes well, you should see results similar to the image below: +从你的 `$HOME/esp/linux` 目录中复制更新后的 boot.cfg 到所有客户端系统的 ESP 中。如果一切顺利,你应该会看到类似下面图片的结果: ![][3] -### A server hosted boot menu +### 一个服务器托管的引导菜单 -Another feature you can add to the netboot server is the ability to manage all the client boot menus from one central location. This feature can be especially useful when rolling out a new version of the OS. It lets you perform a sort of [atomic transaction][4] to switch all clients over to the new OS after you’ve copied the new kernel and initramfs out to the ESPs of all the clients. +你可以添加到网络引导服务器的另一个特性是,能够从一台中央位置去管理所有客户端的引导菜单。这个特性尤其适用于批量安装(升级)一个新版本的操作系统。在你将新内核和新的 initramfs 复制到所有客户端的 ESP 之后,这个特性可以让你执行一种 [原子事务][4] 去切换所有客户端到新操作系统。 -Install Mojolicious: +安装 Mojolicious: ``` $ sudo -i # dnf install -y perl-Mojolicious ``` -Define the “bootmenu” app: +定义 “bootmenu” 应用程序: ``` # mkdir /opt/bootmenu @@ -102,7 +103,7 @@ END # chmod 755 /opt/bootmenu/bootmenu.pl ``` -Define the configuration file for the bootmenu app: +为 “bootmenu” 应用程序定义配置文件: ``` # cat << END > /opt/bootmenu/bootmenu.conf @@ -115,16 +116,16 @@ Define the configuration file for the bootmenu app: END ``` -This is an extremely simple Mojolicious application that listens on port 80 and only answers to /menu requests. If you want a quick introduction to what Mojolicious can do, run man Mojolicious::Guides::Growing to view the manual. Use the **Q** key to quit the manual. +这是一个非常简单的 Mojolicious 应用程序,它监听 80 端口,并且只回复到 /menu 的请求。如果你想快速了解 Mojolicious 能做什么,运行 `man Mojolicious::Guides::Growing` 去查看手册。按 **Q** 键退出手册。 -Move boot.cfg over to our netboot app as a template named menu.html.ep: +将 boot.cfg 移到我们的网络引导应用程序中作为一个名为 menu.html.ep 的模板: ``` # mkdir /opt/bootmenu/templates # mv $HOME/esp/linux/boot.cfg /opt/bootmenu/templates/menu.html.ep ``` -Define a systemd service to manage the bootmenu app: +定义一个 systemd 服务去管理引导菜单应用程序: ``` # cat << END > /etc/systemd/system/bootmenu.service @@ -147,7 +148,7 @@ WantedBy=multi-user.target END ``` -Add an exception for the HTTP service to the local firewall and start the bootmenu service: +在本地防火墙中为 HTTP 服务添加一个例外规则,并启动 bootmenu 服务: ``` # firewall-cmd --add-service http @@ -156,7 +157,7 @@ Add an exception for the HTTP service to the local firewall and start the bootme # systemctl start bootmenu.service ``` -Test it with wget: +用 wget 测试它: ``` $ sudo dnf install -y wget @@ -164,7 +165,7 @@ $ MY_BOOTMENU_SERVER=server-01.example.edu $ wget -q -O - http://$MY_BOOTMENU_SERVER/menu ``` -The above command should output something similar to the following: +以上的命令应该会输出类似下面的内容: ``` #!ipxe @@ -198,9 +199,9 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.4-300.fc29.x86_64.img boot || goto failed ``` -Now that the boot menu server is working, rebuild the ipxe.efi bootloader with an init script that points to it. +现在,引导菜单服务器已经正常工作了,重新构建 ipxe.efi 引导加载器,使用一个 init 脚本指向它。 -First, update the init.ipxe script created in part one of this series: +第一步,先更新我们在本系列文章的第一部分中创建的 init.ipxe 脚本: ``` $ MY_BOOTMENU_SERVER=server-01.example.edu @@ -213,7 +214,7 @@ chain http://$MY_BOOTMENU_SERVER/menu || exit END ``` -Now, rebuild the boot loader: +现在,重新构建引导加载器: ``` $ cd $HOME/ipxe/src @@ -221,23 +222,23 @@ $ make clean $ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe ``` -Copy the updated bootloader to your ESP: +将更新后的引导加载器复制到你的 ESP 中: ``` $ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi ``` -After you’ve copied the updated bootloader to all your clients, you can make future updates to the boot menu simply by editing /opt/bootmenu/templates/menu.html.ep and running: +将更新后的引导加载器复制到所有的客户端中之后,以后更新引导菜单只需要简单地编辑 `/opt/bootmenu/templates/menu.html.ep` 文件,然后再运行如下命令: ``` $ sudo systemctl restart bootmenu.service ``` -### Making further changes +### 做一步的改变 -If the boot menu server is working properly, you’ll longer need the the boot.cfg file on your client systems. +如果引导菜单服务器工作正常,在你的客户端系统上的 boot.cfg 文件将更长。 -For example, re-add the Fedora 28 image to the boot menu: +比如,重新添加 Fedora 28 镜像到引导菜单中: ``` $ sudo -i @@ -259,18 +260,17 @@ END # systemctl restart bootmenu.service ``` -If all goes well, your clients should see results similar to the image below the next time they boot: +如果一切顺利,你的客户端下次引导时,应该看到如下图所示的结果: ![][5] - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qhwdw](https://github.com/qhwdw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2d43837b186966010e7b4ea567c1dd2c07d7bec4 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 25 Dec 2018 23:33:33 +0800 Subject: [PATCH 0318/4278] Translated --- ...elax by the fire at your Linux terminal.md | 59 ------------------- ...elax by the fire at your Linux terminal.md | 59 +++++++++++++++++++ 2 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 sources/tech/20181213 Relax by the fire at your Linux terminal.md create mode 100644 translated/tech/20181213 Relax by the fire at your Linux terminal.md diff --git a/sources/tech/20181213 Relax by the fire at your Linux terminal.md b/sources/tech/20181213 Relax by the fire at your Linux terminal.md deleted file mode 100644 index 7eae421047..0000000000 --- a/sources/tech/20181213 Relax by the fire at your Linux terminal.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zhs852) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Relax by the fire at your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -zhs852 is translating. - -Relax by the fire at your Linux terminal -====== -Chestnuts roasting on an open command prompt? Why not, with this fun Linux toy. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-aafire.png?itok=pAttiVvG) - -Welcome back. Here we are, just past the halfway mark at day 13 of our 24 days of Linux command-line toys. If this is your first visit to the series, see the link to the previous article at the bottom of this one, and take a look back to learn what it's all about. In short, our command-line toys are anything that's a fun diversion at the terminal. - -Maybe some are familiar, and some aren't. Either way, we hope you have fun. - -If you're in the northern hemisphere outside of the tropics, perhaps winter is starting to rear its frigid face outside. At least it is where I live. And some I'd love nothing more than to curl up by the fire with a cup of tea and my favorite book (or a digital equivalent). - -The bad news is my house lacks a fireplace. The good news is that I can still pretend, thanks to the Linux terminal and today's command-line toy, **aafire**. - -On my system, I found **aafire** packed with **aalib** , a delightful library for converting visual images into the style of ASCII art and making it available at your terminal (or elsewhere). **aalib** enables all sorts of fun graphics at the Linux terminal, so we may revisit a toy or two that make use of it before the end of our series. On Fedora, this meant installation was as simple as: - -``` -$ sudo dnf install aalib -``` - -Then, it was simple to launch with the **aafire** command. By default, **aalib** attempted to draw to my GUI, so I had to manually override it to keep my fire in the terminal (this is a command-line series, after all). Fortunately, it comes with a [curses][1] driver, so this meant I just had to run the following to get my fire going: - -``` -$ aafire -driver curses -``` -![](https://opensource.com/sites/default/files/uploads/linux-toy-aafire-animated.gif) -You can find out more about the **aa-lib** library and download the source on [Sourceforge][2], under an LGPLv2 license. - -Do you have a favorite command-line toy that you think I ought to include? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Patch into The Matrix at the Linux command line][3] , and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-aafire - -作者:[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://en.wikipedia.org/wiki/Curses_(programming_library) -[2]: http://aa-project.sourceforge.net/aalib/ -[3]: https://opensource.com/article/18/12/linux-toy-cmatrix diff --git a/translated/tech/20181213 Relax by the fire at your Linux terminal.md b/translated/tech/20181213 Relax by the fire at your Linux terminal.md new file mode 100644 index 0000000000..b3532cbd83 --- /dev/null +++ b/translated/tech/20181213 Relax by the fire at your Linux terminal.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: (zhs852) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Relax by the fire at your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端中观看火焰 +====== +何不在命令行中进行一次“烧烤”呢? + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-aafire.png?itok=pAttiVvG) + +这里是《24 天了解 Linux 命令行小玩意》。如果你未曾读过本系列的文章,可以在本文的结尾部分获取上一篇文章的链接,以了解本系列的大概内容。我们所介绍的命令行小玩意可供你消遣无聊时光。 + +你或许知道它们其中的一些,也可能不曾知晓它们。无论如何,我们都希望你能度过一段愉快的时光。 + +如果你住在北半球的非热带地区,可能冬季来临时你会被冻得满脸通红。住在这里的我,最喜欢的事情便是在火炉旁惬意地边喝茶边读书。 + +不幸的是,我家刚好缺个放火炉的地方。不过,多亏了今天我要介绍的 **aafire** ,我仍然可以假装我坐在火炉旁。 + +在我所使用的系统里, **aafire** 被打包进了 **aalib** 。 **aalib** 是一个受人喜爱的库,它可以很方便地将图像转换成 ASCII 图并输出到终端(或其它任何地方)。 **aalib** 将多种多样的图像带入了 Linux 终端。你可以看看本系列的其它文章,了解一下其它小程序,以便配合使用并充分利用它们。在 Fedora 中,你可以通过以下命令来安装 **aalib** : + +``` +$ sudo dnf install aalib +``` + +接着,试着运行 **aafire** 命令。 **aalib** 默认会使用 GUI 模式,我们要进行一些操作来让它在终端中运行(毕竟这一系列文章都讲的是命令行)。十分幸运的是,仅需安装 [curses][1] 就能实现我们想要的效果。请执行: + +``` +$ aafire -driver curses +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-aafire-animated.gif) + +如果你觉得 **aa-lib** 挺有意思,可以在 [Sourceforge][2] 上找到它的源码(以 LGPLv2 许可证开源)。 + +欢迎将你觉得有意思的命令行小程序投稿到原作者处,只需在原文下留言即可。 + +如果有兴趣,可以查看原作者的上一篇文章: [Patch into The Matrix at the Linux command line][3] 。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-aafire + +作者:[Jason Baker][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://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Curses_(programming_library) +[2]: http://aa-project.sourceforge.net/aalib/ +[3]: https://opensource.com/article/18/12/linux-toy-cmatrix From 5d5abfae1b5eea9507e6d1d0ad0a3a03fe9d139a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 23:43:20 +0800 Subject: [PATCH 0319/4278] PRF:20181208 Play Tetris at your Linux terminal.md @geekpi --- ...81208 Play Tetris at your Linux terminal.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181208 Play Tetris at your Linux terminal.md b/translated/tech/20181208 Play Tetris at your Linux terminal.md index 110990cc61..1998aad851 100644 --- a/translated/tech/20181208 Play Tetris at your Linux terminal.md +++ b/translated/tech/20181208 Play Tetris at your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Play Tetris at your Linux terminal) @@ -10,25 +10,25 @@ 在 Linux 终端上玩俄罗斯方块 ====== -用每个人最喜欢的砖块配对游戏俄罗斯方块重新创造 20 世纪 80 年代的魔力。 +> 用每个人最喜欢的砖块配对游戏“俄罗斯方块”重新创造 20 世纪 80 年代的魔力。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-tetris.png?itok=_UXtpgzN) 感谢你来浏览我们今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己,什么是命令行玩具。即使我不太确定,但一般来说,它可能是一个游戏或任何消遣,可以帮助你在终端获得乐趣。 -很可能你们中的一些人之前会看到过我们日历中的各种选择,但我们希望每个人至少遇到一件新事物。 +很可能你们中的一些人之前会看到过我们日历中的各种推荐,但我们希望每个人至少遇到一件新事物。 我承诺在我开始这个系列时,我会介绍游戏,但到目前为止,我忽略了它,所以我们今天的选择就是游戏:俄罗斯方块。 -俄罗斯方块和我差不多年纪,都在 1984 年夏天来到世界。不过,俄罗斯方块不是来自北卡罗来纳州的农村地区,而是来自当时苏联的莫斯科。。 +俄罗斯方块和我差不多年纪,都在 1984 年夏天来到世界。不过,俄罗斯方块不是来自北卡罗来纳州的农村地区,而是来自当时苏联的莫斯科。 在风靡世界之后,俄罗斯方块被克隆过很多次。我怀疑你可以找到任何你想找的任何语言、操作系统的俄罗斯方块的克隆。说真的,去看看吧。会有一些有趣的。 -我今天带来的命令行[版本][1]是[用 Haskell 编写]的,它是我见过的做得更好的版本之一,有屏幕预览、得分、帮助、干净的外观。 +我今天带来的命令行[版本][1]是[用 Haskell 编写][1]的,它是我见过的做得更好的版本之一,有屏幕预览、得分、帮助、干净的外观。 如果你愿意从不受信任的来源运行已编译的二进制文件(我不推荐它),你可以直接获取它,但有个更安全的方法,使用 [dex][2] 的容器化版本也很容易,或者使用 [stack][3] 从源代码安装。 -这个俄罗斯方块克隆版是由 Sam Tay 编写的,并且在 BSD 许可证下。[请看这里][1]! +这个俄罗斯方块克隆版是由 Sam Tay 编写的,并且在 BSD 许可证下发布。[请看这里获取][1]! ![](https://opensource.com/sites/default/files/uploads/linux-toy-tetris-animated.gif) @@ -44,8 +44,8 @@ via: https://opensource.com/article/18/12/linux-toy-tetris 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -54,4 +54,4 @@ via: https://opensource.com/article/18/12/linux-toy-tetris [1]: https://github.com/samtay/tetris [2]: https://github.com/dockerland/dex [3]: https://docs.haskellstack.org/en/stable/README/#how-to-install -[4]: https://opensource.com/article/18/12/linux-toy-cal \ No newline at end of file +[4]: https://opensource.com/article/18/12/linux-toy-cal From f07f8ca2c8dfe4e96e35f520f28e21040f1e168c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 23:44:27 +0800 Subject: [PATCH 0320/4278] PUB:20181208 Play Tetris at your Linux terminal.md @geekpi https://linux.cn/article-10384-1.html --- .../20181208 Play Tetris at your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181208 Play Tetris at your Linux terminal.md (97%) diff --git a/translated/tech/20181208 Play Tetris at your Linux terminal.md b/published/20181208 Play Tetris at your Linux terminal.md similarity index 97% rename from translated/tech/20181208 Play Tetris at your Linux terminal.md rename to published/20181208 Play Tetris at your Linux terminal.md index 1998aad851..da78a64766 100644 --- a/translated/tech/20181208 Play Tetris at your Linux terminal.md +++ b/published/20181208 Play Tetris at your Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10384-1.html) [#]: subject: (Play Tetris at your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-tetris) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 008cead5e38521babe20e486787ca6946789a14d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 00:53:18 +0800 Subject: [PATCH 0321/4278] PRF:20180826 How to Install and Use FreeDOS on VirtualBox.md @WangYueScream --- ...o Install and Use FreeDOS on VirtualBox.md | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md index e8b0d30183..3474815526 100644 --- a/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md +++ b/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md @@ -1,28 +1,27 @@ - 如何在 VirtualBox 上安装并使用 FreeDOS? ====== -这份指南将带你如何一步一步在 Linux 平台下利用 VirtualBox 安装 FreeDOS。 + +> 这份指南将带你如何一步一步在 Linux 平台下利用 VirtualBox 安装 FreeDOS。 ### Linux 下借助 VirtualBox 安装 FreeDOS - +- [How to Install FreeDOS in Linux using Virtual Box](https://www.youtube.com/p1MegqzFAqA) -2017 年的 11 月份,我[采访了 Jim Hall][1] 关于 [FreeDOS project][2] 背后的历史故事。今天,我将告诉你如何安装并使用 FreeDOS。需要注意到是:我将在 [Solus][4](一种针对家庭用户的 Linux 桌面发行版)下使用 5.2.14 版本的 [VirtualBox][3] 来完成这些操作。 - -注意:在本教程我将使用 Solus 作为主机系统因为它很容易设置。另一个你需要注意的事情是 Solus 的软件中心有两个版本的 VirtualBox:`virtualbox` 和 `virtualbox-current`。Solus 会让你选择是使用 linux-lts 内核还是 linux-current 内核。最终区别就是,`virtualbox` 适用于 linux-lts 而 `virtualbx-current` 适用于 linux-current。 +2017 年的 11 月份,我[采访了 Jim Hall][1] 关于 [FreeDOS 项目][2] 背后的历史故事。今天,我将告诉你如何安装并使用 FreeDOS。需要注意到是:我将在 [Solus][4](一种针对家庭用户的 Linux 桌面发行版)下使用 5.2.14 版本的 [VirtualBox][3] 来完成这些操作。 +> 注意:在本教程我将使用 Solus 作为主机系统因为它很容易设置。另一个你需要注意的事情是 Solus 的软件中心有两个版本的 VirtualBox:`virtualbox` 和 `virtualbox-current`。Solus 会让你选择是使用 linux-lts 内核还是 linux-current 内核。最终区别就是,`virtualbox` 适用于 linux-lts 而 `virtualbx-current` 适用于 linux-current。 #### 第一步 – 创建新的虚拟机 ![][5] -当你打开 VirtualBox,点击 "New" 按钮来新建一个虚拟机。你可以自定义这台虚拟机的名字,我将它命名为 “FreeDOS”。你也可以在标注栏内指明你正在安装的 FreeDOS 的版本。你还需要选择你将要安装的操作系统的类型和版本。选择 “Other” 下的 “DOS”。 +当你打开 VirtualBox,点击 “New” 按钮来新建一个虚拟机。你可以自定义这台虚拟机的名字,我将它命名为 “FreeDOS”。你也可以在标注栏内指明你正在安装的 FreeDOS 的版本。你还需要选择你将要安装的操作系统的类型和版本。选择 “Other” 下的 “DOS”。 #### 第二步 – 设置内存大小 ![][6] -下一个对话框会问你要给 FreeDOS 主机分配多少可用的内存空间。默认分配 32 MB。不必更改它。在 DOS 系统盛行的年代,32 MB 大小的内存对于一台搭载 FreeDOS 的机器已经很足够了。如果你有需要,你可以通过对你针对 FreeDOS 新建的虚拟机右键并选择 Setting -> Symtem 来增加内存。 +下一个对话框会问你要给 FreeDOS 主机分配多少可用的内存空间。默认分配 32 MB。不必更改它。在 DOS 系统盛行的年代,32 MB 大小的内存对于一台搭载 FreeDOS 的机器已经很足够了。如果你有需要,你可以通过对你针对 FreeDOS 新建的虚拟机右键并选择 “Setting -> Symtem” 来增加内存。 ![][7] @@ -38,8 +37,7 @@ ![][9] -现在,你可以选择虚拟磁盘的大小和位置。500 MB 已经很足够了。需要注意的是很多你之后用到的程序都是基于文本的,这意味着它们占据的空间非常小。在你做好这些调整后,点击 Creat。 - +现在,你可以选择虚拟磁盘的大小和位置。500 MB 已经很足够了。需要注意的是很多你之后用到的程序都是基于文本的,这意味着它们占据的空间非常小。在你做好这些调整后,点击 “Create”。 #### 第四步 – 关联 .iso 文件 @@ -47,12 +45,11 @@ ![][11] -当文件下载完毕后,返回到 VirtualBox。选中你的虚拟机并打开设置。你可以通过对虚拟机右键并选中 “Setting” 或者 选中虚拟机并点击 “Setting” 按钮。 +当文件下载完毕后,返回到 VirtualBox。选中你的虚拟机并打开设置。你可以通过对虚拟机右键并选中 “Setting” 或者选中虚拟机并点击 “Setting” 按钮。 接下来,点击 “Storage” 选项卡。在 “Storage Devices” 下面,选中 CD 图标。(它应该会在图标旁边显示 “Empty”。) 在右边的 “Attribute” 面板,点中 CD 图标然后在对应路径选中你刚下载的 .iso 文件。 -提示:通常,在你通过 VirtualBox 安装完一个操作系统后你就可以删除对应的 .iso 文件了。但这并不适合 FreeDOS 。如果你想通过 FreeDOS 的包管理器来安装应用程序,你需要这个 .iso 文件。我通常会让这个 .iso 文件连接到虚拟机以便我安装一些程序。如果你也这么做了,你必须要确认下你让 FreeDOS 虚拟机每次启动的时候是从硬盘启动因为虚拟机的默认设置是从已关联的 .iso 文件启动。如果你忘了关联 .iso 文件,也不用担心。你可以通过选择 FreeDOS 虚拟机窗口上方的 “Devices” 来关联。然后就会发现 .iso 文件列在 “Optical Drives”。 - +> 提示:通常,在你通过 VirtualBox 安装完一个操作系统后你就可以删除对应的 .iso 文件了。但这并不适合 FreeDOS 。如果你想通过 FreeDOS 的包管理器来安装应用程序,你需要这个 .iso 文件。我通常会让这个 .iso 文件连接到虚拟机以便我安装一些程序。如果你也这么做了,你必须要确认下你让 FreeDOS 虚拟机每次启动的时候是从硬盘启动因为虚拟机的默认设置是从已关联的 .iso 文件启动。如果你忘了关联 .iso 文件,也不用担心。你可以通过选择 FreeDOS 虚拟机窗口上方的 “Devices” 来关联。然后就会发现 .iso 文件列在 “Optical Drives”。 #### 第五步 – 安装 FreeDOS @@ -62,11 +59,11 @@ 首先,你需要知道关于最新版本的 VirtualBox 的一个 bug。当我们创建好虚拟硬盘然后选中 “Install to harddisk” 后,如果你开启虚拟机你会发现在 FreeDOS 的欢迎界面出现过后就是不断滚动无群无尽的机器代码。我最近就遇到过这个问题而且不管是 Linux 还是 Windows 平台的 VirtualBox 都会碰到这个问题。(我知道解决办法。) -为了避开这个问题,你需要做一个简单的修改。当你看到 FreeDOS 的欢迎界面的时候,按下 Tab 键。(确认 “Install to harddrive” 已经选中。)在 “fdboot.img” 之后输入 `raw` 然后按下 Enter 键。接下来就会启动 FreeDOS 的安装程序。 +为了避开这个问题,你需要做一个简单的修改。当你看到 FreeDOS 的欢迎界面的时候,按下 Tab 键。(确认 “Install to harddrive” 已经选中。)在 “fdboot.img” 之后输入 `raw` 然后按下回车键。接下来就会启动 FreeDOS 的安装程序。 ![][13] -安装程序会首先处理你的虚拟磁盘的格式化。当格式化完成后,安装程序会重启。当 FreeDOS 的欢迎界面再次出现的时候,你不得不重新输入 `raw` 就像你之前输入的内容那样。 +安装程序会首先处理你的虚拟磁盘的格式化。当格式化完成后,安装程序会重启。当 FreeDOS 的欢迎界面再次出现的时候,你必须重新输入 `raw` 就像你之前输入的内容那样。 要确保在安装过程中你遇到的所有问题你选的都是 “Yes”。但也要注意有一个很重要的问题:“What FreeDOS packages do you want to install?” 的答案并不是 “Yes” 或者 “No”。答案有两个选择分别是 “Base packages” 和 “Full installation”。“Base packages” 针对的是想体验类似原始的 MS-DOS 环境的人群。“Full installation” 则包括了一系列工具和实用的程序来提升 DOS。 @@ -82,15 +79,14 @@ ![][15] -现在,你可以通过输入 `fdimples` 来访问 FreeDOS 的软件包管理工具。你也可以借助方向键来浏览软件包管理器然后用空格键选择类别或者软件包。在 “Networking” 类别中,你需要选中 `fdnet`。FreeDOS project 推荐也安装 `mtcp` 和 `wget`。多次点击 “Tab” 键直到选中 “OK” 然后在按下 “Enter” 键。安装完成后,输入 `reboot` 并按下 “Enter” 键确认执行。系统重启后,引导你的系统驱动。如果网络安装成功的话,你会在终端看到一些关于你的网络信息的新消息。 +现在,你可以通过输入 `fdimples` 来访问 FreeDOS 的软件包管理工具。你也可以借助方向键来浏览软件包管理器,然后用空格键选择类别或者软件包。在 “Networking” 类别中,你需要选中 `fdnet`。FreeDOS project 推荐也安装 `mtcp` 和 `wget`。多次点击 Tab 键直到选中 “OK” 然后在按下回车键。安装完成后,输入 `reboot` 并按下回车键确认执行。系统重启后,引导你的系统驱动。如果网络安装成功的话,你会在终端看到一些关于你的网络信息的新消息。 ![][16] -##### 注意 +注意: 有时候 VirtualBox 的默认设置并没有生效。如果遇到这种情况,先关闭你的 FreeDOS 虚拟机窗口。在 VirtualBox 主界面右键你的虚拟机并选中 “Setting”。VirtualBox 默认的网络设置是 “NAT”。将它改为 “Bridged Adapter” 后再尝试安装 FreeDOS 的软件包。现在就应该能正常运作了。 - #### 第七步 – FreeDOS 的基本使用 ##### 常见命令 @@ -107,7 +103,7 @@ * `MKDIR NEWDIR` – 创建一个新目录 * `CLS` – 清除屏幕 -你可以借助互联网或者 Jim Hall 所创建的 [handy cheat sheet][17] 来找到更多基本的 DOS 命令。 +你可以借助互联网或者 Jim Hall 所创建的 [方便的速查表][17] 来找到更多基本的 DOS 命令。 ##### 运行一个程序 @@ -119,7 +115,7 @@ 对于游戏通常会有一个或者两个 .EXE 程序,你玩游戏之前不得不先运行它们。这些设置文件通常能够修复你遇到的声音,视频,或者控制问题。 -如果你遇到一些本教程中没指出的问题,别忘记访问 [home of FreeDOS][2] 来寻求解决办法。他们有一个 wiki 和一些其他的支持选项。 +如果你遇到一些本教程中没指出的问题,别忘记访问 [FreeDOS 主站][2] 来寻求解决办法。他们有一个 wiki 和一些其他的支持选项。 你使用过 FreeDOS 吗?你还想看关于 FreeDOS 哪些方面的教程?请在下面的评论区告诉我们。 @@ -132,7 +128,7 @@ via: https://itsfoss.com/install-freedos/ 作者:[John Paul][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[WangYueScream](https://github.com/WangYueScream) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d5f2d0163e0aa0fe4265f143ee3ae117622d784b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 00:53:40 +0800 Subject: [PATCH 0322/4278] PUB:20180826 How to Install and Use FreeDOS on VirtualBox.md @WangYueScream https://linux.cn/article-10385-1.html --- .../20180826 How to Install and Use FreeDOS on VirtualBox.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180826 How to Install and Use FreeDOS on VirtualBox.md (100%) diff --git a/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/published/20180826 How to Install and Use FreeDOS on VirtualBox.md similarity index 100% rename from translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md rename to published/20180826 How to Install and Use FreeDOS on VirtualBox.md From ab64e2f074c2ecb25ee35cf781db1eead064990c Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 26 Dec 2018 08:41:29 +0800 Subject: [PATCH 0323/4278] translated --- ... Mode Or Emergency Mode In Ubuntu 18.04.md | 106 ------------------ ... Mode Or Emergency Mode In Ubuntu 18.04.md | 106 ++++++++++++++++++ 2 files changed, 106 insertions(+), 106 deletions(-) delete mode 100644 sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md create mode 100644 translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md diff --git a/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md deleted file mode 100644 index 379bbfd20a..0000000000 --- a/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ /dev/null @@ -1,106 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) -[#]: via: (https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04 -====== -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Rescue-Mode-Or-Emergency-Mode-720x340.png) - -As you might already know, **Runlevels** are replaced with **Systemd targets** in many recent Linux distributions like RHEL 7 and Ubuntu 16.04 LTS. For more details about runlevels and systemd target, refer [**this guide**][1]. In this brief tutorial, we are going to see how to boot into **rescue mode** and/or **emergency mode**. This guide is tested in Ubuntu 18.04 LTS, however the steps given below would work on most Linux distributions that uses Systemd as default service manager. Before going further, let me clarify what is rescue mode and emergency mode and what is the purpose of the both modes. - -### What is Rescue mode? - -The **rescue mode** is equivalent to **single user mode** in Linux distributions that uses **SysV** as the default service manager. In rescue mode, all local filesystems will be mounted, only some important services will be started. However, no normal services (E.g network services) won’t be started. The rescue mode is helpful in situations where the system can’t boot normally. Also, we can perform some important rescue operations, such as [**reset root password**][2], in rescue mode. - -### What is Emergency mode? - -In contrast to the rescue mode, nothing is started in the **emergency mode**. No services are started, no mount points mounted, no sockets established, nothing. All you will have is just a **raw shell**. Emergency mode is suitable for debugging purposes. - -### Boot Into Rescue Mode In Ubuntu 18.04 LTS - -Boot your Ubuntu system. When Grub menu appears, choose the first entry and press **e** to edit. - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png) - -If you don’t see the Grub menu, just hit ESC key right after the BIOS logo disappears. - -Find the line that starts with word **“linux”** and add the following line at the end of that line (To reach the end, just press **CTRL+e** or use END key or LEFT/RIGHT arrows in your keyboard): - -``` -systemd.unit=rescue.target -``` - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png) - -Once you added the above line, just press **CTRL+x** or **F10** to continue to boot into rescue mode. After a few seconds, you will be ended up in the rescue mode (single user mode) as root user. Here is how rescue mode looks like in Ubuntu 18.04 LTS server: - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png) - -Next, type the following command to mount root (/) file system into read/write mode. - -``` -mount -n -o remount,rw / -``` - -### Boot Into Emergency Mode - -Booting your Ubuntu into emergency is as same as above method. All you have to do is replace “systemd.unit=rescue.target” with “systemd.unit=emergency.target” when editing grub menu. - -[![emergency mode][3]][4] - -Once you added “systemd.unit=emergency.target”, press **Ctrl+x** or **F10** to continue booting into emergency mode. - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png) - -Finally, you can mount root filesystem into read/write mode with command: - -``` -mount -n -o remount,rw / -``` - -### Switch between Rescue to Emergency mode and vice versa - -If you are in rescue mode, you don’t have to edit the grub boot entry as I mentioned above. Instead, just type the following command to switch to emergency mode instantly: - -``` -systemctl emergency -``` - -Similarly, to switch from emergency to rescue mode, type: - -``` -systemctl rescue -``` - -You know now what is rescue and emergency modes and how to boot into those modes in Ubuntu 18.04. Like I already mentioned, the steps provided here will work on many recent Linux versions that uses Systemd. - -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-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ - -作者:[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/check-runlevel-linux/ -[2]: https://www.ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/ -[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png diff --git a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md new file mode 100644 index 0000000000..9d5836b921 --- /dev/null +++ b/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) +[#]: via: (https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何在 Ubuntu 18.04 中启动到救援模式或紧急模式 +====== +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Rescue-Mode-Or-Emergency-Mode-720x340.png) + +正如你可能已经知道的那样,**runlevel** 在许多最近的 Linux 发行版(如 RHEL 7 和 Ubuntu 16.04 LTS)中被 **systemd target** 替换。有关 runlevel 和 systemd target 的更多详细信息,请参阅[**本指南**][1]。在这个简短的教程中,我们将看到如何启动**救援模式**以及**紧急模式**。本指南在 Ubuntu 18.04 LTS 中进行了测试,但是下面给出的步骤适用于大多数使用 systemd 作为默认服务管理器的 Linux 发行版。在进一步讨论之前,让我澄清什么是救援模式和紧急模式以及这两种模式的目的是什么。 + +### 什么是救援模式? + +**救援模式**相当于使用 **SysV** 作为默认服务管理器的 Linux 发行版中的 **单用户模式**。在救援模式下,将挂载所有本地文件系统,仅启动一些重要服务。但是,不会启动正常服务(例如网络服务)。救援模式在系统无法正常启动的情况下很有用。此外,我们可以在救援模式下执行一些重要的救援操作,例如[**重置 root 密码**][2]。 + +### 什么是紧急模式? + +与救援模式相比,在**紧急模式**中不启动任何东西。没有服务启动、没有挂载点、没有建立套接字,什么也没有。你所拥有的只是一个**原始的 shell**。紧急模式适用于调试目的。 + +### 在 Ubuntu 18.04 LTS 中进入救援模式 + +启动你的 Ubuntu 系统。出现 Grub 菜单时,选择第一条并按下 **e** 进行编辑。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png) + +如果你没有看到 Grub 菜单,只需在 BIOS logo 消失后立即按下 ESC 键。 + +找到以单词 **“linux”** 开头的行,并在该行的末尾添加以下行(要到达末尾,只需按下 **CTRL+e** 或使用 END 键或左右箭头键): + +``` +systemd.unit=rescue.target +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png) + +添加完成后,只需按下 **CTRL+x** 或 **F10** 即可继续启动救援模式。几秒钟后,你将以 root 用户身份进入救援模式(单用户模式)。以下是 Ubuntu 18.04 LTS 服务器版中救援模式的样子: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png) + +接下来,输入以下命令将根 (/) 文件系统挂载成读/写模式。 + +``` +mount -n -o remount,rw / +``` + +### 启动到紧急模式 + +将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 grub 菜单时将 “systemd.unit=rescue.target” 替换为 “systemd.unit=emergency.target” 即可。 + +[![emergency mode][3]][4] + +添加 “systemd.unit=emergency.target” 后,按下 **Ctrl+x** 或 **F10** 继续启动到紧急模式。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png) + +最后,你可以使用以下命令将根文件系统挂载成读/写模式: + +``` +mount -n -o remount,rw / +``` + +### 在救援模式和紧急模式之间切换 + +如果你处于救援模式,则不必像上面提到的那样编辑 grub 条目。相反,只需输入以下命令即可立即切换到紧急模式: + +``` +systemctl emergency +``` + +同样,要从紧急模式切换到救援模式,请输入: + +``` +systemctl rescue +``` + +你现在知道了什么是救援模式和紧急模式以及如何在 Ubuntu 18.04 中启动这些模式。就像我已经提到的,这里提供的步骤将适用于许多使用 systemd 的 Linux 版本。 + +就是这些了。希望这篇文章有用。 + +还有更多好东西。敬请期待! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ + +作者:[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]: https://www.ostechnix.com/check-runlevel-linux/ +[2]: https://www.ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png \ No newline at end of file From 869b39f33f241f80a22c1a20fcaed053e4021d8c Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 26 Dec 2018 08:48:22 +0800 Subject: [PATCH 0324/4278] translating --- sources/tech/20181222 A Tale of HTTP-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181222 A Tale of HTTP-2.md b/sources/tech/20181222 A Tale of HTTP-2.md index 5484e67148..897fd83fc5 100644 --- a/sources/tech/20181222 A Tale of HTTP-2.md +++ b/sources/tech/20181222 A Tale of HTTP-2.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1be827d677fdbf18f75c6bf06acca89967c60d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Wed, 26 Dec 2018 11:05:11 +0800 Subject: [PATCH 0325/4278] ScarboroughCoral translating! --- ...803 How to use Fedora Server to create a router - gateway.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md b/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md index 0394826c10..934693d1cf 100644 --- a/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md +++ b/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md @@ -1,3 +1,5 @@ +ScarboroughCoral translating! + How to use Fedora Server to create a router / gateway ====== From 51dfff4fe1faa32bcdb0c7ac8b4b67ef0bbfd22c Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 26 Dec 2018 13:36:37 +0800 Subject: [PATCH 0326/4278] Check translation of How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 13d393b381..9d7a8ebf92 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -10,11 +10,11 @@ 如何更新 Ubuntu [终端及GUI方式] It's FOSS ====== -**这篇教程将向你展示如何更新服务器版本或者桌面版本的Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于Ubuntu Linux中的更新的一些其他内容。** +**这篇教程将向你展示如何更新服务器版本或者桌面版本的 Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于 Ubuntu Linux 中的更新的一些其他内容。** -如果你是一个新手并已经体验Ubuntu数天或几周,你可能想知道如何更新你的[Ubuntu][1]系统以获取安全补丁,错误修复和应用升级。 +如果你是一个新手并已经体验 Ubuntu 数天或几周,你可能想知道如何更新你的 [Ubuntu][1] 系统以获取安全补丁,错误修复和应用升级。 -更新 Ubuntu 非常简单。我并不夸张的说。它简单得只要运行两个命令。让我来告诉你更多更新细节。 +更新 Ubuntu 非常简单。我并不是瞎说。它简单得只要运行两个命令。让我来告诉你这两个命令的更多细节。 请注意,本教程适用于 Ubuntu 18.04,16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint,Linux Lite,elementary OS 等。 @@ -22,7 +22,7 @@ ![如何更新 Ubuntu][2] -在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 +在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你是登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 在终端里,你只需要使用以下命令: @@ -30,7 +30,7 @@ sudo apt update && sudo apt upgrade -y ``` -它将询问密码,而你可以使用你账号的密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 +它将询问密码,而你可以使用你的账号密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 现在,我来解释下上面的命令。 @@ -49,9 +49,9 @@ sudo apt upgrade #### 说明:sudo apt update -这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会更新而你的系统将不会知道是否又可用的新版本。 +这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会被更新,而你的系统将不会知道是否有可用的新版本。 -这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。 +这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令会从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。 ![更新 Ubuntu Linux][5] @@ -69,7 +69,7 @@ apt list --upgradable ![通过命令行更新 Ubuntu Linux][7] -你可以键入 `yes`,`y` 或者只敲回车键去确认安装这些更新。 +你可以键入 `yes`,`y` 或者只敲回车键去确认安装这些更新。 所以总的来说,`sudo apt update` 会检查可用的新版本,而 `sudo apt upgrade` 实际上会执行更新。 @@ -123,7 +123,7 @@ sudo apt autoremove #### 在 Ubuntu Server 中内核热修复以避免重启 -如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将是一个问题。 +如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将会是一个问题。 [热修复][15]功能允许Linux内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。 @@ -131,7 +131,7 @@ sudo apt autoremove #### 版本升级是不同的 -本文讨论的更新是使你安装的 Ubuntu 保持最新。它不包括[版本升级][17](例如从 Ubuntu 16.04 升级到 18.04)。 +本文讨论的更新是使你安装的 Ubuntu 保持最新。但它不包括[版本升级][17](例如从 Ubuntu 16.04 升级到 18.04)。 [Ubuntu 版本][18] 升级完全是另一回事。它更新整个操作系统核心。你需要在这个漫长的过程开始前做好备份。 From 1048b330a6021410854cb658918fec7c7fb9d98e Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 26 Dec 2018 13:37:29 +0800 Subject: [PATCH 0327/4278] Delete 20181210 How to Update Ubuntu.md --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 175 ------------------ 1 file changed, 175 deletions(-) delete mode 100644 sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md diff --git a/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md deleted file mode 100644 index 3a9036f403..0000000000 --- a/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ /dev/null @@ -1,175 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) -[#]: via: (https://itsfoss.com/update-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Translating by LazyWolfLin - -How to Update Ubuntu [Terminal & GUI Methods] It's FOSS -====== - -**This tutorial shows you how to update Ubuntu for both server and desktop versions. It also explains the difference between update and upgrade along with a few other things you should know about updates in Ubuntu Linux.** - -If you are a new user and have been using Ubuntu for a few days or weeks, you might be wondering how to update your [Ubuntu][1] system for security patches, bug fixes and application upgrades. - -Updating Ubuntu is absolutely simple. I am not exaggerating. It’s as simple as running two commands. Let me give you more details on it. - -Please note that the tutorial is valid for Ubuntu 18.04, 16.04 or any other version. The command line way is also valid for Ubuntu-based distributions like Linux Mint, Linux Lite, elementary OS etc. - -### Update Ubuntu via Command Line - -![How to Update Ubuntu][2] - -On the desktop, open the terminal. You can find it in the menu or use the Ctrl+Alt+T [keyboard shortcut][3]. If you are logged on to an [Ubuntu server][4], you already have access to a terminal. - -In the terminal, you just have to use the following command: - -``` -sudo apt update && sudo apt upgrade -y -``` - -It will ask for password and you can use your account’s password. You won’t see the anything on the screen while typing so keep on typing your password and hit enter. - -Now let me explain the above command. - -Actually, it’s not a single command. It’s a combination of two commands. The && is a way to combine two commands in a way that the second command runs only when the previous command ran successfully. - -The ‘-y’ in the end automatically enters yes when the command ‘apt upgrade’ ask for your confirmation before installing the updates. - -Note that you can also use the two commands separately, one by one: - -``` -sudo apt update -sudo apt upgrade -``` - -It will take a little longer because you have to wait for one command to finish and then enter the second command. - -#### Explanation: sudo apt update - -This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. - -This is why when you run the sudo apt update, you’ll see lots of URLs in the output. The command fetches the package information from the respective repositories (the URLs you see in the output). - -![Updating Ubuntu Linux][5] - -At the end of the command, it tells you how many packages can be upgraded. You can see these packages by running the following command: - -``` -apt list --upgradable -``` - -**Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. - -#### Explanation: sudo apt upgrade - -This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). - -![Update Ubuntu Linux via Command Line][7] - -You can type ‘yes’, ‘y’ or just press enter to confirm the installation of updates. - -So the bottom line is that the sudo apt update checks for the availability of new versions while as the sudo apt upgrade actually performs the update. - -The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. - -### Update Ubuntu via GUI [For Desktop Users] - -If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. - -In the menu, look for ‘Software Updater’ and run it. - -![Run Software Updater in Ubuntu][8] - -It will check if there are updates available for your system. - -![Checking if updates are available for Ubuntu][9] - -If there are updates available, it will give provide you with options to install the updates. - -![Install Updates via Update Manager in Ubuntu][10] - -Click on Install Now, it may ask for your password. - -![Installing Updates in Ubuntu Linux via GUI][11] - -Once you enter your password, it will start installing the updates. - -![Updating Ubuntu via GUI][12] - -In some cases, you may need to reboot the system for the installed updates to work properly. You’ll be notified at the end of the update if you need to restart the system. - -![Updating Ubuntu via GUI][12] - -You can choose to restart later if you don’t want to reboot your system straightaway. - -![Installing updates via GUI in Ubuntu][13] - -Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. - -### Few things to keep in mind abou updating Ubuntu - -You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. - -#### Clean up after an update - -Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: - -``` -sudo apt autoremove -``` - -#### Live patching kernel in Ubuntu Server to avoid rebooting - -In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. - -[Live patching][15] feature allows the patching of Linux kernel while the kernel is still running. In other words, you don’t have to reboot your system. - -If you manage servers, you may want to [enable live patching in Ubuntu][16]. - -#### Version upgrades are different - -The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). - -[Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. - -### Conclusion - -I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. - -If you have any questions, please fee free to ask. If you are an experienced Linux users and have some tip that can make this tutorial more useful, please share it with the rest of us. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/update-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://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/how-to-update-ubuntu.png?resize=800%2C450&ssl=1 -[3]: https://itsfoss.com/ubuntu-shortcuts/ -[4]: https://www.ubuntu.com/download/server -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-1.jpeg?resize=800%2C357&ssl=1 -[6]: https://itsfoss.com/apt-get-linux-guide/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-2.jpeg?ssl=1 -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-1.jpeg?resize=800%2C250&ssl=1 -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-2.jpeg?resize=800%2C250&ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-GUI-3.jpeg?resize=800%2C365&ssl=1 -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/install-update-ubuntu-1.jpg?resize=800%2C450&ssl=1 -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu.jpg?ssl=1 -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu-2.jpeg?ssl=1 -[14]: https://itsfoss.com/free-up-space-ubuntu-linux/ -[15]: https://www.ubuntu.com/livepatch -[16]: https://www.cyberciti.biz/faq/howto-live-patch-ubuntu-linux-server-kernel-without-rebooting/ -[17]: https://itsfoss.com/upgrade-ubuntu-version/ -[18]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ From 0957306a56214ca0eafe1e6d48aab05594ef05e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 26 Dec 2018 15:35:55 +0800 Subject: [PATCH 0328/4278] Translating by robsean --- sources/tech/20170523 Best Websites to Download Linux Games.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20170523 Best Websites to Download Linux Games.md b/sources/tech/20170523 Best Websites to Download Linux Games.md index e6d4636fdb..b29afc1dfb 100644 --- a/sources/tech/20170523 Best Websites to Download Linux Games.md +++ b/sources/tech/20170523 Best Websites to Download Linux Games.md @@ -1,3 +1,4 @@ +Translating by robsean Best Websites to Download Linux Games ====== Brief: New to Linux gaming and wondering where to **download Linux games** from? We list the best resources from where you can **download free Linux games** as well as buy premium Linux games. From 3024918a2f19b2e92a01e8712e82a84439ce50d6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 19:51:08 +0800 Subject: [PATCH 0329/4278] PRF:20181121 DevOps is for everyone.md @alim0x --- .../talk/20181121 DevOps is for everyone.md | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/translated/talk/20181121 DevOps is for everyone.md b/translated/talk/20181121 DevOps is for everyone.md index 778656640d..df9e41ffd1 100644 --- a/translated/talk/20181121 DevOps is for everyone.md +++ b/translated/talk/20181121 DevOps is for everyone.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (alim0x) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (DevOps is for everyone) [#]: via: (https://opensource.com/article/18/11/how-non-engineer-got-devops) @@ -10,41 +10,40 @@ 所有人的 DevOps ====== -让一名非工程师来解释为什么你不必成为一位开发者或运维就能爱上 DevOps。 +> 让一名非工程师来解释为什么你不必成为一位开发者或运维就能爱上 DevOps。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1) -我没有过开发或运维的工作——那怎么我在写一篇关于 [DevOps][1] 的文章?我一直都对计算机和技术有兴趣。我还对社群、心理学以及帮助他人充满热情。当我第一次听到 DevOps 时,这个概念激起了我的兴趣,因为它看起来融合了很多我感兴趣的东西,即便我是不写代码的。 +我从未做过开发或运维的工作 —— 那怎么我在写一篇关于 [DevOps][1] 的文章?我一直都对计算机和技术有兴趣。我还对社群、心理学以及帮助他人充满热情。当我第一次听到 DevOps 时,这个概念激起了我的兴趣,因为它看起来融合了很多我感兴趣的东西,即便我是不写代码的。 我的第一台电脑是 TRS-80,我喜欢在上面编写 BASIC 程序。我只上过两门我的高中开设的计算机编程课程。若干年后,我创办了一家计算机公司。我定制邮件标签和信纸,并建立了一个数据库来存储地址。 问题是我并不能从写代码中获得享受。我想要教育和帮助人们,我没法将写代码看作这样的一个机会。是的,技术可以帮助人们并改变生活,但是写代码没有点燃我的热情。我需要对我的工作感到兴奋并做我喜欢的事情。 +我发现我爱 DevOps。对我而言,DevOps 指的是: + * 文化,而不是代码 * 过程,而不是结果 * 建立一个所有人可以持续提升的环境 * 沟通与合作,而不是独立工作 - -我发现我爱 DevOps。对我而言,DevOps 指的是: - 归根结底,DevOps 是指成为社区工作的一部分,实现共同的目标。DevOps 融合了心理学、社群、技术。DevOps 不是一个职位名称,它是一种生活和工作的哲学。 ### 找到我的社群 快四年前,我在西雅图参加了我的第一个 [DevOps 日][2] 会议。我感觉我找到了我的社群。我觉得受到了欢迎和接受,尽管我从事营销工作而且没有计算机科学文凭。我可以从心理学和技术中寻找乐趣。 -在 DevOps 日,我学到了 [DevOps“三步工作法”][3]——流动,反馈,持续实验和学习——以及新(对我而言)的概念,如Kaizen(改善)和Kaikaku(改革)。随着我的学习深入,我发现我在说这样的话,“我是这样做的!我都不知道这样做还有个名字!” +在 DevOps 日,我学到了 [DevOps“三步工作法”][3] —— 流动、反馈、持续实验和学习 —— 以及新(对我而言)的概念,如 Kaizen(改善)和 Kaikaku(改革)。随着我的学习深入,我发现我在说这样的话,“我是这样做的!我都不知道这样做还有个名字!” -[Kaizen(改善)][4]是持续改进和学习的实践。小的量变积累随着时间的推移可以引起质变。我发现它和卡罗尔.德韦克的[成长型思维][5]的想法很相似。人们不是生来就是专家。在某方面拥有经验需要花费时间,练习,以及常常还有失败。承认增量的改善对确保我们不会放弃是很有必要的。 +[Kaizen(改善)][4]是持续改进和学习的实践。小的量变积累随着时间的推移可以引起质变。我发现它和卡罗尔·德韦克的[成长型思维][5]的想法很相似。人们不是生来就是专家。在某方面拥有经验需要花费时间、练习,以及常常还有失败。承认增量的改善对确保我们不会放弃是很有必要的。 -另一方面,[Kaikaku(改革)][6]的概念是指,长时间的小的改变有时不能起作用,你需要做一些完全的或破坏性的改变。在没有找到下份工作前就辞职或移居新城市就足够有破坏性——是的,两者我都做过。但这些彻底的改变收获巨大。如果我没有辞职并休息一段时间,我也许不会接触到 DevOps。等我决定继续工作的时候,我一直听到 DevOps,我开始研究它。这引导我参加了我的第一个 DevOps 日,从那里我开始看到我的所有热情开始聚集。从那时起,我已经参加了五次 DevOps 日活动,并且定期撰写关于 DevOps 话题的文章。 +另一方面,[Kaikaku(改革)][6]的概念是指,长时间的小的改变有时不能起作用,你需要做一些完全的或破坏性的改变。在没有找到下份工作前就辞职或移居新城市就足够有破坏性 —— 是的,两者我都做过。但这些彻底的改变收获巨大。如果我没有辞职并休息一段时间,我也许不会接触到 DevOps。等我决定继续工作的时候,我一直听到 DevOps,我开始研究它。这引导我参加了我的第一个 DevOps 日,从那里我开始看到我的所有热情开始聚集。从那时起,我已经参加了五次 DevOps 日活动,并且定期撰写关于 DevOps 话题的文章。 ### 将三步工作法用到工作中 改变是困难的,学习新事物可以听起来很吓人。DevOps 的三步工作法提供了一个管理改变的框架。比如:信息流动是怎样的?是什么驱动着你做出改变?一旦你认为一个改变是必需的,你如何获得这个改变是否正确的反馈?你如何知道你在取得进展?反馈是必要的,并且应该包含积极和有建设性的要素。困难的地方在于保证建设性的要素不要重于积极要素。 -对我而言,第三步——持续实验和学习——是 DevOps 最重要的部分。有一个可以自由地实验和冒险的环境,人们可以获得意想不到的结果。有时这些结果是好的,有时不是太好——但这没事。创建一个可以接受失败结果的环境可以鼓励人们冒险。我们都应该力争定期的持续实验和学习。 +对我而言,第三步 —— 持续实验和学习 —— 是 DevOps 最重要的部分。有一个可以自由地实验和冒险的环境,人们可以获得意想不到的结果。有时这些结果是好的,有时不是太好 —— 但这没事。创建一个可以接受失败结果的环境可以鼓励人们冒险。我们都应该力争定期的持续实验和学习。 DevOps 的三步工作法提供了一个尝试,获得反馈,以及从错误中获取经验的方法。几年前,我的儿子告诉我,“我从来就没想做到最好,因为那样我就没法从我的错误中学到东西了。”我们都会犯错,从中获得经验帮助我们成长和改善。如果我们的文化不支持尝试和学习,我们就不会愿意去犯错。 @@ -60,7 +59,7 @@ via: https://opensource.com/article/18/11/how-non-engineer-got-devops 作者:[Dawn Parych][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 f8f96e530cba62b80c69e3cc3bda911d4b3036e7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 19:51:49 +0800 Subject: [PATCH 0330/4278] PUB:20181121 DevOps is for everyone.md @alim0x https://linux.cn/article-10386-1.html --- .../talk => published}/20181121 DevOps is for everyone.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20181121 DevOps is for everyone.md (98%) diff --git a/translated/talk/20181121 DevOps is for everyone.md b/published/20181121 DevOps is for everyone.md similarity index 98% rename from translated/talk/20181121 DevOps is for everyone.md rename to published/20181121 DevOps is for everyone.md index df9e41ffd1..c4c61486e6 100644 --- a/translated/talk/20181121 DevOps is for everyone.md +++ b/published/20181121 DevOps is for everyone.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (alim0x) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (DevOps is for everyone) [#]: via: (https://opensource.com/article/18/11/how-non-engineer-got-devops) [#]: author: (Dawn Parych https://opensource.com/users/dawnparzych) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10386-1.html) 所有人的 DevOps ====== From de8c02aee1d0e542dec1a81252051dcfc6f17b00 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 20:05:19 +0800 Subject: [PATCH 0331/4278] PRF:20181213 Relax by the fire at your Linux terminal.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhs852 恭喜你完成了第一篇翻译! --- ... Relax by the fire at your Linux terminal.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/translated/tech/20181213 Relax by the fire at your Linux terminal.md b/translated/tech/20181213 Relax by the fire at your Linux terminal.md index b3532cbd83..75e856d74f 100644 --- a/translated/tech/20181213 Relax by the fire at your Linux terminal.md +++ b/translated/tech/20181213 Relax by the fire at your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Relax by the fire at your Linux terminal) @@ -9,7 +9,8 @@ 在 Linux 终端中观看火焰 ====== -何不在命令行中进行一次“烧烤”呢? + +> 何不在命令行中进行一次“烧烤”呢? ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-aafire.png?itok=pAttiVvG) @@ -19,15 +20,15 @@ 如果你住在北半球的非热带地区,可能冬季来临时你会被冻得满脸通红。住在这里的我,最喜欢的事情便是在火炉旁惬意地边喝茶边读书。 -不幸的是,我家刚好缺个放火炉的地方。不过,多亏了今天我要介绍的 **aafire** ,我仍然可以假装我坐在火炉旁。 +不幸的是,我家刚好缺个放火炉的地方。不过,多亏了今天我要介绍的 `aafire` ,我仍然可以假装我坐在火炉旁。 -在我所使用的系统里, **aafire** 被打包进了 **aalib** 。 **aalib** 是一个受人喜爱的库,它可以很方便地将图像转换成 ASCII 图并输出到终端(或其它任何地方)。 **aalib** 将多种多样的图像带入了 Linux 终端。你可以看看本系列的其它文章,了解一下其它小程序,以便配合使用并充分利用它们。在 Fedora 中,你可以通过以下命令来安装 **aalib** : +在我所使用的系统里, `aafire` 被打包进了 aalib 。 aalib 是一个受人喜爱的库,它可以很方便地将图像转换成 ASCII 图并输出到终端(或其它任何地方)。 aalib 将多种多样的图像带入了 Linux 终端。你可以看看本系列的其它文章,了解一下其它小程序,以便配合使用并充分利用它们。在 Fedora 中,你可以通过以下命令来安装 aalib : ``` $ sudo dnf install aalib ``` -接着,试着运行 **aafire** 命令。 **aalib** 默认会使用 GUI 模式,我们要进行一些操作来让它在终端中运行(毕竟这一系列文章都讲的是命令行)。十分幸运的是,仅需安装 [curses][1] 就能实现我们想要的效果。请执行: +接着,试着运行 `aafire` 命令。 `aalib` 默认会使用 GUI 模式,我们要进行一些操作来让它在终端中运行(毕竟这一系列文章都讲的是命令行)。十分幸运的是,仅需安装 [curses][1] 就能实现我们想要的效果。请执行: ``` $ aafire -driver curses @@ -35,11 +36,11 @@ $ aafire -driver curses ![](https://opensource.com/sites/default/files/uploads/linux-toy-aafire-animated.gif) -如果你觉得 **aa-lib** 挺有意思,可以在 [Sourceforge][2] 上找到它的源码(以 LGPLv2 许可证开源)。 +如果你觉得 aalib 挺有意思,可以在 [Sourceforge][2] 上找到它的源码(以 LGPLv2 许可证开源)。 欢迎将你觉得有意思的命令行小程序投稿到原作者处,只需在原文下留言即可。 -如果有兴趣,可以查看原作者的上一篇文章: [Patch into The Matrix at the Linux command line][3] 。 +如果有兴趣,可以查看原作者的上一篇文章: [在命令行中步入黑客帝国][3] 。 -------------------------------------------------------------------------------- @@ -48,7 +49,7 @@ via: https://opensource.com/article/18/12/linux-toy-aafire 作者:[Jason Baker][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 9e621a8d9cf7c2487057aecb73dd469243d34edd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 20:06:45 +0800 Subject: [PATCH 0332/4278] PUB:20181213 Relax by the fire at your Linux terminal.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhs852 本文首发地址:https://linux.cn/article-10387-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/zhs852 请注册领取LCCN :https://lctt.linux.cn/ --- .../20181213 Relax by the fire at your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181213 Relax by the fire at your Linux terminal.md (97%) diff --git a/translated/tech/20181213 Relax by the fire at your Linux terminal.md b/published/20181213 Relax by the fire at your Linux terminal.md similarity index 97% rename from translated/tech/20181213 Relax by the fire at your Linux terminal.md rename to published/20181213 Relax by the fire at your Linux terminal.md index 75e856d74f..5b286e36a8 100644 --- a/translated/tech/20181213 Relax by the fire at your Linux terminal.md +++ b/published/20181213 Relax by the fire at your Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10387-1.html) [#]: subject: (Relax by the fire at your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 4280d68cfab4048790cc537c133ba9288255a2d4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 21:17:48 +0800 Subject: [PATCH 0333/4278] PRF:20180101 27 open solutions to everything in education.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lixinyuxx 这篇翻译不够细心 --- ...en solutions to everything in education.md | 89 ++++++++----------- 1 file changed, 35 insertions(+), 54 deletions(-) diff --git a/translated/tech/20180101 27 open solutions to everything in education.md b/translated/tech/20180101 27 open solutions to everything in education.md index 43f4717c1f..48a4f3fa3c 100644 --- a/translated/tech/20180101 27 open solutions to everything in education.md +++ b/translated/tech/20180101 27 open solutions to everything in education.md @@ -1,72 +1,52 @@ -27个解决教学问题的开放式方法 +27 个全方位的开放式教育解决方案 ====== + +> 阅读这些 2017 年 Opensource.com 发布的开放如何改进教育和学习的好文章。 + ![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo) -开放式理念 (从开源软件到开放硬件, 再到开放原则) 正在改变教育的范式。因此, 为了庆祝今年发生的一切, 我收集了2017年在 Opensource.com 上发表的27篇关于这个主题的最好的文章。我把它们分成明确的主题, 而不是按人气来分类。而且, 如果这27个故事不能满足你对教育公开信息的胃口, 那就看看我们的合作文章吧 “ [education is leveraging Raspberry Pi and Linux][30]” +开放式理念 (从开源软件到开放硬件,再到开放原则) 正在改变教育的范式。因此,为了庆祝今年发生的一切,我收集了 2017 年(译注:本文原发布于 2018 年初)在 Opensource.com 上发表的 27 篇关于这个主题的最好的文章。我把它们分成明确的主题,而不是按人气来分类。而且,如果这 27 个故事不能满足你对教育方面开源信息的胃口,那就看看我们的合作文章吧 “[教育如何借助 Linux 和树莓派][30]”。 ### 开放对每个人都有好处 -1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt 评价David Price 的书 'OPEN' ,该书探讨了 “开放” 不仅仅是技术转变的观点, 而是 “我们未来将如何工作、生活和学习”。 - -2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur 指出了如何利用开放式学习在工作群体中脱颖而出。 这个建议不仅仅是针对程序员的, 而是针对程序员的。设计师、作家、营销人员和其他创意专业人士也是开放式成功的关键。 - -3. [A graduate degree could springboard you into an open source job][3]: 引用的研究表明会 Linux 技能会带来更高的薪水, Joshua Pearce 说对开源的熟练和研究生学位是无与伦比的职业技能组合。 - -4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger 向我们展示了开放的做法是如何在宾夕法尼亚州的一个学区创造一种更具包容性、敏捷性和开放性的文化的。 Charlie 说, 这不仅仅是为了省钱;该区还受益于 “开放式领导原则, 促进师生创新, 帮助更好地吸引社区, 创造一个更有活力和包容性的学习社区”。 - -5. [15 ways to empower students with open source tools][5]: 我写开源是如何让学生自由探索、补拙和学习的, 不管他们是在学习基本的数字化素养, 还是通过有趣的项目来扩展这些技能。 - -6. [Developer opportunities to code for good][6]: 开源往往是对社会有益的项目的支柱。正如 Benetech Labs 副总裁 Ahn Bui 在这次采访中指出的那样: “建立开放数据标准是打破数据孤岛不可或缺的一步。这些开放标准将为互操作性提供基础, 进而转化为更多的组织共同建设, 往往更具成本效益。最终目标是以同样的成本甚至更低的成本为更多的人服务。” +1. [书评:《OPEN》探讨了开放性的广泛文化含义][1]:Scott Nesbitt 评价 David Price 的书 《OPEN》 ,该书探讨了 “开放” 不仅仅是技术转变的观点,而是 “我们未来将如何工作、生活和学习”。 +2. [通过开源技能快速开始您的职业生涯][2]: VM (Vicky) Brasseur 指出了如何借助学习开源在工作群体中脱颖而出。这个建议不仅仅是针对程序员的;设计师、作家、营销人员和其他创意专业人士也对开源的成功至关重要。 +3. [研究生学位可以让你跳槽到开源职位][3]:引用的研究表明会 Linux 技能会带来更高的薪水, Joshua Pearce 说对开源的熟练和研究生学位是无与伦比的职业技能组合。 +4. [彻底改变了宾夕法尼亚的学校文化的三种实践][4]:Charlie Reisinger 向我们展示了开放式实践是如何在宾夕法尼亚州的一个学区创造一种更具包容性、敏捷性和开放性的文化的。Charlie 说,这不仅仅是为了省钱;该区还受益于 “开放式领导原则,促进师生创新,帮助更好地吸引社区,创造一个更有活力和包容性的学习社区”。 +5. [使用开源工具促使学生进步的 15 种方法][5]:我写了开源是如何让学生自由探索、补拙和学习的,不管他们是在学习基本的数字化素养,还是通过有趣的项目来扩展这些技能。 +6. [开发人员有机会编写好的代码][6]:开源往往是对社会有益的项目的支柱。正如 Benetech Labs 副总裁 Ahn Bui 在这次采访中指出的那样:“建立开放数据标准是打破数据孤岛不可或缺的一步。这些开放标准将为互操作性提供基础,进而转化为更多的组织共同建设,往往更具成本效益。最终目标是以同样的成本甚至更低的成本为更多的人服务。” ### 用于再融合和再利用的开放式教育资源 -1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis,Wiki Ed 的, 项目总监,讨论开放教育资源 (OERs) ,如 Wiki Ed,如何提供高质量且经济实惠的开源学习资源作为课堂教学工具。 - -2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green,是 Creative Common 开放教育主任,分享高等教育中教育面貌是如何变化的, 以及 Creative Common 正在采取哪些措施来促进教育。 - -3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites,是 Open Up Resources 社区的福音传教士和首席营销官, 谈论非营利组织努力为 K-12 学校提供开放的, 标准一致的课程。 - -4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke , Hawaii 大学 Manoa 分校的教育技术专家,他说, 在大学课程中过渡到 ORE 将 “使教师能够控制他们教授的内容, 我们预计这将为他们节省学生的费用。” - -5. [How open courses are slashing the cost of higher education][11]: Saylor Academy 的教育主任 Devon Ritter 报告了 Saylor 是如何建立以公开许可内容为基础的大学学分课程, 目的是使更多的人能够负担得起和获得高等教育。 - -6. [Open educational resources movement gains speed][12]: Alexis Clifton,State University of New York 的 OER 服务的执行主任, 描述了纽约800万美元的投资如何刺激开放教育的增长, 并使大学更实惠。 - -7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik 在Duke University 探索 OSPRI (Open Source Pedagogy Research and Innovation,开源教育学的研究与创新), 在 Duke 和 Red Hat 的联合合作这是建立一个21世纪的, preK-12 学习生态系统, 是开放的设计。 - -8. [Perma.cc stops scholarly link rot][14]: Virginia Tech 的 Phillip Young 写关于 Perma.cc, “link rot”(链接失效) 的解决方案 很大可能在学术论文中的超链接随着时间的推移而消失或变化。 - -9. [Open education: How students save money by creating open textbooks][15]: OER 先驱 Robin DeRosa 谈到 “公开许可教科书引入的自由, 以及教育和学习应结合包容性生态系统, 以增强公益的总体理念”。 +1. [学术教员可以和维基百科一起教学吗?][7]:Wiki Ed 的项目总监 LiAnna Davis 讨论开放式教育资源open educational resources (OER) ,如 Wiki Ed,是如何提供高质量且经济实惠的开源学习资源作为课堂教学工具。 +2. [书本内外?开放教育资源的状态][8]:Cable Green 是 Creative Common 开放教育主管,分享了高等教育中教育面貌是如何变化的,以及 Creative Common 正在采取哪些措施来促进教育。 +3. [急需符合标准的课程的学校系统找到了希望][9]:Karen Vaites 是 Open Up Resources 社区布道师和首席营销官,谈论了非营利组织努力为 K-12 学校提供开放的、标准一致的课程。 +4. [夏威夷大学如何解决当今高等教育的问题][10]:夏威夷大学 Manoa 分校的教育技术专家 Billy Meinke 表示,在大学课程中过渡到 ORE 将 “使教师能够控制他们教授的内容,我们预计这将为他们节省学生的费用。” +5. [开放式课程如何削减高等教育成本][11]:塞勒学院的教育总监 Devon Ritter 报告了塞勒学院是如何建立以公开许可内容为基础的大学学分课程,目的是使更多的人能够负担得起和获得高等教育。 +6. [开放教育资源运动在提速][12]:Alexis Clifton 是纽约州立大学的 OER 服务的执行董事,描述了纽约 800 万美元的投资如何刺激开放教育的增长,并使大学更实惠。 +7. [开放项目合作,从小学到大学教室][13]:来自杜克大学的 Aria F. Chernik 探索 OSPRI (开源教育学的研究与创新), 这是杜克大学和红帽的合作,旨在建立一个 21 世纪的,开放设计的 preK-12 学习生态系统。 +8. [Perma.cc 将阻止学术链接腐烂][14]::弗吉尼亚理工大学的 Phillip Young 写的关于 Perma.cc 的文章,这种一种“链接腐烂”的解决方案,在学术论文中的超链接随着时间的推移而消失或变化的概览很高。 +9. [开放教育:学生如何通过创建开放教科书来节省资金][15]:OER 先驱 Robin DeRosa 谈到 “引入公开许可教科书的自由,以及教育和学习应结合包容性生态系统,以增强公益的总体理念”。 ### 课堂上的开源工具 -1. [How an open source board game is saving the planet][16]: Joshua Pearce 写的关于拯救地球的一个棋盘游戏, 使学生能够解决环境问题, 同时有乐趣, 并为制造商社区作出贡献。 - -2. [A new Android app for teaching kids how to read][17]: Michael Hall 谈到他的儿子 Phoenicia,他在儿子被诊断为自闭症后开发的儿童识字应用, 为了产生更好的编码价值, 以及为什么用户测试比你想象的更重要。 - -3. [8 open source Android apps for education][18]: Joshua Allen Holm 通过推荐 F-Droid 存储库中的8个开源应用来尝试, 这将挑战我们将智能手机用作学习工具。 - -4. [3 open source alternatives to MATLAB][19]: Jason Baker's 更新了他2016年的开源数学计算软件调查, 提出了 MATLAB 的替代方案, 这是数学、物理科学、工程和经济学中几乎无处不在的昂贵的专用解决方案。 - -5. [What does SVG have to do with teaching kids to code?][20] 退休工程师 Jay Nick 谈论他如何使用艺术作为一种创造性的方式, 向学生介绍编码。他在学校做志愿者, 使用可缩放矢量图形 (SVG,Scalable Vector Graphics) 教授一种结合数学和艺术原理的编码方法。 - -6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, 在 Texas Tech 拥有美术博士学位分享他在单一解决方案统治的世界中使用开源工具的经验。 Kyle 说有一种偏见, 反对在计算机科学以外的学科中使用开源:“很多人认为非技术专业的学生不能使用 Linux, 他们对在高级学位课程中使用 Linux 的人做出了很多假设。...嗯, 这是有可能的, 我就是证明。” - -7. [A list of open source tools for college][22]: Aaron Cocker 概述了他在攻读计算机科学本科学位时使用的开源工具 (包括演示、备份和编程软件)。 - -8. [5 great KDE apps to help you study][23]: Zsolt Szakács 提供五个 KDE 应用程序, 帮助任何想要学习新技能或培养现有技能的人。 +1. [开源棋盘游戏如何拯救地球][16]:Joshua Pearce 写的关于拯救地球的一个棋盘游戏,这是一款让学生在玩乐和为创客社区做出贡献的同时解决环境问题的棋盘游戏。 +2. [一个教孩子们如何阅读的新 Android 应用程序][17]:Michael Hall 谈到了他在儿子被诊断为自闭症后为他开发的儿童识字应用 Phoenicia,以及良好编码的价值,和为什么用户测试比你想象的更重要。 +3. [8 个用于教育的开源 Android 应用程序][18]:Joshua Allen Holm 推荐了 8 个来自 F-Droid 软件库的开源应用,使我们可以将智能手机用作学习工具。 +4. [MATLA B的 3 种开源替代方案][19]:Jason Baker 更新了他 2016 年的开源数学计算软件调查报告,提供了 MATLAB 的替代方案,这是数学、物理科学、工程和经济学中几乎无处不在的昂贵的专用解决方案。 +5. [SVG 与教孩子编码有什么关系?][20]:退休工程师 Jay Nick 谈论他如何使用艺术作为一种创新的方式,向学生介绍编码。他在学校做志愿者,使用 SVG 来教授一种结合数学和艺术原理的编码方法。 +6. [5 个破灭的神话:在高等教育中使用开源][21]: 拥有德克萨斯理工大学美术博士学位的 Kyle Conway 分享他在一个由专有解决方案统治的世界中使用开源工具的经验。 Kyle 说有一种偏见,反对在计算机科学以外的学科中使用开源:“很多人认为非技术专业的学生不能使用 Linux,他们对在高级学位课程中使用 Linux 的人做出了很多假设……嗯,这是有可能的,我就是证明。” +7. [大学开源工具列表][22]:Aaron Cocker 概述了他在攻读计算机科学本科学位时使用的开源工具 (包括演示、备份和编程软件)。 +8. [5 个可帮助您学习优秀 KDE 应用程序][23]:Zsolt Szakács 提供五个 KDE 应用程序,可以帮助任何想要学习新技能或培养现有技能的人。 ### 在教室编码 -1. [How to get the next generation coding early][24]: Bryson Payne 说我们需要教孩子们在高中前编码: 到了九年级, 80% 的女孩和60% 的男孩已经从 STEM 职业中自选。但他建议, 这不仅仅是就业和缩小 IT 技能差距的问题。“教一个年轻人编写代码可能是你能给他们的最改变生活的技能。而且这不仅仅是一个职业提升者。编码是关于解决问题, 它是关于创造力, 更重要的是, 它是关于授权。 +1. [如何尽早让下一代编码][24]:Bryson Payne 说我们需要在高中前教孩子们学会编码: 到了九年级,80% 的女孩和 60% 的男孩已经从 STEM 职业中自选。但他建议,这不仅仅是就业和缩小 IT 技能差距的问题。“教一个年轻人编写代码可能是你能给他们的最改变生活的技能。而且这不仅仅是一个职业提升者。编码是关于解决问题,它是关于创造力,更重要的是,它是提升能力”。 +2. [孩子们无法在没有计算机的情况下编码][25]:Patrick Masson 推出了 FLOSS 儿童桌面计划, 该计划教授服务不足学校的学生使用开源软件 (如 Linux、LibreOffice 和 GIMP) 重新利用较旧的计算机。该计划不仅为破旧或退役的硬件注入新的生命,还为学生提供了重要的技能,而且还为学生提供了可能转化为未来职业生涯的重要技能。 +3. [如今 Scratch 是否能像 80 年代的 LOGO 语言一样教孩子们编码?][26]:Anderson Silva 提出使用 [Scratch][27] 以激发孩子们对编程的兴趣,就像在 20 世纪 80 年代开始使用 LOGO 语言时一样。 +4. [通过这个拖放框架学习Android开发][28]:Eric Eslinger 介绍了 App Inventor,这是一个编程框架,用于构建 Android 应用程序使用可视块语言(类似 Scratch 或者 [Snap][29])。 -2. [Kids can't code without computers][25]: Patrick Masson 推出了 FLOSS 儿童桌面计划, 该计划教授服务不足学校的学生使用开源软件 (如 Linux、LibreOffice 和 GIMP) 重新设计较旧的计算机。该计划不仅为破旧或退役的硬件注入新的生命, 还为学生提供了重要的技能, 这些技能可能会利于转化为未来的职业。 - -3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva 提出 [Scratch][27] 的使用建议以激发孩子们对编程的兴趣, 就像 LOGO 在20世纪80年代开始使用它时一样。 - -4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger 描述应用发明者, 一个编程框架, 用于构建 Android 应用程序使用可视块语言 (类似 Scratch 或者[Snap][29]). - -在这一年里, 我们了解到, 教育领域的一切都有一个开放的解决方案, 我预计这一主题将在2018年及以后继续下去。在未来的一年里, 你是否希望 Opensource.com 涵盖开放式的教育主题?如果是, 请在评论中分享你的想法。 +在这一年里,我们了解到,教育领域的各个方面都有了开放的解决方案,我预计这一主题将在 2018 年及以后继续下去。在未来的一年里,你是否希望 Opensource.com 涵盖开放式的教育主题?如果是, 请在评论中分享你的想法。 -------------------------------------------------------------------------------- @@ -74,7 +54,7 @@ via: https://opensource.com/article/18/1/best-open-education 作者:[Don Watkins][a] 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -108,3 +88,4 @@ via: https://opensource.com/article/18/1/best-open-education [27]:https://scratch.mit.edu/ [28]:https://opensource.com/article/17/8/app-inventor-android-app-development [29]:http://snap.berkeley.edu/ +[30]:https://opensource.com/article/17/12/best-opensourcecom-linux-and-raspberry-pi-education From 4c9772b35641aec2b56d20cbbfbd874d98d70649 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 21:18:28 +0800 Subject: [PATCH 0334/4278] PUB:20180101 27 open solutions to everything in education.md @lixinyuxx https://linux.cn/article-10388-1.html --- .../20180101 27 open solutions to everything in education.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180101 27 open solutions to everything in education.md (100%) diff --git a/translated/tech/20180101 27 open solutions to everything in education.md b/published/20180101 27 open solutions to everything in education.md similarity index 100% rename from translated/tech/20180101 27 open solutions to everything in education.md rename to published/20180101 27 open solutions to everything in education.md From 99f483aaae7d60d5d54033ffea8ad0155422dfde Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 26 Dec 2018 22:27:33 +0800 Subject: [PATCH 0335/4278] =?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 --- ..., Groups and Other Linux Beasts- Part 2.md | 111 ------------------ ..., Groups and Other Linux Beasts- Part 2.md | 105 +++++++++++++++++ 2 files changed, 105 insertions(+), 111 deletions(-) delete mode 100644 sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md create mode 100644 translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md diff --git a/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md deleted file mode 100644 index b6d2552264..0000000000 --- a/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md +++ /dev/null @@ -1,111 +0,0 @@ -Translating by MjSeven -Users, Groups and Other Linux Beasts: Part 2 -====== -![](https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2) -In this ongoing tour of Linux, we’ve looked at [how to manipulate folders/directories][1], and now we’re continuing our discussion of _permissions_ , _users_ and _groups_ , which are necessary to establish who can manipulate which files and directories. [Last time,][2] we showed how to create new users, and now we’re going to dive right back in: - -You can create new groups and then add users to them at will with the `groupadd` command. For example, using: -``` -sudo groupadd photos - -``` - -will create the _photos_ group. - -You’ll need to [create a directory][1] hanging off the root directory: -``` -sudo mkdir /photos - -``` - -If you run `ls -l /`, one of the lines will be: -``` -drwxr-xr-x 1 root root 0 jun 26 21:14 photos - -``` - -The first _root_ in the output is the user owner and the second _root_ is the group owner. - -To transfer the ownership of the _/photos_ directory to the _photos_ group, use -``` -chgrp photos /photos - -``` - -The `chgrp` command typically takes two parameters, the first parameter is the group that will take ownership of the file or directory and the second is the file or directory you want to give over to the the group. - -Next, run `ls -l /` and you'll see the line has changed to: -``` -drwxr-xr-x 1 root photos 0 jun 26 21:14 photos - -``` - -You have successfully transferred the ownership of your new directory over to the _photos_ group. - -Then, add your own user and the _guest_ user to the _photos_ group: -``` -sudo usermod -a -G photos -sudo usermod guest -a -G photos - -``` - -You may have to log out and log back in to see the changes, but, when you do, running `groups` will show _photos_ as one of the groups you belong to. - -A couple of things to point out about the `usermod` command shown above. First: Be careful not to use the `-g` option instead of `-G`. The `-g` option changes your primary group and could lock you out of your stuff if you use it by accident. `-G`, on the other hand, _adds_ you to the groups listed and doesn't mess with the primary group. If you want to add your user to more groups than one, list them one after another, separated by commas, no spaces, after `-G`: -``` -sudo usermod -a -G photos,pizza,spaceforce - -``` - -Second: Be careful not to forget the `-a` parameter. The `-a` parameter stands for _append_ and attaches the list of groups you pass to `-G` to the ones you already belong to. This means that, if you don't include `-a`, the list of groups you already belong to, will be overwritten, again locking you out from stuff you need. - -Neither of these are catastrophic problems, but it will mean you will have to add your user back manually to all the groups you belonged to, which can be a pain, especially if you have lost access to the _sudo_ and _wheel_ group. - -### Permits, Please! - -There is still one more thing to do before you can copy images to the _/photos_ directory. Notice how, when you did `ls -l /` above, permissions for that folder came back as _drwxr-xr-x_. - -If you read [the article I recommended at the beginning of this post][3], you'll know that the first _d_ indicates that the entry in the file system is a directory, and then you have three sets of three characters ( _rwx_ , _r-x_ , _r-x_ ) that indicate the permissions for the user owner ( _rwx_ ) of the directory, then the group owner ( _r-x_ ), and finally the rest of the users ( _r-x_ ). This means that the only person who has write permissions so far, that is, the only person who can copy or create files in the _/photos_ directory, is the _root_ user. - -But [that article I mentioned also tells you how to change the permissions for a directory or file][3]: -``` -sudo chmod g+w /photos - -``` - -Running `ls -l /` after that will give you _/photos_ permissions as _drwxrwxr-x_ which is what you want: group members can now write into the directory. - -Now you can try and copy an image or, indeed, any other file to the directory and it should go through without a problem: -``` -cp image.jpg /photos - -``` - -The _guest_ user will also be able to read and write from the directory. They will also be able to read and write to it, and even move or delete files created by other users within the shared directory. - -### Conclusion - -The permissions and privileges system in Linux has been honed over decades. inherited as it is from the old Unix systems of yore. As such, it works very well and is well thought out. Becoming familiar with it is essential for any Linux sysadmin. In fact, you can't do much admining at all unless you understand it. But, it's not that hard. - -Next time, we'll be dive into files and see the different ways of creating, manipulating, and destroying them in creative ways. Always fun, that last one. - -See you then! - -Learn more about Linux through the free ["Introduction to Linux" ][4]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2 - -作者:[Paul Brown][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://www.linux.com/users/bro66 -[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux -[2]:https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts -[3]:https://www.linux.com/learn/understanding-linux-file-permissions -[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md new file mode 100644 index 0000000000..c4f20dbf77 --- /dev/null +++ b/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md @@ -0,0 +1,105 @@ +用户、组及其他 Linux 特性:第二部分 +====== + +![](https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2) + +在正在进行的 Linux 之旅中,我们了解了[如何操作文件夹或目录][1],现在我们继续讨论 _权限_,_用户_ 和 _组_,这对于确定谁可以操作哪些文件和目录是必要的。[上次][2],我们展示了如何创建新用户,现在我们将重新来一遍: + +你可以使用 `groupadd` 命令创建新组,然后随意添加用户。例如,使用: +``` +sudo groupadd photos +``` + +这将会创建 _photos_ 组。 + +你需要在根目录下[创建一个目录][1]: +``` +sudo mkdir /photos +``` + +如果你运行 `ls -l /`,结果中会有如下这一行: +``` +drwxr-xr-x 1 root root 0 jun 26 21:14 photos +``` + +输出中的第一个 _root_ 是所属的用户,第二个 _root_ 是所属的组。 + +要将 _/photos_ 目录的所有权转移到 _photos_ 组,使用: +``` +chgrp photos /photos +``` + +`chgrp` 命令通常采用两个参数,第一个参数是将要获得文件或目录所有权的组,第二个参数是希望交给组的文件或目录。 + +接着,运行 `ls -l /`,你会发现刚才那一行变了: +``` +drwxr-xr-x 1 root photos 0 jun 26 21:14 photos +``` + +你已成功将新目录的所有权转移到了 _photos_ 组。 + +然后,将你自己的用户和 _guest_ 用户添加到 _photos_ 组: +``` +sudo usermod <你的用户名> -a -G photos +sudo usermod guest -a -G photos +``` + +你可能必须注销并重新登录才能看到更改,但是当你这样做时,运行 `groups` 会将 _photos_ 显示为你所属的组之一。 + +(to 校正:这里的 primary group 翻译成什么更好点呢) +关于上面提到的 `usermod` 命令,需要指明几点。第一:注意要使用 `-G` 选项而不是 `-g` 选项。`-g` 选项更改你的主要组,如果你意外地使用它,它可能会锁定你的一些东西。另一方面,`-G` 将你 _添加(add)_ 到列出的组中,并没有干扰主要组。如果要将用户添加到多个组中,在 `-G` 之后逐个列出他们,用逗号分隔,不要有空格: +``` +sudo usermod -a -G photos,pizza,spaceforce +``` + +第二点:小心点不要忘记 `-a` 参数。`-a` 参数代表 _追加(append)_,将你传递给 `-G` 的组列表附加到你已经属于的组。这意味着,如果你不包含 `-a`,那么你之前所属的组列表将被覆盖,再次将你从你需要的东西中锁定。(to 校正:最后这句话什么意思呢) + +这些都不是灾难性问题,但这意味着你必须手动将用户添加回你所属的所有组,这可能是个麻烦,特别是如果你失去了对 _sudo_ 和 _wheel_ 组的访问权限。 + +### 权限 + +在将图像复制到 _/photos_ 目录之前,还要做一件事情。注意,当你执行上面的 `ls -l /` 时,该文件夹的权限将以 _drwxr-xr-x_ 形式返回。 + +如果你阅读[我在本文开头推荐的文章][3],你将知道第一个 _d_ 表示文件系统中的条目是一个目录,接着你有三组三个字符 (_rwx_, _r-x_, _r-x_),它们表示目录的所属用户 (_rwx_) 的权限,然后是所属组 (_r-x_)的权限,最后是其他用户 (_r-x_) 的权限。这意味着到目前为止唯一具有写权限的人,即能够在 _/photos_ 目录中复制或创建文件的唯一人员是 _root_ 用户。 + +但是[我提到的那篇文章也告诉你如何更改目录或文件的权限][3]: +``` +sudo chmod g+w /photos +``` + +运行 `ls -l /`,你会看到 _/photos_ 权限变为了 _drwxrwxr-x_。这就是你希望的:组成员现在可以对目录进行写操作了。 + +现在你可以尝试将图像或任何其他文件复制到目录中,它应该没有问题: +``` +cp image.jpg /photos +``` + +_guest_ 用户也可以从目录中读取和写入。他们也可以读取和写入,甚至移动或删除共享目录中其他用户创建的文件。(to 校正:这里 guest 可以从目录中读取和写入吗?guest 不应该是 r-x 权限吗?) + +### 总结 + +Linux 中的权限和特权系统已经磨练了几十年,它继承自昔日的旧 Unix 系统。就其本身而言,它工作的非常好,而且经过了深思熟虑。熟悉它对于任何 Linux 系统管理员都是必不可少的。事实上,除非你理解它,否则你根本就无法做很多事情。但是,这并不难。 + +下一次,我们将深入研究文件,并以一个创新的方式查看创建,操作和销毁文件的不同方法。最后一个总是很有趣。 + +回头见! + +通过 Linux 基金会和 edX 的免费[" Linux 简介"][4]课程了解有关 Linux 的更多信息。 + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2 + +作者:[Paul Brown][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/bro66 +[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux +[2]:https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts +[3]:https://www.linux.com/learn/understanding-linux-file-permissions +[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 2392354a6b5fba66ff7bdcbe0a60cb8d5006e069 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 22:49:34 +0800 Subject: [PATCH 0336/4278] PRF: 20181016 Lab 5- File system, Spawn and Shell.md @qhwdw --- ...016 Lab 5- File system, Spawn and Shell.md | 198 ++++++++---------- 1 file changed, 89 insertions(+), 109 deletions(-) diff --git a/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md b/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md index 769b90bd20..dbd9a3b490 100644 --- a/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md +++ b/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md @@ -1,4 +1,4 @@ -实验 5:文件系统、Spawn 和 Shell +Caffeinated 6.828:实验 5:文件系统、Spawn 和 Shell ====== ### 简介 @@ -10,31 +10,31 @@ 使用 Git 去获取最新版的课程仓库,然后创建一个命名为 `lab5` 的本地分支,去跟踪远程的 `origin/lab5` 分支: ``` - athena% cd ~/6.828/lab - athena% add git - athena% git pull - Already up-to-date. - athena% git checkout -b lab5 origin/lab5 - Branch lab5 set up to track remote branch refs/remotes/origin/lab5. - Switched to a new branch "lab5" - athena% git merge lab4 - Merge made by recursive. - ..... - athena% +athena% cd ~/6.828/lab +athena% add git +athena% git pull +Already up-to-date. +athena% git checkout -b lab5 origin/lab5 +Branch lab5 set up to track remote branch refs/remotes/origin/lab5. +Switched to a new branch "lab5" +athena% git merge lab4 +Merge made by recursive. +..... +athena% ``` 在实验中这一部分的主要新组件是文件系统环境,它位于新的 `fs` 目录下。通过检查这个目录中的所有文件,我们来看一下新的文件都有什么。另外,在 `user` 和 `lib` 目录下还有一些文件系统相关的源文件。 -fs/fs.c 维护文件系统在磁盘上结构的代码 -fs/bc.c 构建在我们的用户级页故障处理功能之上的一个简单的块缓存 -fs/ide.c 极简的基于 PIO(非中断驱动的)IDE 驱动程序代码 -fs/serv.c 使用文件系统 IPC 与客户端环境交互的文件系统服务器 -lib/fd.c 实现一个常见的类 UNIX 的文件描述符接口的代码 -lib/file.c 磁盘上文件类型的驱动,实现为一个文件系统 IPC 客户端 -lib/console.c 控制台输入/输出文件类型的驱动 -lib/spawn.c spawn 库调用的框架代码 +- `fs/fs.c` 维护文件系统在磁盘上结构的代码 +- `fs/bc.c` 构建在我们的用户级页故障处理功能之上的一个简单的块缓存 +- `fs/ide.c` 极简的基于 PIO(非中断驱动的)IDE 驱动程序代码 +- `fs/serv.c` 使用文件系统 IPC 与客户端环境交互的文件系统服务器 +- `lib/fd.c` 实现一个常见的类 UNIX 的文件描述符接口的代码 +- `lib/file.c` 磁盘上文件类型的驱动,实现为一个文件系统 IPC 客户端 +- `lib/console.c` 控制台输入/输出文件类型的驱动 +- `lib/spawn.c` spawn 库调用的框架代码 -你应该再次去运行 `pingpong`、`primes`、和 `forktree`,测试实验 4 完成后合并到新的实验 5 中的代码能否正确运行。你还需要在 `kern/init.c` 中注释掉 `ENV_CREATE(fs_fs)` 行,因为 `fs/fs.c` 将尝试去做一些 I/O,而 JOS 到目前为止还不具备该功能。同样,在 `lib/exit.c` 中临时注释掉对 `close_all()` 的调用;这个函数将调用你在本实验后面部分去实现的子程序,如果现在去调用,它将导致 JOS 内核崩溃。如果你的实验 4 的代码没有任何 bug,将很完美地通过这个测试。在它们都能正常工作之前是不能继续后续实验的。在你开始做练习 1 时,不要忘记去取消这些行上的注释。 +你应该再次去运行 `pingpong`、`primes` 和 `forktree`,测试实验 4 完成后合并到新的实验 5 中的代码能否正确运行。你还需要在 `kern/init.c` 中注释掉 `ENV_CREATE(fs_fs)` 行,因为 `fs/fs.c` 将尝试去做一些 I/O,而 JOS 到目前为止还不具备该功能。同样,在 `lib/exit.c` 中临时注释掉对 `close_all()` 的调用;这个函数将调用你在本实验后面部分去实现的子程序,如果现在去调用,它将导致 JOS 内核崩溃。如果你的实验 4 的代码没有任何 bug,将很完美地通过这个测试。在它们都能正常工作之前是不能继续后续实验的。在你开始做练习 1 时,不要忘记去取消这些行上的注释。 如果它们不能正常工作,使用 `git diff lab4` 去重新评估所有的变更,确保你在实验 4(及以前)所写的代码在本实验中没有丢失。确保实验 4 仍然能正常工作。 @@ -44,11 +44,11 @@ lib/spawn.c spawn 库调用的框架代码 ### 文件系统的雏形 -你将要使用的文件系统比起大多数“真正的”文件系统(包括 xv6 UNIX 的文件系统)要简单的多,但它也是很强大的,足够去提供基本的特性:创建、读取、写入、和删除组织在层次目录结构中的文件。 +你将要使用的文件系统比起大多数“真正的”文件系统(包括 xv6 UNIX 的文件系统)要简单的多,但它也是很强大的,足够去提供基本的特性:创建、读取、写入和删除组织在层次目录结构中的文件。 到目前为止,我们开发的是一个单用户操作系统,它提供足够的保护并能去捕获 bug,但它还不能在多个不可信用户之间提供保护。因此,我们的文件系统还不支持 UNIX 的所有者或权限的概念。我们的文件系统目前也不支持硬链接、时间戳、或像大多数 UNIX 文件系统实现的那些特殊的设备文件。 -### 磁盘上文件系统结构 +### 磁盘上的文件系统结构 主流的 UNIX 文件系统将可用磁盘空间分为两种主要的区域类型:节点区域和数据区域。UNIX 文件系统在文件系统中为每个文件分配一个节点;一个文件的节点保存了这个文件重要的元数据,比如它的 `stat` 属性和指向数据块的指针。数据区域被分为更大的(一般是 8 KB 或更大)数据块,它在文件系统中存储文件数据和目录元数据。目录条目包含文件名字和指向到节点的指针;如果文件系统中的多个目录条目指向到那个文件的节点上,则称该文件是硬链接的。由于我们的文件系统不支持硬链接,所以我们不需要这种间接的级别,并且因此可以更方便简化:我们的文件系统将压根就不使用节点,而是简单地将文件的(或子目录的)所有元数据保存在描述那个文件的(唯一的)目录条目中。 @@ -71,6 +71,7 @@ UNIX xv6 文件系统使用 512 字节大小的块,与它底层磁盘的扇区 #### 文件元数据 ![File structure][2] + 元数据的布局是描述在我们的文件系统中的一个文件中,这个文件就是 `inc/fs.h` 中的 `struct File`。元数据包含文件的名字、大小、类型(普通文件还是目录)、指向构成这个文件的块的指针。正如前面所提到的,我们的文件系统中并没有节点,因此元数据是保存在磁盘上的一个目录条目中,而不是像大多数“真正的”文件系统那样保存在节点中。为简单起见,我们将使用 `File` 这一个结构去表示文件元数据,因为它要同时出现在磁盘上和内存中。 在 `struct File` 中的数组 `f_direct` 包含一个保存文件的前 10 个块(`NDIRECT`)的块编号的空间,我们称之为文件的直接块。对于最大 `10*4096 = 40KB` 的小文件,这意味着这个文件的所有块的块编号将全部直接保存在结构 `File` 中,但是,对于超过 40 KB 大小的文件,我们需要一个地方去保存文件剩余的块编号。所以我们分配一个额外的磁盘块,我们称之为文件的间接块,由它去保存最多 4096/4 = 1024 个额外的块编号。因此,我们的文件系统最多允许有 1034 个块,或者说不能超过 4MB 大小。为支持大文件,“真正的”文件系统一般都支持两个或三个间接块。 @@ -91,33 +92,28 @@ UNIX xv6 文件系统使用 512 字节大小的块,与它底层磁盘的扇区 只要我们依赖轮询、基于 “编程的 I/O”(PIO)的磁盘访问,并且不使用磁盘中断,那么在用户空间中实现磁盘访问还是很容易的。也可以去实现由中断驱动的设备驱动程序(比如像 L3 和 L4 内核就是这么做的),但这样做的话,内核必须接收设备中断并将它派发到相应的用户模式环境上,这样实现的难度会更大。 -x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的代码是否允许执行特定的设备 I/O 指令,比如 `IN` 和 `OUT` 指令。由于我们需要的所有 IDE 磁盘寄存器都位于 x86 的 I/O 空间中而不是映射在内存中,所以,为了允许文件系统去访问这些寄存器,我们需要做的唯一的事情便是授予文件系统环境“I/O 权限”。实际上,在 EFLAGS 寄存器的 IOPL 位上规定,内核使用一个简单的“要么全都能访问、要么全都不能访问”的方法来控制用户模式中的代码能否访问 I/O 空间。在我们的案例中,我们希望文件系统环境能够去访问 I/O 空间,但我们又希望任何其它的环境完全不能访问 I/O 空间。 +x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的代码是否允许执行特定的设备 I/O 指令,比如 `IN` 和 `OUT` 指令。由于我们需要的所有 IDE 磁盘寄存器都位于 x86 的 I/O 空间中而不是映射在内存中,所以,为了允许文件系统去访问这些寄存器,我们需要做的唯一的事情便是授予文件系统环境“I/O 权限”。实际上,在 EFLAGS 寄存器的 IOPL 位上规定,内核使用一个简单的“要么全都能访问、要么全都不能访问”的方法来控制用户模式中的代码能否访问 I/O 空间。在我们的案例中,我们希望文件系统环境能够去访问 I/O 空间,但我们又希望任何其它的环境完全不能访问 I/O 空间。 -```markdown -练习 1、`i386_init` 通过将类型 `ENV_TYPE_FS` 传递给你的环境创建函数 `env_create` 来识别文件系统。修改 `env.c` 中的 `env_create` ,以便于它只授予文件系统环境 I/O 的权限,而不授予任何其它环境 I/O 的权限。 +> **练习 1**、`i386_init` 通过将类型 `ENV_TYPE_FS` 传递给你的环境创建函数 `env_create` 来识别文件系统。修改 `env.c` 中的 `env_create` ,以便于它只授予文件系统环境 I/O 的权限,而不授予任何其它环境 I/O 的权限。 -确保你能启动这个文件系统环境,而不会产生一般保护故障。你应该要通过在 `make grade` 中的 "fs i/o" 测试。 -``` +> 确保你能启动这个文件系统环境,而不会产生一般保护故障。你应该要通过在 `make grade` 中的 "fs i/o" 测试。 -```markdown -问题 - - 1、当你从一个环境切换到另一个环境时,你是否需要做一些操作来确保 I/O 权限设置能被保存和正确地恢复?为什么? -``` +. +> **问题 1**、当你从一个环境切换到另一个环境时,你是否需要做一些操作来确保 I/O 权限设置能被保存和正确地恢复?为什么? 注意本实验中的 `GNUmakefile` 文件,它用于设置 QEMU 去使用文件 `obj/kern/kernel.img` 作为磁盘 0 的镜像(一般情况下表示 DOS 或 Windows 中的 “C 盘”),以及使用(新)文件 `obj/fs/fs.img` 作为磁盘 1 的镜像(”D 盘“)。在本实验中,我们的文件系统应该仅与磁盘 1 有交互;而磁盘 0 仅用于去引导内核。如果你想去恢复其中一个有某些错误的磁盘镜像,你可以通过输入如下的命令,去重置它们到最初的、”崭新的“版本: ``` - $ rm obj/kern/kernel.img obj/fs/fs.img - $ make +$ rm obj/kern/kernel.img obj/fs/fs.img +$ make ``` 或者: ``` - $ make clean - $ make +$ make clean +$ make ``` 小挑战!实现中断驱动的 IDE 磁盘访问,既可以使用也可以不使用 DMA 模式。由你来决定是否将设备驱动移植进内核中、还是与文件系统一样保留在用户空间中、甚至是将它移植到一个它自己的的单独的环境中(如果你真的想了解微内核的本质的话)。 @@ -132,45 +128,39 @@ x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的 当然,将整个磁盘读入到内存中需要很长时间,因此,我们将它实现成”按需“分页的形式,那样我们只在磁盘映射区域中分配页,并且当在这个区域中产生页故障时,从磁盘读取相关的块去响应这个页故障。通过这种方式,我们能够假装将整个磁盘装进了内存中。 -```markdown -练习 2、在 `fs/bc.c` 中实现 `bc_pgfault` 和 `flush_block` 函数。`bc_pgfault` 函数是一个页故障服务程序,就像你在前一个实验中编写的写时复制 fork 一样,只不过它的任务是从磁盘中加载页去响应一个页故障。在你编写它时,记住: (1) `addr` 可能并不会做边界对齐,并且 (2) 在扇区中的 `ide_read` 操作并不是以块为单位的。 +> **练习 2**、在 `fs/bc.c` 中实现 `bc_pgfault` 和 `flush_block` 函数。`bc_pgfault` 函数是一个页故障服务程序,就像你在前一个实验中编写的写时复制 fork 一样,只不过它的任务是从磁盘中加载页去响应一个页故障。在你编写它时,记住: (1) `addr` 可能并不会做边界对齐,并且 (2) 在扇区中的 `ide_read` 操作并不是以块为单位的。 -(如果需要的话)函数 `flush_block` 应该会将一个块写入到磁盘上。如果在块缓存中没有块(也就是说,页没有映射)或者它不是一个脏块,那么 `flush_block` 将什么都不做。我们将使用虚拟内存硬件去跟踪,磁盘块自最后一次从磁盘读取或写入到磁盘之后是否被修改过。查看一个块是否需要写入时,我们只需要去查看 `uvpt` 条目中的 `PTE_D` 的 ”dirty“ 位即可。(`PTE_D` 位由处理器设置,用于表示那个页被写入;具体细节可以查看 x386 参考手册的 [第 5 章][3] 的 5.2.4.3 节)块被写入到磁盘上之后,`flush_block` 函数将使用 `sys_page_map` 去清除 `PTE_D` 位。 +>(如果需要的话)函数 `flush_block` 应该会将一个块写入到磁盘上。如果在块缓存中没有块(也就是说,页没有映射)或者它不是一个脏块,那么 `flush_block` 将什么都不做。我们将使用虚拟内存硬件去跟踪,磁盘块自最后一次从磁盘读取或写入到磁盘之后是否被修改过。查看一个块是否需要写入时,我们只需要去查看 `uvpt` 条目中的 `PTE_D` 的 ”dirty“ 位即可。(`PTE_D` 位由处理器设置,用于表示那个页被写入;具体细节可以查看 x386 参考手册的 [第 5 章][3] 的 5.2.4.3 节)块被写入到磁盘上之后,`flush_block` 函数将使用 `sys_page_map` 去清除 `PTE_D` 位。 -使用 `make grade` 去测试你的代码。你的代码应该能够通过 "check_bc"、"check_super"、和 "check_bitmap" 的测试。 -``` +> 使用 `make grade` 去测试你的代码。你的代码应该能够通过 "check_bc"、"check_super"、和 "check_bitmap" 的测试。 在 `fs/fs.c` 中的函数 `fs_init` 是块缓存使用的一个很好的示例。在初始化块缓存之后,它简单地在全局变量 `super` 中保存指针到磁盘映射区。在这之后,如果块在内存中,或我们的页故障服务程序按需将它们从磁盘上读入后,我们就能够简单地从 `super` 结构中读取块了。 -```markdown -小挑战!到现在为止,块缓存还没有清除策略。一旦某个块因为页故障被读入到缓存中之后,它将一直不会被清除,并且永远保留在内存中。给块缓存增加一个清除策略。在页表中使用 `PTE_A` 的 "accessed" 位来实现,任何环境访问一个页时,硬件就会设置这个位,你可以通过它来跟踪磁盘块的大致使用情况,而不需要修改访问磁盘映射区域的任何代码。使用脏块要小心。 -``` +. + +> **小挑战!**到现在为止,块缓存还没有清除策略。一旦某个块因为页故障被读入到缓存中之后,它将一直不会被清除,并且永远保留在内存中。给块缓存增加一个清除策略。在页表中使用 `PTE_A` 的 "accessed" 位来实现,任何环境访问一个页时,硬件就会设置这个位,你可以通过它来跟踪磁盘块的大致使用情况,而不需要修改访问磁盘映射区域的任何代码。使用脏块要小心。 ### 块位图 在 `fs_init` 设置了 `bitmap` 指针之后,我们可以认为 `bitmap` 是一个装满比特位的数组,磁盘上的每个块就是数组中的其中一个比特位。比如 `block_is_free`,它只是简单地在位图中检查给定的块是否被标记为空闲。 -```markdown -练习 3、使用 `free_block` 作为实现 `fs/fs.c` 中的 `alloc_block` 的一个模型,它将在位图中去查找一个空闲的磁盘块,并将它标记为已使用,然后返回块编号。当你分配一个块时,你应该立即使用 `flush_block` 将已改变的位图块刷新到磁盘上,以确保文件系统的一致性。 +> **练习 3**、使用 `free_block` 作为实现 `fs/fs.c` 中的 `alloc_block` 的一个模型,它将在位图中去查找一个空闲的磁盘块,并将它标记为已使用,然后返回块编号。当你分配一个块时,你应该立即使用 `flush_block` 将已改变的位图块刷新到磁盘上,以确保文件系统的一致性。 -使用 `make grade` 去测试你的代码。现在,你的代码应该要通过 "alloc_block" 的测试。 -``` +> 使用 `make grade` 去测试你的代码。现在,你的代码应该要通过 "alloc_block" 的测试。 ### 文件操作 在 `fs/fs.c` 中,我们提供一系列的函数去实现基本的功能,比如,你将需要去理解和管理结构 `File`、扫描和管理目录”文件“的条目、 以及从根目录开始遍历文件系统以解析一个绝对路径名。阅读 `fs/fs.c` 中的所有代码,并在你开始实验之前,确保你理解了每个函数的功能。 -```markdown -练习 4、实现 `file_block_walk` 和 `file_get_block`。`file_block_walk` 从一个文件中的块偏移量映射到 `struct File` 中那个块的指针上或间接块上,它非常类似于 `pgdir_walk` 在页表上所做的事。`file_get_block` 将更进一步,将去映射一个真实的磁盘块,如果需要的话,去分配一个新的磁盘块。 +> **练习 4**、实现 `file_block_walk` 和 `file_get_block`。`file_block_walk` 从一个文件中的块偏移量映射到 `struct File` 中那个块的指针上或间接块上,它非常类似于 `pgdir_walk` 在页表上所做的事。`file_get_block` 将更进一步,将去映射一个真实的磁盘块,如果需要的话,去分配一个新的磁盘块。 -使用 `make grade` 去测试你的代码。你的代码应该要通过 "file_open"、"file_get_block"、以及 "file_flush/file_truncated/file rewrite"、和 "testfile" 的测试。 -``` +> 使用 `make grade` 去测试你的代码。你的代码应该要通过 "file_open"、"file_get_block"、以及 "file_flush/file_truncated/file rewrite"、和 "testfile" 的测试。 `file_block_walk` 和 `file_get_block` 是文件系统中的”劳动模范“。比如,`file_read` 和 `file_write` 或多或少都在 `file_get_block` 上做必需的登记工作,然后在分散的块和连续的缓存之间复制字节。 -``` -小挑战!如果操作在中途实然被打断(比如,突然崩溃或重启),文件系统很可能会产生错误。实现软件更新或日志处理的方式让文件系统的”崩溃可靠性“更好,并且演示一下旧的文件系统可能会崩溃,而你的更新后的文件系统不会崩溃的情况。 -``` +. + +> **小挑战!**如果操作在中途实然被打断(比如,突然崩溃或重启),文件系统很可能会产生错误。实现软件更新或日志处理的方式让文件系统的”崩溃可靠性“更好,并且演示一下旧的文件系统可能会崩溃,而你的更新后的文件系统不会崩溃的情况。 ### 文件系统接口 @@ -207,19 +197,17 @@ x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的 服务器也通过 IPC 来发送响应。我们为函数的返回代码使用 32 位的数字。对于大多数 RPC,这已经涵盖了它们全部的返回代码。`FSREQ_READ` 和 `FSREQ_STAT` 也返回数据,它们只是被简单地写入到客户端发送它的请求时的页上。在 IPC 的响应中并不需要去发送这个页,因为这个页是文件系统服务器和客户端从一开始就共享的页。另外,在它的响应中,`FSREQ_OPEN` 与客户端共享一个新的 "Fd page”。我们将快捷地返回到文件描述符页上。 -```markdown -练习 5、实现 `fs/serv.c` 中的 `serve_read`。 +> **练习 5**、实现 `fs/serv.c` 中的 `serve_read`。 -`serve_read` 的重任将由已经在 `fs/fs.c` 中实现的 `file_read` 来承担(它实际上不过是对 `file_get_block` 的一连串调用)。对于文件读取,`serve_read` 只能提供 RPC 接口。查看 `serve_set_size` 中的注释和代码,去大体上了解服务器函数的结构。 +> `serve_read` 的重任将由已经在 `fs/fs.c` 中实现的 `file_read` 来承担(它实际上不过是对 `file_get_block` 的一连串调用)。对于文件读取,`serve_read` 只能提供 RPC 接口。查看 `serve_set_size` 中的注释和代码,去大体上了解服务器函数的结构。 -使用 `make grade` 去测试你的代码。你的代码通过 "serve_open/file_stat/file_close" 和 "file_read" 的测试后,你得分应该是 70(总分为 150)。 -``` +> 使用 `make grade` 去测试你的代码。你的代码通过 "serve_open/file_stat/file_close" 和 "file_read" 的测试后,你得分应该是 70(总分为 150)。 -```markdown -练习 6、实现 `fs/serv.c` 中的 `serve_write` 和 `lib/file.c` 中的 `devfile_write`。 +. -使用 `make grade` 去测试你的代码。你的代码通过 "file_write"、"file_read after file_write"、"open"、和 "large file" 的测试后,得分应该是 90(总分为150)。 -``` +> **练习 6**、实现 `fs/serv.c` 中的 `serve_write` 和 `lib/file.c` 中的 `devfile_write`。 + +> 使用 `make grade` 去测试你的代码。你的代码通过 "file_write"、"file_read after file_write"、"open"、和 "large file" 的测试后,得分应该是 90(总分为150)。 ### 进程增殖 @@ -227,21 +215,19 @@ x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的 我们实现的是 `spawn`,而不是一个类 UNIX 的 `exec`,因为 `spawn` 是很容易从用户空间中、以”外内核式“ 实现的,它无需来自内核的特别帮助。为了在用户空间中实现 `exec`,想一想你应该做什么?确保你理解了它为什么很难。 -```markdown -练习 7、`spawn` 依赖新的系统调用 `sys_env_set_trapframe` 去初始化新创建的环境的状态。实现 `kern/syscall.c` 中的 `sys_env_set_trapframe`。(不要忘记在 `syscall()` 中派发新系统调用) +> **练习 7**、`spawn` 依赖新的系统调用 `sys_env_set_trapframe` 去初始化新创建的环境的状态。实现 `kern/syscall.c` 中的 `sys_env_set_trapframe`。(不要忘记在 `syscall()` 中派发新系统调用) -运行来自 `kern/init.c` 中的 `user/spawnhello` 程序来测试你的代码`kern/init.c` ,它将尝试从文件系统中增殖 `/hello`。 +> 运行来自 `kern/init.c` 中的 `user/spawnhello` 程序来测试你的代码`kern/init.c` ,它将尝试从文件系统中增殖 `/hello`。 -使用 `make grade` 去测试你的代码。 -``` +> 使用 `make grade` 去测试你的代码。 -```markdown -小挑战!实现 Unix 式的 `exec`。 -``` +. -```markdown -小挑战!实现 `mmap` 式的文件内存映射,并如果可能的话,修改 `spawn` 从 ELF 中直接映射页。 -``` +> **小挑战!**实现 Unix 式的 `exec`。 + +. + +> **小挑战!**实现 `mmap` 式的文件内存映射,并如果可能的话,修改 `spawn` 从 ELF 中直接映射页。 ### 跨 fork 和 spawn 共享库状态 @@ -255,11 +241,9 @@ UNIX 文件描述符是一个通称的概念,它还包括管道、控制台 I/ 我们在 `inc/lib.h` 中定义了一个新的 `PTE_SHARE` 位,在 Intel 和 AMD 的手册中,这个位是被标记为”软件可使用的“的三个 PTE 位之一。我们将创建一个约定,如果一个页表条目中这个位被设置,那么在 `fork` 和 `spawn` 中应该直接从父环境中复制 PTE 到子环境中。注意它与标记为写时复制的差别:正如在第一段中所描述的,我们希望确保能共享页更新。 -```markdown -练习 8、修改 `lib/fork.c` 中的 `duppage`,以遵循最新约定。如果页表条目设置了 `PTE_SHARE` 位,仅直接复制映射。(你应该去使用 `PTE_SYSCALL`,而不是 `0xfff`,去从页表条目中掩掉有关的位。`0xfff` 仅选出可访问的位和脏位。) +> **练习 8**、修改 `lib/fork.c` 中的 `duppage`,以遵循最新约定。如果页表条目设置了 `PTE_SHARE` 位,仅直接复制映射。(你应该去使用 `PTE_SYSCALL`,而不是 `0xfff`,去从页表条目中掩掉有关的位。`0xfff` 仅选出可访问的位和脏位。) -同样的,在 `lib/spawn.c` 中实现 `copy_shared_pages`。它应该循环遍历当前进程中所有的页表条目(就像 `fork` 那样),复制任何设置了 `PTE_SHARE` 位的页映射到子进程中。 -``` +> 同样的,在 `lib/spawn.c` 中实现 `copy_shared_pages`。它应该循环遍历当前进程中所有的页表条目(就像 `fork` 那样),复制任何设置了 `PTE_SHARE` 位的页映射到子进程中。 使用 `make run-testpteshare` 去检查你的代码行为是否正确。正确的情况下,你应该会看到像 "`fork handles PTE_SHARE right`" 和 "`spawn handles PTE_SHARE right`” 这样的输出行。 @@ -269,9 +253,7 @@ UNIX 文件描述符是一个通称的概念,它还包括管道、控制台 I/ 为了能让 shell 工作,我们需要一些方式去输入。QEMU 可以显示输出,我们将它的输出写入到 CGA 显示器上和串行端口上,但到目前为止,我们仅能够在内核监视器中接收输入。在 QEMU 中,我们从图形化窗口中的输入作为从键盘到 JOS 的输入,虽然键入到控制台的输入作为出现在串行端口上的字符的方式显现。在 `kern/console.c` 中已经包含了由我们自实验 1 以来的内核监视器所使用的键盘和串行端口的驱动程序,但现在你需要去把这些增加到系统中。 -```markdown -练习 9、在你的 `kern/trap.c` 中,调用 `kbd_intr` 去处理捕获 `IRQ_OFFSET+IRQ_KBD` 和 `serial_intr`,用它们去处理捕获 `IRQ_OFFSET+IRQ_SERIAL`。 -``` +> **练习 9**、在你的 `kern/trap.c` 中,调用 `kbd_intr` 去处理捕获 `IRQ_OFFSET+IRQ_KBD` 和 `serial_intr`,用它们去处理捕获 `IRQ_OFFSET+IRQ_SERIAL`。 在 `lib/console.c` 中,我们为你实现了文件的控制台输入/输出。`kbd_intr` 和 `serial_intr` 将使用从最新读取到的输入来填充缓冲区,而控制台文件类型去排空缓冲区(默认情况下,控制台文件类型为 stdin/stdout,除非用户重定向它们)。 @@ -282,40 +264,38 @@ UNIX 文件描述符是一个通称的概念,它还包括管道、控制台 I/ 运行 `make run-icode` 或 `make run-icode-nox` 将运行你的内核并启动 `user/icode`。`icode` 又运行 `init`,它将设置控制台作为文件描述符 0 和 1(即:标准输入 stdin 和标准输出 stdout),然后增殖出环境 `sh`,就是 shell。之后你应该能够运行如下的命令了: ``` - echo hello world | cat - cat lorem |cat - cat lorem |num - cat lorem |num |num |num |num |num - lsfd +echo hello world | cat +cat lorem |cat +cat lorem |num +cat lorem |num |num |num |num |num +lsfd ``` 注意用户库常规程序 `cprintf` 将直接输出到控制台,而不会使用文件描述符代码。这对调试非常有用,但是对管道连接其它程序却很不利。为将输出打印到特定的文件描述符(比如 1,它是标准输出 stdout),需要使用 `fprintf(1, "...", ...)`。`printf("...", ...)` 是将输出打印到文件描述符 1(标准输出 stdout) 的快捷方式。查看 `user/lsfd.c` 了解更多示例。 -```markdown -练习 10、 -这个 shell 不支持 I/O 重定向。如果能够运行 `run sh **练习 10**、这个 shell 不支持 I/O 重定向。如果能够运行 `run sh 通过在你的 shell 中输入 `sh 运行 `make run-testshell` 去测试你的 shell。`testshell` 只是简单地给 shell ”喂“上面的命令(也可以在 `fs/testshell.sh` 中找到),然后检查它的输出是否与 `fs/testshell.key` 一样。 -```markdown -小挑战!给你的 shell 添加更多的特性。最好包括以下的特性(其中一些可能会要求修改文件系统): +. - * 后台命令 (`ls &`) - * 一行中运行多个命令 (`ls; echo hi`) - * 命令组 (`(ls; echo hi) | cat > out`) - * 扩展环境变量 (`echo $hello`) - * 引号 (`echo "a | b"`) - * 命令行历史和/或编辑功能 - * tab 命令补全 - * 为命令行查找目录、cd 和路径 - * 文件创建 - * 用快捷键 `ctl-c` 去杀死一个运行中的环境 -可做的事情还有很多,并不仅限于以上列表。 -``` +> **小挑战!**给你的 shell 添加更多的特性。最好包括以下的特性(其中一些可能会要求修改文件系统): + +> * 后台命令 (`ls &`) +> * 一行中运行多个命令 (`ls; echo hi`) +> * 命令组 (`(ls; echo hi) | cat > out`) +> * 扩展环境变量 (`echo $hello`) +> * 引号 (`echo "a | b"`) +> * 命令行历史和/或编辑功能 +> * tab 命令补全 +> * 为命令行查找目录、cd 和路径 +> * 文件创建 +> * 用快捷键 `ctl-c` 去杀死一个运行中的环境 + +> 可做的事情还有很多,并不仅限于以上列表。 到目前为止,你的代码应该要通过所有的测试。和以前一样,你可以使用 `make grade` 去评级你的提交,并且使用 `make handin` 上交你的实验。 @@ -328,7 +308,7 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab5/ 作者:[csail.mit][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 63768a764cd0d5eb024dc1ee19b7afca8d04c1ea Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 27 Dec 2018 08:26:19 +0800 Subject: [PATCH 0337/4278] Translating --- ...1206 Take a break at the Linux command line with Nyan Cat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md index 7f642b5496..05dd160dc8 100644 --- a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md +++ b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Take a break at the Linux command line with Nyan Cat) From ffe8fa5825d196cc6343c8e1520d10972df81031 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Dec 2018 08:50:32 +0800 Subject: [PATCH 0338/4278] translated --- .../20181214 How To Install Rust Programming Language In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181214 How To Install Rust Programming Language In Linux.md (100%) diff --git a/sources/tech/20181214 How To Install Rust Programming Language In Linux.md b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md similarity index 100% rename from sources/tech/20181214 How To Install Rust Programming Language In Linux.md rename to translated/tech/20181214 How To Install Rust Programming Language In Linux.md From 9271abd1645d98012a323fdf1841d7920739c3be Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Dec 2018 08:53:41 +0800 Subject: [PATCH 0339/4278] translated --- ...tall Rust Programming Language In Linux.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md index c39e037d6d..a2fc9f1382 100644 --- a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md +++ b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md @@ -7,22 +7,22 @@ [#]: via: (https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) -How To Install Rust Programming Language In Linux +如何在 Linux 中安装 Rust 编程语言 ====== -Rust is often called rust-lang. +Rust 通常被称为 rust-lang。 -Rust is a general-purpose, multi-paradigm, modern, cross-platform, and open source systems programming language sponsored by Mozilla Research. +Rust 是一个由 Mozilla Research 赞助的通用、多范式、现代、跨平台和开源系统编程语言。 -It was designed to be achieve a goals such as safety, speed, and concurrency. +它旨在实现安全性、速度和并发性等目标。 -Rust is syntactically similar to C++,[14] but its designers intend it to provide better memory safety while still maintaining performance. +Rust 在语法上与 C++ 相似,但它的设计者希望它在保持性能的同时提供更好的内存安全性。 -Rust is currently used in many organization such as Firefox, Chef, Dropbox, Oracle, GNOME, etc,. +Rust 目前在许多组织中使用,例如 Firefox、Chef、Dropbox、Oracle、GNOME 等。 -### How to Install Runs Language in Linux? +### 如何在 Linux 中安装 Rust 语言? -There are many ways we can install Rust but below is the officially recommended way to install it. +我们可以通过多种方式安装 Rust,但以下是官方推荐的安装方式。 ``` $ curl https://sh.rustup.rs -sSf | sh @@ -85,22 +85,22 @@ environment variable. Next time you log in this will be done automatically. To configure your current shell run source $HOME/.cargo/env ``` -Run the following command to configure your current shell. +运行以下命令配置当前 shell。 ``` $ source $HOME/.cargo/env ``` -Run the following command to verify the installed Rust version. +运行以下命令验证已安装的 Rust 版本。 ``` $ rustc --version rustc 1.31.0 (abe02cefd 2018-12-04) ``` -### How To Test Rust programming language? +### 如何测试 Rust 编程语言? -Once you installed Rust follow the below steps to check whether Rust programe language is working fine or not. +安装 Rust 后,请按照以下步骤检查 Rust 语言是否正常工作。 ``` $ mkdir ~/projects @@ -109,7 +109,7 @@ $ mkdir hello_world $ cd hello_world ``` -Create a file and add the below code and save the file. Make sure, Rust files always end in a .rs extension. +创建一个文件并添加以下代码并保存。确保 Rust 文件始终以 .rs 扩展名结尾。 ``` $ vi 2g.rs @@ -119,13 +119,13 @@ fn main() { } ``` -Run the following command to compile the rust code. +运行以下命令编译 rust 代码。 ``` $ rustc 2g.rs ``` -The above command will create a executable Rust program file in the same directory. +上面的命令将在同一目录中创建一个可执行的 Rust 程序。 ``` $ ls -lh @@ -134,16 +134,16 @@ total 3.9M -rw-r--r-- 1 daygeek daygeek 86 Dec 14 11:09 2g.rs ``` -Run the Rust executable file to get the output. +运行 Rust 可执行文件得到输出。 ``` $ ./2g Hello, It's 2DayGeek.com - Best Linux Practical Blog! ``` -Yup! that’s working fine. +好了!正常工作了。 -To update Rust to latest version. +将 Rust 更新到最新版本。 ``` $ rustup update @@ -153,13 +153,13 @@ info: checking for self-updates stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04) ``` -Run the following command to remove the Rust package from your system. +运行以下命令从系统中删除 Rust 包。 ``` $ rustup self uninstall ``` -Once you uninstalled the Rust package, remove the Rust project directory. +卸载 Rust 包后,删除 Rust 项目目录。 ``` $ rm -fr ~/projects @@ -170,10 +170,10 @@ via: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ 作者:[Prakash Subramanian][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://www.2daygeek.com/author/prakash/ -[b]: https://github.com/lujun9972 +[b]: https://github.com/lujun9972 \ No newline at end of file From 637e80f3f8638fe1154dd1f19c941c3953325e24 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Dec 2018 08:56:27 +0800 Subject: [PATCH 0340/4278] translating --- .../tech/20181222 Watch YouTube videos at the Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md index d2ba12dbeb..e4db6bc039 100644 --- a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md +++ b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e51e499efeca086c62c2b4d3d5f3601a69c92632 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Dec 2018 09:42:30 +0800 Subject: [PATCH 0341/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20[Review]=20Polo?= =?UTF-8?q?=20File=20Manager=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...226 -Review- Polo File Manager in Linux.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 sources/talk/20181226 -Review- Polo File Manager in Linux.md diff --git a/sources/talk/20181226 -Review- Polo File Manager in Linux.md b/sources/talk/20181226 -Review- Polo File Manager in Linux.md new file mode 100644 index 0000000000..cf763850cf --- /dev/null +++ b/sources/talk/20181226 -Review- Polo File Manager in Linux.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: ([Review] Polo File Manager in Linux) +[#]: via: (https://itsfoss.com/polo-file-manager/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +[Review] Polo File Manager in Linux +====== + +We are all familiar with file managers. It’s that piece of software that allows you to access your directories, files in a GUI. + +Most of us use the default file manager included with our desktop of choice. The creator of [Polo][1] hopes to get you to use his file manager by adding extra features but hides the good ones behind a paywall. + +![][2]Polo file manager + +### What is Polo file manager? + +According to its [website][1], Polo is an “advanced file manager for Linux written in [Vala][3])”. Further down the page, Polo is referred to as a “modern, light-weight file manager for Linux with support for multiple panes and tabs; support for archives, and much more.” + +It is from the same developer (Tony George) that has given us some of the most popular applications for desktop Linux. [Timeshift backup][4] tool, [Conky Manager][5], [Aptik backup tool][6]s for applications etc. Polo is the latest offering from Tony. + +Note that Polo is still in the beta stage of development which means the first stable version of the software is not out yet. + +### Features of Polo file manager + +![Polo File Manager in Ubuntu Linux][7]Polo File Manager in Ubuntu Linux + +It’s true that Polo has a bunch of neat features that most file managers don’t have. However, the really neat features are only available if you donate more than $10 to the project or sign up for the creator’s Patreon. I will be separating the free features from the features that require the “donation plugin”. + +![Cloud storage support in Polo file manager][8]Support cloud storage + +#### Free Features + + * Multiple Panes – Single-pane, dual-pane (vertical or horizontal split) and quad-pane layouts. + * Multiple Views – List view, Icon view, Tiled view, and Media view + * Device Manager – Devices popup displays the list of connected devices with options to mount and unmount + * Archive Support – Support for browsing archives as normal folders. Supports creation of archives in multiple formats with advanced compression settings. + * Checksum & Hashing – Generate and compare MD5, SHA1, SHA2-256 ad SHA2-512 checksums + * Built-in [Fish shell][9] + * Support for [cloud storage][10], such as Dropbox, Google Drive, Amazon Drive, Amazon S3, Backblaze B2, Hubi, Microsoft OneDrive, OpenStack Swift, and Yandex Disk + * Compare files + * Analyses disk usage + * KVM support + * Connect to FTP, SFTP, SSH and Samba servers + + + +![Dual pane view of Polo file manager][11]Polo in dual pane view + +#### Donation/Paywall Features + + * Write ISO to USB Device + * Image optimization and adjustment tools + * Optimize PNG + * Reduce JPEG Quality + * Remove Color + * Reduce Color + * Boost Color + * Set as Wallpaper + * Rotate + * Resize + * Convert to PNG, JPEG, TIFF, BMP, ICO and more + * PDF tools + * Split + * Merge + * Add and Remove Password + * Reduce File Size + * Uncompress + * Remove Colors + * Rotate + * Optimize + * Video Download via [youtube-dl][12] + + + +### Installing Polo + +Let’s see how to install Polo file manager on various Linux distributions. + +#### 1\. Ubuntu based distributions + +For all Ubuntu based systems (Ubuntu, Linux Mint, Elementary OS, etc), you can install Polo via the [official PPA][13]. Not sure what a PPA is? [Read about PPA here][14]. + +`sudo apt-add-repository -y ppa:teejee2008/ppa` +`sudo apt-get update` +`sudo apt-get install polo-file-manager` + +#### 2\. Arch based distributions + +For all Arch-based systems (Arch, Manjaro, ArchLabs, etc), you can install Polo from the [Arch User Repository][15]. + +#### 3\. Other Distros + +For all other distros, you can download and use the [.RUN installer][16] to setup Polo. + +### Thoughts on Polo + +I’ve installed tons of different distros and never had a problem with the default file manager. (I’ve probably used Thunar and Caja the most.) The free version of Polo doesn’t contain any features that would make me switch. As for the paid features, I already use a number of applications that accomplish the same things. + +One final note: the paid version of Polo is supposed to help fund development of the project. However, [according to GitHub][17], the last commit on Polo was three months ago. That’s quite a big interval of inactivity for a software that is still in the beta stages of development. + +Have you ever used [Polo][1]? If not, what is your favorite Linux file manager? 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][18]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/polo-file-manager/ + +作者:[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://teejee2008.github.io/polo/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/polo.jpg?fit=800%2C500&ssl=1 +[3]: https://en.wikipedia.org/wiki/Vala_(programming_language +[4]: https://itsfoss.com/backup-restore-linux-timeshift/ +[5]: https://itsfoss.com/conky-gui-ubuntu-1304/ +[6]: https://github.com/teejee2008/aptik +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/polo-file-manager-in-ubuntu.jpeg?resize=800%2C450&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/polo-coud-options.jpg?fit=800%2C795&ssl=1 +[9]: https://fishshell.com/ +[10]: https://itsfoss.com/cloud-services-linux/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/polo-dual-pane.jpg?fit=800%2C520&ssl=1 +[12]: https://itsfoss.com/download-youtube-linux/ +[13]: https://launchpad.net/~teejee2008/+archive/ubuntu/ppa +[14]: https://itsfoss.com/ppa-guide/ +[15]: https://aur.archlinux.org/packages/polo +[16]: https://github.com/teejee2008/polo/releases +[17]: https://github.com/teejee2008/polo +[18]: http://reddit.com/r/linuxusersgroup From 714c33c15748ded422ff8f49371f35fff978d65e Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Dec 2018 09:43:12 +0800 Subject: [PATCH 0342/4278] add done: 20181226 -Review- Polo File Manager in Linux.md --- .../20181226 -Review- Polo File Manager in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => tech}/20181226 -Review- Polo File Manager in Linux.md (100%) diff --git a/sources/talk/20181226 -Review- Polo File Manager in Linux.md b/sources/tech/20181226 -Review- Polo File Manager in Linux.md similarity index 100% rename from sources/talk/20181226 -Review- Polo File Manager in Linux.md rename to sources/tech/20181226 -Review- Polo File Manager in Linux.md From 479a781f1e4aeee3d73a390f2a0db95fc7df0e27 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Dec 2018 09:50:03 +0800 Subject: [PATCH 0343/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Turn=20GNOME=20?= =?UTF-8?q?to=20Heaven=20With=20These=2023=20GNOME=20Extensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...o Heaven With These 23 GNOME Extensions.md | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md diff --git a/sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md b/sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md new file mode 100644 index 0000000000..e49778eab7 --- /dev/null +++ b/sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md @@ -0,0 +1,288 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Turn GNOME to Heaven With These 23 GNOME Extensions) +[#]: via: (https://fosspost.org/tutorials/turn-gnome-to-heaven-with-these-23-gnome-extensions) +[#]: author: (M.Hanny Sabbagh https://fosspost.org/author/mhsabbagh) + +Turn GNOME to Heaven With These 23 GNOME Extensions +====== + +GNOME Shell is one of the most used desktop interfaces on the Linux desktop. It’s part of the GNOME project and is considered to be the next generation of the old classic GNOME 2.x interface. GNOME Shell was first released in 2011 carrying a lot of features, including GNOME Shell extensions feature. + +GNOME Extensions are simply extra functionality that you can add to your interface, they can be panel extensions, performance extensions, quick access extensions, productivity extensions or for any other type of usage. They are all free and open source of course; you can install them with a single click **from your web browser** actually. + +### How To Install GNOME Extensions? + +You main way to install GNOME extensions will be via the extensions.gnome.org website. It’s an official platform belonging to GNOME where developers publish their extensions easily so that users can install them in a single click. + +In order to for this to work, you’ll need two things: + + 1. Browser Add-on: You’ll need to install a browser add-on that allows the website to communicate with your local GNOME desktop. You install it from [here for Firefox][1], or [here for Chrome][2] or [here for Opera][3]. + + 2. Native Connector: You still need another part to allow your system to accept installing files locally from your web browser. To install this component, you must install the `chrome-gnome-shell` package. Do not be deceived! Although the package name is containing “chrome”, it also works on Firefox too. To install it on Debian/Ubuntu/Mint run the following command in terminal: + +``` +sudo apt install chrome-gnome-shell +``` + +For Fedora: + +``` +sudo dnf install chrome-gnome-shell +``` + +For Arch: + +``` +sudo pacman -S chrome-gnome-shell +``` + +After you have installed the two components above, you can easily install extensions from the GNOME extensions website. + +### How to Configure GNOME Extensions Settings? + +Many of these extensions do have a settings window that you can access to adjust the preferences of that extension. You must make sure that you have seen its options at least once so that you know what you can possibly do using that extension. + +To do this, you can head to the [installed extensions page on the GNOME website][4], and you’ll see a small options button near every extension that offers one: + +![Screenshot 2018 12 24 20 50 55 41][5] + +Clicking it will display a window for you, from which you can see the possible settings: + +![Screenshot 2018 12 24 20 51 29 43][6] + +Read our article below for our list of recommended extension! + +### General Extensions + +#### 1\. User Themes + +![Screenshot from 2018 12 23 12 30 20 45][7] + +This is the first must-install extension on the GNOME Shell interface, it simply allows you to change the desktop theme to another one using the tweak tool. After installation run gnome-tweak-tool, and you’ll be able to change your desktop theme. + +Installation link: + +#### 2\. Dash to Panel + +![Screenshot from 2018 12 24 21 16 11 47][8] + +Converts the GNOME top bar into a taskbar with many added features, such as favorite icons, moving the clock to right, adding currently opened windows to the panel and many other features. (Make sure not to install this one with some other extensions below which do provide the same functionality). + +Installation link: + +#### 3\. Desktop Icons + +![gnome shell screenshot SSP3UZ 49][9] + +Restores desktop icons back again to GNOME. Still in continues development. + +Installation link: + +#### 4\. Dash to Dock + +![Screenshot from 2018 12 24 21 50 07 51][10] + +If you are a fan of the Unity interface, then this extension may help you. It simply adds a dock to the left/right side of the screen, which is very similar to Unity. You can customize that dock however you like. + +Installation link: + +### Productivity Extensions + +#### 5\. Todo.txt + +![screenshot_570_5X5YkZb][11] + +For users who like to maintain productivity, you can use this extension to add a simple To-Do list functionality to your desktop, it will use the [syntax][12] from todotxt.com, you can add unlimited to-dos, mark them as complete or remove them, change their position beside modifying or taking a backup of the todo.txt file manually. + +Installation link: + +#### 6\. Screenshot Tool + +![Screenshot from 2018 12 24 21 04 14 54][13] + +Easily take a screenshot of your desktop or a specific area, with the possibility of also auto-uploading it to imgur.com and auto-saving the link into the clipboard! Very useful extension. + +Installation link: + +#### 7\. OpenWeather + +![screenshot_750][14] + +If you would like to know the weather forecast everyday then this extension will be the right one for you, this extension will simply add an applet to the top panel allowing you to fetch the weather data from openweathermap.org or forecast.io, it supports all the countries and cities around the world. It also shows the wind and humidity. + +Installation link: + +#### 8 & 9\. Search Providers Extensions + +![Screenshot from 2018 12 24 21 29 41 57][15] + +In GNOME, you can add what’s known as “search providers” to the shell, meaning that when you type something in the search box, you’ll be able to automatically search these websites (search providers) using the same text you entered, and see the results directly from your shell! + +YouTube Search Provider: + +Wikipedia Search Provider: + +### Workflow Extensions + +#### 10\. No Title Bar + +![Screenshot 20181224210737 59][16] + +This extension simply removes the title bar from all the maximized windows, and moves it into the top GNOME Panel. In this way, you’ll be able to save a complete horizontal line on your screen, more space for your work! + +Installation Link: + +#### 11\. Applications Menu + +![Screenshot 2018 12 23 13 58 07 61][17] + +This extension simply adds a classic menu to the “activities” menu on the corner. By using it, you will be able to browse the installed applications and categories without the need to use the dash or the search feature, which saves you time. (Check the “No hot corner” extension below to get a better usage). + +Installation link: + +#### 12\. Places Status Indicator + +![screenshot_8_1][18] + +This indicator will put itself near the left corner of the activities button, it allows you to access your home folder and sub-folders easily using a menu, you can also browse the available devices and networks using it. + +Installation link: + +#### 13\. Window List + +![Screenshot from 2016-08-12 08-05-48][19] + +Officially supported by GNOME team, this extension adds a bottom panel to the desktop which allows you to navigate between the open windows easily, it also include a workspace indicator to switch between them. + +Installation link: + +#### 14\. Frippery Panel Favorites + +![screenshot_4][20] + +This extensions adds your favorite applications and programs to the panel near the activities button, allowing you to access to it more quickly with just 1 click, you can add or remove applications from it just by modifying your applications in your favorites (the same applications in the left panel when you click the activities button will appear here). + +Installation link: + +#### 15\. TopIcons + +![Screenshot 20181224211009 66][21] + +Those extensions restore the system tray back into the top GNOME panel. Very needed in cases of where applications are very much dependent on the tray icon. + +For GNOME 3.28, installation link: + +For GNOME 3.30, installation link: + +#### 16\. Clipboard Indicator + +![Screenshot 20181224214626 68][22] + +A clipboard manager is simply an applications that manages all the copy & paste operations you do on your system and saves them into a history, so that you can access them later whenever you want. + +This extension does exactly this, plus many other cool features that you can check. + +Installation link: + +### Other Extensions + +#### 17\. Frippery Move Clock + +![screenshot_2][23] + +If you are from those people who like alignment a lot, and dividing the panels into 2 parts only, then you may like this extension, what it simply does is moving the clock from the middle of the GNOME Shell panel to the right near the other applets on the panel, which makes it more organized. + +Installation link: + +#### 18\. No Topleft Hot Corner + +If you don’t like opening the dash whenever you move the mouse to the left corner, you can disable it easily using this extension. You can for sure click the activities button if you want to open the dash view (or via the Super key on the keyboard), but the hot corner will be disabled only. + +Installation link: + +#### 19\. No Annoyance + +Simply removes the “window is ready” notification each time a new window a opened. + +Installation link: + +#### 20\. EasyScreenCast + +![Screenshot 20181224214219 71][24] + +If you would like to quickly take a screencast for your desktop, then this extension may help you. By simply just choosing the type of recording you want, you’ll be able to take screencasts any time. You can also configure advanced options for the extension, such as the pipeline and many other things. + +Installation link: + +#### 21\. Removable drive Menu + +![Screenshot 20181224214131 73][25] + +Adds an icon to the top bar which shows you a list of your currently removable drives. + +Installation link: + +#### 22\. BottomPanel + +![Screenshot 20181224214419 75][26] + +As its title says.. It simply moves the top GNOME bar into the bottom of the screen. + +Installation link: + +#### 23\. Unite + +If you would like one extension only to do most of the above tasks, then Unite extension can help you. It adds panel favorites, removes title bar, moves the clock, allows you to change the location of the panel.. And many other features. All using this extension alone! + +Installation link: + +### Conclusion + +This was our list for some great GNOME Shell extensions to try out. Of course, you don’t (and shouldn’t!) install all of these, but just what you need for your own usage. As you can see, you can convert GNOME into any form you would like, but be careful for RAM usage (because if you use more extensions, the shell will consume very much resources). + +What other GNOME Shell extensions do you use? What do you think of this list? + + +-------------------------------------------------------------------------------- + +via: https://fosspost.org/tutorials/turn-gnome-to-heaven-with-these-23-gnome-extensions + +作者:[M.Hanny Sabbagh][a] +选题:[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/mhsabbagh +[b]: https://github.com/lujun9972 +[1]: https://addons.mozilla.org/en/firefox/addon/gnome-shell-integration/ +[2]: https://chrome.google.com/webstore/detail/gnome-shell-integration/gphhapmejobijbbhgpjhcjognlahblep +[3]: https://addons.opera.com/en/extensions/details/gnome-shell-integration/ +[4]: https://extensions.gnome.org/local/ +[5]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot_2018-12-24_20-50-55.png?resize=850%2C359&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 42) +[6]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot_2018-12-24_20-51-29.png?resize=850%2C462&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 44) +[7]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-23-12-30-20.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 46) +[8]: https://i0.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-24-21-16-11.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 48) +[9]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/gnome-shell-screenshot-SSP3UZ.png?resize=850%2C492&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 50) +[10]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-24-21-50-07.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 52) +[11]: https://i0.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_570_5X5YkZb.png?resize=478%2C474&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 53) +[12]: https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format +[13]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-24-21-04-14.png?resize=715%2C245&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 55) +[14]: https://i2.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_750.jpg?resize=648%2C276&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 56) +[15]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-24-21-29-41.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 58) +[16]: https://i0.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224210737-380x95.png?resize=380%2C95&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 60) +[17]: https://i0.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot_2018-12-23_13-58-07.png?resize=524%2C443&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 62) +[18]: https://i0.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_8_1.png?resize=247%2C620&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 63) +[19]: https://i1.wp.com/fosspost.org/wp-content/uploads/2016/08/Screenshot-from-2016-08-12-08-05-48.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 64) +[20]: https://i0.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_4.png?resize=414%2C39&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 65) +[21]: https://i0.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224211009-631x133.png?resize=631%2C133&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 67) +[22]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224214626-520x443.png?resize=520%2C443&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 69) +[23]: https://i0.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_2.png?resize=388%2C26&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 70) +[24]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224214219-327x328.png?resize=327%2C328&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 72) +[25]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224214131-366x199.png?resize=366%2C199&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 74) +[26]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224214419-830x143.png?resize=830%2C143&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 76) From f5a62473820ac95e0d06db7b72650717346a9670 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Dec 2018 09:54:47 +0800 Subject: [PATCH 0344/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20An=20Introducti?= =?UTF-8?q?on=20to=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20181224 An Introduction to Go.md | 278 ++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 sources/tech/20181224 An Introduction to Go.md diff --git a/sources/tech/20181224 An Introduction to Go.md b/sources/tech/20181224 An Introduction to Go.md new file mode 100644 index 0000000000..b35bc9922e --- /dev/null +++ b/sources/tech/20181224 An Introduction to Go.md @@ -0,0 +1,278 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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/) + +An Introduction to Go +====== + +(What follows is an excerpt from my master’s thesis, almost all of section 2.1, quickly introducing Go to people familiar with CS) + +Go is an imperative programming language for concurrent programming created at and mainly developed by Google, initially mostly by Robert Griesemer, Rob Pike, and Ken Thompson. Design of the language started in 2007, and an initial version was released in 2009; with the first stable version, 1.0 released in 2012 . + +Go has a C-like syntax (without a preprocessor), garbage collection, and, like its predecessors devloped at Bell Labs – Newsqueak (Rob Pike), Alef (Phil Winterbottom), and Inferno (Pike, Ritchie, et al.) – provides built-in support for concurrency using so-called goroutines and channels, a form of co-routines, based on the idea of Hoare’s ‘Communicating Sequential Processes’ . + +Go programs are organised in packages. A package is essentially a directory containing Go files. All files in a package share the same namespace, and there are two visibilities for symbols in a package: Symbols starting with an upper case character are visible to other packages, others are private to the package: + +``` +func PublicFunction() { + fmt.Println("Hello world") +} + +func privateFunction() { + fmt.Println("Hello package") +} +``` + +### Types + +Go has a fairly simple type system: There is no subtyping (but there are conversions), no generics, no polymorphic functions, and there are only a few basic categories of types: + + 1. base types: `int`, `int64`, `int8`, `uint`, `float32`, `float64`, etc. + + 2. `struct` + + 3. `interface` \- a set of methods + + 4. `map[K, V]` \- a map from a key type to a value type + + 5. `[number]Type` \- an array of some element type + + 6. `[]Type` \- a slice (pointer to array with length and capability) of some type + + 7. `chan Type` \- a thread-safe queue + + 8. pointer `*T` to some other type + + 9. functions + + 10. named type - aliases for other types that may have associated methods: + +``` +type T struct { foo int } +type T *T +type T OtherNamedType +``` + +Named types are mostly distinct from their underlying types, so you cannot assign them to each other, but some operators like `+` do work on objects of named types with an underlying numerical type (so you could add two `T` in the example above). + + +Maps, slices, and channels are reference-like types - they essentially are structs containing pointers. Other types are passed by value (copied), including arrays (which have a fixed length and are copied). + +#### Conversions + +Conversions are the similar to casts in C and other languages. They are written like this: + +``` +TypeName(value) +``` + +#### Constants + +Go has “untyped” literals and constants. + +``` +1 // untyped integer literal +const foo = 1 // untyped integer constant +const foo int = 1 // int constant +``` + +Untyped values are classified into the following categories: `UntypedBool`, `UntypedInt`, `UntypedRune`, `UntypedFloat`, `UntypedComplex`, `UntypedString`, and `UntypedNil` (Go calls them basic kinds, other basic kinds are available for the concrete types like `uint8`). An untyped value can be assigned to a named type derived from a base type; for example: + +``` +type someType int + +const untyped = 2 // UntypedInt +const bar someType = untyped // OK: untyped can be assigned to someType +const typed int = 2 // int +const bar2 someType = typed // error: int cannot be assigned to someType +``` + +### Interfaces and ‘objects’ + +As mentioned before, interfaces are a set of methods. Go is not an object-oriented language per se, but it has some support for associating methods with named types: When declaring a function, a receiver can be provided - a receiver is an additional function argument that is passed before the function and involved in the function lookup, like this: + +``` +type SomeType struct { ... } + +func (s *SomeType) MyMethod() { +} + +func main() { + var s SomeType + s.MyMethod() +} +``` + +An object implements an interface if it implements all methods; for example, the following interface `MyMethoder` is implemented by `*SomeType` (note the pointer), and values of `*SomeType` can thus be used as values of `MyMethoder`. The most basic interface is `interface{}`, that is an interface with an empty method set - any object satisfies that interface. + +``` +type MyMethoder interface { + MyMethod() +} +``` + +There are some restrictions on valid receiver types; for example, while a named type could be a pointer (for example, `type MyIntPointer *int`), such a type is not a valid receiver type. + +### Control flow + +Go provides three primary statements for control flow: `if`, `switch`, and `for`. The statements are fairly similar to their equivalent in other C-like languages, with some exceptions: + + * There are no parentheses around conditions, so it is `if a == b {}`, not `if (a == b) {}`. The braces are mandatory. + + * All of them can have initialisers, like this + +`if result, err := someFunction(); err == nil { // use result }` + + * The `switch` statement can use arbitrary expressions in cases + + * The `switch` statement can switch over nothing (equals switching over true) + + * Cases do not fall through by default (no `break` needed), use `fallthrough` at the end of a block to fall through. + + * The `for` loop can loop over ranges: `for key, val := range map { do something }` + + + + +### Goroutines + +The keyword `go` spawns a new goroutine, a concurrently executed function. It can be used with any function call, even a function literal: + +``` +func main() { + ... + go func() { + ... + }() + + go some_function(some_argument) +} +``` + +### Channels + +Goroutines are often combined with channels to provide an extended form of Communicating Sequential Processes . A channel is a concurrent-safe queue, and can be buffered or unbuffered: + +``` +var unbuffered = make(chan int) // sending blocks until value has been read +var buffered = make(chan int, 5) // may have up to 5 unread values queued +``` + +The `<-` operator is used to communicate with a single channel. + +``` +valueReadFromChannel := <- channel +otherChannel <- valueToSend +``` + +The `select` statement allows communication with multiple channels: + +``` +select { + case incoming := <- inboundChannel: + // A new message for me + case outgoingChannel <- outgoing: + // Could send a message, yay! +} +``` + +### The `defer` statement + +Go provides a `defer` statement that allows a function call to be scheduled for execution when the function exits. It can be used for resource clean-up, for example: + +``` +func myFunc(someFile io.ReadCloser) { + defer someFile.close() + /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var Do stuff with file */ +} +``` + +It is of course possible to use function literals as the function to call, and any variables can be used as usual when writing the call. + +### Error handling + +Go does not provide exceptions or structured error handling. Instead, it handles errors by returning them in a second or later return value: + +``` +func Read(p []byte) (n int, err error) + +// Built-in type: +type error interface { + Error() string +} +``` + +Errors have to be checked in the code, or can be assigned to `_`: + +``` +n0, _ := Read(Buffer) // ignore error +n, err := Read(buffer) +if err != nil { + return err +} +``` + +There are two functions to quickly unwind and recover the call stack, though: `panic()` and `recover()`. When `panic()` is called, the call stack is unwound, and any deferred functions are run as usual. When a deferred function invokes `recover()`, the unwinding stops, and the value given to `panic()` is returned. If we are unwinding normally and not due to a panic, `recover()` simply returns `nil`. In the example below, a function is deferred and any `error` value that is given to `panic()` will be recovered and stored in an error return value. Libraries sometimes use that approach to make highly recursive code like parsers more readable, while still maintaining the usual error return value for public functions. + +``` +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) + } + } +} +``` + +### Arrays and slices + +As mentioned before, an array is a value type and a slice is a pointer into an array, created either by slicing an existing array or by using `make()` to create a slice, which will create an anonymous array to hold the elements. + +``` +slice1 := make([]int, 2, 5) // 5 elements allocated, 2 initialized to 0 +slice2 := array[:] // sliced entire array +slice3 := array[1:] // slice of array without first element +``` + +There are some more possible combinations for the slicing operator than mentioned above, but this should give a good first impression. + +A slice can be used as a dynamically growing array, using the `append()` function. + +``` +slice = append(slice, value1, value2) +slice = append(slice, arrayOrSlice...) +``` + +Slices are also used internally to represent variable parameters in variable length functions. + +### Maps + +Maps are simple key-value stores and support indexing and assigning. They are not thread-safe. + +``` +someValue := someMap[someKey] +someValue, ok := someMap[someKey] // ok is false if key not in someMap +someMap[someKey] = someValue +``` +-------------------------------------------------------------------------------- + +via: https://blog.jak-linux.org/2018/12/24/introduction-to-go/ + +作者:[Julian Andres Klode][a] +选题:[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.jak-linux.org/ +[b]: https://github.com/lujun9972 From ff5a22c7171a889298e7d6c9d8d944fd07d633e6 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 27 Dec 2018 11:06:21 +0800 Subject: [PATCH 0345/4278] Translated --- ...at the Linux command line with Nyan Cat.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md index 05dd160dc8..81e74a8a13 100644 --- a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md +++ b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -7,38 +7,39 @@ [#]: author: (Jason Baker https://opensource.com/users/jason-baker) [#]: url: ( ) -Take a break at the Linux command line with Nyan Cat +在 Linux 命令行中观看 Nyan Cat 来稍适休息 ====== -Rainbows, Pop-Tarts, and cats in space: What more could you want at your terminal? +> 你甚至可以在终端里欣赏彩虹猫。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nyancat.png?itok=eg1aEmBw) -We're now on day six of the Linux command-line toys advent calendar, where we explore some of the fun, entertaining, and in some cases, utterly useless toys available for your Linux terminal. All are available under an open source license. +今天是《Linux 命令行小玩具介绍》的第六天。在本系列文章中,我们将会探索一些娱乐用途(甚至有时完全没用)的 Linux 命令行小玩具。所有我们介绍的小玩具都是开源的。 -Will they all be unique? Yes. Will they all be unique to you? I don't know, but, chances are you'll find at least one new toy to play with by the time our advent calendar is done. +也许你会问,他们都很独特吗?是的。不过,他们对你是否独特,我就不知道了。但是,我们相信你应该能在这系列文章结束之前找到至少一个好玩的玩具。 -Today's selection is a continuation on the [theme][1] we started yesterday: cats and rainbows. Wait, there's more cat-related rainbow fun to be had at the Linux command line? You bet there is. +从[昨天的选题][1]继续:我们谈到了猫和彩虹。不过,在 Linux 命令行下有更有趣的彩虹和猫结合的程序吗?答案是肯定的。 -So let's make a throwback all the way to 2011's [Nyan Cat][2] with a command-line toy call, not surprisingly, **nyancat**. Did you miss the cultural phenomenon that was Nyan Cat? Watch the embed below, I'll wait. +我们不妨看看之前可以在命令行中使用 Nyan Cat 的方式吧。意料之中,2011 年发布的 [Nyan Cat][2] 可以用 **nyancat** 呈现在终端中。你想念这只曾火遍网络的 Nyan Cat 吗?看看下面这个视频记录吧,我会等你看完的。 -Now, let's recreate that amazing experience in your terminal. **Nyancat** is packaged for many distributions (Arch, Debian, Gentoo, Ubuntu, etc.) but not for mine (Fedora), but compiling from source was simple. In fact, I grabbed the source, built it, and launched it in one line: +现在,让我们在终端中重新感受这个令人惊奇的体验吧。**Nyancat** 包正在很多地方被分发(比如 Arch、Debian、Gentoo、Ubuntu 等等…),不过我的系统(Fedora)没有,但是我们仍然可以很轻松地从源码编译它。事实上,我们只需要一行命令就能做完所有工作: ``` git clone https://github.com/klange/nyancat.git && cd nyancat && make && cd src && ./nyancat ``` -This launched straight into a **nyancat** experience complete with a counter of how long I had been enjoying the **nyancat** magic for. +这直接为我带来了一个 Nyan Cat 体验,甚至还有个计时器来显示我享受 “Nyan Cat 魔法”的时间。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-nyancat-animated.gif) -You can find the source for **nyancat** [on GitHub][3] under an [NCSA open source license][4]. +你可以在 [GitHub][3] 上找到 **nyancat** 的源码,它正以 [NCSA 许可证][4] 开源。 -The command-line version of Nyan Cat used to be [accessible by a public Telnet server][5] (or, for even more pun, with [netcat][6]) so that you didn't even have to install it, but sadly was shut down due to bandwidth limitations. Nevertheless, the [gallery][5] from the old Telnet server running Nyan Cat on a variety of old devices is well-worth checking out, and maybe you'd like to do the community a favor by launching your own public mirror and letting the author know so that they may share it with the public yet again? +命令行版本的 Nyan Cat 可在[这个公共 Telnet 服务器上访问][5](或者 [netcat][6] 也行),所以理论上来说你不必安装它。不过不幸的是,由于带宽限制,该服务器目前已经被关闭了。尽管如此,在各种老设备上连接老 Telnet 服务器上运行 Nyan Cat 的[照片][5]还是值得一看的,说不准你还会萌生搭建一个能让大家连接的公共服务器的想法呢(如果你真的搭建了,请务必告知作者,万一他们可能会向公众分享呢?)。 -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. +你想让我介绍一下你最喜爱的命令行玩具吗?请在原文下留言,作者会考虑介绍的。 -Check out yesterday's toy, [Bring some color to your Linux terminal with lolcat][1], and check back tomorrow for another! +瞧瞧我们昨天介绍的小玩意:[用 lolcat 为你的 Linux 终端增添些许色彩][1]。明天再来看我们的下一篇文章吧! -------------------------------------------------------------------------------- @@ -46,7 +47,7 @@ via: https://opensource.com/article/18/12/linux-toy-nyancat 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zhs852](https://github.com/zhs852) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ea890f4ca5529cc3ac3708b738fcb504f1f3ec22 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 27 Dec 2018 11:22:12 +0800 Subject: [PATCH 0346/4278] Move file to translated --- ...181206 Take a break at the Linux command line with Nyan Cat.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181206 Take a break at the Linux command line with Nyan Cat.md (100%) diff --git a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md similarity index 100% rename from sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md rename to translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md From 66cd09bb26ddefd662d3964e330f6a56651d6ebd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 12:55:34 +0800 Subject: [PATCH 0347/4278] PUB:20181016 Lab 5- File system, Spawn and Shell.md @qhwdw https://linux.cn/article-10389-1.html --- .../20181016 Lab 5- File system, Spawn and Shell.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181016 Lab 5- File system, Spawn and Shell.md (100%) diff --git a/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md b/published/20181016 Lab 5- File system, Spawn and Shell.md similarity index 100% rename from translated/tech/20181016 Lab 5- File system, Spawn and Shell.md rename to published/20181016 Lab 5- File system, Spawn and Shell.md From 7937523908695caa8f093623ea80fb05c6bd98b5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 19:20:08 +0800 Subject: [PATCH 0348/4278] PRF:20181217 Take a swim at your Linux terminal with asciiquarium.md @amwps290 --- ...t your Linux terminal with asciiquarium.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md index 04ba82841c..70e4a17eb7 100644 --- a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md +++ b/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -1,34 +1,35 @@ [#]: collector: "lujun9972" -[#]: translator: " amwps290" -[#]: reviewer: " " +[#]: translator: "amwps290" +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Take a swim at your Linux terminal with asciiquarium" [#]: via: "https://opensource.com/article/18/12/linux-toy-asciiquarium" [#]: author: "Jason Baker https://opensource.com/users/jason-baker" -# 使用 asciiquarium 在你的终端里探索海洋的秘密 +在你的终端里探索海洋的秘密 +======= + +> “亲爱的,当您的命令行变得更湿润的时候会更好。这多亏了 ASCII。” -亲爱的,当您的命令行变得更湿润的时候会更好。这多亏了 ASCII。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-asciiquarium.png?itok=ZhJ9P2Ft) -现在,我们即将数完长达 24 天的 Linux 命令行玩具倒数日历。离今天只剩一周了!如果这是您第一次访问本系列文章,那么您可能会问自己什么是命令行玩具。我们一边走,一边说,但一般来说,这可能是一个游戏,或者可以帮助你在终端玩得开心的任何简单的娱乐活动。 +现在,我们即将数完长达 24 天的 Linux 命令行玩具日历。离今天只剩一周了!如果这是您第一次访问本系列文章,那么您可能会问自己什么是命令行玩具。我们一边走,一边说,但一般来说,这可能是一个游戏,或者可以帮助你在终端玩得开心的任何简单的娱乐活动。 你们其中的一些人可能已经在以前的系列文章中看到了各种各样的命令行玩具。但是,我们希望每个人都能够获得一个新玩具。 -今天的玩具有一点鱼的味道。先和 **asciiquarium** 打个招呼,一个在你终端里海底冒险的玩具。我是在我的 Fedora 仓库里发现 asciiquarium 的,因此安装它非常容易: +今天的玩具有一点鱼的味道。先和 `asciiquarium` 打个招呼,一个在你终端里海底冒险的玩具。我是在我的 Fedora 仓库里发现 `asciiquarium` 的,因此安装它非常容易: ``` $ sudo dnf install asciiquarium ``` -如果您正在运行不同的发行版,那么它也可能已经为您打包。 只需在您的终端中运行 **asciiquarium** 即可感受到蛤蜊的快乐。 该项目也在终端之外进行了“翻译”,所有水族伙伴的屏保都是为非 Linux 操作系统制作的,甚至还有一个 Android 动态壁纸版本。 +如果您正在运行不同的发行版,那么它也可能已经为您打包。 只需在您的终端中运行 `asciiquarium` 即可感受到蛤蜊的快乐。 该项目也在终端之外进行了“翻译”,所有水族伙伴的屏保都是为几个非 Linux 操作系统制作的,甚至还有一个 Android 动态壁纸版本。 -访问 **asciiquarium** [主页][1]了解更多信息或下载 Perl 源代码。 该项目是 GPL 第 2 版许可证下的开源项目。 如果你想更多地了解开源,开放数据和开放科学如何在实际的海洋中发挥作用,请花点时间去了解[海洋健康指数][2]。 +访问 asciiquarium [主页][1]了解更多信息或下载 Perl 源代码。 该项目是 GPL 第 2 版许可证下的开源项目。 如果你想更多地了解开源,开放数据和开放科学如何在实际的海洋中发挥作用,请花点时间去了解[海洋健康指数][2]。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-asciiquarium-animated.gif) - 你觉得我应该介绍一下你最喜欢的命令行玩具吗?时间不多了,但我还是想听听你的建议。请在下面的评论中告诉我,我会查阅的。让我知道你对今天的娱乐有什么看法。 一定要看看昨天的玩具,[安排一次与 Emacs 精神病医生的访问][3],明天再来看另一个玩具! @@ -40,7 +41,7 @@ via: https://opensource.com/article/18/12/linux-toy-asciiquarium 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[amwps290](https://github.com/amwps290) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a28d4e3550a084c4d1a8c29b006302854462900c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 19:21:24 +0800 Subject: [PATCH 0349/4278] PUB:20181217 Take a swim at your Linux terminal with asciiquarium.md @amwps290 https://linux.cn/article-10390-1.html --- ...17 Take a swim at your Linux terminal with asciiquarium.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181217 Take a swim at your Linux terminal with asciiquarium.md (97%) diff --git a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/published/20181217 Take a swim at your Linux terminal with asciiquarium.md similarity index 97% rename from translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md rename to published/20181217 Take a swim at your Linux terminal with asciiquarium.md index 70e4a17eb7..279bc84b54 100644 --- a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md +++ b/published/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "amwps290" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10390-1.html" [#]: subject: "Take a swim at your Linux terminal with asciiquarium" [#]: via: "https://opensource.com/article/18/12/linux-toy-asciiquarium" [#]: author: "Jason Baker https://opensource.com/users/jason-baker" From 3ba36ccdcd007d4f0d8d028beeb0e6c9ae28f12f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 19:47:01 +0800 Subject: [PATCH 0350/4278] PRF:20180508 Person with diabetes finds open source and builds her own medical device.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Valoniakim 翻译的很棒 --- ...ource and builds her own medical device.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md b/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md index 1a965cdf72..c874777c07 100644 --- a/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md +++ b/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md @@ -1,21 +1,22 @@ 糖尿病患者们是怎样使用开源造出自己的医疗设备的 ====== +> Red Hat 的 2018 女性开源社区奖获得者 Dana Lewis 的故事。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/health_heartbeat.png?itok=P-GXea-p) -Dana Lewis 被评选为开源社区 2018 年度最佳女性!下面是开源怎样改善了她的健康的故事。 +Dana Lewis 被评选为[开源社区 2018 年度最佳女性][1]!下面是开源怎样改善了她的健康的故事。 -Dana 患有1型糖尿病,但当时市面上流通的药品和医疗设备都对她无效。 -她用来管理血糖的动态血糖监测报警器的声音太小了,根本叫不醒熟睡的她,产品这样的设计无法保证她每天睡眠时间的生命安全。 +Dana 患有 I 型糖尿病,但当时市面上流通的药品和医疗设备都对她无效。她用来管理血糖的动态血糖监测(CGM)报警器的声音太小了,根本叫不醒熟睡的她,产品这样的设计无法保证她每天睡眠时间的生命安全。 “我和生产厂家见了一面商议提出意见,厂家的回复是‘我们产品的音量已经足够大了,很少有人叫不醒’,我被告知‘这不是普遍问题,我们正在改进,请期待我们的新产品。’听到这些时我真的很挫败,但我从没想象过我能做出什么改变,毕竟那是通过了 FDA 标准的医疗设备,不是我们能随意改变的。” -面临着这些阻碍,Dana 想着如果她能把自己的数据从设备里导出,就可以设置手机闹铃来叫醒自己。在2013年末,她看到的一条推特解决了她的疑问。那条推特的作者是一位糖尿病患儿的家长,他把动态血糖监测仪进行了逆向工程,这样就可以导出孩子的血糖数据进行远程监控了。 +面临着这些阻碍,Dana 想着如果她能把自己的数据从设备里导出,就可以设置手机闹铃来叫醒自己。在 2013 年末,她看到的一条推特解决了她的疑问。那条推特的作者是一位糖尿病患儿的家长,他把动态血糖监测仪进行了逆向工程,这样就可以导出孩子的血糖数据进行远程监控了。 她意识到如果对方愿意把过程分享给她,她也可以用那些代码做一个自己的响亮的血糖监测仪了。 “我并不知道向别人要源代码是件稀松平常的事,那是我第一次接触开源。” -那个系统演化成一个响亮闹钟的代码,她也可以把代码在网页上分享给别人。和她的丈夫 Scott Leibrand 一起,她反复向闹铃添加属性,最终合成了一个算法,这个算法不仅能监测实时血糖水平,还能主动预测未来血糖波动。 +那个系统演化成一个响亮闹钟的代码,她也可以把代码在网页上分享给别人。和她的丈夫 Scott Leibrand 一起,她逐步向闹铃添加属性,最终形成了一个算法,这个算法不仅能监测实时血糖水平,还能主动预测未来血糖波动。 随着 Dana 与开源糖尿病患者社区的接触越来越深,她认识了 Ben West,他花了很多年才研究出与 Dana 使用的胰岛素泵沟通数据的方法,与血糖监测仪不同,胰岛素泵不是简单的报告血糖,它是个单独的设备,要按人体需要持续推注胰岛素,比血糖监测仪要复杂得多。 @@ -27,15 +28,15 @@ Dana 患有1型糖尿病,但当时市面上流通的药品和医疗设备都 “正因为我们使用的是开源软件,在做出这个系统之后我们就把成果开源化了,这样可以造福更多的人。”开源人工胰腺系统 (OpenAPS) 由此诞生。 -OpenAPS 社区已经拥有超过600名用户,大家都提供了各种各样的自制“闭路”系统代码。OpenAPS 贡献者们以 #WeAreNotWaiting 话题团结一致,以表达患者群体不该干等着医疗保健工厂制造出真正有效便捷产品的理念。 +OpenAPS 社区已经拥有超过 600 名用户,大家都提供了各种各样的自制“闭路”系统代码。OpenAPS 贡献者们聚集到了 #WeAreNotWaiting 话题之下,以表达患者群体不该干等着医疗保健工厂制造出真正有效便捷产品的理念。 “你可以选择等待未来的商业解决方案,这无可厚非,选择等待是你的自由。等待可以是一种选择,但不能是无法改变的现状。对我来说,开源在医疗保健方面做出的这个举动让等待变成了一种选择。你可以选择不自行解决,你可以选择等待商业解决方案,但如果你不想等了,你无需再等。现在你有很多选择,开源社区的人们已经解决了很多问题。” -OpenAPS 社区由糖尿病患者,患者家属,还有想要合理利用这项技术的人们。在社区的帮助下,Dana 学会了很多种贡献开源项目的方式。她发现许多从 Facebook 或 [Gitter][2] 上过来的非技术贡献者也对 OpenAPS 做出了很大贡献。 +OpenAPS 社区由糖尿病患者、患者家属,还有想要合理利用这项技术的人们。在社区的帮助下,Dana 学会了很多种贡献开源项目的方式。她发现许多从 Facebook 或 [Gitter][2] 上过来的非技术贡献者也对 OpenAPS 做出了很大贡献。 “贡献有很多方式,我们要认识到各种方式的贡献都是平等的。它们一般涉及不同的兴趣领域和技能组合,只有把这些综合起来,才能做成社区的项目。” -她亲身经历过,所以知道自己的贡献不被社区的其他成员认可是怎样难过的感受。对于人们习惯把女性的贡献打折的这一现象,她也不回避。在她的 [2014 年博客][3] 和 [反思][4] 文章中她初次写道在入围开源年度最佳人物时所遭受到的区别待遇,这些待遇让她意识到身为女性的不同。 +她亲身经历过,所以知道自己的贡献不被社区的其他成员认可是怎样难过的感受。对于人们习惯把女性的贡献打折的这一现象,她也不回避。在她的 [2014 年博客][3] 和 [反思][4] 文章中她初次写到在入围开源年度最佳人物时所遭受到的区别待遇,这些待遇让她意识到身为女性的不同。 在她最初的博客中,她写道了自己和丈夫 Scott 同为开源社区成员,遭受到的区别待遇。他们都注意到,Dana 总是被提出一些细枝末节的要求,但 Scott 就不会。而 Scott 总被问道一些技术性问题,即使他向他们推荐 Dana,人们也更倾向于问身为男性的 Scott。大家都或多或少经历过这些行为,Dana 的博文在社区里引起了广泛的讨论。 @@ -45,13 +46,13 @@ OpenAPS 社区由糖尿病患者,患者家属,还有想要合理利用这项 “我想如果我就放弃努力了,可能开源世界里糖尿病患者们的现状会有很大不同。我知道别人不幸的遭遇,他们在开源社区中感受不到认同感和自身价值,最终离开了开源。我希望我们可以继续这种讨论,大家都能意识到如果我们不故意打击贡献者,我们可以变得更加温暖,成员们也能感受到认同感,大家的付出也能得到相应的认可。 -OpenAPS 社区的交流和分享给我们提供了一个很好的例子,它说明非技术性的贡献者对于整个社区的成功都是至关重要的。Dana 在现实社会中的关系和交流经历对她为开源社区做出的宣传有着很大的贡献。她为社区在 [DIYPS blog][5] 上写了很多篇文章,她还在 [TEDx Talk][6] 做过一场演讲, 在 [开源大会 (OSCON)][7] 上也演讲过很多次,诸如此类的还有很多。 +OpenAPS 社区的交流和分享给我们提供了一个很好的例子,它说明非技术性的贡献者对于整个社区的成功都是至关重要的。Dana 在现实社会中的关系和交流经历对她为开源社区做出的宣传有着很大的贡献。她为社区在 [DIYPS 博客][5] 上写了很多篇文章,她还在 [TEDx Talk][6] 做过一场演讲, 在 [开源大会 (OSCON)][7] 上也演讲过很多次,诸如此类的还有很多。 “不是每个项目都像 OpenAPS 一样,对患者有那么大的影响,甚至成为患者中间的主流项目。糖尿病社区在项目的沟通中真的做了很多贡献,引来了很多糖尿病患者,也让需要帮助的人们知道了我们的存在。” Dana 现在的目标是帮助其他疾病的患者社区创建项目。她尤其想要把社区成员们学到的工具和技术和其他的患者社区分享,特别是那些想要把项目进一步提升,进行深入研究,或者想和公司合作的社区。 -“听说很多参与项目的患者都听过这样的话,‘你应该申请个专利;你应该拿它开个公司;你应该成立个非营利组织。’但这些都是大事,它们太耗时间了,不仅占据你的工作时间,甚至强行改变你的专业领域。我这样的人并不想做那样的事,我们更倾向于把精力放在壮大其他项目上,以此帮助更多的人。” +“我听说很多参与项目的患者都听过这样的话,‘你应该申请个专利;你应该拿它开个公司;你应该成立个非营利组织。’但这些都是大事,它们太耗时间了,不仅占据你的工作时间,甚至强行改变你的专业领域。我这样的人并不想做那样的事,我们更倾向于把精力放在壮大其他项目上,以此帮助更多的人。” 在此之后,她开始寻找其他不那么占用时间的任务,比如给小孩们写一本书。Dana 在 2017 年进行了这项挑战,她写了本书给侄子侄女,讲解他们婶婶的糖尿病设备是怎样工作的。在她侄女问她“胳膊上的东西是什么”(那是她的血糖监测仪)时,她意识到她不知道怎么和一个小孩子解释糖尿病患者是什么,所以写了[《卡罗琳的机器人亲戚》][8]这本书。 @@ -70,7 +71,7 @@ via: https://opensource.com/article/18/5/dana-lewis-women-open-source-community- 作者:[Taylor Greene][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[Valoniakim](https://github.com/Valoniakim) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fb2b0935bbfbb0860f151766c63662185f7ee1ea Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 19:47:25 +0800 Subject: [PATCH 0351/4278] PUB:20180508 Person with diabetes finds open source and builds her own medical device.md @Valoniakim https://linux.cn/article-10391-1.html --- ...iabetes finds open source and builds her own medical device.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180508 Person with diabetes finds open source and builds her own medical device.md (100%) diff --git a/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md b/published/20180508 Person with diabetes finds open source and builds her own medical device.md similarity index 100% rename from translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md rename to published/20180508 Person with diabetes finds open source and builds her own medical device.md From 2502300609c5e1e44ad9134b318cc4bd27e073ef Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 28 Dec 2018 09:03:24 +0800 Subject: [PATCH 0352/4278] translated --- ...sten to the radio at the Linux terminal.md | 60 ------------------- ...sten to the radio at the Linux terminal.md | 60 +++++++++++++++++++ 2 files changed, 60 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20181221 Listen to the radio at the Linux terminal.md create mode 100644 translated/tech/20181221 Listen to the radio at the Linux terminal.md diff --git a/sources/tech/20181221 Listen to the radio at the Linux terminal.md b/sources/tech/20181221 Listen to the radio at the Linux terminal.md deleted file mode 100644 index 1d4b241ccb..0000000000 --- a/sources/tech/20181221 Listen to the radio at the Linux terminal.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Listen to the radio at the Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-mplayer) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Listen to the radio at the Linux terminal -====== -MPlayer is an extremely versatile open source media player that can be surprisingly useful at the Linux command line. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-mplayer.png?itok=6iTm3Xi7) - -You've found your way to our 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. 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. - -There are many ways to listen to music at the command line; if you've got media stored locally, **cmus** is a great option, but there are [plenty of others][1] as well. - -Lots of times when I'm at the terminal, though, I'd really rather just zone out and not pay close attention to picking each song, and let someone else do the work. While I've got plenty of playlists that work for just such a purpose, after a while, even though go stale, and I'll switch over to an internet radio station. - -Today's toy, MPlayer, is a versatile multimedia player that will support just about any media format you throw at it. If MPlayer is not already installed, you can probably find it packaged for your distribution. On Fedora, I found it in [RPM Fusion][2] (be aware that this is not an "official" repository for Fedora, so exercise caution): - -``` -$ sudo dnf install mplayer -``` - -MPlayer has a slew of command-line options to set depending on your situation. I wanted to listen to the local college radio station here in Raleigh ([88.1 WKNC,][3] they're pretty good!), and so after grabbing the streaming URL from their website, all that took to get my radio up and running, no GUI or web player needed, was: - -``` -$ mplayer -nocache -afm ffmpeg http://wknc.sma.ncsu.edu:8000/wknchd1.mp3 -``` - -MPlayer is open source under the GPLv3, and you can find out more about the project and download source code from the project's [website][4]. - -As I mentioned in yesterday's article, I'm trying to use a screenshot of each toy as the lead image for each article, but as we moved into the world of audio, I had to fudge it a little. So today's image was created from a public domain icon of a radio tower using **img2txt** , which is provided by the **libcaca** package. - -Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, 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, [Let you Linux terminal speak its mind][5], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-mplayer - -作者:[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/life/16/8/3-command-line-music-players-linux -[2]: https://rpmfusion.org/ -[3]: https://wknc.org/index.php -[4]: http://www.mplayerhq.hu/ -[5]: https://opensource.com/article/18/12/linux-toy-espeak diff --git a/translated/tech/20181221 Listen to the radio at the Linux terminal.md b/translated/tech/20181221 Listen to the radio at the Linux terminal.md new file mode 100644 index 0000000000..9cf4534200 --- /dev/null +++ b/translated/tech/20181221 Listen to the radio at the Linux terminal.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Listen to the radio at the Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-mplayer) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端收听广播 +====== +MPlayer 是一个多功能的开源媒体播放器,它在 Linux 命令行中非常有用。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-mplayer.png?itok=6iTm3Xi7) + +你已经看到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。它可能是一个游戏或任何简单的消遣,可以帮助你在终端玩得开心。 + +你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +在命令行中有很多方法可以听音乐。如果你有本地存储的媒体,**cmus** 是一个很好的选择,但还有[很多其他选择][1]。 + +不过,很多时候,当我在终端的时候,我会走神并且不会注意挑选每首歌,并让其他的来做。虽然为了这个我有很多播放列表,但过了一段时间,即使过时,我也会切换到互联网电台。 + +今天的玩具,MPlayer,是一个多功能的多媒体播放器,几乎可以支持任何你给它的媒体格式。如果尚未安装 MPlayer,你可能会发现它已在你的发行版中打包。在 Fedora 中,我在 [RPM Fusion][2] 中找到了它(请注意,这不是 Fedora 的“官方”仓库,因此请谨慎操作): + +``` +$ sudo dnf install mplayer +``` + +MPlayer 有一系列命令行选项可根据你的具体情况进行设置。我想听 Raleigh 当地的大学广播电台([88.1 WKN][3],这个很棒!),在它们的网站得到流媒体网址之后,像这样就可以让收音机运行了,不需要 GUI 或 Web 播放器: + +``` +$ mplayer -nocache -afm ffmpeg http://wknc.sma.ncsu.edu:8000/wknchd1.mp3 +``` + +MPlayer 是 GPLv3 许可证下的开源软件,你可以从项目的[网站][4]中找到更多关于项目的信息并下载源代码。 + +正如我在昨天的文章中提到的,我试图使用每个玩具的截图作为每篇文章的主图,但是当进入音频世界时,我不得不稍微改改。所以今天的图像是由 **libcaca** 包中的 **img2txt** 绘制的来自公共域的无线电塔图标。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上是为这个系列剩余的玩具设置的,但我们仍然很想在新的一年里推出一些很酷的命令行玩具。评论告诉我,我会查看的。如果还有空位置,我会考虑介绍它的。并让我知道你对今天的玩具有何看法。 + +一定要看看昨天的玩具,[让你的 Linux 终端说出来][5],明天记得回来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-mplayer + +作者:[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/life/16/8/3-command-line-music-players-linux +[2]: https://rpmfusion.org/ +[3]: https://wknc.org/index.php +[4]: http://www.mplayerhq.hu/ +[5]: https://opensource.com/article/18/12/linux-toy-espeak \ No newline at end of file From 690fb205677ee6a6caf4cd309b7ec4bfc94ce595 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 28 Dec 2018 09:09:55 +0800 Subject: [PATCH 0353/4278] translating --- ...1217 4 cool new projects to try in COPR for December 2018.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md index 9dc8b3390f..0564320363 100644 --- a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md +++ b/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5272b3fc584b12d41606f169e05e9f243888475c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 28 Dec 2018 23:48:04 +0800 Subject: [PATCH 0354/4278] PRF:20181214 How To Install Rust Programming Language In Linux.md @geekpi --- ...tall Rust Programming Language In Linux.md | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md index a2fc9f1382..83346585bf 100644 --- a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md +++ b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Install Rust Programming Language In Linux) @@ -10,9 +10,7 @@ 如何在 Linux 中安装 Rust 编程语言 ====== -Rust 通常被称为 rust-lang。 - -Rust 是一个由 Mozilla Research 赞助的通用、多范式、现代、跨平台和开源系统编程语言。 +Rust 通常被称为 rust-lang。Rust 是一个由 Mozilla Research 赞助的通用的、多范式、现代的、跨平台和开源系统编程语言。 它旨在实现安全性、速度和并发性等目标。 @@ -30,28 +28,28 @@ info: downloading installer Welcome to Rust! -This will download and install the official compiler for the Rust programming +This will download and install the official compiler for the Rust programming language, and its package manager, Cargo. -It will add the cargo, rustc, rustup and other commands to Cargo's bin +It will add the cargo, rustc, rustup and other commands to Cargo's bin directory, located at: - /home/daygeek/.cargo/bin + /home/daygeek/.cargo/bin This path will then be added to your PATH environment variable by modifying the profile files located at: - /home/daygeek/.profile - /home/daygeek/.bash_profile + /home/daygeek/.profile + /home/daygeek/.bash_profile You can uninstall at any time with rustup self uninstall and these changes will be reverted. Current installation options: - default host triple: x86_64-unknown-linux-gnu - default toolchain: stable - modify PATH variable: yes + default host triple: x86_64-unknown-linux-gnu + default toolchain: stable + modify PATH variable: yes 1) Proceed with installation (default) 2) Customize installation @@ -61,25 +59,25 @@ Current installation options: info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2018-12-06, rust version 1.31.0 (abe02cefd 2018-12-04) info: downloading component 'rustc' - 77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s + 77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'rust-std' - 54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s + 54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'cargo' - 4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s + 4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'rust-docs' - 8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s + 8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s info: installing component 'rustc' info: installing component 'rust-std' info: installing component 'cargo' info: installing component 'rust-docs' info: default toolchain set to 'stable' - stable installed - rustc 1.31.0 (abe02cefd 2018-12-04) + stable installed - rustc 1.31.0 (abe02cefd 2018-12-04) Rust is installed now. Great! -To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH +To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH environment variable. Next time you log in this will be done automatically. To configure your current shell run source $HOME/.cargo/env @@ -150,7 +148,7 @@ $ rustup update info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: checking for self-updates - stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04) + stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04) ``` 运行以下命令从系统中删除 Rust 包。 @@ -164,6 +162,7 @@ $ rustup self uninstall ``` $ rm -fr ~/projects ``` + -------------------------------------------------------------------------------- via: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ @@ -171,9 +170,9 @@ via: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ 作者:[Prakash Subramanian][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/prakash/ -[b]: https://github.com/lujun9972 \ No newline at end of file +[b]: https://github.com/lujun9972 From 2106ca916726019d2f9361cfe8bea927140cff21 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 28 Dec 2018 23:48:39 +0800 Subject: [PATCH 0355/4278] PUB:20181214 How To Install Rust Programming Language In Linux.md @geekpi https://linux.cn/article-10392-1.html --- ...81214 How To Install Rust Programming Language In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181214 How To Install Rust Programming Language In Linux.md (98%) diff --git a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md b/published/20181214 How To Install Rust Programming Language In Linux.md similarity index 98% rename from translated/tech/20181214 How To Install Rust Programming Language In Linux.md rename to published/20181214 How To Install Rust Programming Language In Linux.md index 83346585bf..b8ba0c1d38 100644 --- a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md +++ b/published/20181214 How To Install Rust Programming Language In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10392-1.html) [#]: subject: (How To Install Rust Programming Language In Linux) [#]: via: (https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) From e1c9b5701cdfd175ede6c2bec58aab712901ea32 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Fri, 28 Dec 2018 17:00:20 +0000 Subject: [PATCH 0356/4278] Revert "Update 20171007 The Most Important Database You-ve Never Heard of.md" This reverts commit 1069f1583177821b6e265713744368a0a485a556. --- ...0171007 The Most Important Database You-ve Never Heard of.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/talk/20171007 The Most Important Database You-ve Never Heard of.md b/sources/talk/20171007 The Most Important Database You-ve Never Heard of.md index cebfa1a959..f429aba373 100644 --- a/sources/talk/20171007 The Most Important Database You-ve Never Heard of.md +++ b/sources/talk/20171007 The Most Important Database You-ve Never Heard of.md @@ -1,5 +1,3 @@ -zs19940317翻译中 - The Most Important Database You've Never Heard of ====== In 1962, JFK challenged Americans to send a man to the moon by the end of the decade, inspiring a heroic engineering effort that culminated in Neil Armstrong’s first steps on the lunar surface. Many of the fruits of this engineering effort were highly visible and sexy—there were new spacecraft, new spacesuits, and moon buggies. But the Apollo Program was so staggeringly complex that new technologies had to be invented even to do the mundane things. One of these technologies was IBM’s Information Management System (IMS). From 20abb626839e944e7ee3fa68c0fc1c701113ced3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 29 Dec 2018 09:15:31 +0800 Subject: [PATCH 0357/4278] translated --- sources/tech/20181222 A Tale of HTTP-2.md | 75 -------------------- translated/tech/20181222 A Tale of HTTP-2.md | 75 ++++++++++++++++++++ 2 files changed, 75 insertions(+), 75 deletions(-) delete mode 100644 sources/tech/20181222 A Tale of HTTP-2.md create mode 100644 translated/tech/20181222 A Tale of HTTP-2.md diff --git a/sources/tech/20181222 A Tale of HTTP-2.md b/sources/tech/20181222 A Tale of HTTP-2.md deleted file mode 100644 index 897fd83fc5..0000000000 --- a/sources/tech/20181222 A Tale of HTTP-2.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A Tale of HTTP/2) -[#]: via: (https://veronneau.org/a-tale-of-http2.html) -[#]: author: (Louis-Philippe Véronneau https://veronneau.org/) - -A Tale of HTTP/2 -====== - -Around a month ago, someone mentioned the existence of [HTTP/2][1] in an IRC channel I lurk in. For some reason, I had never heard of it and some of the features of this new protocol (like mutiplexing requests without having to open multiple TCP connections) seemed cool. - -To be honest, I had just finished re-writing the Puppet code that manages our backup procedures and enabling HTTP/2 seemed like a productive way to procrastinate before moving on to an another large project. How hard could this be? - -Turns out it took me around 25 hours of work... Sit back and put on comfortable slippers, for this is a tale of HTTP/2! - -[![The Yule Log][2]][3] - -### Cursed Be the HTTP/1.1 - -When I first looked up how to enable HTTP/2 on Apache it seemed a pretty simple task. The documentation mentioned loading the `http2` module and making sure to prioritise the new protocol via a configuration file like this one: - -``` -Protocols h2 h2c http/1.1 - -H2Push on -H2PushPriority core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated after -H2PushPriority text/css before -H2PushPriority image/jpeg after 32 -H2PushPriority image/png after 32 -H2PushPriority application/javascript interleaved -``` - -This would of course have been too easy. Even if everything in Apache was set up properly, websites kept being served as HTTP/1.1. I was obviously doing something right though, since my websites were now sending a new HTTP header: `Upgrade: h2, h2c`. - -After wasting a good deal of time debugging TLS ciphers (HTTP/2 is [incompatible with TLS 1.1][4]), I finally found out the problem was that we weren't using the right multi-processing module for Apache. - -Turns out Apache won't let you serve HTTP/2 while using `mpm_prefork` (the default MPM), as it is not supported by `mod_http2`. Even though there are two other MPM you can use with Apache, only `mpm_prefork` supports `mod_php`. Suddenly, adding support for HTTP/2 meant switching all our webapps built in PHP to PHP-FPM... - -### Down the Rabbit Hole - -![A clip from Alice in Wonderlands][5] - -For the longest time, a close friend has been trying to convince me of the virtues of [PHP-FPM][6]. As great as it looked on paper, I never really did anything about it. It seemed so ... complicated. Regular ol' `mod_php` did the trick just fine and other things required my attention. - -This whole HTTP/2 thing turned out to be the perfect excuse for me to dive into it after all. Once I understood how FPM pools worked, it was actually pretty easy to set up. Since I had to rewrite the Puppet profiles we're using to deploy websites, also I took that opportunity to harden a bunch of things left and right. - -PHP-FPM let's you run websites under different Unix users for added separation. On top of that, I decided it was time for PHP code on our servers to be ran in read-only mode and had to tweak a bunch of things for our Wordpress, Nextcloud, KanBoard and Drupal instances to stop complaining about it. - -After too much time passed automating tasks in Puppet, I finally was able to turn off `mod_php` and `mpm_prefork` everywhere and to enable `mpm_event` and `mod_http2`. The speed bonus offered by PHP-FPM and HTTP/2 is nice, but more than anything I'm happy this whole ordeal forced me to harden the way our Apache servers deal with PHP. - -![Victory!][7] - --------------------------------------------------------------------------------- - -via: https://veronneau.org/a-tale-of-http2.html - -作者:[Louis-Philippe Véronneau][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://veronneau.org/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/HTTP/2 -[2]: https://veronneau.org/media/blog/2018-12-22/yule_log.jpg (The Yule Log) -[3]: https://commons.wikimedia.org/wiki/File:The_Yule_Log.jpg -[4]: https://http2.github.io/http2-spec/#TLSUsage -[5]: https://veronneau.org/media/blog/2018-12-22/mod_php.gif (A clip from Alice in Wonderlands) -[6]: https://wiki.apache.org/httpd/PHP-FPM -[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) diff --git a/translated/tech/20181222 A Tale of HTTP-2.md b/translated/tech/20181222 A Tale of HTTP-2.md new file mode 100644 index 0000000000..9fcaddfad9 --- /dev/null +++ b/translated/tech/20181222 A Tale of HTTP-2.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Tale of HTTP/2) +[#]: via: (https://veronneau.org/a-tale-of-http2.html) +[#]: author: (Louis-Philippe Véronneau https://veronneau.org/) + +一个 HTTP/2 的故事 +====== + +大约一个月前,有人在我所在的 IRC 频道中提到了 [HTTP/2][1]。由于某种原因,我从未听说过它,而且新协议的一些功能(比如无需打开多个 TCP 连接就能复用请求)似乎很酷。 + +说实话,我刚刚重写了管理我们备份程序的 Puppet 代码,启用 HTTP/2 似乎是一种转向另一个大型项目之前有效的拖延方式。这有多难? + +结果我花了大约 25 个小时来完成。坐下来穿上舒适的拖鞋,因为这是一个 HTTP/2 的故事! + +[![The Yule Log][2]][3] + +### 被诅咒的 HTTP/1.1 + +当我第一次看到如何在 Apache 上启用 HTTP/2 时,这似乎是一项非常简单的任务。文档提到加载 `http2` 模块并通过如下配置文件确保新协议优先: + +``` +Protocols h2 h2c http/1.1 + +H2Push on +H2PushPriority core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated after +H2PushPriority text/css before +H2PushPriority image/jpeg after 32 +H2PushPriority image/png after 32 +H2PushPriority application/javascript interleaved +``` + +这当然很容易。即使 Apache 中的所有内容都已正确设置,网站仍然可以使用 HTTP/1.1。不过,显然我做得没错,因为我的网站现在发送了一个新的 HTTP 头:`Upgrade: h2, h2c`。 + +在浪费了大量时间调试 TLS 密钥(HTTP/2 [与 TLS 1.1 不兼容][4])之后,我终于发现问题是没有使用正确的 Apache 多进程处理模块。 + +事实证明,在使用 `mpm_prefork`(默认 MPM)时,Apache 不会使用 HTTP/2,因为 `mod_http2` 不支持它。尽管 Apache 还有两个其他的 MPM,但只有 `mpm_prefork` 支持 `mod_php`。突然之间,添加对 HTTP/2 的支持意味着我们将要把所有的 PHP 网站切换到 PHP-FPM。 + +### 掉进兔子洞 + +![A clip from Alice in Wonderlands][5] + +在很长一段时间里,一位好友一直试图让我相信 [PHP-FPM][6] 的优点。虽然纸上看起来很好, 但我从来没有真正试过。它看起来很复杂。常规的 `mod_php` 做得很好,还有其他事情需要我注意。 + +事实上,这次的 HTTP/2 事件是让我钻研它的一个契机。在我理解了 FPM 池的工作原理后,它实际上很容易设置。由于我不得不重写我们用于部署网站的 Puppet 配置文件,我也借此机会巩固了一堆东西。 + +PHP-FPM 允许你在不同的 Unix 用户下运行网站来增加隔离性。最重要的是,我决定是时候让我们服务器上的 PHP 代码以只读模式运行,并且不得不为我们的 Wordpress、Nextcloud、KanBoard 和 Drupal 实例调整一些东西来减少报错。 + +过了很长时间通过 Puppet 的自动任务后,我终于能够在任何地方关闭 `mod_php` 和 `mpm_prefork` 并启用 `mpm_event` 和 `mod_http2`。PHP-FPM 和 HTTP/2 带来的速度提升不错,但更让我感到高兴的是这次磨练增强了我们的 Apache 处理 PHP 的能力。 + +![Victory!][7] + +-------------------------------------------------------------------------------- + +via: https://veronneau.org/a-tale-of-http2.html + +作者:[Louis-Philippe Véronneau][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://veronneau.org/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/HTTP/2 +[2]: https://veronneau.org/media/blog/2018-12-22/yule_log.jpg (The Yule Log) +[3]: https://commons.wikimedia.org/wiki/File:The_Yule_Log.jpg +[4]: https://http2.github.io/http2-spec/#TLSUsage +[5]: https://veronneau.org/media/blog/2018-12-22/mod_php.gif (A clip from Alice in Wonderlands) +[6]: https://wiki.apache.org/httpd/PHP-FPM +[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) \ No newline at end of file From dae9dd71ed6a29d87ce13b6562dbc4cfcd436cbc Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 29 Dec 2018 09:35:14 +0800 Subject: [PATCH 0358/4278] translating --- sources/tech/20181217 Working with tarballs on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181217 Working with tarballs on Linux.md b/sources/tech/20181217 Working with tarballs on Linux.md index 29d7b6002f..2c95f1038f 100644 --- a/sources/tech/20181217 Working with tarballs on Linux.md +++ b/sources/tech/20181217 Working with tarballs on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3f166ef001f9f6f533a77d659caec64dce028985 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 29 Dec 2018 18:00:19 +0800 Subject: [PATCH 0359/4278] Translating --- ...81222 Top 11 best Image Viewer for Ubuntu and other Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md index 5aea9702e7..071ffa9ab3 100644 --- a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md +++ b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3912dc35b59ba84b87e687765d3e64427911385b Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 29 Dec 2018 20:42:27 +0800 Subject: [PATCH 0360/4278] Translating by MjSeven --- sources/tech/20171227 YAML- probably not so great after all.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20171227 YAML- probably not so great after all.md b/sources/tech/20171227 YAML- probably not so great after all.md index ed853ca697..adeab60bd2 100644 --- a/sources/tech/20171227 YAML- probably not so great after all.md +++ b/sources/tech/20171227 YAML- probably not so great after all.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From aae8930b83a20ad2a99e270c8777dce34a414a04 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Dec 2018 21:17:50 +0800 Subject: [PATCH 0361/4278] PRF:20181221 Listen to the radio at the Linux terminal.md @geekpi --- ...21 Listen to the radio at the Linux terminal.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/translated/tech/20181221 Listen to the radio at the Linux terminal.md b/translated/tech/20181221 Listen to the radio at the Linux terminal.md index 9cf4534200..ffc4e4357e 100644 --- a/translated/tech/20181221 Listen to the radio at the Linux terminal.md +++ b/translated/tech/20181221 Listen to the radio at the Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Listen to the radio at the Linux terminal) @@ -9,14 +9,16 @@ 在 Linux 终端收听广播 ====== -MPlayer 是一个多功能的开源媒体播放器,它在 Linux 命令行中非常有用。 + +> MPlayer 是一个多功能的开源媒体播放器,它在 Linux 命令行中非常有用。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-mplayer.png?itok=6iTm3Xi7) 你已经看到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。它可能是一个游戏或任何简单的消遣,可以帮助你在终端玩得开心。 -你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 +你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新玩具。 -在命令行中有很多方法可以听音乐。如果你有本地存储的媒体,**cmus** 是一个很好的选择,但还有[很多其他选择][1]。 +在命令行中有很多方法可以听音乐。如果你有本地存储的媒体,`cmus` 是一个很好的选择,但还有[很多其他选择][1]。 不过,很多时候,当我在终端的时候,我会走神并且不会注意挑选每首歌,并让其他的来做。虽然为了这个我有很多播放列表,但过了一段时间,即使过时,我也会切换到互联网电台。 @@ -47,7 +49,7 @@ via: https://opensource.com/article/18/12/linux-toy-mplayer 作者:[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/) 荣誉推出 @@ -57,4 +59,4 @@ via: https://opensource.com/article/18/12/linux-toy-mplayer [2]: https://rpmfusion.org/ [3]: https://wknc.org/index.php [4]: http://www.mplayerhq.hu/ -[5]: https://opensource.com/article/18/12/linux-toy-espeak \ No newline at end of file +[5]: https://opensource.com/article/18/12/linux-toy-espeak From 93ccb28cc01eda7fe88bc9cc5c806d9cdd113dd9 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 29 Dec 2018 21:18:28 +0800 Subject: [PATCH 0362/4278] Translated --- ...Image Viewer for Ubuntu and other Linux.md | 274 ++++++++---------- 1 file changed, 128 insertions(+), 146 deletions(-) diff --git a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md index 071ffa9ab3..3125ef4db3 100644 --- a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md +++ b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -7,303 +7,285 @@ [#]: via: (https://itsfoss.com/image-viewers-linux/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Top 11 best Image Viewer for Ubuntu and other Linux +Linux 下最棒的 11 个图片查看器 ====== -It is probably a good idea to stick with the default system image viewer unless you want a specific feature (that’s missing) or if you crave for better user experience. +如果不是因为系统自带的图片查看器没有你想要的功能,或者你想要更棒的体验,你大概不会想切换到其它图片查看器吧。 -However, if you like to experiment, you may try out different image viewers. You could end up loving the new user experience of viewing the images or get hooked on to the extra features offered. +不过,如果你喜欢折腾,你可能就会想用不同的图片查看器了吧。我猜最终你会被新图片查看器的全新用户体验或特色功能所吸引的。 -In this article, we have mentioned every kind of image viewers ranging from the simplest to the most advanced tool available for Ubuntu or any other Linux distro. +在本篇文章中,无论是简单的还是复杂的、无论是为 Ubuntu 准备的还是其它 Linux 发行版准备的,我们都有提到。 -### Best Image Viewers for Linux +### Linux 下最棒的图片查看器 -![Best image viewers for Ubuntu and other Linux distributions][1] +![Ubuntu 或其它 Linux 发行版适用的最棒的图片查看器][1] -**Note:** You should be able to find these image viewers listed in your software center or AppCenter. If you don’t find it there, we’ve mentioned the instructions for manual installation as well. +**注意:** 在准备安装一个图片查看器时,请前往您系统中预先安装的软件商店中查找。如果您没有任何软件商店或无法在软件商店中找到它,请手动执行我们给出的命令。 #### 1. Nomacs -![nomacs image viewer][2] +![Nomacs 图片查看器][2] -**What’s good about it?** +**它有什么特点?** - * Simple & Fast UI - * Image adjustment tools (color & size) - * Geolocation of the image - * Metadata information panel - * LAN Synchronization - * Fullscreen mode + * 轻快 + * 内建图像调整工具(可以调整色彩和大小) + * 拍摄位置信息 + * 元数据调节器 + * 局域网同步 + * 全屏模式 +Nomacs 是一款自由软件。虽然没有什么出众的功能,但是它的兼容性还不错,可以支持许多常见格式。 +它的界面超级简单,但是提供了简单的图片编辑功能(可以调整色彩、亮度、大小)。除此之外,它还支持全屏模式、元数据调整等功能。 -A free and open source image viewer that does not come baked with any fancy features. However, Nomacs does support most of the common image file formats if you want to use it. +**我该如何安装它?** -The user interface is very simple but it does offer some essential features for image adjustment (color, brightness, resize, crop, & cut). In addition to that, it also supports fullscreen mode, histogram, and a lot of different panels that you can toggle for metadata, edit history, and more such information. - -**How do I install it?** - -You can find it listed in the software center/AppCenter for easy installation. If you want to install it via terminal, you can take a look at their [GitHub page][3] or type in the command below: +简单起见,你可以在各种软件中心中安装它。如果你想通过终端安装它,请参见它的 [GitHub 界面][3] 。或者,在使用 APT 包管理的系统中使用如下命令安装: ``` sudo apt install nomacs ``` -#### 2. Eye Of Gnome -![eye of gnome][4] +#### 2. Gnome 之眼 +![Gnome 之眼][4] -**What’s good about it?** +**它有什么特点?** - * A dead simple image viewer - * Slideshow style (if that’s what you like) - * An image viewer tailored for GNOME desktop environment + * 极其简单的图像查看器 + * 幻灯片视图 + * 为 GNOME 量身打造的图片查看器 +这是一款经典的图片查看器,它在数年前作为 GNOME 项目的一部分被开发出来。不过需要注意的是,对它的维护目前已经不是很活跃了。不过它仍能在最新版 Ubuntu LTS 和部分 Linux 发行版中正常工作。 +如果你需要一个简单、有幻灯片视图并可以在侧栏看到元数据的图像查看器,Gnome 之眼是最佳选择。 -This is a classic image viewer developed as a part of The GNOME Project a lot of years ago. Do note that this isn’t actively maintained anymore. But, it still works on Ubuntu’s latest LTS release and several other Linux distros. +**我该如何安装它?** -If you want a dead simple image viewer where you browse through the images in a slideshow-type UI and get the meta info in the sidebar, Eye of GNOME should be your choice. One of the best for GNOME desktop environment! - -**How do I install it?** - -To manually install it on Ubuntu (or Ubuntu-based Linux distros) type in the following command: +若要在 Ubuntu 及基于 Ubuntu 的 Linux 发行版上安装它,仅需一条命令: ``` sudo apt install eog ``` -For other distros and source, you should follow the [GitHub page.][5] +如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][5] 。 -#### 3. Eye Of MATE Image Viewer +#### 3. EOM -![eye of mate image viewer][6] +![EOM 图像查看器][6] -**What’s good about it?** +**它有什么特点?** - * A simple image viewer - * Plugins supported - * An image viewer tailored for MATE desktop environment + * 简洁 + * 可扩展 + * 为 MATE 量身打造的图片查看器 +另一个基本功能齐全,支持幻灯片视图和图像旋转的查看器。 +虽然它没什么特色功能,但它支持大部分的图像格式,并且还能处理大体积的图像。 -Yet another simple image viewer with the basic functionalities of slideshow view and rotating images. +**我该如何安装它?** -Even if doesn’t support any image manipulation feature, it does support numerous image file formats and can handle big image files. - -**How do I install it?** - -For Ubuntu/Ubuntu-based distros, type in the following command: +若要在 Ubuntu 及基于 Ubuntu 的 Linux 发行版上安装它,仅需一条命令: ``` sudo apt install eom ``` -If you need help for other distros and the source, follow their [GitHub page][7]. +如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][7] 。 #### 4. Geeqie -![geeqie image viewer][8] +![Geeqie 图像查看器][8] -**What’s good about it?** +**它有什么特点?** - * A flexible image manager that supports plugins (you’ll find other image viewers supported as well) - * Information about the color profile + * 可扩展 + * 色彩信息显示 +Geeqie 是一个令用户印象深刻的图片管理/查看器。他支持将其它查看器作为扩展使用,不过它并不提供任何对图像操作的工具。 +如果你希望获取图像的颜色信息、元数据,或是查看/管理一堆图片,它将会是一个不错的选择。 -Geeqie is an impressive image manager and viewer. It supports other image viewers as plugins but does not offer any image manipulation tools. +**我该如何安装它?** -If you need to know the color profile, image info, and manage/view a collection of images. It should be a good choice for that. - -**How do I install it?** - -Type in the terminal: +在终端输入: ``` sudo apt install geeqie ``` -For the source, you can refer the [GitHub page][9]. +若想查看它的源代码,请前往 [它的 GitHub 主页][9]。 -#### 5. gThumb Image Viewer +#### 5. gThumb -![gthumb image viewer][10] +![gThumb 图片查看器][10] -**What’s good about it?** +**它有什么特点?** - * An all-in-one image viewer with the ability to manage, edit and view the images - * Reset EXIF orientation - * Convert image formats - * Find duplicate images + * 多种功能(查看、编辑和管理) + * 可清除 EXIF 信息 + * 图像格式转换 + * 查找重复的图像 +gThumb 会让你眼前一亮,因为它有很多功能。它的查看/管理界面和编辑工具(裁剪、颜色编辑等等)将会给你留下很深的印象。 +你甚至可以为图像添加评论或清除它的 EXIF 信息。它使得你可以方便地编辑或转码图像。 -gThumb is an amazing image viewer with a lot of features. You get an impressive user interface to view/manage your images along with the basic image manipulation tools (crop, resize, color, and so on.) +**我该如何安装它?** -You can also add comments to an image or reset the EXIF orientation info. It also gives you the ability to find duplicate images and convert image formats. - -**How do I install it?** - -You can enter this command in the terminal: +你可以在终端中输入这条命令: ``` sudo apt install gthumb ``` -If that doesn’t work, head to the [GitHub page][11] for more info. +输了没用?请参阅 [项目 GitHub 主页][11] 来获取帮助。 #### 6. Gwenview -![gwenview image viewer][12] +![Gwenview 图像查看器][12] -**What’s good about it?** +**它有什么特点?** - * A basic image viewer with common image manipulation tools to rotate and resize - * Feature extension using KIPI plugins + * 简单,有基础图像编辑功能(旋转、调整大小) + * 可使用 KIPI 插件扩展 +Gwenview 又是一个基本的图像查看器,它为 KDE 量身定做。不过这并不影响你在其它桌面环境中使用它。 +如果你使用 Konqueror 浏览器,你可以将 Gwenview 作为它的内嵌图片浏览器。你也可以为图片添加评论。此外,它还支持 [KIPI][13] 插件。 -Gwenview is just another basic image viewer tailored for KDE desktop environment. However, you can install it on other desktop environments as well. +**我该如何安装它?** -If you utilize the Konqueror web browser, you can use it as an embedded image viewer. Here, you can add comments/description to the image as well. In addition, it supports [KIPI][13] plugins. - -**How do I install it?** - -Type the following in the terminal to install it: +你可以在终端中输入这条命令: ``` sudo apt install gwenview ``` -For the source, check out their [GitHub page][14]. +若想查看它的源代码,请前往 [它的 GitHub 主页][14]。 #### 7. Mirage -![mirage image viewer][15] +![Mirage 图像查看器][15] -**What’s good about it?** +**它有什么特点?** - * Customizable interface even it is a basic UI - * Basic image manipulation tools - * Command-line access + * 可定制的 UI + * 基本图像编辑工具 + * 可在命令行使用 +如果你想要一个可在命令行中访问、支持全屏和幻灯片视图、带有基础编辑工具以及可定制 UI 的查看器,Mirage 是个不二之选。 +它是一个非常快速且兼容性优良的查看器。它支持包括 png、jpg、svg、xpm、gif、bmp 和 tifff 在内的多种图像格式。 -If you want a decent image viewer along with the ability to access it via command line, a fullscreen mode, slideshow mode, basic editing tools to resize/crop/rotate/flip, and a configurable interface – Mirage would be the simplest option. +**我该如何安装它?** -It is a very fast and capable image viewer that supports a lot of image formats that include png, jpg, svg, xpm, gif, bmp, and tifff. - -**How do I install it?** - -You need to type in the following: +你需要执行: ``` sudo apt install mirage ``` -For the source code and other installation instructions, refer the [GitHub page][16]. +访问 [项目 GitHub 页面][16] 来获取更多信息。 #### 8. KPhotoAlbum -![][17] +![KPhotoAlbum][17] -**What’s good about it?** +**它有什么特点?** - * Perfect image manager to tag and manage the pictures - * Demo databases - * Image compression - * Merge/Remove images to/from Stack + * 为图像添加标签 + * 数据库支持 + * 图片比较 + * 合并/移除一堆图像 +确切地说,KPhotoAlbum 其实不仅仅是一款图像查看器,它还能为图像添加标签并管理图像。 +你可以用它来比较图片以及使用标签搜索你的图片。你还可以使用幻灯片视图来观看图片。 -KPhotoAlbum is not exactly a dedicated image viewer but a photo manager to tag and manage the pictures you’ve got. +**我该如何安装它?** -You can opt for slideshows to view the image along with the ability to compress images and search them using the labels/tags. - -**How do I install it?** - -You can install it via the terminal by typing in: +在终端中输入: ``` sudo apt kphotoalbum ``` -In either case, you can check for the [official instructions on their website][18] to get it installed on your Linux distro. +跟从 [官网上的指引][18] 来在其它 Linux 发行版中安装它。 #### 9. Shotwell -![shotwell][19] +![Shotwell][19] -**What’s good about it?** +**它有什么特点?** - * Red-eye correction tool - * Upload photos to Facebook, Flickr, etc. - * Supports RAW file formats as well + * 红眼消除工具 + * 将照片上传到 Facebook 或 Flickr 等社交网络中 + * 支持原始格式(RAW)的图片 +Shotwell 是一个多功能照片管理器。在此,你能查看或管理你的照片。虽然它没带有许多图像编辑工具,但是你还是可以裁剪和调整亮度的。 +**我该如何安装它?** -Shotwell is a feature-rich photo manager. You can view and manage your photos. Although you do not get all the basic image manipulation tools baked in it – you can easily crop and enhance your photos in a single click (auto brightness/contrast adjustments). - -**How do I install it?** - -Go to the terminal and enter the following (Ubuntu/Ubuntu-based distros): +在终端中执行以下命令 (Ubuntu 及其衍生版本): +``` sudo apt install shotwell +``` -For more information, check out their [GitHub page][20]. +若想获取更多信息,请 [前往它的 GitHub 界面][20]。 #### 10. Ristretto -![ristretto][21] +![Ristretto][21] -**What’s good about it?** +**它有什么特点?** - * A dead simple image viewer - * Fullscreen mode & Slideshow + * 极其简单 + * 全屏模式 + * 幻灯片视图 +简易的图像查看器。它能查看、全屏查看、缩放查看或以幻灯片视图查看图片。 +它是为 Xfce 定制的,但你仍然可以在其它任何地方安装它。 -A very straightforward image viewer where you just get the ability to zoom, view in fullscreen mode and view the images as a slideshow. +**我该如何安装它?** -It is tailored for Xfce desktop environment – but you can install it anywhere. - -**How do I install it?** - -Even though it’s built for Xfce desktop environment, you can install it on any Ubuntu/Ubuntu-based distro by typing the following command in the terminal: +即使它是为 Xfce 桌面环境构建的,你仍能在其它地方安装它。对 Ubuntu 及其衍生发行版,请执行: ``` sudo apt install ristretto ``` + #### 11. digiKam -![digikam image viewer][22] +![digiKam 图像查看器][22] -**What’s good about it?** +**它有什么特点?** - * An all-in-one image viewer with advanced photo management features (editing/managing/viewing) - * Batch Queue Manager - * [Light Table][23] + * 带有高级图像管理功能(查看/管理/编辑)的多合一查看器 + * 可以进行批处理 + * 带有 [Light Table 功能][23] +digiKam 是一个带有多种图像编辑功能的高级照片管理器。你可以使用 SQLite 或 MySQL 来配置它的数据库。 +为了提升你的看图体验,你可以在预览图片时加载低画质的图片。这样一来,即使你有一大堆图片,它也丝滑般流畅。不仅如此,你还可以通过 Google、Facebook、Imgur 等来导入/导出图片。如果你希望使用一个超多功能的查看器,请务必试试这个 digiKam。 -digiKam is an advanced photo manager with some additional image manipulation tools. You get the ability to configure the database using SQLite or MySQL. +**我该如何安装它?** -To enhance your experience of viewing images, it lets you choose the reduced version of images while you preview them. So, that becomes super fast even if you have a lot of images. You get several import/export options via Google, Facebook, Imgur, and so on. If you want a feature-rich image viewer, this is the one you should have installed. - -**How do I install it?** - -Type in the following command: +执行这条命令: ``` sudo apt install digikam ``` -For more information, visit their [GitHub page][24]. +访问 [项目 GitHub 页面][24] 来获取更多信息。 -### Wrapping Up +### 尾声 -So, no matter whether you want a different user experience or a rich set of features and powerful tools to manage your photos – there’s something everyone. +总的来说,无论你想要不同的用户体验、丰富的功能还是强大的管理工具,上面总有适合你的工具。 -Which image viewer do you prefer to use? Is it the system’s default viewer? +你更喜欢哪个图像查看器呢?它是系统自带的吗? -Let us know in the comments below. +欢迎前往原文的评论区留下你的答案。 -------------------------------------------------------------------------------- @@ -311,7 +293,7 @@ via: https://itsfoss.com/image-viewers-linux/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zhs852](https://github.com/zhs852) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From dd2c61e1207d9093f8ae727d62853a601766b40d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Dec 2018 21:18:33 +0800 Subject: [PATCH 0363/4278] PUB:20181221 Listen to the radio at the Linux terminal.md @geekpi https://linux.cn/article-10393-1.html --- .../20181221 Listen to the radio at the Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181221 Listen to the radio at the Linux terminal.md (98%) diff --git a/translated/tech/20181221 Listen to the radio at the Linux terminal.md b/published/20181221 Listen to the radio at the Linux terminal.md similarity index 98% rename from translated/tech/20181221 Listen to the radio at the Linux terminal.md rename to published/20181221 Listen to the radio at the Linux terminal.md index ffc4e4357e..431f579460 100644 --- a/translated/tech/20181221 Listen to the radio at the Linux terminal.md +++ b/published/20181221 Listen to the radio at the Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10393-1.html) [#]: subject: (Listen to the radio at the Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-mplayer) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 3c3cc81a676652e65506accabe95e998a8486db5 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 29 Dec 2018 21:19:25 +0800 Subject: [PATCH 0364/4278] Move file to translated --- ...0181222 Top 11 best Image Viewer for Ubuntu and other Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md (100%) diff --git a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md similarity index 100% rename from sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md rename to translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md From 2cb2643f4fcda8e0d73cf3f14f584066789995b1 Mon Sep 17 00:00:00 2001 From: yuqi Date: Sat, 29 Dec 2018 22:14:30 +0800 Subject: [PATCH 0365/4278] translated and proofread by yuqi --- .../tech/20171111 A CEOs Guide to Emacs.md | 116 ++++++++++-------- 1 file changed, 63 insertions(+), 53 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index d7a5f8ad0d..9e7f9290d4 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -1,73 +1,73 @@ -一位 CEO 的 Emacs 指南 +一位 CEO 的 Emacs 指南(备选:CEO 的 Emacs 秘籍) =========== -几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,我已经忘了如何在不用鼠标的情况下来浏览文件。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是就决定再试一次 Emacs。这是个很正确的决定,原因有以下几个。其中包括了 `.emacs` 和 Dropbox 的技巧,可以让你建立一个良好的、可移植的环境。 +几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器,或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,就连最基本的文件浏览,我都已经忘了在不用鼠标的情况下该怎么操作。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是我决定再次使用 Emacs。这是个很正确的决定,原因有以下几个。其中包括用 `.emacs` 和 Dropbox 来搭建一个良好的、可移植的环境的一些技巧。 -对于那些还没用过 Emacs 的人来说,你可能会讨厌它,但也可能喜欢上它。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键短语是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一种可以作为发动机的热核烤面包机……好吧,你可以用来对文字做什么都可以。当考虑到你的计算生活在很大程度上与文本有关时,这是一个相当大胆的声明,真的很大胆。 +对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的的热核烤面包机……好吧,只是文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 -也许对我来说更重要的是,它是我曾经使用过的一个应用程序,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。第一点是它是更快更完整的。第二点就是它会给你带来无尽的快乐或烦恼,这取决于你自己,而且会一直持续到你生命的最后一天。我是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时同样感到高兴的人,具体情况因人而异。 +也许对我来说更重要的是,Emacs 是我曾经使用过的一个应用,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。前者更快而且很完整,后者是无尽的快乐或烦恼的源泉,当然这取决于你自己,而且这种快乐或烦恼会伴随到你死。我就是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时会感到高兴的人,具体情况因人而异。 ![1933 steel bicycle](https://www.fugue.co/hubfs/Imported_Blog_Media/bicycle-1.jpg) *一辆我还在骑的1933年产的钢制自行车。你可以看看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]* -这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。它的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 +这可能给人一种 Emacs 已经过气或过时的印象。然而并不是,Emacs 是强大和永恒的,只要你耐心地去理解它的一些规则。Emacs 的规则很另类,也很奇怪,但其中的逻辑却引人注目,且魅力十足。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 -如果通过编辑 Lisp 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 公司的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32]Pointy-Haired Bosses(PHB[^1] )(以及,其它好奇的人)的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 +使用 Lisp 代码来构建个人工作环境,并将这个恰到好处的环境移植到任何计算机,如果这种想法打动了你,那么你将会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么 Emacs 可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 公司的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是写给 CEO 和其他[精英][32]Pointy-Haired Bosses(PHB[^1] )(以及对 Emacs 感兴趣的人)的,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚,从而让你有个良好的体验,而不是花上几个小时去 Google。 ### 恒久优势 使用 Emacs 带来的长期优势是让生活更轻松。与最后的收获相比,最开始的付出完全值得。想想这些: -#### 无需上下文切换 +#### 简单高效 -Org 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议需要做什么的清单,再到员工评估。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些应用程序都有不同的用户界面、保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住细节。我讨厌上下文切换,因为它是一种强加到我身上的方式,原因是破坏了界面模型[^2] ,并且我讨厌记住本该是计算机要为我记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更有用,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比通常看起来的要高。操作系统和应用程序厂商已经构建了各种界面,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[^3] 。 +Org 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议事务清单,再到员工评估。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些程序都有不同的用户界面、保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住各种细节。我讨厌在程序间切换,这是在强人所难,因为这是个不完整界面模型[^2] ,并且我讨厌记住本该由计算机记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更高效,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比表面上的要更高。操作系统和应用程序厂商已经构建了各种界面,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[^3] 。 -许多应用程序可以全天全屏地用于编辑文本。Emacs 是惟一的,因为它既是编辑器也是 Emacs Lisp 解释器。从本质上说,你工作时只要用电脑上的一两个键就能完成。如果你对编程略知一二,就能发现这意味着你可以在 Emacs 中做 _任何事情_。一旦你在内存中有了这些命令,你的电脑就可以在你工作时几乎实时地为你提供高效的运转。你不会想用 Emacs Lisp 来重建 Excel,只要用简单的一两行代码就能实现 Excel 中大多数的功能。如果我需要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是我有一封多行的邮件要写,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的算术开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得艾萨克·阿西莫夫书中那些神奇的终端吗? Emacs 是我所遇到的最接近它们的东西[^4] 。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 +许多应用程序可以全天全屏地用于编辑文本。但Emacs 是唯一的,因为它既是编辑器也是 Emacs Lisp 解释器。从本质上来说,你工作时只要用电脑上的一两个键就能完成。如果你略懂编程的话,就会发现这代表着你可以在 Emacs 中做 _任何事情_。一旦你在内存中存储了这些指令,你的电脑就可以在工作时几乎实时地为你提供高效的运转。你不会想用 Emacs Lisp 来重建 Excel,因为只要用简单的一两行代码就能实现 Excel 中大多数的功能。比如说我要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是要写一封比较大的邮件时,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的算术开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得艾萨克·阿西莫夫书中那些神奇的终端吗? Emacs 是我所遇到的最接近它们的东西[^4] 。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 -#### 在安静中创造事情 +#### 静中造物 -拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?发挥了 Lisp 键盘的全部威力了吗?我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 +拥有所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?发挥了 Lisp 键盘的全部威力了吗?我用 Emacs 来完成所有的创作性工作,音乐和图片除外。 -我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 应用程序,我更讨厌其在线版。 +我办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,我通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面会隐藏起来,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,越是先进的 UI 应用程序,消除干扰越是不可能,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像出书一样,处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 客户端版,我更讨厌它的在线版。 ![](https://www.fugue.co/hubfs/Imported_Blog_Media/desktop-1.jpg) *我的桌面布局, Emacs 在左边* -但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间段时,我的效率会更高。我们 Fugue 公司使用 Slack,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。只要一个 Slackstorm 或一封风投或董事会董事的电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 +但是沟通呢?创造和沟通之间的差别很大。当我将这两件事在不同时间段处理时,我的效率会更高。我们 Fugue 公司使用 Slack,痛并快乐着。我把 Slack 和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我就能够忽略所有的聊天信息了。虽然只要一个 Slackstorm 或一封风投或董事会董事的电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 #### 包罗万象,永久长青 -第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 Dropbox 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何你已经精心打造了适合你的目的的套件的环境中工作了。我在 OS X、Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理 Pages、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 +第三个原因是,我发现 Emacs 比其它的环境更有优势的是,你可以很容易地用它来处理事务。我的意思是,你所需要的只是通过类似于 Dropbox 的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何你已经精心打造了适合你的目的的套件的环境中工作了。我在 OS X、Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理 Pages、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 -限制在计算机上永久存储的因素是文件格式。假设人类已经解决了存储问题[^6] ,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最长青的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于 Office 应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 +限制在计算机上永久存储的因素是文件格式。假设人类已经解决了存储问题[^6] ,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是保存时间最久的格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于 Office 应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 -如果你准备尝试 Emacs,请继续阅读!下面的部分不会取代完整的教程,但是在完成阅读时,就可以操作了。 +如果你准备尝试 Emacs,请继续读下去!下面的部分不是完整的教程,但是在读完后,就可以动手操作了。 -### 学会驾驭 Emacs —— 一个专业的配置 +### 驾驭之道 —— 专业定制 所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像穿越到过去。这有点像你只开过车,却要你去学骑自行车[^7] 。 -#### 该选哪个 Emacs +#### 类型抉择 我用的是来自 GNU 的 OS X 和 Windows 的通用版本的 Emacs。你可以在 [http://emacsformacos.com/][35] 获取 OS X 版本,在 [http://www.gnu.org/software/emacs/][37] 获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(涉及到 Lisp 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[^8] ! -#### 首先,学会导航 +#### 驾驭之始 在本文中,我将使用 Emacs 的按键和组合键约定。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组合快捷键会指向一个教程,这是你首先要做的一件事。 -不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生的导航命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。这个 Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以您不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后在单词间移动。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向后移动多少个单词或向上或向下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其它真正重要的导航命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中一个过时的[观点][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 +不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生的导航命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。这个 Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以你不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后在单词间移动。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向后移动多少个单词或向上或向下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其它真正重要的导航命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中一个过时的[观点][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 Emacs 所附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 -#### 学会复制和粘贴 +#### 驾驭之复制粘贴 -你可以把 Emacs 设为 CUA 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 和导航命令来标记区域(如同选择)。所以 `C-F` 是选中光标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除killing召回yanking,但它非常类似于剪切和粘贴。在删除中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你开始尝试了,那么 `C-x u` 是撤销。 +你可以把 Emacs 设为 CUA 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 和导航命令来标记区域(如同选择)。所以 `C-F` 是选中光标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除killing召回yanking,但它非常类似于剪切和粘贴。在删除中还有一些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你开始尝试了,那么 `C-x u` 是撤销。 -#### 下一步,学会用 Ido 模式 +#### 驾驭之 Ido 模式 -相信我,Ido 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独的访达或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 Ido 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 Ido 是 Emacs 的 22 版时开始出现的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 +相信我,Ido 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独的访达或文件资源管理器的窗口。相反,你可以用编辑器的命令来创建、打开和保存文件。如果没有 Ido 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 Ido 是 Emacs 的 22 版时开始出现的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 Emacs 中的大多数功能都表现在模式上。要安装指定的模式,需要做两件事。嗯,一开始你需要做一些额外的事情,但这些只需要做一次,然后再做这两件事。那么,这件额外的事情是你需要一个单独的位置来放置所有 Emacs Lisp 文件,并且你需要告诉 Emacs 这个位置在哪。我建议你在 Dropbox 上创建一个单独的目录,那是你 Emacs 主目录。在这里,你需要创建一个 `.emacs` 文件和 `.emacs.d` 目录。在 `.emacs.d` 目录下,创建一个 `lisp` 的目录。就像这样: @@ -81,7 +81,7 @@ home -lisp ``` -你可以将那些比如模式的 `.el` 文件放到 `home/.emacs.d/lisp` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: +你可以将 `.el` 文件,比如说模式文件,放到 `home/.emacs.d/lisp` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: ``` (add-to-list 'load-path "~/.emacs.d/lisp/") @@ -89,11 +89,11 @@ home Ido 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放这个 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. -#### 符号链接是你的好伙伴 +#### 驾驭之符号链接 等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把它们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并做符号链接到 `~` 下的 `.emacs` 、`.emacs.d` 和你的主要存放文档的目录。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的地方了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件夹的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 -至此,你已经完成了在任意机器上指向你的 Emacs 配置和文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就可以得到你的整个工作环境。第一次做这个似乎有点困难,但是一旦你知道你在做什么,就(最多)只需要 10 分钟。 +至此,你已经完成了在任意机器上指向你的 Emacs 配置和文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就可以得到你的整个工作环境。第一次操作起来似乎有点难,但是一旦你知道你在做什么,就(最多)只需要 10 分钟。 但我们现在是在配置 Ido …… @@ -121,9 +121,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] 其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开访达或文件资源管理器再用鼠标点要节省 _很_ 多时间。 Ido 模式很有用,而这只是操作 Emacs 的一种实用模式而已。下面让我们去探索一些其它对完成工作很有帮助的模式吧。 -#### 字体及风格 +#### 驾驭之字体风格 -我推荐在 Emacs 中使用漂亮的字体族。它们可以使用不同的括号、0 和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1.5 倍的行间距,并在代码和数据中使用不等宽字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我将我的 `.emacs` 设置为根据使用的机器的名称来相应配置屏幕。代码如下: +我推荐在 Emacs 中使用漂亮的字体族。它们可以使用不同的括号、0 和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1.5 倍的行间距,并在代码和数据中使用不等宽字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果你使用多个设备,你可能需要一些不同的设置。我将我的 `.emacs` 设置为根据使用的机器的名称来相应配置屏幕。代码如下: ``` ;; set up fonts for different OSes. OSX toggles to full screen. @@ -140,9 +140,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] (set-face-attribute 'default nil :font myfont :height 104))) ``` -您应该将你的 Emacs 中的 `system-name` 的值替换成你通过 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个,但是 Windows 和 Emacs 并不真正喜欢对方,当我尝试这个时,它总是不稳定。相反,我只能在启动后手动全屏。 +你应该将 Emacs 中的 `system-name` 的值替换成你通过 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个功能,但是 Windows 和 Emacs 好像互相嫌弃对方,当我尝试配置时,它总是不稳定。相反,我只能在启动后手动全屏。 -我还建议去掉 Emacs 中的上世纪 90 年代出现的难看工具栏,当时最酷的事情是在应用程序中使用工具栏。我还去掉了一些其它的“电镀层”,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中来去掉工具栏和滚动条,但要保留菜单(在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): +我还建议去掉 Emacs 中的上世纪 90 年代出现的难看工具栏,当时比较流行在应用程序中使用工具栏。我还去掉了一些其它的“电镀层”,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中来去掉工具栏和滚动条,但要保留菜单(在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): ``` (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) @@ -150,11 +150,11 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] (if (fboundp 'menu-bar-mode) (menu-bar-mode 1)) ``` -#### Org 模式 +#### 驾驭之 Org 模式 -我基本上是在 Org 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。Org 模式最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,Org 模式主要是一种处理结构中内容的方式。在 Org 模式中有标题和副标题等,它们的作用就像一个大纲。Org 模式允许你展开或隐藏大纲树,还可以重新排列该树。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 +我基本上是在 Org 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。Org 模式是笔记和待办事项列表的组合工具,最初是由一个在会议中使用笔记本电脑的人构想出来的。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,Org 模式主要是一种处理结构中内容的方式。在 Org 模式中有标题和副标题等,它们的作用就像一个大纲。Org 模式允许你展开或隐藏大纲树,还可以重新排列该树。这正合我意,并且我发现用这种方式使用它是一种乐趣。 -Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,LaTeX/PDF 输出也很好。Org 模式能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下,并且如果你想要它基于文档的结构进行缩进并在打开时全部展开的话,在你的 `.emacs` 文件中添加如下代码: +Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,LaTeX/PDF 输出也很好。Org 模式能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下。如果你想要它基于文档的结构进行缩进并在打开时全部展开的话,在你的 `.emacs` 文件中添加如下代码: ``` ;; set up org mode @@ -169,9 +169,9 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 ##### 用 Org 模式进行发布 -我关心的是文档的外观和格式化。我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。Org 模式对将 LaTeX 生成 PDF 支持的很好,LaTeX 虽然也有学习曲线,但是做简单的事情非常简单。 +我关心的是文档的外观及格式。我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。Org 模式对将 LaTeX 生成 PDF 支持的很好,LaTeX 虽然也有学习曲线,但是很容易处理一些简单的事务。 -如果你想使用字体和样式,而不是典型的 LaTeX 字体和样式,你需要做些事。首先,你要用到 XeLaTeX,这样就可以使用普通的系统字体,而不是 LaTeX 的特殊字体。接下来,您需要将以下代码添加到 `.emacs` 中: +如果你想使用字体和样式,而不是典型的 LaTeX 字体和样式,你需要做些事。首先,你要用到 XeLaTeX,这样就可以使用普通的系统字体,而不是 LaTeX 的特殊字体。接下来,你需要将以下代码添加到 `.emacs` 中: ``` (setq org-latex-pdf-process @@ -179,7 +179,7 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 "xelatex -interaction nonstopmode %f")) ``` -我把这个放在 `.emacs` 中 Org 模式配置部分的末尾来保持整洁。这让你在从 Org 模式发布时可以使用更多格式化选项。例如,我经常使用: +我把这个放在 `.emacs` 中 Org 模式配置部分的末尾,使文档变得更整洁。这让你在从 Org 模式发布时可以使用更多格式化选项。例如,我经常使用: ``` #+LaTeX_HEADER: \usepackage{fontspec} @@ -191,13 +191,12 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 #+TITLE: Document Title Here ``` -这些都可以在你的 `.org` 文件中找到。我们的公司规定的正文字体是 `Maison Neue`,但你也可以在这写上任何适当的东西。我强烈反对使用 `Maison Neue`。它是一种糟糕的字体,任何人都不应该使用它。 +这些都可以在 `.org` 文件中找到。我们的公司规定的正文字体是 `Maison Neue`,但你也可以在这写上任何适当的东西。我很是抵制 `Maison Neue`,因为这是一种糟糕的字体,任何人都不应该使用它。 这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 LaTeX 一样。在我看来这还不错,但是字体很平淡,而且有点奇怪。此外,如果你使用标准格式,人们会觉得他们正在阅读的东西是、或者假装是一篇学术论文。别怪我没提醒你。 -#### Ace Jump 模式 - -这是个辅助而不是主要功能,但是或许你想使用。它的工作原理有点像之前的 Jef Raskin 的 Leap 功能[^9] 。 按下 `C-c C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `lisp` 目录下,并在 `.emacs` 文件添加如下代码: +#### 驾驭之 Ace Jump 模式 +这只是一个辅助模式,而不是一个主模式,但是你也需要它。其工作原理有点像之前提到的 Jef Raskin 的 Leap 功能[^9] 。 按下 `C-c C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。你只需键入所需位置的字母,光标就会跳转到该位置。我常将它作为导航键或是用来检索。将 `.el` 文件下到你的 `lisp` 目录下,并在 `.emacs` 文件添加如下代码: ``` ;; set up ace-jump-mode @@ -206,20 +205,29 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 (define-key global-map (kbd "C-c C-SPC" ) 'ace-jump-mode) ``` -### 更多 +### 待续 -这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除了编程之外(或用于编程)你对 Emacs 的使用情况,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的老板式想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来介绍其它特性或模式。我很确定我将会向你展示如何在 Emacs 和 Ludwig 模式下使用 Fugue,因为我会将它发展成比代码高亮更有用的东西。请把你的想法发到 [@fugueHQ][41] 上。 +本文已经够详细了,你能在其中得到你所想要的。我很想知道除编程之外(或用于编程)Emacs 的使用情况,及其是否高效。在我使用 Emacs 的过程中,可能存在一些自作聪明的老板式想法,如果你能指出来,我将不胜感激。之后,我可能会写一些更新来介绍其它特性或模式。我很确定我将会向你展示如何在 Emacs 和 Ludwig 模式下使用 Fugue,因为我会将它发展成比代码高亮更有用的东西。更多想法,请在 Twitter 上 [@fugueHQ][41] 。 +### 脚注 -[^1]: If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. -[^2]: http://archive.wired.com/wired/archive/2.08/tufte.html -[^3]: I mainly use this to perform calculations while writing. For example, I was writing an offer letter to a new employee and wanted to calculate how many options to include in the offer. Since I have a variable defined in my `.emacs` for outstanding-shares, I can simply type `M-: (* .001 outstanding-shares)`and get a tenth of a point without opening a calculator or spreadsheet. I keep  _lots_ of numbers in variables like this so I can avoid context switching. -[^4]: The missing piece of this is the web. There is an Emacs web browser called eww that will allow you to browse in Emacs. I actually use this, as it is both a great ad-blocker and removes most of the poor choices in readability from the web designer's hands. It's a bit like Reading Mode in Safari. Unfortunately, most websites have lots of annoying cruft and navigation that translates poorly into text. -[^5]: Usability is often confused with learnability. Learnability is how difficult it is to learn a tool. Usability is how useful the tool is. Often, these are at odds, such as with the mouse and menus. Menus are highly learnable, but have poor usability, so there have been keyboard shortcuts from the earliest days. Raskin was right on many points where he was ignored about GUIs in general. Now, OSes are putting things like decent search onto a keyboard shortcut. On OS X and Windows, my default method of navigation is search. Ubuntu's search is badly broken, as is the rest of its GUI. -[^6]: AWS S3 has effectively solved file storage for as long as we have the Internet. Trillions of objects are stored in S3 and they've never lost one of them. Most every service out there that offers cloud storage is built on S3 or imitates it. No one has the scale of S3, so I keep important stuff there, via Dropbox. -[^7]: By now, you might be thinking "what is it with this guy and bicycles?" ... I love them on every level. They are the most mechanically efficient form of transportation ever invented. They can be objects of real beauty. And, with some care, they can last a lifetime. I had Rivendell Bicycle Works build a frame for me back in 2001 and it still makes me happy every time I look at it. Bicycles and UNIX are the two best inventions I've interacted with. Well, they and Emacs. -[^8]: This is not a tutorial for Emacs. It comes with one and it's excellent. I do walk through some of the things that I find most important to getting a useful Emacs setup, but this is not a replacement in any way. -[^9]: Jef Raskin designed the Canon Cat computer in the 1980s after falling out with Steve Jobs on the Macintosh project, which he originally led. The Cat had a document-centric interface (as all computers should) and used the keyboard in innovative ways that you can now imitate with Emacs. If I could have a modern, powerful Cat with a giant high-res screen and Unix underneath, I'd trade my Mac for it right away. [][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] +[^1]: 如果你是位精英,但从没涉及过技术方面,那么 Emacs 并不适合你。对于少数的人来说,Emacs 可能会为他们开辟一条通往计算机技术方面的道路,但这只是极少数。如果你知道怎么使用 Unix 或 Windows 的终端,或者曾编辑过 dotfile,或者说你曾写过一点代码的话,这对使用 Emacs 有很大的帮助。 + +[^2]: 参考链接: http://archive.wired.com/wired/archive/2.08/tufte.html + +[^3]: 我主要是在写作时使用这个模式来进行一些运算。比如说,当我在给一个新雇员写一封入职信时,我想要算这封入职信中有多少个选项。由于我在我的 `.emacs` 为 outstanding-shares 定义了一个变量,所以我只要按下 `M-:` 然后输入 `(* .001 outstanding-shares)` 就能再无需打开计算器或电子表格的情况下得到精度为 0.001 的结果。我使用了 _大量_ 的变量来避免程序间切换。 + +[^4]: 缺少的部分是 web。有个名为 eww 的 Emacs 网页浏览器能够让你在 Emacs 中浏览网页。我用的就是这个,因为它既能拦截广告(译者注:实质上是无法显示,/laugh),同时也在可读性方面为 web 开发者消除了大多数差劲的选项。这个其实有点类似于 Safari 的阅读模式。不幸的是,大部分网站都有很多令人讨厌的繁琐的东西以及难以转换为文本的导航, + +[^5]: 易用性和易学性这两者经常容易被搞混。易学性是指学习使用工具的难易程度。而易用性是指工具高效的程度。通常来说,这是要差别的,就想鼠标和菜单栏的差别一样。菜单栏很容易学会,但是却不怎么高效,以致于早期会存在一些键盘的快捷键。除了在 GUI 方面上,Raskin 在很多方面上的观点都很正确。如今,操作系统正在将一些合适的搜索映射到键盘的快捷键上。比如说在 OS X 和 Windows 上,我默认的导航方式就是搜索。Ubuntu 的搜索做的很差劲,如同它的 GUI 一样差劲。 + +[^6]: 在有网的情况下, [AWSAmazon Web Services S3][42] 是解决文件存储问题的有效方案。数万亿个对象存在 S3 中,但是从来没有遗失过。大部分提供云存储的服务都是在 S3 上或是模拟 S3 构建的。没人能够拥有 S3 一样的规模,所以我将重要的文件通过 Dropbox 存储在上面。 + +[^7]: 目前,你可能会想:“这个人和自行车有什么关系?”……我在各个层面上都喜欢自行车。自行车是迄今为止发明的最具机械效率的交通工具。自行车可以是真正美丽的事物。而且,只要注意点的话,自行车可以用一辈子。早在 2001 年,我曾向 Rivendell Bicycle Works 订购了一辆自行车,现在我每次看到那辆自行车依然很高兴,自行车和 Unix 是我接触过的最好的两个发明。对了,还有 Emacs。 + +[^8]: 这个网站有一个很棒的 Emacs 教程,但不是这个。当我浏览这个页面时,我确实得到了一些对获取高效的 Emacs 配置很重要的知识,但无论怎么说,这都不是个替代品。 + +[^9]: 20世纪80年代,Jef Raskin 与 Steve Jobs 在 Macintosh 项目上闹翻后, Jef Raskin 又设计了 [Canon Cat 计算机][43]。这台 Cat 是以文档为中心的界面(所有的计算机都应如此),并以一种全新的方式使用键盘,你现在可以用 Emacs 来模仿这种键盘。如果现在有一台现代的,功能强大的 Cat 并配有一个高分辨的显示器和 Unix 系统的话,我立马会用 Mac 来换。[][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] -------------------------------------------------------------------------------- @@ -227,7 +235,7 @@ via: https://blog.fugue.co/2015-11-11-guide-to-emacs.html 作者:[Josh Stella][a] 译者:[oneforalone](https://github.com/oneforalone) -校对:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy), [oneforalone](https://github.com/oneforalone) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -273,3 +281,5 @@ via: https://blog.fugue.co/2015-11-11-guide-to-emacs.html [39]:http://practicaltypography.com/one-space-between-sentences.html [40]:http://input.fontbureau.com/ [41]:https://twitter.com/fugueHQ +[42]:https://baike.baidu.com/item/amazon%20s3/10809744?fr=aladdin +[43]:https://en.wikipedia.org/wiki/Canon_Cat From 35948ed908998ae2ab8c1a9a4be2505e299f93b2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Dec 2018 22:47:30 +0800 Subject: [PATCH 0366/4278] PRF:20181212 How to Build a Netboot Server, Part 2.md @qhwdw --- ...2 How to Build a Netboot Server, Part 2.md | 178 +++++++++--------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/translated/tech/20181212 How to Build a Netboot Server, Part 2.md b/translated/tech/20181212 How to Build a Netboot Server, Part 2.md index 8887d84ba1..af3487c169 100644 --- a/translated/tech/20181212 How to Build a Netboot Server, Part 2.md +++ b/translated/tech/20181212 How to Build a Netboot Server, Part 2.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (How to Build a Netboot Server, Part 2) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -如何构建一台网络引导服务器(第二部分) +如何构建一台网络引导服务器(二) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot2-816x345.jpg) -在 [如何构建一台网络引导服务器(第一部分)][1] 的文章中,我们展示了如何创建一个网络引导镜像,在那个镜像中使用了一个名为 “liveuser” 帐户,它的 home 目录位于内存中,重启后 home 中的内容将全部消失。然而很多用户都希望机器重启后保存他们的文件和设置。因此,在本系列的第二部分,我们将向你展示如何在第一部分的基础上,重新配置网络引导镜像,使它能够使用 [活动目录][2] 中的用户帐户进行登陆,然后能够从一个 NFS 服务器上自动挂载他们的 home 目录。 +在 [如何构建一台网络引导服务器(一)][1] 的文章中,我们展示了如何创建一个网络引导镜像,在那个镜像中使用了一个名为 `liveuser` 帐户,它的家目录位于内存中,重启后家目录中的内容将全部消失。然而很多用户都希望机器重启后保存他们的文件和设置。因此,在本系列的第二部分,我们将向你展示如何在第一部分的基础上,重新配置网络引导镜像,以便 [活动目录][2] 中的用户帐户可以进行登录,然后从一个 NFS 服务器上自动挂载他们的家目录。 本系列的第三部分,我们将向你展示网络引导客户端如何与中心化配置的 iPXE 引导菜单进行交互。 @@ -22,7 +22,7 @@ ### 删除 Liveuser 帐户 -删除本系列文章第一部分中创建的 “liveuser” 帐户: +删除本系列文章第一部分中创建的 `liveuser` 帐户: ``` $ sudo -i @@ -33,7 +33,7 @@ $ sudo -i ### 配置 NTP、KRB5 和 SSSD -接下来,我们需要将 NTP、KRB5、和 SSSD 的配置文件复制进客户端使用的镜像中,以便于它们能够使用同一个帐户: +接下来,我们需要将 NTP、KRB5 和 SSSD 的配置文件复制进客户端使用的镜像中,以便于它们能够使用同一个帐户: ``` # MY_HOSTNAME=$(> /fc28/etc/$i; done ``` -### 连接活动目录 +### 加入活动目录 -接下来,你将执行一个 chroot 将客户端镜像连接到活动目录。从删除预置在网络引导镜像中相同的计算机帐户开始: +接下来,你将执行一个 `chroot` 将客户端镜像加入到活动目录。从删除预置在网络引导镜像中同名的计算机帐户开始: ``` # MY_USERNAME=jsmith @@ -73,20 +73,20 @@ $ sudo -i # adcli delete-computer "${MY_CLIENT_HOSTNAME%%.*}" -U "$MY_USERNAME" ``` -在网络引导镜像中如果有 krb5.keytab 文件,也删除它: +在网络引导镜像中如果有 `krb5.keytab` 文件,也删除它: ``` # rm -f /fc28/etc/krb5.keytab ``` -在网络引导镜像中执行一个 chroot 操作: +`chroot` 到网络引导镜像中: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done # chroot /fc28 /usr/bin/bash --login ``` -执行一个 join 操作: +执行一个加入操作: ``` # MY_USERNAME=jsmith @@ -97,7 +97,7 @@ $ sudo -i # adcli join $MY_DOMAIN --login-user="$MY_USERNAME" --computer-name="${MY_HOSTNAME%%.*}" --host-fqdn="$MY_HOSTNAME" --user-principal="host/$MY_HOSTNAME@$MY_REALM" --domain-ou="$MY_OU" ``` -现在登出 chroot,并清除命令历史: +现在登出 chroot,并清除 root 用户的命令历史: ``` # logout @@ -105,9 +105,9 @@ $ sudo -i # > /fc28/root/.bash_history ``` -### 安装和配置 PAM Mount +### 安装和配置 PAM 挂载 -我们希望客户端登入后自动挂载它的 home 目录。为实现这个目的,我们将要使用 “pam_mount” 模块。安装和配置 pam_mount: +我们希望客户端登入后自动挂载用户家目录。为实现这个目的,我们将要使用 `pam_mount` 模块。安装和配置 `pam_mount`: ``` # dnf install -y --installroot=/fc28 pam_mount @@ -123,7 +123,7 @@ $ sudo -i END ``` -重新配置 PAM 去使用 pam_mount: +重新配置 PAM 去使用 `pam_mount`: ``` # dnf install -y patch @@ -131,23 +131,23 @@ END # echo 'initgroups: files' >> /fc28/etc/authselect/custom/sssd/nsswitch.conf # patch /fc28/etc/authselect/custom/sssd/system-auth << END @@ -12 +12,2 @@ --auth sufficient pam_sss.so forward_pass -+auth requisite pam_mount.so {include if "with-pammount"} -+auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} +-auth sufficient pam_sss.so forward_pass ++auth requisite pam_mount.so {include if "with-pammount"} ++auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} @@ -35,2 +36,3 @@ - session required pam_unix.so -+session optional pam_mount.so {include if "with-pammount"} - session optional pam_sss.so + session required pam_unix.so ++session optional pam_mount.so {include if "with-pammount"} + session optional pam_sss.so END # patch /fc28/etc/authselect/custom/sssd/password-auth << END @@ -9 +9,2 @@ --auth sufficient pam_sss.so forward_pass -+auth requisite pam_mount.so {include if "with-pammount"} -+auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} +-auth sufficient pam_sss.so forward_pass ++auth requisite pam_mount.so {include if "with-pammount"} ++auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} @@ -32,2 +33,3 @@ - session required pam_unix.so -+session optional pam_mount.so {include if "with-pammount"} - session optional pam_sss.so + session required pam_unix.so ++session optional pam_mount.so {include if "with-pammount"} + session optional pam_sss.so END # chroot /fc28 authselect select custom/sssd with-pammount --force ``` @@ -159,17 +159,17 @@ END # echo "$MY_IP $MY_HOSTNAME ${MY_HOSTNAME%%.*}" >> /fc28/etc/hosts ``` -可选,允许所有用户去使用 sudo: +可选,允许所有用户可以使用 `sudo`: ``` # echo '%users ALL=(ALL) NOPASSWD: ALL' > /fc28/etc/sudoers.d/users ``` -### 转换 NFS Root 到一个 iSCSI 背后的存储 +### 转换 NFS 根目录到一个 iSCSI 后备存储器 -在一个 nfsroot 连接建立之后,目前版本的 nfs-utils 可能很难为 home 目录维护一个从客户端到 NFS 服务器的二次连接。当尝试去访问 home 目录时,客户端将被挂住。因此,为了网络引导镜像可共享使用,我们将使用一个不同的协议(iSCSI)来解决这个问题。 +在一个 nfsroot 连接建立之后,目前版本的 nfs-utils 可能很难为家目录建立一个从客户端到 NFS 服务器的第二个连接。当尝试去访问家目录时,客户端将被挂起。因此,为了共享网络引导镜像,我们将使用一个不同的协议(iSCSI)来规避这个问题。 -首先 chroot 到镜像中,去重新配置它的 initramfs,让它从一个 iSCSI root 中去引导: +首先 `chroot` 到镜像中,重新配置它的 `initramfs`,让它从一个 iSCSI 根目录中去引导: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done @@ -186,16 +186,16 @@ END # > /fc28/root/.bash_history ``` -在测试时,qedi 驱动会破坏 iscsi,因此我们将它禁用。 +在测试时,qedi 驱动会破坏 iSCSI,因此我们将它禁用。 -接着,创建一个 fc28.img 的 [稀疏文件][4]。这个稀疏文件代表 iSCSI 目标的背后存储: +接着,创建一个 `fc28.img` [稀疏文件][4]。这个稀疏文件代表 iSCSI 目标的后备存储器: ``` # FC28_SIZE=$(du -ms /fc28 | cut -f 1) # dd if=/dev/zero of=/fc28.img bs=1MiB count=0 seek=$(($FC28_SIZE*2)) ``` -(如果你有一个可使用的稀疏文件、一个单独的分区或磁盘驱动器,就可以代替它了,不用再去创建这个稀疏文件了。) +(如果你有一个可使用的独立分区或磁盘驱动器,也可以用它,而不用再去创建这个稀疏文件了。) 接着,使用一个文件系统去格式化镜像、挂载它、然后将网络引导镜像复制进去: @@ -207,31 +207,31 @@ END # umount $TEMP_MNT ``` -在使用 SquashFS 测试时,客户端偶尔会出现小状况。似乎是因为 SquashFS 在多处理器客户端上没法执行一个随机 I/O。(更多内容见 [squashfs 读取卡顿的奇怪案例][5])。如果你希望使用一个压缩文件系统来提升吞吐性能,[ZFS][6] 或许是个很好的选择。 +在使用 SquashFS 测试时,客户端偶尔会出现小状况。似乎是因为 SquashFS 在多处理器客户端上没法执行随机 I/O。(更多内容见 [squashfs 读取卡顿的奇怪案例][5])。如果你希望使用文件系统压缩来提升吞吐性能,[ZFS][6] 或许是个很好的选择。 如果你对 iSCSI 服务器的吞吐性能要求非常高(比如,成百上千的客户端要连接它),可能需要使用带 [负载均衡][7] 的 [Ceph][8] 集群了。更多相关内容,请查看 [使用 HAProxy 和 Keepalived 负载均衡的 Ceph 对象网关][9]。 ### 安装和配置 iSCSI -为了给我们的客户端提供网络引导镜像,安装 scsi-target-utils 包: +为了给我们的客户端提供网络引导镜像,安装 `scsi-target-utils` 包: ``` # dnf install -y scsi-target-utils ``` -配置 iSCSI 守护程序去提供 fc28.img 文件: +配置 iSCSI 守护程序去提供 `fc28.img` 文件: ``` # MY_REVERSE_HOSTNAME=$(echo $MY_HOSTNAME | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_HOSTNAME}) # cat << END > /etc/tgt/conf.d/fc28.conf - backing-store /fc28.img - readonly 1 + backing-store /fc28.img + readonly 1 END ``` -通过 /usr/lib/dracut/modules.d/40network/net-lib.sh 来指示预期的 iqn。 +开头的 `iqn.` 是 `/usr/lib/dracut/modules.d/40network/net-lib.sh` 所需要的。 添加一个防火墙例外,并启用和启动这个服务: @@ -242,7 +242,7 @@ END # systemctl start tgtd.service ``` -你现在应该能够使用 tatadm 命令看到这个共享后的镜像: +你现在应该能够使用 `tatadm` 命令看到这个镜像共享了: ``` # tgtadm --mode target --op show @@ -252,42 +252,42 @@ END ``` Target 1: iqn.edu.example.server-01:fc28 - System information: - Driver: iscsi - State: ready - I_T nexus information: - LUN information: - LUN: 0 - Type: controller - SCSI ID: IET 00010000 - SCSI SN: beaf10 - Size: 0 MB, Block size: 1 - Online: Yes - Removable media: No - Prevent removal: No - Readonly: No - SWP: No - Thin-provisioning: No - Backing store type: null - Backing store path: None - Backing store flags: -  LUN: 1 - Type: disk - SCSI ID: IET 00010001 - SCSI SN: beaf11 - Size: 10488 MB, Block size: 512 - Online: Yes - Removable media: No - Prevent removal: No - Readonly: Yes - SWP: No - Thin-provisioning: No - Backing store type: rdwr - Backing store path: /fc28.img - Backing store flags: - Account information: - ACL information: - ALL + System information: + Driver: iscsi + State: ready + I_T nexus information: + LUN information: + LUN: 0 + Type: controller + SCSI ID: IET 00010000 + SCSI SN: beaf10 + Size: 0 MB, Block size: 1 + Online: Yes + Removable media: No + Prevent removal: No + Readonly: No + SWP: No + Thin-provisioning: No + Backing store type: null + Backing store path: None + Backing store flags: + LUN: 1 + Type: disk + SCSI ID: IET 00010001 + SCSI SN: beaf11 + Size: 10488 MB, Block size: 512 + Online: Yes + Removable media: No + Prevent removal: No + Readonly: Yes + SWP: No + Thin-provisioning: No + Backing store type: rdwr + Backing store path: /fc28.img + Backing store flags: + Account information: + ACL information: + ALL ``` 现在,我们可以去删除本系列文章的第一部分中创建的 NFS 共享了: @@ -300,11 +300,11 @@ Target 1: iqn.edu.example.server-01:fc28 # sed -i '/^\/fc28 /d' /etc/fstab ``` -你也可以删除 /fc28 文件系统,但为了以后进一步更新,你可能需要保留它。 +你也可以删除 `/fc28` 文件系统,但为了以后进一步更新,你可能需要保留它。 ### 更新 ESP 去使用 iSCSI 内核 -更新 ESP 去包含启用了 iSCSI 的 initramfs: +更新 ESP 去包含启用了 iSCSI 的 `initramfs`: ``` $ rm -vf $HOME/esp/linux/*.fc28.* @@ -313,7 +313,7 @@ $ cp $(find /fc28/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $MY_KRNL) $ cp $(find /fc28/boot -name 'init*' | grep -m 1 $MY_KRNL) $HOME/esp/linux/initramfs-$MY_KRNL.img ``` -更新 boot.cfg 文件去传递新的 root 和 netroot 参数: +更新 `boot.cfg` 文件去传递新的 `root` 和 `netroot` 参数: ``` $ MY_NAME=server-01.example.edu @@ -322,7 +322,7 @@ $ MY_ADDR=$(host -t A $MY_NAME | awk '{print $4}') $ sed -i "s! root=[^ ]*! root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc28-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc28!" $HOME/esp/linux/boot.cfg ``` -现在,你只需要从 $HOME/esp/linux 目录中复制更新后的文件到所有客户端系统的 ESP 中。你应该会看到类似下面屏幕截图的结果: +现在,你只需要从 `$HOME/esp/linux` 目录中复制更新后的文件到所有客户端系统的 ESP 中。你应该会看到类似下面屏幕截图的结果: ![][10] @@ -334,7 +334,7 @@ $ sed -i "s! root=[^ ]*! root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_E # cp -a /fc28 /fc29 ``` -Chroot 进入到镜像的新副本: +`chroot` 进入到镜像的新副本: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc29/$i; done @@ -401,7 +401,7 @@ END # tgt-admin --update ALL ``` -添加新内核并 initramfs 到 ESP: +添加新内核和 `initramfs` 到 ESP: ``` $ MY_KRNL=$(ls -c /fc29/lib/modules | head -n 1) @@ -409,7 +409,7 @@ $ cp $(find /fc29/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $MY_KRNL) $ cp $(find /fc29/boot -name 'init*' | grep -m 1 $MY_KRNL) $HOME/esp/linux/initramfs-$MY_KRNL.img ``` -更新 ESP 的 boot.cfg: +更新 ESP 的 `boot.cfg`: ``` $ MY_DNS1=192.0.2.91 @@ -426,7 +426,7 @@ boot || exit END ``` -最后,从我的 $HOME/esp/linux 目录中复制文件到所有客户端系统的 ESP 中去使用它吧! +最后,从我的 `$HOME/esp/linux` 目录中复制文件到所有客户端系统的 ESP 中去使用它吧! -------------------------------------------------------------------------------- @@ -435,13 +435,13 @@ via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/ 作者:[Gregory Bartholomew][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://fedoramagazine.org/author/glb/ [b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ +[1]: https://linux.cn/article-10379-1.html [2]: https://en.wikipedia.org/wiki/Active_Directory [3]: https://fedoramagazine.org/secure-nfs-home-directories-kerberos [4]: https://en.wikipedia.org/wiki/Sparse_file From 3bfca1be933cb7c42d2759ef5fbc234b9c00eed7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Dec 2018 22:48:06 +0800 Subject: [PATCH 0367/4278] PUB:20181212 How to Build a Netboot Server, Part 2.md @qhwdw https://linux.cn/article-10396-1.html --- .../20181212 How to Build a Netboot Server, Part 2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181212 How to Build a Netboot Server, Part 2.md (99%) diff --git a/translated/tech/20181212 How to Build a Netboot Server, Part 2.md b/published/20181212 How to Build a Netboot Server, Part 2.md similarity index 99% rename from translated/tech/20181212 How to Build a Netboot Server, Part 2.md rename to published/20181212 How to Build a Netboot Server, Part 2.md index af3487c169..ea136a4317 100644 --- a/translated/tech/20181212 How to Build a Netboot Server, Part 2.md +++ b/published/20181212 How to Build a Netboot Server, Part 2.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10396-1.html) [#]: subject: (How to Build a Netboot Server, Part 2) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) From c9dfca3c759dd96b0941943dac7e9f65ac366a72 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 10:39:19 +0800 Subject: [PATCH 0368/4278] PRF:20180128 Getting Linux Jobs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Ryze-Borgia 翻译的不错,不过有些细节可以再认真些。 --- .../talk/20180128 Getting Linux Jobs.md | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/translated/talk/20180128 Getting Linux Jobs.md b/translated/talk/20180128 Getting Linux Jobs.md index 1f7b5791af..9bfaf0e1e5 100644 --- a/translated/talk/20180128 Getting Linux Jobs.md +++ b/translated/talk/20180128 Getting Linux Jobs.md @@ -1,80 +1,81 @@ Linux 求职建议 ====== -通过对招聘网站数据的仔细研究,我们发现,即使是非常有经验的 Linux 程序员,也很难在面试中表现的很出色。 +通过对招聘网站数据的仔细研究,我们发现,即使是非常有经验的 Linux 程序员,也会在面试中陷入困境。 -这就导致了很多优秀并且有经验的人找不到合适的工作,所以我们可能需要一些手段来提高自己的竞争力。 +这就导致了很多优秀并且有经验的人无缘无故地找不到合适的工作,因为如今的就业市场需要我们有一些手段来提高自己的竞争力。 -我有两个同事和一个表哥,他们都有 RedHat 认证,管理过比较大的服务器机房,也都收到过老员工的推荐。 +我有两个同事和一个表哥,他们都有 RedHat 认证,管理过比较大的服务器机房,也都收到过前雇主的认真推荐。 -可是,在他们应聘的时候,所有的这些证书、本身的能力、工作经验好像都没有起到任何作用,他们面对的是一些 -从术语列表中临时挑选的一些技术词汇片段所组成的问题。 +可是,在他们应聘的时候,所有的这些证书、本身的能力、工作经验好像都没有起到任何作用,他们所面对的招聘广告是某人从技术词汇中临时挑选的一些“技能片段”所组成的。 -现如今,礼貌变得过时了,**不回应**变成了公司招人时最好的沟通方式。 +现如今,礼貌变得过时了,**不回应**变成了发布招聘广告的公司的新沟通方式。 这同样也意味着大多公司的招聘或者人事可能会**错过**非常优秀的应聘者。 我之所以敢说的如此肯定,是因为现在招聘广告大多数看上去都非常的滑稽。 -Walter ,[Reallylinux.com][3] 另一位特约撰稿人,发表过一篇关于 [招聘广告疯掉了][4] 的文章。 +[Reallylinux.com][3] 另一位特约撰稿人 Walter ,发表过一篇关于 [招聘广告疯掉了][4] 的文章。 -他说的没错,可是我认为 Linux 工作应聘者可以通过注意招聘广告的**三个关键词**避免落入陷阱。 +他说的也许是对的,可是我认为 Linux 工作应聘者可以通过注意招聘广告的**三个关键点**避免落入陷阱。 -首先,很少会有 Linux 领域的招聘广告只对 Linux 有要求 。 +**首先**,很少会有 Linux 系统管理员的招聘广告只针对 Linux 有要求。 -一定要注意 Linux 相关工作的工作场合,公司很有可能会要求你在服务器上跑 Linux ,另外,通过 “Linux” 搜索得到的结果有很多实际上是会涉及到 NX (数字化产品开发系统)的。 +一定要注意很少有 Linux 系统管理员的职位是实际在服务器上跑 Linux的,反而,很多在搜索 “Linux 管理员” 得到的职位实际上是指大量的 *NX 操作系统的。 -举个例子,现在有一则关于 **Linux 管理员招聘** 的招聘广告: -参与建立系统集成,尤其是 BSD 应用的系统安装... +举个例子,有一则关于 **Linux 管理员** 的招聘广告: + +> 该职位需要为建立系统集成提供支持,尤其是 BSD 应用的系统安装... 或者有一些其他的要求: -有 Windows 系统管理经验的 -最为讽刺的是,如果你在应聘面试的时候表现出精通 Linux 的话,你可能不会被聘用。 +> 有 Windows 系统管理经验的。 -另外,如果你直接把 Linux 写在你的特长或者专业上,他们可能都不会仔细看你的简历,因为他们根本区分不了 UNIX, BSD, Linux。 +最为讽刺的是,如果你在应聘面试的时候表现出专注于 Linux 的话,你可能不会被聘用。 -最终的结果就是,如果你只在简历上写了 Linux ,你可能会被直接掉,但是如果你改成 UNIX/Linux 的话,可能会走得更远。 +另外,如果你直接把 Linux 写在你的特长或者专业上,他们可能都不会仔细看你的简历,因为他们根本区分不了 UNIX、BSD、Linux。 -我有两个同事最后修改了他们的简历,然后获得了更好的面试机会,但是依旧没有被聘用,因为大多数招聘广告其实已经内定人员了,这些招聘信息被放出来仅仅是为了表现出他们有招聘的想法。 +最终的结果就是,如果你太老实,只在简历上写了 Linux,你可能会被直接过掉,但是如果你把 Linux 改成 UNIX/Linux 的话,可能会走得更远。 -第二点,公司里真正需要了解系统管理的只有特聘的科技主管,其他人包括人事或管理层根本不关心这个。 +我有两个同事最后修改了他们的简历,然后获得了更好的面试机会,虽然依旧没有被聘用,因为大多数招聘广告其实已经内定人员了,这些招聘信息被放出来仅仅是为了表现出他们有招聘的想法。 -我记得有一次开会的时候,听见一个执行副总裁把服务器管理人员说成“一毛钱一打的人”,这种想法是多么的奇怪啊。 +**第二点**,公司里唯一在乎系统管理员职位的只有技术主管,其他人包括人事或管理层根本不关心这个。 -讽刺的是,等到邮件系统出故障,交换机连接时不时会断开,或者核心商业文件从企业内网中消失的时候,这些总裁又是最先打电话给系统管理员的。 +我记得有一次开会旁听的时候,听见一个执行副总裁把服务器管理人员说成“一毛钱一打的人”,这种想法是多么的奇怪啊。 -或许如果他们不整天说些空话,或者不往邮件里塞满妻子的照片和旅行途中的照片的话,服务器可能就不会崩溃。 +讽刺的是,等到邮件系统出故障,电话交换机连接时不时会断开,或者核心商业文件从企业内网中消失的时候,这些总裁又是最先打电话给系统管理员的。 -在找工作的时候一定要关注招聘 Linux 运维或者服务器管理人员的广告,因为这种一般都是在公司技术层有迫切的需求的时候才会有的。你也不需要和人事或者公司高层聊什么,搞清楚谁要招聘然后打电话给他们。 +或许如果他们不整天在电话留言中说那么多空话,或者不往邮件里塞满妻子的照片和旅行途中的照片的话,服务器可能就不会崩溃。 -你需要直接联系他们因为有些技术问题人事是解决不了的,即使你只有 60 秒的时间可以和他们交流,你也必须抓住这个机会和真正有需求并且懂技术的人沟通。 +请注意,招聘 Linux 运维或者服务器管理员的广告被放出来是因为公司**技术层**认为有迫切的需求。你也不需要和人事或者公司高层聊什么,搞清楚谁是招聘的技术经理然后打电话给他们。 -那如果人事不让你进怎么办呢? +你需要直接联系他们因为“有些技术问题”是人事回答不了的,即使你只有 60 秒的时间可以和他们交流,你也必须抓住这个机会和真正有需求并且懂技术的人沟通。 -记得问人事一些技术性问题,比如说他们的 Linux 群组是如何建立的,能不能独立运行虚拟机。这些技术性的问题会让人事变得不耐烦,最后让你有机会问出“我能不能直接联系你们团队的技术人员”。 +那如果人事的漂亮 MM 不让你直接联系技术怎么办呢? -如果对方的回答是“应该可以”或者“稍后回复你”,那么他们可能已经在两周前就已经计划好了找一个人来填补这个空缺,比如说人事部员工的未婚夫。他们只是不希望看起来太像裙带主义,而是带有一点利己主义的不确定主义。 +开始记得问人事一些技术性问题,比如说他们的 Linux 集群是如何建立的,它们运行在独立的虚拟机上吗?这些技术性的问题会让人事变得不耐烦,最后让你有机会问出“我能不能直接联系你们团队的技术人员”。 -所以一定要记得花点时间弄清楚到底谁是发布招聘广告的直接技术负责人然后和他们聊一聊,这可能会让你少一番胡扯并且让你更有可能应聘成功。 +如果对方的回答是“应该可以”或者“稍后回复你”,那么他们可能已经在两周前就已经计划好了找一个人来填补这个空缺,比如说人事部员工的未婚夫。**他们只是不希望看起来太像裙带主义,而是带有一点利己主义的不确定主义。** -第三点,现在的广告很少有完全真实的内容了。 +所以一定要记得花点时间弄清楚到底谁是发布招聘广告的直接**技术**负责人,然后和他们聊一聊,这可能会让你少一番胡扯并且让你更有可能应聘成功。 -我以前见过一个招聘具有高级专家所不具备的专门知识的初级系统管理员的广告,计划是列出公司的发展计划蓝图,然后找到应聘者。 +**第三点**,现在的招聘广告很少有完全真实的内容了。 + +我以前见过一个招聘具有高级别专家也不会有的专门知识的初级系统管理员的广告,他们的计划是列出公司的发展计划蓝图,然后找到应聘者。 在这种情况下,你应聘 Linux 管理员职位应该提供几个关键性信息,例如工作经验和相关证书。 -诀窍在于,在你的简历中给出与他们的招聘信息相匹配的关键词,这样他们就基本找不到你存在的问题。 +诀窍在于,用这些关键词尽量装点你的简历,以匹配他们的招聘信息,这样他们几乎不可能发现你缺失了哪个关键词。 这并不一定会让你成功找到一份工作,但它可以让你获得一次面试机会,这也算是一个巨大的进步。 -通过理解和应用以上三点,或许可以让那些寻求 Linux 管理员工作的人能够比那些在地狱中只有一线希望的人有一个好的开始。 +通过理解和应用以上三点,或许可以让那些寻求 Linux 管理员工作的人能够比那些只有一线地狱机会的人领先一步。 即使这些建议不能让你马上得到面试机会,你也可以利用这些经验和意识去参加贸易展或公司主办的技术会议等活动。 -我强烈建议你们也经常参加这种活动,尤其是当它们时间比较接近的时候,可以给你一个扩展人脉的机会。 +我强烈建议你们也经常参加这种活动,尤其是当它们比较近的话,可以给你一个扩展人脉的机会。 -请记住,如今的“求职网日”已经失去了原来的意义了,现在只是可以用来获取“哪些公司实际上在招聘、哪些公司只是为了给股东带来增长的表象而在工作方面撒谎”的小道消息。 +请记住,如今的职业人脉已经失去了原来的意义了,现在只是可以用来获取“哪些公司实际上在招聘、哪些公司只是为了给股东带来增长的表象而在职位方面撒谎”的小道消息。 -------------------------------------------------------------------------------- @@ -83,7 +84,7 @@ via: http://reallylinux.com/docs/gettinglinuxjobs.shtml 作者:[Andrea W.Codingly][a] 译者:[Ryze-Borgia](https://github.com/Ryze-Borgia) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3a7cb9df70db0aff71d014f9101c05593116e309 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 10:39:44 +0800 Subject: [PATCH 0369/4278] PUB:20180128 Getting Linux Jobs.md @Ryze-Borgia https://linux.cn/article-10397-1.html --- {translated/talk => published}/20180128 Getting Linux Jobs.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180128 Getting Linux Jobs.md (100%) diff --git a/translated/talk/20180128 Getting Linux Jobs.md b/published/20180128 Getting Linux Jobs.md similarity index 100% rename from translated/talk/20180128 Getting Linux Jobs.md rename to published/20180128 Getting Linux Jobs.md From a56d94e73f20c3181657965046c8523dcc061f99 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 11:15:04 +0800 Subject: [PATCH 0370/4278] PRF:20181206 Take a break at the Linux command line with Nyan Cat.md @zhs852 --- ...at the Linux command line with Nyan Cat.md | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md index 81e74a8a13..abb0559790 100644 --- a/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md +++ b/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -1,41 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Take a break at the Linux command line with Nyan Cat) [#]: via: (https://opensource.com/article/18/12/linux-toy-nyancat) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) [#]: url: ( ) -在 Linux 命令行中观看 Nyan Cat 来稍适休息 +在 Linux 命令行中观看彩虹猫来稍事休息 ====== + > 你甚至可以在终端里欣赏彩虹猫。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nyancat.png?itok=eg1aEmBw) 今天是《Linux 命令行小玩具介绍》的第六天。在本系列文章中,我们将会探索一些娱乐用途(甚至有时完全没用)的 Linux 命令行小玩具。所有我们介绍的小玩具都是开源的。 -也许你会问,他们都很独特吗?是的。不过,他们对你是否独特,我就不知道了。但是,我们相信你应该能在这系列文章结束之前找到至少一个好玩的玩具。 +也许你会问,它们都很独特吗?是的。不过,它们对你是否独特,我就不知道了。但是,我们相信你应该能在这系列文章结束之前找到至少一个好玩的玩具。 从[昨天的选题][1]继续:我们谈到了猫和彩虹。不过,在 Linux 命令行下有更有趣的彩虹和猫结合的程序吗?答案是肯定的。 -我们不妨看看之前可以在命令行中使用 Nyan Cat 的方式吧。意料之中,2011 年发布的 [Nyan Cat][2] 可以用 **nyancat** 呈现在终端中。你想念这只曾火遍网络的 Nyan Cat 吗?看看下面这个视频记录吧,我会等你看完的。 +我们不妨看看之前可以在命令行中使用彩虹猫的方式吧。意料之中,2011 年发布的 [彩虹猫][2] 可以用 `nyancat` 呈现在终端中。你想念这只曾火遍网络的彩虹猫吗?看看下面这个视频记录吧,我会等你看完的。 - +- -现在,让我们在终端中重新感受这个令人惊奇的体验吧。**Nyancat** 包正在很多地方被分发(比如 Arch、Debian、Gentoo、Ubuntu 等等…),不过我的系统(Fedora)没有,但是我们仍然可以很轻松地从源码编译它。事实上,我们只需要一行命令就能做完所有工作: +现在,让我们在终端中重新感受这个令人惊奇的体验吧。`nyancat` 包正在很多发行版上(比如 Arch、Debian、Gentoo、Ubuntu 等等……)都有,不过我的系统(Fedora)没有,但是我们仍然可以很轻松地从源码编译它。 + +根据读者的一个很好的提醒,对于我来说,这应该在该系列中提及:要警惕从不受信任的来源安装应用程序,或者编译和运行你在网上找到的任何代码,就像你在这样的文章中找到这个一样。如果您不确定,请采取适当的预防措施,特别是如果您在生产机器上。 + +从这里克隆源代码: ``` -git clone https://github.com/klange/nyancat.git && cd nyancat && make && cd src && ./nyancat +git clone https://github.com/klange/nyancat.git ``` -这直接为我带来了一个 Nyan Cat 体验,甚至还有个计时器来显示我享受 “Nyan Cat 魔法”的时间。 +然后使用 `make` 编译,并用 `./nyancat` 来运行。 + +这直接为我带来了彩虹猫体验,甚至还有个计时器来显示我享受 “彩虹猫魔法”的时间。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-nyancat-animated.gif) -你可以在 [GitHub][3] 上找到 **nyancat** 的源码,它正以 [NCSA 许可证][4] 开源。 +你可以在 [GitHub][3] 上找到 `nyancat` 的源码,它正以 [NCSA 许可证][4] 开源。 -命令行版本的 Nyan Cat 可在[这个公共 Telnet 服务器上访问][5](或者 [netcat][6] 也行),所以理论上来说你不必安装它。不过不幸的是,由于带宽限制,该服务器目前已经被关闭了。尽管如此,在各种老设备上连接老 Telnet 服务器上运行 Nyan Cat 的[照片][5]还是值得一看的,说不准你还会萌生搭建一个能让大家连接的公共服务器的想法呢(如果你真的搭建了,请务必告知作者,万一他们可能会向公众分享呢?)。 +命令行版本的彩虹猫可在[这个公共 Telnet 服务器上访问][5](或者用另外一个猫 [netcat][6] 也行),所以理论上来说你不必安装它。不过不幸的是,由于带宽限制,该服务器目前已经被关闭了。尽管如此,在各种老设备上连接老 Telnet 服务器上运行彩虹猫的[照片][5]还是值得一看的,说不准你还会萌生搭建一个能让大家连接的公共服务器的想法呢(如果你真的搭建了,请务必告知作者,万一他们可能会向公众分享呢?)。 你想让我介绍一下你最喜爱的命令行玩具吗?请在原文下留言,作者会考虑介绍的。 @@ -48,7 +55,7 @@ via: https://opensource.com/article/18/12/linux-toy-nyancat 作者:[Jason Baker][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 c03a6f617a341f1f20caac85e1b7dd18aa7c410d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 11:15:55 +0800 Subject: [PATCH 0371/4278] PUB:20181206 Take a break at the Linux command line with Nyan Cat.md @zhs852 https://linux.cn/article-10398-1.html --- ...06 Take a break at the Linux command line with Nyan Cat.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181206 Take a break at the Linux command line with Nyan Cat.md (98%) diff --git a/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/published/20181206 Take a break at the Linux command line with Nyan Cat.md similarity index 98% rename from translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md rename to published/20181206 Take a break at the Linux command line with Nyan Cat.md index abb0559790..78674925a6 100644 --- a/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md +++ b/published/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Take a break at the Linux command line with Nyan Cat) [#]: via: (https://opensource.com/article/18/12/linux-toy-nyancat) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10398-1.html) 在 Linux 命令行中观看彩虹猫来稍事休息 ====== From fffdab2919ac6a970220af95710d80a61021c465 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 19:33:54 +0800 Subject: [PATCH 0372/4278] PRF:20180716 Users, Groups and Other Linux Beasts- Part 2.md @MjSeven --- ..., Groups and Other Linux Beasts- Part 2.md | 51 +++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md index c4f20dbf77..b71802c145 100644 --- a/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md +++ b/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md @@ -1,30 +1,35 @@ -用户、组及其他 Linux 特性:第二部分 +用户、组及其它 Linux 特性(二) ====== +> 我们继续创建和管理用户和组的 Linux 教程之旅。 -![](https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2) +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ducks-94911_1920.jpg?itok=7_ZPiph7) -在正在进行的 Linux 之旅中,我们了解了[如何操作文件夹或目录][1],现在我们继续讨论 _权限_,_用户_ 和 _组_,这对于确定谁可以操作哪些文件和目录是必要的。[上次][2],我们展示了如何创建新用户,现在我们将重新来一遍: +在正在进行的 Linux 之旅中,我们了解了[如何操作文件夹或目录][1],现在我们继续讨论 _权限_、_用户_ 和 _组_,这对于确定谁可以操作哪些文件和目录是必要的。[上次][2],我们展示了如何创建新用户,现在我们将重新起航: 你可以使用 `groupadd` 命令创建新组,然后随意添加用户。例如,使用: + ``` sudo groupadd photos ``` -这将会创建 _photos_ 组。 +这将会创建 `photos` 组。 你需要在根目录下[创建一个目录][1]: + ``` sudo mkdir /photos ``` 如果你运行 `ls -l /`,结果中会有如下这一行: + ``` drwxr-xr-x 1 root root 0 jun 26 21:14 photos ``` -输出中的第一个 _root_ 是所属的用户,第二个 _root_ 是所属的组。 +输出中的第一个 `root` 是所属的用户,第二个 `root` 是所属的组。 + +要将 `/photos` 目录的所有权转移到 `photos` 组,使用: -要将 _/photos_ 目录的所有权转移到 _photos_ 组,使用: ``` chgrp photos /photos ``` @@ -32,49 +37,53 @@ chgrp photos /photos `chgrp` 命令通常采用两个参数,第一个参数是将要获得文件或目录所有权的组,第二个参数是希望交给组的文件或目录。 接着,运行 `ls -l /`,你会发现刚才那一行变了: + ``` drwxr-xr-x 1 root photos 0 jun 26 21:14 photos ``` -你已成功将新目录的所有权转移到了 _photos_ 组。 +你已成功将新目录的所有权转移到了 `photos` 组。 + +然后,将你自己的用户和 `guest` 用户添加到 `photos` 组: -然后,将你自己的用户和 _guest_ 用户添加到 _photos_ 组: ``` sudo usermod <你的用户名> -a -G photos sudo usermod guest -a -G photos ``` -你可能必须注销并重新登录才能看到更改,但是当你这样做时,运行 `groups` 会将 _photos_ 显示为你所属的组之一。 +你可能必须注销并重新登录才能看到更改,但是当你这样做时,运行 `groups` 会将 `photos` 显示为你所属的组之一。 + +关于上面提到的 `usermod` 命令,需要指明几点。第一:注意要使用 `-G` 选项而不是 `-g` 选项。`-g` 选项更改你的主要组,如果你意外地使用它,它可能会锁定你的一些东西。另一方面,`-G` 将你添加到列出的组中,并没有干扰主要组。如果要将用户添加到多个组中,在 `-G` 之后逐个列出它们,用逗号分隔,不要有空格: -(to 校正:这里的 primary group 翻译成什么更好点呢) -关于上面提到的 `usermod` 命令,需要指明几点。第一:注意要使用 `-G` 选项而不是 `-g` 选项。`-g` 选项更改你的主要组,如果你意外地使用它,它可能会锁定你的一些东西。另一方面,`-G` 将你 _添加(add)_ 到列出的组中,并没有干扰主要组。如果要将用户添加到多个组中,在 `-G` 之后逐个列出他们,用逗号分隔,不要有空格: ``` sudo usermod -a -G photos,pizza,spaceforce ``` -第二点:小心点不要忘记 `-a` 参数。`-a` 参数代表 _追加(append)_,将你传递给 `-G` 的组列表附加到你已经属于的组。这意味着,如果你不包含 `-a`,那么你之前所属的组列表将被覆盖,再次将你从你需要的东西中锁定。(to 校正:最后这句话什么意思呢) +第二点:小心点不要忘记 `-a` 参数。`-a` 参数代表追加,将你传递给 `-G` 的组列表附加到你已经属于的组。这意味着,如果你不包含 `-a`,那么你之前所属的组列表将被覆盖,再次将你拒之门外。 -这些都不是灾难性问题,但这意味着你必须手动将用户添加回你所属的所有组,这可能是个麻烦,特别是如果你失去了对 _sudo_ 和 _wheel_ 组的访问权限。 +这些都不是灾难性问题,但这意味着你必须手动将用户添加回你所属的所有组,这可能是个麻烦,特别是如果你失去了对 `sudo` 和 `wheel` 组的访问权限。 ### 权限 -在将图像复制到 _/photos_ 目录之前,还要做一件事情。注意,当你执行上面的 `ls -l /` 时,该文件夹的权限将以 _drwxr-xr-x_ 形式返回。 +在将图像复制到 `/photos` 目录之前,还要做一件事情。注意,当你执行上面的 `ls -l /` 时,该文件夹的权限将以 `drwxr-xr-x` 形式返回。 -如果你阅读[我在本文开头推荐的文章][3],你将知道第一个 _d_ 表示文件系统中的条目是一个目录,接着你有三组三个字符 (_rwx_, _r-x_, _r-x_),它们表示目录的所属用户 (_rwx_) 的权限,然后是所属组 (_r-x_)的权限,最后是其他用户 (_r-x_) 的权限。这意味着到目前为止唯一具有写权限的人,即能够在 _/photos_ 目录中复制或创建文件的唯一人员是 _root_ 用户。 +如果你阅读[我在本文开头推荐的文章][3],你将知道第一个 `d` 表示文件系统中的条目是一个目录,接着你有三组三个字符(`rwx`、`r-x`、`r-x`),它们表示目录的所属用户(`rwx`)的权限,然后是所属组(`r-x`)的权限,最后是其他用户(`r-x`)的权限。这意味着到目前为止唯一具有写权限的人,即能够在 `/photos` 目录中复制或创建文件的唯一人员是 `root` 用户。 但是[我提到的那篇文章也告诉你如何更改目录或文件的权限][3]: + ``` sudo chmod g+w /photos ``` -运行 `ls -l /`,你会看到 _/photos_ 权限变为了 _drwxrwxr-x_。这就是你希望的:组成员现在可以对目录进行写操作了。 +运行 `ls -l /`,你会看到 `/photos` 权限变为了 `drwxrwxr-x`。这就是你希望的:组成员现在可以对目录进行写操作了。 现在你可以尝试将图像或任何其他文件复制到目录中,它应该没有问题: + ``` cp image.jpg /photos ``` -_guest_ 用户也可以从目录中读取和写入。他们也可以读取和写入,甚至移动或删除共享目录中其他用户创建的文件。(to 校正:这里 guest 可以从目录中读取和写入吗?guest 不应该是 r-x 权限吗?) +`guest` 用户也可以从目录中读取和写入。他们也可以读取和写入,甚至移动或删除共享目录中其他用户创建的文件。 ### 总结 @@ -84,7 +93,7 @@ Linux 中的权限和特权系统已经磨练了几十年,它继承自昔日 回头见! -通过 Linux 基金会和 edX 的免费[" Linux 简介"][4]课程了解有关 Linux 的更多信息。 +通过 Linux 基金会和 edX 的免费[“Linux 简介”][4]课程了解有关 Linux 的更多信息。 -------------------------------------------------------------------------------- @@ -94,12 +103,12 @@ via: https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-oth 作者:[Paul Brown][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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/) 荣誉推出 [a]:https://www.linux.com/users/bro66 -[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux -[2]:https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts +[1]:https://linux.cn/article-10066-1.html +[2]:https://linux.cn/article-10370-1.html [3]:https://www.linux.com/learn/understanding-linux-file-permissions [4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 682e52dc1fc4cdec5629af8790af60e8104ce8fa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 19:34:14 +0800 Subject: [PATCH 0373/4278] PUB:20180716 Users, Groups and Other Linux Beasts- Part 2.md @MjSeven https://linux.cn/article-10399-1.html --- .../20180716 Users, Groups and Other Linux Beasts- Part 2.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180716 Users, Groups and Other Linux Beasts- Part 2.md (100%) diff --git a/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/published/20180716 Users, Groups and Other Linux Beasts- Part 2.md similarity index 100% rename from translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md rename to published/20180716 Users, Groups and Other Linux Beasts- Part 2.md From 7d70f5891f949b2c76a4f4841fac43c6a66d46f4 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Sun, 30 Dec 2018 20:27:38 +0800 Subject: [PATCH 0374/4278] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=2020180625=208=20reasons=20to=20use=20the=20Xfce=20Linux=20des?= =?UTF-8?q?ktop=20environment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 20180625 8 reasons to use the Xfce Linux desktop environment.md --- ...80625 8 reasons to use the Xfce Linux desktop environment.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md index 254f725a36..974faa1f75 100644 --- a/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ b/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -1,3 +1,5 @@ +translating by WangYueScream +=========================== 8 reasons to use the Xfce Linux desktop environment ====== From 6cd035ec1a0028c16ffd633ac0ccae06438f8b6b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 00:17:33 +0800 Subject: [PATCH 0375/4278] PRF:20180130 Graphics and music tools for game development.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @robsean 翻译的不够认真,希望下回再接再厉。 --- ...cs and music tools for game development.md | 98 ++++++++++--------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/translated/tech/20180130 Graphics and music tools for game development.md b/translated/tech/20180130 Graphics and music tools for game development.md index 1cdb157bc4..7e77e30d67 100644 --- a/translated/tech/20180130 Graphics and music tools for game development.md +++ b/translated/tech/20180130 Graphics and music tools for game development.md @@ -1,133 +1,135 @@ 用于游戏开发的图形和音乐工具 ====== +> 要在三天内打造一个可玩的游戏,你需要一些快速而稳定的好工具。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Life_opengame.png?itok=JPxruL3k) -在十月初,我们的俱乐部,来自马歇尔大学的 [Geeks and Gadgets][1] , 参加就职 [Open Jam][2], 一个游戏 jam ,庆祝最好的开源工具。游戏 jams 是参与者为娱乐像团队协作的来开发计算机游戏的事件。Jams 倾向于非常简短--仅三天时间长--并非常让人精疲力尽。Opensource.com 在八月下旬 [宣布][3] Open Jam ,更多 [three dozen games][4] 进入到竞赛中。 +在十月初,我们的俱乐部马歇尔大学的 [Geeks and Gadgets][1] 参加了首次 [Open Jam][2],这是一个庆祝最佳开源工具的游戏 Jam。游戏 Jam 是一种活动,参与者以团队协作的方式来开发有趣的计算机游戏。Jam 一般都很短,仅有三天,并且非常累。Opensource.com 在八月下旬[发布了][3] Open Jam 活动,足有 [45 支游戏][4] 进入到了竞赛中。 -我们的俱乐部希望在我们的工程中创建和使用开放源码软件,所以 Open Jam 自然是我们想要参与的 jam 。我们的提交的文件是一个实验性的名称为 [Mark My Words][5] 的游戏。我们使用多种自由和开放源码 (FOSS) 工具来开发它;在这篇文章中,我们将讨论一些我们使用和意识到有潜在的障碍物的工具。 +我们的俱乐部希望在我们的项目中创建和使用开放源码软件,所以 Open Jam 自然是我们想要参与的 Jam 了。我们提交的游戏是一个实验性的游戏,名为 [Mark My Words][5]。我们使用了多种自由和开放源码 (FOSS) 工具来开发它;在这篇文章中,我们将讨论一些我们使用的工具和我们注意到可能有潜在阻碍的地方。 ### 音频工具 #### MilkyTracker -[MilkyTracker][6] 是最好的可用于构成旧样式电子游戏音乐的软件包中的一个。它是一个 [music tracker][7] 的一个示例,一个强大的带有特殊的基于网格的图形编辑器的 MOD 和 XM 文件创建器。在我们的游戏中,我们使用它来构成大多数的音乐片段。这个程序最好的特点是,它比我们其它的大多数工具消耗更少的硬盘空间和 RAM 。虽然如此,MilkyTracker 仍然非常强大。 +[MilkyTracker][6] 是一个可用于编曲老式视频游戏中的音乐的软件包。它是一种[音乐声道器][7]music tracker,是一个强大的 MOD 和 XM 文件创建器,带有基于特征网格的模式编辑器。在我们的游戏中,我们使用它来编曲大多数的音乐片段。这个程序最好的地方是,它比我们其它的大多数工具消耗更少的硬盘空间和内存。虽然如此,MilkyTracker 仍然非常强大。 ![](https://opensource.com/sites/default/files/u128651/mtracker.png) -用户界面需要一会来习惯,这里有对一些想试用MilkyTracker的音乐家的一些提示: +其用户界面需要一会来习惯,这里有对一些想试用 MilkyTracker 的音乐家的一些提示: - * 转到 Config > Misc. ,设置 edit 模式控制样式为 "MilkyTracker." 这将给你几乎所有的现代键盘快捷方式 - * 撤销 Ctrl+Z - * 重做 Ctrl+Y - * 切换 pattern-edit 模式 空格键 - * 删除先前的注释 退格键 - * 插入一行 Insert键 - * 默认情况下,一个注释将持续作用,直到它在这频道上被替换。你可以明确地结束一个注释,通过使用一个反引号 (`) 键插入一个 KeyOff 注释 - * 在你开始谱写乐曲前,你将不得不创建或查找示例。我们建议在网站上查找 [Creative Commons][8] 协议的示例,例如 [Freesound][9] 或 [ccMixter][10] + * 转到 “Config > Misc.” ,设置编辑模式的控制风格为 “MilkyTracker”,这将给你提供几乎全部现代键盘快捷方式。 + * 用 `Ctrl+Z` 撤销 + * 用 `Ctrl+Y` 重做 + * 用空格键切换模式编辑方式 + * 用退格键删除先前的音符 + * 用插入键来插入一行 + * 默认情况下,一个音符将持续作用,直到它在该频道上被替换。你可以明确地结束一个音符,通过使用一个反引号(`)键来插入一个 KeyOff 音符 + * 在你开始谱写乐曲前,你需要创建或查找采样。我们建议在诸如 [Freesound][9] 或 [ccMixter][10] 这样的网站上查找采用 [Creative Commons][8] 协议的采样, - - -另外,保持 [MilkyTracker 文档页面][11] 在手边。它含有数不清的教程和手册的链接。一个好的开始点是在该项目 wiki 上的 [MilkyTracker 指南][12] 。 +另外,把 [MilkyTracker 文档页面][11] 放在手边。它含有数不清的教程和手册的链接。一个好的起点是在该项目 wiki 上的 [MilkyTracker 指南][12]。 #### LMMS -我们中的两个音乐家使用多用途和现代音乐创建工具 [LMMS][13] 。它带来一个绝妙的示例和效果库,加一个灵活的多种多样的插件来生成独特的声音。 The learning curve for LMMS 的学习曲线令人吃惊的低,在某种程度上是因为友好的节拍/低音线编辑器。 +我们的两个音乐家使用多用途的现代音乐创建工具 [LMMS][13]。它带有一个绝妙的采样和效果库,以及多种多样的灵活的插件来生成独特的声音。LMMS 的学习曲线令人吃惊的低,在某种程度上是因为其好用的节拍/低音线编辑器。 ![](https://opensource.com/sites/default/files/u128651/lmms_plugins.png) -我们对音乐家有一个建议,尝试 LMMS:使用插件。 对于 [chiptune][14]-样式音乐,我们推荐 [sfxr][15] ,[BitInvader][16] ,和 [FreeBoy][17] 。对于其它样式, [ZynAddSubFX][18] 是一个好的选择。它带来一个宽波段的可以被你任意更改的人工合成工具。 +我们对于想试试 LMMS 的音乐家有一个建议:使用插件。对于 [chiptune][14]式音乐,我们推荐 [sfxr][15]、[BitInvader][16] 和 [FreeBoy][17]。对于其它风格,[ZynAddSubFX][18] 是一个好的选择。它配备了各种合成仪器,可以根据您的需要进行更改。 ### 图形工具 #### Tiled -在开放源码游戏开发中,[Tiled][19] 是一个流行的组件地图类(tilemap)编辑器。我们使用它为来为我们在游戏场景中组合连续的,复古的背景。 +在开放源码游戏开发中,[Tiled][19] 是一个流行的贴片地图编辑器。我们使用它为来为我们在游戏场景中组合连续的、复古式的背景。 ![](https://opensource.com/sites/default/files/u128651/tiled.png) -Tiled 可以导出地图为 XM L,JSON ,或平坦的图像。它是稳定的和跨平台的。 +Tiled 可以导出地图为 XML、JSON 或普通的图片。它是稳定的、跨平台的。 -Tiled 的特征一,在 jam 期间,我们不能使用, 允许你定义和随意的放置游戏对象,例如硬币和永久能力提升道具到地图上。你需要做的全部是加载对象的图像为一个平铺显示集,然后使用插入平铺显示放置它们。 +Tiled 的功能之一允许你在地图上定义和放置随意的游戏对象,例如硬币和提升道具,但在 jam 期间我们没有使用它。你需要做的全部是以贴片集的方式加载对象的图像,然后使用“插入平铺”来放置它们。 -一般来说,对于一些需要一个地图编辑器的工程,Tiled 是我们建议软件的一个主要的部分。 +一般来说,对于需要一个地图编辑器的项目,Tiled 是我们所推荐的软件中一个不可或缺的部分。 #### Piskel -[Piskel][20] 是一个像素艺术编辑器,它的源文件代码是在 [Apache 协议, 版本 2.0][21] 协议下。在 jam 期间,我们对我们的大多数的图像资源使用 Piskel ,我们当然也将在未来的工程中使用它。 +[Piskel][20] 是一个像素艺术编辑器,它的源文件代码以 [Apache 2.0 协议][21] 发布。在这次 Jam 期间,们的大多数的图像资源都使用 Piskel 来处理,我们当然也将在未来的工程中使用它。 -Piskel 的特征二,在 jam 的 onion skin和Spritesheet导出期间极大地帮助我们。 +在这个 Jam 期间,Piskel 极大地帮助我们的两个功能是洋葱皮Onion skin精灵序列图spritesheet导出。 -##### Onion skin +##### 洋葱皮 -onion skin 特征将使 Piskel 显示你编辑的动画的前一帧和后一帧的一个幽灵似的覆盖物,像这样: +洋葱皮功能将使 Piskel 以虚影显示你编辑的动画的前一帧和后一帧的,像这样: ![](https://opensource.com/sites/default/files/u128651/onionshow.gif) -Onion skin 是便于使用的,因为它适合作为一个绘制指南和在动画进程期间帮助你维护在你的角色上连续的图形和声音。为启用它,只需要在屏幕的右上方预览窗体的下面单击 onion-shaped 图标。 +洋葱皮是很方便的,因为它适合作为一个绘制指引和帮助你在整个动画进程中保持角色的一致形状和体积。 要启用它,只需单击屏幕右上角预览窗口下方的洋葱形图标即可。 ![](https://opensource.com/sites/default/files/u128651/onionenable.png) -##### Spritesheet 导出 +##### 精灵序列图导出 -Piskel 的能力是导出动画为一个 spritesheet ,也是非常有用的。一个 spritesheet 是一个单个光栅图象,它包含一个动画的所有的帧。例如,这是一个我们从 Piskel 导出的 spritesheet : +Piskel 将动画导出为精灵序列图的能力也非常有用。精灵序列图是一个包含动画所有帧的光栅图像。例如,这是我们从 Piskel 导出的精灵序列图: ![](https://opensource.com/sites/default/files/u128651/sprite-artist.png) -spritesheet 包含两幅帧。一幅帧是图像的上半部分,另一帧是图像的下半部分。Spritesheets 通过启用一个完整的动画来从单个文件加载,大大地简化一个游戏的代码。这是上面的 spritesheet 的一个动画版本: +该精灵序列图包含两帧。一帧位于图像的上半部分,另一帧位于图像的下半部分。精灵序列图通过从单个文件加载整个动画,大大简化了游戏的代码。这是上面精灵序列图的动画版本: ![](https://opensource.com/sites/default/files/u128651/sprite-artist-anim.gif) ##### Unpiskel.py -在 jam 期间,我们很多次想批量转换 Piskel 文件到 PNG 文件。尽管 Piskel 文件格式基于 JSON ,我们写一个小的 GPLv3 协议的称为 [unpiskel.py][22] 的 Python 脚本来做转换。 +在 Jam 期间,我们很多次想批量转换 Piskel 文件到 PNG 文件。由于 Piskel 文件格式基于 JSON,我们写一个基于 GPLv3 协议的名为 [unpiskel.py][22] 的 Python 小脚本来做转换。 + +它像这样被调用的: -它像这样被引用: ``` python unpiskel.py input.piskel ``` -这个脚本将从一个 Piskel 文件(这里 `input.piskel`)中提取 PNG 数据帧和层,并存储它们在它们拥有的文件中。这些文件采用模式 `NAME_XX_YY.png` ,在这里 `NAME` 是 Piskel 文件的缩减名称,`XX` 是帧的编号,`YY` 是层的编号。 +这个脚本将从一个 Piskel 文件(这里是 `input.piskel`)中提取 PNG 数据帧和图层,并将它们各自存储。这些文件采用模式 `NAME_XX_YY.png` 命名,在这里 `NAME` 是 Piskel 文件的缩减名称,`XX` 是帧的编号,`YY` 是层的编号。 + +因为脚本可以从一个 shell 中调用,它可以用在整个文件列表中。 -因为脚本可以从一个 shell 中引用,它可以被使用在文件的整个列表中。 ``` for f in *.piskel; do python unpiskel.py "$f"; done ``` -### Python, Pygame, 和 cx_Freeze +### Python、Pygame 和 cx_Freeze #### Python 和 Pygame -我们使用 [Python][23] 语言来自制作我们的游戏。它是一个脚本语言,通常被用于文本处理和桌面应用程序开发。它也可以用于游戏开发,例如工程,像 [Angry Drunken Dwarves][24] 和 [Ren'Py][25] 已经显示。这两个工程都使用一个称为 [Pygame][26] 的 Python 库来显示图形和产生声音,所以我们也决定在 Open Jam 中使用这个库。 +我们使用 [Python][23] 语言来制作我们的游戏。它是一个脚本语言,通常被用于文本处理和桌面应用程序开发。它也可以用于游戏开发,例如像 [Angry Drunken Dwarves][24] 和 [Ren'Py][25] 这样的项目所展示的。这两个项目都使用一个称为 [Pygame][26] 的 Python 库来显示图形和产生声音,所以我们也决定在 Open Jam 中使用这个库。 -Pygame 被证明是既稳定又富有特色,并且它对我们创建的街机游戏来说是优秀的。在低分辨率时,库的速度足够快的,但是在高分辨率时,它的仅 CPU 渲染开始变慢。这是因为 Pygame 不使用硬件加速渲染。然而,开发者可以充分利用 OpenGL 基础设施。 +Pygame 被证明是既稳定又富有特色,并且它对我们创建的街机式游戏来说是很棒的。在低分辨率时,库的速度足够快的,但是在高分辨率时,它只用 CPU 的渲染开始变慢。这是因为 Pygame 不使用硬件加速渲染。然而,开发者可以充分利用 OpenGL 基础设施的优势。 -如果你正在寻找一个好的 2D 游戏编程库,Pygame 是值得密切注意的一个。它的网站有 [一个好的教程][27] 来开始。务必看看它! +如果你正在寻找一个好的 2D 游戏编程库,Pygame 是值得密切注意的一个。它的网站有 [一个好的教程][27] 可以作为起步。务必看看它! #### cx_Freeze -准备发行我们的游戏是有趣的。我们知道,Windows 用户不喜欢有一个 Python 安装,并且要求他们来安装它可能很过分。除此之外,他们也可能不得不安装 Pygame ,在 Windows 上,这不是一个简单的工作。 +准备发行我们的游戏是有趣的。我们知道,Windows 用户不喜欢装一套 Python,并且要求他们来安装它可能很过分。除此之外,他们也可能必须安装 Pygame,在 Windows 上,这不是一个简单的工作。 -有一件事很清楚:我们不得不放置我们的游戏到一个更方便的结构中。很多其他的 Open Jam 参与者使用专有的游戏引擎 Unity ,它能够使它们的游戏在网页浏览器中来玩。这使得它们非常方便地来玩。便利性是一个我们的游戏恰巧一丝的都没有的东西。但是,感谢生机勃勃的 Python 生态系统,我们有选择。在 Windows 上现有的工具帮助 Python 程序员准备发行他们的游戏。我们考虑的两个是 [cx_Freeze][28] 和 [Pygame2exe][29] (它使用 [py2exe][30])。我们下决心在 cx_Freeze 上,因为它是跨平台的。 +很显然:我们必须放置我们的游戏到一个更方便的格式中。很多其他的 Open Jam 参与者使用专有的游戏引擎 Unity,它能够使他们的游戏在网页浏览器中来玩。这使得它们非常方便地来玩。便利性是一个我们的游戏中根本不存在的东西。但是,感谢生机勃勃的 Python 生态系统,我们有选择。已有的工具可以帮助 Python 程序员将他们的游戏做成 Windows 上的发布版本。我们考虑过的两个工具是 [cx_Freeze][28] 和 [Pygame2exe][29](它使用 [py2exe][30])。我们最终决定用 cx_Freeze,因为它是跨平台的。 + +在 cx_Freeze 中,你可以把一个单脚本游戏打包成发布版本,只要在 shell 中运行一个命令,像这样: -在 cx_Freeze 中,你可以为发行版打包一个单个脚本游戏,只要在shell运行一个命令,像这样: ``` cxfreeze main.py --target-dir dist ``` -`cxfreeze` 的这个调用将拿你的脚本(这里 `main.py`) 和在你系统上的 Python 解释器,并捆绑定它们到 `dist` 目录。一旦完成它,你需要做的是手动复制你的游戏的数据文件到 `dist` 目录。你将发现,`dist` 目录包含一个可以运行来开始你的游戏的可执行文件。 +`cxfreeze` 的这个调用将把你的脚本(这里是 `main.py`)和在你系统上的 Python 解释器捆绑到到 `dist` 目录。一旦完成,你需要做的是手动复制你的游戏的数据文件到 `dist` 目录。你将看到,`dist` 目录包含一个可以运行来开始你的游戏的可执行文件。 -这里有更复杂难解的方法来使用 cx_Freeze ,允许你自动地复制数据文件,但是我们发现简单的调用 `cxfreeze` 足够我们的需要。感谢这个工具,我们使我们的游戏稍微便利的运行。 +这里有使用 cx_Freeze 的更复杂的方法,允许你自动地复制数据文件,但是我们发现简单的调用 `cxfreeze` 足够满足我们的需要。感谢这个工具,我们使我们的游戏玩起来更便利一些。 -### 庆祝开放源码 +### 庆祝开源 -Open Jam 是重要的,因为它庆祝软件开发的开放源码模式。这是来分析开放源码工具的当前状态和我们在未来工作中需求的一个机会。,对于游戏开发者来设法推动它们的工具的使用范围,学习必需提高未来游戏开发者的益处,游戏 jams 或许是最好的时间。 +Open Jam 是庆祝开源模式的软件开发的重要活动。这是一个分析开源工具的当前状态和我们在未来工作中需求的一个机会。对于游戏开发者探求其工具的使用极限,学习未来游戏开发所必须改进的地方,游戏 Jam 或许是最好的时机。 -开放源码工具使人们能够探索他们的创造性,而不妥协他们的自由和前期的投资。尽管我们可能不能成为专业的游戏开发者,我们仍然能获取它的一段小的体验,使用我们简短的,实验性的称为 [Mark My Words][5] 的游戏。它是一个语言学方面地的有特定主题的游戏,它描述一个小说写作系统在它历史期间的演化。Open Jam 有一些令人愉快的提交,并且它们是值得校核。真的, [去看看][31] ! +开源工具使人们能够在不损害自由的情况下探索自己的创造力,而无需预先投入资金。虽然我们可能不会成为专业的游戏开发者,但我们仍然能够通过我们的简短的实验性游戏 [Mark My Words][5] 获得一点点体验。它是一个以语言学为主题的游戏,描绘了虚构的书写系统在其历史中的演变。还有很多其他不错的作品提交给了 Open Jam,它们都值得一试。 真的,[去看看][31]! -在结束前,我们想要感谢所有的 [参加俱乐部的成员][32],使这次经历真正的有价值。我们也想要感谢 [Michael Clayton][33],[Jared Sprague][34] 和 [Opensource.com][35] 主办 open Jam。它是一次欢乐。 +在本文结束前,我们想要感谢所有的 [参加俱乐部的成员][32],使得这次经历真正的有价值。我们也想要感谢 [Michael Clayton][33]、[Jared Sprague][34] 和 [Opensource.com][35] 主办 Open Jam。简直酷毙了。 -现在,我们对读者有一些问题。你是一个 FOSS 游戏开发者吗?你选择的工具是什么?务必在下面留下一个评论! +现在,我们对读者提出了一些问题。你是一个 FOSS 游戏开发者吗?你选择的工具是什么?务必在下面留下一个评论! -------------------------------------------------------------------------------- @@ -135,7 +137,7 @@ via: https://opensource.com/article/18/1/graphics-music-tools-game-dev 作者:[Charlie Murphy][a] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a4675e566aaec6f516f808efe995ff489fd2d898 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 00:18:02 +0800 Subject: [PATCH 0376/4278] PUB:20180130 Graphics and music tools for game development.md @robsean https://linux.cn/article-10400-1.html --- .../20180130 Graphics and music tools for game development.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180130 Graphics and music tools for game development.md (100%) diff --git a/translated/tech/20180130 Graphics and music tools for game development.md b/published/20180130 Graphics and music tools for game development.md similarity index 100% rename from translated/tech/20180130 Graphics and music tools for game development.md rename to published/20180130 Graphics and music tools for game development.md From 102c89d8621e0d376c3fb053b53f3c6d5c0f5410 Mon Sep 17 00:00:00 2001 From: Ryze-Borgia <42087725+Ryze-Borgia@users.noreply.github.com> Date: Mon, 31 Dec 2018 18:14:56 +0800 Subject: [PATCH 0377/4278] =?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/20180914 A day in the life of a log message.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180914 A day in the life of a log message.md b/sources/tech/20180914 A day in the life of a log message.md index 8d60ec9fe6..cc6ebd0f5b 100644 --- a/sources/tech/20180914 A day in the life of a log message.md +++ b/sources/tech/20180914 A day in the life of a log message.md @@ -1,3 +1,4 @@ +Ryze-Borgia is translating A day in the life of a log message ====== From 83acec62165c1605823c6abcc48b47e7bfddeed0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 20:24:23 +0800 Subject: [PATCH 0378/4278] PRF:20171111 A CEOs Guide to Emacs.md @oneforalone --- .../tech/20171111 A CEOs Guide to Emacs.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index 9e7f9290d4..670b8e78f9 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -1,15 +1,15 @@ -一位 CEO 的 Emacs 指南(备选:CEO 的 Emacs 秘籍) +一位 CEO 的 Emacs 秘籍 =========== 几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器,或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,就连最基本的文件浏览,我都已经忘了在不用鼠标的情况下该怎么操作。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是我决定再次使用 Emacs。这是个很正确的决定,原因有以下几个。其中包括用 `.emacs` 和 Dropbox 来搭建一个良好的、可移植的环境的一些技巧。 -对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的的热核烤面包机……好吧,只是文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 +对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的的热核烤面包机……好吧,只是指文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 也许对我来说更重要的是,Emacs 是我曾经使用过的一个应用,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。前者更快而且很完整,后者是无尽的快乐或烦恼的源泉,当然这取决于你自己,而且这种快乐或烦恼会伴随到你死。我就是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时会感到高兴的人,具体情况因人而异。 ![1933 steel bicycle](https://www.fugue.co/hubfs/Imported_Blog_Media/bicycle-1.jpg) -*一辆我还在骑的1933年产的钢制自行车。你可以看看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]* +*一辆我还在骑的 1933 年产的钢制自行车。你可以看看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]* 这可能给人一种 Emacs 已经过气或过时的印象。然而并不是,Emacs 是强大和永恒的,只要你耐心地去理解它的一些规则。Emacs 的规则很另类,也很奇怪,但其中的逻辑却引人注目,且魅力十足。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 @@ -29,7 +29,7 @@ Org 模式本身就值得花时间,但如果你像我一样,你通常要处 拥有所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?发挥了 Lisp 键盘的全部威力了吗?我用 Emacs 来完成所有的创作性工作,音乐和图片除外。 -我办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,我通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面会隐藏起来,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,越是先进的 UI 应用程序,消除干扰越是不可能,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像出书一样,处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 客户端版,我更讨厌它的在线版。 +我办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,我通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面会隐藏起来,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,越是先进的 UI 应用程序,消除干扰越是不可能,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像出书一样,处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 桌面版,我更讨厌它的在线版。 ![](https://www.fugue.co/hubfs/Imported_Blog_Media/desktop-1.jpg) @@ -37,7 +37,7 @@ Org 模式本身就值得花时间,但如果你像我一样,你通常要处 但是沟通呢?创造和沟通之间的差别很大。当我将这两件事在不同时间段处理时,我的效率会更高。我们 Fugue 公司使用 Slack,痛并快乐着。我把 Slack 和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我就能够忽略所有的聊天信息了。虽然只要一个 Slackstorm 或一封风投或董事会董事的电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 -#### 包罗万象,永久长青 +#### 普适恒久 第三个原因是,我发现 Emacs 比其它的环境更有优势的是,你可以很容易地用它来处理事务。我的意思是,你所需要的只是通过类似于 Dropbox 的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何你已经精心打造了适合你的目的的套件的环境中工作了。我在 OS X、Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理 Pages、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 @@ -196,6 +196,7 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 LaTeX 一样。在我看来这还不错,但是字体很平淡,而且有点奇怪。此外,如果你使用标准格式,人们会觉得他们正在阅读的东西是、或者假装是一篇学术论文。别怪我没提醒你。 #### 驾驭之 Ace Jump 模式 + 这只是一个辅助模式,而不是一个主模式,但是你也需要它。其工作原理有点像之前提到的 Jef Raskin 的 Leap 功能[^9] 。 按下 `C-c C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。你只需键入所需位置的字母,光标就会跳转到该位置。我常将它作为导航键或是用来检索。将 `.el` 文件下到你的 `lisp` 目录下,并在 `.emacs` 文件添加如下代码: ``` @@ -217,17 +218,17 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 [^3]: 我主要是在写作时使用这个模式来进行一些运算。比如说,当我在给一个新雇员写一封入职信时,我想要算这封入职信中有多少个选项。由于我在我的 `.emacs` 为 outstanding-shares 定义了一个变量,所以我只要按下 `M-:` 然后输入 `(* .001 outstanding-shares)` 就能再无需打开计算器或电子表格的情况下得到精度为 0.001 的结果。我使用了 _大量_ 的变量来避免程序间切换。 -[^4]: 缺少的部分是 web。有个名为 eww 的 Emacs 网页浏览器能够让你在 Emacs 中浏览网页。我用的就是这个,因为它既能拦截广告(译者注:实质上是无法显示,/laugh),同时也在可读性方面为 web 开发者消除了大多数差劲的选项。这个其实有点类似于 Safari 的阅读模式。不幸的是,大部分网站都有很多令人讨厌的繁琐的东西以及难以转换为文本的导航, +[^4]: 缺少的部分是 web。有个名为 eww 的 Emacs 网页浏览器能够让你在 Emacs 中浏览网页。我用的就是这个,因为它既能拦截广告(LCTT 译注:实质上是无法显示,/laugh),同时也在可读性方面为 web 开发者消除了大多数差劲的选项。这个其实有点类似于 Safari 的阅读模式。不幸的是,大部分网站都有很多令人讨厌的繁琐的东西以及难以转换为文本的导航, [^5]: 易用性和易学性这两者经常容易被搞混。易学性是指学习使用工具的难易程度。而易用性是指工具高效的程度。通常来说,这是要差别的,就想鼠标和菜单栏的差别一样。菜单栏很容易学会,但是却不怎么高效,以致于早期会存在一些键盘的快捷键。除了在 GUI 方面上,Raskin 在很多方面上的观点都很正确。如今,操作系统正在将一些合适的搜索映射到键盘的快捷键上。比如说在 OS X 和 Windows 上,我默认的导航方式就是搜索。Ubuntu 的搜索做的很差劲,如同它的 GUI 一样差劲。 -[^6]: 在有网的情况下, [AWSAmazon Web Services S3][42] 是解决文件存储问题的有效方案。数万亿个对象存在 S3 中,但是从来没有遗失过。大部分提供云存储的服务都是在 S3 上或是模拟 S3 构建的。没人能够拥有 S3 一样的规模,所以我将重要的文件通过 Dropbox 存储在上面。 +[^6]: 在有网的情况下,[AWS S3][42] 是解决文件存储问题的有效方案。数万亿个对象存在 S3 中,但是从来没有遗失过。大部分提供云存储的服务都是在 S3 上或是模拟 S3 构建的。没人能够拥有 S3 一样的规模,所以我将重要的文件通过 Dropbox 存储在上面。 [^7]: 目前,你可能会想:“这个人和自行车有什么关系?”……我在各个层面上都喜欢自行车。自行车是迄今为止发明的最具机械效率的交通工具。自行车可以是真正美丽的事物。而且,只要注意点的话,自行车可以用一辈子。早在 2001 年,我曾向 Rivendell Bicycle Works 订购了一辆自行车,现在我每次看到那辆自行车依然很高兴,自行车和 Unix 是我接触过的最好的两个发明。对了,还有 Emacs。 [^8]: 这个网站有一个很棒的 Emacs 教程,但不是这个。当我浏览这个页面时,我确实得到了一些对获取高效的 Emacs 配置很重要的知识,但无论怎么说,这都不是个替代品。 -[^9]: 20世纪80年代,Jef Raskin 与 Steve Jobs 在 Macintosh 项目上闹翻后, Jef Raskin 又设计了 [Canon Cat 计算机][43]。这台 Cat 是以文档为中心的界面(所有的计算机都应如此),并以一种全新的方式使用键盘,你现在可以用 Emacs 来模仿这种键盘。如果现在有一台现代的,功能强大的 Cat 并配有一个高分辨的显示器和 Unix 系统的话,我立马会用 Mac 来换。[][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] +[^9]: 20 世纪 80 年代,Jef Raskin 与 Steve Jobs 在 Macintosh 项目上闹翻后, Jef Raskin 又设计了 [Canon Cat 计算机][43]。这台 Cat 计算机是以文档为中心的界面(所有的计算机都应如此),并以一种全新的方式使用键盘,你现在可以用 Emacs 来模仿这种键盘。如果现在有一台现代的,功能强大的 Cat 计算机并配有一个高分辨的显示器和 Unix 系统的话,我立马会用 Mac 来换。[https://youtu.be/o_TlE_U_X3c?t=19s][28] -------------------------------------------------------------------------------- From 62a05a3f208ef5636666244f15a980de1f696904 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 20:24:58 +0800 Subject: [PATCH 0379/4278] PUB:20171111 A CEOs Guide to Emacs.md @oneforalone https://linux.cn/article-10401-1.html --- {translated/tech => published}/20171111 A CEOs Guide to Emacs.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171111 A CEOs Guide to Emacs.md (100%) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/published/20171111 A CEOs Guide to Emacs.md similarity index 100% rename from translated/tech/20171111 A CEOs Guide to Emacs.md rename to published/20171111 A CEOs Guide to Emacs.md From 0b639c43c115981dd788d64466ed1d9ae272a6eb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 20:26:13 +0800 Subject: [PATCH 0380/4278] PRF:20171111 A CEOs Guide to Emacs.md --- published/20171111 A CEOs Guide to Emacs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20171111 A CEOs Guide to Emacs.md b/published/20171111 A CEOs Guide to Emacs.md index 670b8e78f9..4a92e5710b 100644 --- a/published/20171111 A CEOs Guide to Emacs.md +++ b/published/20171111 A CEOs Guide to Emacs.md @@ -1,9 +1,9 @@ -一位 CEO 的 Emacs 秘籍 +CEO 的 Emacs 秘籍 =========== 几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器,或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,就连最基本的文件浏览,我都已经忘了在不用鼠标的情况下该怎么操作。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是我决定再次使用 Emacs。这是个很正确的决定,原因有以下几个。其中包括用 `.emacs` 和 Dropbox 来搭建一个良好的、可移植的环境的一些技巧。 -对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的的热核烤面包机……好吧,只是指文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 +对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的热核烤面包机……好吧,只是指文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 也许对我来说更重要的是,Emacs 是我曾经使用过的一个应用,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。前者更快而且很完整,后者是无尽的快乐或烦恼的源泉,当然这取决于你自己,而且这种快乐或烦恼会伴随到你死。我就是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时会感到高兴的人,具体情况因人而异。 From 2497bfcf68cf2d4037698e73be997813876bdc9a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 23:41:24 +0800 Subject: [PATCH 0381/4278] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201812?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 一年又过去了…… --- ...st Sources For Linux - -BSD - Unix Documentation On the Web.md | 0 published/{ => 201812}/20171012 7 Best eBook Readers for Linux.md | 0 .../20171108 Continuous infrastructure- The other CI.md | 0 published/{ => 201812}/20171111 A CEOs Guide to Emacs.md | 0 ...171129 TLDR pages Simplified Alternative To Linux Man Pages.md | 0 ...1223 Celebrate Christmas In Linux Way With These Wallpapers.md | 0 ...personal Email setup - Notmuch, mbsync, postfix and dovecot.md | 0 .../20180101 27 open solutions to everything in education.md | 0 ...0104 How Creative Commons benefits artists and big business.md | 0 published/{ => 201812}/20180128 Getting Linux Jobs.md | 0 .../20180130 Graphics and music tools for game development.md | 0 ...r your first HTML code lets help Batman write a love letter.md | 0 ...ring project requirements using the Open Decision Framework.md | 0 .../{ => 201812}/20180221 12 useful zypper command examples.md | 0 .../20180226 -Getting to Done- on the Linux command line.md | 0 published/{ => 201812}/20180228 Emacs -2- Introducing org-mode.md | 0 published/{ => 201812}/20180302 Emacs -3- More on org-mode.md | 0 .../20180328 What NASA Has Been Doing About Open Science.md | 0 ...Emacs -4- Automated emails to org-mode and org-mode syncing.md | 0 ...0180404 Emacs -5- Documents and Presentations with org-mode.md | 0 .../20180412 A new approach to security instrumentation.md | 0 .../20180419 Migrating to Linux- Network and System Settings.md | 0 .../20180420 How To Remove Password From A PDF File in Linux.md | 0 ...0422 Command Line Tricks For Data Scientists - kade killary.md | 0 ...04 How a university network assistant used Linux in the 90s.md | 0 ...iabetes finds open source and builds her own medical device.md | 0 published/{ => 201812}/20180518 How to Manage Fonts in Linux.md | 0 .../{ => 201812}/20180523 How to dual-boot Linux and Windows.md | 0 ...25 How to Set Different Wallpaper for Each Monitor in Linux.md | 0 published/{ => 201812}/20180623 The IBM 029 Card Punch.md | 0 .../{ => 201812}/20180707 Version Control Before Git with CVS.md | 0 .../20180709 5 Firefox extensions to protect your privacy.md | 0 .../20180710 Users, Groups, and Other Linux Beasts.md | 0 .../20180716 Users, Groups and Other Linux Beasts- Part 2.md | 0 .../20180717 11 Uses for a Raspberry Pi Around the Office.md | 0 ...0180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md | 0 .../{ => 201812}/20180806 Systemd Timers- Three Use Cases.md | 0 ...180814 HTTP request routing and validation with gorilla-mux.md | 0 ...17 Mixing software development roles produces great results.md | 0 .../20180826 How to Install and Use FreeDOS on VirtualBox.md | 0 ...uction to Quantum Computing with Open Source Cirq Framework.md | 0 .../20180831 Publishing Markdown to HTML with MDwiki.md | 0 .../{ => 201812}/20180904 Why schools of the future are open.md | 0 .../20180911 Know Your Storage- Block, File - Object.md | 0 .../20180912 How to turn on an LED with Fedora IoT.md | 0 published/{ => 201812}/20181004 Archiving web sites.md | 0 published/{ => 201812}/20181004 Lab 3- User Environments.md | 0 published/{ => 201812}/20181016 Lab 4- Preemptive Multitasking.md | 0 .../{ => 201812}/20181016 Lab 5- File system, Spawn and Shell.md | 0 ...prove login security with challenge-response authentication.md | 0 .../20181025 How to write your favorite R functions in Python.md | 0 ...recting traffic- Demystifying internet-scale load balancing.md | 0 .../20181102 Create a containerized machine learning model.md | 0 .../20181105 5 Easy Tips for Linux Web Browser Security.md | 0 .../20181106 How to partition and format a drive on Linux.md | 0 .../{ => 201812}/20181107 Automate a web browser with Selenium.md | 0 .../20181107 Top 30 OpenStack Interview Questions and Answers.md | 0 ...20181112 A Free Guide for Setting Your Open Source Strategy.md | 0 ...20181112 A Free, Secure And Cross-platform Password Manager.md | 0 published/{ => 201812}/20181112 The Source History of Cat.md | 0 ...ion to Udev- The Linux subsystem for managing device events.md | 0 ... 3 best practices for continuous integration and deployment.md | 0 .../20181119 7 command-line tools for writers - Opensource.com.md | 0 .../20181119 9 obscure Python libraries for data science.md | 0 ...to give thanks to open source and free software maintainers.md | 0 .../20181121 Coupled commands with control operators in Bash.md | 0 published/{ => 201812}/20181121 DevOps is for everyone.md | 0 .../20181121 How to swap Ctrl and Caps Lock keys in Linux.md | 0 .../20181123 How to Build a Netboot Server, Part 1.md | 0 .../20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md | 0 ...to use the sudo command to deploy superuser powers on Linux.md | 0 ...1128 OpenSnitch - an Application Firewall for Linux -Review.md | 0 .../20181128 Standalone web applications with GNOME Web.md | 0 published/{ => 201812}/20181129 4 open source Markdown editors.md | 0 ...1130 SMPlayer in Linux- Features, Download and Installation.md | 0 ...atives To ‘top- Command line Utility You Might Want To Know.md | 0 .../20181201 Boxing yourself in on the Linux command line.md | 0 .../20181202 Drive a locomotive through your Linux terminal.md | 0 ...Four Easy Ways to Search Or Find Files And Folders in Linux.md | 0 published/{ => 201812}/20181204 3 implications of serverless.md | 0 .../{ => 201812}/20181204 Have a cow at the Linux command line.md | 0 .../20181205 Bash Variables- Environmental and Otherwise.md | 0 ...0181205 Bring some color to your Linux terminal with lolcat.md | 0 ...ily Convert Audio File Formats with SoundConverter in Linux.md | 0 ...0181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md | 0 ...181206 Take a break at the Linux command line with Nyan Cat.md | 0 .../{ => 201812}/20181208 Play Tetris at your Linux terminal.md | 0 ...o Check Laptop Battery Status And Level From Linux Terminal.md | 0 published/{ => 201812}/20181210 How to get started in AI.md | 0 ...ow to Install Putty on Ubuntu and Other Linux Distributions.md | 0 published/{ => 201812}/20181212 Aliases- DIY Shell Commands.md | 0 .../20181212 How to Build a Netboot Server, Part 2.md | 0 .../20181212 Patch into The Matrix at the Linux command line.md | 0 .../20181213 Relax by the fire at your Linux terminal.md | 0 .../20181214 How To Install Rust Programming Language In Linux.md | 0 ...181217 Take a swim at your Linux terminal with asciiquarium.md | 0 .../20181221 Listen to the radio at the Linux terminal.md | 0 97 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201812}/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md (100%) rename published/{ => 201812}/20171012 7 Best eBook Readers for Linux.md (100%) rename published/{ => 201812}/20171108 Continuous infrastructure- The other CI.md (100%) rename published/{ => 201812}/20171111 A CEOs Guide to Emacs.md (100%) rename published/{ => 201812}/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md (100%) rename published/{ => 201812}/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md (100%) rename published/{ => 201812}/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md (100%) rename published/{ => 201812}/20180101 27 open solutions to everything in education.md (100%) rename published/{ => 201812}/20180104 How Creative Commons benefits artists and big business.md (100%) rename published/{ => 201812}/20180128 Getting Linux Jobs.md (100%) rename published/{ => 201812}/20180130 Graphics and music tools for game development.md (100%) rename published/{ => 201812}/20180131 For your first HTML code lets help Batman write a love letter.md (100%) rename published/{ => 201812}/20180208 Gathering project requirements using the Open Decision Framework.md (100%) rename published/{ => 201812}/20180221 12 useful zypper command examples.md (100%) rename published/{ => 201812}/20180226 -Getting to Done- on the Linux command line.md (100%) rename published/{ => 201812}/20180228 Emacs -2- Introducing org-mode.md (100%) rename published/{ => 201812}/20180302 Emacs -3- More on org-mode.md (100%) rename published/{ => 201812}/20180328 What NASA Has Been Doing About Open Science.md (100%) rename published/{ => 201812}/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md (100%) rename published/{ => 201812}/20180404 Emacs -5- Documents and Presentations with org-mode.md (100%) rename published/{ => 201812}/20180412 A new approach to security instrumentation.md (100%) rename published/{ => 201812}/20180419 Migrating to Linux- Network and System Settings.md (100%) rename published/{ => 201812}/20180420 How To Remove Password From A PDF File in Linux.md (100%) rename published/{ => 201812}/20180422 Command Line Tricks For Data Scientists - kade killary.md (100%) rename published/{ => 201812}/20180504 How a university network assistant used Linux in the 90s.md (100%) rename published/{ => 201812}/20180508 Person with diabetes finds open source and builds her own medical device.md (100%) rename published/{ => 201812}/20180518 How to Manage Fonts in Linux.md (100%) rename published/{ => 201812}/20180523 How to dual-boot Linux and Windows.md (100%) rename published/{ => 201812}/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md (100%) rename published/{ => 201812}/20180623 The IBM 029 Card Punch.md (100%) rename published/{ => 201812}/20180707 Version Control Before Git with CVS.md (100%) rename published/{ => 201812}/20180709 5 Firefox extensions to protect your privacy.md (100%) rename published/{ => 201812}/20180710 Users, Groups, and Other Linux Beasts.md (100%) rename published/{ => 201812}/20180716 Users, Groups and Other Linux Beasts- Part 2.md (100%) rename published/{ => 201812}/20180717 11 Uses for a Raspberry Pi Around the Office.md (100%) rename published/{ => 201812}/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md (100%) rename published/{ => 201812}/20180806 Systemd Timers- Three Use Cases.md (100%) rename published/{ => 201812}/20180814 HTTP request routing and validation with gorilla-mux.md (100%) rename published/{ => 201812}/20180817 Mixing software development roles produces great results.md (100%) rename published/{ => 201812}/20180826 How to Install and Use FreeDOS on VirtualBox.md (100%) rename published/{ => 201812}/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md (100%) rename published/{ => 201812}/20180831 Publishing Markdown to HTML with MDwiki.md (100%) rename published/{ => 201812}/20180904 Why schools of the future are open.md (100%) rename published/{ => 201812}/20180911 Know Your Storage- Block, File - Object.md (100%) rename published/{ => 201812}/20180912 How to turn on an LED with Fedora IoT.md (100%) rename published/{ => 201812}/20181004 Archiving web sites.md (100%) rename published/{ => 201812}/20181004 Lab 3- User Environments.md (100%) rename published/{ => 201812}/20181016 Lab 4- Preemptive Multitasking.md (100%) rename published/{ => 201812}/20181016 Lab 5- File system, Spawn and Shell.md (100%) rename published/{ => 201812}/20181022 Improve login security with challenge-response authentication.md (100%) rename published/{ => 201812}/20181025 How to write your favorite R functions in Python.md (100%) rename published/{ => 201812}/20181026 Directing traffic- Demystifying internet-scale load balancing.md (100%) rename published/{ => 201812}/20181102 Create a containerized machine learning model.md (100%) rename published/{ => 201812}/20181105 5 Easy Tips for Linux Web Browser Security.md (100%) rename published/{ => 201812}/20181106 How to partition and format a drive on Linux.md (100%) rename published/{ => 201812}/20181107 Automate a web browser with Selenium.md (100%) rename published/{ => 201812}/20181107 Top 30 OpenStack Interview Questions and Answers.md (100%) rename published/{ => 201812}/20181112 A Free Guide for Setting Your Open Source Strategy.md (100%) rename published/{ => 201812}/20181112 A Free, Secure And Cross-platform Password Manager.md (100%) rename published/{ => 201812}/20181112 The Source History of Cat.md (100%) rename published/{ => 201812}/20181113 An introduction to Udev- The Linux subsystem for managing device events.md (100%) rename published/{ => 201812}/20181115 3 best practices for continuous integration and deployment.md (100%) rename published/{ => 201812}/20181119 7 command-line tools for writers - Opensource.com.md (100%) rename published/{ => 201812}/20181119 9 obscure Python libraries for data science.md (100%) rename published/{ => 201812}/20181121 10 ways to give thanks to open source and free software maintainers.md (100%) rename published/{ => 201812}/20181121 Coupled commands with control operators in Bash.md (100%) rename published/{ => 201812}/20181121 DevOps is for everyone.md (100%) rename published/{ => 201812}/20181121 How to swap Ctrl and Caps Lock keys in Linux.md (100%) rename published/{ => 201812}/20181123 How to Build a Netboot Server, Part 1.md (100%) rename published/{ => 201812}/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md (100%) rename published/{ => 201812}/20181126 How to use the sudo command to deploy superuser powers on Linux.md (100%) rename published/{ => 201812}/20181128 OpenSnitch - an Application Firewall for Linux -Review.md (100%) rename published/{ => 201812}/20181128 Standalone web applications with GNOME Web.md (100%) rename published/{ => 201812}/20181129 4 open source Markdown editors.md (100%) rename published/{ => 201812}/20181130 SMPlayer in Linux- Features, Download and Installation.md (100%) rename published/{ => 201812}/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md (100%) rename published/{ => 201812}/20181201 Boxing yourself in on the Linux command line.md (100%) rename published/{ => 201812}/20181202 Drive a locomotive through your Linux terminal.md (100%) rename published/{ => 201812}/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md (100%) rename published/{ => 201812}/20181204 3 implications of serverless.md (100%) rename published/{ => 201812}/20181204 Have a cow at the Linux command line.md (100%) rename published/{ => 201812}/20181205 Bash Variables- Environmental and Otherwise.md (100%) rename published/{ => 201812}/20181205 Bring some color to your Linux terminal with lolcat.md (100%) rename published/{ => 201812}/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md (100%) rename published/{ => 201812}/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md (100%) rename published/{ => 201812}/20181206 Take a break at the Linux command line with Nyan Cat.md (100%) rename published/{ => 201812}/20181208 Play Tetris at your Linux terminal.md (100%) rename published/{ => 201812}/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md (100%) rename published/{ => 201812}/20181210 How to get started in AI.md (100%) rename published/{ => 201812}/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md (100%) rename published/{ => 201812}/20181212 Aliases- DIY Shell Commands.md (100%) rename published/{ => 201812}/20181212 How to Build a Netboot Server, Part 2.md (100%) rename published/{ => 201812}/20181212 Patch into The Matrix at the Linux command line.md (100%) rename published/{ => 201812}/20181213 Relax by the fire at your Linux terminal.md (100%) rename published/{ => 201812}/20181214 How To Install Rust Programming Language In Linux.md (100%) rename published/{ => 201812}/20181217 Take a swim at your Linux terminal with asciiquarium.md (100%) rename published/{ => 201812}/20181221 Listen to the radio at the Linux terminal.md (100%) diff --git a/published/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md b/published/201812/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md similarity index 100% rename from published/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md rename to published/201812/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md diff --git a/published/20171012 7 Best eBook Readers for Linux.md b/published/201812/20171012 7 Best eBook Readers for Linux.md similarity index 100% rename from published/20171012 7 Best eBook Readers for Linux.md rename to published/201812/20171012 7 Best eBook Readers for Linux.md diff --git a/published/20171108 Continuous infrastructure- The other CI.md b/published/201812/20171108 Continuous infrastructure- The other CI.md similarity index 100% rename from published/20171108 Continuous infrastructure- The other CI.md rename to published/201812/20171108 Continuous infrastructure- The other CI.md diff --git a/published/20171111 A CEOs Guide to Emacs.md b/published/201812/20171111 A CEOs Guide to Emacs.md similarity index 100% rename from published/20171111 A CEOs Guide to Emacs.md rename to published/201812/20171111 A CEOs Guide to Emacs.md diff --git a/published/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/published/201812/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md similarity index 100% rename from published/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md rename to published/201812/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md diff --git a/published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/published/201812/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md similarity index 100% rename from published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md rename to published/201812/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md diff --git a/published/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md b/published/201812/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md similarity index 100% rename from published/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md rename to published/201812/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md diff --git a/published/20180101 27 open solutions to everything in education.md b/published/201812/20180101 27 open solutions to everything in education.md similarity index 100% rename from published/20180101 27 open solutions to everything in education.md rename to published/201812/20180101 27 open solutions to everything in education.md diff --git a/published/20180104 How Creative Commons benefits artists and big business.md b/published/201812/20180104 How Creative Commons benefits artists and big business.md similarity index 100% rename from published/20180104 How Creative Commons benefits artists and big business.md rename to published/201812/20180104 How Creative Commons benefits artists and big business.md diff --git a/published/20180128 Getting Linux Jobs.md b/published/201812/20180128 Getting Linux Jobs.md similarity index 100% rename from published/20180128 Getting Linux Jobs.md rename to published/201812/20180128 Getting Linux Jobs.md diff --git a/published/20180130 Graphics and music tools for game development.md b/published/201812/20180130 Graphics and music tools for game development.md similarity index 100% rename from published/20180130 Graphics and music tools for game development.md rename to published/201812/20180130 Graphics and music tools for game development.md diff --git a/published/20180131 For your first HTML code lets help Batman write a love letter.md b/published/201812/20180131 For your first HTML code lets help Batman write a love letter.md similarity index 100% rename from published/20180131 For your first HTML code lets help Batman write a love letter.md rename to published/201812/20180131 For your first HTML code lets help Batman write a love letter.md diff --git a/published/20180208 Gathering project requirements using the Open Decision Framework.md b/published/201812/20180208 Gathering project requirements using the Open Decision Framework.md similarity index 100% rename from published/20180208 Gathering project requirements using the Open Decision Framework.md rename to published/201812/20180208 Gathering project requirements using the Open Decision Framework.md diff --git a/published/20180221 12 useful zypper command examples.md b/published/201812/20180221 12 useful zypper command examples.md similarity index 100% rename from published/20180221 12 useful zypper command examples.md rename to published/201812/20180221 12 useful zypper command examples.md diff --git a/published/20180226 -Getting to Done- on the Linux command line.md b/published/201812/20180226 -Getting to Done- on the Linux command line.md similarity index 100% rename from published/20180226 -Getting to Done- on the Linux command line.md rename to published/201812/20180226 -Getting to Done- on the Linux command line.md diff --git a/published/20180228 Emacs -2- Introducing org-mode.md b/published/201812/20180228 Emacs -2- Introducing org-mode.md similarity index 100% rename from published/20180228 Emacs -2- Introducing org-mode.md rename to published/201812/20180228 Emacs -2- Introducing org-mode.md diff --git a/published/20180302 Emacs -3- More on org-mode.md b/published/201812/20180302 Emacs -3- More on org-mode.md similarity index 100% rename from published/20180302 Emacs -3- More on org-mode.md rename to published/201812/20180302 Emacs -3- More on org-mode.md diff --git a/published/20180328 What NASA Has Been Doing About Open Science.md b/published/201812/20180328 What NASA Has Been Doing About Open Science.md similarity index 100% rename from published/20180328 What NASA Has Been Doing About Open Science.md rename to published/201812/20180328 What NASA Has Been Doing About Open Science.md diff --git a/published/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md b/published/201812/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md similarity index 100% rename from published/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md rename to published/201812/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md diff --git a/published/20180404 Emacs -5- Documents and Presentations with org-mode.md b/published/201812/20180404 Emacs -5- Documents and Presentations with org-mode.md similarity index 100% rename from published/20180404 Emacs -5- Documents and Presentations with org-mode.md rename to published/201812/20180404 Emacs -5- Documents and Presentations with org-mode.md diff --git a/published/20180412 A new approach to security instrumentation.md b/published/201812/20180412 A new approach to security instrumentation.md similarity index 100% rename from published/20180412 A new approach to security instrumentation.md rename to published/201812/20180412 A new approach to security instrumentation.md diff --git a/published/20180419 Migrating to Linux- Network and System Settings.md b/published/201812/20180419 Migrating to Linux- Network and System Settings.md similarity index 100% rename from published/20180419 Migrating to Linux- Network and System Settings.md rename to published/201812/20180419 Migrating to Linux- Network and System Settings.md diff --git a/published/20180420 How To Remove Password From A PDF File in Linux.md b/published/201812/20180420 How To Remove Password From A PDF File in Linux.md similarity index 100% rename from published/20180420 How To Remove Password From A PDF File in Linux.md rename to published/201812/20180420 How To Remove Password From A PDF File in Linux.md diff --git a/published/20180422 Command Line Tricks For Data Scientists - kade killary.md b/published/201812/20180422 Command Line Tricks For Data Scientists - kade killary.md similarity index 100% rename from published/20180422 Command Line Tricks For Data Scientists - kade killary.md rename to published/201812/20180422 Command Line Tricks For Data Scientists - kade killary.md diff --git a/published/20180504 How a university network assistant used Linux in the 90s.md b/published/201812/20180504 How a university network assistant used Linux in the 90s.md similarity index 100% rename from published/20180504 How a university network assistant used Linux in the 90s.md rename to published/201812/20180504 How a university network assistant used Linux in the 90s.md diff --git a/published/20180508 Person with diabetes finds open source and builds her own medical device.md b/published/201812/20180508 Person with diabetes finds open source and builds her own medical device.md similarity index 100% rename from published/20180508 Person with diabetes finds open source and builds her own medical device.md rename to published/201812/20180508 Person with diabetes finds open source and builds her own medical device.md diff --git a/published/20180518 How to Manage Fonts in Linux.md b/published/201812/20180518 How to Manage Fonts in Linux.md similarity index 100% rename from published/20180518 How to Manage Fonts in Linux.md rename to published/201812/20180518 How to Manage Fonts in Linux.md diff --git a/published/20180523 How to dual-boot Linux and Windows.md b/published/201812/20180523 How to dual-boot Linux and Windows.md similarity index 100% rename from published/20180523 How to dual-boot Linux and Windows.md rename to published/201812/20180523 How to dual-boot Linux and Windows.md diff --git a/published/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md b/published/201812/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md similarity index 100% rename from published/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md rename to published/201812/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md diff --git a/published/20180623 The IBM 029 Card Punch.md b/published/201812/20180623 The IBM 029 Card Punch.md similarity index 100% rename from published/20180623 The IBM 029 Card Punch.md rename to published/201812/20180623 The IBM 029 Card Punch.md diff --git a/published/20180707 Version Control Before Git with CVS.md b/published/201812/20180707 Version Control Before Git with CVS.md similarity index 100% rename from published/20180707 Version Control Before Git with CVS.md rename to published/201812/20180707 Version Control Before Git with CVS.md diff --git a/published/20180709 5 Firefox extensions to protect your privacy.md b/published/201812/20180709 5 Firefox extensions to protect your privacy.md similarity index 100% rename from published/20180709 5 Firefox extensions to protect your privacy.md rename to published/201812/20180709 5 Firefox extensions to protect your privacy.md diff --git a/published/20180710 Users, Groups, and Other Linux Beasts.md b/published/201812/20180710 Users, Groups, and Other Linux Beasts.md similarity index 100% rename from published/20180710 Users, Groups, and Other Linux Beasts.md rename to published/201812/20180710 Users, Groups, and Other Linux Beasts.md diff --git a/published/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/published/201812/20180716 Users, Groups and Other Linux Beasts- Part 2.md similarity index 100% rename from published/20180716 Users, Groups and Other Linux Beasts- Part 2.md rename to published/201812/20180716 Users, Groups and Other Linux Beasts- Part 2.md diff --git a/published/20180717 11 Uses for a Raspberry Pi Around the Office.md b/published/201812/20180717 11 Uses for a Raspberry Pi Around the Office.md similarity index 100% rename from published/20180717 11 Uses for a Raspberry Pi Around the Office.md rename to published/201812/20180717 11 Uses for a Raspberry Pi Around the Office.md diff --git a/published/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md b/published/201812/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md similarity index 100% rename from published/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md rename to published/201812/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md diff --git a/published/20180806 Systemd Timers- Three Use Cases.md b/published/201812/20180806 Systemd Timers- Three Use Cases.md similarity index 100% rename from published/20180806 Systemd Timers- Three Use Cases.md rename to published/201812/20180806 Systemd Timers- Three Use Cases.md diff --git a/published/20180814 HTTP request routing and validation with gorilla-mux.md b/published/201812/20180814 HTTP request routing and validation with gorilla-mux.md similarity index 100% rename from published/20180814 HTTP request routing and validation with gorilla-mux.md rename to published/201812/20180814 HTTP request routing and validation with gorilla-mux.md diff --git a/published/20180817 Mixing software development roles produces great results.md b/published/201812/20180817 Mixing software development roles produces great results.md similarity index 100% rename from published/20180817 Mixing software development roles produces great results.md rename to published/201812/20180817 Mixing software development roles produces great results.md diff --git a/published/20180826 How to Install and Use FreeDOS on VirtualBox.md b/published/201812/20180826 How to Install and Use FreeDOS on VirtualBox.md similarity index 100% rename from published/20180826 How to Install and Use FreeDOS on VirtualBox.md rename to published/201812/20180826 How to Install and Use FreeDOS on VirtualBox.md diff --git a/published/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/published/201812/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md similarity index 100% rename from published/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md rename to published/201812/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md diff --git a/published/20180831 Publishing Markdown to HTML with MDwiki.md b/published/201812/20180831 Publishing Markdown to HTML with MDwiki.md similarity index 100% rename from published/20180831 Publishing Markdown to HTML with MDwiki.md rename to published/201812/20180831 Publishing Markdown to HTML with MDwiki.md diff --git a/published/20180904 Why schools of the future are open.md b/published/201812/20180904 Why schools of the future are open.md similarity index 100% rename from published/20180904 Why schools of the future are open.md rename to published/201812/20180904 Why schools of the future are open.md diff --git a/published/20180911 Know Your Storage- Block, File - Object.md b/published/201812/20180911 Know Your Storage- Block, File - Object.md similarity index 100% rename from published/20180911 Know Your Storage- Block, File - Object.md rename to published/201812/20180911 Know Your Storage- Block, File - Object.md diff --git a/published/20180912 How to turn on an LED with Fedora IoT.md b/published/201812/20180912 How to turn on an LED with Fedora IoT.md similarity index 100% rename from published/20180912 How to turn on an LED with Fedora IoT.md rename to published/201812/20180912 How to turn on an LED with Fedora IoT.md diff --git a/published/20181004 Archiving web sites.md b/published/201812/20181004 Archiving web sites.md similarity index 100% rename from published/20181004 Archiving web sites.md rename to published/201812/20181004 Archiving web sites.md diff --git a/published/20181004 Lab 3- User Environments.md b/published/201812/20181004 Lab 3- User Environments.md similarity index 100% rename from published/20181004 Lab 3- User Environments.md rename to published/201812/20181004 Lab 3- User Environments.md diff --git a/published/20181016 Lab 4- Preemptive Multitasking.md b/published/201812/20181016 Lab 4- Preemptive Multitasking.md similarity index 100% rename from published/20181016 Lab 4- Preemptive Multitasking.md rename to published/201812/20181016 Lab 4- Preemptive Multitasking.md diff --git a/published/20181016 Lab 5- File system, Spawn and Shell.md b/published/201812/20181016 Lab 5- File system, Spawn and Shell.md similarity index 100% rename from published/20181016 Lab 5- File system, Spawn and Shell.md rename to published/201812/20181016 Lab 5- File system, Spawn and Shell.md diff --git a/published/20181022 Improve login security with challenge-response authentication.md b/published/201812/20181022 Improve login security with challenge-response authentication.md similarity index 100% rename from published/20181022 Improve login security with challenge-response authentication.md rename to published/201812/20181022 Improve login security with challenge-response authentication.md diff --git a/published/20181025 How to write your favorite R functions in Python.md b/published/201812/20181025 How to write your favorite R functions in Python.md similarity index 100% rename from published/20181025 How to write your favorite R functions in Python.md rename to published/201812/20181025 How to write your favorite R functions in Python.md diff --git a/published/20181026 Directing traffic- Demystifying internet-scale load balancing.md b/published/201812/20181026 Directing traffic- Demystifying internet-scale load balancing.md similarity index 100% rename from published/20181026 Directing traffic- Demystifying internet-scale load balancing.md rename to published/201812/20181026 Directing traffic- Demystifying internet-scale load balancing.md diff --git a/published/20181102 Create a containerized machine learning model.md b/published/201812/20181102 Create a containerized machine learning model.md similarity index 100% rename from published/20181102 Create a containerized machine learning model.md rename to published/201812/20181102 Create a containerized machine learning model.md diff --git a/published/20181105 5 Easy Tips for Linux Web Browser Security.md b/published/201812/20181105 5 Easy Tips for Linux Web Browser Security.md similarity index 100% rename from published/20181105 5 Easy Tips for Linux Web Browser Security.md rename to published/201812/20181105 5 Easy Tips for Linux Web Browser Security.md diff --git a/published/20181106 How to partition and format a drive on Linux.md b/published/201812/20181106 How to partition and format a drive on Linux.md similarity index 100% rename from published/20181106 How to partition and format a drive on Linux.md rename to published/201812/20181106 How to partition and format a drive on Linux.md diff --git a/published/20181107 Automate a web browser with Selenium.md b/published/201812/20181107 Automate a web browser with Selenium.md similarity index 100% rename from published/20181107 Automate a web browser with Selenium.md rename to published/201812/20181107 Automate a web browser with Selenium.md diff --git a/published/20181107 Top 30 OpenStack Interview Questions and Answers.md b/published/201812/20181107 Top 30 OpenStack Interview Questions and Answers.md similarity index 100% rename from published/20181107 Top 30 OpenStack Interview Questions and Answers.md rename to published/201812/20181107 Top 30 OpenStack Interview Questions and Answers.md diff --git a/published/20181112 A Free Guide for Setting Your Open Source Strategy.md b/published/201812/20181112 A Free Guide for Setting Your Open Source Strategy.md similarity index 100% rename from published/20181112 A Free Guide for Setting Your Open Source Strategy.md rename to published/201812/20181112 A Free Guide for Setting Your Open Source Strategy.md diff --git a/published/20181112 A Free, Secure And Cross-platform Password Manager.md b/published/201812/20181112 A Free, Secure And Cross-platform Password Manager.md similarity index 100% rename from published/20181112 A Free, Secure And Cross-platform Password Manager.md rename to published/201812/20181112 A Free, Secure And Cross-platform Password Manager.md diff --git a/published/20181112 The Source History of Cat.md b/published/201812/20181112 The Source History of Cat.md similarity index 100% rename from published/20181112 The Source History of Cat.md rename to published/201812/20181112 The Source History of Cat.md diff --git a/published/20181113 An introduction to Udev- The Linux subsystem for managing device events.md b/published/201812/20181113 An introduction to Udev- The Linux subsystem for managing device events.md similarity index 100% rename from published/20181113 An introduction to Udev- The Linux subsystem for managing device events.md rename to published/201812/20181113 An introduction to Udev- The Linux subsystem for managing device events.md diff --git a/published/20181115 3 best practices for continuous integration and deployment.md b/published/201812/20181115 3 best practices for continuous integration and deployment.md similarity index 100% rename from published/20181115 3 best practices for continuous integration and deployment.md rename to published/201812/20181115 3 best practices for continuous integration and deployment.md diff --git a/published/20181119 7 command-line tools for writers - Opensource.com.md b/published/201812/20181119 7 command-line tools for writers - Opensource.com.md similarity index 100% rename from published/20181119 7 command-line tools for writers - Opensource.com.md rename to published/201812/20181119 7 command-line tools for writers - Opensource.com.md diff --git a/published/20181119 9 obscure Python libraries for data science.md b/published/201812/20181119 9 obscure Python libraries for data science.md similarity index 100% rename from published/20181119 9 obscure Python libraries for data science.md rename to published/201812/20181119 9 obscure Python libraries for data science.md diff --git a/published/20181121 10 ways to give thanks to open source and free software maintainers.md b/published/201812/20181121 10 ways to give thanks to open source and free software maintainers.md similarity index 100% rename from published/20181121 10 ways to give thanks to open source and free software maintainers.md rename to published/201812/20181121 10 ways to give thanks to open source and free software maintainers.md diff --git a/published/20181121 Coupled commands with control operators in Bash.md b/published/201812/20181121 Coupled commands with control operators in Bash.md similarity index 100% rename from published/20181121 Coupled commands with control operators in Bash.md rename to published/201812/20181121 Coupled commands with control operators in Bash.md diff --git a/published/20181121 DevOps is for everyone.md b/published/201812/20181121 DevOps is for everyone.md similarity index 100% rename from published/20181121 DevOps is for everyone.md rename to published/201812/20181121 DevOps is for everyone.md diff --git a/published/20181121 How to swap Ctrl and Caps Lock keys in Linux.md b/published/201812/20181121 How to swap Ctrl and Caps Lock keys in Linux.md similarity index 100% rename from published/20181121 How to swap Ctrl and Caps Lock keys in Linux.md rename to published/201812/20181121 How to swap Ctrl and Caps Lock keys in Linux.md diff --git a/published/20181123 How to Build a Netboot Server, Part 1.md b/published/201812/20181123 How to Build a Netboot Server, Part 1.md similarity index 100% rename from published/20181123 How to Build a Netboot Server, Part 1.md rename to published/201812/20181123 How to Build a Netboot Server, Part 1.md diff --git a/published/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md b/published/201812/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md similarity index 100% rename from published/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md rename to published/201812/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md diff --git a/published/20181126 How to use the sudo command to deploy superuser powers on Linux.md b/published/201812/20181126 How to use the sudo command to deploy superuser powers on Linux.md similarity index 100% rename from published/20181126 How to use the sudo command to deploy superuser powers on Linux.md rename to published/201812/20181126 How to use the sudo command to deploy superuser powers on Linux.md diff --git a/published/20181128 OpenSnitch - an Application Firewall for Linux -Review.md b/published/201812/20181128 OpenSnitch - an Application Firewall for Linux -Review.md similarity index 100% rename from published/20181128 OpenSnitch - an Application Firewall for Linux -Review.md rename to published/201812/20181128 OpenSnitch - an Application Firewall for Linux -Review.md diff --git a/published/20181128 Standalone web applications with GNOME Web.md b/published/201812/20181128 Standalone web applications with GNOME Web.md similarity index 100% rename from published/20181128 Standalone web applications with GNOME Web.md rename to published/201812/20181128 Standalone web applications with GNOME Web.md diff --git a/published/20181129 4 open source Markdown editors.md b/published/201812/20181129 4 open source Markdown editors.md similarity index 100% rename from published/20181129 4 open source Markdown editors.md rename to published/201812/20181129 4 open source Markdown editors.md diff --git a/published/20181130 SMPlayer in Linux- Features, Download and Installation.md b/published/201812/20181130 SMPlayer in Linux- Features, Download and Installation.md similarity index 100% rename from published/20181130 SMPlayer in Linux- Features, Download and Installation.md rename to published/201812/20181130 SMPlayer in Linux- Features, Download and Installation.md diff --git a/published/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md b/published/201812/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md similarity index 100% rename from published/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md rename to published/201812/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md diff --git a/published/20181201 Boxing yourself in on the Linux command line.md b/published/201812/20181201 Boxing yourself in on the Linux command line.md similarity index 100% rename from published/20181201 Boxing yourself in on the Linux command line.md rename to published/201812/20181201 Boxing yourself in on the Linux command line.md diff --git a/published/20181202 Drive a locomotive through your Linux terminal.md b/published/201812/20181202 Drive a locomotive through your Linux terminal.md similarity index 100% rename from published/20181202 Drive a locomotive through your Linux terminal.md rename to published/201812/20181202 Drive a locomotive through your Linux terminal.md diff --git a/published/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md b/published/201812/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md similarity index 100% rename from published/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md rename to published/201812/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md diff --git a/published/20181204 3 implications of serverless.md b/published/201812/20181204 3 implications of serverless.md similarity index 100% rename from published/20181204 3 implications of serverless.md rename to published/201812/20181204 3 implications of serverless.md diff --git a/published/20181204 Have a cow at the Linux command line.md b/published/201812/20181204 Have a cow at the Linux command line.md similarity index 100% rename from published/20181204 Have a cow at the Linux command line.md rename to published/201812/20181204 Have a cow at the Linux command line.md diff --git a/published/20181205 Bash Variables- Environmental and Otherwise.md b/published/201812/20181205 Bash Variables- Environmental and Otherwise.md similarity index 100% rename from published/20181205 Bash Variables- Environmental and Otherwise.md rename to published/201812/20181205 Bash Variables- Environmental and Otherwise.md diff --git a/published/20181205 Bring some color to your Linux terminal with lolcat.md b/published/201812/20181205 Bring some color to your Linux terminal with lolcat.md similarity index 100% rename from published/20181205 Bring some color to your Linux terminal with lolcat.md rename to published/201812/20181205 Bring some color to your Linux terminal with lolcat.md diff --git a/published/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md b/published/201812/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md similarity index 100% rename from published/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md rename to published/201812/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md diff --git a/published/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md b/published/201812/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md similarity index 100% rename from published/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md rename to published/201812/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md diff --git a/published/20181206 Take a break at the Linux command line with Nyan Cat.md b/published/201812/20181206 Take a break at the Linux command line with Nyan Cat.md similarity index 100% rename from published/20181206 Take a break at the Linux command line with Nyan Cat.md rename to published/201812/20181206 Take a break at the Linux command line with Nyan Cat.md diff --git a/published/20181208 Play Tetris at your Linux terminal.md b/published/201812/20181208 Play Tetris at your Linux terminal.md similarity index 100% rename from published/20181208 Play Tetris at your Linux terminal.md rename to published/201812/20181208 Play Tetris at your Linux terminal.md diff --git a/published/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md b/published/201812/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md similarity index 100% rename from published/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md rename to published/201812/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md diff --git a/published/20181210 How to get started in AI.md b/published/201812/20181210 How to get started in AI.md similarity index 100% rename from published/20181210 How to get started in AI.md rename to published/201812/20181210 How to get started in AI.md diff --git a/published/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md b/published/201812/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md similarity index 100% rename from published/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md rename to published/201812/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md diff --git a/published/20181212 Aliases- DIY Shell Commands.md b/published/201812/20181212 Aliases- DIY Shell Commands.md similarity index 100% rename from published/20181212 Aliases- DIY Shell Commands.md rename to published/201812/20181212 Aliases- DIY Shell Commands.md diff --git a/published/20181212 How to Build a Netboot Server, Part 2.md b/published/201812/20181212 How to Build a Netboot Server, Part 2.md similarity index 100% rename from published/20181212 How to Build a Netboot Server, Part 2.md rename to published/201812/20181212 How to Build a Netboot Server, Part 2.md diff --git a/published/20181212 Patch into The Matrix at the Linux command line.md b/published/201812/20181212 Patch into The Matrix at the Linux command line.md similarity index 100% rename from published/20181212 Patch into The Matrix at the Linux command line.md rename to published/201812/20181212 Patch into The Matrix at the Linux command line.md diff --git a/published/20181213 Relax by the fire at your Linux terminal.md b/published/201812/20181213 Relax by the fire at your Linux terminal.md similarity index 100% rename from published/20181213 Relax by the fire at your Linux terminal.md rename to published/201812/20181213 Relax by the fire at your Linux terminal.md diff --git a/published/20181214 How To Install Rust Programming Language In Linux.md b/published/201812/20181214 How To Install Rust Programming Language In Linux.md similarity index 100% rename from published/20181214 How To Install Rust Programming Language In Linux.md rename to published/201812/20181214 How To Install Rust Programming Language In Linux.md diff --git a/published/20181217 Take a swim at your Linux terminal with asciiquarium.md b/published/201812/20181217 Take a swim at your Linux terminal with asciiquarium.md similarity index 100% rename from published/20181217 Take a swim at your Linux terminal with asciiquarium.md rename to published/201812/20181217 Take a swim at your Linux terminal with asciiquarium.md diff --git a/published/20181221 Listen to the radio at the Linux terminal.md b/published/201812/20181221 Listen to the radio at the Linux terminal.md similarity index 100% rename from published/20181221 Listen to the radio at the Linux terminal.md rename to published/201812/20181221 Listen to the radio at the Linux terminal.md From 06e26dd6367dbe7674f7a5405c74794d48e03f01 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 00:36:00 +0800 Subject: [PATCH 0382/4278] PRF:20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md @qhwdw --- ...ving Your Master Key to Offline Storage.md | 105 ++++++++---------- 1 file changed, 46 insertions(+), 59 deletions(-) diff --git a/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md index 8ca36884d9..666c661806 100644 --- a/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md +++ b/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md @@ -1,129 +1,117 @@ 用 PGP 保护代码完整性(四):将主密钥移到离线存储中 ====== +> 如果开发者的 PGP 密钥被偷了,危害非常大。了解一下如何更安全。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/industry-1920.jpg?itok=gI3QraS8) + 在本系列教程中,我们为使用 PGP 提供了一个实用指南。你可以从下面的链接中查看前面的文章: -[第一部分:基本概念和工具][1] +- [第一部分:基本概念和工具][1] +- [第二部分:生成你的主密钥][2] +- [第三部分:生成 PGP 子密钥][3] -[第二部分:生成你的主密钥][2] +这是本系列教程的第四部分,我们继续本教程,我们将谈一谈如何及为什么要将主密钥从你的家目录移到离线存储中。现在开始我们的教程。 -[第三部分:生成 PGP 子密钥][3] - -这是本系列教程的第四部分,我们继续本教程,我们将谈一谈如何及为什么要将主密钥从你的 Home 目录移到离线存储中。现在开始我们的教程。 - -### 清单 +#### 清单 * 准备一个加密的可移除的存储(必要) - * 备份你的 GnuPG 目录(必要) + * 从你的家目录中删除主密钥(推荐) + * 从你的家目录中删除吊销证书(推荐) - * 从你的 Home 目录中删除主密钥(推荐) +#### 考虑事项 - * 从你的 Home 目录中删除吊销证书(推荐) +为什么要从你的家目录中删除你的主 [C] 密钥 ?这样做的主要原因是防止你的主密钥失窃或意外泄露。对于心怀不轨的人来说,私钥对他们具有很大的诱惑力 —— 我们知道有几个恶意软件成功地实现了扫描用户的家目录并将发现的私钥内容上传。 +对于开发者来说,私钥失窃是非常危险的事情 —— 在自由软件的世界中,这无疑是身份证明失窃。从你的家目录中删除私钥将帮你防范这类事件的发生。 - - -#### Considerations - -为什么要从你的 Home 目录中删除你的主密钥 [C] ?这样做的主要原因是防止你的主密钥失窃或意外泄露。对于心怀不轨的人来说,私钥对他们具有很大的诱惑力 —— 我们知道有几个恶意软件成功地实现了扫描用户的 Home 目录并将发现的任何私钥内容上传。 - -对于任何开发者来说,私钥失窃是非常危险的事情 —— 在自由软件的世界中,这无疑是身份证明失窃。从你的 Home 目录中删除私钥将帮你防范这类事件的发生。 - -##### 备份你的 GnuPG 目录 +#### 备份你的 GnuPG 目录 **!!!绝对不要跳过这一步!!!** 备份你的 PGP 密钥将让你在需要的时候很容易地恢复它们,这很重要!(这与我们做的使用 paperkey 的灾难级备份是不一样的)。 -##### 准备可移除的加密存储 +#### 准备可移除的加密存储 我们从取得一个(最好是两个)小型的 USB “拇指“ 驱动器(可加密 U 盘)开始,我们将用它来做备份。你首先需要去加密它们: 加密密码可以使用与主密钥相同的密码。 -##### 备份你的 GnuPG 目录 +#### 备份你的 GnuPG 目录 -加密过程结束之后,重新插入 USB 驱动器并确保它能够正常挂载。你可以通过运行 `mount` 命令去找到设备挂载点的完全路径。(在 Linux 下,外置介质一般挂载在 /media/disk 下,Mac 一般在它的 /Volumes 下) +加密过程结束之后,重新插入 USB 驱动器并确保它能够正常挂载。你可以通过运行 `mount` 命令去找到设备挂载点的完全路径。(在 Linux 下,外置介质一般挂载在 `/media/disk` 下,Mac 一般在它的 `/Volumes` 下) 你知道了挂载点的全路径后,将你的整个 GnuPG 的目录复制进去: + ``` $ cp -rp ~/.gnupg [/media/disk/name]/gnupg-backup - ``` (注意:如果出现任何套接字不支持的错误,没有关系,直接忽略它们。) 现在,用如下的命令去测试一下,确保它们能够正常地工作: + ``` $ gpg --homedir=[/media/disk/name]/gnupg-backup --list-key [fpr] - ``` 如果没有出现任何错误,说明一切正常。弹出这个 USB 驱动器并给它粘上一个明确的标签,以便于你下次需要它时能够很快找到它。接着,将它放到一个安全的 —— 但不要太远 —— 的地方,因为从现在起,你需要偶尔使用它来做一些像编辑身份信息、添加或吊销子证书、或签署其它人的密钥这样的事情。 -##### 删除主密钥 +#### 删除主密钥 -我们 Home 目录中的文件并没有像我们所想像的那样受到保护。它们可能会通过许多不同的方式被泄露或失窃: +我们家目录中的文件并没有像我们所想像的那样受到保护。它们可能会通过许多不同的方式被泄露或失窃: * 通过快速复制来配置一个新工作站时的偶尔事故 - * 通过系统管理员的疏忽或恶意操作 - * 通过安全性欠佳的备份 - * 通过桌面应用中的恶意软件(浏览器、pdf 查看器等等) - * 通过跨境胁迫 +使用一个很好的密码来保护你的密钥是降低上述风险的一个很好方法,但是密码能够通过键盘记录器、背后窥视、或其它方式被发现。基于以上原因,我们建议去配置一个从你的家目录上可移除的主密钥,将它保存在一个离线存储中。 - - -使用一个很好的密码来保护你的密钥是降低上述风险的一个很好方法,但是密码能够通过键盘记录器、背后窥视、或其它方式被发现。基于以上原因,我们建议去配置一个从你的 Home 目录上可移除的主密钥,将它保存在一个离线存储中。 - -###### 删除主密钥 +##### 删除你的主密钥 **请查看前面的节,确保你有完整的你的 GnuPG 目录的一个备份。如果你没有一个可用的备份,下面所做的操作将会使你的主密钥失效!!!** 首先,识别你的主密钥的 keygrip: + ``` $ gpg --with-keygrip --list-key [fpr] - ``` 它的输出应该像下面这样: -``` -pub rsa4096 2017-12-06 [C] [expires: 2019-12-06] - 111122223333444455556666AAAABBBBCCCCDDDD - Keygrip = AAAA999988887777666655554444333322221111 -uid [ultimate] Alice Engineer -uid [ultimate] Alice Engineer -sub rsa2048 2017-12-06 [E] - Keygrip = BBBB999988887777666655554444333322221111 -sub rsa2048 2017-12-06 [S] - Keygrip = CCCC999988887777666655554444333322221111 ``` +pub rsa4096 2017-12-06 [C] [expires: 2019-12-06] + 111122223333444455556666AAAABBBBCCCCDDDD + Keygrip = AAAA999988887777666655554444333322221111 +uid [ultimate] Alice Engineer +uid [ultimate] Alice Engineer +sub rsa2048 2017-12-06 [E] + Keygrip = BBBB999988887777666655554444333322221111 +sub rsa2048 2017-12-06 [S] + Keygrip = CCCC999988887777666655554444333322221111 +``` + +找到 `pub` 行下方的 `Keygrip` 条目(就在主密钥指纹的下方)。它与你的家目录下 `.gnupg` 目录下的一个文件是一致的: -找到 pub 行下方的 keygrip 条目(就在主密钥指纹的下方)。它与你的 Home 目录下 `.gnupg` 目录下的一个文件是一致的: ``` $ cd ~/.gnupg/private-keys-v1.d $ ls AAAA999988887777666655554444333322221111.key BBBB999988887777666655554444333322221111.key CCCC999988887777666655554444333322221111.key - ``` 现在你做的全部操作就是简单地删除与主密钥 keygrip 一致的 `.key` 文件: + ``` $ cd ~/.gnupg/private-keys-v1.d $ rm AAAA999988887777666655554444333322221111.key - ``` -现在,如果运行 --list-secret-keys 命令将出现问题,它将显示主密钥丢失(# 表示不可用): +现在,如果运行 `--list-secret-keys` 命令将出现问题,它将显示主密钥丢失(`#` 表示不可用): + ``` $ gpg --list-secret-keys sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] @@ -132,23 +120,22 @@ uid [ultimate] Alice Engineer uid [ultimate] Alice Engineer ssb rsa2048 2017-12-06 [E] ssb rsa2048 2017-12-06 [S] - ``` -##### 删除吊销证书 +#### 删除吊销证书 你应该去删除的另一个文件是吊销证书(**删除之前,确保你的备份中有它**),它是使用你的主密钥自动创建的。吊销证书允许一些人去永久标记你的证书为吊销状态,这意味着它无论在任何用途中将不再被使用或信任。一般是使用它来吊销由于某些原因不再受控的一个密钥 —— 比如,你丢失了密钥密码。 -与使用主密钥一样,如果一个吊销证书泄露到恶意者手中,他们能够使用它去破坏你的开发者数字身份,因此,最好是从你的 Home 目录中删除它。 +与使用主密钥一样,如果一个吊销证书泄露到恶意者手中,他们能够使用它去破坏你的开发者数字身份,因此,最好是从你的家目录中删除它。 + ``` cd ~/.gnupg/openpgp-revocs.d rm [fpr].rev - ``` 在下一篇文章中,你将学习如何保护你的子密钥。敬请期待。 -从来自 Linux 基金会和 edX 的免费课程 [“Linux 入门" ][4] 中学习更多 Linux 知识。 +从来自 Linux 基金会和 edX 的免费课程 [“Linux 入门”][4] 中学习更多 Linux 知识。 -------------------------------------------------------------------------------- @@ -156,12 +143,12 @@ via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-p 作者:[Konstantin Ryabitsev][a] 译者:[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.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[1]:https://linux.cn/article-9524-1.html +[2]:https://linux.cn/article-9529-1.html +[3]:https://linux.cn/article-9607-1.html [4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From f50536e8c2cdbd176b2b174492336cf847f0253a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 00:39:36 +0800 Subject: [PATCH 0383/4278] PUB:20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md @qhwdw https://linux.cn/article-10402-1.html --- ...ith PGP - Part 4- Moving Your Master Key to Offline Storage.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md (100%) diff --git a/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/published/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md similarity index 100% rename from translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md rename to published/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md From c6f8cc7dfa8279228375489c549ea83d999179d3 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 1 Jan 2019 14:10:04 +0800 Subject: [PATCH 0384/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Two=20Years=20W?= =?UTF-8?q?ith=20Emacs=20as=20a=20CEO=20(and=20now=20CTO)?= 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 | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md diff --git a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md new file mode 100644 index 0000000000..3e1f5d1eb2 --- /dev/null +++ b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +Two Years With Emacs as a CEO (and now CTO) +====== + +Two years ago, I wrote [a blog post][1] that got some notice, which surprised me. It was a piece about going back to Emacs as my primary content creation tool, first as a CEO, and now as a CTO. A brief recap is that I spent most of my career as a programmer and a software architect, and preferred Emacs as my code editor for much of that time. Reconsidering Emacs was an experiment that I was excited about, but wasn't sure how it would work out. On the Internet, the post was met with roughly equal parts disdain and appreciation, but tens of thousands of people read it, so it seems that I touched on something interesting. Some of the more challenging and funny posts on [Reddit][2] and [HackerNews][3] predicted that I'd have hands shaped like claws or that I'd have lost my eyesight because I use white backgrounds. I'm pleased to report that no dire consequences resulted, and in fact my wrists are thanking me for the decision. Some folks worried that using Emacs would be a cognitive drain on a CEO. Having taken Fugue from an idea in my backyard to a powerful product with great and enthusiastic customers, I find Emacs to be a solace from things that are actually difficult. I still use white backgrounds. + +Recently, the post was rediscovered and posted to [HackerNews][4]. I got a number of requests to follow up with a post on how things have gone since, so this is that report. In this post, I will also focus on why Emacs and functional programming are highly relevant now; and how Emacs works with our product, Fugue, that uses functional programming to automate cloud computing. I received a lot of feedback that the level of detail and color commentary were useful, so this post is also fairly verbose and I do spend some effort on explaining my thinking. I've recently moved from the CEO to CTO role here at Fugue, but the content of this post reflects the work I have been doing as CEO. I expect to do more work in code with Emacs going forward, so I have some yak shaving ahead. As always, YMMV, caveat emptor, etc. + +### It worked out better than I suspected it would + +My time is filled with nearly constant communication outside of and within the company. Communication is how things get done in the world, and the enemy of reflection and real contemplation of difficult or complex problems. The rarest commodity for me as a startup CEO is time to focus without distraction. Emacs is particularly good for this, once you've invested the time to learn a handful of commands. Other applications call out to be noticed, but a well configured Emacs gets out of the way both visually and mentally. It doesn't change unless you want it to, and there is no cleaner interface than a blank screen and beautiful typography. In my world of constant interruption, this simplicity allows me to focus solely on what I am thinking rather than the computer. The best programs provide access to the computer without demanding attention. + +A few folks pointed out that the original post was as much a criticism of modern computer interfaces as a recommendation of Emacs. I agree and disagree. Modern interfaces, and particularly their application-centric approach (vs. content-centric), are not user focused or task oriented. Emacs avoids this fallacy, which is part of why I like it so much, but it brings other merits to the table as well. Emacs is a portal into the power of the computer itself, and that is a rabbit hole worth descending. Its idioms are paths to discovering and creating your own, and that for me is the definition of creativity. One of the sad things about modern computing is that it is largely made up of black boxes with shiny interfaces that provide momentary gratification rather than real satisfaction. This makes us into consumers rather than creators/makers of technology. I don't care who you are or what your background is; you can understand your computer, and you can make things with it. It's fun, satisfying, and not as hard as you think to get started! + +We often underappreciate the effects of our environments on our psychology. Emacs imparts a feeling of calm and freedom, rather than of urgency, annoyance, or excitement - the latter of which are enemies of thought and contemplation. I like things that last, get out of the way, and provide insight when I do take the time to pay attention to them. Emacs meets all these criteria for me. I use Emacs every day for content creation, and I'm very pleased with how little I think about it. Emacs does have a learning curve, but it's no steeper than a bicycle, and has a similar payoff in that once you are through it, you don't have to think about it anymore, and it imparts a feeling of freedom that other tools don't. It's an elegant tool, from a more civilized age. I'm happy that we seem to be entering another civilized age in computing, and so Emacs is gaining in popularity. + +### I gave up on using Org-mode for schedules and to-do lists + +I spent some words in the original post on using Org-mode for schedules. I gave up on using Org-mode for to dos and the like, as I have to coordinate many meetings and calls every day with dozens of people, and I cannot ask the rest of the world to adapt to my choice of tools, nor do I have the time to transcribe or automate moving things to Org. We are primarily a Mac shop, use Google Calendar etc., and the native Mac OS/iOS tools do a good job for collaboration. I also use a plain old pen for note-taking during meetings, as I find laptop/keyboard use in meetings to be rude and limiting to my ability to listen and think. Therefore I've largely abandoned the idea that Emacs/org can help me with my schedule or organizing my life. Org-mode is great for lots of other things too though, and is my go-to for writing documents, including this one. In other words, I use it largely in ways the author didn't intend, and it's great at them. I hope someone says the same of our work at Fugue someday. + +### Emacs use has spread at Fugue + +I started the original post with an admonition that you may love Emacs, but will probably hate it. I was therefore a little concerned when the documentation team at Fugue picked it as their standard tool, as I thought perhaps they were influenced by my appreciation for it. A couple years later, I'm pretty sure that it was a good call for them. The leader of the team at the time was a very bright programmer, but the two writers we hired to make the Fugue documentation had less technical backgrounds. I figured that if it was a case of a manager imposing the wrong tool, I'd hear about it and it would resolve itself, as Fugue has an anti-authoritarian culture where people are unafraid to call bullshit on anything or anyone, including me. The original manager left Fugue last year, but the docs team now has a slick, integrated CI/CD toolchain for [docs.fugue.co][5], and they've become enthusiastic Emacs users. There is a learning curve for Emacs, but it's not that tall even if it is steep, and climbing it has real benefits in productivity and general happiness. It was also a reminder that liberal arts focused people are every bit as smart and capable with technology as programmers, and perhaps less prone to technology religions and tribalism. + +### My wrists are thanking me + +I've been spending 12 hours a day or so at a computer since the mid-eighties, and it has taken a toll on my wrists (as well as my back, for which I unreservedly recommend the Tag Capisco chair). The combination of Emacs and an ergonomic keyboard has made the RSI wrist issues go away to the point that I haven't thought about it in over a year. Prior to that, I was having daily pain, particularly in my right wrist, and if you've had this issue, you know it can be very distracting and worrying. A few folks asked about keyboards and mice, so if you're interested I'm currently using a [keyboard.io][6] though I've mainly used a Truly Ergonomic keyboard over the last couple years. I'm a few weeks into using the keyboard.io, and I absolutely love it. The shaped key caps are amazing for knowing where you are without looking, and the thumb keys seem obvious in retrospect, particularly for Emacs, where Control and Meta are your constant companions. No more using the pinkie for highly repetitive tasks! + +The amount of mousing I do is much lower than when using Office and IDEs, and that has helped a lot, but I do still need a mouse. I've been using the rather dated looking but highly functional and ergonomic Clearly Superior trackball, which lives up to its name. + +Specific tools aside, the main point is that a great keyboard combined with mouse avoidance has proved very effective at reducing wear and tear on my body. Emacs is central to this because I don't have to mouse around menus to get things done, and the navigation keys are right under my fingers. I'm pretty convinced now that hand movement away from the standard typing position causes a lot of tendon stress for me. YMMV, I'm not a doctor, etc. + +### I haven't done much to my config... + +Some predicted that I'd spend a lot of time yak shaving my configuration. I wondered if they were right, so I paid attention. Not only have I left my config largely alone, paying attention to the issue has made me realize just how much the other tools I use demand my attention and time. Emacs is easily the lowest maintenance piece of software I use. Mac OS and Windows are constantly demanding that I update them, but that's far less intrusive than Adobe Suite and Office's update intrusions in my world. I do occasionally update my Emacs, but it still works the same way, so it's largely a near zero cost operation for me, and one I can choose to do when I please. + +I'm sorry to disappoint, as a number of folks wanted to know what I've done to keep up with a renewed Emacs community and its output, but I've only added a few things to my config over the last two years. I consider this a success, as Emacs is a tool, not a hobby for me. That said, I'd love to hear about new things if you want to share. + +### ...Except for controlling the cloud + +We have a lot of Emacs fans at Fugue, so we've had a [Ludwig-mode][7] for a while now. Ludwig is our declarative, functional DSL for automating cloud infrastructure and services. Recently, Alex Schoof took some flight and evening hours to build fugue-mode, which acts as an Emacs console over the Fugue CLI. If you aren't familiar with Fugue, we make a cloud automation and governance tool that leverages functional programming to give users a great experience of interacting with cloud APIs. Well, it does a lot more than that, but it does that too. Fugue-mode is cool for a number of reasons. It allows me to have a buffer that is constantly reporting on the status of my cloud infrastructure, and since I often modify that infrastructure, I can quickly see the effects of my coding. Fugue organizes cloud workloads into processes, and Fugue-mode is a lot like top for cloud workloads. It also allows me to perform operations like creating new infrastructure or deleting stuff that isn't needed anymore, without much typing. Fugue-mode is a prototype, but it's pretty handy and I now use it regularly. + +![fugue-mode-edited.gif][8] + +### Modes and monitors + +I have added a few modes and integrations, but not really for work/CEO functions. I've been hacking around in Haskell and Scheme on the weekends for fun, so I've added haskell-mode and geiser. Emacs is great for languages that have a REPL, as you can divide up your screen into different "windows" that are running different modes, including REPLs or shells. Geiser is great for Scheme, and if you've not done so, working through SICP is a joy and possibly a revelation in an age that has lots of examples of cargo cult programming. Install MIT Scheme and geiser and you've got something that feels a bit like the Symbolics environments of lore. + +This brings up another topic I didn't cover in the 2015 post: screen management. I like to use a single portrait mode monitor for writing, and I have this configuration at my home and at my primary office. For programming or mixed use, I like the new ultra-wide monitors that we provide to all Fuguers. For these, I prefer to divide my screen into three columns, with the center having my main editing buffer, the left side having a shell and a fugue-mode buffer divided horizontally, and the right having either a documentation buffer or another editing buffer or two. This is easily done by first using 'Ctl-x 3' twice, then 'Ctl-x =' to make the windows equal in width. This will give you three equal columns that you can further subdivide as you like with 'Ctl-x 2' for horizontal divisions. Here's a screenshot of what this looks like. + +![Emacs Screen Shot][9] + +### This will be my last CEO/Emacs post... + +The first reason for this is that I'm now the CTO of Fugue, but also because there are so many topics I'm looking forward to blogging about and now I should have time to do so. I'm planning on doing some deeper dive posts on topics like functional programming, type safety for infrastructure-as-code, and as we roll out some awesome new Fugue capabilities, some posts on what is achievable on the cloud using Fugue. + +-------------------------------------------------------------------------------- + +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/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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 +[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 +[5]: https://docs.fugue.co/ +[6]: https://shop.keyboard.io/ +[7]: https://github.com/fugue/ludwig-mode +[8]: https://www.fugue.co/hubfs/Imported_Blog_Media/fugue-mode-edited-1.gif +[9]: https://www.fugue.co/hs-fs/hubfs/Emacs%20Screen%20Shot.png?width=929&name=Emacs%20Screen%20Shot.png From 9adb867080e2dfc35d11bc0a136c697b05c3ade5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 16:57:47 +0800 Subject: [PATCH 0385/4278] PRF:20181222 A Tale of HTTP-2.md @geekpi --- translated/tech/20181222 A Tale of HTTP-2.md | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181222 A Tale of HTTP-2.md b/translated/tech/20181222 A Tale of HTTP-2.md index 9fcaddfad9..1c872981f1 100644 --- a/translated/tech/20181222 A Tale of HTTP-2.md +++ b/translated/tech/20181222 A Tale of HTTP-2.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (A Tale of HTTP/2) @@ -14,7 +14,7 @@ 说实话,我刚刚重写了管理我们备份程序的 Puppet 代码,启用 HTTP/2 似乎是一种转向另一个大型项目之前有效的拖延方式。这有多难? -结果我花了大约 25 个小时来完成。坐下来穿上舒适的拖鞋,因为这是一个 HTTP/2 的故事! +结果我花了大约 25 个小时来完成。坐下来穿上舒适的拖鞋,听听这个 HTTP/2 的故事! [![The Yule Log][2]][3] @@ -25,15 +25,15 @@ ``` Protocols h2 h2c http/1.1 -H2Push on -H2PushPriority core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated after -H2PushPriority text/css before -H2PushPriority image/jpeg after 32 -H2PushPriority image/png after 32 -H2PushPriority application/javascript interleaved +H2Push on +H2PushPriority * after +H2PushPriority text/css before +H2PushPriority image/jpeg after 32 +H2PushPriority image/png after 32 +H2PushPriority application/javascript interleaved ``` -这当然很容易。即使 Apache 中的所有内容都已正确设置,网站仍然可以使用 HTTP/1.1。不过,显然我做得没错,因为我的网站现在发送了一个新的 HTTP 头:`Upgrade: h2, h2c`。 +这当然很容易。即使 Apache 中的所有内容都已正确设置,网站仍然使用的是 HTTP/1.1。不过,显然我做得没错,因为我的网站现在发送了一个新的 HTTP 头:`Upgrade: h2, h2c`。 在浪费了大量时间调试 TLS 密钥(HTTP/2 [与 TLS 1.1 不兼容][4])之后,我终于发现问题是没有使用正确的 Apache 多进程处理模块。 @@ -43,13 +43,13 @@ H2PushPriority application/javascript interleaved ![A clip from Alice in Wonderlands][5] -在很长一段时间里,一位好友一直试图让我相信 [PHP-FPM][6] 的优点。虽然纸上看起来很好, 但我从来没有真正试过。它看起来很复杂。常规的 `mod_php` 做得很好,还有其他事情需要我注意。 +在很长一段时间里,一位好友一直试图让我相信 [PHP-FPM][6] 的优点。虽然表面上看起来很好,但我从来没有真正试过。它看起来很复杂。常规的 `mod_php` 做得很好,还有其他事情需要我注意。 事实上,这次的 HTTP/2 事件是让我钻研它的一个契机。在我理解了 FPM 池的工作原理后,它实际上很容易设置。由于我不得不重写我们用于部署网站的 Puppet 配置文件,我也借此机会巩固了一堆东西。 PHP-FPM 允许你在不同的 Unix 用户下运行网站来增加隔离性。最重要的是,我决定是时候让我们服务器上的 PHP 代码以只读模式运行,并且不得不为我们的 Wordpress、Nextcloud、KanBoard 和 Drupal 实例调整一些东西来减少报错。 -过了很长时间通过 Puppet 的自动任务后,我终于能够在任何地方关闭 `mod_php` 和 `mpm_prefork` 并启用 `mpm_event` 和 `mod_http2`。PHP-FPM 和 HTTP/2 带来的速度提升不错,但更让我感到高兴的是这次磨练增强了我们的 Apache 处理 PHP 的能力。 +过了很长时间通过 Puppet 的自动任务后,我终于能够全部关闭 `mod_php` 和 `mpm_prefork` 并启用 `mpm_event` 和 `mod_http2`。PHP-FPM 和 HTTP/2 带来的速度提升不错,但更让我感到高兴的是这次磨练增强了我们的 Apache 处理 PHP 的能力。 ![Victory!][7] @@ -60,7 +60,7 @@ via: https://veronneau.org/a-tale-of-http2.html 作者:[Louis-Philippe Véronneau][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/) 荣誉推出 @@ -72,4 +72,4 @@ via: https://veronneau.org/a-tale-of-http2.html [4]: https://http2.github.io/http2-spec/#TLSUsage [5]: https://veronneau.org/media/blog/2018-12-22/mod_php.gif (A clip from Alice in Wonderlands) [6]: https://wiki.apache.org/httpd/PHP-FPM -[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) \ No newline at end of file +[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) From d45457e8d38c634c8a096c37813c40f61235c887 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 17:03:49 +0800 Subject: [PATCH 0386/4278] PUB:20181222 A Tale of HTTP-2.md @geekpi https://linux.cn/article-10404-1.html --- {translated/tech => published}/20181222 A Tale of HTTP-2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181222 A Tale of HTTP-2.md (98%) diff --git a/translated/tech/20181222 A Tale of HTTP-2.md b/published/20181222 A Tale of HTTP-2.md similarity index 98% rename from translated/tech/20181222 A Tale of HTTP-2.md rename to published/20181222 A Tale of HTTP-2.md index 1c872981f1..1374a98481 100644 --- a/translated/tech/20181222 A Tale of HTTP-2.md +++ b/published/20181222 A Tale of HTTP-2.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10404-1.html) [#]: subject: (A Tale of HTTP/2) [#]: via: (https://veronneau.org/a-tale-of-http2.html) [#]: author: (Louis-Philippe Véronneau https://veronneau.org/) From 582d5ade684ca3009e84f70ce0a601e3c3c8b904 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 17:18:10 +0800 Subject: [PATCH 0387/4278] PRF:20181221 How to Build a Netboot Server, Part 3.md @qhwdw --- ...1 How to Build a Netboot Server, Part 3.md | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/translated/tech/20181221 How to Build a Netboot Server, Part 3.md b/translated/tech/20181221 How to Build a Netboot Server, Part 3.md index e174248f62..f36338fd7b 100644 --- a/translated/tech/20181221 How to Build a Netboot Server, Part 3.md +++ b/translated/tech/20181221 How to Build a Netboot Server, Part 3.md @@ -1,22 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (How to Build a Netboot Server, Part 3) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -如何构建一台网络引导服务器(第三部分) +如何构建一台网络引导服务器(三) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot3-816x345.jpg) -在 [如何构建一台网络引导服务器(第一部分)][1] 的文章中,我们提供了一个极简的 [iPXE][2] 引导脚本来引导你的网络引导镜像。许多用户除了使用网络引导镜像外,可能在机器本地也有一个操作系统。但是使用常见的工作站的 BIOS 去切换引导加载器是很笨拙的。在本系列文件的第三部分,我们将向你展示如何设置一个更复杂的 iPXE 配置。它将允许终端用户以更容易的方式去选择引导哪个操作系统。它也可以配置为让系统管理员从一台中央服务器来统一管理引导菜单。 +在 [如何构建一台网络引导服务器(一)][1] 中,我们提供了一个极简的 [iPXE][2] 引导脚本来引导你的网络引导镜像。许多用户除了使用网络引导镜像外,可能在机器本地也有一个操作系统。但是使用常见的工作站的 BIOS 去切换引导加载器是很笨拙的。在本系列文件的第三部分,我们将向你展示如何设置一个更复杂的 iPXE 配置。它将允许终端用户以更容易的方式去选择引导哪个操作系统。它也可以配置为让系统管理员从一台中央服务器来统一管理引导菜单。 ### 一个交互式 iPXE 引导菜单 -下面这些命令重定义了网络引导镜像的 boot.cfg 来作为一个交互式的 iPXE 引导菜单,并使用了一个 5 秒倒计时的定时器: +下面这些命令重定义了网络引导镜像的 `boot.cfg` 来作为一个交互式的 iPXE 引导菜单,并使用了一个 5 秒倒计时的定时器: ``` $ MY_FVER=29 @@ -61,22 +61,20 @@ END 上述菜单有五个节: - * **menu** 定义了显示在屏幕上的实际菜单内容。 - * **failed** 提示用户发生了错误,并将用户带到 shell 以错误错误。 - * **shell** 提供了交互式命令提示符。你可以在引导菜单出现时按下 **Esc** 键进入,或者是 - “boot” 命令失败时也会进入到命令提示符。 - * **lcl** 包含一个提供给 iPXE 退出的简单命令,以及返还控制权给 BIOS。在 iPXE 之后,无论你希望缺省引导的设备(即:工作站的本地硬件)是什么,都必须在你的工作站的 BIOS 中正确地作为下一个引导设备列出来。 - * **f29** 包含前面文章提到同一个网络引导代码,但使用最终的退出代码来替换掉 goto failed。 + * `menu` 定义了显示在屏幕上的实际菜单内容。 + * `failed` 提示用户发生了错误,并将用户带到 shell 以错误错误。 + * `shell` 提供了交互式命令提示符。你可以在引导菜单出现时按下 `Esc` 键进入,或者是 + `boot` 命令失败时也会进入到命令提示符。 + * `lcl` 包含一个提供给 iPXE 退出的简单命令,以及返还控制权给 BIOS。在 iPXE 之后,无论你希望缺省引导的设备(即:工作站的本地硬件)是什么,都必须在你的工作站的 BIOS 中正确地作为下一个引导设备列出来。 + * `f29` 包含前面文章提到同一个网络引导代码,但使用最终的退出代码来替换掉 `goto failed`。 - - -从你的 `$HOME/esp/linux` 目录中复制更新后的 boot.cfg 到所有客户端系统的 ESP 中。如果一切顺利,你应该会看到类似下面图片的结果: +从你的 `$HOME/esp/linux` 目录中复制更新后的 `boot.cfg` 到所有客户端系统的 ESP 中。如果一切顺利,你应该会看到类似下面图片的结果: ![][3] ### 一个服务器托管的引导菜单 -你可以添加到网络引导服务器的另一个特性是,能够从一台中央位置去管理所有客户端的引导菜单。这个特性尤其适用于批量安装(升级)一个新版本的操作系统。在你将新内核和新的 initramfs 复制到所有客户端的 ESP 之后,这个特性可以让你执行一种 [原子事务][4] 去切换所有客户端到新操作系统。 +你可以添加到网络引导服务器的另一个特性是,能够从一台中央位置去管理所有客户端的引导菜单。这个特性尤其适用于批量安装(升级)一个新版本的操作系统。在你将新内核和新的 `initramfs` 复制到所有客户端的 ESP 之后,这个特性可以让你执行一种 [原子事务][4] 去切换所有客户端到新操作系统。 安装 Mojolicious: @@ -116,9 +114,9 @@ END END ``` -这是一个非常简单的 Mojolicious 应用程序,它监听 80 端口,并且只回复到 /menu 的请求。如果你想快速了解 Mojolicious 能做什么,运行 `man Mojolicious::Guides::Growing` 去查看手册。按 **Q** 键退出手册。 +这是一个非常简单的 Mojolicious 应用程序,它监听 80 端口,并且只回应对 `/menu` 的请求。如果你想快速了解 Mojolicious 能做什么,运行 `man Mojolicious::Guides::Growing` 去查看手册。按 `Q` 键退出手册。 -将 boot.cfg 移到我们的网络引导应用程序中作为一个名为 menu.html.ep 的模板: +将 `boot.cfg` 移到我们的网络引导应用程序中作为一个名为 `menu.html.ep` 的模板: ``` # mkdir /opt/bootmenu/templates @@ -157,7 +155,7 @@ END # systemctl start bootmenu.service ``` -用 wget 测试它: +用 `wget` 测试它: ``` $ sudo dnf install -y wget @@ -199,9 +197,9 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.4-300.fc29.x86_64.img boot || goto failed ``` -现在,引导菜单服务器已经正常工作了,重新构建 ipxe.efi 引导加载器,使用一个 init 脚本指向它。 +现在,引导菜单服务器已经正常工作了,重新构建 `ipxe.efi` 引导加载器,使用一个初始化脚本指向它。 -第一步,先更新我们在本系列文章的第一部分中创建的 init.ipxe 脚本: +第一步,先更新我们在本系列文章的第一部分中创建的 `init.ipxe` 脚本: ``` $ MY_BOOTMENU_SERVER=server-01.example.edu @@ -236,7 +234,7 @@ $ sudo systemctl restart bootmenu.service ### 做一步的改变 -如果引导菜单服务器工作正常,在你的客户端系统上的 boot.cfg 文件将更长。 +如果引导菜单服务器工作正常,在你的客户端系统上的 `boot.cfg` 文件将更长。 比如,重新添加 Fedora 28 镜像到引导菜单中: @@ -271,13 +269,13 @@ via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/ 作者:[Gregory Bartholomew][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://fedoramagazine.org/author/glb/ [b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ +[1]: https://linux.cn/article-10379-1.html [2]: https://ipxe.org/ [3]: https://fedoramagazine.org/wp-content/uploads/2018/11/netboot-menu-1024x641.png [4]: https://en.wikipedia.org/wiki/Atomicity_(database_systems) From 92bdc0971aa6288b71f4dcbf698fd141bfed7e93 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 17:22:14 +0800 Subject: [PATCH 0388/4278] PUB:20181221 How to Build a Netboot Server, Part 3.md @qhwdw https://linux.cn/article-10405-1.html --- .../20181221 How to Build a Netboot Server, Part 3.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181221 How to Build a Netboot Server, Part 3.md (99%) diff --git a/translated/tech/20181221 How to Build a Netboot Server, Part 3.md b/published/20181221 How to Build a Netboot Server, Part 3.md similarity index 99% rename from translated/tech/20181221 How to Build a Netboot Server, Part 3.md rename to published/20181221 How to Build a Netboot Server, Part 3.md index f36338fd7b..72a8d2f7f8 100644 --- a/translated/tech/20181221 How to Build a Netboot Server, Part 3.md +++ b/published/20181221 How to Build a Netboot Server, Part 3.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10405-1.html) [#]: subject: (How to Build a Netboot Server, Part 3) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) From 36eebe27941005288895e4661ddf65c29c13e469 Mon Sep 17 00:00:00 2001 From: zgj Date: Tue, 1 Jan 2019 18:17:03 +0800 Subject: [PATCH 0389/4278] =?UTF-8?q?zgj1024=20=E8=AE=A4=E9=A2=86=20201807?= =?UTF-8?q?31=20How=20to=20be=20the=20lazy=20sysadmin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit zgj1024 认领文章 --- sources/talk/20180731 How to be the lazy sysadmin.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20180731 How to be the lazy sysadmin.md b/sources/talk/20180731 How to be the lazy sysadmin.md index 25024a20bd..52491e397c 100644 --- a/sources/talk/20180731 How to be the lazy sysadmin.md +++ b/sources/talk/20180731 How to be the lazy sysadmin.md @@ -1,3 +1,4 @@ +zgj1024 is translating How to be the lazy sysadmin ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) From c8477f3413db743d7868bbd7e42826dce22b7075 Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Tue, 1 Jan 2019 19:23:06 +0800 Subject: [PATCH 0390/4278] Update 20181222 How to detect automatically generated emails.md --- .../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 23b509a77b..2ccaeddeee 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: ( ) +[#]: translator: (wyxplus) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8f493168a70365d2706690ffa221f6c5e2de2d46 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Tue, 1 Jan 2019 19:25:06 +0800 Subject: [PATCH 0391/4278] =?UTF-8?q?Update=2020181210=20McFly=20-=20A=20R?= =?UTF-8?q?eplacement=20To=20=E2=80=98Ctrl-R-=20Bash=20History=20Search=20?= =?UTF-8?q?Feature.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 准备翻译该篇。 --- ...y - A Replacement To ‘Ctrl-R- Bash History Search Feature.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md index 4c1da08110..cc7155cf03 100644 --- a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md +++ b/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (FSSlc) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d075751c10c56a1e392f6af5719863f861fe6f3e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 21:29:06 +0800 Subject: [PATCH 0392/4278] PRF:20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @LazyWolfLin --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 9d7a8ebf92..0b1364fe6a 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) [#]: via: (https://itsfoss.com/update-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何更新 Ubuntu [终端及GUI方式] It's FOSS +初级:如何在终端及图形界面中更新 Ubuntu ====== -**这篇教程将向你展示如何更新服务器版本或者桌面版本的 Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于 Ubuntu Linux 中的更新的一些其他内容。** +> 这篇教程将向你展示如何更新服务器版本或者桌面版本的 Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于 Ubuntu Linux 中的更新的一些其他内容。 如果你是一个新手并已经体验 Ubuntu 数天或几周,你可能想知道如何更新你的 [Ubuntu][1] 系统以获取安全补丁,错误修复和应用升级。 更新 Ubuntu 非常简单。我并不是瞎说。它简单得只要运行两个命令。让我来告诉你这两个命令的更多细节。 -请注意,本教程适用于 Ubuntu 18.04,16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint,Linux Lite,elementary OS 等。 +请注意,本教程适用于 Ubuntu 18.04、16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint、Linux Lite、elementary OS 等。 ### 通过命令行更新 Ubuntu ![如何更新 Ubuntu][2] -在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你是登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 +在桌面上,打开终端。你可以在菜单里找到它或者使用 `Ctrl+Alt+T` [快捷键][3]。如果你是登录到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 在终端里,你只需要使用以下命令: @@ -30,13 +30,13 @@ sudo apt update && sudo apt upgrade -y ``` -它将询问密码,而你可以使用你的账号密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 +它将询问你密码,而你可以使用你的账号密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 现在,我来解释下上面的命令。 事实上,这不是一条命令。它由两条命令组成。符号 `&&` 是合并两条命令的一个方法,第二条命令仅在前一条命令执行成功时执行。 -当命令 `apt upgrade` 要求你在安装更新前确认时,末尾的参数 `-y` 会自动输入 yes。 +当命令 `apt upgrade` 要求你在安装更新前确认时,末尾的参数 `-y` 会自动输入 `yes`。 请注意,你也可以逐条使用这两条命令: @@ -51,7 +51,7 @@ sudo apt upgrade 这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会被更新,而你的系统将不会知道是否有可用的新版本。 -这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令会从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。 +这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URL。这条命令会从对应的储存库(你在输出中看到的 URL)中获取软件包信息。 ![更新 Ubuntu Linux][5] @@ -61,7 +61,7 @@ sudo apt upgrade apt list --upgradable ``` -**补充阅读:** 阅读这篇文章了解[命令 `apt update` 的输出中的 Ign,Hit 和 Get 是什么][6]。 +**补充阅读:** 阅读这篇文章了解[命令 apt update 的输出中的 Ign、Hit 和 Get 是什么][6]。 #### 说明:sudo apt upgrade @@ -69,17 +69,17 @@ apt list --upgradable ![通过命令行更新 Ubuntu Linux][7] -你可以键入 `yes`,`y` 或者只敲回车键去确认安装这些更新。 +你可以键入 `yes`、`y` 或者只敲回车键去确认安装这些更新。 所以总的来说,`sudo apt update` 会检查可用的新版本,而 `sudo apt upgrade` 实际上会执行更新。 命令 `update` 可能会令人困惑,因为你可能期望通过命令 `apt update` 安装更新来更新系统,但这并不会发生。 -### 通过 GUI 更新 Ubuntu[适用于桌面用户] +### 通过 GUI 更新 Ubuntu(适用于桌面用户) 如果你使用桌面版 Ubuntu,你并不需要为了更新系统而打开终端。你可以仍可以使用命令行更新,但这只是一个选择。 -在菜单力,找到 `Software Updater` 并运行它。 +在菜单里,找到 “软件更新” 并运行它。 ![在 Ubuntu 中运行 Software Updater][8] @@ -91,7 +91,7 @@ apt list --upgradable ![在 Ubuntu 中通过更新管理器安装更新][10] -现在,点击 `Install`,它可能会向你询问密码。 +现在,点击 “安装”,它可能会向你询问密码。 ![通过 GUI 在 Ubuntu Linux 中安装更新][11] @@ -107,7 +107,7 @@ apt list --upgradable ![通过 GUI 在 Ubuntu 中安装更新][13] -提示:如果 `software updater` 返回一个错误,你需要在终端是使用命令 `sudo apt update`。输出的最后几行将包含真正的错误信息。你可以在因特网上搜索该错误并解决问题。 +提示:如果“软件更新”返回一个错误,你需要在终端是使用命令 `sudo apt update`。输出的最后几行将包含真正的错误信息。你可以在因特网上搜索该错误并解决问题。 ### 更新 Ubuntu 时要记住几件事 @@ -125,7 +125,7 @@ sudo apt autoremove 如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将会是一个问题。 -[热修复][15]功能允许Linux内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。 +[热修复][15]功能允许 Linux 内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。 如果你在管理服务器,你可能需要[在 Ubuntu 中启用热修复][16]。 @@ -148,7 +148,7 @@ via: https://itsfoss.com/update-ubuntu/ 作者:[Abhishek Prakash][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 bccc9b5d8f44b7ef0d93cf3c71ee1d14547875e2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 21:30:10 +0800 Subject: [PATCH 0393/4278] PUB:20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @LazyWolfLin https://linux.cn/article-10406-1.html --- ...How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md (99%) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md similarity index 99% rename from translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md rename to published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 0b1364fe6a..6ab6123cfa 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10406-1.html) [#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) [#]: via: (https://itsfoss.com/update-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From c029acada70516ec43fbba7e4d47c9976b612a92 Mon Sep 17 00:00:00 2001 From: FSSlc Date: Tue, 1 Jan 2019 21:34:52 +0800 Subject: [PATCH 0394/4278] [Translated] 20181210 McFly - A Replacement To \342\200\230Ctrl-R- Bash History Search Feature.md Signed-off-by: FSSlc --- ...To ‘Ctrl-R- Bash History Search Feature.md | 160 ------------------ ...To ‘Ctrl-R- Bash History Search Feature.md | 155 +++++++++++++++++ 2 files changed, 155 insertions(+), 160 deletions(-) delete mode 100644 sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md create mode 100644 translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md diff --git a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md deleted file mode 100644 index cc7155cf03..0000000000 --- a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md +++ /dev/null @@ -1,160 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (FSSlc) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) -[#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature -====== -![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png) -If you spend a lot of time on CLI mode, you should definitely used or heard about **reverse search** function in BASH. The keyboard shortcut to do reverse search in Bash is **Ctrl+r**. Using bash reverse search, we can bring up all commands which we used previously executed without having to re-type them every time. You can, of course, use UP/DOWN arrows to search your bash history. However, Ctrl+r will make this process much easier and faster. Today, I Stumbled upon a replacement to ‘Ctrl+r’ Bash history search feature. Meet **“McFly”** , a simple tool written in **Rust** programming language that replaces the default Ctrl+r Bash history search with an intelligent search engine. All command suggestions made by McFly are prioritized in real time with a small **neural network**. - -McFly rebinds Ctrl+r functionality to bring up all recently executed commands from your Bash history. It augments your shell history by tracking the following: - - * Command exit status, - * timestamp (When you run the command), - * and execution directory (Where you run the command). - - - -It saves all tracking details in a SQLite database. Since it tracks the command’s historical exit status, you can simply ignore the old failed commands. Cool, yeah? - -When suggesting a command, McFly considers the following facts: - - * On which directory you ran the command. You’re likely to repeat that command in the same directory in future. - * What commands you typed before the command. - * How often you run the command. - * When you last ran the command. - * If you’ve selected the command in McFly before. - * The command’s historical exit status. Because, you probably don’t want to run old failed commands, right? - - - -McFly maintains your default Bash history file, so you can stop using McFly at any time. McFly is not just for BASH, it is also extendable for other shells as well. - -### Installing McFly - -McFly can be installed using Linuxbrew on Linux. If you haven’t installed Linuxbrew yet, refer the following link. - -[Linuxbrew – A Common Package Manager For Linux And Mac OS X][1] - -Once Linuxbrew installed, run the following commands to install McFly: - -``` -$ brew tap cantino/mcfly https://github.com/cantino/mcfly - -$ brew install mcfly -``` - -After the installation is completed, you will see the following output. - -``` -==> Installing mcfly from cantino/mcfly -==> Downloading https://github.com/cantino/mcfly/releases/download/v0.2.5/mcfly-v0 -==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.c -######################################################################## 100.0% -==> ONE MORE STEP! Edit ~/.bashrc and add the following: - -if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then -. $(brew --prefix)/opt/mcfly/mcfly.bash -fi -🍺 /home/linuxbrew/.linuxbrew/Cellar/mcfly/v0.2.5: 4 files, 3.5MB, built in 33 seconds -``` -![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png) -As you can see, we need to do one more step before start using McFly. - -Add the following lines to your **~/.bashrc** file: - -``` -if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then -. $(brew --prefix)/opt/mcfly/mcfly.bash -fi -``` - -Finally, run the following command to take effects changes: - -``` -$ source ~/.bashrc -``` - -Your BASH history will be imported to McFly database when you run this command for the first time. It will take a few moments depending upon size of your bash history file. Once the import is done, you will see the following message. - -``` -McFly: Importing Bash history for the first time. This may take a minute or two...done. -``` - -You can now start using McFly. - - -### Usage - -To search through your command history, just type ‘mcfly search’ followed by the part of the command name and hit ENTER key. Mcfly will display the command suggestions based on the search query you just type. - -``` -$ mcfly search -``` - -For instance, I type the following command: - -``` -$ mcfly search mk -``` - -Here is the sample output from my Ubuntu machine: - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png) - -As you can see, I have used ‘mkdir’ command two times. If you want to run a command from the list of suggestions, just use **UP/DOWN** arrows to select it and hit ENTER to run it immediately. If you want to edit a command, choose it and hit **TAB** key to bring it back to your Terminal and then edit before running it. To delete the selected command from the history, just press **F2**. - -Alternatively, type the following command to open the history search and then type any command or part of the command to view the suggestions from your history. - -``` -$ mcfly search -``` - -McFly will display the command suggestions as you type. - -Here is a short video demonstration of McFly: -![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif) -View help: - -``` -$ mcfly --help -``` - - -### Remove McFly - -Don’t like McFly, no problem! Remove it using the following commands: - -``` -$ brew uninstall mcfly - -$ brew untap cantino/mcfly -``` - -Finally, remove the lines which we added earlier from **~/.bashrc** file. - -And, that’s all for now. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/ - -作者:[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/linuxbrew-common-package-manager-linux-mac-os-x/ diff --git a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md new file mode 100644 index 0000000000..5031edc985 --- /dev/null +++ b/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (FSSlc) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) +[#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +McFly – Bash 历史命令搜索特性的一个替代品 +====== +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png) + +假如你在命令行模式下花费过很长时间,那么你必定使用过或者听说过 BASH 的 **反向搜索** 功能,在 Bash 中执行反向搜索功能的快捷键是 **Ctrl+r**。通过使用这个特性,我们可以找到我们执行过的命令而无需再次输入它们。当然,你可以使用上下键来搜索你的 bash 命令记录,但使用 Ctrl+r 快捷键可以让这个搜索过程更简单快速。今天我找寻到了 Bash 历史命令搜索特性 ‘Ctrl+r’ 的一个替代品,它就是 **“McFly”**。McFly 是一个使用 **Rust** 编程语言写就的简洁工具,自带一个智能的搜索引擎,用来替换默认的 Ctrl+r 这个 Bash 历史命令搜索特性。 McFly 提供的命令建议都是通过一个小巧的 **神经网络** 来实时排序给出的。 + +McFly 重新绑定了 Ctrl+r 快捷键,可以从你的 Bash 历史命令中找到所有最近执行过的命令。它通过追溯下面的信息来增强你的 shell 历史命令搜索特性: + +* 命令结束状态 +* 当你运行命令时的时间戳 +* 以及你运行命令的执行目录 + +它将所有追溯的信息保存在一个 SQLite 数据库中。由于它追溯了命令的历史结束状态,所以你可以很轻易地忽略掉失败的命令。听起来很酷,对吧? + +在给出一个命令建议时,它将考虑如下因素: + +* 你在哪个目录执行的这个命令,将来你很有可能在相同的目录重复这个命令 +* 在你执行这个命令之前,执行过什么命令 +* 你执行这个命令有多频繁 +* 你最后执行该命令的时间 +* 你是否在 McFly 中选择过这个命令 +* 以及这个命令的历史结束状态。因为你很有可能不会去执行失败过的命令,对吧? + +McFly 维护着你的默认 Bash 历史文件,所以你可以随时停止使用它。McFly 也并不只服务于 BASH, 它也可以扩展到其他 shell 程序。 + +### 安装 McFly + +在 Linux 中,McFly 可以使用 Linuxbrew 来安装。如若你还没有安装过 Linuxbrew,那么你可以参考下面的这个链接。(译者注:从其github 主页了解到也可以下载其二进制来使用。) + +[Linuxbrew —— 一个使用 Linux 和 Mac OS X 的通用包管理][1] + +一旦安装好了 Linuxbrew,运行下面的命令来安装 McFly: + +``` +$ brew tap cantino/mcfly https://github.com/cantino/mcfly + +$ brew install mcfly +``` + +在安装完成后,你将看到下面的输出: + +``` +==> Installing mcfly from cantino/mcfly +==> Downloading https://github.com/cantino/mcfly/releases/download/v0.2.5/mcfly-v0 +==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.c +######################################################################## 100.0% +==> ONE MORE STEP! Edit ~/.bashrc and add the following: + +if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then +. $(brew --prefix)/opt/mcfly/mcfly.bash +fi +🍺 /home/linuxbrew/.linuxbrew/Cellar/mcfly/v0.2.5: 4 files, 3.5MB, built in 33 seconds +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png) +正如你上面看到的那样,在使用 McFly 之前我们需要再做一些配置。 + +将下面几行添加到你的 **~/.bashrc** 文件中: + +``` +if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then +. $(brew --prefix)/opt/mcfly/mcfly.bash +fi +``` + +最后,再运行下面的命令来让更改生效。 + +``` +$ source ~/.bashrc +``` + +当你第一次执行上面的这个命令时,你的 BASH 历史将会被导入 McFly 的数据库。依据你的 bash 历史文件的大小,这个过程将花费一些时间。一旦导入完成,你讲看到下面的提示信息。 + +``` +McFly: Importing Bash history for the first time. This may take a minute or two...done. +``` + +现在你就可以使用 McFly 了。 + +### 使用方法 + +要在你的命令中执行搜索,只需要键入 ‘mcfly search’ 再加上命令名的一部分,最后敲击 ENTER 键即可。Mcfly 将会基于你刚才键入的搜索查询语句给出命令建议。 + +``` +$ mcfly search +``` + +例如我键入了下面的命令: + +``` +$ mcfly search mk +``` + +下面展示的是我 Ubuntu 机子上的示例输出: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png) + +如你所见,我已经使用过 'mkdir' 这个命令两次。假如你想从这些命令建议中执行其中之一,只需使用上下键来选择它,然后敲击 ENTER 键来执行它就可以了。假如你想编辑其中一个命令,则需要先选择它,然后敲 **TAB** 键将这个命令放置到终端中,最后在运行它之前更改它就行了。要从历史中删除已经选择的命令,按 **F2** 即可。 + +或者,输入下面的命令来打开历史搜索,然后输入任意一个命令或者命令的一部分来从你的历史命令中查看它提供的建议。 + +``` +$ mcfly search +``` + +在你输入的同时, McFly 将会展示命令的提示。 + +下面是一个介绍 McFly 的简短演示视频: +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif) + +你还可以使用下面的命令来查看帮助: + +``` +$ mcfly --help +``` + +### 移除 McFly + +不喜欢 McFly,没问题!可以使用下面的命令来移除它: + +``` +$ brew uninstall mcfly + +$ brew untap cantino/mcfly +``` + +最后,移除先前添加到 **~/.bashrc** 文件中的几行命令。 + +好了,这些就是所有了,更多精彩内容敬请期待,请保存关注! + +Cheers! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/ + +作者:[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/linuxbrew-common-package-manager-linux-mac-os-x/ From c27b4a1a14f4fbde222042faca3e93cce934f7a1 Mon Sep 17 00:00:00 2001 From: Bestony <13283837+bestony@users.noreply.github.com> Date: Tue, 1 Jan 2019 22:31:28 +0800 Subject: [PATCH 0395/4278] =?UTF-8?q?=E7=94=B3=E9=A2=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180725 Build an interactive CLI with Node.js.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180725 Build an interactive CLI with Node.js.md b/sources/tech/20180725 Build an interactive CLI with Node.js.md index 6ec13f1cfc..e491993808 100644 --- a/sources/tech/20180725 Build an interactive CLI with Node.js.md +++ b/sources/tech/20180725 Build an interactive CLI with Node.js.md @@ -1,3 +1,5 @@ +bestony translating + Build an interactive CLI with Node.js ====== From a4a2805a06ee91b9f3a66796a41256655338c371 Mon Sep 17 00:00:00 2001 From: Bestony <13283837+bestony@users.noreply.github.com> Date: Wed, 2 Jan 2019 06:52:40 +0800 Subject: [PATCH 0396/4278] =?UTF-8?q?=E8=AE=A4=E9=A2=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180703 10 killer tools for the admin in a hurry.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180703 10 killer tools for the admin in a hurry.md b/sources/tech/20180703 10 killer tools for the admin in a hurry.md index 363f401709..87e3e8b309 100644 --- a/sources/tech/20180703 10 killer tools for the admin in a hurry.md +++ b/sources/tech/20180703 10 killer tools for the admin in a hurry.md @@ -1,3 +1,5 @@ +bestony translating + 10 killer tools for the admin in a hurry ====== From ffeeb9ae4de0f6b541eb8a88e6b7feb47e722211 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 2 Jan 2019 08:53:32 +0800 Subject: [PATCH 0397/4278] translated --- ...ch YouTube videos at the Linux terminal.md | 80 ------------------- ...ch YouTube videos at the Linux terminal.md | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 sources/tech/20181222 Watch YouTube videos at the Linux terminal.md create mode 100644 translated/tech/20181222 Watch YouTube videos at the Linux terminal.md diff --git a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md deleted file mode 100644 index e4db6bc039..0000000000 --- a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Watch YouTube videos at the Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Watch YouTube videos at the Linux terminal -====== -Thought video content was just for your GUI? Think again. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a) - -We're almost to the end 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 we're going to double-down on yesterday's toy, [MPlayer][2], and add in one more, [**youtube-dl**][3]. - -As its name would imply, **youtube-dl** is a command-line utility for downloading YouTube videos, but it can capture video from a number of other sites as well, and it's a really quite full-featured application with [thorough documentation][4] to make video acquisition easy. A note: please don't use **youtube-dl** in any context that would violate the copyright laws in your jurisdiction. - -**youtube-dl** is licensed under a public domain dedication known as [the][5] [Unlicense][5] that's similar to Creative Common's [CC0][6]. There are some interesting [legal opinions][7] out there about where public domain dedication fits into the open source landscape, but it's generally considered compatible with existing open source licenses even by organizations who don't recommend its use. - -In its simplest form, we're going to use **youtube-dl** to grab a video for playback in our terminal. First, [install][8] it using a method appropriate for your distribution. For me, in Fedora, it was packaged in my repositories, so installation was as simple as: - -``` -$ sudo dnf install youtube-dl -``` - -Then, let's grab a video. YouTube allows you to search by license, so today, we're going to take a look at a fireplace [video][9] from [Gemmy's Videos][10] available under a Creative Commons attribution license. For YouTube videos, you can download with the file ID alone, like this, and we'll specify an output file name as well. I intentionally picked a short video, since long videos can get quite large! - -``` -$ youtube-dl pec8P5K4s8c -o fireplace.mp4 -``` - -If you didn't install [MPlayer][2] yesterday, go ahead and do that, and you may need to install **libcaca** for your system as well if you did not install it previously. If you just use MPlayer to launch the video from the command line as-is ( **$** **mplayer fireplace.webm** ), it will play, but in a window all of its own; not exactly what we were going for. - -First, I set my **libcaca** settings to force it to use **ncurses** **** as the display driver, keeping the output in my terminal, with: - -``` -$ export CACA_DRIVER=ncurses -``` - -Then, I zoomed way out in my terminal (the more "pixels", the better), and played the file with the following (forcing the use of **libcaca** and silencing text output from MPlayer): - -``` -$ mplayer -really-quiet -vo caca fireplace.mp4 -``` - -And, there you go! -![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif) - -Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, 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, [Listen to the radio at the Linux terminal][2], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-youtube-dl - -作者:[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/article/18/12/linux-toy-mplayer -[3]: https://rg3.github.io/youtube-dl/ -[4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme -[5]: https://unlicense.org/ -[6]: https://creativecommons.org/share-your-work/public-domain/cc0/ -[7]: https://opensource.org/faq#public-domain -[8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation -[9]: https://www.youtube.com/watch?v=pec8P5K4s8c -[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A diff --git a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md b/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md new file mode 100644 index 0000000000..201a911c5b --- /dev/null +++ b/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Watch YouTube videos at the Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端上观看 YouTube 视频 +====== +认为视频只能在 GUI 下看么?再想想。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a) + +我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你一直在看,如果没有,请回到[这里][1]开始,自己试试。你会发现 Linux 终端有很多游戏,消遣和奇怪的东西。 + +虽然你之前可能已经看过我们日历中的一些玩具,但我们希望对每个人至少有一个新事物。 + +今天我们要在昨天的玩具 [MPlayer][2] 上再加上一个 [**youtube-dl**][3]。 + +正如其名称所暗示的那样,**youtube-dl** 是一个用于下载 YouTube 视频的命令行程序,但它也可以从其他许多站点下载视频,而且它是一个有着[丰富文档][4]的功能齐全的程序,从而使视频获取变得容易。注意:请勿在任何违反你所在司法辖区的版权法的情况下使用 **youtube-dl**。 + +**youtube-dl** 使用的是 [Unlicense][5] 这个公共领域许可,类似于 Creative Common 的 [CC0][6]。这里还有哪些公共领域贡献适用于开源领域的[法律意见][7],但它通常被认为与现有的开源许可证兼容,即使是不推荐使用它的组织也是如此。 + +最简单地,我们将使用 **youtube-dl** 来获取视频以便在终端中播放。首先,使用适用于你发行版的方法[安装][8]它。对我来说,在 Fedora 中,它被打包在我的仓库中,因此安装非常简单: + +``` +$ sudo dnf install youtube-dl +``` + +然后,获取一个视频。YouTube 允许你按照许可证进行搜索,所以今天我们将根据知识共享署名许可证查看来自 [Gemmy's Videos][10] 中的壁炉[视频][9]。对于 YouTube 视频,你可以像这样用文件 ID 下载,我们也可以指定输出文件名。我故意选择了一个短片,因为长视频会变得很大! + +``` +$ youtube-dl pec8P5K4s8c -o fireplace.mp4 +``` + +如果你昨天没有安装 [MPlayer][2],请继续安装好,如果你之前没有安装 **libcaca** 则需要安装它。如果你直接用 MPlayer 在命令行中播放视频 ( **$****mplayer fireplace.webm** ),它能够播放,但是会在一个自己的窗口中,这不是我们想要的。 + +首先,我设置将 **libcaca** 强制使用 **ncurses** 作为显示驱动,使输出保持在我的终端: + +``` +$ export CACA_DRIVER=ncurses +``` + +然后,我放大了终端(“像素”越多越好),并使用以下命令播放文件(强制使用 **libcaca**并静默 MPlayer 的文本输出): + +``` +$ mplayer -really-quiet -vo caca fireplace.mp4 +``` + +这就完成了! +![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif) + +你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。 + +一定要看看昨天的玩具,[在 Linux 终端收听广播][2],明天还要再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-youtube-dl + +作者:[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/article/18/12/linux-toy-mplayer +[3]: https://rg3.github.io/youtube-dl/ +[4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme +[5]: https://unlicense.org/ +[6]: https://creativecommons.org/share-your-work/public-domain/cc0/ +[7]: https://opensource.org/faq#public-domain +[8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation +[9]: https://www.youtube.com/watch?v=pec8P5K4s8c +[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A \ No newline at end of file From 39dfe0833698bada06fe7b331e27ba6bd9b8befd Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 2 Jan 2019 08:57:21 +0800 Subject: [PATCH 0398/4278] translating --- .../20181223 The Linux command line can fetch fun from afar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181223 The Linux command line can fetch fun from afar.md b/sources/tech/20181223 The Linux command line can fetch fun from afar.md index 3b5e77fa27..19231007f4 100644 --- a/sources/tech/20181223 The Linux command line can fetch fun from afar.md +++ b/sources/tech/20181223 The Linux command line can fetch fun from afar.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 26bfea2843e86bb63b89063bd38800e4afa50da5 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 2 Jan 2019 10:45:47 +0800 Subject: [PATCH 0399/4278] Translating --- sources/tech/20181224 An Introduction to Go.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181224 An Introduction to Go.md b/sources/tech/20181224 An Introduction to Go.md index b35bc9922e..5989b6c913 100644 --- a/sources/tech/20181224 An Introduction to Go.md +++ b/sources/tech/20181224 An Introduction to Go.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (LazyWolfLin) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d23743a43cf07a7ab627b695257538bf44d00855 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 14:05:09 +0800 Subject: [PATCH 0400/4278] PRF:20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @zhs852 --- ...Image Viewer for Ubuntu and other Linux.md | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md index 3125ef4db3..e1cf33d5b4 100644 --- a/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md +++ b/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Top 11 best Image Viewer for Ubuntu and other Linux) @@ -37,17 +37,18 @@ Linux 下最棒的 11 个图片查看器 Nomacs 是一款自由软件。虽然没有什么出众的功能,但是它的兼容性还不错,可以支持许多常见格式。 -它的界面超级简单,但是提供了简单的图片编辑功能(可以调整色彩、亮度、大小)。除此之外,它还支持全屏模式、元数据调整等功能。 +它的界面超级简单,但是提供了简单的图片编辑功能(可以调整色彩、亮度、大小和裁剪)。除此之外,它还支持全屏模式、直方图,以及可以切换显示元数据、编辑历史等信息的许多面板。 **我该如何安装它?** -简单起见,你可以在各种软件中心中安装它。如果你想通过终端安装它,请参见它的 [GitHub 界面][3] 。或者,在使用 APT 包管理的系统中使用如下命令安装: +简单起见,你可以在各种软件中心中安装它。如果你想通过终端安装它,请参见它的 [GitHub 页][3] 。或者,在使用 APT 包管理的系统中使用如下命令安装: ``` sudo apt install nomacs ``` #### 2. Gnome 之眼 + ![Gnome 之眼][4] **它有什么特点?** @@ -68,7 +69,7 @@ sudo apt install nomacs sudo apt install eog ``` -如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][5] 。 +如果你想在其它发行版中安装它,请参见 [该项目的 GitHub 页面][5] 。 #### 3. EOM @@ -92,19 +93,20 @@ sudo apt install eog sudo apt install eom ``` -如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][7] 。 +如果你想在其它发行版中安装它,请参见 [该项目的 GitHub 页面][7] 。 #### 4. Geeqie + ![Geeqie 图像查看器][8] **它有什么特点?** - * 可扩展 - * 色彩信息显示 + * 可扩展的灵活的图像查看器(其它的图像查看器支持它) + * 可以显示色彩信息 -Geeqie 是一个令用户印象深刻的图片管理/查看器。他支持将其它查看器作为扩展使用,不过它并不提供任何对图像操作的工具。 +Geeqie 是一个令用户印象深刻的图片管理/查看器。它支持将其它查看器作为扩展使用,不过它并不提供任何对图像操作的工具。 -如果你希望获取图像的颜色信息、元数据,或是查看/管理一堆图片,它将会是一个不错的选择。 +如果你希望获取图像的颜色信息、元数据,或是查看/管理一组图片,它将会是一个不错的选择。 **我该如何安装它?** @@ -122,14 +124,14 @@ sudo apt install geeqie **它有什么特点?** - * 多种功能(查看、编辑和管理) + * 全功能(查看、编辑和管理) * 可清除 EXIF 信息 * 图像格式转换 * 查找重复的图像 -gThumb 会让你眼前一亮,因为它有很多功能。它的查看/管理界面和编辑工具(裁剪、颜色编辑等等)将会给你留下很深的印象。 +gThumb 会让你眼前一亮,因为它有很多功能。它的查看/管理界面和编辑工具(裁剪、缩放、颜色编辑等等)将会给你留下很深的印象。 -你甚至可以为图像添加评论或清除它的 EXIF 信息。它使得你可以方便地编辑或转码图像。 +你甚至可以为图像添加评论或清除它的 EXIF 信息。它使得你可以方便地找到重复的图像或转码图像。 **我该如何安装它?** @@ -142,6 +144,7 @@ sudo apt install gthumb 输了没用?请参阅 [项目 GitHub 主页][11] 来获取帮助。 #### 6. Gwenview + ![Gwenview 图像查看器][12] **它有什么特点?** @@ -169,13 +172,13 @@ sudo apt install gwenview **它有什么特点?** - * 可定制的 UI + * 可定制的基本用户界面 * 基本图像编辑工具 * 可在命令行使用 -如果你想要一个可在命令行中访问、支持全屏和幻灯片视图、带有基础编辑工具以及可定制 UI 的查看器,Mirage 是个不二之选。 +如果你想要一个可在命令行中访问、支持全屏和幻灯片视图、带有基础编辑工具以及可定制 UI 的普通查看器,Mirage 是个不二之选。 -它是一个非常快速且兼容性优良的查看器。它支持包括 png、jpg、svg、xpm、gif、bmp 和 tifff 在内的多种图像格式。 +它是一个非常快速且兼容性优良的查看器。它支持包括 png、jpg、svg、xpm、gif、bmp 和 tiff 在内的多种图像格式。 **我该如何安装它?** @@ -185,21 +188,22 @@ sudo apt install gwenview sudo apt install mirage ``` -访问 [项目 GitHub 页面][16] 来获取更多信息。 +访问 [该项目 GitHub 页面][16] 来获取更多信息。 #### 8. KPhotoAlbum + ![KPhotoAlbum][17] **它有什么特点?** * 为图像添加标签 * 数据库支持 - * 图片比较 - * 合并/移除一堆图像 + * 图片压缩 + * 将图像合并到一组图像,或移除 确切地说,KPhotoAlbum 其实不仅仅是一款图像查看器,它还能为图像添加标签并管理图像。 -你可以用它来比较图片以及使用标签搜索你的图片。你还可以使用幻灯片视图来观看图片。 +你可以用它来压缩图片以及使用标签搜索你的图片。你还可以使用幻灯片视图来观看图片。 **我该如何安装它?** @@ -231,7 +235,7 @@ Shotwell 是一个多功能照片管理器。在此,你能查看或管理你 sudo apt install shotwell ``` -若想获取更多信息,请 [前往它的 GitHub 界面][20]。 +若想获取更多信息,请 [前往它的 GitHub 页面][20]。 #### 10. Ristretto @@ -294,7 +298,7 @@ via: https://itsfoss.com/image-viewers-linux/ 作者:[Ankush Das][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 48f55d91fa3ca3adafcb2cf438764be14930b4eb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 14:07:08 +0800 Subject: [PATCH 0401/4278] PUB:20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @zhs852 https://linux.cn/article-10407-1.html --- ...222 Top 11 best Image Viewer for Ubuntu and other Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md (99%) diff --git a/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md similarity index 99% rename from translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md rename to published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md index e1cf33d5b4..c0cf2d04c1 100644 --- a/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md +++ b/published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10407-1.html) [#]: subject: (Top 11 best Image Viewer for Ubuntu and other Linux) [#]: via: (https://itsfoss.com/image-viewers-linux/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 2d56091df46a1c99609fa9dad139d549f3abeb7e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 15:35:51 +0800 Subject: [PATCH 0402/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Asciinema=20?= =?UTF-8?q?=E2=80=93=20Record=20And=20Share=20Your=20Terminal=20Sessions?= =?UTF-8?q?=20On=20The=20Fly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Share Your Terminal Sessions On The Fly.md | 312 ++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100644 sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md diff --git a/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md b/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md new file mode 100644 index 0000000000..769780a79f --- /dev/null +++ b/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md @@ -0,0 +1,312 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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 – Record And Share Your Terminal Sessions On The Fly +====== + +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. + +I mean we can share the recording on the web. + +By default everyone prefer history command to review/recall the previously entered commands in terminal. + +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. + +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]**. + +But if you are looking for **[GIF Recorder][4]** then try **[Gifine][5]** , **[Kgif][6]** and **[Peek][7]** utilities. + +### What is Asciinema + +asciinema is a free and open source solution for recording terminal sessions and sharing them on the web. + +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. + +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 project is built of several complementary pieces such as asciinema command line tool, API at asciinema.org and javascript player. + +Asciinema was inspired by script and scriptreplay commands. + +### How to Install Asciinema In Linux + +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. + +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. + +``` +$ sudo pacman -S python-pip +``` + +For Fedora users, use **[DNF Command][11]** to install pip package. + +``` +$ sudo dnf install python-pip +``` + +For CentOS/RHEL users, use **[YUM Command][12]** to install pip package. + +``` +$ sudo yum install python-pip +``` + +For openSUSE users, use **[Zypper Command][13]** to install pip package. + +``` +$ sudo zypper install python-pip +``` + +Finally run the following **[pip command][14]** to install Asciinema tool in Linux. + +``` +$ sudo pip3 install asciinema +``` + +### How to Record Your Terminal Session Using Asciinema + +Once you successfully installed Asciinema. Just run the following command to start recording. + +``` +$ asciinema rec 2g-test +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 + total used free shared buff/cache available +Mem: 15867 2783 10537 1264 2546 11510 +Swap: 17454 0 17454 + +$ hostnamectl + Static hostname: daygeek-Y700 + Icon name: computer-laptop + Chassis: laptop + Machine ID: 31bdeb7b833547368d230a2025d475bc + Boot ID: c84f7e6f39394d1f8fdc4bcaa251aee2 + Operating System: Manjaro Linux + Kernel: Linux 4.19.8-2-MANJARO + Architecture: x86-64 + +$ 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 + +$ lscpu +Architecture: x86_64 +CPU op-mode(s): 32-bit, 64-bit +Byte Order: Little Endian +Address sizes: 39 bits physical, 48 bits virtual +CPU(s): 8 +On-line CPU(s) list: 0-7 +Thread(s) per core: 2 +Core(s) per socket: 4 +Socket(s): 1 +NUMA node(s): 1 +Vendor ID: GenuineIntel +CPU family: 6 +Model: 94 +Model name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz +Stepping: 3 +CPU MHz: 800.047 +CPU max MHz: 3500.0000 +CPU min MHz: 800.0000 +BogoMIPS: 5186.00 +Virtualization: VT-x +L1d cache: 32K +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 +``` + +Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in the same directory. + +``` +$ exit +exit +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 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. + +``` +$ 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 upload 2g-test +View the recording at: + + 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) +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 +``` + +![][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 + +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. + +``` +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. + +``` +$ asciinema auth + +Open the following URL in a web browser to link your install ID with your asciinema.org user account: + +https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 + +This will associate all recordings uploaded from this machine (past and future ones) to your account, and allow you to manage them (change title/theme, delete) at asciinema.org. +``` + +![][17] + +Run the following command if you would like to upload the file directly to asciinema.org instead of locally saving. + +``` +$ asciinema rec +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 +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 + total used free shared buff/cache available +Mem: 15867 2783 10537 1264 2546 11510 +Swap: 17454 0 17454 + +$ hostnamectl + Static hostname: daygeek-Y700 + Icon name: computer-laptop + Chassis: laptop + Machine ID: 31bdeb7b833547368d230a2025d475bc + Boot ID: c84f7e6f39394d1f8fdc4bcaa251aee2 + Operating System: Manjaro Linux + Kernel: Linux 4.19.8-2-MANJARO + Architecture: x86-64 + +$ 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. + +``` +$ exit +exit +asciinema: recording finished +asciinema: press "enter" to upload to asciinema.org, "ctrl-c" to save locally + +View the recording at: + + https://asciinema.org/a/b7bu5OhuCy2vUH7M8RRPjsSxg +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/ + +作者:[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/script-command-record-save-your-terminal-session-activity-linux/ +[2]: https://www.2daygeek.com/terminalizer-a-tool-to-record-your-terminal-and-generate-animated-gif-images/ +[3]: https://www.2daygeek.com/Asciinema-record-your-terminal-sessions-as-svg-animations-in-linux/ +[4]: https://www.2daygeek.com/category/gif-recorder/ +[5]: https://www.2daygeek.com/gifine-create-animated-gif-vedio-recorder-linux-mint-debian-ubuntu/ +[6]: https://www.2daygeek.com/kgif-create-animated-gif-file-active-window-screen-recorder-capture-arch-linux-mint-fedora-ubuntu-debian-opensuse-centos/ +[7]: https://www.2daygeek.com/peek-create-animated-gif-screen-recorder-capture-arch-linux-mint-fedora-ubuntu/ +[8]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[9]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[10]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[11]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[12]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[13]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[14]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[15]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[16]: https://www.2daygeek.com/wp-content/uploads/2018/12/linux-asciinema-record-your-terminal-sessions-share-web-1.png +[17]: https://www.2daygeek.com/wp-content/uploads/2018/12/linux-asciinema-record-your-terminal-sessions-share-web-3.png From 6326d8405051b83c28b9077e72c056b1a53ae7b7 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 15:44:29 +0800 Subject: [PATCH 0403/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Easily=20Upload?= =?UTF-8?q?=20Text=20Snippets=20To=20Pastebin-like=20Services=20From=20Com?= =?UTF-8?q?mandline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Pastebin-like Services From Commandline.md | 259 ++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md diff --git a/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md new file mode 100644 index 0000000000..58b072f2fc --- /dev/null +++ b/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md @@ -0,0 +1,259 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Easily Upload Text Snippets To Pastebin-like Services From Commandline) +[#]: via: (https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +Easily Upload Text Snippets To Pastebin-like Services From Commandline +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-720x340.png) + +Whenever there is need to share the code snippets online, the first one probably comes to our mind is Pastebin.com, the online text sharing site launched by **Paul Dixon** in 2002. Now, there are several alternative text sharing services available to upload and share text snippets, error logs, config files, a command’s output or any sort of text files. If you happen to share your code often using various Pastebin-like services, I do have a good news for you. Say hello to **Wgetpaste** , a command line BASH utility to easily upload text snippets to pastebin-like services. Using Wgetpaste script, anyone can quickly share text snippets to their friends, colleagues, or whoever wants to see/use/review the code from command line in Unix-like systems. + +### Installing Wgetpaste + +Wgetpaste is available in Arch Linux [Community] repository. To install it on Arch Linux and its variants like Antergos and Manjaro Linux, just run the following command: + +``` +$ sudo pacman -S wgetpaste +``` + +For other distributions, grab the source code from [**Wgetpaste website**][1] and install it manually as described below. + +First download the latest Wgetpaste tar file: + +``` +$ wget http://wgetpaste.zlin.dk/wgetpaste-2.28.tar.bz2 +``` + +Extract it: + +``` +$ tar -xvjf wgetpaste-2.28.tar.bz2 +``` + +It will extract the contents of the tar file in a folder named “wgetpaste-2.28”. + +Go to that directory: + +``` +$ cd wgetpaste-2.28/ +``` + +Copy the wgetpaste binary to your $PATH, for example **/usr/local/bin/**. + +``` +$ sudo cp wgetpaste /usr/local/bin/ +``` + +Finally, make it executable using command: + +``` +$ sudo chmod +x /usr/local/bin/wgetpaste +``` + +### Upload Text Snippets To Pastebin-like Services + +Uploading text snippets using Wgetpaste is trivial. Let me show you a few examples. + +**1\. Upload text files** + +To upload any text file using Wgetpaste, just run: + +``` +$ wgetpaste mytext.txt +``` + +This command will upload the contents of mytext.txt file. + +Sample output: + +``` +Your paste can be seen here: https://paste.pound-python.org/show/eO0aQjTgExP0wT5uWyX7/ +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-1.png) + +You can share the pastebin URL via any medium like mail, message, whatsapp or IRC etc. Whoever has this URL can visit it and view the contents of the text file in a web browser of their choice. + +Here is the contents of mytext.txt file in web browser: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-2.png) + +You can also use **‘tee’** command to display what is being pasted, instead of uploading them blindly. + +To do so, use **-t** option like below. + +``` +$ wgetpaste -t mytext.txt +``` + +![][3] + +**2. Upload text snippets to different services +** + +By default, Wgetpaste will upload the text snippets to **poundpython** () service. + +To view the list of supported services, run: + +``` +$ wgetpaste -S +``` + +Sample output: + +``` +Services supported: (case sensitive): +Name: | Url: +=============|================= +bpaste | https://bpaste.net/ +codepad | http://codepad.org/ +dpaste | http://dpaste.com/ +gists | https://api.github.com/gists +*poundpython | https://paste.pound-python.org/ +``` + +Here, ***** indicates the default service. + +As you can see, Wgetpaste currently supports five text sharing services. I didn’t try all of them, but I believe all services will work. + +To upload the contents to other services, for example **bpaste.net** , use **-s** option like below. + +``` +$ wgetpaste -s bpaste mytext.txt +Your paste can be seen here: https://bpaste.net/show/5199e127e733 +``` + +**3\. Read input from stdin** + +Wgetpaste can also read the input from stdin. + +``` +$ uname -a | wgetpaste +``` + +This command will upload the output of ‘uname -a’ command. + +**4. Upload the COMMAND and the output of COMMAND together +** + +Sometimes, you may need to paste a COMMAND and its output. To do so, specify the contents of the command within quotes like below. + +``` +$ wgetpaste -c 'ls -l' +``` + +This will upload the command ‘ls -l’ along with its output to the pastebin service. + +This can be useful when you wanted to let others to clearly know what was the exact command you just ran and its output. + +![][4] + +As you can see in the output, I ran ‘ls -l’ command. + +**5. Upload system log files, config files +** + +Like I already said, we can upload any sort of text files, not just an ordinary text file, in your system such as log files, a specific command’s output etc. Say for example, you just updated your Arch Linux box and ended up with a broken system. You ask your colleague how to fix it and s/he wants to read the pacman.log file. Here is the command to upload the contents of the pacman.log file: + +``` +$ wgetpaste /var/log/pacman.log +``` + +Share the pastebin URL with your Colleague, so s/he will review the pacman.log and may help you to fix the problem by reviewing the log file. + +Usually, the contents of log files might be too long and you don’t want to share them all. In such cases, just use **cat** command to read the output and use **tail** command with the **-n** switch to define the number of lines to share and finally pipe the output to Wgetpaste as shown below. + +``` +$ cat /var/log/pacman.log | tail -n 50 | wgetpaste +``` + +The above command will upload only the **last 50 lines** of pacman.log file. + +**6\. Convert input url to tinyurl** + +By default, Wgetpaste will display the full pastebin URL in the output. If you want to convert the input URL to a tinyurl, just use **-u** option. + +``` +$ wgetpaste -u mytext.txt +Your paste can be seen here: http://tinyurl.com/y85d8gtz +``` + +**7. Set language +** + +By default, Wgetpaste will upload text snippets in **plain text**. + +To list languages supported by the specified service, use **-L** option. + +``` +$ wgetpaste -L +``` + +This command will list all languages supported by default service i.e **poundpython** (). + +We can change this using **-l** option. + +``` +$ wgetpaste -l Bash mytext.txt +``` + +**8\. Disable syntax highlighting or html in the output** + +As I mentioned above, the text snippets will be displayed in a specific language format (plaintext, Bash etc.). + +You can, however, change this behaviour to display the raw text snippets using **-r** option. + +``` +$ wgetpaste -r mytext.txt +Your raw paste can be seen here: https://paste.pound-python.org/raw/CUJhQ3jEmr2UvfmD2xCL/ +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-5.png) + +As you can see in the above output, there is no syntax highlighting, no html formatting. Just a raw output. + +**9\. Change Wgetpaste defaults** + +All Defaults values (DEFAULT_{NICK,LANGUAGE,EXPIRATION}[_${SERVICE}] and DEFAULT_SERVICE) can be changed globally in **/etc/wgetpaste.conf** or per user in **~/.wgetpaste.conf** files. These files, however, are not available by default in my system. I guess we need to manually create them. The developer has given the sample contents for both files [**here**][5] and [**here**][6]. Just create these files manually with given sample contents and modify the parameters accordingly to change Wgetpaste defaults. + +**10\. Getting help** + +To display the help section, run: + +``` +$ wgetpaste -h +``` + +And, that’s all for now. Hope this was useful. We will publish more useful content in the days to come. Stay tuned! + +On behalf of **OSTechNix** , I wish you all a very **Happy New Year 2019**. I am grateful to all our readers, contributors, and mentors for supporting us from the beginning of our journey. We couldn’t come this far without your support and guidance. Thank you everyone! Have a great year ahead!! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: http://wgetpaste.zlin.dk/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-3.png +[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-4.png +[5]: http://wgetpaste.zlin.dk/zlin.conf +[6]: http://wgetpaste.zlin.dk/wgetpaste.example From 3262d72061b56fef4cdb0bbd96f43f3525e093fe Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 15:48:39 +0800 Subject: [PATCH 0404/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Troubleshooting?= =?UTF-8?q?=20hardware=20problems=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ubleshooting hardware problems in Linux.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20181231 Troubleshooting hardware problems in Linux.md diff --git a/sources/tech/20181231 Troubleshooting hardware problems in Linux.md b/sources/tech/20181231 Troubleshooting hardware problems in Linux.md new file mode 100644 index 0000000000..dcc89034db --- /dev/null +++ b/sources/tech/20181231 Troubleshooting hardware problems in Linux.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Troubleshooting hardware problems in Linux) +[#]: via: (https://opensource.com/article/18/12/troubleshooting-hardware-problems-linux) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +Troubleshooting hardware problems in Linux +====== +Learn what's causing your Linux hardware to malfunction so you can get it back up and running quickly. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other11x_cc.png?itok=I_kCDYj0) + +[Linux servers][1] run mission-critical business applications in many different types of infrastructures including physical machines, virtualization, private cloud, public cloud, and hybrid cloud. It's important for Linux sysadmins to understand how to manage Linux hardware infrastructure—including software-defined functionalities related to [networking][2], storage, Linux containers, and multiple tools on Linux servers. + +It can take some time to troubleshoot and solve hardware-related issues on Linux. Even highly experienced sysadmins sometimes spend hours working to solve mysterious hardware and software discrepancies. + +The following tips should make it quicker and easier to troubleshoot hardware in Linux. Many different things can cause problems with Linux hardware; before you start trying to diagnose them, it's smart to learn about the most common issues and where you're most likely to find them. + +### Quick-diagnosing devices, modules, and drivers + +The first step in troubleshooting usually is to display a list of the hardware installed on your Linux server. You can obtain detailed information on the hardware using **ls** commands such as **[lspci][3]** , **[lsblk][4]** , **[lscpu][5]** , and **[lsscsi][6]**. For example, here is output of the **lsblk** command: + +``` +# lsblk +NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT +xvda    202:0    0  50G  0 disk +├─xvda1 202:1    0   1M  0 part +└─xvda2 202:2    0  50G  0 part / +xvdb    202:16   0  20G  0 disk +└─xvdb1 202:17   0  20G  0 part +``` + +If the **ls** commands don't reveal any errors, use init processes (e.g., **systemd** ) to see how the Linux server is working. **systemd** is the most popular init process for bootstrapping user spaces and controlling multiple system processes. For example, here is output of the **systemctl status** command: + +``` +# systemctl status +● bastion.f347.internal +    State: running +     Jobs: 0 queued +   Failed: 0 units +    Since: Wed 2018-11-28 01:29:05 UTC; 2 days ago +   CGroup: / +           ├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 21 +           ├─kubepods.slice +           │ ├─kubepods-pod3881728a_f2af_11e8_af77_06af52f87498.slice +           │ │ ├─docker-88b27385f4bae77bba834fbd60a61d19026bae13d18eb147783ae27819c34967.scope +           │ │ │ └─23860 /opt/bridge/bin/bridge --public-dir=/opt/bridge/static --config=/var/console-config/console-c +           │ │ └─docker-a4433f0d523c7e5bc772ee4db1861e4fa56c4e63a2d48f6bc831458c2ce9fd2d.scope +           │ │   └─23639 /usr/bin/pod +.... +``` + +### Digging into multiple loggings + +**Dmesg** allows you to figure out errors and warnings in the kernel's latest messages. For example, here is output of the **dmesg | more** command: + +``` +# dmesg | more +.... +[ 1539.027419] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready +[ 1539.042726] IPv6: ADDRCONF(NETDEV_UP): veth61f37018: link is not ready +[ 1539.048706] IPv6: ADDRCONF(NETDEV_CHANGE): veth61f37018: link becomes ready +[ 1539.055034] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready +[ 1539.098550] device veth61f37018 entered promiscuous mode +[ 1541.450207] device veth61f37018 left promiscuous mode +[ 1542.493266] SELinux: mount invalid.  Same superblock, different security settings for (dev mqueue, type mqueue) +[ 9965.292788] SELinux: mount invalid.  Same superblock, different security settings for (dev mqueue, type mqueue) +[ 9965.449401] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready +[ 9965.462738] IPv6: ADDRCONF(NETDEV_UP): vetheacc333c: link is not ready +[ 9965.468942] IPv6: ADDRCONF(NETDEV_CHANGE): vetheacc333c: link becomes ready +.... +``` + +You can also look at all Linux system logs in the **/var/log/messages** file, which is where you'll find errors related to specific issues. It's worthwhile to monitor the messages via the **tail** command in real time when you make modifications to your hardware, such as mounting an extra disk or adding an Ethernet network interface. For example, here is output of the **tail -f /var/log/messages** command: + +``` +# tail -f /var/log/messages +Dec  1 13:20:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa +Dec  1 13:20:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local +Dec  1 13:21:03 bastion dnsmasq[30201]: setting upstream servers from DBus +Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 192.199.0.2#53 +Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa +Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local +Dec  1 13:21:33 bastion dnsmasq[30201]: setting upstream servers from DBus +Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 192.199.0.2#53 +Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa +Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local +``` + +### Analyzing networking functions + +You may have hundreds of thousands of cloud-native applications to serve business services in a complex networking environment; these may include virtualization, multiple cloud, and hybrid cloud. This means you should analyze whether networking connectivity is working correctly as part of your troubleshooting. Useful commands to figure out networking functions in the Linux server include **ip addr** , **traceroute** , **nslookup** , **dig** , and **ping** , among others. For example, here is output of the **ip addr show** command: + +``` +# ip addr show +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 +    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +    inet 127.0.0.1/8 scope host lo +       valid_lft forever preferred_lft forever +    inet6 ::1/128 scope host +       valid_lft forever preferred_lft forever +2: eth0: mtu 9001 qdisc mq state UP group default qlen 1000 +    link/ether 06:af:52:f8:74:98 brd ff:ff:ff:ff:ff:ff +    inet 192.199.0.169/24 brd 192.199.0.255 scope global noprefixroute dynamic eth0 +       valid_lft 3096sec preferred_lft 3096sec +    inet6 fe80::4af:52ff:fef8:7498/64 scope link +       valid_lft forever preferred_lft forever +3: docker0: mtu 1500 qdisc noqueue state DOWN group default +    link/ether 02:42:67:fb:1a:a2 brd ff:ff:ff:ff:ff:ff +    inet 172.17.0.1/16 scope global docker0 +       valid_lft forever preferred_lft forever +    inet6 fe80::42:67ff:fefb:1aa2/64 scope link +       valid_lft forever preferred_lft forever +.... +``` + +### In conclusion + +Troubleshooting Linux hardware requires considerable knowledge, including how to use powerful command-line tools and figure out system loggings. You should also know how to diagnose the kernel space, which is where you can find the root cause of many hardware problems. Keep in mind that hardware issues in Linux may come from many different sources, including devices, modules, drivers, BIOS, networking, and even plain old hardware malfunctions. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/troubleshooting-hardware-problems-linux + +作者:[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/5/what-linux-server +[2]: https://opensource.com/article/18/11/intro-software-defined-networking +[3]: https://linux.die.net/man/8/lspci +[4]: https://linux.die.net/man/8/lsblk +[5]: https://linux.die.net/man/1/lscpu +[6]: https://linux.die.net/man/8/lsscsi From 22c0afa939413a3215130ae7473ab032742253ea Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 15:53:51 +0800 Subject: [PATCH 0405/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Plans=20to=20le?= =?UTF-8?q?arn=20a=20new=20tech=20skill=20in=202019=3F=20What=20you=20need?= =?UTF-8?q?=20to=20know?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ch skill in 2019- What you need to know.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md diff --git a/sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md b/sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md new file mode 100644 index 0000000000..6ef539df9c --- /dev/null +++ b/sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Plans to learn a new tech skill in 2019? What you need to know) +[#]: via: (https://opensource.com/article/18/12/tech-skills-online-learning) +[#]: author: (David Clinton https://opensource.com/users/remyd) + +Plans to learn a new tech skill in 2019? What you need to know +====== +Go on a tour of the current state of online technology education. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/learn-programming-code-keyboard.png?itok=xaLyptT4) + +Open source software is, by definition, free. But it can sometimes cost you a king's ransom to learn how to master it. The good news? The open source ethos is alive and well in the education sector, and there are plenty of high-quality learning resources available. You just need to know where to find them. + +This article—adapted from my book, [Solving for Technology: How to quickly learn valuable new skills in a madly changing technology world][1]—offers some thoughts on what's out there and how to get the most out of it. + +How do you learn best—video courses? Hands-on interactive classes? And what are you usually looking for when you go hunting for knowledge—fast fixes to immediate problems? Deep understanding of an entire technology? Quick and dirty getting-starting guides? + +Whatever you're after, you're more likely to find it if you know what's out there. So keep your mind open to the many categories of teaching tools that exist, and join me for a tour of the current state of online technology education. + +### freeCodeCamp + +Most of the heavily edited, peer-reviewed courses available online live behind paywalls—but not all. [freeCodeCamp][2], as its name suggests, is free. And by free, I don't mean the site exists to drive traffic to some revenue-generating web page—it's completely free, simply because its creators believe such opportunities should exist. + +The idea behind freeCodeCamp is that "campers" work their way through realistic projects centered around coding challenges. But this site is different in a few important ways. First, campers are encouraged to join other local campers so they can code in mutually supportive groups. Once they've worked through the Front End, Data Visualization, Back End, or Full Stack certifications, campers are also encouraged to gain real-world experience by coding for non-profits. Finally, freeCodeCamp guides graduates through the job search and interviewing stages of their young careers. + +### YouTube + +Wondering how to change the bulb on the passenger-side brake light on your 2010 Dodge Caravan (3.8L)? There's a YouTube video that'll show you. Need to replace the pressure sensor on your ten-year-old Carrier forced-air natural gas furnace? There's another YouTube video that'll show you how to do that. In fact, there's a selection of YouTube videos that can show you how to do just about anything you can imagine—and a great many things you can't (and perhaps shouldn't). + +Got a specific problem that's blocking your progress? Looking for a bird's eye overview of your next language? Someone out there has probably already been there and recorded the solution in a video. Also, keep an eye out for video authors you like and subscribe to their YouTube channels. That makes it easier to find more useful content. + +Perhaps the most famous and successful YouTube channel of all is Salman Khan's [Khan Academy][3]. Although it's primarily aimed at K-12 students, there's plenty of useful content for people taking their first steps in programming (or physics or electrical engineering, for that matter). + +### Top 4 MOOCs + +The cost of traditional higher education programs has ballooned in recent decades. Currently, a four-year degree in the US can cost about five times the median annual household income in 2016 (around $59,000). Even if your degree ends up earning you an extra $20,000 per year beyond what you would have earned without it, it would still take you more than ten years just to break even (and perhaps many additional years to pay off the actual interest-carrying debt). + +Investments like that might not make a lot of sense. But what if you could get the same knowledge at no cost at all? + +Welcome to the world of the massive open online course (MOOC). A MOOC is a platform through which existing educational institutions deliver course content to anyone on the internet who's interested. + +By joining a MOOC, you can view video recordings of lectures from some of the best professors at elite universities and engage in simulated interactive labs, all at no cost and from the comfort of your own home. In many cases, you can also receive credit or certification for successfully completing a course. Certification often does carry some charges, but they are much lower than what you'd pay for a traditional degree. + +The downside—although not everyone will consider this a downside—is that many university-based MOOCs are less job- and industry-focused and spend more time on general theory. They sometimes also expect you to have already mastered some prerequisite STEM skills. + +Here are four major MOOC portals: + + * [**Coursera**][4]: Taking the 4- to 10-week Coursera courses is free, including quizzes and exercises. But they also offer fee-based add-ons such as assessments, grades, and certification. Specializations are multiple Coursera courses organized into a larger program like Data Science or Deep Learning. To earn a specialization certificate, students must complete a capstone project at the end. Coursera categories include Computer Science, Data Science, and Information Technology. + + * [**edX**][5]: Originally created by MIT and Harvard University, edX is a non-profit organization that delivers courseware created by more than 100 universities and colleges. Students may audit a course for free, or for a reasonable fee, gain verified certificates of completion. + + * [**MIT OpenCourseWare**][6]: OpenCourseWare isn't really a learning platform, and it won't help you much if you're looking for an organized guide through a particular topic. Rather, it's an online repository containing notes, quizzes, and some videos from thousands of MIT courses. The content can give you insights into specific questions, and if you're ambitious and determined enough, you could mine entire topics from the rich resources you'll find. + + * [**Udacity**][7]: I included Udacity in this higher education section because that's where its roots lie. But while the project's founders came from the Stanford University faculty, it was originally something of a rebellion against the high costs and distracting bloat of many university degree programs. Rather than spending four (or more) years studying material that's largely out of sync with the demands of the real job market, it proposes, why not focus on the skills the industry is looking for and get it done in much less time and for a tiny fraction of the cost? + +Udacity currently offers a couple dozen or so nano-degrees that can get to you beyond entry-level competence in some high-demand fields in just a few months. Because the nano-degrees are created with the direct involvement of major industry employers like Amazon, Nvidia, and Google, hard-working graduates have a decent chance of quickly landing a great job. + + + + +### Tips for using the internet + +There's a world of help waiting for you out there. Don't miss it. A few tips: + +#### Learn to compose smart search strings + +Internet search is much more than simply typing a few related words into the search field and hitting Enter. Here are some powerful tips that will work on any major search engine (my personal favorite is [DuckDuckGo][8]): + +#### Use your problem to find a solution + +Thousands of people have worked with the same technology you’re learning, and odds are at least some of them have encountered the same problems you have. And at least a few of those folks will likely have posted their questions to an online user forum like Stack Overflow. The quickest way to find the answers they found is to search using the same language that you encountered. + +Did your problem generate an error message? Paste that exact text into your search engine. Were there any log messages? Post those, too. + +#### Be precise + +The internet has billions of pages, and vague search results are bound to include a lot of false positives, so be as precise as possible. One powerful trick: Enclose your error message in quotation marks, which tells the search engine that you’re looking for an exact phrase rather than a single result containing all or most of the words somewhere on the page. Just don’t be so specific that you end up narrowing your results down to zero. + +As an example, for an entry from the Apache error log like this: + +`[Fri Dec 16 02:15:44 2017] [error] [client 54.211.9.96] Client sent malformed Host header` + +Leave out the date and client IP address because there’s no way anyone else got those exact details. Instead, include only the `"Client sent..."` part (in quotations): + +`"Client sent malformed Host header"` + +If that’s still too broad, consider adding the strings `Apache` and `[error]` outside the quotation marks: + +`"Client sent malformed Host header" apache [error]` + +#### Be timely + +Search engines let you narrow down your search by time. If your problem is specific to a relatively recent release version, restrict your search to only the last week or month. + +#### Search in all the right places + +Sometimes an outside search engine will do a better job searching through a large website than the site’s own internal tool (I’m looking at you, Government of Canada). If you feel the solution to your problem is likely to be somewhere on a particular site—like Stack Overflow’s admin cousin, Server Fault—but you can’t find it, restrict results to only that one site: + +`"gssacceptsec_context(2) failed:" site:serverfault.com` + +#### Leverage public code samples + +Are you stuck in a way that only a developer can be stuck? You've read your code through over and over again and you just can't find the error. You've tried at least a half a dozen different design approaches and even—briefly, mind you—an entirely different language. Nothing. The application isn't working. + +Haunt GitHub and other places where public repositories of code live. They're all searchable and filled with examples of great code. Of course, there will also be plenty of examples of really bad and even malicious code, so keep your guard up. + +Browsing through other people's code is a great way to get new ideas and learn about best practices and coding patterns. If your search engine skills are as good as I'm guessing, then you'll probably uncover working solutions to whatever it is that ails you. + +### More free stuff + +You don't have to do this all by yourself. Before embarking on a significant new learning project, take a good look at your community and government to see what services are available. + +Many governments offer support—both financial and practical—for people looking to upgrade their professional skills. There are also more and more state/provincial governments joining the open textbook movement, where well-written, up-to-date technical textbooks are made freely available on the internet. At this point, the quality of most collections looks a bit spotty, but the long-term goal is to cut the cost of an education by many hundreds of dollars. + +Your company might be willing to sponsor your learning. Many companies provide their employees with accounts to online learning sites; sometimes it's just a matter of asking your boss or HR rep what is available. + +And what about your community? You might be surprised at how many older, experienced professionals are eager to engage in mentoring. It might take a bit of courage, but go ahead and approach someone you admire to see what wisdom and practical guidance they might offer. + +This article was adapted from the book [Solving for Technology: How to quickly learn valuable new skills in a madly changing technology world][1]. As an exclusive offer to the opensource.com community, feel free to [download a PDF version of the full book][9]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/tech-skills-online-learning + +作者:[David Clinton][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/remyd +[b]: https://github.com/lujun9972 +[1]: https://learntech.bootstrap-it.com/ +[2]: https://www.freecodecamp.org/ +[3]: https://www.khanacademy.org/ +[4]: https://www.coursera.org/ +[5]: https://www.edx.org/ +[6]: http://ocw.mit.edu/index.htm +[7]: https://www.udacity.com/ +[8]: https://duckduckgo.com/ +[9]: https://learntech.bootstrap-it.com/download.html From f7d81afde86659949cb61d3c0ada87ef46a475df Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 16:24:29 +0800 Subject: [PATCH 0406/4278] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E7=BF=BB=E8=AF=91=E7=9A=84=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/status/status.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/status/status.sh b/scripts/status/status.sh index 9705c3cbc0..02c46cfc7e 100755 --- a/scripts/status/status.sh +++ b/scripts/status/status.sh @@ -5,13 +5,7 @@ cd "$(dirname "$0")/../.." # 进入TP root function file-translating-p () { local file="$*" - if head -n 1 "${file}" |grep '\[^#\]:'>/dev/null 2>&1 ;then - # 新模板 - head -n 12 "$file" |grep -v '\[^#\]:' |grep -E -i "translat|fanyi|翻译" >/dev/null 2>&1 - else - # 旧模板 - head -n 3 "$file" |grep -E -i "translat|fanyi|翻译" >/dev/null 2>&1 - fi + head -n 3 "$file" | grep -iE "^[^[].*translat|^\[#\]: translator: \([^[:space:]]+\)|fanyi|翻译" >/dev/null 2>&1 } function get_status_of() { From af614d9555cb3f5f8b36e010036ae62fe05494e1 Mon Sep 17 00:00:00 2001 From: Moelf Date: Wed, 2 Jan 2019 18:31:03 +0800 Subject: [PATCH 0407/4278] Start translating 'managing digital files' --- ...ing Digital Files (e.g., Photographs) in Files and Folders.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md b/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md index d1fd01ef0c..9a5c691e42 100644 --- a/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md +++ b/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md @@ -1,3 +1,4 @@ +Moelf translating Managing Digital Files (e.g., Photographs) in Files and Folders ====== Update 2014-05-14: added real world example From ed00d6951e5f73290c493129d587f45a21d45d64 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Wed, 2 Jan 2019 19:53:17 +0800 Subject: [PATCH 0408/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=20=E5=88=A0=E9=99=A4=E5=8E=9F=E6=96=87=2020180625=208=20reason?= =?UTF-8?q?s=20to=20use=20the=20Xfce=20Linux=20desktop=20environment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成 删除原文 20180625 8 reasons to use the Xfce Linux desktop environment.md --- ... use the Xfce Linux desktop environment.md | 87 ------------------- 1 file changed, 87 deletions(-) delete mode 100644 sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md diff --git a/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md deleted file mode 100644 index 974faa1f75..0000000000 --- a/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ /dev/null @@ -1,87 +0,0 @@ -translating by WangYueScream -=========================== -8 reasons to use the Xfce Linux desktop environment -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22) - -For several reasons (including curiosity), a few weeks ago I started using [Xfce][1] as my Linux desktop. One reason was trouble with background daemons eating up all the CPU and I/O bandwidth on my very powerful main workstation. Of course, some of the instability may be due to my removal of some of the RPM packages that provide those background daemons. However, even before I removed the RPMs, the fact is KDE was unstable and causing performance and stability issues. I needed to use a different desktop to avoid these problems. - -I realized in looking back over my series of articles on Linux desktops that I had neglected Xfce. This article is intended to rectify that oversight. I like Xfce a lot and am enjoying the speed and lightness of it more than I thought I would. - -As part of my research, I googled to try to learn what Xfce means. There is a historical reference to XForms Common Environment, but Xfce no longer uses the XForms tools. Some years ago, I found a reference to "Xtra fine computing environment," and I like that a lot. I will use that (despite not being able to find the page reference again). - -### Eight reasons for recommending Xfce - -#### 1\. Lightweight construction - -Xfce has a very small memory footprint and CPU usage compared to some other desktops, such as KDE and GNOME. On my system, the programs that make up the Xfce desktop take a tiny amount of memory for such a powerful desktop. Very low CPU usage is also a hallmark of the Xfce desktop. With such a small memory footprint, I am not especially surprised that Xfce is also very sparing of CPU cycles. - -#### 2\. Simplicity - -The Xfce desktop is simple and uncluttered with fluff. The basic desktop has two panels and a vertical line of icons on the left side. Panel 0 is at the bottom and consists of some basic application launchers, as well as the Applications icon, which provides access to all the applications on the system. Panel 1 is at the top and has an Applications launcher as well as a Workspace Switcher that allows the user to switch between multiple workspaces. The panels can be modified with additional items, such as new launchers, or by altering their height and width. - -The icons down the left side of the desktop consist of the Home directory and Trash icons. It can also display icons for the complete filesystem directory tree and any connected pluggable USB storage devices. These icons can be used to mount and unmount the device, as well as to open the default file manager. They can also be hidden if you prefer, and the Filesystem, Trash, and Home directory icons are separately controllable. The removable drives can be hidden or displayed as a group. - -#### 3\. File management - -Thunar, Xfce's default file manager, is simple, easy to use and configure, and very easy to learn. While not as fancy as file managers like Konqueror or Dolphin, it is quite capable and very fast. Thunar can't create multiple panes in its window, but it does provide tabs so multiple directories can be open at the same time. Thunar also has a very nice sidebar that, like the desktop, shows the same icons for the complete filesystem directory tree and any connected USB storage devices. Devices can be mounted and unmounted, and removable media such as CDs can be ejected. Thunar can also use helper applications such as Ark to open archive files when they are clicked. Archives, such as ZIP, TAR, and RPM files, can be viewed, and individual files can be copied out of them. - - -![Xfce desktop][3] - -The Xfce desktop with Thunar and the Xfce terminal emulator. - -Having used many different applications for my [series on file managers][4], I must say that I like Thunar for its simplicity and ease of use. It is easy to navigate the filesystem using the sidebar. - -#### 4\. Stability - -The Xfce desktop is very stable. New releases seem to be on a three-year cycle, although updates are provided as necessary. The current version is 4.12, which was released in February 2015. The rock-solid nature of the Xfce desktop is very reassuring after having issues with KDE. The Xfce desktop has never crashed for me, and it has never spawned daemons that gobbled up system resources. It just sits there and works—which is what I want. - -#### 5\. Elegance - -Xfce is simply elegant. In my new book, The Linux Philosophy for SysAdmins, which will be available this fall, I talk about the many advantages of simplicity, including the fact that simplicity is one of the hallmarks of elegance. Clearly, the programmers who write and maintain Xfce and its component applications are great fans of simplicity. This simplicity is very likely the reason that Xfce is so stable, but it also results in a clean look, a responsive interface, an easily navigable structure that feels natural, and an overall elegance that makes it a pleasure to use. - -#### 6\. Terminal emulation - -The Xfce4 terminal emulator is a powerful emulator that uses tabs to allow multiple terminals in a single window, like many other terminal emulators. This terminal emulator is simple compared to emulators like Tilix, Terminator, and Konsole, but it gets the job done. The tab names can be changed, and the tabs can be rearranged by drag and drop, using the arrow icons on the toolbar, or selecting the options on the menu bar. One thing I especially like about the tabs on the Xfce terminal emulator is that they display the name of the host to which they are connected regardless of how many other hosts are connected through to make that connection, e.g., `host1==>host2==>host3==>host4` properly shows `host4` in the tab. Other emulators show `host2` at best. - -Other aspects of its function and appearance can be easily configured to suit your needs. Like other Xfce components, this terminal emulator uses very little in the way of system resources. - -#### 7\. Configurability - -Within its limits, Xfce is very configurable. While not offering as much configurability as a desktop like KDE, it is far more configurable (and more easily so) than GNOME, for example. I found that the Settings Manager is the doorway to everything needed to configure Xfce. The individual configuration apps are separately available, but the Settings Manager collects them all into one window for ease of access. All the important aspects of the desktop can be configured to meet my needs and preferences. - -#### 8\. Modularity - -Xfce has a number of individual projects that make up the whole, and not all parts of Xfce are necessarily installed by your distro. [Xfce's projects][5] page lists the main projects, so you can find additional parts you might want to install. The items that weren't installed on my Fedora 28 workstation when I installed the Xfce group were mostly the applications at the bottom of that page. - -There is also a [documentation page][6], and a wiki called [Xfce Goodies Project][7] lists other Xfce-related projects that provide applications, artwork, and plugins for Thunar and the Xfce panels. - -### Conclusions - -The Xfce desktop is thin and fast with an overall elegance that makes it easy to figure out how to do things. Its lightweight construction conserves both memory and CPU cycles. This makes it ideal for older hosts with few resources to spare for a desktop. However, Xfce is flexible and powerful enough to satisfy my needs as a power user. - -I've learned that changing to a new Linux desktop can take some work to configure it as I want—with all of my favorite application launchers on the panel, my preferred wallpaper, and much more. I have changed to new desktops or updates of old ones many times over the years. It takes some time and a bit of patience. - -I think of it like when I've moved cubicles or offices at work. Someone carries my stuff from the old office to the new one, and I connect my computer, unpack the boxes, and place their contents in appropriate locations in my new office. Moving into the Xfce desktop was the easiest move I have ever made. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/xfce-desktop - -作者:[David Both][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/dboth -[1]:https://xfce.org/ -[2]:/file/401856 -[3]:https://opensource.com/sites/default/files/uploads/xfce-desktop-01.png (Xfce desktop) -[4]:https://opensource.com/sitewide-search?search_api_views_fulltext=David%20Both%20File%20managers -[5]:https://xfce.org/projects -[6]:https://docs.xfce.org/ -[7]:https://goodies.xfce.org/ From bbf8e7753377199da8fdb580cee809ab4638cfa1 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Wed, 2 Jan 2019 19:54:36 +0800 Subject: [PATCH 0409/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E8=AF=91=E6=96=87=2020180625=208=20reason?= =?UTF-8?q?s=20to=20use=20the=20Xfce=20Linux=20desktop=20environment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成 添加译文 20180625 8 reasons to use the Xfce Linux desktop environment.md --- ... use the Xfce Linux desktop environment.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md diff --git a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md new file mode 100644 index 0000000000..e625f12f5c --- /dev/null +++ b/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -0,0 +1,98 @@ + + +使用 Xfce Linux 桌面环境的 8 个理由 +============================ + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22) + + +由于某些原因(也包括好奇),几周前我开始使用 [Xfce][1] 作为我的 Linux 桌面。促使我更换 Linux 桌面环境的原因之一是桌面相关的守护进程占据了我的性能非常强大的主工作站的绝大部分 CPU 资源和 I/O 带宽。当然,有些不稳定性可能是因为我删除了提供这些守护进程的 RPM 包。然而,事实是在我删除这些 RPM 包之前,KDE 就已经很不稳定了而且还导致了一系列其他方面的性能和稳定性问题。所以我需要换一个桌面来避免这些问题。 + + +在回顾了我为 Linux 桌面所写的一系列文章后我才意识到我忽略了 Xfce。这篇文章也是力图能够纠正弥补这个疏忽。我非常喜欢 Xfce 也很享受它所带给我超乎预期的快速、轻量的体验。 + + +作为研究的一部分,我有尝试过在 Google 上查询 Xfce 对应什么意思。有个历史参考是它对应着 XForms Common Environment,但 Xfce 早已不在使用 XForms 工具。几年前,我找到另一个参考是 "Xtra fine computing environment" 而且我也很喜欢这个解释。我将会用它作为 Xfce 的全称(尽管再也找不到这个参考页面)。 + + +### 推荐 Xfce 的 8 个理由 + + +#### 1\. 轻量级架构 + +Xfce 相对于其他的桌面如 KDE 和 GNOME,不管是内存还是 CPU 的占用率都非常小。在我的系统中,组成 Xfce 桌面的程序仅占用了少量内存就构成一个如此强大的桌面。超低的 CPU 占用率也是 Xfce 桌面的一个特点。了解到 Xfce 内存占用特别低后,我对它的 CPU 占用率也非常低这个特性自然而言也就不感到奇怪了。 + +#### 2\. 简洁 + +Xfce 桌面很简单就像绒毛整洁的动物让人一目了然赏心悦目。基础的桌面有两个面板和一条在左边垂直的图标行。面板 0 是在底部并由一些基础的应用启动程序和能访问到系统里对应程序的图标组成。面板 1 是在顶部由一个应用程序启动器和一个能够允许用户在多个工作区之间来回切换的工作区切换器组成。面板可以通过补充项自定义修改比如增加个新的应用启动器或者更改它们的宽高。 + +桌面左侧的图标对应是家目录和垃圾桶。它也可以显示其他的图标如完整的文件系统目录树和任意已连接上系统的可插拔的 USB 存储设备。这些图标可以用来挂载和卸载设备也可以用来打开默认的文件管理器。如果你愿意,它们都可以被隐藏同时文件系统,垃圾箱,家目录对应的图标都可以逐个控制管理。所有的可移动设备也可以被隐藏或作为一个组显示。 + +#### 3\. 文件管理 + +作为 Xfce 的默认文件管理器 Thunar,它很简单,既易于使用和配置也非常容易学习。尽管它并不像其他的文件管理器比如 Konqueror 或者 Dolphin 那样效果华丽,但它很强大也很快。Thunar 并不能在一个窗口里面打开并产生多个窗口但它提供了选项卡来支持多个目录的同时打开。Thunar 也有一个非常漂亮的侧边栏就像桌面那样能够显示完整的文件系统目录树和所有已连接的 USB 存储设备。设备能够被挂载和卸载,可移动媒介如 CD 也能够被弹出。Thunar 也可以使用类似 Ark 这种帮助软件来在你点击归档文件的时候打开它们。比如 ZIP,TAR,RPM 这种归档文件都可以被浏览也可以从中复制单个文件。 + +![Xfce desktop][3] + +Xfce 桌面及 Thunar 和 Xfce 下的终端模拟器。 + +在我的[文件管理器系列][4]一文中,我已经使用体验过很多不同的文件管理器软件,我不得不说 Thunar 的简单易用让你无法不喜欢上它。它很容易帮助你通过使用侧边栏来浏览文件系统。 + + +#### 4\. 稳定 + +Xfce 桌面非常稳定。新版本的发布周期似乎是三年,但也会根据需要发布相关更新。最新的版本是于 2015 年 2 月发布的 4.12。在使用 KDE 遇到一系列问题后稳如磐石的 Xfce 桌面环境显得让人格外放心。在我使用 Xfce 的过程中,它从来没有崩溃过,也不会产生额外的守护进程占据过多的系统资源。这正是我想要的—它安安静静地工作,不会给你带来额外的困扰。 + + +#### 5\. 优雅 + +Xfce 简单优雅。在我的新书,The Linux Philosophy for SysAdmins 中我谈到了关于简单的一系列好处包括事实上简单也是优雅的诸多标志之一。很明确能够确定的就是 Xfce 及相关组件程序的开发者和维护者也是极力推崇简单至上。这种简单特性很可能也是 Xfce 如此稳定的主要原因,但它也用户带来了一个整洁的桌面外观,一个反应灵敏的操作界面,一个会让人感觉很自然也很易用的导航结构,而且 Xfce 整体上的优雅特性也会让用户的使用过程中充满愉悦感。 + + +#### 6\. 终端仿真程序 + +Xfce4 的终端仿真程序非常强大而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix,Terminator,Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如 `host1==>host2==>host3==>host4` 准确地在选项卡显示了 `host4`。但其他的终端仿真程序最多也就显示 `host2`。 + +至于这个终端仿真程序功能和外观的其他方面都可以根据你的需要很容易配置成你想要的。当然同 Xfce 的其他组件一样,这款终端仿真程序占用了系统资源的很少一部分。 + + +#### 7\. 可配置性 + +Xfce 能够配置的范围极大。虽然 Xfce 桌面的可配置性比不上 KDE,但依旧远超 GNOME 了而且比它更容易配置。比如,我发现设置管理器是 Xfce 配置一切的入口。虽然每个配置程序都可以单独使用,但是设置管理器把他们都放在一个窗口里以便快速访问。关于 Xfce 桌面很多重要的部分都可以通过配置来满足我的需求。 + + +#### 8\. 模块化 + +Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌面发行版中也未必安装了 Xfce 的所有组件。[Xfce's projects][5] 的主页列出了主要的项目,所以你可以根据需要安装你想安装的额外组件。比如在我的 Fedora 28 workstation 版本上我安装的 Xfce 桌面就没有 [Xfce's projects][5] 页最下面的说明的一些程序。 + +这里还有个关于 Xfce 的 [documentation page][6] 和 一个被称为 [Xfce Goodies Project][7] 的 wiki 列举了其他的 Xfce 相关的项目,它们为 Xfce 的面板 及 Thunar 提供了很多不错的应用程序,精美的插图,好用的插件。 + + +### 总结 + +整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易清楚如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和 内存资源。这也使得 Xfce 非常适合那种由于硬件有限无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大能够满足高级用户的需要。 + +我已经了解到更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置—比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。 + +我觉得切换 Linux 的桌面环境就像我在工作中换个办公工位或者办公室一样。别人把我的东西装箱从旧办公室搬到新办公室,然后我在我的新办公室里组装连接好我的电脑,打开箱子再把里面的东西放在合适的位置。而切换到 Xfce 桌面大概就是我做过的最简单省事容易的桌面环境更换了。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/6/xfce-desktop + +作者:[David Both][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[WangYueScream](https://github.com/WangYueScream) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/dboth +[1]:https://xfce.org/ +[2]:/file/401856 +[3]:https://opensource.com/sites/default/files/uploads/xfce-desktop-01.png (Xfce desktop) +[4]:https://opensource.com/sitewide-search?search_api_views_fulltext=David%20Both%20File%20managers +[5]:https://xfce.org/projects +[6]:https://docs.xfce.org/ +[7]:https://goodies.xfce.org/ From 7ea9c4c23734b343f5ad5533863989373cefe7c0 Mon Sep 17 00:00:00 2001 From: fuowang <19955913+fuowang@users.noreply.github.com> Date: Wed, 2 Jan 2019 21:30:54 +0800 Subject: [PATCH 0410/4278] =?UTF-8?q?fuowang=20=E7=BF=BB=E8=AF=91=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...402 An introduction to the Flask Python web app framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180402 An introduction to the Flask Python web app framework.md b/sources/tech/20180402 An introduction to the Flask Python web app framework.md index 4b07338bc5..ffb6e9c441 100644 --- a/sources/tech/20180402 An introduction to the Flask Python web app framework.md +++ b/sources/tech/20180402 An introduction to the Flask Python web app framework.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (fuowang) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (An introduction to the Flask Python web app framework) From 8f234919669be32bb303fba9a6e164482b94a462 Mon Sep 17 00:00:00 2001 From: Bestony Date: Wed, 2 Jan 2019 21:59:13 +0800 Subject: [PATCH 0411/4278] =?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 --- ...5 Build an interactive CLI with Node.js.md | 533 ----------------- ...5 Build an interactive CLI with Node.js.md | 542 ++++++++++++++++++ 2 files changed, 542 insertions(+), 533 deletions(-) delete mode 100644 sources/tech/20180725 Build an interactive CLI with Node.js.md create mode 100644 translated/tech/20180725 Build an interactive CLI with Node.js.md diff --git a/sources/tech/20180725 Build an interactive CLI with Node.js.md b/sources/tech/20180725 Build an interactive CLI with Node.js.md deleted file mode 100644 index e491993808..0000000000 --- a/sources/tech/20180725 Build an interactive CLI with Node.js.md +++ /dev/null @@ -1,533 +0,0 @@ -bestony translating - -Build an interactive CLI with Node.js -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A) - -Node.js can be very useful when it comes to building command-line interfaces (CLIs). In this post, I'll teach you how to use [Node.js][1] to build a CLI that asks some questions and creates a file based on the answers. - -### Get started - -Let's start by creating a brand new [npm][2] package. (Npm is the JavaScript package manager.) -``` -mkdir my-script - -cd my-script - -npm init - -``` - -Npm will ask some questions. After that, we need to install some packages. -``` -npm install --save chalk figlet inquirer shelljs - -``` - -Here's what these packages do: - - * **Chalk:** Terminal string styling done right - * **Figlet:** A program for making large letters out of ordinary text - * **Inquirer:** A collection of common interactive command-line user interfaces - * **ShellJS:** Portable Unix shell commands for Node.js - - - -### Make an index.js file - -Now we'll create an `index.js` file with the following content: -``` -#!/usr/bin/env node - - - -const inquirer = require("inquirer"); - -const chalk = require("chalk"); - -const figlet = require("figlet"); - -const shell = require("shelljs"); - -``` - -### Plan the CLI - -It's always good to plan what a CLI needs to do before writing any code. This CLI will do just one thing: **create a file**. - -The CLI will ask two questions—what is the filename and what is the extension?—then create the file, and show a success message with the created file path. -``` -// index.js - - - -const run = async () => { - -  // show script introduction - -  // ask questions - -  // create the file - -  // show success message - -}; - - - -run(); - -``` - -The first function is the script introduction. Let's use `chalk` and `figlet` to get the job done. -``` -const init = () => { - -  console.log( - -    chalk.green( - -      figlet.textSync("Node JS CLI", { - -        font: "Ghost", - -        horizontalLayout: "default", - -        verticalLayout: "default" - -      }) - -    ) - -  ); - -} - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  // create the file - -  // show success message - -}; - - - -run(); - -``` - -Second, we'll write a function that asks the questions. -``` -const askQuestions = () => { - -  const questions = [ - -    { - -      name: "FILENAME", - -      type: "input", - -      message: "What is the name of the file without extension?" - -    }, - -    { - -      type: "list", - -      name: "EXTENSION", - -      message: "What is the file extension?", - -      choices: [".rb", ".js", ".php", ".css"], - -      filter: function(val) { - -        return val.split(".")[1]; - -      } - -    } - -  ]; - -  return inquirer.prompt(questions); - -}; - - - -// ... - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  const answers = await askQuestions(); - -  const { FILENAME, EXTENSION } = answers; - - - -  // create the file - -  // show success message - -}; - -``` - -Notice the constants FILENAME and EXTENSIONS that came from `inquirer`. - -The next step will create the file. -``` -const createFile = (filename, extension) => { - -  const filePath = `${process.cwd()}/${filename}.${extension}` - -  shell.touch(filePath); - -  return filePath; - -}; - - - -// ... - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  const answers = await askQuestions(); - -  const { FILENAME, EXTENSION } = answers; - - - -  // create the file - -  const filePath = createFile(FILENAME, EXTENSION); - - - -  // show success message - -}; - -``` - -And last but not least, we'll show the success message along with the file path. -``` -const success = (filepath) => { - -  console.log( - -    chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) - -  ); - -}; - - - -// ... - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  const answers = await askQuestions(); - -  const { FILENAME, EXTENSION } = answers; - - - -  // create the file - -  const filePath = createFile(FILENAME, EXTENSION); - - - -  // show success message - -  success(filePath); - -}; - -``` - -Let's test the script by running `node index.js`. Here's what we get: - -### The full code - -Here is the final code: -``` -#!/usr/bin/env node - - - -const inquirer = require("inquirer"); - -const chalk = require("chalk"); - -const figlet = require("figlet"); - -const shell = require("shelljs"); - - - -const init = () => { - -  console.log( - -    chalk.green( - -      figlet.textSync("Node JS CLI", { - -        font: "Ghost", - -        horizontalLayout: "default", - -        verticalLayout: "default" - -      }) - -    ) - -  ); - -}; - - - -const askQuestions = () => { - -  const questions = [ - -    { - -      name: "FILENAME", - -      type: "input", - -      message: "What is the name of the file without extension?" - -    }, - -    { - -      type: "list", - -      name: "EXTENSION", - -      message: "What is the file extension?", - -      choices: [".rb", ".js", ".php", ".css"], - -      filter: function(val) { - -        return val.split(".")[1]; - -      } - -    } - -  ]; - -  return inquirer.prompt(questions); - -}; - - - -const createFile = (filename, extension) => { - -  const filePath = `${process.cwd()}/${filename}.${extension}` - -  shell.touch(filePath); - -  return filePath; - -}; - - - -const success = filepath => { - -  console.log( - -    chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) - -  ); - -}; - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  const answers = await askQuestions(); - -  const { FILENAME, EXTENSION } = answers; - - - -  // create the file - -  const filePath = createFile(FILENAME, EXTENSION); - - - -  // show success message - -  success(filePath); - -}; - - - -run(); - -``` - -### Use the script anywhere - -To execute this script anywhere, add a `bin` section in your `package.json` file and run `npm link`. -``` -{ - -  "name": "creator", - -  "version": "1.0.0", - -  "description": "", - -  "main": "index.js", - -  "scripts": { - -    "test": "echo \"Error: no test specified\" && exit 1", - -    "start": "node index.js" - -  }, - -  "author": "", - -  "license": "ISC", - -  "dependencies": { - -    "chalk": "^2.4.1", - -    "figlet": "^1.2.0", - -    "inquirer": "^6.0.0", - -    "shelljs": "^0.8.2" - -  }, - -  "bin": { - -    "creator": "./index.js" - -  } - -} - -``` - -Running `npm link` makes this script available anywhere. - -That's what happens when you run this command: -``` -/usr/bin/creator -> /usr/lib/node_modules/creator/index.js - -/usr/lib/node_modules/creator -> /home/hugo/code/creator - -``` - -It links the `index.js` file as an executable. This is only possible because of the first line of the CLI script: `#!/usr/bin/env node`. - -Now we can run this script by calling: -``` -$ creator - -``` - -### Wrapping up - -As you can see, Node.js makes it very easy to build nice command-line tools! If you want to go even further, check this other packages: - - * [meow][3] – a simple command-line helper - * [yargs][4] – a command-line opt-string parser - * [pkg][5] – package your Node.js project into an executable - - - -Tell us about your experience building a CLI in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/7/node-js-interactive-cli - -作者:[Hugo Dias][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/hugodias -[1]:https://nodejs.org/en/ -[2]:https://www.npmjs.com/ -[3]:https://github.com/sindresorhus/meow -[4]:https://github.com/yargs/yargs -[5]:https://github.com/zeit/pkg diff --git a/translated/tech/20180725 Build an interactive CLI with Node.js.md b/translated/tech/20180725 Build an interactive CLI with Node.js.md new file mode 100644 index 0000000000..8a7ff8f77f --- /dev/null +++ b/translated/tech/20180725 Build an interactive CLI with Node.js.md @@ -0,0 +1,542 @@ +使用 Node.js 构建交互式 CLI +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A) + + +当用于构建命令行界面(CLIs)时,Node.js变得十分的有用。在这篇文章中,我将会教你如何使用 [Node.js][1] 来构建一个问一些问题并基于回答创建一个文件 CLI。 + +### 开始 + +首先,创建一个新的 [npm][2] 包(NPM 是 JavaScript 包管理器)。 +``` +mkdir my-script + +cd my-script + +npm init + +``` + + +NPM 将会问一些问题。随后,我们需要安装一些 Packages。 + +``` +npm install --save chalk figlet inquirer shelljs + +``` + + +这是我们需要的 packages: + + * **Chalk:** 正确的设定终端的字符样式 + * **Figlet:** 使用普通字符制作大字母的程序(译者注:使用标准字符,拼凑出图片) + * **Inquirer:** 通用交互式命令行用户界面的集合 + * **ShellJS:** Node.js 版本的可移植 Unix Shell 命令行工具 + + + +### 创建一个 index.js 文件 + +现在我们要使用下述内容创建一个 `index.js` 文件。 +``` +#!/usr/bin/env node + + + +const inquirer = require("inquirer"); + +const chalk = require("chalk"); + +const figlet = require("figlet"); + +const shell = require("shelljs"); + +``` + +### 规划 CLI + +在我们写 CLI 所需的任何代码之前,做计划总是很棒的。这个 Cli 只做一件事:**创建一个文件** + +这个 CLI 将会问两个问题:文件名是什么以及文件后缀名是什么?然后创建文件,并展示一个包含了所创建文件路径的成功信息。 + +``` +// index.js + + + +const run = async () => { + + // show script introduction + + // ask questions + + // create the file + + // show success message + +}; + + + +run(); + +``` + +第一个函数是脚本的介绍。让我们使用 `chalk` 和 `figlet` 来完成这项工作。 +``` +const init = () => { + + console.log( + + chalk.green( + + figlet.textSync("Node JS CLI", { + + font: "Ghost", + + horizontalLayout: "default", + + verticalLayout: "default" + + }) + + ) + + ); + +} + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + // create the file + + // show success message + +}; + + + +run(); + +``` + +然后,我们来写一个函数来问问题。 +``` +const askQuestions = () => { + + const questions = [ + + { + + name: "FILENAME", + + type: "input", + + message: "What is the name of the file without extension?" + + }, + + { + + type: "list", + + name: "EXTENSION", + + message: "What is the file extension?", + + choices: [".rb", ".js", ".php", ".css"], + + filter: function(val) { + + return val.split(".")[1]; + + } + + } + + ]; + + return inquirer.prompt(questions); + +}; + + + +// ... + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + const answers = await askQuestions(); + + const { FILENAME, EXTENSION } = answers; + + + + // create the file + + // show success message + +}; + +``` + +注意,常量 FILENAME 和 EXTENSIONS 来自 `inquirer` 包。 + +下一步将会创建文件。 +``` +const createFile = (filename, extension) => { + + const filePath = `${process.cwd()}/${filename}.${extension}` + + shell.touch(filePath); + + return filePath; + +}; + + + +// ... + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + const answers = await askQuestions(); + + const { FILENAME, EXTENSION } = answers; + + + + // create the file + + const filePath = createFile(FILENAME, EXTENSION); + + + + // show success message + +}; + +``` + +最后,重要的是,我们将展示成功信息以及文件路径。 + +``` +const success = (filepath) => { + + console.log( + + chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) + + ); + +}; + + + +// ... + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + const answers = await askQuestions(); + + const { FILENAME, EXTENSION } = answers; + + + + // create the file + + const filePath = createFile(FILENAME, EXTENSION); + + + + // show success message + + success(filePath); + +}; + +``` + + +来让我们通过运行 `node index.js` 来测试这个脚本,这是我们得到的: + +### 完整代码 + +下述代码为完整代码: +``` +#!/usr/bin/env node + + + +const inquirer = require("inquirer"); + +const chalk = require("chalk"); + +const figlet = require("figlet"); + +const shell = require("shelljs"); + + + +const init = () => { + + console.log( + + chalk.green( + + figlet.textSync("Node JS CLI", { + + font: "Ghost", + + horizontalLayout: "default", + + verticalLayout: "default" + + }) + + ) + + ); + +}; + + + +const askQuestions = () => { + + const questions = [ + + { + + name: "FILENAME", + + type: "input", + + message: "What is the name of the file without extension?" + + }, + + { + + type: "list", + + name: "EXTENSION", + + message: "What is the file extension?", + + choices: [".rb", ".js", ".php", ".css"], + + filter: function(val) { + + return val.split(".")[1]; + + } + + } + + ]; + + return inquirer.prompt(questions); + +}; + + + +const createFile = (filename, extension) => { + + const filePath = `${process.cwd()}/${filename}.${extension}` + + shell.touch(filePath); + + return filePath; + +}; + + + +const success = filepath => { + + console.log( + + chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) + + ); + +}; + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + const answers = await askQuestions(); + + const { FILENAME, EXTENSION } = answers; + + + + // create the file + + const filePath = createFile(FILENAME, EXTENSION); + + + + // show success message + + success(filePath); + +}; + + + +run(); + +``` + +### 在任何地方使用这个脚本 + +To execute this script anywhere, add a `bin` section in your `package.json` file and run `npm link`. +想要在任何地方执行这个脚本,在你的 `package.json` 文件中添加一个 `bin` 部分,并执行 `npm link` +``` +{ + + "name": "creator", + + "version": "1.0.0", + + "description": "", + + "main": "index.js", + + "scripts": { + + "test": "echo \"Error: no test specified\" && exit 1", + + "start": "node index.js" + + }, + + "author": "", + + "license": "ISC", + + "dependencies": { + + "chalk": "^2.4.1", + + "figlet": "^1.2.0", + + "inquirer": "^6.0.0", + + "shelljs": "^0.8.2" + + }, + + "bin": { + + "creator": "./index.js" + + } + +} + +``` + + +执行 `npm link` 使得这个脚本可以在任何地方调用。 + +这就是是当你运行这个命令时会发生的事情。 + +``` +/usr/bin/creator -> /usr/lib/node_modules/creator/index.js + +/usr/lib/node_modules/creator -> /home/hugo/code/creator + +``` + + +这会连接 `index.js` 作为一个可执行文件。这是完全可能的,因为这个 CLI 脚本的第一行是 `#!/usr/bin/env node`。 + + +现在我们可以通过执行如下命令来调用。 +``` +$ creator + +``` + +### 总结 + +正如你所看到的,Node.js 使得构建一个好的命令行工具变得非常简单。如果你希望了解更多内容,查看下列包。 + + * [meow][3] – 一个简单的命令行助手工具 + * [yargs][4] – 一个命令行参数 opts 解析工具 + * [pkg][5] – 将你的 Node.js 程序包装在一个可执行文件中。 + + +在评论中留下你关于构建 CLI 的经验吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/node-js-interactive-cli + +作者:[Hugo Dias][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[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/hugodias +[1]:https://nodejs.org/en/ +[2]:https://www.npmjs.com/ +[3]:https://github.com/sindresorhus/meow +[4]:https://github.com/yargs/yargs +[5]:https://github.com/zeit/pkg From 09cb0fcfed852713c839983726cba29d2716ae3a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:23:13 +0800 Subject: [PATCH 0412/4278] PRF:20180725 Build an interactive CLI with Node.js.md @bestony --- ...5 Build an interactive CLI with Node.js.md | 273 +++--------------- 1 file changed, 33 insertions(+), 240 deletions(-) diff --git a/translated/tech/20180725 Build an interactive CLI with Node.js.md b/translated/tech/20180725 Build an interactive CLI with Node.js.md index 8a7ff8f77f..d2e6d1d52b 100644 --- a/translated/tech/20180725 Build an interactive CLI with Node.js.md +++ b/translated/tech/20180725 Build an interactive CLI with Node.js.md @@ -1,527 +1,320 @@ -使用 Node.js 构建交互式 CLI +使用 Node.js 构建交互式命令行工具 ====== +> 使用 Node.js 构建一个根据询问创建文件的命令行工具。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A) - -当用于构建命令行界面(CLIs)时,Node.js变得十分的有用。在这篇文章中,我将会教你如何使用 [Node.js][1] 来构建一个问一些问题并基于回答创建一个文件 CLI。 +当用于构建命令行界面(CLI)时,Node.js 十分有用。在这篇文章中,我将会教你如何使用 [Node.js][1] 来构建一个问一些问题并基于回答创建一个文件的命令行工具。 ### 开始 首先,创建一个新的 [npm][2] 包(NPM 是 JavaScript 包管理器)。 + ``` mkdir my-script - cd my-script - npm init - ``` - -NPM 将会问一些问题。随后,我们需要安装一些 Packages。 +NPM 将会问一些问题。随后,我们需要安装一些包。 ``` npm install --save chalk figlet inquirer shelljs - ``` +这是我们需要的包: -这是我们需要的 packages: - - * **Chalk:** 正确的设定终端的字符样式 - * **Figlet:** 使用普通字符制作大字母的程序(译者注:使用标准字符,拼凑出图片) - * **Inquirer:** 通用交互式命令行用户界面的集合 - * **ShellJS:** Node.js 版本的可移植 Unix Shell 命令行工具 - - + * Chalk:正确设定终端的字符样式 + * Figlet:使用普通字符制作大字母的程序(LCTT 译注:使用标准字符,拼凑出图片) + * Inquirer:通用交互式命令行用户界面的集合 + * ShellJS:Node.js 版本的可移植 Unix Shell 命令行工具 ### 创建一个 index.js 文件 现在我们要使用下述内容创建一个 `index.js` 文件。 + ``` #!/usr/bin/env node - - const inquirer = require("inquirer"); - const chalk = require("chalk"); - const figlet = require("figlet"); - const shell = require("shelljs"); - ``` -### 规划 CLI +### 规划命令行工具 -在我们写 CLI 所需的任何代码之前,做计划总是很棒的。这个 Cli 只做一件事:**创建一个文件** +在我们写命令行工具所需的任何代码之前,做计划总是很棒的。这个命令行工具只做一件事:**创建一个文件**。 -这个 CLI 将会问两个问题:文件名是什么以及文件后缀名是什么?然后创建文件,并展示一个包含了所创建文件路径的成功信息。 +它将会问两个问题:文件名是什么以及文件后缀名是什么?然后创建文件,并展示一个包含了所创建文件路径的成功信息。 ``` // index.js - - const run = async () => { - // show script introduction - // ask questions - // create the file - // show success message - }; - - run(); - ``` -第一个函数是脚本的介绍。让我们使用 `chalk` 和 `figlet` 来完成这项工作。 +第一个函数只是该脚本的介绍。让我们使用 `chalk` 和 `figlet` 来把它完成。 + ``` const init = () => { - console.log( - chalk.green( - figlet.textSync("Node JS CLI", { - font: "Ghost", - horizontalLayout: "default", - verticalLayout: "default" - }) - ) - ); - } - - const run = async () => { - // show script introduction - init(); - - // ask questions - // create the file - // show success message - }; - - run(); - ``` 然后,我们来写一个函数来问问题。 + ``` const askQuestions = () => { - const questions = [ - { - name: "FILENAME", - type: "input", - message: "What is the name of the file without extension?" - }, - { - type: "list", - name: "EXTENSION", - message: "What is the file extension?", - choices: [".rb", ".js", ".php", ".css"], - filter: function(val) { - return val.split(".")[1]; - } - } - ]; - return inquirer.prompt(questions); - }; - - // ... - - const run = async () => { - // show script introduction - init(); - - // ask questions - const answers = await askQuestions(); - const { FILENAME, EXTENSION } = answers; - - // create the file - // show success message - }; - ``` -注意,常量 FILENAME 和 EXTENSIONS 来自 `inquirer` 包。 +注意,常量 `FILENAME` 和 `EXTENSIONS` 来自 `inquirer` 包。 下一步将会创建文件。 + ``` const createFile = (filename, extension) => { - const filePath = `${process.cwd()}/${filename}.${extension}` - shell.touch(filePath); - return filePath; - }; - - // ... - - const run = async () => { - // show script introduction - init(); - - // ask questions - const answers = await askQuestions(); - const { FILENAME, EXTENSION } = answers; - - // create the file - const filePath = createFile(FILENAME, EXTENSION); - - // show success message - }; - ``` 最后,重要的是,我们将展示成功信息以及文件路径。 ``` const success = (filepath) => { - console.log( - chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) - ); - }; - - // ... - - const run = async () => { - // show script introduction - init(); - - // ask questions - const answers = await askQuestions(); - const { FILENAME, EXTENSION } = answers; - - // create the file - const filePath = createFile(FILENAME, EXTENSION); - - // show success message - success(filePath); - }; - ``` 来让我们通过运行 `node index.js` 来测试这个脚本,这是我们得到的: +![](https://opensource.com/sites/default/files/uploads/nodejs_output.png) + ### 完整代码 下述代码为完整代码: + ``` #!/usr/bin/env node - - const inquirer = require("inquirer"); - const chalk = require("chalk"); - const figlet = require("figlet"); - const shell = require("shelljs"); - - const init = () => { - console.log( - chalk.green( - figlet.textSync("Node JS CLI", { - font: "Ghost", - horizontalLayout: "default", - verticalLayout: "default" - }) - ) - ); - }; - - const askQuestions = () => { - const questions = [ - { - name: "FILENAME", - type: "input", - message: "What is the name of the file without extension?" - }, - { - type: "list", - name: "EXTENSION", - message: "What is the file extension?", - choices: [".rb", ".js", ".php", ".css"], - filter: function(val) { - return val.split(".")[1]; - } - } - ]; - return inquirer.prompt(questions); - }; - - const createFile = (filename, extension) => { - const filePath = `${process.cwd()}/${filename}.${extension}` - shell.touch(filePath); - return filePath; - }; - - const success = filepath => { - console.log( - chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) - ); - }; - - const run = async () => { - // show script introduction - init(); - - // ask questions - const answers = await askQuestions(); - const { FILENAME, EXTENSION } = answers; - - // create the file - const filePath = createFile(FILENAME, EXTENSION); - - // show success message - success(filePath); - }; - - run(); - ``` -### 在任何地方使用这个脚本 +### 使用这个脚本 + +想要在其它地方执行这个脚本,在你的 `package.json` 文件中添加一个 `bin` 部分,并执行 `npm link`: -To execute this script anywhere, add a `bin` section in your `package.json` file and run `npm link`. -想要在任何地方执行这个脚本,在你的 `package.json` 文件中添加一个 `bin` 部分,并执行 `npm link` ``` { - "name": "creator", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "node index.js" - }, - "author": "", - "license": "ISC", - "dependencies": { - "chalk": "^2.4.1", - "figlet": "^1.2.0", - "inquirer": "^6.0.0", - "shelljs": "^0.8.2" - }, - "bin": { - "creator": "./index.js" - } - } - ``` - 执行 `npm link` 使得这个脚本可以在任何地方调用。 -这就是是当你运行这个命令时会发生的事情。 +这就是是当你运行这个命令时的结果。 ``` /usr/bin/creator -> /usr/lib/node_modules/creator/index.js - /usr/lib/node_modules/creator -> /home/hugo/code/creator - ``` - 这会连接 `index.js` 作为一个可执行文件。这是完全可能的,因为这个 CLI 脚本的第一行是 `#!/usr/bin/env node`。 - 现在我们可以通过执行如下命令来调用。 + ``` $ creator - ``` ### 总结 正如你所看到的,Node.js 使得构建一个好的命令行工具变得非常简单。如果你希望了解更多内容,查看下列包。 - * [meow][3] – 一个简单的命令行助手工具 - * [yargs][4] – 一个命令行参数 opts 解析工具 - * [pkg][5] – 将你的 Node.js 程序包装在一个可执行文件中。 + * [meow][3]:一个简单的命令行助手工具 + * [yargs][4]:一个命令行参数解析工具 + * [pkg][5]:将你的 Node.js 程序包装在一个可执行文件中。 - -在评论中留下你关于构建 CLI 的经验吧! +在评论中留下你关于构建命令行工具的经验吧! -------------------------------------------------------------------------------- @@ -530,7 +323,7 @@ via: https://opensource.com/article/18/7/node-js-interactive-cli 作者:[Hugo Dias][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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 5d4b6ce9077fb2a3b44a82bcf66e03aea8ecd035 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:26:42 +0800 Subject: [PATCH 0413/4278] PUB:20180725 Build an interactive CLI with Node.js.md @bestony https://linux.cn/article-10408-1.html --- .../20180725 Build an interactive CLI with Node.js.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180725 Build an interactive CLI with Node.js.md (100%) diff --git a/translated/tech/20180725 Build an interactive CLI with Node.js.md b/published/20180725 Build an interactive CLI with Node.js.md similarity index 100% rename from translated/tech/20180725 Build an interactive CLI with Node.js.md rename to published/20180725 Build an interactive CLI with Node.js.md From 56951389e57468eee6e4676eb4ae98b41e18d146 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:35:07 +0800 Subject: [PATCH 0414/4278] PRF:20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @geekpi --- ... Mode Or Emergency Mode In Ubuntu 18.04.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md index 9d5836b921..8598c7e4cc 100644 --- a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ b/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) @@ -9,13 +9,14 @@ 如何在 Ubuntu 18.04 中启动到救援模式或紧急模式 ====== + ![](https://www.ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Rescue-Mode-Or-Emergency-Mode-720x340.png) -正如你可能已经知道的那样,**runlevel** 在许多最近的 Linux 发行版(如 RHEL 7 和 Ubuntu 16.04 LTS)中被 **systemd target** 替换。有关 runlevel 和 systemd target 的更多详细信息,请参阅[**本指南**][1]。在这个简短的教程中,我们将看到如何启动**救援模式**以及**紧急模式**。本指南在 Ubuntu 18.04 LTS 中进行了测试,但是下面给出的步骤适用于大多数使用 systemd 作为默认服务管理器的 Linux 发行版。在进一步讨论之前,让我澄清什么是救援模式和紧急模式以及这两种模式的目的是什么。 +正如你可能已经知道的那样,**运行级别** 在许多最近的 Linux 发行版(如 RHEL 7 和 Ubuntu 16.04 LTS)中被 **systemd 的目标** 替换。有关它们的更多详细信息,请参阅[这个指南][1]。在这个简短的教程中,我们将看到如何启动**救援模式**以及**紧急模式**。本指南在 Ubuntu 18.04 LTS 中进行了测试,但是下面给出的步骤适用于大多数使用 systemd 作为默认服务管理器的 Linux 发行版。在进一步讨论之前,让我澄清什么是救援模式和紧急模式以及这两种模式的目的是什么。 ### 什么是救援模式? -**救援模式**相当于使用 **SysV** 作为默认服务管理器的 Linux 发行版中的 **单用户模式**。在救援模式下,将挂载所有本地文件系统,仅启动一些重要服务。但是,不会启动正常服务(例如网络服务)。救援模式在系统无法正常启动的情况下很有用。此外,我们可以在救援模式下执行一些重要的救援操作,例如[**重置 root 密码**][2]。 +**救援模式**相当于使用 **SysV** 作为默认的服务管理器的 Linux 发行版中的 **单用户模式**。在救援模式下,将挂载所有本地文件系统,仅启动一些重要服务。但是,不会启动正常服务(例如网络服务)。救援模式在系统无法正常启动的情况下很有用。此外,我们可以在救援模式下执行一些重要的救援操作,例如[重置 root 密码][2]。 ### 什么是紧急模式? @@ -23,13 +24,13 @@ ### 在 Ubuntu 18.04 LTS 中进入救援模式 -启动你的 Ubuntu 系统。出现 Grub 菜单时,选择第一条并按下 **e** 进行编辑。 +启动你的 Ubuntu 系统。出现 Grub 菜单时,选择第一条并按下 `e` 进行编辑。 ![](https://www.ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png) -如果你没有看到 Grub 菜单,只需在 BIOS logo 消失后立即按下 ESC 键。 +如果你没有看到 Grub 菜单,只需在 BIOS 的 logo 消失后立即按下 `ESC` 键。 -找到以单词 **“linux”** 开头的行,并在该行的末尾添加以下行(要到达末尾,只需按下 **CTRL+e** 或使用 END 键或左右箭头键): +找到以单词 `linux` 开头的行,并在该行的末尾添加以下内容(要到达末尾,只需按下 `CTRL+e` 或使用 `END` 键或左右箭头键): ``` systemd.unit=rescue.target @@ -37,11 +38,11 @@ systemd.unit=rescue.target ![](https://www.ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png) -添加完成后,只需按下 **CTRL+x** 或 **F10** 即可继续启动救援模式。几秒钟后,你将以 root 用户身份进入救援模式(单用户模式)。以下是 Ubuntu 18.04 LTS 服务器版中救援模式的样子: +添加完成后,只需按下 `CTRL+x` 或 `F10` 即可继续启动救援模式。几秒钟后,你将以 root 用户身份进入救援模式(单用户模式)。以下是 Ubuntu 18.04 LTS 服务器版中救援模式的样子: ![](https://www.ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png) -接下来,输入以下命令将根 (/) 文件系统挂载成读/写模式。 +接下来,输入以下命令将根 (`/`) 文件系统重新挂载成读/写模式。 ``` mount -n -o remount,rw / @@ -49,15 +50,15 @@ mount -n -o remount,rw / ### 启动到紧急模式 -将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 grub 菜单时将 “systemd.unit=rescue.target” 替换为 “systemd.unit=emergency.target” 即可。 +将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 Grub 菜单时将 `systemd.unit=rescue.target` 替换为 `systemd.unit=emergency.target` 即可。 [![emergency mode][3]][4] -添加 “systemd.unit=emergency.target” 后,按下 **Ctrl+x** 或 **F10** 继续启动到紧急模式。 +添加 `systemd.unit=emergency.target` 后,按下 `Ctrl+x` 或 `F10` 继续启动到紧急模式。 ![](https://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png) -最后,你可以使用以下命令将根文件系统挂载成读/写模式: +最后,你可以使用以下命令将根文件系统重新挂载成读/写模式: ``` mount -n -o remount,rw / @@ -65,7 +66,7 @@ mount -n -o remount,rw / ### 在救援模式和紧急模式之间切换 -如果你处于救援模式,则不必像上面提到的那样编辑 grub 条目。相反,只需输入以下命令即可立即切换到紧急模式: +如果你处于救援模式,则不必像上面提到的那样编辑 Grub 条目。相反,只需输入以下命令即可立即切换到紧急模式: ``` systemctl emergency @@ -86,7 +87,6 @@ systemctl rescue 干杯! - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ @@ -94,7 +94,7 @@ via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in 作者:[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/) 荣誉推出 @@ -103,4 +103,4 @@ via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in [1]: https://www.ostechnix.com/check-runlevel-linux/ [2]: https://www.ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/ [3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png \ No newline at end of file +[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png From ebe6925711fc4b93623369b2e38b66fc002dd9bd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:35:42 +0800 Subject: [PATCH 0415/4278] PUB:20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @geekpi https://linux.cn/article-10409-1.html --- ...Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md (98%) diff --git a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md similarity index 98% rename from translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md rename to published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md index 8598c7e4cc..5e599cfa66 100644 --- a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ b/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10409-1.html) [#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) [#]: via: (https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 150cffb49be287b8278ef7f3fc6fc79e16bdfc39 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:50:20 +0800 Subject: [PATCH 0416/4278] PRF:20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md --- ...o Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md index 5e599cfa66..cd334fe55a 100644 --- a/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ b/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -52,7 +52,7 @@ mount -n -o remount,rw / 将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 Grub 菜单时将 `systemd.unit=rescue.target` 替换为 `systemd.unit=emergency.target` 即可。 -[![emergency mode][3]][4] +![emergency mode][4] 添加 `systemd.unit=emergency.target` 后,按下 `Ctrl+x` 或 `F10` 继续启动到紧急模式。 From 908b8dc6a583d0e72b8489cac65ace1af4662453 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 3 Jan 2019 08:55:16 +0800 Subject: [PATCH 0417/4278] translated --- ...ojects to try in COPR for December 2018.md | 93 ------------------- ...ojects to try in COPR for December 2018.md | 93 +++++++++++++++++++ 2 files changed, 93 insertions(+), 93 deletions(-) delete mode 100644 sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md create mode 100644 translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md diff --git a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md deleted file mode 100644 index 0564320363..0000000000 --- a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md +++ /dev/null @@ -1,93 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 cool new projects to try in COPR for December 2018) -[#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) -[#]: author: (Dominik Turecek https://fedoramagazine.org) - -4 cool new projects to try in COPR for December 2018 -====== -![](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. - -### MindForger - -[MindForger][2] is a Markdown editor and a notebook. In addition to features you’d expect from a Markdown editor, MindForger lets you split a single file into multiple notes. It’s easy to organize the notes and move them around between files, as well as search through them. I’ve been using MindForger for some time for my study notes, so it’s nice that it’s available through COPR now.![][3] - -#### Installation instructions - -The repo currently provides MindForger for Fedora 29 and Rawhide. To install MindForger, use these commands: - -``` -sudo dnf copr enable deadmozay/mindforger -sudo dnf install mindforger -``` - -### Clingo - -[Clingo][4] is a program for solving logical problems using [answer set programming][5] (ASP) modeling language. With ASP, you can declaratively describe a problem as a logical program that Clingo then solves. As a result, Clingo produces solutions to the problem in the form of logical models, called answer sets. - -#### Installation instructions - -The repo currently provides Clingo for Fedora 28 and 29. To install Clingo, use these commands: - -``` -sudo dnf copr enable timn/clingo -sudo dnf install clingo -``` - -### SGVrecord - -[SGVrecord][6] is a simple tool for recording your screen. It allows you to either capture the whole screen or select just a part of it. Furthermore, it is possible to make the record with or without sound. Sgvrecord produces files in WebM format.![][7] - -#### Installation instructions - -The repo currently provides SGVrecord for Fedora 28, 29, and Rawhide. To install SGVrecord, use these commands: - -``` -sudo dnf copr enable youssefmsourani/sgvrecord -sudo dnf install sgvrecord -``` - -### Watchman - -[Watchman][8] is a service for monitoring and recording when changes are done to files. -You can specify directory trees for Watchman to monitor, as well as define actions -that are triggered when specified files are changed. - -#### Installation instructions - -The repo currently provides Watchman for Fedora 29 and Rawhide. To install Watchman, use these commands: - -``` -sudo dnf copr enable eklitzke/watchman -sudo dnf install watchman -``` - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/4-try-copr-december-2018/ - -作者:[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.mindforger.com/ -[3]: https://fedoramagazine.org/wp-content/uploads/2018/12/mindforger.png -[4]: https://potassco.org/clingo/ -[5]: https://en.wikipedia.org/wiki/Answer_set_programming -[6]: https://github.com/yucefsourani/sgvrecord -[7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png -[8]: https://facebook.github.io/watchman/ diff --git a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md new file mode 100644 index 0000000000..e69a659b9e --- /dev/null +++ b/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for December 2018) +[#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) +[#]: author: (Dominik Turecek https://fedoramagazine.org) + +2018 年 12 月值得尝试的 4个很酷的 COPR 新项目 +====== +![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) + +COPR 是个人软件仓库[集合][1],它不在 Fedora 中。某些软件不符合允许轻松打包的标准。或者它可能不符合其他 Fedora 标准,尽管它是自由开源的。COPR 可在 Fedora套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或由项目自己签名。但是,这是尝试新的或实验性软件的一种很好的方法。 + +这是 COPR 中一组新的有趣项目。 + +### MindForger + +[MindForger][2] 是 Markdown 编辑器和笔记本。除了你希望的 Markdown 编辑器的功能之外,MindForger 还允许你将单个文件拆分为多个笔记。组织笔记并在文件之间移动、搜索它们都很容易。我已经使用 MindForger 一段时间来记录学习笔记了,现在可以在 COPR 中找到它啦。 +![][3] + +#### 安装说明 + +该仓库目前在 Fedora 29 和 Rawhide 中提供 MindForger。要安装 MindForger,请使用以下命令: + +``` +sudo dnf copr enable deadmozay/mindforger +sudo dnf install mindforger +``` + +### Clingo + +[Clingo][4] 是使用[回答集编程][5] (ASP) 建模语言解决逻辑问题的程序。使用 ASP,你可以将问题声明为一个 Clingo 逻辑程序然后解决。最后,Clingo 以逻辑模型的形式产生问题的解决方案,称为回答集。 + +#### 安装说明 + +该仓库目前为 Fedora 28 和 29 提供 Clingo。要安装 Clingo,请使用以下命令: + +``` +sudo dnf copr enable timn/clingo +sudo dnf install clingo +``` + +### SGVrecord + +[SGVrecord][6] 是一个用于录制屏幕的简单工具。它允许你捕获整个屏幕或仅选择其中的一部分。此外,有没有声音都可以进行录制。Sgvrecord 以 WebM 格式生成文件。 +![][7] + +#### 安装说明 + +该仓库目前为 Fedora 28、29 和 Rawhide 提供 SGVrecord。要安装 SGVrecord,请使用以下命令: + +``` +sudo dnf copr enable youssefmsourani/sgvrecord +sudo dnf install sgvrecord +``` + +### Watchman + +[Watchman][8] 是一个对文件更改进行监视和记录的服务。你可以为指定 Watchman 监视的目录树,以及定义指定文件发生更改时触发的操作。 + +#### 安装说明 + +该仓库目前为 Fedora 29 和 Rawhide 提供 Watchman。要安装 Watchman,请使用以下命令: + +``` +sudo dnf copr enable eklitzke/watchman +sudo dnf install watchman +``` + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-try-copr-december-2018/ + +作者:[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.mindforger.com/ +[3]: https://fedoramagazine.org/wp-content/uploads/2018/12/mindforger.png +[4]: https://potassco.org/clingo/ +[5]: https://en.wikipedia.org/wiki/Answer_set_programming +[6]: https://github.com/yucefsourani/sgvrecord +[7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png +[8]: https://facebook.github.io/watchman/ \ No newline at end of file From 794af2bbba1a716475781f125b92fdee2e3b4d16 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 3 Jan 2019 09:02:11 +0800 Subject: [PATCH 0418/4278] translating --- ...1219 Solve a puzzle at the Linux command line with nudoku.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md index 7822a0cb98..664921bb87 100644 --- a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md +++ b/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 85929b48443eca4661001f3faeb3434cf3cac977 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 3 Jan 2019 09:07:21 +0800 Subject: [PATCH 0419/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Linux=20command?= =?UTF-8?q?s=20for=20measuring=20disk=20activity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ux commands for measuring disk activity.md | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 sources/tech/20181227 Linux commands for measuring disk activity.md diff --git a/sources/tech/20181227 Linux commands for measuring disk activity.md b/sources/tech/20181227 Linux commands for measuring disk activity.md new file mode 100644 index 0000000000..badda327dd --- /dev/null +++ b/sources/tech/20181227 Linux commands for measuring disk activity.md @@ -0,0 +1,252 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux commands for measuring disk activity) +[#]: via: (https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux commands for measuring disk activity +====== +![](https://images.idgesg.net/images/article/2018/12/tape-measure-100782593-large.jpg) +Linux systems provide a handy suite of commands for helping you see how busy your disks are, not just how full. In this post, we examine five very useful commands for looking into disk activity. Two of the commands (iostat and ioping) may have to be added to your system, and these same two commands require you to use sudo privileges, but all five commands provide useful ways to view disk activity. + +Probably one of the easiest and most obvious of these commands is **dstat**. + +### dtstat + +In spite of the fact that the **dstat** command begins with the letter "d", it provides stats on a lot more than just disk activity. If you want to view just disk activity, you can use the **-d** option. As shown below, you’ll get a continuous list of disk read/write measurements until you stop the display with a ^c. Note that after the first report, each subsequent row in the display will report disk activity in the following time interval, and the default is only one second. + +``` +$ dstat -d +-dsk/total- + read writ + 949B 73k + 65k 0 <== first second + 0 24k <== second second + 0 16k + 0 0 ^C +``` + +Including a number after the -d option will set the interval to that number of seconds. + +``` +$ dstat -d 10 +-dsk/total- + read writ + 949B 73k + 65k 81M <== first five seconds + 0 21k <== second five second + 0 9011B ^C +``` + +Notice that the reported data may be shown in a number of different units — e.g., M (megabytes), k (kilobytes), and B (bytes). + +Without options, the dstat command is going to show you a lot of other information as well — indicating how the CPU is spending its time, displaying network and paging activity, and reporting on interrupts and context switches. + +``` +$ dstat +You did not select any stats, using -cdngy by default. +--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system-- +usr sys idl wai stl| read writ| recv send| in out | int csw + 0 0 100 0 0| 949B 73k| 0 0 | 0 3B| 38 65 + 0 0 100 0 0| 0 0 | 218B 932B| 0 0 | 53 68 + 0 1 99 0 0| 0 16k| 64B 468B| 0 0 | 64 81 ^C +``` + +The dstat command provides valuable insights into overall Linux system performance, pretty much replacing a collection of older tools, such as vmstat, netstat, iostat, and ifstat, with a flexible and powerful command that combines their features. For more insight into the other information that the dstat command can provide, refer to this post on the [dstat][1] command. + +### iostat + +The iostat command helps monitor system input/output device loading by observing the time the devices are active in relation to their average transfer rates. It's sometimes used to evaluate the balance of activity between disks. + +``` +$ iostat +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +loop0 0.00 0.00 0.00 1048 0 +loop1 0.00 0.00 0.00 365 0 +loop2 0.00 0.00 0.00 1056 0 +loop3 0.00 0.01 0.00 16169 0 +loop4 0.00 0.00 0.00 413 0 +loop5 0.00 0.00 0.00 1184 0 +loop6 0.00 0.00 0.00 1062 0 +loop7 0.00 0.00 0.00 5261 0 +sda 1.06 0.89 72.66 2837453 232735080 +sdb 0.00 0.02 0.00 48669 40 +loop8 0.00 0.00 0.00 1053 0 +loop9 0.01 0.01 0.00 18949 0 +loop10 0.00 0.00 0.00 56 0 +loop11 0.00 0.00 0.00 7090 0 +loop12 0.00 0.00 0.00 1160 0 +loop13 0.00 0.00 0.00 108 0 +loop14 0.00 0.00 0.00 3572 0 +loop15 0.01 0.01 0.00 20026 0 +loop16 0.00 0.00 0.00 24 0 +``` + +Of course, all the stats provided on Linux loop devices can clutter the display when you want to focus solely on your disks. The command, however, does provide the **-p** option, which allows you to just look at your disks — as shown in the commands below. + +``` +$ iostat -p sda +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 1.06 0.89 72.54 2843737 232815784 +sda1 1.04 0.88 72.54 2821733 232815784 +``` + +Note that **tps** refers to transfers per second. + +You can also get iostat to provide repeated reports. In the example below, we're getting measurements every five seconds by using the **-d** option. + +``` +$ iostat -p sda -d 5 +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 1.06 0.89 72.51 2843749 232834048 +sda1 1.04 0.88 72.51 2821745 232834048 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 0.80 0.00 11.20 0 56 +sda1 0.80 0.00 11.20 0 56 +``` + +If you prefer to omit the first (stats since boot) report, add a **-y** to your command. + +``` +$ iostat -p sda -d 5 -y +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 0.80 0.00 11.20 0 56 +sda1 0.80 0.00 11.20 0 56 +``` + +Next, we look at our second disk drive. + +``` +$ iostat -p sdb +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sdb 0.00 0.02 0.00 48669 40 +sdb2 0.00 0.00 0.00 4861 40 +sdb1 0.00 0.01 0.00 35344 0 +``` + +### iotop + +The **iotop** command is top-like utility for looking at disk I/O. It gathers I/O usage information provided by the Linux kernel so that you can get an idea which processes are most demanding in terms in disk I/O. In the example below, the loop time has been set to 5 seconds. The display will update itself, overwriting the previous output. + +``` +$ sudo iotop -d 5 +Total DISK READ: 0.00 B/s | Total DISK WRITE: 1585.31 B/s +Current DISK READ: 0.00 B/s | Current DISK WRITE: 12.39 K/s + TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND +32492 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.12 % [kworker/u8:1-ev~_power_efficient] + 208 be/3 root 0.00 B/s 1585.31 B/s 0.00 % 0.11 % [jbd2/sda1-8] + 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init splash + 2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd] + 3 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_gp] + 4 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_par_gp] + 8 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [mm_percpu_wq] +``` + +### ioping + +The **ioping** command is an altogether different type of tool, but it can report disk latency — how long it takes a disk to respond to requests — and can be helpful in diagnosing disk problems. + +``` +$ sudo ioping /dev/sda1 +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=1 time=960.2 us (warmup) +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=2 time=841.5 us +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=3 time=831.0 us +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=4 time=1.17 ms +^C +--- /dev/sda1 (block device 111.8 GiB) ioping statistics --- +3 requests completed in 2.84 ms, 12 KiB read, 1.05 k iops, 4.12 MiB/s +generated 4 requests in 3.37 s, 16 KiB, 1 iops, 4.75 KiB/s +min/avg/max/mdev = 831.0 us / 947.9 us / 1.17 ms / 158.0 us +``` + +### atop + +The **atop** command, like **top** provides a lot of information on system performance, including some stats on disk activity. + +``` +ATOP - butterfly 2018/12/26 17:24:19 37d3h13m------ 10ed +PRC | sys 0.03s | user 0.01s | #proc 179 | #zombie 0 | #exit 6 | +CPU | sys 1% | user 0% | irq 0% | idle 199% | wait 0% | +cpu | sys 1% | user 0% | irq 0% | idle 99% | cpu000 w 0% | +CPL | avg1 0.00 | avg5 0.00 | avg15 0.00 | csw 677 | intr 470 | +MEM | tot 5.8G | free 223.4M | cache 4.6G | buff 253.2M | slab 394.4M | +SWP | tot 2.0G | free 2.0G | | vmcom 1.9G | vmlim 4.9G | +DSK | sda | busy 0% | read 0 | write 7 | avio 1.14 ms | +NET | transport | tcpi 4 | tcpo stall 8 | udpi 1 | udpo 0swout 2255 | +NET | network | ipi 10 | ipo 7 | ipfrw 0 | deliv 60.67 ms | +NET | enp0s25 0% | pcki 10 | pcko 8 | si 1 Kbps | so 3 Kbp0.73 ms | + + PID SYSCPU USRCPU VGROW RGROW ST EXC THR S CPUNR CPU CMD 1/1673e4 | + 3357 0.01s 0.00s 672K 824K -- - 1 R 0 0% atop + 3359 0.01s 0.00s 0K 0K NE 0 0 E - 0% + 3361 0.00s 0.01s 0K 0K NE 0 0 E - 0% + 3363 0.01s 0.00s 0K 0K NE 0 0 E - 0% +31357 0.00s 0.00s 0K 0K -- - 1 S 1 0% bash + 3364 0.00s 0.00s 8032K 756K N- - 1 S 1 0% sleep + 2931 0.00s 0.00s 0K 0K -- - 1 I 1 0% kworker/u8:2-e + 3356 0.00s 0.00s 0K 0K -E 0 0 E - 0% + 3360 0.00s 0.00s 0K 0K NE 0 0 E - 0% + 3362 0.00s 0.00s 0K 0K NE 0 0 E - 0% +``` + +If you want to look at _just_ the disk stats, you can easily manage that with a command like this: + +``` +$ atop | grep DSK +$ atop | grep DSK +DSK | sda | busy 0% | read 122901 | write 3318e3 | avio 0.67 ms | +DSK | sdb | busy 0% | read 1168 | write 103 | avio 0.73 ms | +DSK | sda | busy 2% | read 0 | write 92 | avio 2.39 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.47 ms | +DSK | sda | busy 2% | read 0 | write 99 | avio 2.26 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms | +DSK | sda | busy 2% | read 0 | write 92 | avio 2.43 ms | +^C +``` + +### Being in the know with disk I/O + +Linux provides enough commands to give you good insights into how hard your disks are working and help you focus on potential problems or slowdowns. Hopefully, one of these commands will tell you just what you need to know when it's time to question disk performance. Occasional use of these commands will help ensure that especially busy or slow disks will be obvious when you need to check them. + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-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://www.networkworld.com/article/3291616/linux/examining-linux-system-performance-with-dstat.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From dbaee7265e609d10b381670ea2c78846f274940e Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 3 Jan 2019 09:11:14 +0800 Subject: [PATCH 0420/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Disp?= =?UTF-8?q?lay=20Thumbnail=20Images=20In=20Terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To Display Thumbnail Images In Terminal.md | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..2756747334 --- /dev/null +++ b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md @@ -0,0 +1,186 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 02afe4e8fa4b8c437745ecf7cf52419bf05e652c Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 3 Jan 2019 09:14:29 +0800 Subject: [PATCH 0421/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Using=20Yarn=20?= =?UTF-8?q?on=20Ubuntu=20and=20Other=20Linux=20Distributions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...on Ubuntu and Other Linux Distributions.md | 265 ++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..71555454f5 --- /dev/null +++ b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,265 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Yarn on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/install-yarn-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Using Yarn on Ubuntu and Other Linux Distributions +====== + +**This quick tutorial shows you the official way of installing Yarn package manager on Ubuntu and Debian Linux. You’ll also learn some basic Yarn commands and the steps to remove Yarn completely.** + +[Yarn][1] is an open source JavaScript package manager developed by Facebook. It is an alternative or should I say improvement to the popular npm package manager. [Facebook developers’ team][2] created Yarn to overcome the shortcomings of [npm][3]. Facebook claims that Yarn is faster, reliable and more secure than npm. + +Like npm, Yarn provides you a way to automate the process of installing, updating, configuring, and removing packages retrieved from a global registry. + +The advantage of Yarn is that it is faster as it caches every package it downloads so it doesn’t need to download it again. It also parallelizes operations to maximize resource utilization. Yarn also uses [checksums to verify the integrity][4] of every installed package before its code is executed. Yarn also guarantees that an install that worked on one system will work exactly the same way on any other system. + +If you are [using nodejs on Ubuntu][5], probably you already have npm installed on your system. In that case, you can use npm to install Yarn globally in the following manner: + +``` +sudo npm install yarn -g +``` + +However, I would recommend using the official way to install Yarn on Ubuntu/Debian. + +### Installing Yarn on Ubuntu and Debian [The Official Way] + +![Yarn JS][6] + +The instructions mentioned here should be applicable to all versions of Ubuntu such as Ubuntu 18.04, 16.04 etc. The same set of instructions are also valid for Debian and other Debian based distributions. + +Since the tutorial uses Curl to add the GPG key of Yarn project, it would be a good idea to verify whether you have Curl installed already or not. + +``` +sudo apt install curl +``` + +The above command will install Curl if it wasn’t installed already. Now that you have curl, you can use it to add the GPG key of Yarn project in the following fashion: + +``` +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +``` + +After that, add the repository to your sources list so that you can easily upgrade the Yarn package in future with the rest of the system updates: + +``` +sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list' +``` + +You are set to go now. [Update Ubuntu][7] or Debian system to refresh the list of available packages and then install yarn: + +``` +sudo apt update +sudo apt install yarn +``` + +This will install Yarn along with nodejs. Once the process completes, verify that Yarn has been installed successfully. You can do that by checking the Yarn version. + +``` +yarn --version +``` + +For me, it showed an output like this: + +``` +yarn --version +1.12.3 +``` + +This means that I have Yarn version 1.12.3 installed on my system. + +### Using Yarn + +I presume that you have some basic understandings of JavaScript programming and how dependencies work. I am not going to go in details here. I’ll show you some of the basic Yarn commands that will help you getting started with it. + +#### Creating a new project with Yarn + +Like npm, Yarn also works with a package.json file. This is where you add your dependencies. All the packages of the dependencies are cached in the node_modules directory in the root directory of your project. + +In the root directory of your project, run the following command to generate a fresh package.json file: + +It will ask you a number of questions. You can skip the questions r go with the defaults by pressing enter. + +``` +yarn init +yarn init v1.12.3 +question name (test_yarn): test_yarn_proect +question version (1.0.0): 0.1 +question description: Test Yarn +question entry point (index.js): +question repository url: +question author: abhishek +question license (MIT): +question private: +success Saved package.json +Done in 82.42s. +``` + +With this, you get a package.json file of this sort: + +``` +{ + "name": "test_yarn_proect", + "version": "0.1", + "description": "Test Yarn", + "main": "index.js", + "author": "abhishek", + "license": "MIT" +} +``` + +Now that you have the package.json, you can either manually edit it to add or remove package dependencies or use Yarn commands (preferred). + +#### Adding dependencies with Yarn + +You can add a dependency on a certain package in the following fashion: + +``` +yarn add +``` + +For example, if you want to use [Lodash][8] in your project, you can add it using Yarn like this: + +``` +yarn add lodash +yarn add v1.12.3 +info No lockfile found. +[1/4] Resolving packages… +[2/4] Fetching packages… +[3/4] Linking dependencies… +[4/4] Building fresh packages… +success Saved lockfile. +success Saved 1 new dependency. +info Direct dependencies +└─ [email protected] +info All dependencies +└─ [email protected] +Done in 2.67s. +``` + +And you can see that this dependency has been added automatically in the package.json file: + +``` +{ + "name": "test_yarn_proect", + "version": "0.1", + "description": "Test Yarn", + "main": "index.js", + "author": "abhishek", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.11" + } +} +``` + +By default, Yarn will add the latest version of a package in the dependency. If you want to use a specific version, you may specify it while adding. + +As always, you can also update the package.json file manually. + +#### Upgrading dependencies with Yarn + +You can upgrade a particular dependency to its latest version with the following command: + +``` +yarn upgrade +``` + +It will see if the package in question has a newer version and will update it accordingly. + +You can also change the version of an already added dependency in the following manner: + +You can also upgrade all the dependencies of your project to their latest version with one single command: + +``` +yarn upgrade +``` + +It will check the versions of all the dependencies and will update them if there are any newer versions. + +#### Removing dependencies with Yarn + +You can remove a package from the dependencies of your project in this way: + +``` +yarn remove +``` + +#### Install all project dependencies + +If you made any changes to the project.json file, you should run either + +``` +yarn +``` + +or + +``` +yarn install +``` + +to install all the dependencies at once. + +### How to remove Yarn from Ubuntu or Debian + +I’ll complete this tutorial by mentioning the steps to remove Yarn from your system if you used the above steps to install it. If you ever realized that you don’t need Yarn anymore, you will be able to remove it. + +Use the following command to remove Yarn and its dependencies. + +``` +sudo apt purge yarn +``` + +You should also remove the Yarn repository from the repository list: + +``` +sudo rm /etc/apt/sources.list.d/yarn.list +``` + +The optional next step is to remove the GPG key you had added to the trusted keys. But for that, you need to know the key. You can get that using the apt-key command: + +Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging + +Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging yarn@dan.cx sub rsa4096 2016-10-05 [E] sub rsa4096 2019-01-02 [S] [expires: 2020-02-02] + +The key here is the last 8 characters of the GPG key’s fingerprint in the line starting with pub. + +So, in my case, the key is 86E50310 and I’ll remove it using this command: + +``` +sudo apt-key del 86E50310 +``` + +You’ll see an OK in the output and the GPG key of Yarn package will be removed from the list of GPG keys your system trusts. + +I hope this tutorial helped you to install Yarn on Ubuntu, Debian, Linux Mint, elementary OS etc. I provided some basic Yarn commands to get you started along with complete steps to remove Yarn from your system. + +I hope you liked this tutorial and if you have any questions or suggestions, please feel free to leave a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-yarn-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://yarnpkg.com/lang/en/ +[2]: https://code.fb.com/ +[3]: https://www.npmjs.com/ +[4]: https://itsfoss.com/checksum-tools-guide-linux/ +[5]: https://itsfoss.com/install-nodejs-ubuntu/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/yarn-js-ubuntu-debian.jpeg?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/update-ubuntu/ +[8]: https://lodash.com/ From 6534f92dbed110088b2f5ab2f706fb5abec098ef Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 3 Jan 2019 10:43:46 +0800 Subject: [PATCH 0422/4278] Translating Translating: Let your Linux terminal speak its mind --- sources/tech/20181220 Let your Linux terminal speak its mind.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181220 Let your Linux terminal speak its mind.md b/sources/tech/20181220 Let your Linux terminal speak its mind.md index 7f237c0962..8934bc60d6 100644 --- a/sources/tech/20181220 Let your Linux terminal speak its mind.md +++ b/sources/tech/20181220 Let your Linux terminal speak its mind.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7a7cef837f75a92335f66f6d4db28a8b2b1ba640 Mon Sep 17 00:00:00 2001 From: leon-shi <45240011+1eon-shi@users.noreply.github.com> Date: Thu, 3 Jan 2019 05:14:45 +0000 Subject: [PATCH 0423/4278] Update 20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md --- ... 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md | 1 + 1 file changed, 1 insertion(+) 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..4335a7a98d 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,6 +1,7 @@ 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. From ec088c2d9077785d5dc9c8d5230cc01aea920a24 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 3 Jan 2019 13:21:47 +0800 Subject: [PATCH 0424/4278] Translated Translated: Let your Linux terminal speak its mind --- ... Let your Linux terminal speak its mind.md | 62 ------------------- ... Let your Linux terminal speak its mind.md | 62 +++++++++++++++++++ 2 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 sources/tech/20181220 Let your Linux terminal speak its mind.md create mode 100644 translated/tech/20181220 Let your Linux terminal speak its mind.md diff --git a/sources/tech/20181220 Let your Linux terminal speak its mind.md b/sources/tech/20181220 Let your Linux terminal speak its mind.md deleted file mode 100644 index 8934bc60d6..0000000000 --- a/sources/tech/20181220 Let your Linux terminal speak its mind.md +++ /dev/null @@ -1,62 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zhs852) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Let your Linux terminal speak its mind) -[#]: via: (https://opensource.com/article/18/12/linux-toy-espeak) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Let your Linux terminal speak its mind -====== -eSpeak is an open source text-to-speech synthesizer that can be invoked from the Linux command line. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) - -Greetings from another day in our 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. - -We hope that even if you've seen some of these before, there will be something new for everybody in our series. - -Some of you may be too young to remember, but before there was Alexa, Siri, or the Google Assistant, computers still had voices. - -Many of us will never forget HAL 9000 from [2001: A Space Odessey][1] helpfully conversing with the crew (sorry, Dave). But between 1960s science fiction and today, there was a whole generation of speaking computers. Some of them great, most of them, not so great. - -One of my favorites is the open source project [eSpeak][2]. It's available in many forms, including a library version you can use to include speech technology in your own project, but it also coms as a command-line program that you can install and use easily. In my distribution, this was as simple as: - -``` -$ sudo dnf install espeak -``` - -Invoking eSpeak then can be invoked either interactively, or by piping text to it using the output of another program or a simple echo command. There are a number of [voice files][3] available for eSpeak, and if you're especially bored over the holidays, you could even create your own. - -A fork of eSpeak called eSpeak NG ("Next Generation") was created in 2015 from some developers who wanted to continue development of the otherwise lightly-updated eSpeak. eSpeak is made available as open source under a GPL version 3 license, and you can find out more about the project and download the source code [on SourceForge][2]. - -I'll also throw in a bonus toy today, [cava][4]. Because I've been eager to give each of these articles a unique screenshot as the lead image, and today's toy outputs sound rather than something visual, I needed to find something to fill the space. Short for "console-based audio visualizer for ALSA" (although it supports more than just ALSA now), cava is a nice MIT-licensed terminal audio visualization tool that's fun to watch. Below, is a visualization of eSpeak's output of the following: - -``` -$ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak -``` - -![](https://opensource.com/sites/default/files/uploads/linux-toy-cava.gif) - -Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, 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, [Solve a puzzle at the Linux command line with nudoku][5], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-espeak - -作者:[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://en.wikipedia.org/wiki/2001:_A_Space_Odyssey_(film) -[2]: http://espeak.sourceforge.net/ -[3]: http://espeak.sourceforge.net/voices.html -[4]: https://github.com/karlstav/cava -[5]: https://opensource.com/article/18/12/linux-toy-nudoku diff --git a/translated/tech/20181220 Let your Linux terminal speak its mind.md b/translated/tech/20181220 Let your Linux terminal speak its mind.md new file mode 100644 index 0000000000..f61b258c31 --- /dev/null +++ b/translated/tech/20181220 Let your Linux terminal speak its mind.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (zhs852) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Let your Linux terminal speak its mind) +[#]: via: (https://opensource.com/article/18/12/linux-toy-espeak) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +让 Linux 终端说出它的想法 +====== +> eSpeak 是一个可在 Linux 命令行中使用的开源的 TTS 合成器。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) + +欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你大概连什么是 Linux 命令行小玩具都不知道。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。 + +或许你已经对一些玩具有了解了,不过我们相信,在本系列文章中总有那么几个你没见过的玩意。 + +年轻读者可能不知道,在 Alexa、Siri 或 Google Assistant 问世之前,计算机就能说话了。 + +我们也许永远不会忘记来自 [2001 太空漫游][1] 中与机组人员交流的 HAL 9000。但是在 1960 年代到今天的时间里,是存在着许多能说话的计算机的。它们有些很出色,也有些不那么出色。 + +其中一个我最爱的是一个叫做 [eSpeak][2] 的开源项目。它以多种形式被发布,比如可以嵌入你自己项目中的库。与此同时,它也提供了可供你安装的命令行版本。在我所用的发行版中,安装十分简单,只需使用: + +``` +$ sudo dnf install espeak +``` + +你既可以与 eSpeak 交互,也可以用它来输出其它程序的信息,甚至通过简单的 echo 命令来使用它。[这里][3] 有一些可供 eSpeak 使用的声音文件,你可以在无聊时切换他们。甚者你可以制作一个属于你自己的声音。 + +在 2015 年,一些希望继续 eSpeak 开发的开发者创建了一个名为 eSpeak NG (即 "Next Generation",“下一代”的意思)的项目。eSpeak 目前在 GPL v3 许可证下开源,你可以在 [SourceForge][2] 上详细了解这个项目或下载源代码。 + +别急,我今天还会介绍一个额外的小程序,它叫 [cava][4]。我经常希望用一张独一无二的截图作为我文章的头图,更何况今天的玩具主要是关于声音的,导致图片更少了。因此,我需要一些东西来填补这些空白。Cava 是 "console-based audio visualizer for ALSA" (译注:基于 ALSA 的命令行音频可视化工具)(尽管它现在支持的比 ALSA 更多)的简写,它是一个优秀的命令行音频可视化工具,并且它正以 MIT 许可证开源。下面是一个将 eSpeak 输出可视化的命令: + +``` +$ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-cava.gif) + +你想让作者介绍你喜欢的命令行玩具吗?请前往原文下留言,作者可能会考虑介绍的。同时,你也可以去原文下评论你对文章的看法。 + +欢迎去看看我们昨天介绍的玩具,[在 Linux 命令行中使用 nudoku 解决谜题][5]。敬请期待我们明天的文章吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-espeak + +作者:[Jason Baker][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://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/2001:_A_Space_Odyssey_(film) +[2]: http://espeak.sourceforge.net/ +[3]: http://espeak.sourceforge.net/voices.html +[4]: https://github.com/karlstav/cava +[5]: https://opensource.com/article/18/12/linux-toy-nudoku From d609a764b0002d3d3077e316336227799f36bc88 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 3 Jan 2019 13:22:32 +0800 Subject: [PATCH 0425/4278] Translated --- .../tech/20181220 Let your Linux terminal speak its mind.md | 1 + 1 file changed, 1 insertion(+) diff --git a/translated/tech/20181220 Let your Linux terminal speak its mind.md b/translated/tech/20181220 Let your Linux terminal speak its mind.md index f61b258c31..cbf61034a6 100644 --- a/translated/tech/20181220 Let your Linux terminal speak its mind.md +++ b/translated/tech/20181220 Let your Linux terminal speak its mind.md @@ -10,6 +10,7 @@ 让 Linux 终端说出它的想法 ====== > eSpeak 是一个可在 Linux 命令行中使用的开源的 TTS 合成器。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) 欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你大概连什么是 Linux 命令行小玩具都不知道。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。 From a34e5926ed14cd28502c5afeb6ba4a92294b359b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 3 Jan 2019 13:24:09 +0800 Subject: [PATCH 0426/4278] Update and rename sources/tech/20170523 Best Websites to Download Linux Games.md to translated/tech/20170523 Best Websites to Download Linux Games.md --- ...3 Best Websites to Download Linux Games.md | 140 ------------------ ...3 Best Websites to Download Linux Games.md | 140 ++++++++++++++++++ 2 files changed, 140 insertions(+), 140 deletions(-) delete mode 100644 sources/tech/20170523 Best Websites to Download Linux Games.md create mode 100644 translated/tech/20170523 Best Websites to Download Linux Games.md diff --git a/sources/tech/20170523 Best Websites to Download Linux Games.md b/sources/tech/20170523 Best Websites to Download Linux Games.md deleted file mode 100644 index b29afc1dfb..0000000000 --- a/sources/tech/20170523 Best Websites to Download Linux Games.md +++ /dev/null @@ -1,140 +0,0 @@ -Translating by robsean -Best Websites to Download Linux Games -====== -Brief: New to Linux gaming and wondering where to **download Linux games** from? We list the best resources from where you can **download free Linux games** as well as buy premium Linux games. - -Linux and Games? Once upon a time, it was hard to imagine these two going together. Then time passed and a lot of things happened. Fast-forward to the present, there are thousands and thousands of games available for Linux and more are being developed by both big game companies and independent developers. - -[Gaming on Linux][1] is real now and today we are going to see where you can find games for Linux platform and hunt down the games that you like. - -### Where to download Linux games? - -![Websites to download Linux games][2] - -First and foremost, look into your Linux distribution's software center (if it has one). You should find plenty of games there already. - -But that doesn't mean you should restrict yourself to the software center. Let me list you some websites to download Linux games. - -#### 1. Steam - -If you are a seasoned gamer, you have heard about Steam. Yes, if you don't know it already, Steam is available for Linux. Steam recommends Ubuntu but it should run on other major distributions too. And if you are really psyched up about Steam, there is even a dedicated operating system for playing Steam games - [SteamOS][3]. We covered it last year in the [Best Linux Gaming Distribution][4] article. - -![Steam Store][5] - -Steam has the largest games store for Linux. While writing this article, it has exactly 3487 games on Linux platform and that's really huge. You can find games from wide range of genre. As for [Digital Rights Management][6], most of the Steam games have some kind of DRM. - -For using Steam either you will have to install the [Steam client][7] on your Linux distribution or use SteamOS. One of the advantages of Steam is that, after your initial setup, for most of the games you wouldn't need to worry about dependencies and complex installation process. Steam client will do the heavy tasks for you. - -[Steam Store][8] - -#### 2. GOG - -If you are solely interested in DRM-free games, GOG has a pretty large collection of it. At this moment, GOG has 1978 DRM-free games in their library. GOG is kind of famous for its vast collection of DRM-free games. - -![GOG Store][9] - -Officially, GOG games support Ubuntu LTS versions and Linux Mint. So, Ubuntu and its derivatives will have no problem installing them. Installing them on other distributions might need some extra works, such as - installing correct dependencies. - -You will not need any extra clients for downloading games from GOG. All the purchased games will be available in your accounts section. You can download them directly with your favorite download manager. - -[GOG Store][10] - -#### 3. Humble Store - -The Humble Store is another place where you can find various games for Linux. There are both DRM-free and non-DRM-free games available on Humble Store. The non-DRM-free games are generally from the Steam. Currently there are about 1826 games for Linux in the Humble Store. - -![The Humble Store][11] - -Humble Store is famous for another reason though. They have a program called [**Humble Indie Bundle**][12] where they offer a bunch of games together with a compelling discount for a limited time period. Another thing about Humble is that when you make a purchase, 10% of the revenue from your purchase goes to charities. - -Humble doesn't have any extra clients for downloading their games. - -[The Humble Store][13] - -#### 4. itch.io - -itch.io is an open marketplace for independent digital creators with a focus on independent video games. itch.io has some of the most interesting and unique games that you can find. Most games available on itch.io are DRM-free. - -![itch.io Store][14] - -Right now, itch.io has 9514 games available in their store for Linux platform. - -itch.io has their own [client][15] for effortlessly downloading, installing, updating and playing their games. - -[itch.io Store][16] - -#### 5. LGDB - -LGDB is an abbreviation for Linux Game Database. Though technically not a game store, it has a large collection of games for Linux along with various information about them. Every game is documented with links of where you can find them. - -![Linux Game Database][17] - -As of now, there are 2046 games entries in the database. They also have very long lists for [Emulators][18], [Tools][19] and [Game Engines][20]. - -[LGDB][21] - -[Annoying Experiences Every Linux Gamer Never Wanted!][27] - -#### 6. Game Jolt - -Game Jolt has a very impressive collection with about 5000 indie games for Linux under their belt. - -![GameJolt Store][22] - -Game Jolt has an (pre-release) [client][23] for downloading, installing, updating and playing games with ease. - -[Game Jolt Store][24] - -### Others - -There are many other stores that sells Linux Games. Also there are many places you can find free games too. Here are a couple of them: - - * [**Bundle Stars**][25]: Bundle Stars currently has 814 Linux games and 31 games bundles. - * [**GamersGate**][26]: GamersGate has 595 Linux games as for now. There are both DRM-free and non-DRM-free games. - - - -#### App Stores, Software Center & Repositories - -Linux distribution has their own application stores or repositories. Though not many, but there you can find various games too. - -That's all for today. Did you know there are this many games available for Linux? How do you feel about this? Do you use some other websites to download Linux games? Do share your favorites with us. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/download-linux-games/ - -作者:[Munif Tanjim][a] -译者:[译者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/munif/ -[1]:https://itsfoss.com/linux-gaming-guide/ -[2]:https://itsfoss.com/wp-content/uploads/2017/05/download-linux-games-800x450.jpg -[3]:http://store.steampowered.com/steamos/ -[4]:https://itsfoss.com/linux-gaming-distributions/ -[5]:https://itsfoss.com/wp-content/uploads/2017/05/Steam-Store-800x382.jpg -[6]:https://www.wikiwand.com/en/Digital_rights_management -[7]:http://store.steampowered.com/about/ -[8]:http://store.steampowered.com/linux -[9]:https://itsfoss.com/wp-content/uploads/2017/05/GOG-Store-800x366.jpg -[10]:https://www.gog.com/games?system=lin_mint,lin_ubuntu -[11]:https://itsfoss.com/wp-content/uploads/2017/05/The-Humble-Store-800x393.jpg -[12]:https://www.humblebundle.com/?partner=itsfoss -[13]:https://www.humblebundle.com/store?partner=itsfoss -[14]:https://itsfoss.com/wp-content/uploads/2017/05/itch.io-Store-800x485.jpg -[15]:https://itch.io/app -[16]:https://itch.io/games/platform-linux -[17]:https://itsfoss.com/wp-content/uploads/2017/05/LGDB-800x304.jpg -[18]:https://lgdb.org/emulators -[19]:https://lgdb.org/tools -[20]:https://lgdb.org/engines -[21]:https://lgdb.org/games -[22]:https://itsfoss.com/wp-content/uploads/2017/05/GameJolt-Store-800x357.jpg -[23]:http://gamejolt.com/client -[24]:http://gamejolt.com/games/best?os=linux -[25]:https://www.bundlestars.com/en/games?page=1&platforms=Linux -[26]:https://www.gamersgate.com/games?state=available -[27]:https://itsfoss.com/linux-gaming-problems/ diff --git a/translated/tech/20170523 Best Websites to Download Linux Games.md b/translated/tech/20170523 Best Websites to Download Linux Games.md new file mode 100644 index 0000000000..8fc5610b7c --- /dev/null +++ b/translated/tech/20170523 Best Websites to Download Linux Games.md @@ -0,0 +1,140 @@ +最好的下载 Linux 游戏的网站 +====== +简述:新接触 Linux 游戏并想知道从哪里来 **下载 Linux 游戏** ?我们列出最好的资源,你既能 **下载免费的 Linux 游戏** ,也能购买优质的 Linux 游戏。 + +Linux 和游戏?从前,很难想象这两者走到一起。然而时间流逝,很多事情发生。快进到现在,有成千上万对 Linux 可用的游戏,更多的游戏正在被大公司和独立开发者开发。 + +[在 Linux 上的游戏][1] 现在是真是,今天我们将去看看,你在哪里可以找到 Linux 平台游戏,和搜索到你喜欢的游戏。 + +### 在哪里来下载 Linux 游戏? + +![下载 Linux 游戏的网站][2] + +首先,看看你的 Linux 发行版的软件中心(如果它有)。在这里你也能找到大量的游戏。 + +但是,这不意味着你应该限制你自己到软件中心。让我们列出为你列出网站来下载 Linux 游戏。 + +#### 1. Steam + +如果你是老练的游戏者,你应该听过 Steam 。是的,如果你还不知道它,Steam 对 Linux 是可用的。Steam 推荐 Ubuntu ,但是它也能运行在其它主要的发行版上。如果你真的对 Steam 兴奋起来,这里甚至有一个玩 Steam 游戏的专用操作系统 - [SteamOS][3]。我们在上一年 [最佳的 Linux 游戏发行版][4] 文章中国包括它。 + +![Steam 商店][5] + +Steam 有最大的 Linux 游戏商店。当写这篇文章的时候,在 Linux 平台上,确切地有 3487 款游戏,这真的是庞大的。你可以从宽广的类型范围中查找游戏。。说起 [数字版权管理][6],大多数的 Steam 游戏有各种 DRM 。 + +对于使用 Steam ,要么你将不得不在你的 Linux 系统上安装 [Steam 客户端][7],要么使用 SteamOS。Steam 的一个优势是,在初始化安装后,对于大多数的游戏,你不需要担心依赖关系和复杂的安装过程。 Steam 客户端将为你做重要的任务。 + +[Steam 商店][8] + +#### 2. GOG + +如果你完全对 自由-DRM 游戏感兴趣,GOG 有它的相当多的收集。在这一时刻,GOG 在它们的库中有1978中 自由-DRM 游戏。 GOG 因它的 自由-DRM 游戏的大量的收集而著名。 + +![GOG 商店][9] + +官方的,GOG 游戏支持 Ubuntu LTS 版本和 Linux Mint。所以,Ubuntu 和它的衍生物在安装它们时将没有问题。在其他发行版上安装它们可能需要一些额外的工作,例如 - 安装正确的依赖关系。 + +从 GOG 中下载游戏,你将不需要一些额外的客户端。所有购买的游戏将在你的账户部分可用。你可以使用你最爱的下载管理器直接下载它们。 + +[GOG 商店][10] + +#### 3. Humble 商店 + +Humble +商店是另一个你可以查找 Linux 的各种各样游戏的地方。在 Humble 商店中有 自由-DRM 和 非-自由-DRM 的可用的游戏。非-自由-DRM 游戏通常来自 Steam。在 Humble 商店中,当前有超过1826款 Linux 游戏。 + +![Humble 商店][11] + +Humble 商店因另一个原因而著名。它们有一个被称为 [**Humble 内部包**][12]的程序,在程序它们提供游戏的一个包,在限定时间中带有令人不可抗拒的优惠。 Another thing about关于 Humble 的另一件事是,当你制作一个优惠时,,你的优惠的10%的税收将去慈善机构。 + +Humble 没有一些额外的客户端来下载它们的游戏, + +[Humble 商店][13] + +#### 4. itch.io + +itch.io 对于致力于独立视频游戏的独立数字创造者是一个开放市场。itch.io 有一些你能找到的最感兴趣的和独特的游戏。在 itch.io 的大多数游戏是 自由-DRM 。 + +![itch.io 商店][14] + +现在,itch.io 在它们的商店中有9514款 Linux 平台可用游戏。 + +itch.io 有它们自己的 [客户端][15] 来不费力地下载,安装,更新和玩它们的游戏。 + +[itch.io 商店][16] + +#### 5. LGDB + +LGDB 是 Linux 游戏数据库的缩写。虽然技术上不是一个游戏商店,它有x大量的 Linux 游戏收藏,以及关于它们的各种各样的信息。每一款游戏被用你可以找到它们的链接记录。 + +![Linux 游戏数据库][17] + +从现在起,在数据库中有2046款游戏入口。[Emulators][18],[Tools][19] 和 [Game Engines][20]也有很长的列表 + +[LGDB][21] + +[令人讨厌的体验,每一个 Linux 游戏者从不想要!][27] + +#### 6. Game Jolt + +Game Jolt 有一个非常可观的收集,在 belt 的区域下大约有5000个 Linux 游戏。 + +![GameJolt Store][22] + +Game Jolt 有一个(预览版) [client][23] 用于轻松地下载,安装,更新和玩游戏。 + +[Game Jolt Store][24] + +### 其他 + +这里有很多其他的卖 Linux 游戏的商店。这里也有很多你能找到免费游戏的地方。这是它们中的两个: + + * [**Bundle Stars**][25]: Bundle Stars 当前有814个 Linux 游戏和31个游戏包。 + * [**GamersGate**][26]: GamersGate 现在有595个 Linux 游戏。它们都是 DRM-free and non-DRM-free games. + + + +#### 应用商店,软件中心 & 存储库 + +Linux 发行版有它们自己的应用程序商店或存储库。尽管不是很多,但是在这里你也能找到各种各样的游戏。 + +今天到此为止。你知道这里有这么多 Linux 可用的游戏吗?你使用一些其他的网站来下载 Linux 游戏?与我们分享你的收藏。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/download-linux-games/ + +作者:[Munif Tanjim][a] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/munif/ +[1]:https://itsfoss.com/linux-gaming-guide/ +[2]:https://itsfoss.com/wp-content/uploads/2017/05/download-linux-games-800x450.jpg +[3]:http://store.steampowered.com/steamos/ +[4]:https://itsfoss.com/linux-gaming-distributions/ +[5]:https://itsfoss.com/wp-content/uploads/2017/05/Steam-Store-800x382.jpg +[6]:https://www.wikiwand.com/en/Digital_rights_management +[7]:http://store.steampowered.com/about/ +[8]:http://store.steampowered.com/linux +[9]:https://itsfoss.com/wp-content/uploads/2017/05/GOG-Store-800x366.jpg +[10]:https://www.gog.com/games?system=lin_mint,lin_ubuntu +[11]:https://itsfoss.com/wp-content/uploads/2017/05/The-Humble-Store-800x393.jpg +[12]:https://www.humblebundle.com/?partner=itsfoss +[13]:https://www.humblebundle.com/store?partner=itsfoss +[14]:https://itsfoss.com/wp-content/uploads/2017/05/itch.io-Store-800x485.jpg +[15]:https://itch.io/app +[16]:https://itch.io/games/platform-linux +[17]:https://itsfoss.com/wp-content/uploads/2017/05/LGDB-800x304.jpg +[18]:https://lgdb.org/emulators +[19]:https://lgdb.org/tools +[20]:https://lgdb.org/engines +[21]:https://lgdb.org/games +[22]:https://itsfoss.com/wp-content/uploads/2017/05/GameJolt-Store-800x357.jpg +[23]:http://gamejolt.com/client +[24]:http://gamejolt.com/games/best?os=linux +[25]:https://www.bundlestars.com/en/games?page=1&platforms=Linux +[26]:https://www.gamersgate.com/games?state=available +[27]:https://itsfoss.com/linux-gaming-problems/ From 9cba55350f9c21ad441c3517823b567db07f8dcf Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 3 Jan 2019 13:45:10 +0800 Subject: [PATCH 0427/4278] PRF:20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @geekpi --- ...Locally As Virtual File System In Linux.md | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md index 889fb00ac8..a271bca1ac 100644 --- a/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md +++ b/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @@ -1,15 +1,15 @@ -Dbxfs - 在 Linux 中本地挂载 Dropbox 文件夹作为虚拟文件系统 +dbxfs:在 Linux 中本地挂载 Dropbox 文件夹 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/10/dbxfs-720x340.png) -不久前,我们总结了所有**[在本地挂载 Google Drive][1]**作为虚拟文件系统,并从 Linux 系统访问存储在 Google Drive 中的文件的方法。今天,我们将学习使用 **dbxfs**将 Dropbox 文件夹挂载到本地文件系统中。dbxfs 用于在类 Unix 操作系统中本地挂载 Dropbox 文件夹作为虚拟文件系统。虽然在 Linux 中很容易[**安装 Dropbox 客户端**][2],但这种方法与官方方法略有不同。它是一个命令行 dropbox 客户端,且无需磁盘空间即可访问。dbxfs 是免费、开源的,并且是用 Python 3.5+ 编写的。 +不久前,我们总结了所有 [在本地挂载 Google Drive][1] 作为虚拟文件系统,并从 Linux 系统访问存储在 Google Drive 中的文件的方法。今天,我们将学习使用 `dbxfs` 将 Dropbox 文件夹挂载到本地文件系统中。`dbxfs` 用于在类 Unix 操作系统中本地挂载 Dropbox 文件夹作为虚拟文件系统。虽然在 Linux 中很容易[安装 Dropbox 客户端][2],但这种方法与官方方法略有不同。它是一个命令行 dropbox 客户端,且无需磁盘空间即可访问。`dbxfs` 是自由开源的,并且是用 Python 3.5+ 编写的。 ### 安装 dbxfs -dbxfs 官方支持 Linux 和 Mac OS。但是,它应该适用于任何提供 **FUSE 兼容库**或能够挂载 **SMB** 共享的 POSIX 系统。由于它是用 Python 3.5 编写的,因此可以使用 **pip3** 包管理器进行安装。如果尚未安装 PIP,请参阅以下指南。 +`dbxfs` 官方支持 Linux 和 Mac OS。但是,它应该适用于任何提供 **FUSE 兼容库**或能够挂载 SMB 共享的 POSIX 系统。由于它是用 Python 3.5 编写的,因此可以使用 pip3 包管理器进行安装。如果尚未安装 pip,请参阅以下指南。 -[如何使用 pip 管理 Python 包][13] +- [如何使用 pip 管理 Python 包][13] 并且也要安装 FUSE 库。 @@ -17,21 +17,18 @@ dbxfs 官方支持 Linux 和 Mac OS。但是,它应该适用于任何提供 ** ``` $ sudo apt install libfuse2 - ``` 在 Fedora 上: ``` $ sudo dnf install fuse - ``` -安装完所有必需的依赖项后,运行以下命令以安装 dbxfs: +安装完所有必需的依赖项后,运行以下命令以安装 `dbxfs`: ``` $ pip3 install dbxfs - ``` ### 在本地挂载 Dropbox 文件夹 @@ -40,29 +37,27 @@ $ pip3 install dbxfs ``` $ mkdir ~/mydropbox - ``` -然后,使用 dbxfs 在本地挂载 dropbox 文件夹,如下所示: +然后,使用 `dbxfs` 在本地挂载 dropbox 文件夹,如下所示: ``` $ dbxfs ~/mydropbox - ``` 你将被要求生成一个访问令牌: ![](https://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-1.png) -要生成访问令牌,只需在 Web 浏览器中输入上面输出的 URL,然后单击**允许** 以授权 Dropbox 访问。你需要登录 Dropbox 帐户才能完成授权过程。 +要生成访问令牌,只需在 Web 浏览器中输入上面输出的 URL,然后单击 **允许** 以授权 Dropbox 访问。你需要登录 Dropbox 帐户才能完成授权过程。 下一个页面将生成新的授权码。复制代码并返回终端将其粘贴到 cli-dbxfs 提示符中以完成该过程。 -然后,系统会要求你保存凭据以供将来访问。无论你是要保存还是拒绝,输入 **Y** 或 **N**。然后,你需要为新的访问令牌输入两次密码。 +然后,系统会要求你保存凭据以供将来访问。根据你是要保存还是拒绝,输入 `Y` 或 `N`。然后,你需要为新的访问令牌输入两次密码。 -最后,输入 **Y** 接受 **“/home/username/mydropbox”** 作为默认挂载点。如果你要设置不同的路径,输入 **N** 并输入你选择的位置。 +最后,输入 `Y` 接受 `/home/username/mydropbox` 作为默认挂载点。如果你要设置不同的路径,输入 `N` 并输入你选择的位置。 -[![Generate access token 2][3]][4] +![Generate access token 2][4] 完成了!从现在开始,你可以看到你的 Dropbox 文件夹已挂载到本地文件系统中。 @@ -70,7 +65,7 @@ $ dbxfs ~/mydropbox ### 更改访问令牌存储路径 -默认情况下,dbxfs 会将 Dropbox 访问令牌存储在系统密钥环或加密文件中。但是,你可能希望将其存储在 **gpg** 加密文件或其他地方。如果是这样,请在 [Dropbox 开发者应用控制台][5]上创建个人应用来获取访问令牌。 +默认情况下,`dbxfs` 会将 Dropbox 访问令牌存储在系统密钥环或加密文件中。但是,你可能希望将其存储在 gpg 加密文件或其他地方。如果是这样,请在 [Dropbox 开发者应用控制台][5]上创建个人应用来获取访问令牌。 ![](https://www.ostechnix.com/wp-content/uploads/2018/10/access-token.png) @@ -78,30 +73,27 @@ $ dbxfs ~/mydropbox ![](https://www.ostechnix.com/wp-content/uploads/2018/10/Create-a-new-app.png) -创建访问令牌后,使用任何你选择的加密工具对其进行加密,例如 [**Cryptomater**][6]、[**Cryptkeeper**][7]、[**CryptGo**][8]、[**Cryptr**][9]、[**Tomb**][10]、[**Toplip**][11] 和 [**GnuPG**][12] 等,并在你喜欢的位置保存。 +创建访问令牌后,使用任何你选择的加密工具对其进行加密,例如 [Cryptomater][6]、[Cryptkeeper][7]、[CryptGo][8]、[Cryptr][9]、[Tomb][10]、[Toplip][11] 和 [**GnuPG][12] 等,并在你喜欢的位置保存。 接下来编辑 dbxfs 配置文件并添加以下行: ``` "access_token_command": ["gpg", "--decrypt", "/path/to/access/token/file.gpg"] - ``` 你可以通过运行以下命令找到 dbxfs 配置文件: ``` $ dbxfs --print-default-config-file - ``` 有关更多详细信息,请参阅 dbxfs 帮助: ``` $ dbxfs -h - ``` -如你所见,使用 dbxfs 在你的文件系统中本地挂载 Dropfox 文件夹没什么大不了的。经过测试,dbxfs 如常工作。如果你有兴趣了解它是如何工作的,请尝试一下,并在下面的评论栏告诉我们你的体验。 +如你所见,使用 `dbxfs` 在你的文件系统中本地挂载 Dropfox 文件夹并不复杂。经过测试,`dbxfs` 如常工作。如果你有兴趣了解它是如何工作的,请尝试一下,并在下面的评论栏告诉我们你的体验。 就是这些了。希望这篇文章有用。还有更多好东西。敬请期待! @@ -116,7 +108,7 @@ via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-fil 作者:[SK][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/) 荣誉推出 @@ -133,4 +125,4 @@ via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-fil [10]: https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/ [11]: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ [12]: https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/ -[13]:https://www.ostechnix.com/manage-python-packages-using-pip/ \ No newline at end of file +[13]:https://www.ostechnix.com/manage-python-packages-using-pip/ From 1ff80e44b5dc927fc47520298f8556d84aee3289 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 3 Jan 2019 13:45:30 +0800 Subject: [PATCH 0428/4278] PUB:20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @geekpi https://linux.cn/article-10410-1.html --- ...ount Dropbox Folder Locally As Virtual File System In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md (100%) diff --git a/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/published/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md similarity index 100% rename from translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md rename to published/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md From 8b583b8fb7d99f01fdfeb847d69429b3c62c369b Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 3 Jan 2019 13:51:22 +0800 Subject: [PATCH 0429/4278] Translating An Introduction to Go. --- .../tech/20181224 An Introduction to Go.md | 278 ++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 translated/tech/20181224 An Introduction to Go.md diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md new file mode 100644 index 0000000000..8963e7e016 --- /dev/null +++ b/translated/tech/20181224 An Introduction to Go.md @@ -0,0 +1,278 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: ( ) +[#]: 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 简介 +====== + +(以下内容是我的硕士论文的摘录,几乎整个 2.1 章节,向具有 CS 背景的人快速介绍 Go) + +Go 是一门用于并发编程的命令式编程语言,它主要由创造者 Google 进行开发,最初主要由 Robert Griesemer、Rob Pike 和 Ken Thompson开发。 Design of the language started in 2007, and an initial version was released in 2009; with the first stable version, 1.0 released in 2012 . + +Go has a C-like syntax (without a preprocessor), garbage collection, and, like its predecessors devloped at Bell Labs – Newsqueak (Rob Pike), Alef (Phil Winterbottom), and Inferno (Pike, Ritchie, et al.) – provides built-in support for concurrency using so-called goroutines and channels, a form of co-routines, based on the idea of Hoare’s ‘Communicating Sequential Processes’ . + +Go programs are organised in packages. A package is essentially a directory containing Go files. All files in a package share the same namespace, and there are two visibilities for symbols in a package: Symbols starting with an upper case character are visible to other packages, others are private to the package: + +``` +func PublicFunction() { + fmt.Println("Hello world") +} + +func privateFunction() { + fmt.Println("Hello package") +} +``` + +### 类型 + +Go has a fairly simple type system: There is no subtyping (but there are conversions), no generics, no polymorphic functions, and there are only a few basic categories of types: + + 1. base types: `int`, `int64`, `int8`, `uint`, `float32`, `float64`, etc. + + 2. `struct` + + 3. `interface` \- a set of methods + + 4. `map[K, V]` \- a map from a key type to a value type + + 5. `[number]Type` \- an array of some element type + + 6. `[]Type` \- a slice (pointer to array with length and capability) of some type + + 7. `chan Type` \- a thread-safe queue + + 8. pointer `*T` to some other type + + 9. functions + + 10. named type - aliases for other types that may have associated methods: + +``` +type T struct { foo int } +type T *T +type T OtherNamedType +``` + +Named types are mostly distinct from their underlying types, so you cannot assign them to each other, but some operators like `+` do work on objects of named types with an underlying numerical type (so you could add two `T` in the example above). + + +Maps, slices, and channels are reference-like types - they essentially are structs containing pointers. Other types are passed by value (copied), including arrays (which have a fixed length and are copied). + +#### 类型转换 + +Conversions are the similar to casts in C and other languages. They are written like this: + +``` +TypeName(value) +``` + +#### 常量 + +Go has “untyped” literals and constants. + +``` +1 // untyped integer literal +const foo = 1 // untyped integer constant +const foo int = 1 // int constant +``` + +Untyped values are classified into the following categories: `UntypedBool`, `UntypedInt`, `UntypedRune`, `UntypedFloat`, `UntypedComplex`, `UntypedString`, and `UntypedNil` (Go calls them basic kinds, other basic kinds are available for the concrete types like `uint8`). An untyped value can be assigned to a named type derived from a base type; for example: + +``` +type someType int + +const untyped = 2 // UntypedInt +const bar someType = untyped // OK: untyped can be assigned to someType +const typed int = 2 // int +const bar2 someType = typed // error: int cannot be assigned to someType +``` + +### 接口和对象 + +As mentioned before, interfaces are a set of methods. Go is not an object-oriented language per se, but it has some support for associating methods with named types: When declaring a function, a receiver can be provided - a receiver is an additional function argument that is passed before the function and involved in the function lookup, like this: + +``` +type SomeType struct { ... } + +func (s *SomeType) MyMethod() { +} + +func main() { + var s SomeType + s.MyMethod() +} +``` + +An object implements an interface if it implements all methods; for example, the following interface `MyMethoder` is implemented by `*SomeType` (note the pointer), and values of `*SomeType` can thus be used as values of `MyMethoder`. The most basic interface is `interface{}`, that is an interface with an empty method set - any object satisfies that interface. + +``` +type MyMethoder interface { + MyMethod() +} +``` + +There are some restrictions on valid receiver types; for example, while a named type could be a pointer (for example, `type MyIntPointer *int`), such a type is not a valid receiver type. + +### 控制流 + +Go provides three primary statements for control flow: `if`, `switch`, and `for`. The statements are fairly similar to their equivalent in other C-like languages, with some exceptions: + + * There are no parentheses around conditions, so it is `if a == b {}`, not `if (a == b) {}`. The braces are mandatory. + + * All of them can have initialisers, like this + +`if result, err := someFunction(); err == nil { // use result }` + + * The `switch` statement can use arbitrary expressions in cases + + * The `switch` statement can switch over nothing (equals switching over true) + + * Cases do not fall through by default (no `break` needed), use `fallthrough` at the end of a block to fall through. + + * The `for` loop can loop over ranges: `for key, val := range map { do something }` + + + + +### Goroutines + +The keyword `go` spawns a new goroutine, a concurrently executed function. It can be used with any function call, even a function literal: + +``` +func main() { + ... + go func() { + ... + }() + + go some_function(some_argument) +} +``` + +### Channels + +Goroutines are often combined with channels to provide an extended form of Communicating Sequential Processes . A channel is a concurrent-safe queue, and can be buffered or unbuffered: + +``` +var unbuffered = make(chan int) // sending blocks until value has been read +var buffered = make(chan int, 5) // may have up to 5 unread values queued +``` + +The `<-` operator is used to communicate with a single channel. + +``` +valueReadFromChannel := <- channel +otherChannel <- valueToSend +``` + +The `select` statement allows communication with multiple channels: + +``` +select { + case incoming := <- inboundChannel: + // A new message for me + case outgoingChannel <- outgoing: + // Could send a message, yay! +} +``` + +### `defer` 声明 + +Go provides a `defer` statement that allows a function call to be scheduled for execution when the function exits. It can be used for resource clean-up, for example: + +``` +func myFunc(someFile io.ReadCloser) { + defer someFile.close() + /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var Do stuff with file */ +} +``` + +It is of course possible to use function literals as the function to call, and any variables can be used as usual when writing the call. + +### 错误处理 + +Go does not provide exceptions or structured error handling. Instead, it handles errors by returning them in a second or later return value: + +``` +func Read(p []byte) (n int, err error) + +// Built-in type: +type error interface { + Error() string +} +``` + +Errors have to be checked in the code, or can be assigned to `_`: + +``` +n0, _ := Read(Buffer) // ignore error +n, err := Read(buffer) +if err != nil { + return err +} +``` + +There are two functions to quickly unwind and recover the call stack, though: `panic()` and `recover()`. When `panic()` is called, the call stack is unwound, and any deferred functions are run as usual. When a deferred function invokes `recover()`, the unwinding stops, and the value given to `panic()` is returned. If we are unwinding normally and not due to a panic, `recover()` simply returns `nil`. In the example below, a function is deferred and any `error` value that is given to `panic()` will be recovered and stored in an error return value. Libraries sometimes use that approach to make highly recursive code like parsers more readable, while still maintaining the usual error return value for public functions. + +``` +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) + } + } +} +``` + +### Arrays 和 slices + +As mentioned before, an array is a value type and a slice is a pointer into an array, created either by slicing an existing array or by using `make()` to create a slice, which will create an anonymous array to hold the elements. + +``` +slice1 := make([]int, 2, 5) // 5 elements allocated, 2 initialized to 0 +slice2 := array[:] // sliced entire array +slice3 := array[1:] // slice of array without first element +``` + +There are some more possible combinations for the slicing operator than mentioned above, but this should give a good first impression. + +A slice can be used as a dynamically growing array, using the `append()` function. + +``` +slice = append(slice, value1, value2) +slice = append(slice, arrayOrSlice...) +``` + +Slices are also used internally to represent variable parameters in variable length functions. + +### Maps + +Maps are simple key-value stores and support indexing and assigning. They are not thread-safe. + +``` +someValue := someMap[someKey] +someValue, ok := someMap[someKey] // ok is false if key not in someMap +someMap[someKey] = someValue +``` +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://blog.jak-linux.org/ +[b]: https://github.com/lujun9972 From cc1d90a4435e5870c6d725ec1f74e20fc05657f8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 3 Jan 2019 14:37:11 +0800 Subject: [PATCH 0430/4278] PRF:20170523 Best Websites to Download Linux Games.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @robsean 还应该再认真些,翻译完放一放,然后再去通读会找到一些不通顺的地方。 --- ...3 Best Websites to Download Linux Games.md | 84 +++++++++---------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/translated/tech/20170523 Best Websites to Download Linux Games.md b/translated/tech/20170523 Best Websites to Download Linux Games.md index 8fc5610b7c..dc04b472ab 100644 --- a/translated/tech/20170523 Best Websites to Download Linux Games.md +++ b/translated/tech/20170523 Best Websites to Download Linux Games.md @@ -1,104 +1,100 @@ -最好的下载 Linux 游戏的网站 +下载 Linux 游戏的最佳网站 ====== -简述:新接触 Linux 游戏并想知道从哪里来 **下载 Linux 游戏** ?我们列出最好的资源,你既能 **下载免费的 Linux 游戏** ,也能购买优质的 Linux 游戏。 -Linux 和游戏?从前,很难想象这两者走到一起。然而时间流逝,很多事情发生。快进到现在,有成千上万对 Linux 可用的游戏,更多的游戏正在被大公司和独立开发者开发。 +> 新接触 Linux 游戏并想知道从哪里来 **下载 Linux 游戏**?我们列出了最好的资源,在这里你既能 **下载免费的 Linux 游戏** ,也能购买优质的 Linux 游戏。 -[在 Linux 上的游戏][1] 现在是真是,今天我们将去看看,你在哪里可以找到 Linux 平台游戏,和搜索到你喜欢的游戏。 +Linux 和游戏?从前,很难想象这两者走到一起。然而随着时间流逝,很多事情都在变化。到如今,有成千上万在 Linux 上可以玩的游戏,而大公司和独立开发者们正在开发更多的游戏。 + +[在 Linux 上玩游戏][1] 现在已经是现实。今天我们将去看看,你在哪里可以找到 Linux 平台游戏、搜索到你喜欢的游戏。 ### 在哪里来下载 Linux 游戏? ![下载 Linux 游戏的网站][2] -首先,看看你的 Linux 发行版的软件中心(如果它有)。在这里你也能找到大量的游戏。 +首先,看看你的 Linux 发行版的软件中心(如果有的话)。在这里你也能找到大量的游戏。 -但是,这不意味着你应该限制你自己到软件中心。让我们列出为你列出网站来下载 Linux 游戏。 +但是,这不意味着你应该将自己的视野局限于软件中心上。让我们来为你列出一些可以下载 Linux 游戏网站。 #### 1. Steam -如果你是老练的游戏者,你应该听过 Steam 。是的,如果你还不知道它,Steam 对 Linux 是可用的。Steam 推荐 Ubuntu ,但是它也能运行在其它主要的发行版上。如果你真的对 Steam 兴奋起来,这里甚至有一个玩 Steam 游戏的专用操作系统 - [SteamOS][3]。我们在上一年 [最佳的 Linux 游戏发行版][4] 文章中国包括它。 +如果你是老练的玩家,你应该听过 Steam。如果你还不知道的话,没错,Steam 在 Linux 上也是可用的。Steam 推荐运行在 Ubuntu 上,但是它也能运行在其它主要的发行版上。如果你真的对 Steam 很狂热,这里甚至还有一个玩 Steam 游戏的专用操作系统:[SteamOS][3]。我们在上一年 [最佳的 Linux 游戏发行版][4] 文章中提及了它。 ![Steam 商店][5] -Steam 有最大的 Linux 游戏商店。当写这篇文章的时候,在 Linux 平台上,确切地有 3487 款游戏,这真的是庞大的。你可以从宽广的类型范围中查找游戏。。说起 [数字版权管理][6],大多数的 Steam 游戏有各种 DRM 。 +Steam 有最大的 Linux 游戏商店。当写这篇文章的时候,在 Linux 平台上,确切地说有 3487 款游戏,这真的是很多了。你可以从宽广的类型中寻找游戏。至于 [数字版权管理(DRM)][6],大多数的 Steam 游戏都有某种 DRM 。 -对于使用 Steam ,要么你将不得不在你的 Linux 系统上安装 [Steam 客户端][7],要么使用 SteamOS。Steam 的一个优势是,在初始化安装后,对于大多数的游戏,你不需要担心依赖关系和复杂的安装过程。 Steam 客户端将为你做重要的任务。 +对于使用 Steam ,要么你必须在你的 Linux 系统上安装 [Steam 客户端][7],要么使用 SteamOS。Steam 的一个优势是,在初始化安装后,对于大多数的游戏,你不需要担心依赖关系和复杂的安装过程。 Steam 客户端将为你做这些繁重的任务。 -[Steam 商店][8] +- [Steam 商店][8] #### 2. GOG -如果你完全对 自由-DRM 游戏感兴趣,GOG 有它的相当多的收集。在这一时刻,GOG 在它们的库中有1978中 自由-DRM 游戏。 GOG 因它的 自由-DRM 游戏的大量的收集而著名。 +如果你只对免 DRM 的游戏感兴趣,GOG 收集了相当多的这种游戏。此刻,GOG 在它们的库中有 1978 种免 DRM 游戏。GOG 因它大量收集了免 DRM 游戏而闻名。 ![GOG 商店][9] -官方的,GOG 游戏支持 Ubuntu LTS 版本和 Linux Mint。所以,Ubuntu 和它的衍生物在安装它们时将没有问题。在其他发行版上安装它们可能需要一些额外的工作,例如 - 安装正确的依赖关系。 +GOG 游戏官方支持 Ubuntu LTS 版本和 Linux Mint。所以,Ubuntu 和它的衍生版在安装它们时将没有问题。在其他发行版上安装它们时可能需要一些额外的工作,例如,你需要安装正确的依赖关系。 -从 GOG 中下载游戏,你将不需要一些额外的客户端。所有购买的游戏将在你的账户部分可用。你可以使用你最爱的下载管理器直接下载它们。 +从 GOG 中下载游戏,你不需要额外的客户端。所有购买的游戏都可在你的账户区内找到。你可以使用你最爱的下载管理器直接下载它们。 -[GOG 商店][10] +- [GOG 商店][10] #### 3. Humble 商店 -Humble -商店是另一个你可以查找 Linux 的各种各样游戏的地方。在 Humble 商店中有 自由-DRM 和 非-自由-DRM 的可用的游戏。非-自由-DRM 游戏通常来自 Steam。在 Humble 商店中,当前有超过1826款 Linux 游戏。 +Humble 商店是另一个你可以查找各种各样 Linux 游戏的地方。在 Humble 商店中有免 DRM 和非免 DRM 的游戏。非免 DRM 游戏通常来自 Steam。在 Humble 商店中,当前有超过 1826 款 Linux 游戏。 ![Humble 商店][11] -Humble 商店因另一个原因而著名。它们有一个被称为 [**Humble 内部包**][12]的程序,在程序它们提供游戏的一个包,在限定时间中带有令人不可抗拒的优惠。 Another thing about关于 Humble 的另一件事是,当你制作一个优惠时,,你的优惠的10%的税收将去慈善机构。 +Humble 商店因另一个原因而著名。它们有一个被称为 [Humble 独立包][12]的活动,其中打包提供了一批游戏,带有令人不可抗拒的限时优惠。关于 Humble 的另一件事是,当你购买时,你的购买金额的 10% 将捐给慈善机构。 -Humble 没有一些额外的客户端来下载它们的游戏, +Humble 不需要额外的客户端来下载它们的游戏。 -[Humble 商店][13] +- [Humble 商店][13] -#### 4. itch.io +#### 4. itch.io 商店 -itch.io 对于致力于独立视频游戏的独立数字创造者是一个开放市场。itch.io 有一些你能找到的最感兴趣的和独特的游戏。在 itch.io 的大多数游戏是 自由-DRM 。 +itch.io 是给独立数字创作者的一个开放市场,其致力于独立视频游戏。itch.io 有一些你能找到的最有趣、最独特的游戏。在 itch.io 的大多数游戏是免 DRM 的。 ![itch.io 商店][14] -现在,itch.io 在它们的商店中有9514款 Linux 平台可用游戏。 +现今,itch.io 在它的商店中有 9514 款 Linux 平台的游戏。 -itch.io 有它们自己的 [客户端][15] 来不费力地下载,安装,更新和玩它们的游戏。 +itch.io 有它自己的 [客户端][15],可以轻松地下载、安装、更新和玩它们的游戏。 -[itch.io 商店][16] +- [itch.io 商店][16] #### 5. LGDB -LGDB 是 Linux 游戏数据库的缩写。虽然技术上不是一个游戏商店,它有x大量的 Linux 游戏收藏,以及关于它们的各种各样的信息。每一款游戏被用你可以找到它们的链接记录。 +LGDB 是 Linux 游戏数据库Linux Game DataBase的缩写。虽然从技术上说它不是一个游戏商店,它收集有大量的 Linux 游戏,以及关于它们的各种各样的信息。每一款游戏都有你可以在哪里找到它们的链接。 ![Linux 游戏数据库][17] -从现在起,在数据库中有2046款游戏入口。[Emulators][18],[Tools][19] 和 [Game Engines][20]也有很长的列表 +如今,在该数据库中有 2046 款游戏。它们也有很长的关于 [模拟器][18]、[工具][19] 和 [游戏引擎][20] 的列表。 -[LGDB][21] +- [LGDB][21] -[令人讨厌的体验,每一个 Linux 游戏者从不想要!][27] +#### 6. Game Jolt 商店 -#### 6. Game Jolt +Game Jolt 有一个非常可观的集合,在它的库藏中大约有 5000 个 Linux 独立游戏。 -Game Jolt 有一个非常可观的收集,在 belt 的区域下大约有5000个 Linux 游戏。 +![Game Jolt 商店][22] -![GameJolt Store][22] +Game Jolt 有一个(预览版)[客户端][23],可用于轻松地下载、安装、更新和玩游戏。 -Game Jolt 有一个(预览版) [client][23] 用于轻松地下载,安装,更新和玩游戏。 - -[Game Jolt Store][24] +- [Game Jolt 商店][24] ### 其他 -这里有很多其他的卖 Linux 游戏的商店。这里也有很多你能找到免费游戏的地方。这是它们中的两个: +有很多其他的销售 Linux 游戏的商店。也有很多你能找到免费游戏的地方。这是它们中的两个: - * [**Bundle Stars**][25]: Bundle Stars 当前有814个 Linux 游戏和31个游戏包。 - * [**GamersGate**][26]: GamersGate 现在有595个 Linux 游戏。它们都是 DRM-free and non-DRM-free games. + * [Bundle Stars][25]:当前有 814 个 Linux 游戏和 31 个游戏包。 + * [GamersGate][26]:现在有 595 个 Linux 游戏。既有免 DRM 的,也有非免 DRM 的。 +#### 应用商店、软件中心 & 软件库 +Linux 发行版有它们自己的应用商店或软件库。尽管不是很多,但是在这里你也能找到各种各样的游戏。 -#### 应用商店,软件中心 & 存储库 - -Linux 发行版有它们自己的应用程序商店或存储库。尽管不是很多,但是在这里你也能找到各种各样的游戏。 - -今天到此为止。你知道这里有这么多 Linux 可用的游戏吗?你使用一些其他的网站来下载 Linux 游戏?与我们分享你的收藏。 +今天到此为止。你知道这里有这么多 Linux 上可玩的游戏吗?你使用一些其他的网站来下载 Linux 游戏吗?与我们分享你的收藏。 -------------------------------------------------------------------------------- @@ -106,12 +102,12 @@ via: https://itsfoss.com/download-linux-games/ 作者:[Munif Tanjim][a] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://itsfoss.com/author/munif/ -[1]:https://itsfoss.com/linux-gaming-guide/ +[1]:https://linux.cn/article-7316-1.html [2]:https://itsfoss.com/wp-content/uploads/2017/05/download-linux-games-800x450.jpg [3]:http://store.steampowered.com/steamos/ [4]:https://itsfoss.com/linux-gaming-distributions/ From e1e937b5d74f9099a53fded629229608b4cce8fb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 3 Jan 2019 14:38:30 +0800 Subject: [PATCH 0431/4278] PUB:20170523 Best Websites to Download Linux Games.md @robsean https://linux.cn/article-10411-1.html --- .../20170523 Best Websites to Download Linux Games.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20170523 Best Websites to Download Linux Games.md (100%) diff --git a/translated/tech/20170523 Best Websites to Download Linux Games.md b/published/20170523 Best Websites to Download Linux Games.md similarity index 100% rename from translated/tech/20170523 Best Websites to Download Linux Games.md rename to published/20170523 Best Websites to Download Linux Games.md From 3b9baabf04420b1466fb91687b3b3695198b53a6 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Thu, 3 Jan 2019 17:00:20 +0000 Subject: [PATCH 0432/4278] Revert "translating" This reverts commit 62899945549b1ec2a3a4937612989e96f85cd2ec. --- sources/talk/20170921 The Rise and Rise of JSON.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md index f6d54edfc9..84a594c89a 100644 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ b/sources/talk/20170921 The Rise and Rise of JSON.md @@ -1,12 +1,3 @@ -[#]: collector: (lujun9972) -[#]: translator: (runningwater) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (The Rise and Rise of JSON) -[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) -[#]: author: (https://twobithistory.org) -[#]: url: ( ) - The Rise and Rise of JSON ====== JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format. @@ -89,7 +80,7 @@ via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html 作者:[Two-Bit History][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 e4457e89394be4bce3652cfb3a0b7d1ef8fc568d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 4 Jan 2019 09:09:34 +0800 Subject: [PATCH 0433/4278] translated --- ...20181217 Working with tarballs on Linux.md | 100 ------------------ ...20181217 Working with tarballs on Linux.md | 100 ++++++++++++++++++ 2 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 sources/tech/20181217 Working with tarballs on Linux.md create mode 100644 translated/tech/20181217 Working with tarballs on Linux.md diff --git a/sources/tech/20181217 Working with tarballs on Linux.md b/sources/tech/20181217 Working with tarballs on Linux.md deleted file mode 100644 index 2c95f1038f..0000000000 --- a/sources/tech/20181217 Working with tarballs on Linux.md +++ /dev/null @@ -1,100 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Working with tarballs on Linux) -[#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Working with tarballs on Linux -====== -![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg) - -The word “tarball” is often used to describe the type of file used to back up a select group of files and join them into a single file. The name comes from the **.tar** file extension and the **tar** command that is used to group together the files into a single file that is then sometimes compressed to make it smaller for its move to another system. - -Tarballs are often used to back up personal or system files in place to create an archive, especially prior to making changes that might have to be reversed. Linux sysadmins, for example, will often create a tarball containing a series of configuration files before making changes to an application just in case they have to reverse those changes. Extracting the files from a tarball that’s sitting in place will generally be faster than having to retrieve the files from backups. - -### How to create a tarball on Linux - -You can create a tarball and compress it in a single step if you use a command like this one: - -``` -$ tar -cvzf PDFs.tar.gz *.pdf -``` - -The result in this case is a compressed (gzipped) file that contains all of the PDF files that are in the current directory. The compression is optional, of course. A slightly simpler command would just put all of the PDF files into an uncompressed tarball: - -``` -$ tar -cvf PDFs.tar *.pdf -``` - -Note that it’s the **z** in that list of options that causes the file to be compressed or “zipped”. The **c** specifies that you are creating the file and the **v** (verbose) indicates that you want some feedback while the command is running. Omit the **v** if you don't want to see the files listed. - -Another common naming convention is to give zipped tarballs the extension **.tgz** instead of the double extension **.tar.gz** as shown in this command: - -``` -$ tar cvzf MyPDFs.tgz *.pdf -``` - -### How to extract files from a tarball - -To extract all of the files from a gzipped tarball, you would use a command like this: - -``` -$ tar -xvzf file.tar.gz -``` - -If you use the .tgz naming convention, that command would look like this: - -``` -$ tar -xvzf MyPDFs.tgz -``` - -To extract an individual file from a gzipped tarball, you do almost the same thing but add the file name: - -``` -$ tar -xvzf PDFs.tar.gz ShenTix.pdf -ShenTix.pdf -ls -l ShenTix.pdf --rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf -``` - -You can even delete files from a tarball if the tarball is not compressed. For example, if we wanted to remove tile file that we extracted above from the PDFs.tar.gz file, we would do it like this: - -``` -$ gunzip PDFs.tar.gz -$ ls -l PDFs.tar --rw-rw-r-- 1 shs shs 10700800 Dec 15 11:51 PDFs.tar -$ tar -vf PDFs.tar --delete ShenTix.pdf -$ ls -l PDFs.tar --rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar -``` - -Notice that we shaved a little space off the tar file while deleting the ShenTix.pdf file. We can then compress the file again if we want: - -``` -$ gzip -f PDFs.tar -ls -l PDFs.tar.gz --rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John -``` - -The versatility of the command line options makes working with tarballs easy and very convenient. - -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/3328840/linux/working-with-tarballs-on-linux.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.facebook.com/NetworkWorld/ -[2]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20181217 Working with tarballs on Linux.md b/translated/tech/20181217 Working with tarballs on Linux.md new file mode 100644 index 0000000000..2b2e493625 --- /dev/null +++ b/translated/tech/20181217 Working with tarballs on Linux.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Working with tarballs on Linux) +[#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上使用 tarball +====== +![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg) + +“tarball” 一词通常用于描述备份一组选择的文件并将它们打包在一个文件中的一种文件格式。该名称来自 **.tar** 文件扩展名和 **tar** 命令,它用于将文件打包到一个文件中,然后压缩该文件,使其在移动到其他系统时更小。 + +tarballs 通常用于备份个人或系统文件来创建存档, 特别是在进行可能需要撤消的更改之前。例如,Linux 系统管理员通常会在更改应用之前创建包含一系列配置文件的 tarball,以防必须撤消这些更改。从 tarball 中解压文件通常比在备份中搜索文件快。 + +### 如何在 Linux 上创建 tarball + +使用如下命令,你可以在单条命令中创建并压缩文件。 + +``` +$ tar -cvzf PDFs.tar.gz *.pdf +``` + +这里最后是一个压缩文件 (gzip),其中包含了当前目录中的所有 PDF 文件。当然,压缩是可选的。一个稍微简单的只是将 PDF 文件打包成未压缩 tarball 的命令: + +``` +$ tar -cvf PDFs.tar *.pdf +``` + +注意,选项中的 **z** 将文件变成压缩的。 **c** 表明正在创建文件,**v** (详细)表示你在命令运行时需要一些反馈。如果你不想查看列出的文件,请忽略 **v**。 + +另一个常见的命名约定是给压缩的 tarball 命名成 **.tgz** 而不是双扩展名 **.tar.gz**,如下所示: + +``` +$ tar cvzf MyPDFs.tgz *.pdf +``` + +### 如何从 tarball 中解压文件 + +要从 gzip 压缩包中解压所有文件,你可以使用如下命令: + +``` +$ tar -xvzf file.tar.gz +``` + +如果使用 .tgz 命名约定,该命令将如下所示: + +``` +$ tar -xvzf MyPDFs.tgz +``` + +要从 gzip 包中解压单个文件,你可以执行几乎相同的操作,只需添加文件名: + +``` +$ tar -xvzf PDFs.tar.gz ShenTix.pdf +ShenTix.pdf +ls -l ShenTix.pdf +-rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf +``` + +如果未压缩 tarball,你甚至可以从 tarball 中删除文件。例如,如果我们想从 PDFs.tar.gz 中删除我们上面解压的文件,我们会这样做: + +``` +$ gunzip PDFs.tar.gz +$ ls -l PDFs.tar +-rw-rw-r-- 1 shs shs 10700800 Dec 15 11:51 PDFs.tar +$ tar -vf PDFs.tar --delete ShenTix.pdf +$ ls -l PDFs.tar +-rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar +``` + +请注意,我们在删除 ShenTix.pdf 后,缩小了一点 tar 文件占用的空间。如果我们想要,我们可以再次压缩文件: + +``` +$ gzip -f PDFs.tar +ls -l PDFs.tar.gz +-rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John +``` + +丰富的命令行选项使得 tarball 使用起来简单方便。 + +在 [Facebook][1] 和 [LinkedIn][2] 中加入 Network World 社区来评论主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world \ No newline at end of file From 196fed6ee2193b1db95636559877768b64b0f8fa Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 4 Jan 2019 09:19:43 +0800 Subject: [PATCH 0434/4278] translating --- ...181218 Use your Linux terminal to celebrate a banner year.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md index da3f36b00f..c02371d1ed 100644 --- a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md +++ b/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9fa7e2770b746db0ac1841fc8fdb7bb238bf8781 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 09:48:19 +0800 Subject: [PATCH 0435/4278] PRF:20181222 Watch YouTube videos at the Linux terminal.md @geekpi --- ...ch YouTube videos at the Linux terminal.md | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md b/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md index 201a911c5b..5a4f008a1e 100644 --- a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md +++ b/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Watch YouTube videos at the Linux terminal) @@ -9,20 +9,22 @@ 在 Linux 终端上观看 YouTube 视频 ====== -认为视频只能在 GUI 下看么?再想想。 + +> 视频只能在 GUI 下看么?再想想。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a) 我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你一直在看,如果没有,请回到[这里][1]开始,自己试试。你会发现 Linux 终端有很多游戏,消遣和奇怪的东西。 虽然你之前可能已经看过我们日历中的一些玩具,但我们希望对每个人至少有一个新事物。 -今天我们要在昨天的玩具 [MPlayer][2] 上再加上一个 [**youtube-dl**][3]。 +今天我们要在昨天的玩具 [MPlayer][2] 上再加上一个 [youtube-dl][3]。 -正如其名称所暗示的那样,**youtube-dl** 是一个用于下载 YouTube 视频的命令行程序,但它也可以从其他许多站点下载视频,而且它是一个有着[丰富文档][4]的功能齐全的程序,从而使视频获取变得容易。注意:请勿在任何违反你所在司法辖区的版权法的情况下使用 **youtube-dl**。 +正如其名称所暗示的那样,`youtube-dl` 是一个用于下载 YouTube 视频的命令行程序,但它也可以从其他许多站点下载视频,而且它是一个有着[丰富文档][4]的功能齐全的程序,从而使视频获取变得容易。注意:请勿在任何违反你所在司法辖区的版权法的情况下使用 `youtube-dl`。 -**youtube-dl** 使用的是 [Unlicense][5] 这个公共领域许可,类似于 Creative Common 的 [CC0][6]。这里还有哪些公共领域贡献适用于开源领域的[法律意见][7],但它通常被认为与现有的开源许可证兼容,即使是不推荐使用它的组织也是如此。 +`youtube-dl` 使用的是 [Unlicense][5] 这个公共领域许可,类似于 Creative Common 的 [CC0][6]。这里还有哪些公共领域贡献适用于开源领域的[法律意见][7],但它通常被认为与现有的开源许可证兼容,即使是不推荐使用它的组织也是如此。 -最简单地,我们将使用 **youtube-dl** 来获取视频以便在终端中播放。首先,使用适用于你发行版的方法[安装][8]它。对我来说,在 Fedora 中,它被打包在我的仓库中,因此安装非常简单: +最简单地,我们将使用 `youtube-dl` 来获取视频以便在终端中播放。首先,使用适用于你发行版的方法[安装][8]它。对我来说,在 Fedora 中,它被打包在我的仓库中,因此安装非常简单: ``` $ sudo dnf install youtube-dl @@ -34,21 +36,22 @@ $ sudo dnf install youtube-dl $ youtube-dl pec8P5K4s8c -o fireplace.mp4 ``` -如果你昨天没有安装 [MPlayer][2],请继续安装好,如果你之前没有安装 **libcaca** 则需要安装它。如果你直接用 MPlayer 在命令行中播放视频 ( **$****mplayer fireplace.webm** ),它能够播放,但是会在一个自己的窗口中,这不是我们想要的。 +如果你昨天没有安装 [MPlayer][2],请继续安装好,如果你之前没有安装 libcaca 则需要安装它。如果你直接用 MPlayer 在命令行中播放视频 ( `$ mplayer fireplace.webm` ),它能够播放,但是会在一个自己的窗口中,这不是我们想要的。 -首先,我设置将 **libcaca** 强制使用 **ncurses** 作为显示驱动,使输出保持在我的终端: +首先,我设置将 libcaca 强制使用 ncurses 作为显示驱动,使输出保持在我的终端: ``` $ export CACA_DRIVER=ncurses ``` -然后,我放大了终端(“像素”越多越好),并使用以下命令播放文件(强制使用 **libcaca**并静默 MPlayer 的文本输出): +然后,我放大了终端(“像素”越多越好),并使用以下命令播放文件(强制使用 libcaca 并静默 MPlayer 的文本输出): ``` $ mplayer -really-quiet -vo caca fireplace.mp4 ``` 这就完成了! + ![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif) 你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。 @@ -62,14 +65,14 @@ via: https://opensource.com/article/18/12/linux-toy-youtube-dl 作者:[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/) 荣誉推出 [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/article/18/12/linux-toy-mplayer +[2]: https://linux.cn/article-10393-1.html [3]: https://rg3.github.io/youtube-dl/ [4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme [5]: https://unlicense.org/ @@ -77,4 +80,4 @@ via: https://opensource.com/article/18/12/linux-toy-youtube-dl [7]: https://opensource.org/faq#public-domain [8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation [9]: https://www.youtube.com/watch?v=pec8P5K4s8c -[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A \ No newline at end of file +[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A From 80cf767b782036b4f7cf160391f97fa53d96a7cd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 09:50:29 +0800 Subject: [PATCH 0436/4278] PUB:20181222 Watch YouTube videos at the Linux terminal.md @geekpi https://linux.cn/article-10412-1.html --- .../20181222 Watch YouTube videos at the Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181222 Watch YouTube videos at the Linux terminal.md (98%) diff --git a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md b/published/20181222 Watch YouTube videos at the Linux terminal.md similarity index 98% rename from translated/tech/20181222 Watch YouTube videos at the Linux terminal.md rename to published/20181222 Watch YouTube videos at the Linux terminal.md index 5a4f008a1e..55e18d6c20 100644 --- a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md +++ b/published/20181222 Watch YouTube videos at the Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10412-1.html) [#]: subject: (Watch YouTube videos at the Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 6ebac7ec2ebcfd0f4fc6adb8b3fe4de88cd495a1 Mon Sep 17 00:00:00 2001 From: runningwater Date: Fri, 4 Jan 2019 09:55:19 +0800 Subject: [PATCH 0437/4278] =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=B3=E9=A2=86?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20170921 The Rise and Rise of JSON.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md index 84a594c89a..5603c7bacf 100644 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ b/sources/talk/20170921 The Rise and Rise of JSON.md @@ -80,7 +80,7 @@ via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] -译者:[译者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 8ed34440a0a71b04e109d2b23462a60530e379ed Mon Sep 17 00:00:00 2001 From: Bestony Date: Fri, 4 Jan 2019 11:41:38 +0800 Subject: [PATCH 0438/4278] =?UTF-8?q?docs=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 --- ...0 killer tools for the admin in a hurry.md | 72 +++++++------- ...0 killer tools for the admin in a hurry.md | 97 +++++++++++++++++++ 2 files changed, 136 insertions(+), 33 deletions(-) create mode 100644 translated/tech/20180703 10 killer tools for the admin in a hurry.md diff --git a/sources/tech/20180703 10 killer tools for the admin in a hurry.md b/sources/tech/20180703 10 killer tools for the admin in a hurry.md index 87e3e8b309..73fa91b9d4 100644 --- a/sources/tech/20180703 10 killer tools for the admin in a hurry.md +++ b/sources/tech/20180703 10 killer tools for the admin in a hurry.md @@ -1,69 +1,75 @@ -bestony translating - -10 killer tools for the admin in a hurry +10 个供管理员快速使用的杀手工具 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT) -Administering networks and systems can get very stressful when the workload piles up. Nobody really appreciates how long anything takes, and everyone wants their specific thing done yesterday. +当工作负载累加时,管理网络和系统变得富有压力。每个人都希望在昨天能够完成他们的具体事务,但没有人能真正意识到需要花费多长时间。 -So it's no wonder so many of us are drawn to the open source spirit of figuring out what works and sharing it with everyone. Because, when deadlines are looming, and there just aren't enough hours in the day, it really helps if you can just find free answers you can implement immediately. +所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。 -So, without further ado, here's my Swiss Army Knife of stuff to get you out of the office before dinner time. +因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。 -### Server configuration and scripting +### 服务器配置和脚本 -Let's jump right in. +让我们看一看! **[NixCraft][1]** -Use the site's internal search function. With more than a decade of regular updates, there's gold to be found here—useful scripts and handy hints that can solve your problem straight away. This is often the second place I look after Google. +用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 **[Webmin][2]** -This gives you a nice web interface to remotely edit your configuration files. It cuts down on a lot of time spent having to juggle directory paths and `sudo nano`, which is handy when you're handling several customers. +它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。 -**[Windows Subsystem for Linux][3]** -The reality of the modern workplace is that most employees are on Windows, while the grown-up gear in the server room is on Linux. So sometimes you find yourself trying to do admin tasks from (gasp) a Windows desktop. +**[Windows 下的 Linux 子系统][3]** -What do you do? Install a virtual machine? It's actually much faster and far less work to configure if you install the Windows Subsystem for Linux compatibility layer, now available at no cost on Windows 10. +现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 -This gives you a Bash terminal in a window where you can run Bash scripts and Linux binaries on the local machine, have full access to both Windows and Linux filesystems, and mount network drives. It's available in Ubuntu, OpenSUSE, SLES, Debian, and Kali flavors. +你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。 + +这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。 **[mRemoteNG][4]** -This is an excellent SSH and remote desktop client for when you have 100+ servers to manage. +当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 -### Setting up a network so you don't have to do it again +### 设置网络,这样你就无需再这样做了。 -A poorly planned network is the sworn enemy of the admin who hates working overtime. +一个考虑不周的网络是厌恶加班的管理员的死敌。 -**[IP Addressing Schemes that Scale][5]** -The diabolical thing about running out of IP addresses is that, when it happens, the network's grown large enough that a new addressing scheme is an expensive, time-consuming pain in the proverbial. +**[可拓展的 IP 寻址方案][5]** -Ain't nobody got time for that! +IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 -At some point, IPv6 will finally arrive to save the day. Until then, these one-size-fits-most IP addressing schemes should keep you going, no matter how many network-connected wearables, tablets, smart locks, lights, security cameras, VoIP headsets, and espresso machines the world throws at us. +没有人有时间做这件事! -**[Linux Chmod Permissions Cheat Sheet][6]** -A short but sweet cheat sheet of Bash commands to set permissions across the network. This is so when Bill from Customer Service falls for that ransomware scam, you're recovering just his files and not the entire company's. +到了某个时候,IPv6 终将到来,来拯救这世界。在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机,这些一刀切的IP 寻址方案都应该让我们继续前行。 -**[VLSM Subnet Calculator][7]** -Just put in the number of networks you want to create from an address space and the number of hosts you want per network, and it calculates what the subnet mask should be for everything. -### Single-purpose Linux distributions +**[Linux Chmod 权限备忘录][6]** -Need a Linux box that does just one thing? It helps if someone else has already sweated the small stuff on an operating system you can install and have ready immediately. +一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 -Each of these has, at one point, made my work day so much easier. +**[VLSM 子网计算器][7]** + +只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 + +### 单一用途的 Linux 发行版 + +需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。 + +下面这些每一个都使得我的工作变得轻松了许多。 **[Porteus Kiosk][8]** -This is for when you want a computer totally locked down to just a web browser. With a little tweaking, you can even lock the browser down to just one website. This is great for public access machines. It works with touchscreens or with a keyboard and mouse. +这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 **[Parted Magic][9]** -This is an operating system you can boot from a USB drive to partition hard drives, recover data, and run benchmarking tools. +这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 **[IPFire][10]** -Hahahaha, I still can't believe someone called a router/firewall/proxy combo "I pee fire." That's my second favorite thing about this Linux distribution. My favorite is that it's a seriously solid software suite. It's so easy to set up and configure, and there is a heap of plugins available to extend it. -So, how about you? What tools, resources, and cheat sheets have you found to make the workday easier? I'd love to know. Please share in the comments. +啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”(译者注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 + +那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松? + +我很高兴知道,请在评论中分享您的工具。 -------------------------------------------------------------------------------- @@ -71,7 +77,7 @@ via: https://opensource.com/article/18/7/tools-admin 作者:[Grant Hamono][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/) 荣誉推出 diff --git a/translated/tech/20180703 10 killer tools for the admin in a hurry.md b/translated/tech/20180703 10 killer tools for the admin in a hurry.md new file mode 100644 index 0000000000..8fc7d36474 --- /dev/null +++ b/translated/tech/20180703 10 killer tools for the admin in a hurry.md @@ -0,0 +1,97 @@ +10 个供管理员快速使用的杀手工具 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT) + +当工作负载累计时,管理网络和系统变得富有压力。没有人能真正意识到需要花费多长时间,每个人都希望在昨天能够完成他们的具体事务。 + +所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。 + +So, without further ado, here's my Swiss Army Knife of stuff to get you out of the office before dinner time. + +因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。 + +### 服务器配置和脚本 + +让我们看一看! + +**[NixCraft][1]** +用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 + +**[Webmin][2]** +它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。 + +**[Windows 下的 Linux 子系统][3]** + +现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 + +你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。 + +这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。 + +**[mRemoteNG][4]** +当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 + +### 设置网络,这样你就无需再这样做了。 + +一个考虑不周的网络是厌恶加班管理员的死敌。 + +**[可拓展的 IP 寻址方案][5]** + +IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 + +没有人有时间做这件事! + +到了某个时候,IPv6 终将到来,来拯救这世界。在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机,这些一刀切的IP 寻址方案都应该让我们继续前行。 + + +**[Linux Chmod 权限备忘录][6]** + +一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 + +**[VLSM 子网计算器][7]** + +只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 + +### 单一用途的 Linux 发行版 + +需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。 + +下面这些每一个都使得我的工作变得轻松了许多。 + +**[Porteus Kiosk][8]** +这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 + +**[Parted Magic][9]** +这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 + +**[IPFire][10]** + +啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”(译者注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 + +那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松? + +我很高兴知道,请在评论中分享您的工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/tools-admin + +作者:[Grant Hamono][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[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/grantdxm +[1]:https://www.cyberciti.biz/ +[2]:http://www.webmin.com/ +[3]:http://wsl-guide.org/en/latest/ +[4]:https://mremoteng.org/ +[5]:https://blog.dxmtechsupport.com.au/ip-addressing-for-a-small-business-that-might-grow/ +[6]:https://isabelcastillo.com/linux-chmod-permissions-cheat-sheet +[7]:http://www.vlsm-calc.net/ +[8]:http://porteus-kiosk.org/ +[9]:https://partedmagic.com/ +[10]:https://www.ipfire.org/ From ec4940d3083f3f5728a0d432fbc0bf3a427445f8 Mon Sep 17 00:00:00 2001 From: Bestony Date: Fri, 4 Jan 2019 11:49:44 +0800 Subject: [PATCH 0439/4278] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 killer tools for the admin in a hurry.md | 95 ------------------- 1 file changed, 95 deletions(-) delete mode 100644 sources/tech/20180703 10 killer tools for the admin in a hurry.md diff --git a/sources/tech/20180703 10 killer tools for the admin in a hurry.md b/sources/tech/20180703 10 killer tools for the admin in a hurry.md deleted file mode 100644 index 73fa91b9d4..0000000000 --- a/sources/tech/20180703 10 killer tools for the admin in a hurry.md +++ /dev/null @@ -1,95 +0,0 @@ -10 个供管理员快速使用的杀手工具 -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT) - -当工作负载累加时,管理网络和系统变得富有压力。每个人都希望在昨天能够完成他们的具体事务,但没有人能真正意识到需要花费多长时间。 - -所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。 - -因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。 - -### 服务器配置和脚本 - -让我们看一看! - -**[NixCraft][1]** -用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 - -**[Webmin][2]** -它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。 - -**[Windows 下的 Linux 子系统][3]** - -现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 - -你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。 - -这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。 - -**[mRemoteNG][4]** -当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 - -### 设置网络,这样你就无需再这样做了。 - -一个考虑不周的网络是厌恶加班的管理员的死敌。 - -**[可拓展的 IP 寻址方案][5]** - -IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 - -没有人有时间做这件事! - -到了某个时候,IPv6 终将到来,来拯救这世界。在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机,这些一刀切的IP 寻址方案都应该让我们继续前行。 - - -**[Linux Chmod 权限备忘录][6]** - -一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 - -**[VLSM 子网计算器][7]** - -只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 - -### 单一用途的 Linux 发行版 - -需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。 - -下面这些每一个都使得我的工作变得轻松了许多。 - -**[Porteus Kiosk][8]** -这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 - -**[Parted Magic][9]** -这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 - -**[IPFire][10]** - -啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”(译者注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 - -那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松? - -我很高兴知道,请在评论中分享您的工具。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/7/tools-admin - -作者:[Grant Hamono][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[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/grantdxm -[1]:https://www.cyberciti.biz/ -[2]:http://www.webmin.com/ -[3]:http://wsl-guide.org/en/latest/ -[4]:https://mremoteng.org/ -[5]:https://blog.dxmtechsupport.com.au/ip-addressing-for-a-small-business-that-might-grow/ -[6]:https://isabelcastillo.com/linux-chmod-permissions-cheat-sheet -[7]:http://www.vlsm-calc.net/ -[8]:http://porteus-kiosk.org/ -[9]:https://partedmagic.com/ -[10]:https://www.ipfire.org/ From b843a8fb1030c5cb2840a7ebf642c340852cb19c Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 4 Jan 2019 12:08:22 +0800 Subject: [PATCH 0440/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20crea?= =?UTF-8?q?te=20presentations=20with=20Beamer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...How to create presentations with Beamer.md | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 sources/tech/20190103 How to create presentations with Beamer.md diff --git a/sources/tech/20190103 How to create presentations with Beamer.md b/sources/tech/20190103 How to create presentations with Beamer.md new file mode 100644 index 0000000000..68997a146d --- /dev/null +++ b/sources/tech/20190103 How to create presentations with Beamer.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create presentations with Beamer) +[#]: via: (https://opensource.com/article/19/1/create-presentations-beamer) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +How to create presentations with Beamer +====== +Beamer brings LaTeX's powerful typesetting features and ecosystem to creating slides. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b) + +[Beamer][1] is a LaTeX package for generating presentation slide decks. One of its nicest features is that it can take advantage of LaTeX's powerful typesetting system and all the other packages in its ecosystem. For example, I often use LaTeX's [listings][2] package in Beamer presentations that include code. + +### Starting a presentation + +To begin a Beamer document, enter: + +``` +\documentclass{beamer} +``` + +As you would with any other LaTeX document, add any packages you want to use. For example, to use the **listings** package, enter: + +``` +\usepackage{listings} +``` + +Place all content inside the **document** environment: + +``` +\begin{document} +``` + +Beamer documents are usually a sequence of **frame** environments. Frames that contain code should be marked **fragile** : + +``` +\begin{frame}[fragile] +``` + +Begin your frames with a title: + +``` +\frametitle{Function to Do Stuff} +``` + +### Testing your code before you present it + +One of the worst feelings in the world is giving a talk and realizing, as you walk through the code, that there is a glaring bug in it—maybe a misspelled keyword or an unclosed brace. + +The solution is to test code that is presented. In most presentation environments, this means creating a separate file, writing tests, then copying and pasting. + +However, with Beamer, there is a better way. Imagine you have a file named **do_stuff.py** that contains code. You can write tests for the **do_stuff.py** code in a second file, which you call **test_do_stuff.py** , and can exercise it with, say, [pytest][3]. However, most of the lines in **do_stuff.py** lack pedagogic value, like defining helper functions. + +To simplify things for your audience, you can import just the lines you want to talk about into the frame in your presentation : + +``` +\lstinputlisting[ +    language=Python, +    firstline=8, +    lastline=15 +]{do_stuff.py} +``` + +Since you will be talking through those lines (from 8 to 15), you don't need any other content on the slide. Close the frame: + +``` +\end{frame} +``` + +On the next slide, you want to show a usage example for the **do_stuff()** function you just presented: + +``` +\begin{frame}[fragile] +\frametitle{Calling Function to Do Stuff} +\lstinputlisting[ +    language=Python, +    firstline=17, +    lastline=19 +]{do_stuff.py} +\end{frame} +``` + +You use the same file, but this time you show the lines that call the function. Finally, close the document: + +``` +\end{document} +``` + +Assuming you have an appropriate Python file in **do_stuff.py** , this will produce a short two-slide presentation. + +Beamer also supports necessary features such as progressive revelation, showing only one bullet at a time to prevent the audience from being distracted by reading ahead.": **\pause** inside a list will divide bullets into pages: + +``` +\begin{frame} +Remember: +\begin{itemize} +\item This will show up on the first slide. \pause +\item This will show up on the +      second slide, as well as the preceding point. \pause +\item Finally, on the third slide, +       all three bullets will show up. +\end{frame} +``` + +### Creating handouts + +My favorite feature in Beamer is that you can set it to ignore everything outside a frame with **\documentclass[ignorenonframetext]{beamer}**. When I prepare a presentation, I leave off the top (where the document class is declared) and auto-generate two versions of it: one with Beamer that ignores all text outside any frame, which I use for my presentation, and one with a header like: + +``` +\documentclass{article} +\usepackage{beamerarticle} +``` + +which generates a handout—a PDF that has all the frames and all the text between them. + +When a conference organizer asks me to publish my slides, I include the original slide deck as a reference, but the main thing I like people to have is the handout, which has all the explanatory text that I don't want to include on the slide deck itself. + +When creating presentation slides, people often wonder whether it's better to optimize their materials for the presentation or for people who want to read them afterward. Fortunately, Beamer provides the best of both worlds. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/create-presentations-beamer + +作者:[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://www.overleaf.com/learn/latex/Beamer +[2]: https://www.overleaf.com/learn/latex/Code_listing +[3]: https://docs.pytest.org/en/latest/ From 7a5ff89805b90c4dd533f2df1ca7f01af3342e26 Mon Sep 17 00:00:00 2001 From: Bestony <13283837+bestony@users.noreply.github.com> Date: Fri, 4 Jan 2019 12:10:46 +0800 Subject: [PATCH 0441/4278] =?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 --- ...0181212 5 resolutions for open source project maintainers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181212 5 resolutions for open source project maintainers.md b/sources/talk/20181212 5 resolutions for open source project maintainers.md index 122cc3f2d2..8004b05745 100644 --- a/sources/talk/20181212 5 resolutions for open source project maintainers.md +++ b/sources/talk/20181212 5 resolutions for open source project maintainers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (bestony) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 05fe7c392607434546ac2f77e08474e1f94f2b09 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 4 Jan 2019 12:50:43 +0800 Subject: [PATCH 0442/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labo?= =?UTF-8?q?ratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=200=20Introductio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...y - Raspberry Pi- Lesson 0 Introduction.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md diff --git a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md new file mode 100644 index 0000000000..f7d0af8187 --- /dev/null +++ b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 0 Introduction +====== + +This introductory lesson does not contain a practical element, but exists to explain the basic concepts of what is an operating system, what is assembly code and other important basics. If you just want to get straight into practicals, it should be safe to skip this lesson. + +### 1 Operating Systems + +An operating system is just a very complicated program. It has the job of organising other programs on a computer, including sharing the computer's time, memory, hardware and other resources. Some big families of desktop operating systems that you may have heard of include GNU/Linux, Mac OS X and Microsoft Windows. Other devices also need operating systems such as phones, which may use operating systems such as Android, iOS and Windows Phone.[1] + +Since the operating system has to interact with the hardware on a computer system, it also has to have specific knowledge of the hardware on a system. To allow operating systems to be used on a variety of computers, the concept of **drivers** was invented. Drivers are small bits of code that can be added and removed from the operating system in order to allow the operating system to talk to a particular piece of hardware. In this course, we do not cover how to create such removable drivers, and instead focus on making specific ones for the Raspberry Pi. + +There are all kinds of different designs of operating systems, and this course can only just scratch the surface. In this course we will mainly focus on getting the operating system to interact with a variety of bits of hardware, as this is often the trickiest bit, and the part for which the least documentation and help exists online. + +### 2 Assembly Code + +``` +A processor can often perform millions of instructions per second, but they must be simple. +``` + +This course will be written almost exclusively in assembly code. Assembly code is code that is very close to what the computer understands. How a computer really works is that there is a small device called a processor which is capable of performing simple jobs like adding numbers, and there is a set of one or more microchips called the **RAM** which are capable of storing numbers. When a computer has power, the processor works through a sequence of instructions given to it by the programmer, which cause it to change numbers in the RAM, and interact with connected hardware. Assembly code is a translation into human readable text of those commands. + +When programming normally, the programmer writes code in a programming language such as C++, Java, C#, Basic, etc, and then a program called the compiler translates what the programmer wrote into assembly code, which is the further reduced into binary code[2]. Binary code is what the computer actually understands, but it is almost impossible for humans to read. Assembly code is much better, but it can be frustrating how few commands are possible. Remember that every command you write in assembly code is something that the processor understands directly, and so the commands are simple by design, as a physical circuit must process each one. + +![Compiler process][1] + +Just like with ordinary programming, there are many different assembly code languages, however unlike ordinary programming, the reason these exist is due to the fact that there exists many different processors, each designed to understand a different language. Thus a program written in assembly code for one machine, will not work on a different one. For most things, this would be a disaster as each program would have to be rewritten for every system it was used on, but for operating systems this isn't so much of a problem, as it would have to be rewritten anyway due to differing hardware. Nevertheless, most operating systems are written in C++ or C, so that they can be converted more easily, and only the sections that absolutely have to be written in assembly are. + +You're now ready to move on to the first lesson, [Lesson 1: OK01][2] + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html + +作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/compiling.png +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html From 83e0919b98337f22a9d6c6f625aa9a75f1a04dd5 Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 15:01:01 +0800 Subject: [PATCH 0443/4278] =?UTF-8?q?=20=E7=94=B3=E9=A2=86=E5=8E=9F?= =?UTF-8?q?=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申领原文 --- ...8 How to create a free baby monitoring system with Gonimo.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 0b68b7967a..a224e8d4f3 100644 --- a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -1,3 +1,5 @@ +lintaov587 is translating + How to create a free baby monitoring system with Gonimo ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE) From 7b7341fe1911f23da02c939495000c02293d07fc Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 15:06:13 +0800 Subject: [PATCH 0444/4278] Update 20170928 How to create a free baby monitoring system with Gonimo.md --- ...free baby monitoring system with Gonimo.md | 82 +++++++++---------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md index a224e8d4f3..3f52c8be4a 100644 --- a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -1,119 +1,115 @@ -lintaov587 is translating - -How to create a free baby monitoring system with Gonimo +如何用Gonimo创建一个免费的婴儿监视系统 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE) -New and expecting parents quickly learn that there is a long--and expensive--list of equipment that a new baby needs. High on that list is a baby monitor, so they can keep an eye (and an ear) on their infant while they're doing other things. But this is one piece of equipment that doesn't have to eat into your baby fund; Gonimo is a free and open source solution that turns existing devices into a baby monitoring system, freeing up some of your baby budget for any of the thousands of other must-have or trendy items lining the aisles of the nearby big-box baby store. +新父母和准父母很快就会知道将会有一个长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的免费的开源解决方案,为附近大型婴儿用品商店的过道中数以千计的其他必备或时尚物品中的任何一个腾出一些婴儿的预算。 -Gonimo was born when its developer, an open source fan, had twins and found problems with the existing options: +Gonimo诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: - * Status-quo hardware baby monitors are expensive, have limited range, and require you to carry extra devices. - * There are mobile monitoring apps, but most of the existing iOS/Android baby monitoring apps are unreliable and unsecure, with no obvious open source product in sight. - * If you have two young children (e.g., twins), you'll need two monitors, doubling your costs. + * 现有硬件婴儿监视器价格昂贵,范围有限,需要您携带额外的设备。 + * 虽然有移动监控应用程序,但大多数现有的iOS / Android婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 + * 如果您有两个小孩(例如双胞胎),您将需要两台监视器,使您的成本翻倍。 -Gonimo was created as an open source solution to the shortcomings of typical monitors: +Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: - * Expensive? Nope, it is free! - * Limited range? No, it works with internet/WiFi, wherever you are. - * Download and install apps? Uh-uh, it works in your existing web browser. - * Buy new devices? No way, you can use any laptop, mobile phone, or tablet with a web browser and a microphone and/or camera. + * 昂贵? 不,它是免费的! + * 范围有限? 不,它适用于互联网/ WiFi,无论您身在何处。 + * 下载并安装应用程序? 噢不,它适用于您现有的网络浏览器。 + * 购买新设备? 不用,你可以使用任何笔记本电脑,手机或平板电脑与网络浏览器和麦克风和/或相机。 -(Note: Apple iOS devices are unfortunately not yet supported, but that's expected to change very soon--read on for how you can help make that happen.) +(注意:遗憾的是,Apple iOS设备尚不支持,但预计很快就会发生变化 - 请继续阅读,了解如何帮助实现这一目标。) -### Get started +### 开始 -Transforming your devices into a baby monitor is easy. From your device's browser (ideally Chrome), visit [gonimo.com][1] and click Start baby monitor to get to the web app. +将您的设备转换为婴儿监视器很容易。 从您设备的浏览器(理想情况下为Chrome),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问Web应用程序。 - 1. **Create family:** On the first-time startup screen, you will see a cute rabbit running on the globe. This is where you create a new family. Hit the **+** button and either accept the randomly generated family name or type in your own choice. + 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。 这是您创建新家庭的地方。 单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 ![Start screen][3] -Create a new family from the start screen +从开始屏幕创建一个新家庭 - 1. **Invite devices:** After you've set up your family, the next screen directs you to invite another device to join your Gonimo family. There is a one-time invitation link that you can directly send via email or copy and paste into a message. From the other device, simply open the link and accept the invitation. Repeat this process for any other devices you'd like to invite to your family. Your devices are now in the same family, ready to cooperate as a fully working baby monitor system. + 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的Gonimo家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。 您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 ![Invite screen][5] -Invite family members +邀请家庭成员 - 1. **Start baby station stream:** Next, choose which device will stream the baby's audio and video to the parent station by going to the [Gonimo home screen][6], clicking on the button with the pacifier, and giving the web browser permission to access the device's microphone and camera. Adjust the camera to point at your baby's bed, or turn it off to save device battery (audio will still be streamed). Hit Start. The stream is now active. + 1. **启动婴儿工作站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。 调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。 点击开始。 该流现在处于活动状态。 ![Select baby station][8] -Select the baby station +选择婴儿站 ![Press Start][10] -Press Start to stream video. - - 1. **Connect to parent station stream:** To view the baby station stream, go to another device in your Gonimo family --this is the parent station. Hit the "parent" button on the Gonimo home screen. You will see a list of all the devices in the family; next to the one with the active baby station will be a pulsing Connect button. Select Connect, and you can see and hear your baby over a peer-to-peer audio/video stream. A volume bar provides visualization for the transmitted audio stream. +按“Start”开始以流式传输视频 + 1. **连接到双亲站流:** 要查看婴儿站流,请转到Gonimo家族中的其他设备 - 这是双亲站。 点击Gonimo主屏幕上的“Parent”按钮。 您将看到该系列中所有设备的列表; 旁边有一个活跃的婴儿站将是一个短时连接按钮。 选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。 音量条为传输的音频流提供可视化。 ![Select parent station][12] -Select parent station +选择双亲站 ![Press Connect][14] -Press Connect to start viewing the baby stream. +按下“Connect”开始观看婴儿流。 - 1. **Congratulations!** You have successfully transformed your devices into a baby monitor directly over a web browser without downloading or installing any apps! + 1. **恭喜!** 您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! -For more information and detailed descriptions about renaming devices, removing devices from a family, or deleting a family, check out the [video tutorial][15] at gonimo.com. +有关重命名设备,从系列中删除设备或删除系列的详细信息和详细说明,请查看 [video tutorial][15] 在 gonimo.com。 -### Flexibility of the family system +### 家庭系统的灵活性 -One of Gonimo's strengths is its family-based system, which offers enormous flexibility for different kinds of situations that aren't available even in commercial Android or iOS apps. To dive into these features, let's assume that you have created a family that consists of three devices. +Gonimo的优势之一是其基于家庭的系统,它为即使在商业Android或iOS应用中也无法提供的各种情况提供了极大的灵活性。 要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 - * **Multi-baby:** What if you want to keep an eye on your two young children who sleep in separate rooms? Put a device in each child's room and set them as baby stations. The third device will act as the parent station, on which you can connect to both streams and see your toddlers via split screen. You can even extend this use case to more than two baby stations by inviting more devices to your family and setting them up as baby stations. As soon as your parent station is connected to the first baby station, return to the Device Overview screen by clicking the back arrow in the top left corner. Now you can connect to the second (and, in turn, the third, and fourth, and fifth, and so on) device, and the split screen will be established automatically. Voila! + * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。 第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。 您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。 只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。 现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! - * **Multi-parent:** What if daddy wants to watch the children while he's at work? Just invite a fourth device (e.g., his office PC) to the family and set it up as a parent station. Both parents can check in on their children simultaneously from their own devices, even independently choosing to which stream(s) they wish to connect. + * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办? 只需邀请第四个设备(例如,他的办公室PC)到家庭并将其设置为父母站。 父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 - * **Multi-family:** A single device can also be part of several families. This is very useful when your baby station is something that's always with you, such as a tablet, and you frequently visit relatives or friends. Create another family for "Granny's house" or "Uncle John's house," which consists of your baby station device paired with Granny's or Uncle John's devices. You can switch the baby station device among those families, whenever you want, from the baby station device's Gonimo home screen. + * **多户:** 单个设备也可以是几个系列的一部分。 当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。 为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与Granny's或Uncle John的设备配对。 您可以随时通过婴儿站设备的Gonimo主屏幕在这些家庭中切换婴儿站设备。 -### Want to participate? +### 想要参加吗? -The Gonimo team loves open source. Code from the community, for the community. Gonimo's users are very important to us, but they are only one part of the Gonimo story. Creative brains behind the scenes are the key to creating a great baby monitor experience. +Gonimo团队喜欢开源。 社区代码,社区代码。 Gonimo的用户对我们非常重要,但它们只是Gonimo故事的一部分。 幕后有创意的大脑是创造出色婴儿监视器体验的关键。 -Currently we especially need help from people who are willing to be iOS 11 testers, as Apple's support of WebRTC in iOS 11 means we will finally be able to support iOS devices. If you can, please help us realize this awesome milestone. +目前我们特别需要那些愿意成为iOS 11测试者的人的帮助,因为Apple在iOS 11中对WebRTC的支持意味着我们最终将能够支持iOS设备。 如果可以,请帮助我们实现这个令人敬畏的里程碑。 -If you know Haskell or want to learn it, you can check out [our code at GitHub][16]. Pull requests, code reviews, and issues are all welcome. +如果您了解Haskell或想要了解它,您可以查看 [our code at GitHub][16]. 欢迎拉取请求,审查代码以及提出问题。 +最后,请通过向新父母和开源世界宣传Gonimo婴儿监视器是易于使用并且便携的。 -And, finally, please help by spreading the word to new parents and the open source world that the Gonimo baby monitor is simple to use and already in your pocket. - -### About The Author -Robert Klotzner;I Am Father Of Twins;A Programmer. Once I Heard That Ordinary People Can Actually Program Computers;I Bought A Page Book About C;Started Learning;I Was Fifteen Back Then. I Sticked With C;For Quite A While;Learned Java;Went Back To C +### 关于作者 +Robert Klotzner;我是双胞胎的父亲;一个程序员。当我听到普通人可以给计算机编程时;我买了一本关于C的书页;开始学习;我当时十五岁。我坚持用C;相当长的一段时间;学习了java;回归到C -------------------------------------------------------------------------------- via: https://opensource.com/article/17/9/gonimo 作者:[Robert Klotzner][a] -译者:[译者ID](https://github.com/译者ID) +译者:[lintaov587](https://github.com/lintaov587) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8952ebafa98a13f1e32eff99b5575d6d895a2d2a Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 15:08:36 +0800 Subject: [PATCH 0445/4278] Rename sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md to translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md --- ...928 How to create a free baby monitoring system with Gonimo.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20170928 How to create a free baby monitoring system with Gonimo.md (100%) diff --git a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md similarity index 100% rename from sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md rename to translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md From cea16301088ee2aae4818a7ca7145c7aedc5e2f3 Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 21:28:55 +0800 Subject: [PATCH 0446/4278] Update 20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改排版 --- ...free baby monitoring system with Gonimo.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 3f52c8be4a..06b972ed7d 100644 --- a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -1,33 +1,33 @@ -如何用Gonimo创建一个免费的婴儿监视系统 +如何用 Gonimo 创建一个免费的婴儿监视系统 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE) 新父母和准父母很快就会知道将会有一个长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的免费的开源解决方案,为附近大型婴儿用品商店的过道中数以千计的其他必备或时尚物品中的任何一个腾出一些婴儿的预算。 -Gonimo诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: +Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: * 现有硬件婴儿监视器价格昂贵,范围有限,需要您携带额外的设备。 - * 虽然有移动监控应用程序,但大多数现有的iOS / Android婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 + * 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 * 如果您有两个小孩(例如双胞胎),您将需要两台监视器,使您的成本翻倍。 Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: - * 昂贵? 不,它是免费的! - * 范围有限? 不,它适用于互联网/ WiFi,无论您身在何处。 - * 下载并安装应用程序? 噢不,它适用于您现有的网络浏览器。 - * 购买新设备? 不用,你可以使用任何笔记本电脑,手机或平板电脑与网络浏览器和麦克风和/或相机。 + * 昂贵?不,它是免费的! + * 范围有限?不,它适用于互联网 / WiFi,无论您身在何处。 + * 下载并安装应用程序?噢不,它适用于您现有的网络浏览器。 + * 购买新设备?不用,你可以使用任何笔记本电脑,手机或平板电脑与网络浏览器和麦克风和/或相机。 -(注意:遗憾的是,Apple iOS设备尚不支持,但预计很快就会发生变化 - 请继续阅读,了解如何帮助实现这一目标。) +(注意:遗憾的是,Apple iOS 设备尚不支持,但预计很快就会发生变化 - 请继续阅读,了解如何帮实现这一目标助。) ### 开始 -将您的设备转换为婴儿监视器很容易。 从您设备的浏览器(理想情况下为Chrome),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问Web应用程序。 +将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome ),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问 Web 应用程序。 - 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。 这是您创建新家庭的地方。 单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 + 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 @@ -36,7 +36,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 从开始屏幕创建一个新家庭 - 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的Gonimo家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。 您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 + 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 @@ -45,7 +45,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 邀请家庭成员 - 1. **启动婴儿工作站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。 调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。 点击开始。 该流现在处于活动状态。 + 1. **启动婴儿站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击开始。该流现在处于活动状态。 @@ -59,7 +59,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 按“Start”开始以流式传输视频 - 1. **连接到双亲站流:** 要查看婴儿站流,请转到Gonimo家族中的其他设备 - 这是双亲站。 点击Gonimo主屏幕上的“Parent”按钮。 您将看到该系列中所有设备的列表; 旁边有一个活跃的婴儿站将是一个短时连接按钮。 选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。 音量条为传输的音频流提供可视化。 + 1. **连接到双亲站流:** 要查看婴儿站流,请转到 Gonimo 家族中的其他设备 - 这是双亲站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个活跃的婴儿站将是一个短时连接按钮。选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 ![Select parent station][12] @@ -80,29 +80,29 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: ### 家庭系统的灵活性 -Gonimo的优势之一是其基于家庭的系统,它为即使在商业Android或iOS应用中也无法提供的各种情况提供了极大的灵活性。 要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 + Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 - * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。 第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。 您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。 只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。 现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! + * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! - * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办? 只需邀请第四个设备(例如,他的办公室PC)到家庭并将其设置为父母站。 父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 + * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 - * **多户:** 单个设备也可以是几个系列的一部分。 当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。 为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与Granny's或Uncle John的设备配对。 您可以随时通过婴儿站设备的Gonimo主屏幕在这些家庭中切换婴儿站设备。 + * **多户:** 单个设备也可以是几个系列的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与 Granny's 或 Uncle John 的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 ### 想要参加吗? -Gonimo团队喜欢开源。 社区代码,社区代码。 Gonimo的用户对我们非常重要,但它们只是Gonimo故事的一部分。 幕后有创意的大脑是创造出色婴儿监视器体验的关键。 +Gonimo 团队喜欢开源。社区代码,社区代码。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。 -目前我们特别需要那些愿意成为iOS 11测试者的人的帮助,因为Apple在iOS 11中对WebRTC的支持意味着我们最终将能够支持iOS设备。 如果可以,请帮助我们实现这个令人敬畏的里程碑。 +目前我们特别需要那些愿意成为 iOS 11 测试者的人的帮助,因为 Apple 在 iOS 11 中对 WebRTC 的支持意味着我们最终将能够支持 iOS 设备。如果可以,请帮助我们实现这个令人敬畏的里程碑。 -如果您了解Haskell或想要了解它,您可以查看 [our code at GitHub][16]. 欢迎拉取请求,审查代码以及提出问题。 -最后,请通过向新父母和开源世界宣传Gonimo婴儿监视器是易于使用并且便携的。 +如果您了解 Haskell 或想要了解它,您可以查看 [our code at GitHub][16]. 欢迎拉取请求,审查代码以及提出问题。 +最后,请通过向新父母和开源世界宣传 Gonimo 婴儿监视器是易于使用并且便携的。 ### 关于作者 -Robert Klotzner;我是双胞胎的父亲;一个程序员。当我听到普通人可以给计算机编程时;我买了一本关于C的书页;开始学习;我当时十五岁。我坚持用C;相当长的一段时间;学习了java;回归到C +Robert Klotzner;我是双胞胎的父亲;一个程序员。当我听到普通人可以给计算机编程时;我买了一本关于 C 的书页;开始学习;我当时十五岁。我坚持用 C ;相当长的一段时间;学习了 Java ;回归到 C -------------------------------------------------------------------------------- From 55991857dcb2efb1f12e76f9110e8e60b98e8f8b Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 21:30:07 +0800 Subject: [PATCH 0447/4278] Update 20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改排版 --- ...8 How to create a free baby monitoring system with Gonimo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 06b972ed7d..809074a10c 100644 --- a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -72,7 +72,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 按下“Connect”开始观看婴儿流。 - 1. **恭喜!** 您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! + 1. **恭喜!** 您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! From fef29d834efcbe57581fc400b8d94ec97faaf4d0 Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 21:36:08 +0800 Subject: [PATCH 0448/4278] Update 20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改排版,更改标点符号 --- ... free baby monitoring system with Gonimo.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 809074a10c..95c495e814 100644 --- a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -4,7 +4,7 @@ 新父母和准父母很快就会知道将会有一个长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的免费的开源解决方案,为附近大型婴儿用品商店的过道中数以千计的其他必备或时尚物品中的任何一个腾出一些婴儿的预算。 -Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: +Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: * 现有硬件婴儿监视器价格昂贵,范围有限,需要您携带额外的设备。 * 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 @@ -27,7 +27,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome ),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问 Web 应用程序。 - 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 + 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 @@ -36,7 +36,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 从开始屏幕创建一个新家庭 - 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 + 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 @@ -45,7 +45,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 邀请家庭成员 - 1. **启动婴儿站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击开始。该流现在处于活动状态。 + 1. **启动婴儿站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击开始。该流现在处于活动状态。 @@ -59,7 +59,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 按“Start”开始以流式传输视频 - 1. **连接到双亲站流:** 要查看婴儿站流,请转到 Gonimo 家族中的其他设备 - 这是双亲站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个活跃的婴儿站将是一个短时连接按钮。选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 + 1. **连接到双亲站流:** 要查看婴儿站流,请转到 Gonimo 家族中的其他设备 - 这是双亲站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个活跃的婴儿站将是一个短时连接按钮。选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 ![Select parent station][12] @@ -82,17 +82,17 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 - * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! + * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! - * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 + * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 - * **多户:** 单个设备也可以是几个系列的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与 Granny's 或 Uncle John 的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 + * **多户:** 单个设备也可以是几个系列的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与 Granny's 或 Uncle John 的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 -### 想要参加吗? +### 想要参加吗? Gonimo 团队喜欢开源。社区代码,社区代码。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。 From 10e1a2e233ff51c0fdb4c9a099fd16fc464c5cbc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 22:47:58 +0800 Subject: [PATCH 0449/4278] PRF:20180625 8 reasons to use the Xfce Linux desktop environment.md @WangYueScream --- ... use the Xfce Linux desktop environment.md | 60 ++++++++----------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md index e625f12f5c..d2695cefb1 100644 --- a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ b/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -1,78 +1,66 @@ - - 使用 Xfce Linux 桌面环境的 8 个理由 ============================ +> 这个 Linux 桌面环境简洁而快速,十分优雅,可以很容易地弄清楚如何做事。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22) - 由于某些原因(也包括好奇),几周前我开始使用 [Xfce][1] 作为我的 Linux 桌面。促使我更换 Linux 桌面环境的原因之一是桌面相关的守护进程占据了我的性能非常强大的主工作站的绝大部分 CPU 资源和 I/O 带宽。当然,有些不稳定性可能是因为我删除了提供这些守护进程的 RPM 包。然而,事实是在我删除这些 RPM 包之前,KDE 就已经很不稳定了而且还导致了一系列其他方面的性能和稳定性问题。所以我需要换一个桌面来避免这些问题。 - 在回顾了我为 Linux 桌面所写的一系列文章后我才意识到我忽略了 Xfce。这篇文章也是力图能够纠正弥补这个疏忽。我非常喜欢 Xfce 也很享受它所带给我超乎预期的快速、轻量的体验。 - -作为研究的一部分,我有尝试过在 Google 上查询 Xfce 对应什么意思。有个历史参考是它对应着 XForms Common Environment,但 Xfce 早已不在使用 XForms 工具。几年前,我找到另一个参考是 "Xtra fine computing environment" 而且我也很喜欢这个解释。我将会用它作为 Xfce 的全称(尽管再也找不到这个参考页面)。 - +作为研究的一部分,我有尝试过在 Google 上查询 Xfce 对应什么意思。有个历史参考是它对应着 “XForms Common Environment”,但 Xfce 早已不在使用 XForms 工具。几年前,我找到另一个参考是 “Xtra fine computing environment” 而且我也很喜欢这个解释。我将会用它作为 Xfce 的全称(尽管再也找不到这个参考页面)。 ### 推荐 Xfce 的 8 个理由 - -#### 1\. 轻量级架构 +#### 1、轻量级架构 Xfce 相对于其他的桌面如 KDE 和 GNOME,不管是内存还是 CPU 的占用率都非常小。在我的系统中,组成 Xfce 桌面的程序仅占用了少量内存就构成一个如此强大的桌面。超低的 CPU 占用率也是 Xfce 桌面的一个特点。了解到 Xfce 内存占用特别低后,我对它的 CPU 占用率也非常低这个特性自然而言也就不感到奇怪了。 -#### 2\. 简洁 +#### 2、简洁 -Xfce 桌面很简单就像绒毛整洁的动物让人一目了然赏心悦目。基础的桌面有两个面板和一条在左边垂直的图标行。面板 0 是在底部并由一些基础的应用启动程序和能访问到系统里对应程序的图标组成。面板 1 是在顶部由一个应用程序启动器和一个能够允许用户在多个工作区之间来回切换的工作区切换器组成。面板可以通过补充项自定义修改比如增加个新的应用启动器或者更改它们的宽高。 +Xfce 桌面很简单,就像绒毛整洁的动物让人一目了然、赏心悦目。基础的桌面有两个面板和一条在左边垂直的图标行。面板 0 在底部,并由一些基础的应用启动程序和能访问到系统里对应程序的图标组成。面板 1 在顶部,由一个应用程序启动器和一个能够允许用户在多个工作区之间来回切换的工作区切换器组成。面板可以通过补充项自定义修改,比如增加个新的应用启动器或者更改它们的宽高。 -桌面左侧的图标对应是家目录和垃圾桶。它也可以显示其他的图标如完整的文件系统目录树和任意已连接上系统的可插拔的 USB 存储设备。这些图标可以用来挂载和卸载设备也可以用来打开默认的文件管理器。如果你愿意,它们都可以被隐藏同时文件系统,垃圾箱,家目录对应的图标都可以逐个控制管理。所有的可移动设备也可以被隐藏或作为一个组显示。 +桌面左侧的图标对应是家目录和垃圾桶。它也可以显示其他的图标,如完整的文件系统目录树和已连接上系统的可插拔的任意 USB 存储设备。这些图标可以用来挂载和卸载设备,也可以用来打开默认的文件管理器。如果你愿意,它们都可以被隐藏,同时文件系统、垃圾箱、家目录对应的图标都可以逐个控制管理。所有的可移动设备也可以被隐藏或作为一个组显示。 -#### 3\. 文件管理 +#### 3、文件管理 -作为 Xfce 的默认文件管理器 Thunar,它很简单,既易于使用和配置也非常容易学习。尽管它并不像其他的文件管理器比如 Konqueror 或者 Dolphin 那样效果华丽,但它很强大也很快。Thunar 并不能在一个窗口里面打开并产生多个窗口但它提供了选项卡来支持多个目录的同时打开。Thunar 也有一个非常漂亮的侧边栏就像桌面那样能够显示完整的文件系统目录树和所有已连接的 USB 存储设备。设备能够被挂载和卸载,可移动媒介如 CD 也能够被弹出。Thunar 也可以使用类似 Ark 这种帮助软件来在你点击归档文件的时候打开它们。比如 ZIP,TAR,RPM 这种归档文件都可以被浏览也可以从中复制单个文件。 +作为 Xfce 的默认文件管理器 Thunar,它很简单,既易于使用和配置也非常容易学习。尽管它并不像其他的文件管理器比如 Konqueror 或者 Dolphin 那样效果华丽,但它很强大也很快。Thunar 并不能在一个窗口里面打开多个面板,但它提供了选项卡来支持多个目录的同时打开。Thunar 也有一个非常漂亮的侧边栏,其上同样的图标就像桌面那样能够显示完整的文件系统目录树和所有已连接的 USB 存储设备。设备能够被挂载和卸载,可移动媒介如 CD 也能够被弹出。Thunar 也可以使用类似 Ark 这种帮助软件来在你点击归档文件的时候打开它们。比如 ZIP、TAR、RPM 这种归档文件都可以被浏览也可以从中复制单个文件。 ![Xfce desktop][3] -Xfce 桌面及 Thunar 和 Xfce 下的终端模拟器。 +*Xfce 桌面及 Thunar 和 Xfce 下的终端模拟器。* -在我的[文件管理器系列][4]一文中,我已经使用体验过很多不同的文件管理器软件,我不得不说 Thunar 的简单易用让你无法不喜欢上它。它很容易帮助你通过使用侧边栏来浏览文件系统。 +在我的[文件管理器系列][4]文章中,我已经使用体验过很多不同的文件管理器软件,我不得不说 Thunar 的简单易用让你无法不喜欢上它。它可以让你通过使用侧边栏来很容易地浏览文件系统。 +#### 4、稳定 -#### 4\. 稳定 +Xfce 桌面非常稳定。新版本的发布周期似乎是三年,但也会根据需要发布相关更新。最新的版本是于 2015 年 2 月发布的 4.12。在使用 KDE 遇到一系列问题后,稳如磐石的 Xfce 桌面环境显得让人格外放心。在我使用 Xfce 的过程中,它从来没有崩溃过,也不会产生额外的守护进程占据过多的系统资源。这正是我想要的:它安安静静地工作,不会给你带来额外的困扰。 -Xfce 桌面非常稳定。新版本的发布周期似乎是三年,但也会根据需要发布相关更新。最新的版本是于 2015 年 2 月发布的 4.12。在使用 KDE 遇到一系列问题后稳如磐石的 Xfce 桌面环境显得让人格外放心。在我使用 Xfce 的过程中,它从来没有崩溃过,也不会产生额外的守护进程占据过多的系统资源。这正是我想要的—它安安静静地工作,不会给你带来额外的困扰。 +#### 5、优雅 +Xfce 简单优雅。在我的今年秋天将面世的新书《系统管理员的 Linux 哲学》中我谈到了关于简单的一系列好处,包括简单事实上也是优雅的诸多标志之一。很明确能够确定的就是 Xfce 及相关组件程序的开发者和维护者也是极力推崇简单至上。这种简单特性很可能也是 Xfce 如此稳定的主要原因,但它也给用户带来了一个整洁的桌面外观,一个反应灵敏的操作界面,一个会让人感觉很自然也很易用的导航结构,而且 Xfce 整体上的优雅特性也会让用户的使用过程中充满愉悦感。 -#### 5\. 优雅 +#### 6、终端仿真程序 -Xfce 简单优雅。在我的新书,The Linux Philosophy for SysAdmins 中我谈到了关于简单的一系列好处包括事实上简单也是优雅的诸多标志之一。很明确能够确定的就是 Xfce 及相关组件程序的开发者和维护者也是极力推崇简单至上。这种简单特性很可能也是 Xfce 如此稳定的主要原因,但它也用户带来了一个整洁的桌面外观,一个反应灵敏的操作界面,一个会让人感觉很自然也很易用的导航结构,而且 Xfce 整体上的优雅特性也会让用户的使用过程中充满愉悦感。 - - -#### 6\. 终端仿真程序 - -Xfce4 的终端仿真程序非常强大而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix,Terminator,Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如 `host1==>host2==>host3==>host4` 准确地在选项卡显示了 `host4`。但其他的终端仿真程序最多也就显示 `host2`。 +Xfce4 的终端仿真程序非常强大,而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix、Terminator、Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如,从 host1==>host2==>host3==>host4,会准确地在选项卡显示了 “host4”。但其他的终端仿真程序最多也就显示 “host2”。 至于这个终端仿真程序功能和外观的其他方面都可以根据你的需要很容易配置成你想要的。当然同 Xfce 的其他组件一样,这款终端仿真程序占用了系统资源的很少一部分。 +#### 7、可配置性 -#### 7\. 可配置性 +Xfce 能够配置的范围极大。虽然 Xfce 桌面的可配置性比不上 KDE,但依旧远超 GNOME,而且比它更容易配置。比如,我发现设置管理器是 Xfce 配置一切的入口。虽然每个配置程序都可以单独使用,但是设置管理器把他们都放在一个窗口里以便快速访问。关于 Xfce 桌面很多重要的部分都可以通过配置来满足我的需求。 -Xfce 能够配置的范围极大。虽然 Xfce 桌面的可配置性比不上 KDE,但依旧远超 GNOME 了而且比它更容易配置。比如,我发现设置管理器是 Xfce 配置一切的入口。虽然每个配置程序都可以单独使用,但是设置管理器把他们都放在一个窗口里以便快速访问。关于 Xfce 桌面很多重要的部分都可以通过配置来满足我的需求。 +#### 8、模块化 +Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌面发行版中也未必安装了 Xfce 的所有组件。[Xfce 项目][5] 的主页列出了主要的项目,所以你可以根据需要安装你想安装的附加组件。比如在我的 Fedora 28 workstation 版本上我安装的 Xfce 组时就没有 [Xfce 项目][5] 主页最下面的说明的一些程序。 -#### 8\. 模块化 - -Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌面发行版中也未必安装了 Xfce 的所有组件。[Xfce's projects][5] 的主页列出了主要的项目,所以你可以根据需要安装你想安装的额外组件。比如在我的 Fedora 28 workstation 版本上我安装的 Xfce 桌面就没有 [Xfce's projects][5] 页最下面的说明的一些程序。 - -这里还有个关于 Xfce 的 [documentation page][6] 和 一个被称为 [Xfce Goodies Project][7] 的 wiki 列举了其他的 Xfce 相关的项目,它们为 Xfce 的面板 及 Thunar 提供了很多不错的应用程序,精美的插图,好用的插件。 - +这里还有个关于 Xfce 的 [文档页面][6] 和 一个被称为 [Xfce 超值项目][7] 的 wiki 列举了其他的 Xfce 相关的项目,它们为 Xfce 的面板及 Thunar 提供了很多不错的应用程序、精美的插图、好用的插件。 ### 总结 -整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易清楚如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和 内存资源。这也使得 Xfce 非常适合那种由于硬件有限无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大能够满足高级用户的需要。 +整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易清楚如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和内存资源。这也使得 Xfce 非常适合那种由于硬件有限而无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大的,能够满足高级用户的需要。 -我已经了解到更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置—比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。 +我知道,更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置:比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。 我觉得切换 Linux 的桌面环境就像我在工作中换个办公工位或者办公室一样。别人把我的东西装箱从旧办公室搬到新办公室,然后我在我的新办公室里组装连接好我的电脑,打开箱子再把里面的东西放在合适的位置。而切换到 Xfce 桌面大概就是我做过的最简单省事容易的桌面环境更换了。 @@ -84,7 +72,7 @@ via: https://opensource.com/article/18/6/xfce-desktop 作者:[David Both][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[WangYueScream](https://github.com/WangYueScream) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2e691e9617c3aaa86e5c5d903ab37102c755d94a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 22:50:35 +0800 Subject: [PATCH 0450/4278] PUB:20180625 8 reasons to use the Xfce Linux desktop environment.md @WangYueScream https://linux.cn/article-10413-1.html --- ...625 8 reasons to use the Xfce Linux desktop environment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20180625 8 reasons to use the Xfce Linux desktop environment.md (95%) diff --git a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/published/20180625 8 reasons to use the Xfce Linux desktop environment.md similarity index 95% rename from translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md rename to published/20180625 8 reasons to use the Xfce Linux desktop environment.md index d2695cefb1..a208e10d90 100644 --- a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ b/published/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -1,6 +1,6 @@ 使用 Xfce Linux 桌面环境的 8 个理由 ============================ -> 这个 Linux 桌面环境简洁而快速,十分优雅,可以很容易地弄清楚如何做事。 +> 整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易地知道如何做好一件事。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22) @@ -58,7 +58,7 @@ Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌 ### 总结 -整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易清楚如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和内存资源。这也使得 Xfce 非常适合那种由于硬件有限而无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大的,能够满足高级用户的需要。 +整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易地知道如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和内存资源。这也使得 Xfce 非常适合那种由于硬件有限而无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大的,能够满足高级用户的需要。 我知道,更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置:比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。 From f2301723c535be0998d9715e68c54c37d01ca568 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 22:51:45 +0800 Subject: [PATCH 0451/4278] PRF:20180625 8 reasons to use the Xfce Linux desktop environment.md --- ...80625 8 reasons to use the Xfce Linux desktop environment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180625 8 reasons to use the Xfce Linux desktop environment.md b/published/20180625 8 reasons to use the Xfce Linux desktop environment.md index a208e10d90..bec72ea941 100644 --- a/published/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ b/published/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -42,7 +42,7 @@ Xfce 简单优雅。在我的今年秋天将面世的新书《系统管理员的 #### 6、终端仿真程序 -Xfce4 的终端仿真程序非常强大,而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix、Terminator、Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如,从 host1==>host2==>host3==>host4,会准确地在选项卡显示了 “host4”。但其他的终端仿真程序最多也就显示 “host2”。 +Xfce4 的终端仿真程序非常强大,而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix、Terminator、Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如,从 host1=>host2=>host3=>host4,会准确地在选项卡显示了 “host4”。但其他的终端仿真程序最多也就显示 “host2”。 至于这个终端仿真程序功能和外观的其他方面都可以根据你的需要很容易配置成你想要的。当然同 Xfce 的其他组件一样,这款终端仿真程序占用了系统资源的很少一部分。 From 99e08016023233f09b58f607728c6d868113cbbc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 23:24:41 +0800 Subject: [PATCH 0452/4278] =?UTF-8?q?PRF:20181210=20McFly=20-=20A=20Replac?= =?UTF-8?q?ement=20To=20=E2=80=98Ctrl-R-=20Bash=20History=20Search=20Featu?= =?UTF-8?q?re.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @FSSlc --- ...To ‘Ctrl-R- Bash History Search Feature.md | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md index 5031edc985..a880ef1cf3 100644 --- a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md +++ b/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -1,19 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (FSSlc) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) [#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -McFly – Bash 历史命令搜索特性的一个替代品 +McFly:利用神经网络为 Bash 提供历史命令搜索功能 ====== + ![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png) -假如你在命令行模式下花费过很长时间,那么你必定使用过或者听说过 BASH 的 **反向搜索** 功能,在 Bash 中执行反向搜索功能的快捷键是 **Ctrl+r**。通过使用这个特性,我们可以找到我们执行过的命令而无需再次输入它们。当然,你可以使用上下键来搜索你的 bash 命令记录,但使用 Ctrl+r 快捷键可以让这个搜索过程更简单快速。今天我找寻到了 Bash 历史命令搜索特性 ‘Ctrl+r’ 的一个替代品,它就是 **“McFly”**。McFly 是一个使用 **Rust** 编程语言写就的简洁工具,自带一个智能的搜索引擎,用来替换默认的 Ctrl+r 这个 Bash 历史命令搜索特性。 McFly 提供的命令建议都是通过一个小巧的 **神经网络** 来实时排序给出的。 +假如你在命令行模式下渡过了很长时间,那么你必定使用过或者听说过 BASH 的 **反向搜索** 功能,在 Bash 中执行反向搜索功能的快捷键是 `Ctrl+r`。通过使用这个特性,我们可以找到我们执行过的命令而无需再次输入它们。当然,你可以使用上下键来搜索你的 bash 命令记录,但使用 `Ctrl+r` 快捷键可以让这个搜索过程更简单快速。今天我找寻到了 Bash 历史命令搜索特性 `Ctrl+r` 的一个替代品,它就是 McFly。McFly 是一个使用 Rust 编程语言写就的简洁工具,自带一个智能的搜索引擎,用来替换默认的 `Ctrl+r` 这个 Bash 历史命令搜索功能。 McFly 提供的命令建议都是通过一个小巧的 **神经网络** 来实时排序给出的。 -McFly 重新绑定了 Ctrl+r 快捷键,可以从你的 Bash 历史命令中找到所有最近执行过的命令。它通过追溯下面的信息来增强你的 shell 历史命令搜索特性: +McFly 重新绑定了 `Ctrl+r` 快捷键,可以从你的 Bash 历史命令中找到所有最近执行过的命令。它通过追溯下面的信息来增强你的 shell 历史命令搜索特性: * 命令结束状态 * 当你运行命令时的时间戳 @@ -34,9 +35,9 @@ McFly 维护着你的默认 Bash 历史文件,所以你可以随时停止使 ### 安装 McFly -在 Linux 中,McFly 可以使用 Linuxbrew 来安装。如若你还没有安装过 Linuxbrew,那么你可以参考下面的这个链接。(译者注:从其github 主页了解到也可以下载其二进制来使用。) +在 Linux 中,McFly 可以使用 Linuxbrew 来安装。如若你还没有安装过 Linuxbrew,那么你可以参考下面的这个链接。(LCTT 译注:从其 [GitHub 主页](https://github.com/cantino/mcfly)了解到也可以下载其二进制来使用。) -[Linuxbrew —— 一个使用 Linux 和 Mac OS X 的通用包管理][1] +- [Linuxbrew:一个用于 Linux 和 Mac OS X 的通用包管理][1] 一旦安装好了 Linuxbrew,运行下面的命令来安装 McFly: @@ -62,9 +63,10 @@ fi ``` ![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png) + 正如你上面看到的那样,在使用 McFly 之前我们需要再做一些配置。 -将下面几行添加到你的 **~/.bashrc** 文件中: +将下面几行添加到你的 `~/.bashrc` 文件中: ``` if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then @@ -88,7 +90,7 @@ McFly: Importing Bash history for the first time. This may take a minute or two. ### 使用方法 -要在你的命令中执行搜索,只需要键入 ‘mcfly search’ 再加上命令名的一部分,最后敲击 ENTER 键即可。Mcfly 将会基于你刚才键入的搜索查询语句给出命令建议。 +要在你的命令历史中执行搜索,只需要键入 `mcfly search` 再加上命令名的一部分,最后敲击回车键即可。Mcfly 将会基于你刚才键入的搜索查询语句给出命令建议。 ``` $ mcfly search @@ -104,7 +106,7 @@ $ mcfly search mk ![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png) -如你所见,我已经使用过 'mkdir' 这个命令两次。假如你想从这些命令建议中执行其中之一,只需使用上下键来选择它,然后敲击 ENTER 键来执行它就可以了。假如你想编辑其中一个命令,则需要先选择它,然后敲 **TAB** 键将这个命令放置到终端中,最后在运行它之前更改它就行了。要从历史中删除已经选择的命令,按 **F2** 即可。 +如你所见,我已经使用过 `mkdir` 这个命令两次。假如你想从这些命令建议中执行其中之一,只需使用上下键来选择它,然后敲击**回车键**来执行它就可以了。假如你想编辑其中一个命令,则需要先选择它,然后敲 `TAB` 键将这个命令放置到终端中,最后在运行它之前更改它就行了。要从历史中删除已经选择的命令,按 `F2` 即可。 或者,输入下面的命令来打开历史搜索,然后输入任意一个命令或者命令的一部分来从你的历史命令中查看它提供的建议。 @@ -115,6 +117,7 @@ $ mcfly search 在你输入的同时, McFly 将会展示命令的提示。 下面是一个介绍 McFly 的简短演示视频: + ![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif) 你还可以使用下面的命令来查看帮助: @@ -133,11 +136,11 @@ $ brew uninstall mcfly $ brew untap cantino/mcfly ``` -最后,移除先前添加到 **~/.bashrc** 文件中的几行命令。 +最后,移除先前添加到 `~/.bashrc` 文件中的几行命令。 好了,这些就是所有了,更多精彩内容敬请期待,请保存关注! -Cheers! +干杯! -------------------------------------------------------------------------------- @@ -146,7 +149,7 @@ via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search- 作者:[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 4d08819ef9519fd9a95aa47fc42834251b0d244b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 23:25:50 +0800 Subject: [PATCH 0453/4278] =?UTF-8?q?PUB:20181210=20McFly=20-=20A=20Replac?= =?UTF-8?q?ement=20To=20=E2=80=98Ctrl-R-=20Bash=20History=20Search=20Featu?= =?UTF-8?q?re.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @FSSlc https://linux.cn/article-10414-1.html --- ...- A Replacement To ‘Ctrl-R- Bash History Search Feature.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md (98%) diff --git a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md similarity index 98% rename from translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md rename to published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md index a880ef1cf3..86f4e297c3 100644 --- a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md +++ b/published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (FSSlc) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10414-1.html) [#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) [#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From cae0218d113ef647625d772b297a872539c691ff Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 00:15:14 +0800 Subject: [PATCH 0454/4278] PRF:20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @qhwdw --- ... 5- Moving Subkeys to a Hardware Device.md | 173 ++++++++---------- 1 file changed, 77 insertions(+), 96 deletions(-) diff --git a/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md index 8dadad1193..cd72ae600a 100644 --- a/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md +++ b/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @@ -1,159 +1,141 @@ 用 PGP 保护代码完整性(五):将子密钥移到一个硬件设备中 ====== +> 在这个系列教材中,将为你提供使用 PGP 和保护你的私钥的最佳体验。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pgp-keys.jpg?itok=aS6IWGpq) 在本系列教程中,我们将提供一个使用 PGP 的实用指南。如果你没有看过前面的文章,你可以通过下面的链接去查看。在这篇文章中,我们将继续讨论如何保护你的密钥,谈一谈将你的子密钥移到一个专门的硬件设备中的一些技巧。 -[第一部分:基本概念和工具][1] +- [第一部分:基本概念和工具][1] +- [第二部分:生成你的主密钥][2] +- [第三部分:生成 PGP 子密钥][3] +- [第四部分:将主密钥移到离线存储中][4] -[第二部分:生成你的主密钥][2] - -[第三部分:生成 PGP 子密钥][3] - -[第四部分:将主密钥移到离线存储中][4] - -### 清单 +#### 清单 * 取得一个 GnuPG 兼容的硬件设备(必要) - * 配置 GnuPG 在设备上工作(必要) - - * 设置 user 和 admin 的 PIN(必要) - + * 设置用户和管理员的 PIN(必要) * 移动子密钥到设备中(必要) +#### 考虑事项 - - -### 考虑事项 - -虽然现在主密钥已经不用担心泄露或失窃了,但子密钥仍然在你的 Home 目录中。任何得到它的人都能够解密你的通讯或假冒你的签名(如果他们知道密钥的密码)。并且,每次执行一个 GnuPG 操作都要将密钥加载到操作系统内存中,这将使一些更高级的恶意软件有机会得到你的密钥(想想 Meltdown 和 Spectre)。 +虽然现在主密钥已经不用担心泄露或失窃了,但子密钥仍然在你的家目录中。任何得到它的人都能够解密你的通讯或假冒你的签名(如果他们知道密钥的密码)。并且,每次执行一个 GnuPG 操作都要将密钥加载到操作系统内存中,这将使一些更高级的恶意软件有机会得到你的密钥(想想 Meltdown 和 Spectre)。 完全保护密钥的最好方式就是,将它移到一个专门的硬件设备中,这种硬件设备是一个可操作的智能卡。 -#### 智能卡的好处 +##### 智能卡的好处 一个智能卡包含一个加密芯片,它能够存储私钥,并且直接在智能卡内部执行秘密操作。因为密钥内容从来没有离开过智能卡,计算机操作系统并不能检索你插入的智能卡上的私钥。这与前面用于备份目的的加密 USB 存储是不同的 —— 虽然 USB 设备也是插入并解密的,但操作系统是能够去访问私钥内容的。使用外置的加密 USB 介质并不能代替智能卡设备的功能。 智能卡的一些其它好处: * 它们很便宜且易于获得 - * 它们小巧且易于携带 - * 它们可以用于多种设备上 - * 它们中的很多都具有防篡改功能(取决于制造商) - - - #### 可用的智能卡设备 -智能卡最初是嵌入到真实钱包大小的卡中,故而得名智能卡。你总是可以买到并使用 GnuPG 功能的智能卡,并且它们是你能得到的最便宜的可用设备之一。但是,事实上智能卡有一个很重要的缺点:它们需要一个智能卡读卡器,只有极小数的笔记本电脑上有这种读卡器。 +智能卡最初是嵌入到真实钱包大小的卡中,故而得名智能卡。你肯定可以买到并使用 GnuPG 功能的智能卡,并且它们是你能得到的最便宜的可用设备之一。但是,事实上智能卡有一个很重要的缺点:它们需要一个智能卡读卡器,只有极小数的笔记本电脑上有这种读卡器。 由于这个原因,制造商开始推出小型 USB 设备,它的大小和 U 盘类似,内置有微型智能卡,并且在芯片上简单地实现了智能卡协议特性。下面推荐几个这样的设备: * [Nitrokey Start][5]:开源硬件和自由软件,可用于 GnuPG 的最便宜的选择之一,但是额外的安全特性很少。 - * [Nitrokey Pro][6]:类似于 Nitrokey Start,它提供防篡改及更多的安全特性(但没有 U2F,具体查看指南的 U2F 节)。 - * [Yubikey 4][7]:专利硬件和软件,但比 Nitrokey Pro 便宜,并且可以用在最新的笔记本电脑上的 USB-C 接口;也提供像 U2F 这样的额外的安全特性。 - - - 我们推荐选一个同时具备智能卡功能和 U2F 的设备,在写这篇文章时,只能选择 Yubikey 4。 #### 配置智能卡设备 你的智能卡设备插入任何一台现代的 Linux 或 Mac 工作站上都应该能正常工作。你可以通过运行如下的命令去验证它: + ``` $ gpg --card-status - ``` 如果你没有收到错误,有一个完整的卡列表,就表示一切正常。不幸的是,排除为什么设备不能正常工作的所有可能原因,已经超出了本指南的范围。如果你的智能卡使用 GnuPG 时有问题,请通过你的操作系统的常见支持通道寻求支持。 ##### PIN 不一定是数字 -注意,尽管名为 “PIN”(暗示你它必须是一个“数字”),不论是 user PIN 还是 admin PIN 都不必非要是数字。 +注意,尽管名为 “PIN”(暗示你它必须是一个“数字”),不论是用户 PIN 还是管理员 PIN 都不必非要是数字。 -当你收到一个新设备时,它可能设置有一个默认的 user 和 admin PIN,对于 Yubikeys,它分别是 123456 和 12345678。如果它们的 PIN 不是默认的,请查看设备附带的说明书。 +当你收到一个新设备时,它可能设置有一个默认的用户和管理员 PIN,对于 Yubikey,它分别是 `123456` 和 `12345678`。如果它们的 PIN 不是默认的,请查看设备附带的说明书。 ##### 快速设置 为配置你的智能卡,你需要使用 GnuPG 菜单系统,因此这里并没有更方便的命令行开关: + ``` $ gpg --card-edit [...omitted...] gpg/card> admin Admin commands are allowed gpg/card> passwd - ``` -你应该去设置 user PIN (1)、admin PIN (3)、和 Reset Code (4)。请确保把它们记录并保存到一个安全的地方 —— 尤其是 Admin PIN 和 Reset Code(它允许你去擦除整个智能卡内容)。你很少使用到 Admin PIN,因此如果你不记录下来,很可能会忘掉它。 +你应该去设置用户 PIN (1)、管理员 PIN (3)、和重置码 (4)。请确保把它们记录并保存到一个安全的地方 —— 尤其是管理员 PIN 和重置码(它允许你去擦除整个智能卡内容)。你很少使用到管理员 PIN,因此如果你不记录下来,很可能会忘掉它。 返回到智能卡主菜单,你也可以设置其它值(比如名字、性别、登入日期、等等),但是这些都不是必需的,一旦你的智能卡丢失了,将导致额外的信息泄露。 #### 将子密钥移到你的智能卡中 -退出卡菜单(使用 “q” 命令)保存所有更改。接下来,我们将你的子密钥移到智能卡中。将需要用到你的 PGP 密钥的密码,在大多数的智能卡操作中都将用到 admin PIN。记住,那个 [fpr] 表示你的密钥的完整的 40 个字符的指纹。 +退出卡菜单(使用 `q` 命令)保存所有更改。接下来,我们将你的子密钥移到智能卡中。将需要用到你的 PGP 密钥的密码,在大多数的智能卡操作中都将用到管理员 PIN。记住,那个 `[fpr]` 表示你的密钥的完整的 40 个字符的指纹。 + ``` $ gpg --edit-key [fpr] Secret subkeys are available. -pub rsa4096/AAAABBBBCCCCDDDD - created: 2017-12-07 expires: 2019-12-07 usage: C - trust: ultimate validity: ultimate -ssb rsa2048/1111222233334444 - created: 2017-12-07 expires: never usage: E -ssb rsa2048/5555666677778888 - created: 2017-12-07 expires: never usage: S +pub rsa4096/AAAABBBBCCCCDDDD + created: 2017-12-07 expires: 2019-12-07 usage: C + trust: ultimate validity: ultimate +ssb rsa2048/1111222233334444 + created: 2017-12-07 expires: never usage: E +ssb rsa2048/5555666677778888 + created: 2017-12-07 expires: never usage: S [ultimate] (1). Alice Engineer -[ultimate] (2) Alice Engineer +[ultimate] (2) Alice Engineer gpg> - ``` -使用 --edit-key 再次进入到菜单模式,你将注意到那个密钥清单有一点小差别。从现在开始,所有的命令都是在这个菜单模式下运行,它用 gpg> 提示符来表示。 +使用 `--edit-key` 再次进入到菜单模式,你将注意到那个密钥清单有一点小差别。从现在开始,所有的命令都是在这个菜单模式下运行,它用 `gpg>` 提示符来表示。 首先,我们来选择移到智能卡中的密钥 —— 你可以通过键入 `key 1`(它表示选择清单中的第一个密钥)来实现: + ``` gpg> key 1 - ``` 这个输出会有一点细微的差别: + ``` -pub rsa4096/AAAABBBBCCCCDDDD - created: 2017-12-07 expires: 2019-12-07 usage: C - trust: ultimate validity: ultimate +pub rsa4096/AAAABBBBCCCCDDDD + created: 2017-12-07 expires: 2019-12-07 usage: C + trust: ultimate validity: ultimate ssb* rsa2048/1111222233334444 - created: 2017-12-07 expires: never usage: E -ssb rsa2048/5555666677778888 - created: 2017-12-07 expires: never usage: S + created: 2017-12-07 expires: never usage: E +ssb rsa2048/5555666677778888 + created: 2017-12-07 expires: never usage: S [ultimate] (1). Alice Engineer -[ultimate] (2) Alice Engineer - +[ultimate] (2) Alice Engineer ``` -注意与密钥对应的 ssb 行旁边的 `*` —— 它表示这是当前选定的密钥。它是可切换的,意味着如果你再次输入 `key 1`,这个 `*` 将消失,这个密钥将不再被选中。 +注意与密钥对应的 `ssb` 行旁边的 `*` —— 它表示这是当前选定的密钥。它是可切换的,意味着如果你再次输入 `key 1`,这个 `*` 将消失,这个密钥将不再被选中。 现在,我们来将密钥移到智能卡中: + ``` gpg> keytocard Please select where to store the key: - (2) Encryption key + (2) Encryption key Your selection? 2 - ``` -由于它是我们的 [E] 密钥,把它移到加密区中是有很有意义的。当你提交了你的选择之后,将会被提示输入你的 PGP 密钥的保护密码,接下来输入智能卡的 admin PIN。如果命令没有返回错误,表示你的密钥已经被移到智能卡中了。 +由于它是我们的 [E] 密钥,把它移到加密区中是有很有意义的。当你提交了你的选择之后,将会被提示输入你的 PGP 密钥的保护密码,接下来输入智能卡的管理员 PIN。如果命令没有返回错误,表示你的密钥已经被移到智能卡中了。 **重要:** 现在再次输入 `key 1` 去取消选中第一个密钥,并输入 `key 2` 去选择 [S] 密钥: @@ -162,42 +144,41 @@ gpg> key 1 gpg> key 2 gpg> keytocard Please select where to store the key: - (1) Signature key - (3) Authentication key + (1) Signature key + (3) Authentication key Your selection? 1 - ``` -你可以使用 [S] 密钥同时做签名和验证,但是我们希望确保它在签名区,因此,我们选择 (1)。完成后,如果你的命令没有返回错误,表示操作已成功。 +你可以使用 [S] 密钥同时做签名和验证,但是我们希望确保它在签名区,因此,我们选择 (`1`)。完成后,如果你的命令没有返回错误,表示操作已成功。 + +最后,如果你创建了一个 [A] 密钥,你也可以将它移到智能卡中,但是你需要先取消选中 `key 2`。完成后,选择 `q`: -最后,如果你创建了一个 [A] 密钥,你也可以将它移到智能卡中,但是你需要先取消选中 `key 2`。完成后,选择 “q": ``` gpg> q Save changes? (y/N) y - ``` -保存变更将把你的子密钥移到智能卡后,把你的 Home 目录中的相应子密钥删除(没有关系,因为我们的备份中还有,如果更换了智能卡,你需要再做一遍)。 +保存变更将把你的子密钥移到智能卡后,把你的家目录中的相应子密钥删除(没有关系,因为我们的备份中还有,如果更换了智能卡,你需要再做一遍)。 ##### 验证移动后的密钥 现在,如果你执行一个` --list-secret-keys` 操作,你将看到一个稍有不同的输出: + ``` $ gpg --list-secret-keys -sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] - 111122223333444455556666AAAABBBBCCCCDDDD -uid [ultimate] Alice Engineer -uid [ultimate] Alice Engineer -ssb> rsa2048 2017-12-06 [E] -ssb> rsa2048 2017-12-06 [S] - +sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] + 111122223333444455556666AAAABBBBCCCCDDDD +uid [ultimate] Alice Engineer +uid [ultimate] Alice Engineer +ssb> rsa2048 2017-12-06 [E] +ssb> rsa2048 2017-12-06 [S] ``` -在 ssb> 的输出中的 `>` 表示子密钥仅在智能卡上有效。如果你进入到你的密钥目录中,查看目录的内容,你将会看到那个 `.key` 文件已经被存根替换: +在 `ssb>` 的输出中的 `>` 表示子密钥仅在智能卡上有效。如果你进入到你的密钥目录中,查看目录的内容,你将会看到那个 `.key` 文件已经被存根替换: + ``` $ cd ~/.gnupg/private-keys-v1.d $ strings *.key - ``` 这个输出将包含一个影子私钥,它表示那个文件仅是个存根,真正的内容在智能卡中。 @@ -205,29 +186,29 @@ $ strings *.key #### 验证智能卡的功能 验证智能卡能否如期正常运行,你可以通过创建一个签名来验证: + ``` $ echo "Hello world" | gpg --clearsign > /tmp/test.asc $ gpg --verify /tmp/test.asc - ``` -首次运行这个命令时将询问你智能卡的 PIN,在你运行 `gpg —verify` 之后,它将显示 "Good signature”。 +首次运行这个命令时将询问你智能卡的 PIN,在你运行 `gpg —verify` 之后,它将显示 “Good signature”。 祝贺你,你已经成功将窃取你的开发者数字身份变得更加困难了! -### 其它常见 GnuPG 操作 +#### 其它常见 GnuPG 操作 下面是使用你的 PGP 密钥需要做的一些常见操作的快速指南。 -在下面的所有命令中,[fpr] 表示你的密钥指纹。 +在下面的所有命令中,`[fpr]` 表示你的密钥指纹。 -#### 挂载主密钥离线存储 +##### 挂载主密钥离线存储 + +下面的一些操作将需要你的主密钥,因此首先需要去挂载你的主密钥离线存储,并告诉 GnuPG 去使用它。首先,找出介质挂载路径,可以通过查看 `mount` 命令的输出找到它。接着,设置你的 GnuPG 目录为你的介质上备份的目录,并告诉 GnuPG 将那个目录做为它的家目录: -下面的一些操作将需要你的主密钥,因此首先需要去挂载你的主密钥离线存储,并告诉 GnuPG 去使用它。首先,找出介质挂载路径,可以通过查看 mount 命令的输出找到它。接着,设置你的 GnuPG 目录为你的介质上备份的目录,并告诉 GnuPG 将那个目录做为它的 Home: ``` $ export GNUPGHOME=/media/disk/name/gnupg-backup $ gpg --list-secret-keys - ``` 确保你在输出中看到的是 `sec` 而不是 `sec#`(这个 `#` 表示密钥不可用,仍然使用的是惯常的那个 Home 目录)。 @@ -235,53 +216,53 @@ $ gpg --list-secret-keys ##### 更新你惯常使用的那个 GnuPG 工作目录 在你的离线存储上做了任何更改之后,你应该将这些更改同步应用到你惯常使用的工作目录中: + ``` $ gpg --export | gpg --homedir ~/.gnupg --import $ unset GNUPGHOME - ``` -#### 延长密钥过期日期 +##### 延长密钥过期日期 我们创建的主密钥的默认过期日期是自创建之日起两年后。这样做都是为安全考虑,这样将使淘汰密钥最终从密钥服务器上消失。 延长你的密钥过期日期,从当前日期延长一年,只需要运行如下命令: + ``` $ gpg --quick-set-expire [fpr] 1y - ``` 如果为了好记住,你也可以使用一个特定日期(比如,你的生日、1 月 1 日、或加拿大国庆日): + ``` $ gpg --quick-set-expire [fpr] 2020-07-01 - ``` 记得将更新后的密钥发送到密钥服务器: + ``` $ gpg --send-key [fpr] - ``` -#### 吊销身份 +##### 吊销身份 如果你需要吊销一个身份(比如,你换了雇主并且旧的邮件地址不再有效了),你可以使用一行命令搞定: + ``` $ gpg --quick-revoke-uid [fpr] 'Alice Engineer ' - ``` 你也可以通过使用 `gpg --edit-key [fpr]` 在菜单模式下完成同样的事情。 完成后,记得将更新后的密钥发送到密钥服务器上: + ``` $ gpg --send-key [fpr] - ``` 下一篇文章中,我们将谈谈 Git 如何支持 PGP 的多级别集成。 -通过来自 Linux 基金会和 edX 的免费课程 [“Linux 入门" ][8]学习更多 Linux 知识。 +通过来自 Linux 基金会和 edX 的免费课程 [“Linux 入门”][8]学习更多 Linux 知识。 -------------------------------------------------------------------------------- @@ -289,15 +270,15 @@ via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-p 作者:[KONSTANTIN RYABITSEV][a] 译者:[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.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage +[1]:https://linux.cn/article-9524-1.html +[2]:https://linux.cn/article-9529-1.html +[3]:https://linux.cn/article-9607-1.html +[4]:https://linux.cn/article-10402-1.html [5]:https://shop.nitrokey.com/shop/product/nitrokey-start-6 [6]:https://shop.nitrokey.com/shop/product/nitrokey-pro-3 [7]:https://www.yubico.com/product/yubikey-4-series/ From 7b6aa3850c0d229239efcc33fdeae733b2b6734b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 00:15:33 +0800 Subject: [PATCH 0455/4278] PUB:20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @qhwdw https://linux.cn/article-10415-1.html --- ...rity with PGP - Part 5- Moving Subkeys to a Hardware Device.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md (100%) diff --git a/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/published/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md similarity index 100% rename from translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md rename to published/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md From 96c37b5d79250855be0329d0c82fe3821947a7ef Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 5 Jan 2019 10:22:02 +0800 Subject: [PATCH 0456/4278] Translating by qhwdw --- ...Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index f7d0af8187..a7a0707466 100644 --- a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9fc0d49c7e55500736b52846acd42bfa15e836d9 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 5 Jan 2019 11:38:07 +0800 Subject: [PATCH 0457/4278] Translated by qhwdw --- ...y - Raspberry Pi- Lesson 0 Introduction.md | 53 ------------------- ...y - Raspberry Pi- Lesson 0 Introduction.md | 53 +++++++++++++++++++ 2 files changed, 53 insertions(+), 53 deletions(-) delete mode 100644 sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md create mode 100644 translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md diff --git a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md deleted file mode 100644 index a7a0707466..0000000000 --- a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ /dev/null @@ -1,53 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) -[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) - -Computer Laboratory – Raspberry Pi: Lesson 0 Introduction -====== - -This introductory lesson does not contain a practical element, but exists to explain the basic concepts of what is an operating system, what is assembly code and other important basics. If you just want to get straight into practicals, it should be safe to skip this lesson. - -### 1 Operating Systems - -An operating system is just a very complicated program. It has the job of organising other programs on a computer, including sharing the computer's time, memory, hardware and other resources. Some big families of desktop operating systems that you may have heard of include GNU/Linux, Mac OS X and Microsoft Windows. Other devices also need operating systems such as phones, which may use operating systems such as Android, iOS and Windows Phone.[1] - -Since the operating system has to interact with the hardware on a computer system, it also has to have specific knowledge of the hardware on a system. To allow operating systems to be used on a variety of computers, the concept of **drivers** was invented. Drivers are small bits of code that can be added and removed from the operating system in order to allow the operating system to talk to a particular piece of hardware. In this course, we do not cover how to create such removable drivers, and instead focus on making specific ones for the Raspberry Pi. - -There are all kinds of different designs of operating systems, and this course can only just scratch the surface. In this course we will mainly focus on getting the operating system to interact with a variety of bits of hardware, as this is often the trickiest bit, and the part for which the least documentation and help exists online. - -### 2 Assembly Code - -``` -A processor can often perform millions of instructions per second, but they must be simple. -``` - -This course will be written almost exclusively in assembly code. Assembly code is code that is very close to what the computer understands. How a computer really works is that there is a small device called a processor which is capable of performing simple jobs like adding numbers, and there is a set of one or more microchips called the **RAM** which are capable of storing numbers. When a computer has power, the processor works through a sequence of instructions given to it by the programmer, which cause it to change numbers in the RAM, and interact with connected hardware. Assembly code is a translation into human readable text of those commands. - -When programming normally, the programmer writes code in a programming language such as C++, Java, C#, Basic, etc, and then a program called the compiler translates what the programmer wrote into assembly code, which is the further reduced into binary code[2]. Binary code is what the computer actually understands, but it is almost impossible for humans to read. Assembly code is much better, but it can be frustrating how few commands are possible. Remember that every command you write in assembly code is something that the processor understands directly, and so the commands are simple by design, as a physical circuit must process each one. - -![Compiler process][1] - -Just like with ordinary programming, there are many different assembly code languages, however unlike ordinary programming, the reason these exist is due to the fact that there exists many different processors, each designed to understand a different language. Thus a program written in assembly code for one machine, will not work on a different one. For most things, this would be a disaster as each program would have to be rewritten for every system it was used on, but for operating systems this isn't so much of a problem, as it would have to be rewritten anyway due to differing hardware. Nevertheless, most operating systems are written in C++ or C, so that they can be converted more easily, and only the sections that absolutely have to be written in assembly are. - -You're now ready to move on to the first lesson, [Lesson 1: OK01][2] - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html - -作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/compiling.png -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html diff --git a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md new file mode 100644 index 0000000000..8f4f6a4bcc --- /dev/null +++ b/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +计算机实验室 – 树莓派:课程 0:简介 +====== + +这个课程简介不包含实践内容,但它解释了一个操作系统的基本概念、汇编代码、和其它很重要的一些基本原理。如果你想直接进入实践环节,跳过本课程并不会有什么问题。 + +### 1、操作系统 + +一个操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话,也需要操作系统,它可能使用的操作系统是 Android、iOS 和 [Windows Phone][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note1] + +由于操作系统是用来与计算机系统上的硬件进行交互的,所以它必须有系统上硬件专有的内容。为了能让操作系统适用于各种类型的计算机,发明了 **驱动程序** 的概念。驱动程序是为了能够让操作系统与特定的硬件进行交互而添加(并可删除)到操作系统上的一小部分代码。在本课程中,我们并不涉及如何创建可删除的驱动程序,而是专注于特定的一个硬件:树莓派。 + +操作系统有各种不同的设计方式,在本课程中,我们只触及操作系统设计的皮毛。本课程中,我们主要专注于操作系统与各种硬件的交互部分,因为这经常是比较棘手的部分,并且也是在网络上文档和帮助最少的部分。 + +### 2、汇编代码 + +``` +一个处理器每秒可以执行上百万的指令,但是这些指令必须要简单。 +``` + +本课程几乎要完全靠汇编代码来写。汇编代码非常接近计算机的底层。计算机其实是靠一个叫处理器的设备来工作的,处理器能够执行像加法这样的简单任务,还有一组叫做 **RAM** 的芯片,它能够用来保存数字。当计算机通电后,处理器执行程序员给定的一系列指令,这将导致内存中的数字发生变化,以及与连接的硬件进行交互。汇编代码只是将这些机器命令转换为人类可读的文本。 + +常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic、等等来写代码,然后一个叫编译器的程序将程序员写的代码转换成汇编代码,然后进一步转换为[二进制代码][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note2]。二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。 + +![Compiler process][1] + +和普通编程一样,也有很多不同的汇编代码编程语言,但与普通编程不一样的是,每个汇编编程语言是面对不同的处理器的,每种处理器设计为去理解不同的语言。因此,用一个针对某种机器设计的汇编语言所写的汇编代码,是不能在其它种类的机器上运行的。很多情况下,这都是一个大灾难,因此每个程序都必须在使用它的不同种类的机器上重写一遍,但对于操作系统,这不是个问题,因为在不同的硬件上它必须得重写。尽管如此,大多数操作系统都是用 C++ 或 C 来写的,这样它们就可以很容易地在不同种类的硬件上使用,只需要重写那些必须用汇编代码来实现的部分即可。 + +现在,你已经准备好进入第一节课了,它是 [课程 1:OK01][2] + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/images/compiling.png +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html From 54537c1db23f165a3097835f482892a4be4a54a4 Mon Sep 17 00:00:00 2001 From: runningwater Date: Sat, 5 Jan 2019 15:11:59 +0800 Subject: [PATCH 0458/4278] Update 20170921 The Rise and Rise of JSON.md --- sources/talk/20170921 The Rise and Rise of JSON.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md index 5603c7bacf..f6d54edfc9 100644 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ b/sources/talk/20170921 The Rise and Rise of JSON.md @@ -1,3 +1,12 @@ +[#]: collector: (lujun9972) +[#]: translator: (runningwater) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (The Rise and Rise of JSON) +[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) +[#]: author: (https://twobithistory.org) +[#]: url: ( ) + The Rise and Rise of JSON ====== JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format. From 811f4483dbe0c45cef3a97e5d3838cf5674baf99 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 15:41:17 +0800 Subject: [PATCH 0459/4278] PRF:20181220 Let your Linux terminal speak its mind.md @zhs852 --- ...1220 Let your Linux terminal speak its mind.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181220 Let your Linux terminal speak its mind.md b/translated/tech/20181220 Let your Linux terminal speak its mind.md index cbf61034a6..b58a9cd2a2 100644 --- a/translated/tech/20181220 Let your Linux terminal speak its mind.md +++ b/translated/tech/20181220 Let your Linux terminal speak its mind.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Let your Linux terminal speak its mind) @@ -9,11 +9,12 @@ 让 Linux 终端说出它的想法 ====== + > eSpeak 是一个可在 Linux 命令行中使用的开源的 TTS 合成器。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) -欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你大概连什么是 Linux 命令行小玩具都不知道。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。 +欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你可能不知道什么是 Linux 命令行小玩具。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。 或许你已经对一些玩具有了解了,不过我们相信,在本系列文章中总有那么几个你没见过的玩意。 @@ -21,17 +22,17 @@ 我们也许永远不会忘记来自 [2001 太空漫游][1] 中与机组人员交流的 HAL 9000。但是在 1960 年代到今天的时间里,是存在着许多能说话的计算机的。它们有些很出色,也有些不那么出色。 -其中一个我最爱的是一个叫做 [eSpeak][2] 的开源项目。它以多种形式被发布,比如可以嵌入你自己项目中的库。与此同时,它也提供了可供你安装的命令行版本。在我所用的发行版中,安装十分简单,只需使用: +其中一个我最爱的是一个叫做 [eSpeak][2] 的开源项目。它以多种形式发布,比如可以嵌入你自己项目中的库。与此同时,它也提供了可供你安装的命令行版本。在我所用的发行版中,安装十分简单,只需使用: ``` $ sudo dnf install espeak ``` -你既可以与 eSpeak 交互,也可以用它来输出其它程序的信息,甚至通过简单的 echo 命令来使用它。[这里][3] 有一些可供 eSpeak 使用的声音文件,你可以在无聊时切换他们。甚者你可以制作一个属于你自己的声音。 +你既可以与 eSpeak 交互,也可以用它来输出其它程序的信息,甚至通过简单的 `echo` 命令来使用它。[这里][3] 有一些可供 eSpeak 使用的声音文件,你可以在无聊时切换他们。甚者你可以制作一个属于你自己的声音。 -在 2015 年,一些希望继续 eSpeak 开发的开发者创建了一个名为 eSpeak NG (即 "Next Generation",“下一代”的意思)的项目。eSpeak 目前在 GPL v3 许可证下开源,你可以在 [SourceForge][2] 上详细了解这个项目或下载源代码。 +在 2015 年,一些希望继续 eSpeak 开发的开发者创建了一个名为 eSpeak NG (即 “Next Generation”,“下一代”的意思)的项目。eSpeak 目前在 GPL v3 许可证下开源,你可以在 [SourceForge][2] 上详细了解这个项目或下载源代码。 -别急,我今天还会介绍一个额外的小程序,它叫 [cava][4]。我经常希望用一张独一无二的截图作为我文章的头图,更何况今天的玩具主要是关于声音的,导致图片更少了。因此,我需要一些东西来填补这些空白。Cava 是 "console-based audio visualizer for ALSA" (译注:基于 ALSA 的命令行音频可视化工具)(尽管它现在支持的比 ALSA 更多)的简写,它是一个优秀的命令行音频可视化工具,并且它正以 MIT 许可证开源。下面是一个将 eSpeak 输出可视化的命令: +别急,我今天还会介绍一个额外的小程序,它叫 [cava][4]。我经常希望用一张独一无二的截图作为我文章的头图,更何况今天的玩具主要是关于声音的,这就图片更少了。因此,我需要一些东西来填补这些空白。Cava 是基于 ALSA 的命令行音频可视化工具console-based audio visualizer for ALSA的简写(尽管它现在支持的比 ALSA 更多),它是一个优秀的命令行音频可视化工具,并且它正以 MIT 许可证开源。下面是一个将 eSpeak 输出可视化的命令: ``` $ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak @@ -50,7 +51,7 @@ via: https://opensource.com/article/18/12/linux-toy-espeak 作者:[Jason Baker][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 238f9506b64d183ae220f6354db902121812bce1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 15:42:25 +0800 Subject: [PATCH 0460/4278] PUB:20181220 Let your Linux terminal speak its mind.md @zhs852 https://linux.cn/article-10416-1.html --- .../20181220 Let your Linux terminal speak its mind.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181220 Let your Linux terminal speak its mind.md (98%) diff --git a/translated/tech/20181220 Let your Linux terminal speak its mind.md b/published/20181220 Let your Linux terminal speak its mind.md similarity index 98% rename from translated/tech/20181220 Let your Linux terminal speak its mind.md rename to published/20181220 Let your Linux terminal speak its mind.md index b58a9cd2a2..6a49dde11f 100644 --- a/translated/tech/20181220 Let your Linux terminal speak its mind.md +++ b/published/20181220 Let your Linux terminal speak its mind.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10416-1.html) [#]: subject: (Let your Linux terminal speak its mind) [#]: via: (https://opensource.com/article/18/12/linux-toy-espeak) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 5069157b50bdfcdd7e3ac37902b3890035424ba8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 20:42:34 +0800 Subject: [PATCH 0461/4278] PRF:20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lintaov587 恭喜你,完成了第一篇翻译。 --- ...free baby monitoring system with Gonimo.md | 87 +++++++------------ 1 file changed, 33 insertions(+), 54 deletions(-) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 95c495e814..f45bc72e28 100644 --- a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -1,108 +1,87 @@ 如何用 Gonimo 创建一个免费的婴儿监视系统 ====== +> 当你可以用两个设备、浏览器和网络连接就能免费搭建一个婴儿监视器时,谁还会花钱去买呢? + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE) -新父母和准父母很快就会知道将会有一个长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的免费的开源解决方案,为附近大型婴儿用品商店的过道中数以千计的其他必备或时尚物品中的任何一个腾出一些婴儿的预算。 +新父母和准父母很快就会知道将会有一个既长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的自由开源解决方案,附近大型婴儿用品商店的过道中有数以千计的其他必备或时尚物品,就可以为其中某一个腾出一些婴儿的预算。 Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: - * 现有硬件婴儿监视器价格昂贵,范围有限,需要您携带额外的设备。 - * 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 + * 现有硬件婴儿监视器价格昂贵,使用范围有限,需要您带着额外的设备。 + * 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,不太容易找到开源产品。 * 如果您有两个小孩(例如双胞胎),您将需要两台监视器,使您的成本翻倍。 - - -Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: +Gonimo 是作为一个解决典型的监视器的缺点的开源解决方案而创建的: * 昂贵?不,它是免费的! - * 范围有限?不,它适用于互联网 / WiFi,无论您身在何处。 + * 使用范围有限?不,它适用于互联网 / WiFi,无论您身在何处。 * 下载并安装应用程序?噢不,它适用于您现有的网络浏览器。 - * 购买新设备?不用,你可以使用任何笔记本电脑,手机或平板电脑与网络浏览器和麦克风和/或相机。 + * 购买新设备?不用,你可以使用任何笔记本电脑、手机或平板电脑与网络浏览器和麦克风和/或相机。 - - -(注意:遗憾的是,Apple iOS 设备尚不支持,但预计很快就会发生变化 - 请继续阅读,了解如何帮实现这一目标助。) +(注意:遗憾的是,Apple iOS 设备尚不支持,但预计很快就会发生变化 —— 请继续阅读,了解如何帮实现这一目标。) ### 开始 -将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome ),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问 Web 应用程序。 - - 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 - +将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome),访问 [gonimo.com][1] 并单击 “Start baby monitor” 以访问该 Web 应用程序。 +1、创建家庭:在首次启动的屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 “+” 按钮并接受随机生成的姓氏或键入您自己的选择。 ![Start screen][3] +*从开始屏幕创建一个新家庭* -从开始屏幕创建一个新家庭 - - 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 - - +2、邀请设备:建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到消息中。对其他设备,只需打开该链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 ![Invite screen][5] +*邀请家庭成员* -邀请家庭成员 - - 1. **启动婴儿站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击开始。该流现在处于活动状态。 - - +3、启动婴儿站流:接下来,通过转到 [Gonimo 主屏][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击“Start”。该流现在处于活动状态。 ![Select baby station][8] - -选择婴儿站 +*选择婴儿站* ![Press Start][10] +*按“Start”开始以流式传输视频* -按“Start”开始以流式传输视频 - - 1. **连接到双亲站流:** 要查看婴儿站流,请转到 Gonimo 家族中的其他设备 - 这是双亲站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个活跃的婴儿站将是一个短时连接按钮。选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 - +4、连接到父母站流:要查看婴儿站流,请转到 Gonimo 家族中的另外的设备 —— 即父母站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个闪动的“Connect”按钮的是活跃的婴儿站。选择“Connect”,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 ![Select parent station][12] - -选择双亲站 +*选择父母站* ![Press Connect][14] +*按下“Connect”开始观看婴儿流。* -按下“Connect”开始观看婴儿流。 +5、恭喜!您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! - 1. **恭喜!** 您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! - - - -有关重命名设备,从系列中删除设备或删除系列的详细信息和详细说明,请查看 [video tutorial][15] 在 gonimo.com。 +有关重命名设备,从系列中删除设备或删除系列的详细信息和详细说明,请查看 gonimo.com 的[视频教程][15]。 ### 家庭系统的灵活性 - Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 - - * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! - - - * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 - - - * **多户:** 单个设备也可以是几个系列的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与 Granny's 或 Uncle John 的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 - +Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的家庭系统。 +* 多婴儿:如果你想留意你在两个不同房间睡觉的两个小孩怎么办?在每个孩子的房间放一个设备,并将其设置为婴儿站。第三个设备将充当父母站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向该家庭系统提供更多设备,并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个、第四个、第五个和第五个等)设备,并自动建立分屏。酷! +* 多父母:如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 +* 多家庭:单个设备也可以是几个家庭系统的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与奶奶或约翰叔叔的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 ### 想要参加吗? -Gonimo 团队喜欢开源。社区代码,社区代码。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。 +Gonimo 团队喜欢开源。代码来自社区,代码用于社区。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。 -目前我们特别需要那些愿意成为 iOS 11 测试者的人的帮助,因为 Apple 在 iOS 11 中对 WebRTC 的支持意味着我们最终将能够支持 iOS 设备。如果可以,请帮助我们实现这个令人敬畏的里程碑。 +目前我们特别需要那些愿意成为 iOS 11 测试者的人的帮助,因为 Apple 在 iOS 11 中对 WebRTC 的支持意味着我们最终将能够支持 iOS 设备。如果可以,请帮助我们实现这个令人赞叹的里程碑。 + +如果您了解 Haskell 或想要了解它,您可以查看 [GitHub 上我们的代码][16]。欢迎发起拉取请求、审查代码以及提出问题。 -如果您了解 Haskell 或想要了解它,您可以查看 [our code at GitHub][16]. 欢迎拉取请求,审查代码以及提出问题。 最后,请通过向新父母和开源世界宣传 Gonimo 婴儿监视器是易于使用并且便携的。 ### 关于作者 -Robert Klotzner;我是双胞胎的父亲;一个程序员。当我听到普通人可以给计算机编程时;我买了一本关于 C 的书页;开始学习;我当时十五岁。我坚持用 C ;相当长的一段时间;学习了 Java ;回归到 C + +Robert Klotzner:我是双胞胎的父亲,一个程序员。当我听到普通人可以给计算机编程时,我买了一本 1200 页的关于 C++ 的书开始学习,我当时才十五岁。我坚持用 C++ 相当长的一段时间,学习了 Java 又回归到 C++,学习了 D、Python 等等,最终学习了 Haskell。我喜欢 Haskell 是因为它丰富的类型系统,这几乎可以避免我书写错误的代码。强壮的静态类型和性能让我爱上了 C++…… -------------------------------------------------------------------------------- @@ -110,7 +89,7 @@ via: https://opensource.com/article/17/9/gonimo 作者:[Robert Klotzner][a] 译者:[lintaov587](https://github.com/lintaov587) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 61f58dc8abb349c5ea4645096bdb2355e3d309a5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 20:43:55 +0800 Subject: [PATCH 0462/4278] PUB:20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lintaov587 本文首发地址: https://linux.cn/article-10417-1.html 您的 LCTT 专页: https://linux.cn/lctt/lintaov587 请注册领取LCCN: https://lctt.linux.cn/ --- ...928 How to create a free baby monitoring system with Gonimo.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20170928 How to create a free baby monitoring system with Gonimo.md (100%) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/published/20170928 How to create a free baby monitoring system with Gonimo.md similarity index 100% rename from translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md rename to published/20170928 How to create a free baby monitoring system with Gonimo.md From 9bd4f430901b6bbcc784617a73bc5a860e1f3018 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 21:52:30 +0800 Subject: [PATCH 0463/4278] PRF:20181217 Working with tarballs on Linux.md @geekpi --- ...20181217 Working with tarballs on Linux.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181217 Working with tarballs on Linux.md b/translated/tech/20181217 Working with tarballs on Linux.md index 2b2e493625..7399f1c421 100644 --- a/translated/tech/20181217 Working with tarballs on Linux.md +++ b/translated/tech/20181217 Working with tarballs on Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Working with tarballs on Linux) @@ -9,29 +9,32 @@ 在 Linux 上使用 tarball ====== + +> Tarball 提供了一种在 Linux 系统上备份和管理一组文件的通用方法。请按照以下提示了解如何创建它们,以及从中提取和删除单个文件。 + ![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg) -“tarball” 一词通常用于描述备份一组选择的文件并将它们打包在一个文件中的一种文件格式。该名称来自 **.tar** 文件扩展名和 **tar** 命令,它用于将文件打包到一个文件中,然后压缩该文件,使其在移动到其他系统时更小。 +“tarball” (LCTT 译注:国内也常称为“tar 包”)一词通常用于描述备份一组选择的文件并将它们打包在一个文件中的一种文件格式。该名称来自 .tar 文件扩展名和 `tar` 命令,它用于将文件打包到一个文件中,有时还会压缩该文件,使其在移动到其它系统时更小。 -tarballs 通常用于备份个人或系统文件来创建存档, 特别是在进行可能需要撤消的更改之前。例如,Linux 系统管理员通常会在更改应用之前创建包含一系列配置文件的 tarball,以防必须撤消这些更改。从 tarball 中解压文件通常比在备份中搜索文件快。 +tarball 通常用于备份个人或系统文件来创建存档,特别是在进行可能需要撤消的更改之前。例如,Linux 系统管理员通常会在更改应用之前创建包含一系列配置文件的 tarball,以防必须撤消这些更改。从 tarball 中解压文件通常比在备份中搜索文件快。 ### 如何在 Linux 上创建 tarball -使用如下命令,你可以在单条命令中创建并压缩文件。 +使用如下命令,你可以在单条命令中创建 tarball 并压缩它。 ``` $ tar -cvzf PDFs.tar.gz *.pdf ``` -这里最后是一个压缩文件 (gzip),其中包含了当前目录中的所有 PDF 文件。当然,压缩是可选的。一个稍微简单的只是将 PDF 文件打包成未压缩 tarball 的命令: +其结果是一个压缩文件(gzip 压缩的),其中包含了当前目录中的所有 PDF 文件。当然,压缩是可选的。一个稍微简单的只是将 PDF 文件打包成未压缩 tarball 的命令: ``` $ tar -cvf PDFs.tar *.pdf ``` -注意,选项中的 **z** 将文件变成压缩的。 **c** 表明正在创建文件,**v** (详细)表示你在命令运行时需要一些反馈。如果你不想查看列出的文件,请忽略 **v**。 +注意,选项中的 `z` 将文件变成压缩的。 `c` 表明创建文件,`v`(详细)表示你在命令运行时需要一些反馈。如果你不想查看列出的文件,请忽略 `v`。 -另一个常见的命名约定是给压缩的 tarball 命名成 **.tgz** 而不是双扩展名 **.tar.gz**,如下所示: +另一个常见的命名约定是给压缩的 tarball 命名成 .tgz 而不是双扩展名 .tar.gz,如下所示: ``` $ tar cvzf MyPDFs.tgz *.pdf @@ -60,7 +63,7 @@ ls -l ShenTix.pdf -rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf ``` -如果未压缩 tarball,你甚至可以从 tarball 中删除文件。例如,如果我们想从 PDFs.tar.gz 中删除我们上面解压的文件,我们会这样做: +如果未压缩 tarball,你甚至可以从 tarball 中删除文件。例如,如果我们想从 PDFs.tar.gz 中删除我们上面解压过的文件,我们会这样做: ``` $ gunzip PDFs.tar.gz @@ -71,7 +74,7 @@ $ ls -l PDFs.tar -rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar ``` -请注意,我们在删除 ShenTix.pdf 后,缩小了一点 tar 文件占用的空间。如果我们想要,我们可以再次压缩文件: +请注意,我们在删除 ShenTix.pdf 后,缩小了一点 tarball 文件占用的空间。如果我们想要,我们可以再次压缩文件: ``` $ gzip -f PDFs.tar @@ -81,8 +84,6 @@ ls -l PDFs.tar.gz 丰富的命令行选项使得 tarball 使用起来简单方便。 -在 [Facebook][1] 和 [LinkedIn][2] 中加入 Network World 社区来评论主题。 - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html @@ -90,11 +91,11 @@ via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ [b]: https://github.com/lujun9972 [1]: https://www.facebook.com/NetworkWorld/ -[2]: https://www.linkedin.com/company/network-world \ No newline at end of file +[2]: https://www.linkedin.com/company/network-world From e8203ef0b7916a94fda988aaf79d94bb27699021 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 21:53:15 +0800 Subject: [PATCH 0464/4278] PUB:20181217 Working with tarballs on Linux.md @geekpi https://linux.cn/article-10418-1.html --- .../20181217 Working with tarballs on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181217 Working with tarballs on Linux.md (98%) diff --git a/translated/tech/20181217 Working with tarballs on Linux.md b/published/20181217 Working with tarballs on Linux.md similarity index 98% rename from translated/tech/20181217 Working with tarballs on Linux.md rename to published/20181217 Working with tarballs on Linux.md index 7399f1c421..0d6e827bb4 100644 --- a/translated/tech/20181217 Working with tarballs on Linux.md +++ b/published/20181217 Working with tarballs on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10418-1.html) [#]: subject: (Working with tarballs on Linux) [#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From ba492475852a013844adef36bd26b07216a1eb82 Mon Sep 17 00:00:00 2001 From: zgj Date: Sat, 5 Jan 2019 23:33:41 +0800 Subject: [PATCH 0465/4278] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=88=9D=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 觉得翻译有点不够流畅 --- .../20180731 How to be the lazy sysadmin.md | 106 +++++++++++++++++- 1 file changed, 103 insertions(+), 3 deletions(-) rename {sources => translated}/talk/20180731 How to be the lazy sysadmin.md (51%) diff --git a/sources/talk/20180731 How to be the lazy sysadmin.md b/translated/talk/20180731 How to be the lazy sysadmin.md similarity index 51% rename from sources/talk/20180731 How to be the lazy sysadmin.md rename to translated/talk/20180731 How to be the lazy sysadmin.md index 52491e397c..7a5860ed7c 100644 --- a/sources/talk/20180731 How to be the lazy sysadmin.md +++ b/translated/talk/20180731 How to be the lazy sysadmin.md @@ -1,4 +1,3 @@ -zgj1024 is translating How to be the lazy sysadmin ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) @@ -93,13 +92,114 @@ It is actually quite a lot of work being the Lazy SysAdmin. But we work smart, r There are many other ways to be the Lazy SysAdmin besides the few described here. I'm sure you have some of your own; please share them with the rest of us in the comments. + + +如何成为一名懒惰的系统管理员 +--- + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) + +Linux 的系统管理员的工作总是复杂的,并且总是伴随这各种陷阱和障碍。从没有足够时间做任何事情,当你想完成那个半秃头老板(PHB)给的任务的时候,他(只会)不停在你的后面.盯着,而最核心的服务器总是在最不合时宜的时间点崩溃,问题和挑战比比皆是。 + +(译者注:半秃头老板 [PHB](https://en.wikipedia.org/wiki/Pointy-haired_Boss),译者:那是[呆伯特漫画](https://zh.wikipedia.org/wiki/%E5%91%86%E4%BC%AF%E7%89%B9)中的角色,缺乏一般知识常识及其职位所应具有的管理能力,爱说大话且富有向物理显示挑战的精神,大概长成这样) + +![](https://cdn-images-1.medium.com/max/1600/1*qu5upg6tgVSXx4KqL-4gZw.jpeg) + +我在即将出版的新书 《 The Linux Philosophy for SysAdmins 》(译者注:暂叫《系统管理员的 Liunx 哲学》 ) 中更详细地讨论如何成为一个懒惰的系统管理员,那书预计会在9月出版。这本的部分内容摘录自该书,特别是第九章,「成为一名懒惰的系统管理员」。在我们讨论如何做到这点前,让我们简单了解一下成为一个名懒惰的系统管理员意味着什么。 + +### 真实生产力vs.虚假生产力 +#### 虚假生产力 + +在我工作的地方,半秃头老板相信的管理风格叫「走动式管理」( management by walking around )。假设某人不在他的键盘上输入东西,或者至少检查他们显示的东西,判断他们的工作是否有效率的。这是一个糟糕的工作场所。它的各部门间有道很高的行政墙,这会造就了许多小型沟通壁垒,大量无用的文书工作,以及获得任何事情的许可都要等待漫长的时间。因为这些或者其他原因,不可能高效地做任何事情 ——如果真的是这样——所以我们是非常低效。为了看起来很忙,我们都有自己的一套 Look Busy 工具包( Look Busy Kits, LBKs ),可能是一些短小的、用来显示一些行为行为活动的 Bash 脚本,或者是 `top`,`htop`,`iotop` 之类的程序,或者是一些持续显示某些行为活动的监控工具。这个工作场所的风气让人不可能真正高效, 我讨厌这个地方, 也讨厌那个几乎不可能完成任何有价值的事情的事实。 + +这糟糕场所对真实的系统管理员来讲是场噩梦。我们中没有人会感到快乐。(在那里)花费四五月才能完成的事,在其他地方只需的一个早晨。我们没有什么实际工作要做,却要花大量的时间干活来(让自己)看起来很忙。我们有一个无言竞赛,创造最好的 LBK( Look Busy Kits) ,这就是我们花费最多时间的地方了。那份工作我只做了几个月,但好像已经过完一生。如果你看到的这个监狱的表面,你可能会说我们是很懒,因为我们只完成了几乎为 0 的实际工作。 + +这是个极端的例子,它完全与我所说的“我是一个懒惰的系统管理员”的意思相反,做一个懒惰的系统管理是件好事。 + +#### 真实生产力 + +我很幸运,曾为一些真正的经理工作——他们明白,系统管理员的生产力并不是以每天花多少小时敲键盘来衡量。毕竟,即使一只猴子能敲击他们的键盘,但也不能说明结果的价值。 + +正如我书中所言 + +> 「我是一个懒惰的系统管理员,同时我也是一个高效的系统管理员。这两者看似矛盾的说法不是相互排斥的,而是会以一种非常积极的方式相辅相成。。。 +> +> 「一个系统管理员在思考的时候是最高效的——思考关于如何解决现有问题和避免未来的问题;思考怎样监控 Linux 计算机,以便找到预测和预示这些未来的问题的线索;思考如何让他们的工作更有效率;思考如何自动化所有这些要执行的任务, 无论是每天还是每年一次的任务。 +> +> 「系统管理员冥思苦想的那一面是不会被非系统管理员所熟知的,那些人包括很多掌管着系统管理员的人,比如那个半秃头老板。系统管理员都会以不同的方式解决他们工作中苦思的部分。一些我认识的系统管理员会在沙滩、骑自行车、参加马拉松或者攀岩时找到最好的想法。另一些人会认为静坐或听音乐的时候思考得最好。还有一些会在阅读小说、学习不相关的学科、甚至在学习 Linux 系统的时候会想得最好。关键是我们都有不同的方式激发我们的创造力,而这些创造力的推进器中很多并不涉及键盘上的一个按键。我们真正的生产力对于系统管理员周围的人来说可能是完全看不见的。」 + +成为懒惰的系统管理员有一些简单的秘诀——系统管理员要完成一切需要完成的事,而且更多的是,当所有人都处于恐慌的状态时要保持冷静和镇定。(秘诀的)一部分是高效工作,另一部分是把预防问题放在首位。 + +### 成为懒惰系统管理员的方法 + +#### 多思考 + +我相信关于懒惰系统管理员最重要的秘诀在于思考。正如上面的摘录所言,优秀的系统管理员会花大量的时候思考这些事情,如何更有效率地工作,在异常成为问题前如何定位,更聪明地工作,做其他所有东西的同时会考虑如何完成这些的事等等。 + +例如,现在——除了撰写本文之外——我正在想一个项目,我打算在新部件从亚马逊和本地计算机商店到达时才开始。 我不那么重要的计算机上的主板坏了,最近它的崩溃更频率。 但我旧的和最小的服务器——处理我的电子邮件和外部网站,以及为我的网络的其余部分提供 DHCP 和 DNS 服务——并没有出现故障,但必须处理由于各种外部攻击而导致的间歇性过载。 + +我一开始想,我只要替换故障单元中的主板及其直接部件——内存、CPU,可能还有电源。但是在考虑了一段时间之后,我决定将新部件放到服务器中,并将旧的(但仍然可用的)部件从服务器移到故障系统中。可以这样做的,只需一、两个小时就可以从服务器上移除旧部件并安装新的。然后我就可以花时间更换出故障的电脑里的部件了。太好了。所以我开始在脑海中列出要完成的任务。 + +然而,当我查看列表时,我意识到服务器中唯一不能替换的部件是机箱和硬盘驱动器,这两台计算机的机箱几乎完全相同。在有了这个小小的发现之后,我开始考虑用新的部件替换出故障的计算机的部件,并将之作为我的服务器。经过一些测试之后,我只需从当前的服务器移除硬盘,并将它安装到新的组件中,改下网络配置项,再更改 KVM 交换机端口上的主机名,并更改主机名标签,就可以了。这将大大减少服务器停机时间,大大减少我的压力。此外,如果出现故障,我可以简单地将硬盘移回原来的服务器,直到我可以用新服务器解决问题为止。 + +所以,现在我在脑海中已经创建了一个我需要做的任务清单,以完成这项工作。而且——我希望你能仔细观察——当我脑子里想着这一切的时候,我的手指从来没有碰过键盘。我新的心理行动计划风险很低,与我最初的计划相比,涉及的服务器停机时间要少得多。 + +当我在 IBM 工作的时候,我经常看到很多语言中都有写着“思考”的标语。思考可以节省时间和压力,是懒散的系统管理员的主要标志。 + +#### 做预防性维护 + +在 1970 年代中期,我被 IBM 聘为客户工程师,我的领地由相当多的穿孔卡片设备组成。这也就是说,它们是处理打孔卡的重型机械设备—— 一些可以追溯到20世纪30年代。因为这些机器主要是机械的,所以它们的部件经常磨损或失调。我的部分工作是在他们损坏时修复这些他们。我工作的主要部分——最重要的部分 ——首先要防止它们。预防性维护的目的是在磨损部件损坏之前进行更换,并对还在运行的部件进行润滑和调整,以确保它们工作正常。 + + +正如我在《系统管理员的 Linux哲学》( The Linux Philosophy for SysAdmins)中所言: + +>「我在 IBM 的经理们明白这只是冰山一角;他们——和我——都是我的工作是让顾客满意。虽然这通常意味着修复损坏的硬件,但也意味着减少硬件损坏的次数。这对客户来说是好事,因为他们的机器在工作时工作效率更高。这对我有好处,因为我从那些快乐的客户那里接到的电话要少得多。我也睡了更多的觉,因为这样做的结果是更少的非工作时间的紧急电话。我是个懒惰的(客户工程师)。通过提前做额外的工作,从长远来看,我需要做的工作要少得多。 +> +>「这一原则已成为系统管理员的 Linux 哲学的功能原则之一。作为系统管理员,我们的时间最好用在最大限度地减少未来工作量的任务上。」 + +在 Linux 计算机中查找要解决的问题相当于项目管理。我检查系统日志,寻找以后可能会变得非常危险的问题的暗示。如果出现了一些小问题,或者我注意到我的工作站、服务器没有做出该有的响应,或者如果日志显示了一些不寻常的东西——所有这些都可以暗示出潜在的问题,而对于用户或半秃头老板来说,这些问题并没有产生明显的症状。 + +我经常检查 `/var/log/` 中的文件,特别是 messages 和 security 文件。我最常见的问题之一是许多脚本小子在我的防火墙系统上尝试各种类型的攻击。而且,不,我不依赖 ISP(Internet Service Provider,网络服务提供者)提供的调制解调器/路由器中的所谓的防火墙。这些日志包含了大量关于企图攻击来源的信息,非常有价值。但是要扫描不同主机上的日志并将解决方案部署到位,需要做大量的工作。所以我转向自动化。 + +#### 自动化 + +我发现我的工作有很大一部分可以通过某种形式的自动化来完成。系统管理员的 Linux 哲学的原则之一是 「自动化一切」,这包括每天扫描日志文件等枯燥乏味的任务。 + +像是 [Logwatch][3] 这类的程序能够监控你的日志文件中的异常条目,并在异常条目发生时通知您。Logwatch通常作为 cron jobs(译者注,Linux/Unix 中周期作业程序)每天运行一次,并向本地主机上的 root 用户发送电子邮件。你可以从命令行运行 Logwatch,并立即在显示器上查看结果。现在我只需要每天查看 Logwatch 的电子邮件通知。 + +但现实是,仅仅收到通知是不够的,因为我们不能坐以待毙。有时需要立即作出反应。我喜欢的另一个程序是——它能为我做所有事——(让大家看到,这就是懒惰的管理员)——它就是[Fail2ban][4]。Fail2Ban 会扫描指定的日志文件,查找各种类型的黑客攻击和入侵尝试,如果它发现某个 IP 地址在做特定类型的持续活动够了,它会向防火墙添加一个条目,在指定的时间内阻止来自该 IP 地址的任何进一步的黑客尝试。默认值通常在 10 分钟左右,但我喜欢为大多数类型的攻击指定为 12 或 24 小时。每种类型的黑客攻击都是单独配置的,例如尝试通过 SSH 登录和那些 Web 服务器的攻击。 + +#### 写脚本 + +自动化是哲学的关键组成部分之一。一切可以自动化的东西都应该自动化的,其余的尽可能地自动化。所以,我也写了很多脚本来解决问题,也就说说我编写脚本来完成我的大部分工作。 + +我的脚本帮我节省了大量时间,因为它们包含执行特定任务的命令,这大大减少了我需要输入的数量。例如,我经常重新启动我的电子邮件服务器和垃圾邮件处理软件(当修改 SpamAssassin 的 `local.cf` 配置文件时,就需要重启)。必须按特定顺序停止并重新启动这些服务。因此,我用几个命令编写了一个简短的脚本,并将其存储在可访问的 `/usr/local/bin` 中。现在,不用键入几个命令并等待每个命令都完成,然后再键入下一个命令——更用记住正确的命令顺序和每个命令的正确语法——我输入一个三个字符的命令,其余的留给我的脚本来完成。 + +#### 简化键入 + +另一种成为懒惰的系统管理员的方法是减少我们需要键入的数量。而且,我的打字技巧真的很糟糕(也就是说,我一点也没有——顶多是几个笨拙的手指)。导致错误的一个可能原因是我的打字不好,所以我会尽量少打字。 + +绝大多数 GNU 和 Linux 核心实用程序都有非常短的名称。然而,它们都是有意义的名字。诸如用于更改目录的 `cd` 、用于列出(目录内容)的 `ls` 和用于磁盘转储的 `dd` 等工具都非常明显。短名字意味着更少的打字和更少的产生错误机会。我认为短的名字通常更容易记住。 + +当我编写 shell 脚本时,我喜欢保持名称简短而意义(至少对我来说是),比如用于 rsync 备份的 `rsbu`(译者注,Rsync Backup 的简写)。在某些情况下,我喜欢使用更长的名称,比如 `doUpdates` 来执行系统更新。在后一种情况下,长一点名让脚本的目的就越明显。这可以节省时间,因为很容易记住脚本的名称。 + +其他减少键入的方法包括命令行别名(alias)、命令行调回(recall)和编辑。别名只是你在 Bash shell 键入命令时才做的替换。键入 `alias` 命令会看到默认配置的别名列表。例如,当你输入命令 `ls` 时,会被条目 `alias ls='ls –color=auto'` 替成较长的命令,因此你只需键入 2 个字符而不是 14 个字符即可获得带有颜色的列表。还可以使用 `alias` 命令添加你自己(定义)的别名。 + +命令行调回允许你使用键盘的向上和向下箭头键滚动浏览命令历史记录。如果需要再次使用相同的命令,只需在找到所需的命令时按 Enter 键即可。如果在找到命令后需要更改该命令,则可以使用标准命令行编辑功能进行更改。 + +### 结束语 + +一名懒惰的系统管理员实际上也有很多的工作。但我们是聪明地工作,而不是刻苦工作。早在一堆小问题汇聚成大问题之前, 我们就花时间探索我们负责的主机,并处理好所有的小问题。我们花了很多时间思考解决问题的最佳方法, 我们也花了很多时间来发现新的方法, 让自己更聪明地工作, 成为懒惰的系统管理员。 + +除了这里描述的少数方法外, 还有许多其他的方式可以成为懒惰的系统管理员。我相信你也有一些自己的方式;请在评论中和我们分享。 + -------------------------------------------------------------------------------- via: https://opensource.com/article/18/7/how-be-lazy-sysadmin 作者:[David Both][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[zgj1024](https://github.com/zgj1024) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -108,4 +208,4 @@ via: https://opensource.com/article/18/7/how-be-lazy-sysadmin [1]:https://www.apress.com/us/book/9781484237298 [2]:https://en.wikipedia.org/wiki/Unit_record_equipment [3]:https://www.techrepublic.com/article/how-to-install-and-use-logwatch-on-linux/ -[4]:https://www.fail2ban.org/wiki/index.php/Main_Page +[4]:https://www.fail2ban.org/wiki/index.php/Main_Page \ No newline at end of file From 01e78f002326232fd5874c1ea060cfbc350415cd Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Sun, 6 Jan 2019 10:32:36 +0800 Subject: [PATCH 0466/4278] translating --- .../20180503 11 Methods To Find System-Server Uptime In Linux.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md b/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md index 7a30127b07..a2060fb130 100644 --- a/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md +++ b/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md @@ -1,3 +1,4 @@ +LuMing is translating 11 Methods To Find System/Server Uptime In Linux ====== Do you want to know, how long your Linux system has been running without downtime? when the system is up and what date. From bb32cf26d2473665a1adf2e750219b6e2eec0df0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 6 Jan 2019 17:38:31 +0800 Subject: [PATCH 0467/4278] PRF:20180731 How to be the lazy sysadmin.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zgj1024 恭喜你完成了第一篇翻译。 --- .../20180731 How to be the lazy sysadmin.md | 181 +++++------------- 1 file changed, 44 insertions(+), 137 deletions(-) diff --git a/translated/talk/20180731 How to be the lazy sysadmin.md b/translated/talk/20180731 How to be the lazy sysadmin.md index 7a5860ed7c..5f1c5b7da5 100644 --- a/translated/talk/20180731 How to be the lazy sysadmin.md +++ b/translated/talk/20180731 How to be the lazy sysadmin.md @@ -1,197 +1,104 @@ -How to be the lazy sysadmin -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) - -The job of a Linux SysAdmin is always complex and often fraught with various pitfalls and obstacles. Ranging from never having enough time to do everything, to having the Pointy-Haired Boss (PHB) staring over your shoulder while you try to work on the task that she or he just gave you, to having the most critical server in your care crash at the most inopportune time, problems and challenges abound. I have found that becoming the Lazy Sysadmin can help. - -I discuss how to be a lazy SysAdmin in detail in my forthcoming book, [The Linux Philosophy for SysAdmins][1], (Apress), which is scheduled to be available in September. Parts of this article are taken from that book, especially Chapter 9, "Be a Lazy SysAdmin." Let's take a brief look at what it means to be a Lazy SysAdmin before we discuss how to do it. - -### Real vs. fake productivity - -#### Fake productivity - -At one place I worked, the PHB believed in the management style called "management by walking around," the supposition being that anyone who wasn't typing something on their keyboard, or at least examining something on their display, was not being productive. This was a horrible place to work. It had high administrative walls between departments that created many, tiny silos, a heavy overburden of useless paperwork, and excruciatingly long wait times to obtain permission to do anything. For these and other reasons, it was impossible to do anything efficiently—if at all—so we were incredibly non-productive. To look busy, we all had our Look Busy Kits (LBKs), which were just short Bash scripts that showed some activity, or programs like `top`, `htop`, `iotop`, or any monitoring tool that constantly displayed some activity. The ethos of this place made it impossible to be truly productive, and I hated both the place and the fact that it was nearly impossible to accomplish anything worthwhile. - -That horrible place was a nightmare for real SysAdmins. None of us was happy. It took four or five months to accomplish what took only a single morning in other places. We had little real work to do but spent a huge amount of time working to look busy. We had an unspoken contest going to create the best LBK, and that is where we spent most of our time. I only managed to last a few months at that job, but it seemed like a lifetime. If you looked only at the surface of that dungeon, you could say we were lazy because we accomplished almost zero real work. - -This is an extreme example, and it is totally the opposite of what I mean when I say I am a Lazy SysAdmin and being a Lazy SysAdmin is a good thing. - -#### Real productivity - -I am fortunate to have worked for some true managers—they were people who understood that the productivity of a SysAdmin is not measured by how many hours per day are spent banging on a keyboard. After all, even a monkey can bang on a keyboard, but that is no indication of the value of the results. - -As I say in my book: - -> "I am a lazy SysAdmin and yet I am also a very productive SysAdmin. Those two seemingly contradictory statements are not mutually exclusive, rather they are complementary in a very positive way. … -> -> "A SysAdmin is most productive when thinking—thinking about how to solve existing problems and about how to avoid future problems; thinking about how to monitor Linux computers in order to find clues that anticipate and foreshadow those future problems; thinking about how to make their work more efficient; thinking about how to automate all of those tasks that need to be performed whether every day or once a year. -> -> "This contemplative aspect of the SysAdmin job is not well known or understood by those who are not SysAdmins—including many of those who manage the SysAdmins, the Pointy Haired Bosses. SysAdmins all approach the contemplative parts of their job in different ways. Some of the SysAdmins I have known found their best ideas at the beach, cycling, participating in marathons, or climbing rock walls. Others think best when sitting quietly or listening to music. Still others think best while reading fiction, studying unrelated disciplines, or even while learning more about Linux. The point is that we all stimulate our creativity in different ways, and many of those creativity boosters do not involve typing a single keystroke on a keyboard. Our true productivity may be completely invisible to those around the SysAdmin." - -There are some simple secrets to being the Lazy SysAdmin—the SysAdmin who accomplishes everything that needs to be done and more, all the while keeping calm and collected while others are running around in a state of panic. Part of this is working efficiently, and part is about preventing problems in the first place. - -### Ways to be the Lazy SysAdmin - -#### Thinking - -I believe the most important secret about being the Lazy SysAdmin is thinking. As in the excerpt above, great SysAdmins spend a significant amount of time thinking about things we can do to work more efficiently, locate anomalies before they become problems, and work smarter, all while considering how to accomplish all of those things and more. - -For example, right now—in addition to writing this article—I am thinking about a project I intend to start as soon as the new parts arrive from Amazon and the local computer store. The motherboard on one of my less critical computers is going bad, and it has been crashing more frequently recently. But my very old and minimal server—the one that handles my email and external websites, as well as providing DHCP and DNS services for the rest of my network—isn't failing but has to deal with intermittent overloads due to external attacks of various types. - -I started by thinking I would just replace the motherboard and its direct components—memory, CPU, and possibly the power supply—in the failing unit. But after thinking about it for a while, I decided I should put the new components into the server and move the old (but still serviceable) ones from the server into the failing system. This would work and take only an hour, or perhaps two, to remove the old components from the server and install the new ones. Then I could take my time replacing the components in the failing computer. Great. So I started generating a mental list of tasks to do to accomplish this. - -However, as I worked the list, I realized that about the only components of the server I wouldn't replace were the case and the hard drive, and the two computers' cases are almost identical. After having this little revelation, I started thinking about replacing the failing computer's components with the new ones and making it my server. Then, after some testing, I would just need to remove the hard drive from my current server and install it in the case with all the new components, change a couple of network configuration items, change the hostname on the KVM switch port, and change the hostname labels on the case, and it should be good to go. This will produce far less server downtime and significantly less stress for me. Also, if something fails, I can simply move the hard drive back to the original server until I can fix the problem with the new one. - -So now I have created a mental list of the tasks I need to do to accomplish this. And—I hope you were watching closely—my fingers never once touched the keyboard while I was working all of this out in my head. My new mental action plan is low risk and involves a much smaller amount of server downtime compared to my original plan. - -When I worked for IBM, I used to see signs all over that said "THINK" in many languages. Thinking can save time and stress and is the main hallmark of a Lazy SysAdmin. - -#### Doing preventative maintenance - -In the mid-1970s, I was hired as a customer engineer at IBM, and my territory consisted of a fairly large number of [unit record machines][2]. That just means that they were heavily mechanical devices that processed punched cards—a few dated from the 1930s. Because these machines were primarily mechanical, their parts often wore out or became maladjusted. Part of my job was to fix them when they broke. The main part of my job—the most important part—was to prevent them from breaking in the first place. The preventative maintenance was intended to replace worn parts before they broke and to lubricate and adjust the moving components to ensure that they were working properly. - -As I say in The Linux Philosophy for SysAdmins: - -> "My managers at IBM understood that was only the tip of the iceberg; they—and I—knew my job was customer satisfaction. Although that usually meant fixing broken hardware, it also meant reducing the number of times the hardware broke. That was good for the customer because they were more productive when their machines were working. It was good for me because I received far fewer calls from those happier customers. I also got to sleep more due to the resultant fewer emergency off-hours callouts. I was being the Lazy [Customer Engineer]. By doing the extra work upfront, I had to do far less work in the long run. -> -> "This same tenet has become one of the functional tenets of the Linux Philosophy for SysAdmins. As SysAdmins, our time is best spent doing those tasks that minimize future workloads." - -Looking for problems to fix in a Linux computer is the equivalent of project management. I review the system logs looking for hints of problems that might become critical later. If something appears to be a little amiss, or I notice my workstation or a server is not responding as it should, or if the logs show something unusual—all of these can be indicative of an underlying problem that has not generated symptoms obvious to users or the PHB. - -I do frequent checks of the files in `/var/log/`, especially messages and security. One of my more common problems is the many script kiddies who try various types of attacks on my firewall system. And, no, I do not rely on the alleged firewall in the modem/router provided by my ISP. These logs contain a lot of information about the source of the attempted attack and can be very valuable. But it takes a lot of work to scan the logs on various hosts and put solutions into place. So I turn to automation. - -#### Automating - -I have found that a very large percentage of my work can be performed by some form of automation. One of the tenets of the Linux Philosophy for SysAdmins is "automate everything," and this includes boring, drudge tasks like scanning logfiles every day. - -Programs like [Logwatch][3] can monitor your logfiles for anomalous entries and notify you when they occur. Logwatch usually runs as a cron job once a day and sends an email to root on the localhost. You can run Logwatch from the command line and view the results immediately on your display. Now I just need to look at the Logwatch email notification every day. - -But the reality is just getting a notification is not enough, because we can't sit and watch for problems all the time. Sometimes an immediate response is required. Another program I like, one that does all of the work for me—see, this is the real Lazy Admin—is [Fail2Ban][4]. Fail2Ban scans designated logfiles for various types of hacking and intrusion attempts, and if it sees enough sustained activity of a specific type from a particular IP address, it adds an entry to the firewall that blocks any further hacking attempts from that IP address for a specified time. The defaults tend to be around 10 minutes, but I like to specify 12 or 24 hours for most types of attacks. Each type of hacking attack is configured separately, such as those trying to log in via SSH and those attacking a web server. - -#### Writing scripts - -Automation is one of the key components of the Philosophy. Everything that can be automated should be, and the rest should be automated as much as possible. So, I also write a lot of scripts to solve problems, which also means I write scripts to do most of my work for me. - -My scripts save me huge amounts of time because they contain the commands to perform specific tasks, which significantly reduces the amount of typing I need to do. For example, I frequently restart my email server and my spam-fighting software (which needs restarted when configuration changes are made to SpamAssassin's `local.cf` file). Those services must be stopped and restarted in a specific order. So, I wrote a short script with a few commands and stored it in `/usr/local/bin`, where it is accessible. Now, instead of typing several commands and waiting for each to finish before typing the next one—not to mention remembering the correct sequence of commands and the proper syntax of each—I type in a three-character command and leave the rest to my script. - -#### Reducing typing - -Another way to be the Lazy SysAdmin is to reduce the amount of typing we need to do. Besides, my typing skills are really horrible (that is to say I have none—a few clumsy fingers at best). One possible cause for errors is my poor typing, so I try to keep typing to a minimum. - -The vast majority of GNU and Linux core utilities have very short names. They are, however, names that have some meaning. Tools like `cd` for change directory, `ls` for list (the contents of a directory), and `dd` for disk dump are pretty obvious. Short names mean less typing and fewer opportunities for errors to creep in. I think the short names are usually easier to remember. - -When I write shell scripts, I like to keep the names short but meaningful (to me at least) like `rsbu` for Rsync BackUp. In some cases, I like the names a bit longer, such as `doUpdates` to perform system updates. In the latter case, the longer name makes the script's purpose obvious. This saves time because it's easy to remember the script's name. - -Other methods to reduce typing are command line aliases and command line recall and editing. Aliases are simply substitutions that are made by the Bash shell when you type a command. Type the `alias` command and look at the list of aliases that are configured by default. For example, when you enter the command `ls`, the entry `alias ls='ls –color=auto'` substitutes the longer command, so you only need to type two characters instead of 14 to get a listing with colors. You can also use the `alias` command to add your own aliases. - -Command line recall allows you to use the keyboard's Up and Down arrow keys to scroll through your command history. If you need to use the same command again, you can just press the Enter key when you find the one you need. If you need to change the command once you have found it, you can use standard command line editing features to make the changes. - -### Parting thoughts - -It is actually quite a lot of work being the Lazy SysAdmin. But we work smart, rather than working hard. We spend time exploring the hosts we are responsible for and dealing with any little problems long before they become large problems. We spend a lot of time thinking about the best ways to resolve problems, and we think a lot about discovering new ways to work smarter at being the Lazy SysAdmin. - -There are many other ways to be the Lazy SysAdmin besides the few described here. I'm sure you have some of your own; please share them with the rest of us in the comments. - - - 如何成为一名懒惰的系统管理员 ---- +====== +> 我们是聪明地工作,而不是刻苦工作,但仍把你的工作做好。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) -Linux 的系统管理员的工作总是复杂的,并且总是伴随这各种陷阱和障碍。从没有足够时间做任何事情,当你想完成那个半秃头老板(PHB)给的任务的时候,他(只会)不停在你的后面.盯着,而最核心的服务器总是在最不合时宜的时间点崩溃,问题和挑战比比皆是。 +Linux 的系统管理员的工作总是复杂的,并且总是伴随着各种陷阱和障碍。做每件事都没有足够时间,当你想完成那个半秃头老板(PHB)给的任务时,他(只会)不停在你的后面盯着,而最核心的服务器总是在最不合时宜的时间点崩溃,问题和挑战比比皆是。而我发现,成为一名懒惰的系统管理员Lazy SysAdmin可以解决这一困境。 -(译者注:半秃头老板 [PHB](https://en.wikipedia.org/wiki/Pointy-haired_Boss),译者:那是[呆伯特漫画](https://zh.wikipedia.org/wiki/%E5%91%86%E4%BC%AF%E7%89%B9)中的角色,缺乏一般知识常识及其职位所应具有的管理能力,爱说大话且富有向物理显示挑战的精神,大概长成这样) +(LCTT 译注:[半秃头老板](https://en.wikipedia.org/wiki/Pointy-haired_Boss)Pointy-Haired Boss(PHB),那是[呆伯特漫画](https://zh.wikipedia.org/wiki/%E5%91%86%E4%BC%AF%E7%89%B9)中的角色,缺乏一般知识常识及其职位所应具有的管理能力,爱说大话且富有向物理显示挑战的精神,大概长成下图这样。) ![](https://cdn-images-1.medium.com/max/1600/1*qu5upg6tgVSXx4KqL-4gZw.jpeg) -我在即将出版的新书 《 The Linux Philosophy for SysAdmins 》(译者注:暂叫《系统管理员的 Liunx 哲学》 ) 中更详细地讨论如何成为一个懒惰的系统管理员,那书预计会在9月出版。这本的部分内容摘录自该书,特别是第九章,「成为一名懒惰的系统管理员」。在我们讨论如何做到这点前,让我们简单了解一下成为一个名懒惰的系统管理员意味着什么。 +我在即将在 Apress 出版的新书 《The Linux Philosophy for SysAdmins》(LCTT 译注:暂译《系统管理员的 Linux 哲学》)中更详细地讨论如何成为一个懒惰的系统管理员,那书预计会在 9 月出版(LCTT 译注:已于 2018 年 8 月出版)。这本的部分内容摘录自该书,特别是第九章,“成为一名懒惰的系统管理员”。在我们讨论如何做到这点前,让我们简单了解一下成为一个名懒惰的系统管理员意味着什么。 + +![](https://images-na.ssl-images-amazon.com/images/I/41YOHTGClbL._SX348_BO1,204,203,200_.jpg) + +### 真实生产力 vs. 虚假生产力 -### 真实生产力vs.虚假生产力 #### 虚假生产力 -在我工作的地方,半秃头老板相信的管理风格叫「走动式管理」( management by walking around )。假设某人不在他的键盘上输入东西,或者至少检查他们显示的东西,判断他们的工作是否有效率的。这是一个糟糕的工作场所。它的各部门间有道很高的行政墙,这会造就了许多小型沟通壁垒,大量无用的文书工作,以及获得任何事情的许可都要等待漫长的时间。因为这些或者其他原因,不可能高效地做任何事情 ——如果真的是这样——所以我们是非常低效。为了看起来很忙,我们都有自己的一套 Look Busy 工具包( Look Busy Kits, LBKs ),可能是一些短小的、用来显示一些行为行为活动的 Bash 脚本,或者是 `top`,`htop`,`iotop` 之类的程序,或者是一些持续显示某些行为活动的监控工具。这个工作场所的风气让人不可能真正高效, 我讨厌这个地方, 也讨厌那个几乎不可能完成任何有价值的事情的事实。 +在我工作的地方,半秃头老板相信的管理风格叫“走动式管理management by walking around”。通过判断某人在不在他的键盘上输入东西,或者至少要看看他们显示器上显示的东西,来判断他们的工作是否有效率。这是一个糟糕的工作场所。各部门间有道很高的行政墙,这会造就了许多的、微小的沟通壁垒,大量无用的文书工作,以及获得任何事情的许可都要等待漫长的时间。因为这样、那样的原因,不可能高效地做任何事情,如果真的是这样,那是非常低效。为了看起来很忙,我们都有自己的一套“看起来很忙”的工具包Look Busy Kits(LBK),可能是一些短小的、用来显示一些行为活动的 Bash 脚本,或者是 `top`、`htop`、`iotop` 之类的程序,或者是一些持续显示某些行为活动的监控工具。这种工作场所的风气让人不可能真正高效,我讨厌这种地方,也讨厌那个几乎不可能完成任何有价值的事情的事实。 -这糟糕场所对真实的系统管理员来讲是场噩梦。我们中没有人会感到快乐。(在那里)花费四五月才能完成的事,在其他地方只需的一个早晨。我们没有什么实际工作要做,却要花大量的时间干活来(让自己)看起来很忙。我们有一个无言竞赛,创造最好的 LBK( Look Busy Kits) ,这就是我们花费最多时间的地方了。那份工作我只做了几个月,但好像已经过完一生。如果你看到的这个监狱的表面,你可能会说我们是很懒,因为我们只完成了几乎为 0 的实际工作。 +这种糟糕场所对真实的系统管理员来讲是场噩梦。没有人会感到快乐。在那里花费四五个月才能完成的事,在其他地方只需的一个早晨。我们没有什么实际工作要做,却要花大量的时间干活来让自己看起来很忙。我们在默默地竞赛,看谁能创造最好的“看起来很忙”的工具包,这就是我们花费最多时间的地方了。那份工作我只做了几个月,但好像已经耗费了一生。如果你看到的这个监狱的表面,你可能会说我们是很懒,因为我们只完成了几乎为 0 的实际工作。 -这是个极端的例子,它完全与我所说的“我是一个懒惰的系统管理员”的意思相反,做一个懒惰的系统管理是件好事。 +这是个极端的例子,它完全与我所说的“我是一个懒惰的系统管理员”的意思相反,而做一个懒惰的系统管理是件好事。 #### 真实生产力 -我很幸运,曾为一些真正的经理工作——他们明白,系统管理员的生产力并不是以每天花多少小时敲键盘来衡量。毕竟,即使一只猴子能敲击他们的键盘,但也不能说明结果的价值。 +我很幸运,曾为一些真正的管理者工作过 —— 他们明白,系统管理员的生产力并不是以每天花多少小时敲键盘来衡量。毕竟,即使一只猴子能敲击他们的键盘,但也不能说明结果的价值。 -正如我书中所言 +正如我书中所言: -> 「我是一个懒惰的系统管理员,同时我也是一个高效的系统管理员。这两者看似矛盾的说法不是相互排斥的,而是会以一种非常积极的方式相辅相成。。。 +> “我是一个懒惰的系统管理员,同时我也是一个高效的系统管理员。这两者看似矛盾的说法不是相互排斥的,而是会以一种非常积极的方式相辅相成…… > -> 「一个系统管理员在思考的时候是最高效的——思考关于如何解决现有问题和避免未来的问题;思考怎样监控 Linux 计算机,以便找到预测和预示这些未来的问题的线索;思考如何让他们的工作更有效率;思考如何自动化所有这些要执行的任务, 无论是每天还是每年一次的任务。 +> “系统管理员在思考的时候是最高效的 —— 思考关于如何解决现有问题和避免未来的问题;思考怎样监控 Linux 计算机,以便找到预测和预示这些未来的问题的线索;思考如何让他们的工作更有效率;思考如何自动化所有这些要执行的任务,无论是每天还是每年一次的任务。 > -> 「系统管理员冥思苦想的那一面是不会被非系统管理员所熟知的,那些人包括很多掌管着系统管理员的人,比如那个半秃头老板。系统管理员都会以不同的方式解决他们工作中苦思的部分。一些我认识的系统管理员会在沙滩、骑自行车、参加马拉松或者攀岩时找到最好的想法。另一些人会认为静坐或听音乐的时候思考得最好。还有一些会在阅读小说、学习不相关的学科、甚至在学习 Linux 系统的时候会想得最好。关键是我们都有不同的方式激发我们的创造力,而这些创造力的推进器中很多并不涉及键盘上的一个按键。我们真正的生产力对于系统管理员周围的人来说可能是完全看不见的。」 +> “系统管理员冥思苦想的那一面是不会被非系统管理员所熟知的,那些人包括很多管理着系统管理员的人,比如那个半秃头老板。系统管理员都会以不同的方式解决他们工作中苦思的部分。一些我认识的系统管理员会在沙滩、骑自行车、参加马拉松或者攀岩时找到最好的想法。另一些人会认为静坐或听音乐的时候思考得最好。还有一些会在阅读小说、学习不相关的学科、甚至在学习 Linux 系统的时候可以最佳思考。关键是我们都有不同的方式激发我们的创造力,而这些创造力的推进器中很多并不涉及键盘上的任何一个按键。我们真正的生产力对于系统管理员周围的人来说可能是完全看不见的。” -成为懒惰的系统管理员有一些简单的秘诀——系统管理员要完成一切需要完成的事,而且更多的是,当所有人都处于恐慌的状态时要保持冷静和镇定。(秘诀的)一部分是高效工作,另一部分是把预防问题放在首位。 +成为懒惰的系统管理员有一些简单的秘诀 —— 系统管理员要完成一切需要完成的事,而且更多的是,当所有人都处于恐慌的状态时要保持冷静和镇定。秘诀的一部分是高效工作,另一部分是把预防问题放在首位。 ### 成为懒惰系统管理员的方法 #### 多思考 -我相信关于懒惰系统管理员最重要的秘诀在于思考。正如上面的摘录所言,优秀的系统管理员会花大量的时候思考这些事情,如何更有效率地工作,在异常成为问题前如何定位,更聪明地工作,做其他所有东西的同时会考虑如何完成这些的事等等。 +我相信关于懒惰系统管理员最重要的秘诀在于思考。正如上面的摘录所言,优秀的系统管理员会花大量的时候思考这些事情,如何更有效率地工作,在异常成为问题前如何定位,更聪明地工作,做其它事情的同时会考虑如何完成这些事情等等。 -例如,现在——除了撰写本文之外——我正在想一个项目,我打算在新部件从亚马逊和本地计算机商店到达时才开始。 我不那么重要的计算机上的主板坏了,最近它的崩溃更频率。 但我旧的和最小的服务器——处理我的电子邮件和外部网站,以及为我的网络的其余部分提供 DHCP 和 DNS 服务——并没有出现故障,但必须处理由于各种外部攻击而导致的间歇性过载。 +例如,除了撰写本文之外,我现在正在想一个项目,我打算在从亚马逊和本地计算机商店采购的新部件到达时才开始。我有一台不太关键的计算机上的主板坏了,最近它的崩溃更频率。但我的一台非常老的小服务器并没有出现故障,它负责处理我的电子邮件和外部网站,以及为我的网络的其余部分提供 DHCP 和 DNS 服务,但需要解决由于各种外部攻击而导致的间歇性过载。 -我一开始想,我只要替换故障单元中的主板及其直接部件——内存、CPU,可能还有电源。但是在考虑了一段时间之后,我决定将新部件放到服务器中,并将旧的(但仍然可用的)部件从服务器移到故障系统中。可以这样做的,只需一、两个小时就可以从服务器上移除旧部件并安装新的。然后我就可以花时间更换出故障的电脑里的部件了。太好了。所以我开始在脑海中列出要完成的任务。 +我一开始想,我只要替换故障设备的主板及其直接部件:内存、CPU,可能还有电源。但是在考虑了一段时间之后,我决定将新部件放到服务器中,并将旧的(但仍然可用的)部件从服务器移到故障设备中。可以这样做的,只需一、两个小时就可以从服务器上移除旧部件并安装新的。然后我就可以花时间更换出故障的电脑里的部件了。太好了,所以我开始在脑海中列出要完成的任务。 -然而,当我查看列表时,我意识到服务器中唯一不能替换的部件是机箱和硬盘驱动器,这两台计算机的机箱几乎完全相同。在有了这个小小的发现之后,我开始考虑用新的部件替换出故障的计算机的部件,并将之作为我的服务器。经过一些测试之后,我只需从当前的服务器移除硬盘,并将它安装到新的组件中,改下网络配置项,再更改 KVM 交换机端口上的主机名,并更改主机名标签,就可以了。这将大大减少服务器停机时间,大大减少我的压力。此外,如果出现故障,我可以简单地将硬盘移回原来的服务器,直到我可以用新服务器解决问题为止。 +然而,当我查看这个任务列表时,我意识到服务器中唯一不能替换的部件是机箱和硬盘驱动器,这两台计算机的机箱几乎完全相同。在有了这个小小的发现之后,我开始考虑用新的部件替换出了故障的计算机的部件,并将之作为我的服务器。经过一些测试之后,我只需从当前的服务器移除硬盘,并将它安装到用了新组件的机箱中,改下网络配置项,再更改 KVM 交换机端口上的主机名,并更改机箱上的主机名标签,就可以了。这将大大减少服务器停机时间,大大减少我的压力。此外,如果出现故障,我可以简单地将硬盘移回原来的服务器,直到我可以用新服务器解决问题为止。 -所以,现在我在脑海中已经创建了一个我需要做的任务清单,以完成这项工作。而且——我希望你能仔细观察——当我脑子里想着这一切的时候,我的手指从来没有碰过键盘。我新的心理行动计划风险很低,与我最初的计划相比,涉及的服务器停机时间要少得多。 +所以,现在我在脑海中已经创建了一个完成这项工作我所需要做的任务清单。而且,我希望你能仔细观察,当我脑子里想着这一切的时候,我的手指从来没有碰过键盘。我新的心理行动计划风险很低,与我最初的计划相比,涉及的服务器停机时间要少得多。 -当我在 IBM 工作的时候,我经常看到很多语言中都有写着“思考”的标语。思考可以节省时间和压力,是懒散的系统管理员的主要标志。 +当我在 IBM 工作的时候,我经常看到很多语言中都有写着“**思考**”的标语。思考可以节省时间和压力,是懒散的系统管理员的主要标志。 #### 做预防性维护 -在 1970 年代中期,我被 IBM 聘为客户工程师,我的领地由相当多的穿孔卡片设备组成。这也就是说,它们是处理打孔卡的重型机械设备—— 一些可以追溯到20世纪30年代。因为这些机器主要是机械的,所以它们的部件经常磨损或失调。我的部分工作是在他们损坏时修复这些他们。我工作的主要部分——最重要的部分 ——首先要防止它们。预防性维护的目的是在磨损部件损坏之前进行更换,并对还在运行的部件进行润滑和调整,以确保它们工作正常。 +在 1970 年代中期,我被 IBM 聘为客户工程师,我的领地由相当多的[穿孔卡片设备][2]组成。这也就是说,它们是处理打孔卡的重型机械设备,其中一些可以追溯到 20 世纪 30 年代。因为这些机器主要是机械的,所以它们的部件经常磨损或失调。我的部分工作是在它们损坏时修复它们。我工作的主要部分,也是最重要的部分,是首先要防止它们损坏。预防性维护的目的是在磨损部件损坏之前进行更换,并对还在运行的部件进行润滑和调整,以确保它们工作正常。 +正如我在《系统管理员的 Linux 哲学》中所言: -正如我在《系统管理员的 Linux哲学》( The Linux Philosophy for SysAdmins)中所言: - ->「我在 IBM 的经理们明白这只是冰山一角;他们——和我——都是我的工作是让顾客满意。虽然这通常意味着修复损坏的硬件,但也意味着减少硬件损坏的次数。这对客户来说是好事,因为他们的机器在工作时工作效率更高。这对我有好处,因为我从那些快乐的客户那里接到的电话要少得多。我也睡了更多的觉,因为这样做的结果是更少的非工作时间的紧急电话。我是个懒惰的(客户工程师)。通过提前做额外的工作,从长远来看,我需要做的工作要少得多。 +>“我在 IBM 的经理们明白这只是冰山一角;他们和我都知道,我的工作是让顾客满意。虽然这通常意味着修复损坏的硬件,但也意味着减少硬件损坏的次数。这对客户来说是好事,因为他们的机器在工作时工作效率更高。这对我有好处,因为我从那些快乐的客户那里接到的电话要少得多。我也睡了更多的觉,因为这样做的结果是更少的非工作时间的紧急电话。我是个懒惰的(客户工程师)。通过提前做额外的工作,从长远来看,我需要做的工作要少得多。 > ->「这一原则已成为系统管理员的 Linux 哲学的功能原则之一。作为系统管理员,我们的时间最好用在最大限度地减少未来工作量的任务上。」 +>“这一原则已成为系统管理员的 Linux 哲学的功能原则之一。作为系统管理员,我们的时间最好用在最大限度地减少未来工作量的任务上。” -在 Linux 计算机中查找要解决的问题相当于项目管理。我检查系统日志,寻找以后可能会变得非常危险的问题的暗示。如果出现了一些小问题,或者我注意到我的工作站、服务器没有做出该有的响应,或者如果日志显示了一些不寻常的东西——所有这些都可以暗示出潜在的问题,而对于用户或半秃头老板来说,这些问题并没有产生明显的症状。 +在 Linux 计算机中查找要解决的问题相当于项目管理。我检查系统日志,寻找以后可能会变得非常危险的问题的迹象。如果出现了一些小问题,或者我注意到我的工作站、服务器没有做出该有的响应,或者如果日志显示了一些不寻常的东西,所有这些都可以暗示出潜在的问题,而对于用户或半秃头老板来说,这些问题并没有产生明显的症状。 -我经常检查 `/var/log/` 中的文件,特别是 messages 和 security 文件。我最常见的问题之一是许多脚本小子在我的防火墙系统上尝试各种类型的攻击。而且,不,我不依赖 ISP(Internet Service Provider,网络服务提供者)提供的调制解调器/路由器中的所谓的防火墙。这些日志包含了大量关于企图攻击来源的信息,非常有价值。但是要扫描不同主机上的日志并将解决方案部署到位,需要做大量的工作。所以我转向自动化。 +我经常检查 `/var/log/` 中的文件,特别是 `messages` 和 `security` 文件。我最常见的问题之一是许多脚本小子在我的防火墙系统上尝试各种类型的攻击。而且,不,我不依赖 ISP 提供的调制解调器/路由器中的所谓的防火墙。这些日志包含了大量关于企图攻击来源的信息,非常有价值。但是要扫描不同主机上的日志并将解决方案部署到位,需要做大量的工作,所以我转向自动化。 #### 自动化 -我发现我的工作有很大一部分可以通过某种形式的自动化来完成。系统管理员的 Linux 哲学的原则之一是 「自动化一切」,这包括每天扫描日志文件等枯燥乏味的任务。 +我发现我的工作有很大一部分可以通过某种形式的自动化来完成。系统管理员的 Linux 哲学的原则之一是 “自动化一切”,这包括每天扫描日志文件等枯燥乏味的任务。 -像是 [Logwatch][3] 这类的程序能够监控你的日志文件中的异常条目,并在异常条目发生时通知您。Logwatch通常作为 cron jobs(译者注,Linux/Unix 中周期作业程序)每天运行一次,并向本地主机上的 root 用户发送电子邮件。你可以从命令行运行 Logwatch,并立即在显示器上查看结果。现在我只需要每天查看 Logwatch 的电子邮件通知。 +像是 [Logwatch][3] 这类的程序能够监控你的日志文件中的异常条目,并在异常条目发生时通知您。Logwatch 通常作为 cron 任务每天运行一次,并向本地主机上的 root 用户发送电子邮件。你可以从命令行运行 Logwatch,并立即在显示器上查看结果。现在我只需要每天查看 Logwatch 的电子邮件通知。 -但现实是,仅仅收到通知是不够的,因为我们不能坐以待毙。有时需要立即作出反应。我喜欢的另一个程序是——它能为我做所有事——(让大家看到,这就是懒惰的管理员)——它就是[Fail2ban][4]。Fail2Ban 会扫描指定的日志文件,查找各种类型的黑客攻击和入侵尝试,如果它发现某个 IP 地址在做特定类型的持续活动够了,它会向防火墙添加一个条目,在指定的时间内阻止来自该 IP 地址的任何进一步的黑客尝试。默认值通常在 10 分钟左右,但我喜欢为大多数类型的攻击指定为 12 或 24 小时。每种类型的黑客攻击都是单独配置的,例如尝试通过 SSH 登录和那些 Web 服务器的攻击。 +但现实是,仅仅收到通知是不够的,因为我们不能坐以待毙。有时需要立即作出反应。我喜欢的另一个程序是——它能为我做所有事(看,这就是懒惰的管理员)——它就是 [Fail2ban][4]。Fail2Ban 会扫描指定的日志文件,查找各种类型的黑客攻击和入侵尝试,如果它发现某个 IP 地址在持续做特定类型的活动,它会向防火墙添加一个条目,在指定的时间内阻止来自该 IP 地址的任何进一步的黑客尝试。默认值通常在 10 分钟左右,但我喜欢为大多数类型的攻击指定为 12 或 24 小时。每种类型的黑客攻击都是单独配置的,例如尝试通过 SSH 登录和那些 Web 服务器的攻击。 #### 写脚本 -自动化是哲学的关键组成部分之一。一切可以自动化的东西都应该自动化的,其余的尽可能地自动化。所以,我也写了很多脚本来解决问题,也就说说我编写脚本来完成我的大部分工作。 +自动化是这种哲学的关键组成部分之一。一切可以自动化的东西都应该自动化的,其余的尽可能地自动化。所以,我也写了很多脚本来解决问题,也就是说我编写了脚本来完成我的大部分工作。 -我的脚本帮我节省了大量时间,因为它们包含执行特定任务的命令,这大大减少了我需要输入的数量。例如,我经常重新启动我的电子邮件服务器和垃圾邮件处理软件(当修改 SpamAssassin 的 `local.cf` 配置文件时,就需要重启)。必须按特定顺序停止并重新启动这些服务。因此,我用几个命令编写了一个简短的脚本,并将其存储在可访问的 `/usr/local/bin` 中。现在,不用键入几个命令并等待每个命令都完成,然后再键入下一个命令——更用记住正确的命令顺序和每个命令的正确语法——我输入一个三个字符的命令,其余的留给我的脚本来完成。 +我的脚本帮我节省了大量时间,因为它们包含执行特定任务的命令,这大大减少了我需要输入的数量。例如,我经常重新启动我的电子邮件服务器和垃圾邮件过滤软件(当修改 SpamAssassin 的 `local.cf` 配置文件时,就需要重启)。必须按特定顺序停止并重新启动这些服务。因此,我用几个命令编写了一个简短的脚本,并将其存储在可访问的 `/usr/local/bin` 中。现在,不用键入几个命令并等待每个命令都完成,然后再键入下一个命令,更不用记住正确的命令顺序和每个命令的正确语法,我输入一个三个字符的命令,其余的留给我的脚本来完成。 #### 简化键入 -另一种成为懒惰的系统管理员的方法是减少我们需要键入的数量。而且,我的打字技巧真的很糟糕(也就是说,我一点也没有——顶多是几个笨拙的手指)。导致错误的一个可能原因是我的打字不好,所以我会尽量少打字。 +另一种成为懒惰的系统管理员的方法是减少我们需要键入的数量。而且,我的打字技巧真的很糟糕(也就是说,我一点也没有,顶多是几个笨拙的手指)。导致错误的一个可能原因是我糟糕的打字技巧,所以我会尽量少打字。 -绝大多数 GNU 和 Linux 核心实用程序都有非常短的名称。然而,它们都是有意义的名字。诸如用于更改目录的 `cd` 、用于列出(目录内容)的 `ls` 和用于磁盘转储的 `dd` 等工具都非常明显。短名字意味着更少的打字和更少的产生错误机会。我认为短的名字通常更容易记住。 +绝大多数 GNU 和 Linux 核心实用程序都有非常短的名称。然而,它们都是有意义的名字。诸如用于更改目录的 `cd` 、用于列出目录内容的 `ls` 和用于磁盘转储的 `dd` 等工具都一目了然。短名字意味着更少的打字和更少的产生错误机会。我认为短的名字通常更容易记住。 -当我编写 shell 脚本时,我喜欢保持名称简短而意义(至少对我来说是),比如用于 rsync 备份的 `rsbu`(译者注,Rsync Backup 的简写)。在某些情况下,我喜欢使用更长的名称,比如 `doUpdates` 来执行系统更新。在后一种情况下,长一点名让脚本的目的就越明显。这可以节省时间,因为很容易记住脚本的名称。 +当我编写 shell 脚本时,我喜欢保持名称简短而意义(至少对我来说是),比如用于 rsync 备份的 `rsbu`(LCTT 译注,Rsync Backup 的简写)。但在某些情况下,我喜欢使用更长的名称,比如 `doUpdates` 来执行系统更新。在后一种情况下,更长一点的名字让脚本的目的更明显。这可以节省时间,因为很容易记住脚本的名称。 -其他减少键入的方法包括命令行别名(alias)、命令行调回(recall)和编辑。别名只是你在 Bash shell 键入命令时才做的替换。键入 `alias` 命令会看到默认配置的别名列表。例如,当你输入命令 `ls` 时,会被条目 `alias ls='ls –color=auto'` 替成较长的命令,因此你只需键入 2 个字符而不是 14 个字符即可获得带有颜色的列表。还可以使用 `alias` 命令添加你自己(定义)的别名。 +其他减少键入的方法包括命令行别名、历史命令调回和编辑。别名只是你在 Bash shell 键入命令时才做的替换。键入 `alias` 命令会看到默认配置的别名列表。例如,当你输入命令 `ls` 时,会被条目 `alias ls='ls –color=auto'` 替成较长的命令,因此你只需键入 2 个字符而不是 14 个字符即可获得带有颜色的文件列表。还可以使用 `alias` 命令添加你自己定义的别名。 -命令行调回允许你使用键盘的向上和向下箭头键滚动浏览命令历史记录。如果需要再次使用相同的命令,只需在找到所需的命令时按 Enter 键即可。如果在找到命令后需要更改该命令,则可以使用标准命令行编辑功能进行更改。 +历史命令调回允许你使用键盘的向上和向下箭头键滚动浏览命令历史记录。如果需要再次使用相同的命令,只需在找到所需的命令时按回车键即可。如果在找到命令后需要更改该命令,则可以使用标准命令行编辑功能进行更改。 ### 结束语 -一名懒惰的系统管理员实际上也有很多的工作。但我们是聪明地工作,而不是刻苦工作。早在一堆小问题汇聚成大问题之前, 我们就花时间探索我们负责的主机,并处理好所有的小问题。我们花了很多时间思考解决问题的最佳方法, 我们也花了很多时间来发现新的方法, 让自己更聪明地工作, 成为懒惰的系统管理员。 +一名懒惰的系统管理员实际上也有很多的工作。但我们是聪明地工作,而不是刻苦工作。早在一堆小问题汇聚成大问题之前,我们就花时间探索我们负责的主机,并处理好所有的小问题。我们花了很多时间思考解决问题的最佳方法,我们也花了很多时间来发现新的方法,让自己更聪明地工作,成为懒惰的系统管理员。 -除了这里描述的少数方法外, 还有许多其他的方式可以成为懒惰的系统管理员。我相信你也有一些自己的方式;请在评论中和我们分享。 +除了这里描述的少数方法外,还有许多其他的方式可以成为懒惰的系统管理员。我相信你也有一些自己的方式;请在评论中和我们分享。 -------------------------------------------------------------------------------- @@ -200,7 +107,7 @@ via: https://opensource.com/article/18/7/how-be-lazy-sysadmin 作者:[David Both][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[zgj1024](https://github.com/zgj1024) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -208,4 +115,4 @@ via: https://opensource.com/article/18/7/how-be-lazy-sysadmin [1]:https://www.apress.com/us/book/9781484237298 [2]:https://en.wikipedia.org/wiki/Unit_record_equipment [3]:https://www.techrepublic.com/article/how-to-install-and-use-logwatch-on-linux/ -[4]:https://www.fail2ban.org/wiki/index.php/Main_Page \ No newline at end of file +[4]:https://www.fail2ban.org/wiki/index.php/Main_Page From bd11e3e57999f374665013e34cbcfc8db5dfeb05 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 6 Jan 2019 21:30:45 +0800 Subject: [PATCH 0468/4278] =?UTF-8?q?20171227=20YAML-=20probably=20not=20s?= =?UTF-8?q?o=20great=20after=20all.md=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 --- ...7 YAML- probably not so great after all.md | 316 ------------------ ...7 YAML- probably not so great after all.md | 292 ++++++++++++++++ 2 files changed, 292 insertions(+), 316 deletions(-) delete mode 100644 sources/tech/20171227 YAML- probably not so great after all.md create mode 100644 translated/tech/20171227 YAML- probably not so great after all.md diff --git a/sources/tech/20171227 YAML- probably not so great after all.md b/sources/tech/20171227 YAML- probably not so great after all.md deleted file mode 100644 index adeab60bd2..0000000000 --- a/sources/tech/20171227 YAML- probably not so great after all.md +++ /dev/null @@ -1,316 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (YAML: probably not so great after all) -[#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) -[#]: author: (Martin Tournoij https://arp242.net/) - -YAML: probably not so great after all -====== - - -I previously wrote [why using JSON for human-editable configuration files is a bad idea][1]. Today we’re going to look at some general problems with the YAML format. - -### Insecure by default - -YAML is insecure by default. Loading a user-provided (untrusted) YAML string needs careful consideration. - -``` -!!python/object/apply:os.system -args: ['ls /'] -``` - -Running it with `print(yaml.load(open('a.yaml')))` should give you something like: - -``` -bin etc lib lost+found opt root sbin tmp var sys -boot dev efi home lib64 mnt proc run srv usr -0 -``` - -Many other languages (including Ruby and PHP) are also unsafe by default. [Searching for `yaml.load` on GitHub][2] gives a whopping 2.8 million results. [`yaml.safe_load`][3] only gives 26,000 results. - -Mind you, many of those `yaml.load()`s are fine – loading in a config file with `yaml.load()` is often okay since it’s usually (though not always!) from a ‘trusted source’, and many are from test files with static YAML. But still, one can’t help but wonder how many exploits are hidden in those 2.8 million results. - -This is not a theoretical problem. In 2013 [every Ruby on Rails application ever written was found to be vulnerable][4] to remote code execution due to exactly this problem. - -One might argue this is not really the fault of the YAML format as such, but rather the fault of the libraries implementing it wrong, but it seems to be the case that the majority of libraries are unsafe by default (especially the dynamic languages), so de-facto it is a problem with YAML. - -One might also argue that fixing it is as easy as replacing `load()` with `safe_load()`, but many people are unaware of the problem, and even if you’re aware of it, it’s one of those things that can be easy to forget. It’s pretty bad API design. - -### Can be hard to edit, especially for large files - -YAML files can be hard to edit, and this difficulty grows fast as the file gets larger. - -A good example of this are Ruby on Rails’ translation files; for example: - -``` -en: - formtastic: - labels: - title: "Title" # Default global value - article: - body: "Article content" - post: - new: - title: "Choose a title..." - body: "Write something..." - edit: - title: "Edit title" - body: "Edit body" -``` - -This still looks okay, right? But what if this file has 100 lines? Or 1,000 lines? It is difficult to see “where” in the file you are because it may be off the screen. You’ll need to scroll up, but then you need to keep track of the indentation, which can be pretty hard even with indentation guides, especially since 2-space indentation is the norm and [tab indentation is forbidden][5]. - -And accidentally getting the indentation wrong often isn’t an error; it will often just deserialize to something you didn’t intend. Happy debugging! - -I’ve been happily programming Python for over a decade, so I’m used to significant whitespace, but sometimes I’m still struggling with YAML. In Python the drawbacks and loss of clarity are contained by not having functions that are several pages long, but data or configuration files have no such natural limits to their length. - -For small files this is not a problem; but it really doesn’t scale well to larger files, especially not if you want to edit them later on. - -### It’s pretty complex - -YAML may seem ‘simple’ and ‘obvious’ when glancing at a basic example, but turns out it’s not. The [YAML spec][6] is 23,449 words; for comparison, [TOML][7] is 3,339 words, [JSON][8] is 1,969 words, and [XML][9] is 20,603 words. - -Who among us have read all that? Who among us have read and understood all of that? Who among of have read, understood, and **remembered** all of that? - -For example did you know there are [nine ways to write a multi-line string in YAML][10] with subtly different behaviour? - -Yeah :-/ - -That post gets even more interesting if you look at [its revision history][11], as the author of the post discovers more and more ways to do this and more of the subtleties involved. - -It’s telling that the YAML spec starts with a preview, which states (emphases mine): - -> This section provides a quick glimpse into the expressive power of YAML. **It is not expected that the first-time reader grok all of the examples**. Rather, these selections are used as motivation for the remainder of the specification. - -#### Surprising behaviour - -What does this parse to (examples courtesy of [Colm O’Connor][12]): - -``` -- Don Corleone: Do you have faith in my judgment? -- Clemenza: Yes -- Don Corleone: Do I have your loyalty? -``` - -Yup! - -``` -[ - {'Don Corleone': 'Do you have faith in my judgment?'}, - {'Clemenza': True}, - {'Don Corleone': 'Do I have your loyalty?'} -] -``` - -Or what about: - -``` -python: 3.5.3 -postgres: 9.3 -``` - -`3.5.3` gets recognized as as string, but `9.3` gets recognized as a number instead of a string: - -``` -{'python': '3.5.3', 'postgres': 9.3} -``` - -Or what about: - -``` -Effenaar: Eindhoven -013: Tilburg -``` - -013 is a popular music Venue in Tilburg, but YAML will send you the wrong way since it’s parsed as an octal number: - -``` -{11: 'Tilburg', 'Effenaar': 'Eindhoven'} -``` - -All of this – and more – is why many experienced YAMLers will often quote all strings, even when it’s not strictly required. Many people don’t use quotes, and it can be easy to forget especially if the rest of the file – possibly written by other people – doesn’t use quotes. - -#### It’s not portable - -Because it’s so complex, its claims of portability have been greatly exaggerated. For example consider this example taken from the YAML spec: - -``` -? - Detroit Tigers - - Chicago cubs -: - - 2001-07-23 - -? [ New York Yankees, - Atlanta Braves ] -: [ 2001-07-02, 2001-08-12, - 2001-08-14 ] -``` - -Aside from the fact that most readers of this probably won’t even know what this does, try parsing it in Python with PyYAML: - -``` -yaml.constructor.ConstructorError: while constructing a mapping - in "a.yaml", line 1, column 1 -found unhashable key - in "a.yaml", line 1, column 3 -``` - -In Ruby it works: - -``` -{ - ["Detroit Tigers", "Chicago cubs"] => [ - # - ], - ["New York Yankees", "Atlanta Braves"] => [ - #, - #, - # - ] -} -``` - -The reason for this is because you can’t use a list as a dict key in Python: - -``` ->>> {['a']: 'zxc'} -Traceback (most recent call last): - File "", line 1, in - TypeError: unhashable type: 'list' -``` - -And this restriction is not unique to Python; common languages such as PHP, JavaScript, and Go all share this restriction. - -So use this in a YAML file, and you won’t be able to read it in most languages. - -Here’s another example again taken from the examples section of the YAML spec: - -``` -# Ranking of 1998 home runs ---- -- Mark McGwire -- Sammy Sosa -- Ken Griffey - -# Team ranking ---- -- Chicago Cubs -- St Louis Cardinals -``` - -Python says: - -``` -yaml.composer.ComposerError: expected a single document in the stream - in "a.yaml", line 3, column 1 -but found another document - in "a.yaml", line 8, column 1 -``` - -While Ruby outputs: - -``` -["Mark McGwire", "Sammy Sosa", "Ken Griffey"] -``` - -The reason for this is that there are multiple YAML documents in a single file (`---` start the document). In Python there is the `load_all()` function to parse all documents. Ruby’s `load()` just loads the first document, and as near as I can tell, doesn’t have a way to load multiple documents. - -There are [many more incompatibilities between implementations][13]. - -### Goals achieved? - -The spec states: - -> The design goals for YAML are, in decreasing priority: -> -> 1. YAML is easily readable by humans. -> 2. YAML data is portable between programming languages. -> 3. YAML matches the native data structures of agile languages. -> 4. YAML has a consistent model to support generic tools. -> 5. YAML supports one-pass processing. -> 6. YAML is expressive and extensible. -> 7. YAML is easy to implement and use. -> - - -So how well does it do? - -> YAML is easily readable by humans. - -True only if you stick to a small subset. The full set is complex – much more so than XML or JSON. - -> YAML data is portable between programming languages. - -Not really true, as it’s too easy to create constructs that are not supported by common languages. - -> YAML matches the native data structures of agile languages. - -See above. Plus, why only support agile (or dynamic) languages? What about other languages? - -> YAML has a consistent model to support generic tools. - -I am not even sure what this means and I can’t find any elaboration. - -> YAML supports one-pass processing. - -I’ll take their word for it. - -> YAML is expressive and extensible. - -Well, it is, but it’s too expressive (e.g. too complex). - -> YAML is easy to implement and use. - -``` -$ cat `ls -1 ~/gocode/src/github.com/go-yaml/yaml/*.go | grep -v _test` | wc -l -9247 - -$ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l -5713 -``` - -### Conclusion - -Don’t get me wrong, it’s not like YAML is absolutely terrible – it’s certainly not as [problematic as using JSON][1] – but it’s not exactly great either. There are some drawbacks and surprises that are not at all obvious at first, and there are a number of better alternatives such as [TOML][7] and other more specialized formats. - -Personally, I’m not likely to use it again when I’ve got a choice. - -If you must use YAML then I recommend you use [StrictYAML][14], which removes some (though not all) of the more hairy parts. - -### Feedback - -You can mail me at [martin@arp242.net][15] or [create a GitHub issue][16] for feedback, questions, etc. - --------------------------------------------------------------------------------- - -via: https://arp242.net/weblog/yaml_probably_not_so_great_after_all.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]: http://arp242.net/weblog/JSON_as_configuration_files-_please_dont.html -[2]: https://github.com/search?q=yaml.load&type=Code&utf8=%E2%9C%93 -[3]: https://github.com/search?q=yaml.safe_load&type=Code&utf8=%E2%9C%93 -[4]: https://www.sitepoint.com/anatomy-of-an-exploit-an-in-depth-look-at-the-rails-yaml-vulnerability/ -[5]: http://www.yaml.org/faq.html -[6]: http://yaml.org/spec/1.2/spec.pdf -[7]: https://github.com/toml-lang/toml -[8]: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf -[9]: https://www.w3.org/TR/REC-xml/ -[10]: http://stackoverflow.com/a/21699210/660921 -[11]: http://stackoverflow.com/posts/21699210/revisions -[12]: https://github.com/crdoconnor/strictyaml/blob/master/FAQ.rst#what-is-wrong-with-implicit-typing -[13]: https://github.com/cblp/yaml-sucks -[14]: https://github.com/crdoconnor/strictyaml -[15]: mailto:martin@arp242.net -[16]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/translated/tech/20171227 YAML- probably not so great after all.md b/translated/tech/20171227 YAML- probably not so great after all.md new file mode 100644 index 0000000000..a64cb1e43d --- /dev/null +++ b/translated/tech/20171227 YAML- probably not so great after all.md @@ -0,0 +1,292 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (YAML: probably not so great after all) +[#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +YAML: 可能并不是那么完美 +====== + +我之前写过[为什么将 JSON 用于人类可编辑的配置文件是一个坏主意][1],今天我们将讨论 YAML 格式的一些常见问题。 + +### 默认情况下不安全 + +YAML 默认是不安全的。加载用户提供的(不可信的)YAML 字符串需要仔细考虑。 +``` +!!python/object/apply:os.system +args: ['ls /'] +``` + +用 `print(yaml.load(open('a.yaml')))` 运行它,应该给你这样的东西: +``` +bin etc lib lost+found opt root sbin tmp var sys +boot dev efi home lib64 mnt proc run srv usr +0 +``` + +许多其他语言(包括 Ruby 和 PHP)默认情况下(to 校正:这里应该说的是解析 yaml)也不安全。[在 GitHub 上搜索 `yaml.load`][2] 会得到惊人的 280 万个结果,而 [`yaml.safe_load`][3] 只能得到 26,000 个结果。 + +提个醒,很多这样的 `yaml.load()` 都工作的很好,在配置文件中加载 `yaml.load()` 通常没问题,因为它通常(虽然并不总是!)来自“可靠源”,而且很多都来自静态的 YAML 测试文件。但是,人们还是不禁怀疑在这 280 万个结果中隐藏了多少漏洞。 + +这不是一个理论问题。在 2013 年,[正是由于这个问题,所有的 Ruby on Rails 应用程序都被发现易受][4]远程代码执行攻击。 + +有人可能会反驳说这不是 YAML 格式的错误,而是那些库实现错误的的问题,但似乎大多数库默认不是安全的(特别是动态语言),所以事实上这是 YAML 的一个问题。 + +有些人可能会反驳认为修复它就像用 `safe_load()` 替换 `load()` 一样容易,但是很多人都没有意识到这个问题,即使你知道它,它也是很容易忘记的事情之一。这是非常糟糕的 API 设计。 + +### 可能很难编辑,特别是对于大文件 + +YAML 文件可能很难编辑,随着文件变大,这个难度会快速增大。 + +一个很好的例子是 Ruby on Rails 的翻译文件。(to 校正:这里 translation files 是什么?)例如: +``` +en: + formtastic: + labels: + title: "Title" # Default global value + article: + body: "Article content" + post: + new: + title: "Choose a title..." + body: "Write something..." + edit: + title: "Edit title" + body: "Edit body" +``` + +看起来不错,对吧?但是如果这个文件有 100 行怎么办?或者 1,000 行?在文件中很难看到 "where",因为它可能在屏幕外。你需要向上滚动,但是你需要跟踪缩进,即使使用缩进指南也很难,特别是因为 2 个缩进是常态而且 [tab 缩进被禁止][5]。 + +不小心缩进出错通常不是一个错误,它通常只是反序列化为你不想要的东西。这样只能祝你调试快乐! + +我已经愉快地编写 Python 长达十多年,所以我已经习惯了显著的空白,但有时候我仍在和 YAML 抗争。在 Python 中,缺点和清晰度的丧失是由于没有那种长达几页的函数,但数据或配置文件的长度没有这种自然限制。(to 校正:这里不太明白为什么没有长达几页函数会导致 python 清晰度的丧失,或许我的翻译有问题) + +对于小文件,这不是问题,但它确实无法很好地扩展到较大的文件,特别是如果你以后想编辑它们的话。 + +### 这非常复杂 + +在浏览一个基本的例子时,YAML 看似“简单”和“显而易见”,但事实证明并非如此。[YAML 规范][6]有 23,449 个单词,为了比较,[TOML][7] 有 3,339 个单词,[Json][8] 有 1,969 个单词,[XML][9] 有 20,603 个单词。 + +我们中有谁读过全部吗?有谁读过并理解了全部?谁阅读过,理解进而**记住**所有这些? + +例如,你知道有[ 9 种方法在 YAML 中编写多行字符串][10]吗?并且它们具有细微的不同行为。 + +是的 :-/ + +如果你看一下[它的修订历史][11],那篇文章就会变得更加有趣,因为文章的作者发现了越来越多的方法可以实现这一点,以及更多的细微之处。 + +它从预览开始告诉我们 YANL 规范,它表明(强调我的): + +> 本节简要介绍了 YAML 的表达能力。**初次阅读的人不可能熟读所有的例子**。相反,这些选择用作规范其余部分的动机。 + +#### 惊讶的行为 + +以下会解析成什么([Colm O’Connor][12] 提供的例子): +``` +- Don Corleone: Do you have faith in my judgment? +- Clemenza: Yes +- Don Corleone: Do I have your loyalty? +``` + +结果为 +``` +[ + {'Don Corleone': 'Do you have faith in my judgment?'}, + {'Clemenza': True}, + {'Don Corleone': 'Do I have your loyalty?'} +] +``` + +那么这个呢: +``` +python: 3.5.3 +postgres: 9.3 +``` + +`3.5.3` 被识别为字符串,但 `9.3` 被识别为数字而不是字符串: +``` +{'python': '3.5.3', 'postgres': 9.3} +``` + +这个呢: +``` +Effenaar: Eindhoven +013: Tilburg +``` + +013 是蒂尔堡(Tilburg)的一个流行音乐场地,但 YAML 会告诉你错误答案,因为它被解析为八进制数字: +``` +{11: 'Tilburg', 'Effenaar': 'Eindhoven'} +``` + +所有这一切,以及更多,就是为什么许多经验丰富的 YAMLers 经常会引用所有字符串的原因,即使它不是严格要求。许多人不使用引号,而且很容易忘记,特别是如果文件的其余部分(可能由其他人编写)不使用引号。 + +### 它不方便 + +因为它太复杂了,它声称的可移植性被夸大了。例如,考虑以下这个从 YAML 规范中获取的示例: +``` +? - Detroit Tigers + - Chicago cubs +: + - 2001-07-23 + +? [ New York Yankees, + Atlanta Braves ] +: [ 2001-07-02, 2001-08-12, + 2001-08-14 ] +``` + +除了大多数读者可能甚至不知道这样做的事实,还可以尝试使用 PyYAML 在 Python 中解析它: +``` +yaml.constructor.ConstructorError: while constructing a mapping + in "a.yaml", line 1, column 1 +found unhashable key + in "a.yaml", line 1, column 3 +``` + +在 Ruby 中,它可以工作: +``` +{ + ["Detroit Tigers", "Chicago cubs"] => [ + # + ], + ["New York Yankees", "Atlanta Braves"] => [ + #, + #, + # + ] +} +``` + +原因是你不能在 Python 中使用列表作为一个字典(dict)键: +``` +>>> {['a']: 'zxc'} +Traceback (most recent call last): + File "", line 1, in + TypeError: unhashable type: 'list' +``` + +而这种限制并不是 Python 特有的,PHP, JavaScript 和 Go 等常用语言都有此限制。 + +因此,在 YAML 文件中使用它,你将无法在大多数语言中解析它。 + +这是另一个从 YAML 规范的示例部分中获取的: +``` +# Ranking of 1998 home runs +--- +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +# Team ranking +--- +- Chicago Cubs +- St Louis Cardinals +``` + +Python 会输出: + +``` +yaml.composer.ComposerError: expected a single document in the stream + in "a.yaml", line 3, column 1 +but found another document + in "a.yaml", line 8, column 1 +``` + +然而 Ruby 输出: +``` +["Mark McGwire", "Sammy Sosa", "Ken Griffey"] +``` + +原因是单个文件中有多个 YAML 文档(`---` 意味开始一个新文档)。在 Python 中,有一个 `load_all` 函数来解析所有文档,而 Ruby 的 `load()` 只是加载第一个文档,据我所知,它没有办法加载多个文档。 + +[在实现之间存在很多不兼容][13]。 + +### 目标实现了吗? + +规范说明: + +> YAML 的设计目标是降低优先级: +> +> 1. YAML 很容易被人类阅读。 +> 2. YAML 数据在编程语言之间是可移植的。 +> 3. YAML 匹配敏捷语言的原生数据结构。 +> 4. YAML 有一个一致的模型来支持通用工具。 +> 5. YAML 支持一趟处理。(to 校正:这里 one-pass 是否有专业翻译?) +> 6. YAML 具有表现力和可扩展性。 +> 7. YAML 易于实现和使用。 +> + +那么它有多好呢? + +> YAML 很容易被人类阅读。 +只有坚持一小部分时才有效。完整集很复杂 - 远远超过 XML 或 JSON。 + +> YAML 数据在编程语言之间是可移植的。 +事实并非如此,因为创建常见语言不支持的结构太容易了。 + +> YAML 匹配敏捷语言的原生数据结构。 +往上看。另外,为什么只支持敏捷(或动态)语言?其他语言呢? + +> YAML 有一个一致的模型来支持通用工具。 +我甚至不确定这意味着什么,我找不到任何详细说明。 + +> YAML 支持一趟处理。 +这点我接受。 + +> YAML 具有表现力和可扩展性。 +嗯,是的,但它太富有表现力(例如太复杂)。 + +> YAML 易于实现和使用。 +``` +$ cat `ls -1 ~/gocode/src/github.com/go-yaml/yaml/*.go | grep -v _test` | wc -l +9247 + +$ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l +5713 +``` + +### 结论 + +不要误解我的意思,并不是说 YAML 很糟糕 - 它肯定不像[使用 JSON 那么多的问题][1] - 但它也不是非常好。有一些一开始并不明显的缺点和惊喜,还有许多更好的替代品,如 [TOML][7] 和其他更专业的格式。 + +就个人而言,当我有选择时,我不太可能再次使用它。 + +如果你必须使用 YAML,那么我建议你使用 [StrictYAML][14],它会删除一些(虽然不是全部)比较麻烦的部分。 + +### 反馈 + +你可以发送电子邮件至 [martin@arp242.net][15] 或[创建 GitHub issue][16] 以获取反馈,问题等。 + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html + +作者:[Martin Tournoij][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://arp242.net/ +[b]: https://github.com/lujun9972 +[1]: http://arp242.net/weblog/JSON_as_configuration_files-_please_dont.html +[2]: https://github.com/search?q=yaml.load&type=Code&utf8=%E2%9C%93 +[3]: https://github.com/search?q=yaml.safe_load&type=Code&utf8=%E2%9C%93 +[4]: https://www.sitepoint.com/anatomy-of-an-exploit-an-in-depth-look-at-the-rails-yaml-vulnerability/ +[5]: http://www.yaml.org/faq.html +[6]: http://yaml.org/spec/1.2/spec.pdf +[7]: https://github.com/toml-lang/toml +[8]: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf +[9]: https://www.w3.org/TR/REC-xml/ +[10]: http://stackoverflow.com/a/21699210/660921 +[11]: http://stackoverflow.com/posts/21699210/revisions +[12]: https://github.com/crdoconnor/strictyaml/blob/master/FAQ.rst#what-is-wrong-with-implicit-typing +[13]: https://github.com/cblp/yaml-sucks +[14]: https://github.com/crdoconnor/strictyaml +[15]: mailto:martin@arp242.net +[16]: https://github.com/Carpetsmoker/arp242.net/issues/new From a91b4862d2aca43fc653712c75f877e8637208e9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 6 Jan 2019 22:54:44 +0800 Subject: [PATCH 0469/4278] PUB:20180731 How to be the lazy sysadmin.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zgj1024 本文首发地址:https://linux.cn/article-10419-1.html 您的LCTT 专页地址:https://linux.cn/lctt/zgj1024 请注册领取LCCN:https://lctt.linux.cn/ --- .../talk => published}/20180731 How to be the lazy sysadmin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {translated/talk => published}/20180731 How to be the lazy sysadmin.md (99%) diff --git a/translated/talk/20180731 How to be the lazy sysadmin.md b/published/20180731 How to be the lazy sysadmin.md similarity index 99% rename from translated/talk/20180731 How to be the lazy sysadmin.md rename to published/20180731 How to be the lazy sysadmin.md index 5f1c5b7da5..3acc9ce9c4 100644 --- a/translated/talk/20180731 How to be the lazy sysadmin.md +++ b/published/20180731 How to be the lazy sysadmin.md @@ -1,6 +1,6 @@ 如何成为一名懒惰的系统管理员 ====== -> 我们是聪明地工作,而不是刻苦工作,但仍把你的工作做好。 +> 我们是聪明地工作,而不是刻苦工作,但仍能把工作做好。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) From f7fa58d0031bc351062a3009bc09b7c1c81a71d0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 6 Jan 2019 23:22:18 +0800 Subject: [PATCH 0470/4278] PRF:20181217 4 cool new projects to try in COPR for December 2018.md @geekpi --- ...ojects to try in COPR for December 2018.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md index e69a659b9e..c791f3c0ca 100644 --- a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md +++ b/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md @@ -1,23 +1,25 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 cool new projects to try in COPR for December 2018) [#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) [#]: author: (Dominik Turecek https://fedoramagazine.org) -2018 年 12 月值得尝试的 4个很酷的 COPR 新项目 +COPR 仓库中 4 个很酷的新软件(2018.12) ====== + ![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) -COPR 是个人软件仓库[集合][1],它不在 Fedora 中。某些软件不符合允许轻松打包的标准。或者它可能不符合其他 Fedora 标准,尽管它是自由开源的。COPR 可在 Fedora套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或由项目自己签名。但是,这是尝试新的或实验性软件的一种很好的方法。 +COPR 是软件的个人存储库的[集合][1],它包含那些不在标准的 Fedora 仓库中的软件。某些软件不符合允许轻松打包的标准。或者它可能不符合其他 Fedora 标准,尽管它是自由开源的。COPR 可以在标准的 Fedora 包之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,它是尝试新的或实验性软件的一种很好的方法。 这是 COPR 中一组新的有趣项目。 ### MindForger -[MindForger][2] 是 Markdown 编辑器和笔记本。除了你希望的 Markdown 编辑器的功能之外,MindForger 还允许你将单个文件拆分为多个笔记。组织笔记并在文件之间移动、搜索它们都很容易。我已经使用 MindForger 一段时间来记录学习笔记了,现在可以在 COPR 中找到它啦。 +[MindForger][2] 是一个 Markdown 编辑器和笔记本。除了你预期的 Markdown 编辑器的功能之外,MindForger 还允许你将单个文件拆分为多个笔记。组织笔记并在文件之间移动、搜索它们都很容易。我已经使用 MindForger 一段时间来记录学习笔记了,现在可以在 COPR 中找到它啦。 + ![][3] #### 安装说明 @@ -31,7 +33,7 @@ sudo dnf install mindforger ### Clingo -[Clingo][4] 是使用[回答集编程][5] (ASP) 建模语言解决逻辑问题的程序。使用 ASP,你可以将问题声明为一个 Clingo 逻辑程序然后解决。最后,Clingo 以逻辑模型的形式产生问题的解决方案,称为回答集。 +[Clingo][4] 是使用[回答集编程][5](ASP)建模语言解决逻辑问题的程序。使用 ASP,你可以将问题声明为一个逻辑程序,然后 Clingo 来解决。最后,Clingo 以逻辑模型的形式产生问题的解决方案,称为回答集。 #### 安装说明 @@ -44,7 +46,8 @@ sudo dnf install clingo ### SGVrecord -[SGVrecord][6] 是一个用于录制屏幕的简单工具。它允许你捕获整个屏幕或仅选择其中的一部分。此外,有没有声音都可以进行录制。Sgvrecord 以 WebM 格式生成文件。 +[SGVrecord][6] 是一个用于录制屏幕的简单工具。它允许你捕获整个屏幕或仅选择其中的一部分。此外,有没有声音都可以进行录制。SGVrecord 以 WebM 格式生成文件。 + ![][7] #### 安装说明 @@ -77,7 +80,7 @@ via: https://fedoramagazine.org/4-try-copr-december-2018/ 作者:[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/) 荣誉推出 @@ -90,4 +93,4 @@ via: https://fedoramagazine.org/4-try-copr-december-2018/ [5]: https://en.wikipedia.org/wiki/Answer_set_programming [6]: https://github.com/yucefsourani/sgvrecord [7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png -[8]: https://facebook.github.io/watchman/ \ No newline at end of file +[8]: https://facebook.github.io/watchman/ From b0537b55c6a8473c0e4fed419dbeb569c9d06d49 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 6 Jan 2019 23:23:10 +0800 Subject: [PATCH 0471/4278] PUB:20181217 4 cool new projects to try in COPR for December 2018.md @geekpi https://linux.cn/article-10420-1.html --- ...17 4 cool new projects to try in COPR for December 2018.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181217 4 cool new projects to try in COPR for December 2018.md (98%) diff --git a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/published/20181217 4 cool new projects to try in COPR for December 2018.md similarity index 98% rename from translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md rename to published/20181217 4 cool new projects to try in COPR for December 2018.md index c791f3c0ca..5aa1170d24 100644 --- a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md +++ b/published/20181217 4 cool new projects to try in COPR for December 2018.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10420-1.html) [#]: subject: (4 cool new projects to try in COPR for December 2018) [#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) [#]: author: (Dominik Turecek https://fedoramagazine.org) From 70a8cec601c0115caa85a19fb8ca73b76abd95c2 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Sun, 6 Jan 2019 23:24:54 +0800 Subject: [PATCH 0472/4278] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=2020190102=20How=20To=20Display=20Thumbnail=20Images=20In=20Te?= =?UTF-8?q?rminal.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 20190102 How To Display Thumbnail Images In Terminal.md --- .../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 2756747334..3c4105e13f 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: ( ) +[#]: translator: ( WangYueScream) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 922e13340ad924d00129bcc6b160d11ac2fb30a8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 00:09:39 +0800 Subject: [PATCH 0473/4278] PRF:20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @qhwdw --- ...y with PGP - Part 6- Using PGP with Git.md | 195 +++++++----------- 1 file changed, 80 insertions(+), 115 deletions(-) diff --git a/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md index ba010bb0ec..688864d163 100644 --- a/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md +++ b/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @@ -1,123 +1,92 @@ 保护代码完整性(六):在 Git 上使用 PGP ====== +> 我们继续我们的 PGP 实践系列,来看看签名标签的标签和提交,这可以帮你确保你的仓库没有被篡改。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/global-network.jpg?itok=h_hhZc36) + 在本系列教程中,我们提供了一个使用 PGP 的实用指南,包括基本概念和工具、生成和保护你的密钥。如果你错过了前面的文章,你可以查看下面的链接。在这篇文章中,我们谈一谈在 Git 中如何集成 PGP、使用签名的标签,然后介绍签名提交,最后添加签名推送的支持。 -[第一部分:基本概念和工具][1] - -[第二部分:生成你的主密钥][2] - -[第三部分:生成 PGP 子密钥][3] - -[第四部分:将主密钥移到离线存储中][4] - -[第五部分:将子密钥移到硬件设备中][5] +- [第一部分:基本概念和工具][1] +- [第二部分:生成你的主密钥][2] +- [第三部分:生成 PGP 子密钥][3] +- [第四部分:将主密钥移到离线存储中][4] +- [第五部分:将子密钥移到硬件设备中][5] Git 的核心特性之一就是它的去中心化本质 —— 一旦仓库克隆到你的本地系统,你就拥有了项目的完整历史,包括所有的标签、提交和分支。然而由于存在着成百上千的克隆仓库,如何才能验证你下载的仓库没有被恶意的第三方做过篡改?你可以从 GitHub 或一些貌似官方的位置来克隆它们,但是如果有些人故意欺骗了你怎么办? -或者在你参与的一些项目上发现了后门,而 "Author" 行显示是你干的,然而你很确定 [不是你干的][6],会发生什么情况? +或者在你参与的一些项目上发现了后门,而 “Author” 行显示是你干的,然而你很确定 [不是你干的][6],会发生什么情况? 为解决上述问题,Git 添加了 PGP 集成。签名的标签通过确认它的内容与创建这个标签的开发者的工作站上的内容完全一致来证明仓库的完整性,而签名的提交几乎是不可能在不访问你的 PGP 密钥的情况下能够假冒你。 -### 清单 - - * 了解签名的标签、提交、和推送(必要) +#### 清单 + * 了解签名的标签、提交和推送(必要) * 配置 git 使用你的密钥(必要) - - * 学习如何签名标签和验证工作(必要) - - * 配置 git 总是签名注释的标签(推荐) - - * 学习如何签名提交和验证工作(必要) - + * 学习标签如何签名和验证(必要) + * 配置 git 总是签名带注释标签(推荐) + * 学习提交如何签名和验证工作(必要) * 配置 git 总是签名提交(推荐) - * 配置 gpg-agent 选项(必要) +#### 考虑事项 +git 实现了 PGP 的多级集成,首先从签名标签开始,接着介绍签名提交,最后添加签名推送的支持。 +##### 了解 Git 哈希 -### 考虑事项 +git 是一个复杂的东西,为了你能够更好地掌握它如何集成 PGP,你需要了解什么是”哈希“。我们将它归纳为两种类型的哈希:树哈希和提交哈希。 -Git 实现了 PGP 的多级集成,首先从签名标签开始,接着介绍签名提交,最后添加签名推送的支持。 - -#### 了解 Git 哈希 - -Git 是一个复杂的东西,为了你能够更好地掌握它如何集成 PGP,你需要了解什么是”哈希“。我们将它归纳为两种类型的哈希:树哈希和提交哈希。 - -##### 树哈希 +###### 树哈希 每次你向仓库提交一个变更,对于仓库中的每个子目录,git 都会记录它里面所有对象的校验和哈希 —— 内容(blobs)、目录(trees)、文件名和许可等等。它只对每次提交中发生变更的树和内容做此操作,这样在只变更树的一小部分时就不必去重新计算整个树的校验和。 然后再计算和存储处于顶级的树的校验和,这样如果仓库的任何一部分发生变化,校验和将不可避免地发生变化。 -##### 提交哈希 +###### 提交哈希 一旦创建了树哈希,git 将计算提交哈希,它将包含有关仓库和变更的下列信息: * 树哈希的校验和 - * 变更前树哈希的校验和(父级) - * 有关作者的信息(名字、email、创作时间) - * 有关提交者的信息(名字、email、提交时间) - * 提交信息 - - - -##### 哈希函数 +###### 哈希函数 在写这篇文章时,虽然研究一种更强大的、抗碰撞的算法的工作正在进行,但 git 仍然使用的是 SHA1 哈希机制去计算校验和。注意,git 已经包含了碰撞防范程序,因此认为对 git 成功进行碰撞攻击仍然是不可行的。 -#### 注释的标签和标签签名 +#### 带注释标签和标签签名 -在每个 Git 仓库中,标签允许开发者标记特定的提交。标签可以是 “轻量级的” —— 几乎只是一个特定提交上的指针,或者它们可以是 “注释的”,它成为 git 树中自己的项目。一个注释的标签对象包含所有下列的信息: - - * 成为标签的提交哈希的校验和 +在每个 Git 仓库中,标签允许开发者标记特定的提交。标签可以是 “轻量级的” —— 几乎只是一个特定提交上的指针,或者它们可以是 “带注释的”,它自己将成为 git 树中的项目。一个带注释标签对象包含所有下列的信息: + * 成为标签的提交的哈希的校验和 * 标签名字 - * 关于打标签的人的信息(名字、email、打标签时间) - * 标签信息 - - - -一个 PGP 签名的标签是一个带有将所有这些条目封装进一个 PGP 签名的注释标签。当开发者签名他们的 git 标签时,他们实际上是向你保证了如下的信息: +一个 PGP 签名的标签是一个带有将所有这些条目封装进一个 PGP 签名的带注释标签。当开发者签名他们的 git 标签时,他们实际上是向你保证了如下的信息: * 他们是谁(以及他们为什么应该被信任) - * 他们在签名时的仓库状态是什么样: - - * 标签包含提交的哈希 - - * 提交哈希包含了顶级树的哈希 - - * 顶级哈希包含了所有文件、内容和子树的哈希 + * 标签包含的提交的哈希 + * 提交的哈希包含了顶级树的哈希 + * 顶级树哈希包含了所有文件、内容和子树的哈希 * 它也包含有关作者的所有信息 - * 包含变更发生时的精确时间 - - - -当你克隆一个仓库并验证一个签名标签时,就是向你以密码方式保证仓库中的所有内容、包括所有它的历史,与开发者签名时在它的计算机上的仓库完全一致。 +当你克隆一个仓库并验证一个签名的标签时,就是向你以密码方式保证:仓库中的所有内容、包括所有它的历史,与开发者签名时在它的计算机上的仓库完全一致。 #### 签名的提交 -签名的提交与签名的标签非常类似 —— 提交对象的内容是 PGP 签名过的,而不是标签对象的内容。一个提交签名也给你提供了开发者签名时,开发者树上的全部可验证信息。标签签名和提交 PGP 签名提供了有关仓库和它的完整历史的完全一致的安全保证。 +签名的提交与签名的标签非常类似 —— PGP 签名的是提交对象的内容,而不是标签对象的内容。一个提交签名也给你提供了开发者签名时开发者树上的全部可验证信息。标签签名和提交的 PGP 签名提供了有关仓库和它的完整历史的完全一致的安全保证。 #### 签名的推送 为了完整起见,在这里包含了签名的推送这一功能,因为在你使用这个功能之前,需要在接收推送的服务器上先启用它。正如我们在上面所说过的,PGP 签名一个 git 对象就是提供了开发者的 git 树当时的可验证信息,但不提供开发者对那个树意图相关的信息。 -比如,你可以在你自己 fork 的 git 仓库的一个实验分支上尝试一个很酷的特性,为了评估它,你提交了你的工作,但是有人在你的代码中发现了一个恶意的 bug。由于你的提交是经过正确签名的,因此有人可能将包含有恶意 bug 的分支推入到 master 分支中,从而在生产系统中引入一个漏洞。由于提交是经过你的密钥正确签名的,所以一切看起来都是合理合法的,而当 bug 被发现时,你的声誉就会因此而受到影响。 +比如,你可以在你自己复刻的 git 仓库的一个实验分支上尝试一个很酷的特性,为了评估它,你提交了你的工作,但是有人在你的代码中发现了一个恶意的 bug。由于你的提交是经过正确签名的,因此有人可能将包含有恶意 bug 的分支推入到 master 分支中,从而在生产系统中引入一个漏洞。由于提交是经过你的密钥正确签名的,所以一切看起来都是合理合法的,而当 bug 被发现时,你的声誉就会因此而受到影响。 在 `git push` 时,为了验证提交的意图而不仅仅是验证它的内容,添加了要求 PGP 推送签名的功能。 @@ -125,47 +94,48 @@ Git 是一个复杂的东西,为了你能够更好地掌握它如何集成 PGP 如果在你的钥匙环上只有一个密钥,那么你就不需要再做额外的事了,因为它是你的默认密钥。 -然而,如果你有多个密钥,那么你必须要告诉 git 去使用哪一个密钥。([fpr] 是你的密钥的指纹): +然而,如果你有多个密钥,那么你必须要告诉 git 去使用哪一个密钥。(`[fpr]` 是你的密钥的指纹): + ``` $ git config --global user.signingKey [fpr] - ``` -注意:如果你有一个不同的 gpg2 命令,那么你应该告诉 git 总是去使用它,而不是传统的版本 1 的 gpg: +注意:如果你有一个不同的 `gpg2` 命令,那么你应该告诉 git 总是去使用它,而不是传统的版本 1 的 `gpg`: + ``` $ git config --global gpg.program gpg2 - ``` #### 如何使用签名标签 -创建一个签名的标签,只要传递一个简单地 -s 开关给 tag 命令即可: +创建一个签名的标签,只要传递一个简单地 `-s` 开关给 `tag` 命令即可: + ``` $ git tag -s [tagname] - ``` 我们建议始终对 git 标签签名,这样让其它的开发者确信他们使用的 git 仓库没有被恶意地修改过(比如,引入后门): ##### 如何验证签名的标签 -验证一个签名的标签,只需要简单地使用 verify-tag 命令即可: +验证一个签名的标签,只需要简单地使用 `verify-tag` 命令即可: + ``` $ git verify-tag [tagname] - ``` 如果你要验证其他人的 git 标签,那么就需要你导入他的 PGP 公钥。请参考 “可信任的团队沟通” 一文中关于此主题的指导。 ##### 在拉取时验证 -如果你从项目仓库的其它 fork 中拉取一个标签,git 将自动验证签名,并在合并操作时显示结果: +如果你从项目仓库的其它复刻中拉取一个标签,git 将自动验证签名,并在合并操作时显示结果: + ``` $ git pull [url] tags/sometag - ``` 合并信息将包含类似下面的内容: + ``` Merge tag 'sometag' of [url] @@ -173,128 +143,123 @@ Merge tag 'sometag' of [url] # gpg: Signature made [...] # gpg: Good signature from [...] - ``` -#### 配置 git 始终签名注释的标签 +#### 配置 git 始终签名带注释标签 + +很可能的是,你正在创建一个带注释标签,你应该去签名它。强制 git 始终签名带注释的标签,你可以设置一个全局配置选项: -很可能的是,你正在创建一个带注释的标签,你应该去签名它。强制 git 始终签名带注释的标签,你可以设置一个全局配置选项: ``` $ git config --global tag.forceSignAnnotated true - ``` -或者,你始终记得每次都传递一个 -s 开关: +或者,你始终记得每次都传递一个 `-s` 开关: + ``` $ git tag -asm "Tag message" tagname - ``` -#### 如何使用签名提交 +#### 如何使用签名的提交 -创建一个签名提交很容易,但是将它纳入到你的工作流中却很困难。许多项目使用签名提交作为一种 "Committed-by:” 的等价行,它记录了代码来源 —— 除了跟踪项目历史外,签名很少有人去验证。在某种意义上,签名的提交用于 ”篡改证据“,而不是 git 工作流的 ”篡改证明“。 +创建一个签名的提交很容易,但是将它纳入到你的工作流中却很困难。许多项目使用签名的提交作为一种 “Committed-by:” 的等价行,它记录了代码来源 —— 除了跟踪项目历史外,签名很少有人去验证。在某种意义上,签名的提交用于 “篡改证据”,而不是 git 工作流的 “篡改证明”。 + +为创建一个签名的提交,你只需要 `git commit` 命令传递一个 `-S` 标志即可(由于它与另一个标志冲突,所以改为大写的 `-S`): -为创建一个签名的提交,你只需要 `git commit` 命令传递一个 -S 标志即可(由于它与另一个标志冲突,所以改为大写的 -S): ``` $ git commit -S - ``` 我们建议始终使用签名提交,并要求项目所有成员都这样做,这样其它人就可以验证它们(下面就讲到如何验证)。 ##### 如何去验证签名的提交 -验证签名的提交需要使用 verify-commit 命令: +验证签名的提交需要使用 `verify-commit` 命令: + ``` $ git verify-commit [hash] - ``` 你也可以查看仓库日志,要求所有提交签名是被验证和显示的: + ``` $ git log --pretty=short --show-signature - ``` -##### 在 git merge 时验证提交 +##### 在 git 合并时验证提交 + +如果项目的所有成员都签名了他们的提交,你可以在合并时强制进行签名检查(然后使用 `-S` 标志对合并操作本身进行签名): -如果项目的所有成员都签名了他们的提交,你可以在合并时强制进行签名检查(然后使用 -S 标志对合并操作本身进行签名): ``` $ git merge --verify-signatures -S merged-branch - ``` 注意,如果有一个提交没有签名或验证失败,将导致合并操作失败。通常情况下,技术是最容易的部分 —— 而人的因素使得项目中很难采用严格的提交验证。 ##### 如果你的项目在补丁管理上采用邮件列表 -如果你的项目在提交和处理补丁时使用一个邮件列表,那么一般很少使用签名提交,因为通过那种方式发送时,签名信息将会丢失。对提交进行签名仍然是非常有用的,这样引用你托管在公开 git 树的其他人就能以它作为参考,但是上游项目接收你的补丁时,仍然不能直接使用 git 去验证它们。 +如果你的项目在提交和处理补丁时使用一个邮件列表,那么一般很少使用签名提交,因为通过那种方式发送时,签名信息将会丢失。对提交进行签名仍然是非常有用的,这样其他人就能引用你托管在公开 git 树作为参考,但是上游项目接收你的补丁时,仍然不能直接使用 git 去验证它们。 尽管,你仍然可以签名包含补丁的电子邮件。 #### 配置 git 始终签名提交 你可以告诉 git 总是签名提交: + ``` git config --global commit.gpgSign true - ``` -或者你每次都记得给 `git commit` 操作传递一个 -S 标志(包括 —amend)。 +或者你每次都记得给 `git commit` 操作传递一个 `-S` 标志(包括 `—amend`)。 #### 配置 gpg-agent 选项 -GnuPG agent 是一个守护工具,它能在你使用 gpg 命令时随时自动启动,并运行在后台来缓存私钥的密码。这种方式让你只需要解锁一次密钥就可以重复地使用它(如果你需要在一个自动脚本中签署一组 git 操作,而不需要重复输入密钥,这种方式就很方便)。 +GnuPG agent 是一个守护工具,它能在你使用 gpg 命令时随时自动启动,并运行在后台来缓存私钥的密码。这种方式让你只需要解锁一次密钥就可以重复地使用它(如果你需要在一个自动脚本中签署一组 git 操作,而不想重复输入密钥,这种方式就很方便)。 为了调整缓存中的密钥过期时间,你应该知道这两个选项: - * default-cache-ttl(秒):如果在 time-to-live 过期之前再次使用同一个密钥,这个倒计时将重置成另一个倒计时周期。缺省值是 600(10 分钟)。 + * `default-cache-ttl`(秒):如果在 TTL 过期之前再次使用同一个密钥,这个倒计时将重置成另一个倒计时周期。缺省值是 600(10 分钟)。 + * `max-cache-ttl`(秒):自首次密钥输入以后,不论最近一次使用密钥是什么时间,只要最大值的 TTL 倒计时过期,你将被要求再次输入密码。它的缺省值是 30 分钟。 - * max-cache-ttl(秒):自首次密钥输入以后,不论最近一次使用密钥是什么时间,只要最大值的 time-to-live 倒计时过期,你将被要求再次输入密码。它的缺省值是 30 分钟。 +如果你认为这些缺省值过短(或过长),你可以编辑 `~/.gnupg/gpg-agent.conf` 文件去设置你自己的值: - - - -如果你认为这些缺省值过短(或过长),你可以编辑 ~/.gnupg/gpg-agent.conf 文件去设置你自己的值: ``` # set to 30 minutes for regular ttl, and 2 hours for max ttl default-cache-ttl 1800 max-cache-ttl 7200 - ``` -##### 额外好处:与 ssh 一起使用 gpg-agent +##### 补充:与 ssh 一起使用 gpg-agent 如果你创建了一个 [A](验证)密钥,并将它移到了智能卡,你可以将它用到 ssh 上,为你的 ssh 会话添加一个双因子验证。为了与 agent 沟通你只需要告诉你的环境去使用正确的套接字文件即可。 -首先,添加下列行到你的 ~/.gnupg/gpg-agent.conf 文件中: +首先,添加下列行到你的 `~/.gnupg/gpg-agent.conf` 文件中: + ``` enable-ssh-support - ``` -接着,添加下列行到你的 .bashrc 文件中: +接着,添加下列行到你的 `.bashrc` 文件中: + ``` export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - ``` -为了让改变生效,你需要 kill 掉正在运行的 gpg-agent 进程,并重新启动一个新的登入会话: +为了让改变生效,你需要杀掉正在运行的 gpg-agent 进程,并重新启动一个新的登入会话: + ``` $ killall gpg-agent $ bash $ ssh-add -L - ``` 最后的命令将列出代表你的 PGP Auth 密钥的 SSH(注释应该会在结束的位置显示: cardno:XXXXXXXX,表示它来自智能卡)。 -为了启用 ssh 的基于密钥的登入,只需要在你要登入的远程系统上添加 `ssh-add -L` 的输出到 ~/.ssh/authorized_keys 中。祝贺你,这将使你的 SSH 登入凭据更难以窃取。 +为了启用 ssh 的基于密钥的登入,只需要在你要登入的远程系统上添加 `ssh-add -L` 的输出到 `~/.ssh/authorized_keys` 中。祝贺你,这将使你的 SSH 登入凭据更难以窃取。 + +此外,你可以从公共密钥服务器上下载其它人的基于 PGP 的 ssh 公钥,这样就可以赋予他登入 ssh 的权利: -作为一个福利,你可以从公共密钥服务器上下载其它人的基于 PGP 的 ssh 公钥,这样就可以赋予他登入 ssh 的权利: ``` $ gpg --export-ssh-key [keyid] - ``` 如果你有让开发人员通过 ssh 来访问 git 仓库的需要,这将让你非常方便。下一篇文章,我们将提供像保护你的密钥那样保护电子邮件帐户的小技巧。 @@ -305,14 +270,14 @@ via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-p 作者:[KONSTANTIN RYABITSEV][a] 译者:[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.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device +[1]:https://linux.cn/article-9524-1.html +[2]:https://linux.cn/article-9529-1.html +[3]:https://linux.cn/article-9607-1.html +[4]:https://linux.cn/article-10402-1.html +[5]:https://linux.cn/article-10415-1.html [6]:https://github.com/jayphelps/git-blame-someone-else From 92d61ac555a7a1e3f6e087d26da377ffd8c65498 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 00:10:03 +0800 Subject: [PATCH 0474/4278] PUB:20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @qhwdw https://linux.cn/article-10421-1.html --- ...ecting Code Integrity with PGP - Part 6- Using PGP with Git.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md (100%) diff --git a/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md similarity index 100% rename from translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md rename to published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md From ffddd29dada11075f8d29e4ee38f120a816ac82d Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 7 Jan 2019 08:55:38 +0800 Subject: [PATCH 0475/4278] translated --- ...ux command line can fetch fun from afar.md | 63 ------------------- ...ux command line can fetch fun from afar.md | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 63 deletions(-) delete mode 100644 sources/tech/20181223 The Linux command line can fetch fun from afar.md create mode 100644 translated/tech/20181223 The Linux command line can fetch fun from afar.md diff --git a/sources/tech/20181223 The Linux command line can fetch fun from afar.md b/sources/tech/20181223 The Linux command line can fetch fun from afar.md deleted file mode 100644 index 19231007f4..0000000000 --- a/sources/tech/20181223 The Linux command line can fetch fun from afar.md +++ /dev/null @@ -1,63 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Linux command line can fetch fun from afar) -[#]: via: (https://opensource.com/article/18/12/linux-toy-remote) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -The Linux command line can fetch fun from afar -====== -Use these tools to access weather, reading material, and more from remote locations. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi) - -We're almost to the end 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 (or actually, collection of toys) is a little different. So far I've mostly tried to focus on toys that are self-contained, and completely usable under an open source license. But I've gotten some great suggestions from readers which utilize an open source tool to access something remotely that may or may not be open source. Today, I'll round up a few of those. - -The first one is a total classic: use Telnet to watch an ASCII-rendition of Star Wars. Chances are that Telnet is already installed on your system, so all you'll need to do is run: - -``` -$ telnet towel.blinkenlights.nl -``` - -I feel like I first saw this one over a decade ago, so it's a bit amazing to me that it's still alive and online. If you've never watched it, set aside some time and go check it out. You won't regret it. - -![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png) - -Next, Opensource.com contributor [Manuel Dewald][2] suggested a way to fetch your local weather from the terminal. It's easy, and only requires that you have **curl** (or, well, **** **wget** ) installed. - -``` -$ curl wttr.in -``` - -![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png) - -Finally, while you can spend the holidays reading your favorite sites (including Opensource.com) from your favorite [command-line web browser][3], there are a few of my favorite sites that are more easily browsed with a dedicated client. Two of these include Reddit and Hacker News, for which there are clients that have been recommended to me that you may wish to try, mostly available under open source licenses. I've poked around with [haxor-news][4] (Hacker News) and [rtv][5] (Reddit), and both seem pretty cool. - -Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, 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, [Watch YouTube videos at the Linux terminal][6], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-remote - -作者:[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/ntlx -[3]: https://opensource.com/article/16/12/web-browsers-linux-command-line -[4]: https://github.com/donnemartin/haxor-news -[5]: https://github.com/michael-lazar/rtv -[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl diff --git a/translated/tech/20181223 The Linux command line can fetch fun from afar.md b/translated/tech/20181223 The Linux command line can fetch fun from afar.md new file mode 100644 index 0000000000..d9f64745f3 --- /dev/null +++ b/translated/tech/20181223 The Linux command line can fetch fun from afar.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Linux command line can fetch fun from afar) +[#]: via: (https://opensource.com/article/18/12/linux-toy-remote) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +能从远程获得乐趣的 Linux 命令 +====== +使用这些工具从远程了解天气、阅读资料等。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi) + +我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你有一直在看,如果没有,请回到[开始][1],从头看过来。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。 + +虽然你之前可能已经看过我们日历中的一些玩具,但我们希望每个人都遇见一个新事物。 + +今天的玩具(实际是玩具集合)有点不同。到目前为止,我主要是想把重点放在那些独立的玩具上,并且完全可在开源许可下使用。但是我从读者那里得到了一些很好的建议,利用开源工具远程访问一些开源或者不开源的东西。今天,我将介绍其中的一些。 + +第一个是经典之作:使用 Telnet 观看星球大战的 ASCII 演绎版本。你的系统可能已经安装了 Telnet,因此你只需运行: + +``` +$ telnet towel.blinkenlights.nl +``` + +我第一次看到它是十年之前,因此我对于它还存在优点惊奇。如果你还没看过,请留出一点时间看一下。你不会后悔的。 + +![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png) + +接下来,Opensource.com 的撰稿人 [Manuel Dewald][2] 提出了一种从终端获取当地天气的方法。它很简单,你只需安装 **curl**(或者,**wget**)。 + +``` +$ curl wttr.in +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png) + +最后,在假期中虽然你可以从[命令行 Web 浏览器][3]浏览你喜欢的网站(包括 Opensource.com),但有一些我最喜欢的网站可以通过专用客户端更轻松地浏览。其中两个是 Reddit 和 Hacker News,我被推荐过一些它们的客户端,你可能也想尝试,它们都使用开源许可。我尝试过 [haxor-news][4] (Hacker News) 和 [rtv][5] (Reddit),它们都还不错。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。 + +一定要看看昨天的玩具,[在 Linux 终端收看 Youtube 视频][2],明天还要再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-remote + +作者:[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/ntlx +[3]: https://opensource.com/article/16/12/web-browsers-linux-command-line +[4]: https://github.com/donnemartin/haxor-news +[5]: https://github.com/michael-lazar/rtv +[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl \ No newline at end of file From a893339bf1cffe00d274f3c60af08ea56f1a3540 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 7 Jan 2019 09:01:09 +0800 Subject: [PATCH 0476/4278] translating --- .../tech/20181210 Snake your way across your Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181210 Snake your way across your Linux terminal.md b/sources/tech/20181210 Snake your way across your Linux terminal.md index 5ae452dcf5..32c4aba096 100644 --- a/sources/tech/20181210 Snake your way across your Linux terminal.md +++ b/sources/tech/20181210 Snake your way across your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 61374c191a5955e5ce7b35b757c4792d443b5c42 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 13:03:19 +0800 Subject: [PATCH 0477/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labo?= =?UTF-8?q?ratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=201=20OK01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md diff --git a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md new file mode 100644 index 0000000000..c5225cba1a --- /dev/null +++ b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 1 OK01 +====== + +The OK01 lesson contains an explanation about how to get started and teaches how to enable the 'OK' or 'ACT' **LED** on the Raspberry Pi board near the RCA and USB ports. This light was originally labelled OK but has been renamed to ACT on the revision 2 Raspberry Pi boards. + +### 1 Getting Started + +I am assuming at this point that you have already visited the [Downloads][1] page, and got the necessary GNU Toolchain. Also on the downloads page is a file called OS Template. Please download this and extract its contents to a new directory. + +### 2 The Beginning + +``` +The '.s' file extension is commonly used for all forms of assembly code, it is up to us to remember this is ARMv6. +``` + +Now that you have extracted the template, create a new file in the 'source' directory called 'main.s'. This file will contain the code for this operating system. To be explicit, the folder structure should look like: + +``` +build/ + (empty) +source/ + main.s +kernel.ld +LICENSE +Makefile +``` + +Open 'main.s' in a text editor so that we can begin typing assembly code. The Raspberry Pi uses a variety of assembly code called ARMv6, so that is what we'll need to write in. + +Copy in these first commands. + +``` +.section .init +.globl _start +_start: +``` + +As it happens, none of these actually do anything on the Raspberry Pi, these are all instructions to the assembler. The assembler is the program that will translate between assembly code that we understand, and binary machine code that the Raspberry Pi understands. In Assembly Code, each line is a new command. The first line here tells the Assembler[1] where to put our code. The template I provided causes the code in the section called .init to be put at the start of the output. This is important, as we want to make sure we can control which code runs first. If we don't do this, the code in the alphabetically first file name will run first! The .section command simply tells the assembler which section to put the code in, from this point until the next .section or the end of the file. + +``` +In assembly code, you may skip lines, and put spaces before and after commands to aid readability. +``` + +The next two lines are there to stop a warning message and aren't all that important.[2] + +### 3 The First Line + +Now we're actually going to code something. In assembly code, the computer simply goes through the code, doing each instruction in order, unless told otherwise. Each instruction starts on a new line. + +Copy the following instruction. + +``` +ldr r0,=0x20200000 +``` + +``` +ldr reg,=val puts the number val into the register named reg. +``` + +That is our first command. It tells the processor to store the number 0x20200000 into the register r0. I shall need to answer two questions here, what is a register, and how is 0x20200000 a number? + +``` +A single register can store any integer between 0 and 4,294,967,295 inclusive on the Raspberry Pi, which might seem like a large amount of memory, but it is only 32 binary bits. +``` + +A register is a tiny piece of memory in the processor, which is where the processor stores the numbers it is working on right now. There are quite a few of these, many of which have a special meaning, which we will come to later. Importantly there are 13 (named r0,r1,r2,...,r9,r10,r11,r12) which are called General Purpose, and you can use them for whatever calculations you need to do. Since it's the first, I've used r0 in this example, but I could very well have used any of the others. As long as you're consistent, it doesn't matter. + +0x20200000 is indeed a number. However it is written in Hexadecimal notation. To learn more about hexadecimal expand the box below: +``` +Hexadecimal is an alternate system for writing numbers. You may only be aware of the decimal system for writing numbers in which we have 10 digits: 0,1,2,3,4,5,6,7,8 and 9. Hexadecimal is a system with 16 digits: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e and f. + +![567 is 5 hundreds, 6 tens and 7 units.][2] + +You may recall being taught how decimal numbers work in terms of place value. We say that the rightmost digits is the 'units' digits, the next one left is the 'tens' digit, the next is the 'hundreds' digit, and so on. What this actually meant is, the number is 100 × the value in the 'hundreds' digit, plus 10 × the value in the 'tens' digit, plus 1 × the value in the units digit. + +![567 is 5x10^2+6x10^1+7x10^0][3] + +More mathematically, we can now spot the pattern and say that the rightmost digit is the 100=1s digit, the next left is the 101=10s digit, the next is 102=100s digit, and so on. We have all agreed on the system that 0 is the lowest digit, 1 is the next and so on. But what if we used a different number instead of 10 in these powers? Hexadecimal is just the system in which we use 16 instead. + +![567 = 5x10^2+6x10^1+7x10^0 = 2x16^2+3x16^1+7x16^0][4] + +The mathematics to the right shows that the number 567 in decimal is equivalent to the number 237 in hexadecimal. Often when we need to be clear about what system we're using to write numbers in we put 10 for decimal and 16 for hexadecimal. Since it's difficult to write small numbers in assembly code, we use 0x instead to represent a number in hexadecimal notation. So 0x237 means 23716. + +So where do a,b,c,d,e and f come in? Well, in order to be able to write every number in hexadecimal, we need extra digits. For example 916 = 9×160 = 910, but 1016 = 1×161 + 1×160 = 1610. So if we just used 0,1,2,3,4,5,6,7,8 and 9 we would not be able to write 1010, 1110, 1210, 1310, 1410, 1510. So we introduce 6 new digits such that a16 = 1010, b16 = 1110, c16 = 1210, d16 = 1310, e16 = 1410, f16 = 1510 + +So, we now have another system for writing numbers. But why did we bother? Well, it turns out that since computers always work in binary, hexadecimal notation is very useful because every hexadecimal digit is exactly four binary digits long. This has the nice side effect that a lot of computer numbers are round numbers in hexadecimal, even though they're not in decimal. For example, in the assembly code just above I used the number 2020000016. If I had chose to write this in decimal it would have been 53896806410, which is much less memorable. + +To convert numbers from decimal to hexadecimal I find the following method easiest: + +![Conversion example][5] + + 1. Start with the decimal number, say 567. + 2. Divide by 16 and calculate the remainder. For example 567 ÷ 16 = 35 remainder 7. + 3. The remainder is the last digit of the answer in hexadecimal, in the example this is 7. + 4. Repeat steps 2 and 3 again with the result of the last division until the result is 0. For example 35 ÷ 16 = 2 remainder 3, so 3 is the next digit of the answer. 2 ÷ 16 = 0 remainder 2, so 2 is the next digit of the answer. + 5. Once the result of the division is 0, you can stop. The answer is just the remainders in the reverse order to which you got them, so 56710 = 23716. + + + +To convert hexadecimal numbers back to decimal, it is easiest to expand out the number, so 23716 = 2×162 + 3×161 +7 ×160 = 2×256 + 3×16 + 7×1 = 512 + 48 + 7 = 567. +``` + +So our first command is to put the number 2020000016 into r0. That doesn't sound like it would be much use, but it is. In computers, there are an awful lot of chunks of memory and devices. In order to access them all, we give each one an address. Much like a postal address or a web address this is just a means of identifying the location of the device or chunks of memory we want. Addresses in computers are just numbers, and so the number 2020000016 happens to be the address of the GPIO controller. This is just a design decision taken by the manufacturers, they could have used any other address (providing it didn't conflict with anything else). I know this address only because I looked it up in a manual[3], there is no particular system to the addresses (other than that they are all large round numbers in hexadecimal). + +### 4 Enabling Output + +![A diagram showing key parts of the GPIO controller.][6] + +Having read the manual, I know we're going to need to send two messages to the GPIO controller. We need to talk its language, but if we do, it will obligingly do what we want and turn on the OK LED. Fortunately, it is such a simple chip, that it only needs a few numbers in order to understand what to do. + +``` +mov r1,#1 +lsl r1,#18 +str r1,[r0,#4] +``` + +``` +mov reg,#val puts the number val into the register named reg. + +lsl reg,#val shifts the binary representation of the number in reg by val places to the left. + +str reg,[dest,#val] stores the number in reg at the address given by dest + val. +``` + +These commands enable output to the 16th GPIO pin. First we get a necessary value in r1, then send it to the GPIO controller. Since the first two instructions are just trying to get a value into r1, we could use another ldr command as before, but it will be useful to us later to be able to set any given GPIO pin, so it is better to deduce the value from a formula than write it straight in. The OK LED is wired to the 16th GPIO pin, and so we need to send a command to enable the 16th pin. + +The value in r1 is needed to enable the LED pin. The first line puts the number 110 into r1. The mov command is faster than the ldr command, because it does not involve a memory interaction, whereas ldr loads the value we want to put into the register from memory. However, mov can only be used to load certain values[4]. In ARM assembly code, almost every instruction begins with a three letter code. This is called the mnemonic, and is supposed to hint at what the operation does. mov is short for move and ldr is short for load register. mov moves the second argument #1 into the first r1. In general, # must be used to denote numbers, but we have already seen a counterexample to this. + +The second instruction is lsl or logical shift left. This means shift the binary representation for the first argument left by the second argument. In this case this will shift the binary representation of 110 (which is 12) left by 18 places (making it 10000000000000000002=26214410). + +If you are unfamiliar with binary, expand the box below: +``` +Just like hexadecimal binary is another way of writing numbers. In binary we only have 2 digits, 0 and 1. This is useful for computers because we can implement this in a circuit by saying that electricity flowing through the circuit means 1, and not means 0. This is how computers actually work and do maths. Despite only having 2 digits binary can still be used to represent every number, it just takes a lot longer. + +![567 in decimal = 1000110111 in binary][7] + +The image shows the binary representation of the number 56710 which is 10001101112. We use 2 to denote numbers written in binary. + +One of the quirks of binary that we make heavy use of in assembly code is the ease by which numbers can be multiplied or divided by powers of 2 (e.g. 1,2,4,8,16). Normally multiplications and divisions are tricky operations, however these special cases are very easy, and so are very important. + +![13*4 = 52, 1101*100=110100][8] + +Shifting a binary number left by **n** places is the same as multiplying the number by 2 **n**. So, if we want to multiply by 4, we just shift the number left 2 places. If we want to multiply by 256 we could shift it left by 8 places. If we wanted to multiply by a number like 12, we could instead multiply it by 8, then separately by 4 and add the results (N × 12 = N × (8 + 4) = N × 8 + N × 4). + +![53/16 = 3, 110100/10000=11][9] + +Shifting a binary number right by **n** places is the same as dividing the number by 2 **n**. The remainder of the division is the bits that were lost when shifted right. Unfortunately dividing by a binary number that is not an exact power of 2 is very difficult, and will be covered in [Lesson 9: Screen04][10]. + +![Binary Terminology][11] + +This diagram shows common terminology used with binary. A bit is a single binary digit. A nibble is 4 binary bits. A byte is 2 nibbles, or 8 bits. A half is half the size of a word, 2 bytes in this case. A word refers to the size of the registers on a processor, and so on the Raspberry Pi this is 4 bytes. The convention is to number the most significant bit of a word 31, and the least significant bit as 0. The top, or high bits refer to the most significant bits, and the low or bottom bits refer to the least significant. A kilobyte (KB) is 1000 bytes, a megabyte is 1000 KB. There is some confusion as to whether this should be 1000 or 1024 (a round number in binary). As such, the new international standard is that a KB is 1000 bytes, and a Kibibyte (KiB) is 1024 bytes. A Kb is 1000 bits, and a Kib is 1024 bits. + +The Raspberry Pi is little endian by default, meaning that loading a byte from an address you just wrote a word to will load the lowest byte of the word. +``` + +Once again, I only know that we need this value from reading the manual[3]. The manual says that there is a set of 24 bytes in the GPIO controller, which determine the settings of the GPIO pin. The first 4 relate to the first 10 GPIO pins, the second 4 relate to the next 10 and so on. There are 54 GPIO pins, so we need 6 sets of 4 bytes, which is 24 bytes in total. Within each 4 byte section, every 3 bits relates to a particular GPIO pin. Since we want the 16th GPIO pin, we need the second set of 4 bytes because we're dealing with pins 10-19, and we need the 6th set of 3 bits, which is where the number 18 (6×3) comes from in the code above. + +Finally the str 'store register' command stores the value in the first argument, r1 into the address computed from the expression afterwards. The expression can be a register, in this case r0, which we know to be the GPIO controller address, and another value to add to it, in this case #4. This means we add 4 to the GPIO controller address and write the value in r1 to that location. This happens to be the location of the second set of 4 bytes that I mentioned before, and so we send our first message to the GPIO controller, telling it to ready the 16th GPIO pin for output. + +### 5 A Sign Of Life + +Now that the LED is ready to turn on, we need to actually turn it on. This means sending a message to the GPIO controller to turn pin 16 off. Yes, turn it off. The chip manufacturers decided it made more sense[5] to have the LED turn on when the GPIO pin is off. Hardware engineers often seem to take these sorts of decisions, seemingly just to keep OS Developers on their toes. Consider yourself warned. + +``` +mov r1,#1 +lsl r1,#16 +str r1,[r0,#40] +``` + +Hopefully you should recognise all of the above commands, if not their values. The first puts a 1 into r1 as before. The second shifts the binary representation of this 1 left by 16 places. Since we want to turn pin 16 off, we need to have a 1 in the 16th bit of this next message (other values would work for other pins). Finally we write it out to the address which is 4010 added to the GPIO controller address, which happens to be the address to write to turn a pin off (28 would turn the pin on). + +### 6 Happily Ever After + +It might be tempting to finish now, but unfortunately the processor doesn't know we're done. In actuality, the processor never will stop. As long as it has power, it continues working. Thus, we need to give it a task to do forever more, or the Raspberry Pi will crash (not much of a problem in this example, the light is already on). + +``` +loop$: +b loop$ +``` + +``` +name: labels the next line name. + +b label causes the next line to be executed to be label. +``` + +The first line here is not a command, but a label. It names the next line loop$. This means we can now refer to the line by name. This is called a label. Labels get discarded when the code is turned into binary, but they're useful for our benefit for referring to lines by name, not number (address). By convention we use a $ for labels which are only important to the code in this block of code, to let others know they're not important to the overall program. The b (branch) command causes the next line to be executed to be the one at the label specified, rather than the one after it. Therefore, the next line to be executed will be this b, which will cause it to be executed again, and so on forever. Thus the processor is stuck in a nice infinite loop until it is switched off safely. + +The new line at the end of the block is intentional. The GNU toolchain expects all assembly code files to end in an empty line, so that it is sure you were really finished, and the file hasn't been cut off. If you don't put one, you get an annoying warning when the assembler runs. + +### 7 Pi Time + +So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory. Type make and then press enter. If any errors occur, please refer to the troubleshooting section. If not, you will have generated three files. kernel.img is the compiled image of your operating system. kernel.list is a listing of the assembly code you wrote, as it was actually generated. This is useful to check that things were generated correctly in future. The kernel.map file contains a map of where all the labels ended up, which can be useful for chasing around values. + +To install your operating system, first of all get a Raspberry PI SD card which has an operating system installed already. If you browse the files in the SD card, you should see one called kernel.img. Rename this file to something else, such as kernel_linux.img. Then, copy the file kernel.img that make generated onto the SD Card. You've just replaced the existing operating system with your own. To switch back, simply delete your kernel.img file, and rename the other one back to kernel.img. I find it is always helpful to keep a backup of you original Raspberry Pi operating system, in case you need it again. + +Put the SD card into a Raspberry Pi and turn it on. The OK LED should turn on. If not please see the troubleshooting page. If so, congratulations, you just wrote your first operating system. See [Lesson 2: OK02][12] for a guide to making the LED flash on and off. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html + +作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal1.png +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal2.png +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal3.png +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal4.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioController.png +[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary1.png +[8]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary2.png +[9]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary3.png +[10]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html +[11]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary4.png +[12]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html From 1454b2ba82673e43a05d75d8b42179fe10e00df3 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 13:05:17 +0800 Subject: [PATCH 0478/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labo?= =?UTF-8?q?ratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=202=20OK02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 2 OK02.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md diff --git a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md new file mode 100644 index 0000000000..9442a67708 --- /dev/null +++ b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 2 OK02 +====== + +The OK02 lesson builds on OK01, by causing the 'OK' or 'ACT' LED to turn on and off repeatedly. It is assumed you have the code for the [Lesson 1: OK01][1] operating system as a basis. + +### 1 Waiting + +Waiting is a surprisingly useful part of Operating System development. Often Operating Systems find themselves with nothing to do, and must delay. In this example, we wish to do so in order to allow the LED flashing off and on to be visible. If you just turned it off and on, it would not be visible, as the computer would be able to turn it off and on many thousands of times per second. In later lessons we will look at accurate waiting, but for now it is sufficient to simply waste time. + +``` +mov r2,#0x3F0000 +wait1$: +sub r2,#1 +cmp r2,#0 +bne wait1$ +``` + +``` +sub reg,#val subtracts the number val from the value in reg. + +cmp reg,#val compares the value in reg with the number val. + +Suffix ne causes the command to be executed only if the last comparison determined that the numbers were not equal. +``` + +The code above is a generic piece of code that creates a delay, which thanks to every Raspberry Pi being basically the same, is roughly the same time. How it does this is using a mov command to put the value 3F000016 into r2, and then subtracting 1 from this value until it is 0. The new commands here are sub, cmp, and bne. + +sub is the subtract command, and simply subtracts the second argument from the first. + +cmp is a more interesting command. It compares the first argument with the second, and remembers the result of the comparison in a special register called the current processor status register. You don't really need to worry about this, suffice to say it remembers, among other things, which of the two numbers was bigger or smaller, or if they were equal.[1] + +bne is actually just a branch command in disguise. In the ARM assembly language family, any instruction can be executed conditionally. This means that the instruction is only run if the last comparison had a certain result. We will use this extensively later for interesting tricks, but in this case we use the ne suffix on the b command to mean 'only branch if the last comparison's result was that the values were not equal'. The ne suffix can be used on any command, as can several other (16 in all) conditions such as eq for equal and lt for less than. + +### 2 The All Together + +I mentioned briefly last time that the status LED can be turned off again by writing to an offset of 28 from the GPIO controller instead of 40 (i.e. str r1,[r0,#28]). Thus, you need to modify the code from OK01 to turn the LED on, run the wait code, turn it off, run the wait code again, and then include a branch back to the beginning. Note, it is not necessary to re-enable the output to GPIO 16, we need only do that once. If you're being efficient, which I strongly encourage, you should be able to reuse the value of r1. As with all lessons, a full solution to this can be found on the [download page][2]. Be careful to make sure all of your labels are unique. When you write wait1$: you cannot label another line wait1$. + +On my Raspberry Pi it flashes about twice a second. this could easily be altered by changing the value we set r2 to. However, unfortunately we can't precisely predict the speed this runs at. If you didn't manage to get this working see our trouble shooting page, otherwise, congratulations. + +In this lesson we've learnt two more assembly commands, sub and cmp, as well as learning about conditional execution in ARM. + +In the next lesson, [Lesson 3: OK03][3] we will evaluate how we're coding, and establish some standards so that we can reuse code, and if necessary, work with C or C++ code. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html + +作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html From 449d754782725f6b7b9f1321e6caba34f21c5ee9 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 7 Jan 2019 13:33:15 +0800 Subject: [PATCH 0479/4278] Translating An Introduction to Go. --- translated/tech/20181224 An Introduction to Go.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 8963e7e016..e866c59da3 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -12,9 +12,9 @@ Go 简介 (以下内容是我的硕士论文的摘录,几乎整个 2.1 章节,向具有 CS 背景的人快速介绍 Go) -Go 是一门用于并发编程的命令式编程语言,它主要由创造者 Google 进行开发,最初主要由 Robert Griesemer、Rob Pike 和 Ken Thompson开发。 Design of the language started in 2007, and an initial version was released in 2009; with the first stable version, 1.0 released in 2012 . +Go 是一门用于并发编程的命令式编程语言,它主要由创造者 Google 进行开发,最初主要由 Robert Griesemer、Rob Pike 和 Ken Thompson开发。这门语言的设计起始于 2017 年,并在 2019 年推出最初版本;而第一个稳定版本是 2012 年发布的 1.0。 -Go has a C-like syntax (without a preprocessor), garbage collection, and, like its predecessors devloped at Bell Labs – Newsqueak (Rob Pike), Alef (Phil Winterbottom), and Inferno (Pike, Ritchie, et al.) – provides built-in support for concurrency using so-called goroutines and channels, a form of co-routines, based on the idea of Hoare’s ‘Communicating Sequential Processes’ . +Go 有 C 风格语法(没有预处理器),垃圾回收机制,并且类似它在贝尔实验室里被开发出来的前辈们,Newsqueak (Rob Pike)、Alef (Phil Winterbottom) 和 Inferno (Pike, Ritchie, et al.),使用所谓的 goroutines 和 channels(一种基于 Hoare 的“通信顺序进程”理论的协程)提供内建的并发支持。 Go programs are organised in packages. A package is essentially a directory containing Go files. All files in a package share the same namespace, and there are two visibilities for symbols in a package: Symbols starting with an upper case character are visible to other packages, others are private to the package: From 700d20a872b7e4933c8a849147d47bb030d24e40 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 14:28:28 +0800 Subject: [PATCH 0480/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labo?= =?UTF-8?q?ratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=203=20OK03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 3 OK03.md | 383 ++++++++++++++++++ 1 file changed, 383 insertions(+) create mode 100644 sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md diff --git a/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md new file mode 100644 index 0000000000..c6724ff672 --- /dev/null +++ b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md @@ -0,0 +1,383 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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) + +Computer Laboratory – Raspberry Pi: Lesson 3 OK03 +====== + +The OK03 lesson builds on OK02 by teaching how to use functions in assembly to make more reusable and rereadable code. It is assumed you have the code for the [Lesson 2: OK02][1] operating system as a basis. + +### 1 Reusable Code + +So far we've made code for our operating system by typing the things we want to happen in order. This is fine for such tiny programs, but if we wrote the whole system like this, the code would be completely unreadable. Instead we use functions. + +``` +A function is a piece of code that can be reused to compute a certain kind of answer, or perform a certain action. You may also hear them called procedures, routines or subroutines. Although these are all different, people rarely use the correct term. + +You should already be happy with the concept of a function from mathematics. For example the cosine function applied to a number gives another number between -1 and 1 which is the cosine of the angle. Notationally we write cos(x) to be the cosine function applied to the value x. + +In code, functions can take multiple inputs (including none), give multiple outputs (including none), and may cause side effects. For example a function might create a file on the file system, named after the first input, with length based on the second. +``` + +![Function as black boxes][2] + +``` +Functions are said to be 'black boxes'. We put inputs in, and outputs come out, but we don't need to know how they work. +``` + +In higher level code such as C or C++, functions are part of the language itself. In assembly code, functions are just ideas we have. + +Ideally we want to be able to set our registers to some input values, branch to an address, and expect that at some point the code will branch back to our code having set the registers to output values. This is what a function is in assembly code. The difficulty comes in what system we use for setting the registers. If we just used any system we felt like, each programmer may use a different system, and would find other programmers' work hard to understand. Further, compilers would not be able to work with assembly code as easily, as they would not know how to use the functions. To prevent confusion, a standard called the Application Binary Interface (ABI) was devised for each assembly language which is an agreement on how functions should be run. If everyone makes functions in the same way, then everyone will be able to use each others' functions. I will teach that standard here, and from now on I will code all of my functions to meet the standard. + +The standard says that r0,r1,r2 and r3 will be used as inputs to a function in order. If a function needs no inputs, then it doesn't matter what value it takes. If it needs only one it always goes in r0, if it needs two, the first goes in r0, and the second goes on r1, and so on. The output will always be in r0. If a function has no output, it doesn't matter what value r0 takes. + +Further, it also requires that after a function is run, r4 to r12 must have the same values as they had when the function started. This means that when you call a function, you can be sure the r4 to r12 will not change value, but you cannot be so sure about r0 to r3. + +When a function completes it has to branch back to the code that started it. This means it must know the address of the code that started it. To facilitate this, there is a special register called lr (link register) which always holds the address of the instruction after the one that called this function. + +Table 1.1 ARM ABI register usage +| Register | Brief | Preserved | Rules | +| -------- | ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| r0 | Argument and result | No | r0 and r1 are used for passing the first two arguments to functions, and returning the results of functions. If a function does not use them for a return value, they can take any value after a function. | +| r1 | Argument and result | No | | +| r2 | Argument | No | r2 and r3 are used for passing the second two arguments to functions. There values after a function is called can be anything. | +| r3 | Argument | No | | +| r4 | General purpose | Yes | r4 to r12 are used for working values, and their value after a function is called must be the same as before. | +| r5 | General purpose | Yes | | +| r6 | General purpose | Yes | | +| r7 | General purpose | Yes | | +| r8 | General purpose | Yes | | +| r9 | General purpose | Yes | | +| r10 | General purpose | Yes | | +| r11 | General purpose | Yes | | +| r12 | General purpose | Yes | | +| lr | Return address | No | lr is the address to branch back to when a function is finished, but this does have to contain the same address after the function has finished. | +| sp | Stack pointer | Yes | sp is the stack pointer, described below. Its value must be the same after the function has finished. | + +Often functions need to use more registers than just r0 to r3. But, since r4 to r12 must stay the same after the method has run, they must be saved somewhere. We save them on something called the stack. + + +![Stack diagram][3] +``` +A stack is a metaphor we use in computing for a method of storing values. Just like in a stack of plates, you can only remove items from the top of a stack, and only add items to the top of the stack. + +The stack is a brilliant idea for storing registers on when functions are running. For example if I have a function which needs to use registers r4 and r5, it could place the current values of those registers on a stack. At the end of the method it could take them back off again. What is most clever is that if my function had to run another function in order to complete and that function needed to save some registers, it could put those on the top of the stack while it ran, and then take them off again at the end. That wouldn't affect the values of r4 and r5 that my method had to save, as they would be added to the top of the stack, and then taken off again. + +The terminology we used to refer to the values put on the stack by a particular method is that methods 'stack frame'. Not every method needs a stack frame, some don't need to store values. +``` + +Because the stack is so useful, it has been implemented in the ARMv6 instruction set directly. A special register called sp (stack pointer) holds the address of the stack. When items are added to the stack, the sp register updates so that it always holds the address of the first item on the stack. push {r4,r5} would put the values in r4 and r5 onto the top of the stack and pop {r4,r5} would take them back off again (in the correct order). + +### 2 Our First Function + +Now that we have some idea about how functions work, let's try to make one. For a basic first example, we are going to make a function that takes no input, and gives an output of the GPIO address. In the last lesson, we just wrote in this value, but it would be better as a function, since it is something we might need to do often in a real operating system, and we might not always remember the address. + +Copy the following code into a new file called 'gpio.s'. Just make the new file in the 'source' directory with 'main.s'. We're going to put all functions related to the GPIO controller in one file to make them easier to find. + +``` +.globl GetGpioAddress +GetGpioAddress: +ldr r0,=0x20200000 +mov pc,lr +``` + +``` +.globl lbl makes the label lbl accessible from other files. + +mov reg1,reg2 copies the value in reg2 into reg1. +``` + +This is a very simple complete function. The .globl GetGpioAddress command is a message to the assembler to make the label GetGpioAddress accessible to all files. This means that in our main.s file we can branch to the label GetGpioAddress even though it is not defined in that file. + +You should recognise the ldr r0,=0x20200000 command, which stores the GPIO controller address in r0. Since this is a function, we have to give the output in r0, so we are not as free to use any register as we once were. + +mov pc,lr copies the value in lr to pc. As mentioned earlier lr always contains the address of the code that we have to go back to when a method finishes. pc is a special register which always contains the address of the next instruction to be run. A normal branch command just changes the value of this register. By copying the value in lr to pc we just change the next line to be run to be the one we were told to go back to. + +A reasonable question would now be, how would we actually run this code? A special type of branch bl does what we need. It branches to a label like a normal branch, but before it does it updates lr to contain the address of the line after the branch. That means that when the function finishes, the line it will go back to will be the one after the bl command. This makes a function running just look like any other command, it simply runs, does whatever it needs to do, and then carries on to the next line. This is a really useful way of thinking about functions. We treat them as 'black boxes' in that when we use them, we don't need to think about how they work, we just need to know what inputs they need, and what outputs they give. + +For now, don't worry about using the function, we will use it in the next section. + +### 3 A Big Function + +Now we're going to implement a bigger function. Our first job was to enable output on GPIO pin 16. It would be nice if this was a function. We could simply specify a pin and a function as the input, and the function would set the function of that pin to that value. That way, we could use the code to control any GPIO pin, not just the LED. + +Copy the following commands below the GetGpioAddress function in gpio.s. + +``` +.globl SetGpioFunction +SetGpioFunction: +cmp r0,#53 +cmpls r1,#7 +movhi pc,lr +``` + +``` +Suffix ls causes the command to be executed only if the last comparison determined that the first number was less than or the same as the second. Unsigned. + +Suffix hi causes the command to be executed only if the last comparison determined that the first number was higher than the second. Unsigned. +``` + +One of the first things we should always think about when writing functions is our inputs. What do we do if they are wrong? In this function, we have one input which is a GPIO pin number, and so must be a number between 0 and 53, since there are 54 pins. Each pin has 8 functions, numbered 0 to 7 and so the function code must be too. We could just assume that the inputs will be correct, but this is very dangerous when working with hardware, as incorrect values could cause very bad side effects. Therefore, in this case, we wish to make sure the inputs are in the right ranges. + +To do this we need to check that r0 <= 53 and r1 <= 7. First of all, we can use the comparison we've seen before to compare the value of r0 with 53. The next instruction, cmpls is a normal comparison instruction that will only be run if r0 was lower than or the same as 53. If that was the case, it compares r1 with 7, otherwise the result of the comparison is the same as before. Finally we go back to the code that ran the function if the result of the last comparison was that the register was higher than the number. + +The effect of this is exactly what we want. If r0 was bigger than 53, then the cmpls command doesn't run, but the movhi does. If r0 is <= 53, then the cmpls command does run, and so r1 is compared with 7, and then if it is higher than 7, movhi is run, and the function ends, otherwise movhi does not run, and we know for sure that r0 <= 53 and r1 <= 7. + +There is a subtle difference between the ls (lower or same) and le (less or equal) as well as between hi (higher) and gt (greater) suffixes, but I will cover this later. + +Copy these commands below the above. + +``` +push {lr} +mov r2,r0 +bl GetGpioAddress +``` + +``` +push {reg1,reg2,...} copies the registers in the list reg1,reg2,... onto the top of the stack. Only general purpose registers and lr can be pushed. + +bl lbl sets lr to the address of the next instruction and then branches to the label lbl. +``` + +These next three commands are focused on calling our first method. The push {lr} command copies the value in lr onto the top of the stack, so that we can retrieve it later. We must do this because when we call GetGpioAddress, we will need to use lr to store the address to come back to in our function. + +If we did not know anything about the GetGpioAddress function, we would have to assume it changes r0,r1,r2 and r3, and would have to move our values to r4 and r5 to keep them the same after it finishes. Fortunately, we do know about GetGpioAddress, and we know it only changes r0 to the address, it doesn't affect r1,r2 or r3. Thus, we only have to move the GPIO pin number out of r0 so it doesn't get overwritten, but we know we can safely move it to r2, as GetGpioAddress doesn't change r2. + +Finally we use the bl instruction to run GetGpioAddress. Normally we use the term 'call' for running a function, and I will from now. As discussed earlier bl calls a function by updating the lr to the next instruction's address, and then branching to the function. + +When a function ends we say it has 'returned'. When the call to GetGpioAddress returns, we now know that r0 contains the GPIO address, r1 contains the function code and r2 contains the GPIO pin number. I mentioned earlier that the GPIO functions are stored in blocks of 10, so first we need to determine which block of ten our pin number is in. This sounds like a job we would use a division for, but divisions are very slow indeed, so it is better for such small numbers to do repeated subtraction. + +Copy the following code below the above. + +``` +functionLoop$: + +cmp r2,#9 +subhi r2,#10 +addhi r0,#4 +bhi functionLoop$ +``` + +``` +add reg,#val adds the number val to the contents of the register reg. +``` + +This simple loop code compares the pin number to 9. If it is higher than 9, it subtracts 10 from the pin number, and adds 4 to the GPIO Controller address then runs the check again. + +The effect of this is that r2 will now contain a number from 0 to 9 which represents the remainder of dividing the pin number by 10. r0 will now contain the address in the GPIO controller of this pin's function settings. This would be the same as GPIO Controller Address + 4 × (GPIO Pin Number ÷ 10). + +Finally, copy the following code below the above. + +``` +add r2, r2,lsl #1 +lsl r1,r2 +str r1,[r0] +pop {pc} +``` + +``` +Argument shift reg,lsl #val shifts the binary representation of the number in reg left by val before using it in the operation before. + +lsl reg,amt shifts the binary representation of the number in reg left by the number in amt. + +str reg,[dst] is the same as str reg,[dst,#0]. + +pop {reg1,reg2,...} copies the values from the top of the stack into the register list reg1,reg2,.... Only general purpose registers and pc can be popped. +``` + +This code finishes off the method. The first line is actually a multiplication by 3 in disguise. Multiplication is a big and slow instruction in assembly code, as the circuit can take a long time to come up with the answer. It is much faster sometimes to use some instructions which can get the answer quicker. In this case, I know that r2 × 3 is the same as r2 × 2 + r2. It is very easy to multiply a register by 2 as this is conveniently the same as shifting the binary representation of the number left by one place. + +One of the very useful features of the ARMv6 assembly code language is the ability to shift an argument before using it. In this case, I add r2 to the result of shifting the binary representation of r2 to the left by one place. In assembly code, you often use tricks such as this to compute answers more easily, but if you're uncomfortable with this, you could also write something like mov r3,r2; add r2,r3; add r2,r3. + +Now we shift the function value left by a number of places equal to r2. Most instructions such as add and sub have a variant which uses a register rather than a number for the amount. We perform this shift because we want to set the bits that correspond to our pin number, and there are three bits per pin. + +We then store the the computed function value at the address in the GPIO controller. We already worked out the address in the loop, so we don't need to store it at an offset like we did in OK01 and OK02. + +Finally, we can return from this method call. Since we pushed lr onto the stack, if we pop pc, it will copy the value that was in lr at the time we pushed it into pc. This would be the same as having used mov pc,lr and so the function call will return when this line is run. + +The very keen may notice that this function doesn't actually work correctly. Although it sets the function of the GPIO pin to the requested value, it causes all the pins in the same block of 10's functions to go back to 0! This would likely be quite annoying in a system which made heavy use of the GPIO pins. I leave it as a challenge to the interested to fix this function so that it does not overwrite other pins values by ensuring that all bits other than the 3 that must be set remain the same. A solution to this can be found on the downloads page for this lesson. Functions that you may find useful are and which computes the Boolean and function of two registers, mvns which computes the Boolean not and orr which computes the Boolean or. + +### 4 Another Function + +So, we now have a function which takes care of the GPIO pin function setting. We now need to make a function to turn a GPIO pin on or off. Rather than having one function for off and one function for on, it would be handy to have a single function which does either. + +We will make a function called SetGpio which takes a GPIO pin number as its first input in r0, and a value as its second in r1. If the value is 0 we will turn the pin off, and if it is not zero we will turn it on. + +Copy and paste the following code at the end of 'gpio.s'. + +``` +.globl SetGpio +SetGpio: +pinNum .req r0 +pinVal .req r1 +``` + +``` +alias .req reg sets alias to mean the register reg. +``` + +Once again we need the .globl command and the label to make the function accessible from other files. This time we're going to use register aliases. Register aliases allow us to use a name other than just r0 or r1 for registers. This may not be so important now, but it will prove invaluable when writing big methods later, and you should try to use aliases from now on. pinNum .req r0 means that pinNum now means r0 when used in instructions. + +Copy and paste the following code after the above. + +``` +cmp pinNum,#53 +movhi pc,lr +push {lr} +mov r2,pinNum +.unreq pinNum +pinNum .req r2 +bl GetGpioAddress +gpioAddr .req r0 +``` + +``` +.unreq alias removes the alias alias. +``` + +Like in SetGpioFunction the first thing we must do is check that we were actually given a valid pin number. We do this in exactly the same way by comparing pinNum (r0) with 53, and returning immediately if it is higher. Once again we wish to call GetGpioAddress, so we have to preserve lr by pushing it onto the stack, and to move pinNum to r2. We then use the .unreq statement to remove our alias from r0. Since the pin number is now stored in r2 we want our alias to reflect this, so we remove the alias from r0 and remake it on r2. You should always .unreq every alias as soon as it is done with, so that you cannot make the mistake of using it further down the code when it no longer exists. + +We then call GetGpioAddress, and we create an alias for r0 to reflect this. + +Copy and paste the following code after the above. + +``` +pinBank .req r3 +lsr pinBank,pinNum,#5 +lsl pinBank,#2 +add gpioAddr,pinBank +.unreq pinBank +``` + +``` +lsr dst,src,#val shifts the binary representation of the number in src right by val, but stores the result in dst. +``` + +The GPIO controller has two sets of 4 bytes each for turning pins on and off. The first set in each case controls the first 32 pins, and the second set controls the remaining 22. In order to determine which set it is in, we need to divide the pin number by 32. Fortunately this is very easy, at is the same as shifting the binary representation of the pin number right by 5 places. Hence, in this case I've named r3 as pinBank and then computed pinNum ÷ 32. Since it is a set of 4 bytes, we then need to multiply the result of this by 4. This is the same as shifting the binary representation left by 2 places, which is the command that follows. You may wonder if we could just shift it right by 3 places, as we went right then left. This won't work however, as some of the answer may have been rounded away when we did ÷ 32 which may not be if we just ÷ 8. + +The result of this is that gpioAddr now contains either 2020000016 if the pin number is 0-31, and 2020000416 if the pin number is 32-53. This means if we add 2810 we get the address for turning the pin on, and if we add 4010 we get the address for turning the pin off. Since we are done with pinBank, I use .unreq immediately afterwards. + +Copy and paste the following code after the above. + +``` +and pinNum,#31 +setBit .req r3 +mov setBit,#1 +lsl setBit,pinNum +.unreq pinNum +``` + +``` +and reg,#val computes the Boolean and function of the number in reg with val. +``` + +This next part of the function is for generating a number with the correct bit set. For the GPIO controller to turn a pin on or off, we give it a number with a bit set in the place of the remainder of that pin's number divided by 32. For example, to set pin 16, we need a number with the 16th bit a 1. To set pin 45 we would need a number with the 13th bit 1 as 45 ÷ 32 = 1 remainder 13. + +The and command computes the remainder we need. How it does this is that the result of an and operation is a number with 1s in all binary digits which had 1s in both of the inputs, and 0s elsewhere. This is a fundamental binary operation, and is very quick. We have given it inputs of pinNum and 3110 = 111112. This means that the answer can only have 1 bits in the last 5 places, and so is definitely between 0 and 31. Specifically it only has 1s where there were 1s in pinNum's last 5 places. This is the same as the remainder of a division by 32. It is no coincidence that 31 = 32 - 1. + +![binary division example][4] + +The rest of this code simply uses this value to shift the number 1 left. This has the effect of creating the binary number we need. + +Copy and paste the following code after the above. + +``` +teq pinVal,#0 +.unreq pinVal +streq setBit,[gpioAddr,#40] +strne setBit,[gpioAddr,#28] +.unreq setBit +.unreq gpioAddr +pop {pc} +``` + +``` +teq reg,#val checks if the number in reg is equal to val. +``` + +This code ends the method. As stated before, we turn the pin off if pinVal is zero, and on otherwise. teq (test equal) is another comparison operation that can only be used to test for equality. It is similar to cmp but it does not work out which number is bigger. If all you wish to do is test if to numbers are the same, you can use teq. + +If pinVal is zero, we store the setBit at 40 away from the GPIO address, which we already know turns the pin off. Otherwise we store it at 28, which turns the pin on. Finally, we return by popping the pc, which sets it to the value that we stored when we pushed the link register. + +### 5 A New Beginning + +Finally, after all that work we have our GPIO functions. We now need to alter 'main.s' to use them. Since 'main.s' is now getting a lot bigger and more complicated, it is better design to split it into two sections. The '.init' we've been using so far is best kept as small as possible. We can change the code to reflect this easily. + +Insert the following just after _start: in main.s: + +``` +b main + +.section .text +main: +mov sp,#0x8000 +``` + +The key change we have made here is to introduce the .text section. I have designed the makefile and linker scripts such that code in the .text section (which is the default section) is placed after the .init section which is placed at address 800016. This is the default load address and gives us some space to store the stack. As the stack exists in memory, it has to have an address. The stack grows down memory, so that each new value is at a lower address, thus making the 'top' of the stack, the lowest address. + +``` +The 'ATAGs' section in the diagram is a place where information about the Raspberry Pi is stored such as how much memory it has, and what its default screen resolution is. +``` + +![Layout diagram of operating system][5] + +Replace all the code that set the function of the GPIO pin with the following: + +``` +pinNum .req r0 +pinFunc .req r1 +mov pinNum,#16 +mov pinFunc,#1 +bl SetGpioFunction +.unreq pinNum +.unreq pinFunc +``` + +This code calls SetGpioFunction with the pin number 16 and the pin function code 1. This has the effect of enabling output to the OK LED. + +Replace any code which turns the OK LED on with the following: + +``` +pinNum .req r0 +pinVal .req r1 +mov pinNum,#16 +mov pinVal,#0 +bl SetGpio +.unreq pinNum +.unreq pinVal +``` + +This code uses SetGpio to turn off GPIO pin 16, thus turning on the OK LED. If we instead used mov pinVal,#1, it would turn the LED off. Replace your old code to turn the LED off with that. + +### 6 Onwards + +Hopefully now, you should be able to test what you have made on the Raspberry Pi. We've done a large amount of code this time, so there is a lot that can go wrong. If it does, head to the troubleshooting page. + +When you get it working, congratulations. Although our operating system does nothing more than it did in [Lesson 2: OK02][1], we've learned a lot about functions and formatting, and we can now code new features much more quickly. It would be very simple now to make an Operating System that alters any GPIO register, which could be used to control hardware! + +In [Lesson 4: OK04][6], we will address our wait function, which is currently imprecise, so that we can gain better control over our LED, and ultimately over all of the GPIO pins. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html + +作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.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 +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/osLayout.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html From 4352a239aa23038e8b1493eddfd14f0953aaa211 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Mon, 7 Jan 2019 15:32:11 +0800 Subject: [PATCH 0481/4278] translating --- ...asy Way To Remove Programs Installed From Source In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md index 7e3378b4e3..1d3f35beaf 100644 --- a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md +++ b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6c8a667cbd1cafaf243b0428b4ea79a9277a6b70 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 15:59:53 +0800 Subject: [PATCH 0482/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labo?= =?UTF-8?q?ratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=204=20OK04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 4 OK04.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md diff --git a/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md b/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md new file mode 100644 index 0000000000..00fe349914 --- /dev/null +++ b/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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) + +Computer Laboratory – Raspberry Pi: Lesson 4 OK04 +====== + +The OK04 lesson builds on OK03 by teaching how to use the timer to flash the 'OK' or 'ACT' LED at precise intervals. It is assumed you have the code for the [Lesson 3: OK03][1] operating system as a basis. + +### 1 A New Device + +The timer is the only way the Pi can keep time. Most computers have a battery powered clock to keep time when off. + +So far, we've only looked at one piece of hardware on the Raspberry Pi, namely the GPIO Controller. I've simply told you what to do, and it happened. Now we're going to look at the timer, and I'm going to lead you through understanding how it works. + +Just like the GPIO Controller, the timer has an address. In this case, the timer is based at 2000300016. Reading the manual, we find the following table: + +Table 1.1 GPIO Controller Registers +| Address | Size / Bytes | Name | Description | Read or Write | +| -------- | ------------ | ---------------- | ---------------------------------------------------------- | ---------------- | +| 20003000 | 4 | Control / Status | Register used to control and clear timer channel comparator matches. | RW | +| 20003004 | 8 | Counter | A counter that increments at 1MHz. | R | +| 2000300C | 4 | Compare 0 | 0th Comparison register. | RW | +| 20003010 | 4 | Compare 1 | 1st Comparison register. | RW | +| 20003014 | 4 | Compare 2 | 2nd Comparison register. | RW | +| 20003018 | 4 | Compare 3 | 3rd Comparison register. | RW | + +![Flowchart of the system timer's operation][2] + +This table tells us a lot, but the descriptions in the manual of the various fields tell us the most. The manual explains that the timer fundamentally just increments the value in Counter by 1 every 1 micro second. Each time it does so, it compares the lowest 32 bits (4 bytes) of the counter's value with the 4 comparison registers, and if it matches any of them, it updates Control / Status to reflect which ones matched. + +For more information about bits, bytes, bit fields, and data sizes expand the box below. + +``` +A bit is a name for a single binary digit. As you may recall, a single binary digit is either a 1 or a 0. + +A byte is the name we give for a collection of 8 bits. Since each bit can be one of two values, there are 28 = 256 different possible values for a byte. We normally interpret a byte as a binary number between 0 and 255 inclusive. + +![Diagram of GPIO function select controller register 0.][3] + +A bit field is another way of interpreting binary. Rather than interpreting it as a number, binary can be interpreted as many different things. A bit field treats binary as a series of switches which are either on (1) or off (0). If we have a meaning for each of these little switches, we can use them to control things. We have actually already met bitfields with the GPIO controller, with the setting a pin on or off. The bit that was a 1 was the GPIO pin to actually turn on or off. Sometimes we need more options than just on or off, so we group several of the switches together, such as with the GPIO controller function settings (pictured), in which every group of 3 bits controls one GPIO pin function. +``` + +Our goal is to implement a function that we can call with an amount of time as an input that will wait for that amount of time and then return. Think for a moment about how we could do this, given what we have. + +I see there being two options: + + 1. Read a value from the counter, and then keep branching back into the same code until the counter is the amount of time to wait more than it was. + 2. Read a value from the counter, add the amount of time to wait, store this in one of the comparison registers and then keep branching back into the same code until the Control / Status register updates. + + +``` +Issues like these are called concurrency problems, and can be almost impossible to fix. +``` + +Both of these strategies would work fine, but in this tutorial we will only implement the first. The reason is because the comparison registers are more likely to go wrong, as during the time it takes to add the wait time and store it in the comparison register, the counter may have increased, and so it would not match. This could lead to very long unintentional delays if a 1 micro second wait is requested (or worse, a 0 microsecond wait). + +### 2 Implementation + +``` +Large Operating Systems normally use the Wait function as an opportunity to perform background tasks. +``` + +I will largely leave the challenge of creating the ideal wait method to you. I suggest you put all code related to the timer in a file called 'systemTimer.s' (for hopefully obvious reasons). The complicated part about this method, is that the counter is an 8 byte value, but each register only holds 4 bytes. Thus, the counter value will span two registers. + +The following code blocks are examples. + +``` +ldrd r0,r1,[r2,#4] +``` + +``` +ldrd regLow,regHigh,[src,#val] loads 8 bytes from the address given by the number in src plus val into regLow and regHigh . +``` + +An instruction you may find useful is the ldrd instruction above. It loads 8 bytes of memory across 2 registers. In this case, the 8 bytes of memory starting at the address in r2 would be copied into r0 and r1. What is slightly complicated about this arrangement is that r1 actually holds the highest 4 bytes. In other words, if the counter had a value of 999,999,999,99910 = 11101000110101001010010100001111111111112, r1 would contain 111010002 and r0 would contain 110101001010010100001111111111112. + +The most sensible way to implement this would be to compute the difference between the current counter value and the one from when the method started, and then to compare this with the requested amount of time to wait. Conveniently, unless you wish to support wait times that were 8 bytes, the value in r1 in the example above could be discarded, and only the low 4 bytes of the counter need be used. + +When waiting you should always be sure to use higher comparisons not equality comparisons, as if you try to wait for the gap between the time the method started and the time it ends to be exactly the amount requested, you could miss the value, and wait forever. + +If you cannot figure out how to code the wait function, expand the box below for a guide. + +``` +Borrowing the idea from the GPIO controller, the first function we should write should be to get the address of this system timer. An example of this is shown below: + +.globl GetSystemTimerBase +GetSystemTimerBase: +ldr r0,=0x20003000 +mov pc,lr + +Another function that will prove useful would be one that returns the current counter value in registers r0 and r1: + +.globl GetTimeStamp +GetTimeStamp: +push {lr} +bl GetSystemTimerBase +ldrd r0,r1,[r0,#4] +pop {pc} + +This function simply uses the GetSystemTimerBase function and loads in the counter value using ldrd like we have just learned. + +Now we actually want to code our wait method. First of all, we need to know the counter value when the method started, which we can now get using GetTimeStamp. + +delay .req r2 +mov delay,r0 +push {lr} +bl GetTimeStamp +start .req r3 +mov start,r0 + +This code copies our method's input, the amount of time to delay, into r2, and then calls GetTimeStamp, which we know will return the current counter value in r0 and r1. It then copies the lower 4 bytes of the counter's value to r3. + +Next we need to compute the difference between the current counter value and the reading we just took, and then keep doing so until the gap between them is at least the size of delay. + +loop$: + +bl GetTimeStamp +elapsed .req r1 +sub elapsed,r0,start +cmp elapsed,delay +.unreq elapsed +bls loop$ + +This code will wait until the requested amount of time has passed. It takes a reading from the counter, subtracts the initial value from this reading and then compares that to the requested delay. If the amount of time that has elapsed is less than the requested delay, it branches back to loop$. + +.unreq delay +.unreq start +pop {pc} + +This code finishes off the function by returning. +``` + +### 3 Another Blinking Light + +Once you have what you believe to be a working wait function, change 'main.s' to use it. Alter everywhere you wait to set the value of r0 to some big number (remember it is in microseconds) and then test it on the Raspberry Pi. If it does not function correctly please see our troubleshooting page. + +Once it is working, congratulations you have now mastered another device, and with it, time itself. In the next and final lesson in the OK series, [Lesson 5: OK05][4] we shall use all we have learned to flash out a pattern on the LED. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html + +作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.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 6188288bbe7ec922f9eb82f5ff3bbc3950488135 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 16:03:06 +0800 Subject: [PATCH 0483/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labo?= =?UTF-8?q?ratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=205=20OK05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 5 OK05.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md diff --git a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md new file mode 100644 index 0000000000..9eb5bf6f93 --- /dev/null +++ b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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) + +Computer Laboratory – Raspberry Pi: Lesson 5 OK05 +====== + +The OK05 lesson builds on OK04 using it to flash the SOS Morse Code pattern (...---...). It is assumed you have the code for the [Lesson 4: OK04][1] operating system as a basis. + +### 1 Data + +So far, all we've had to do with our operating system is provide instructions to be followed. Sometimes however, instructions are only half the story. Our operating systems may need data. + +``` +Some early Operating Systems did only allow certain types of data in certain files, but this was generally found to be too restrictive. The modern way does make programs a lot more complicated however. +``` + +In general data is just values that are important. You are probably trained to think of data as being of a specific type, e.g. a text file contains text, an image file contains an image, etc. This is, in truth, just an idea. All data on a computer is just binary numbers, how we choose to interpret them is what counts. In this example we're going to store a light flashing sequence as data. + +At the end of 'main.s' copy the following code: + +``` +.section .data +.align 2 +pattern: +.int 0b11111111101010100010001000101010 +``` + +``` +.align num ensures the address of the next line is a multiple of 2num . + +.int val outputs the number val . +``` + +To differentiate between data and code, we put all the data in the .data. I've included this on the operating system memory layout diagram here. I've just chosen to put the data after the end of the code. The reason for keeping our data and instructions separate is so that if we eventually implement some security on our operating system, we need to know what parts of the code can be executed, and what parts can't. + +I've used two new commands here. .align and .int. .align ensures alignment of the following data to a specified power of 2. In this case I've used .align 2 which means that this data will definitely be placed at an address which is a multiple of 22 = 4. It is really important to do this, because the ldr instruction we used to read memory only works at addresses that are multiples of 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. + +``` +One challenge with data is finding an efficient and useful representation. This method of storing the sequence as on and off units of time is easy to run, but would be difficult to edit, as the concept of a Morse - or . is lost. +``` + +As I mentioned, data can mean whatever you want. In this case I've encoded the Morse Code SOS sequence, which is ...---... for those unfamiliar. I've used a 0 to represent a unit of time with the LED off, and a 1 to represent a unit of time with the LED on. That way, we can write some code which just displays a sequence in data like this one, and then all we have to do to make it display a different sequence is change the data. This is a very simple example of what operating systems must do all the time; interpret and display data. + +Copy the following lines before the loop$ label in 'main.s'. + +``` +ptrn .req r4 +ldr ptrn,=pattern +ldr ptrn,[ptrn] +seq .req r5 +mov seq,#0 +``` + +This code loads the pattern into r4, and loads 0 into r5. r5 will be our sequence position, so we can keep track of how much of the pattern we have displayed. + +The following code puts a non-zero into r1 if and only if there is a 1 in the current part of the pattern. + +``` +mov r1,#1 +lsl r1,seq +and r1,ptrn +``` + +This code is useful for your calls to SetGpio, which must have a non-zero value to turn the LED off, and a value of zero to turn the LED on. + +Now modify all of your code in 'main.s' so that each loop the code sets the LED based on the current sequence number, waits for 250000 micro seconds (or any other appropriate delay), and then increments the sequence number. When the sequence number reaches 32, it needs to go back to 0. See if you can implement this, and for an extra challenge, try to do it using only 1 instruction (solution in the download). + +### 2 Time Flies When You're Having Fun... + +You're now ready to test this on the Raspberry Pi. It should flash out a sequence of 3 short pulses, 3 long pulses and then 3 more short pulses. After a delay, the pattern should repeat. If it doesn't work please see our troubleshooting page. + +Once it works, congratulations you have reached the end of the OK series of tutorials. + +In this series we've learnt about assembly code, the GPIO controller and the System Timer. We've learnt about functions and the ABI, as well as several basic Operating System concepts, and also about data. + +You're now ready to move onto one of the more advanced series. + + * The [Screen][2] series is next and teaches you how to use the screen with assembly code. + * The [Input][3] series teaches you how to use the keyboard and mouse. + + + +By now you already have enough information to make Operating Systems that interact with the GPIO in other ways. If you have any robot kits, you may want to try writing a robot operating system controlled with the GPIO pins! + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html + +作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.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 13dba92b6989f3f4dad649edeebba95df12a3b22 Mon Sep 17 00:00:00 2001 From: guevaraya Date: Mon, 7 Jan 2019 19:26:56 +0800 Subject: [PATCH 0484/4278] Linux/Unix App For Prevention Of RSI (Repetitive Strain Injury) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 --- ...Unix App For Prevention Of RSI (Repetitive Strain Injury).md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md b/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md index 0adea8a54c..989f54d45a 100644 --- a/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md +++ b/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md @@ -1,3 +1,5 @@ +Translating By Guevaraya + Linux/Unix App For Prevention Of RSI (Repetitive Strain Injury) ====== ![workrave-image][1] From 5f25c6e7d17f25ceefc4b9a31e2296ea2469ce82 Mon Sep 17 00:00:00 2001 From: "GJ.Zhang" Date: Mon, 7 Jan 2019 21:20:59 +0800 Subject: [PATCH 0485/4278] =?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 My Lisp Experiences and the Development of GNU Emacs --- ...40412 My Lisp Experiences and the Development of GNU Emacs.md | 1 + 1 file changed, 1 insertion(+) 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 7be913c3bf..60e1094af9 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,3 +1,4 @@ +zgj1024 is translating My Lisp Experiences and the Development of GNU Emacs ====== From 2f8ec07b2c67ed31dd92f208159f76e85801fa01 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 22:27:00 +0800 Subject: [PATCH 0486/4278] PRF:20180703 10 killer tools for the admin in a hurry.md @bestony --- ...0 killer tools for the admin in a hurry.md | 70 ++++++++++--------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/translated/tech/20180703 10 killer tools for the admin in a hurry.md b/translated/tech/20180703 10 killer tools for the admin in a hurry.md index 8fc7d36474..82d1c4e33f 100644 --- a/translated/tech/20180703 10 killer tools for the admin in a hurry.md +++ b/translated/tech/20180703 10 killer tools for the admin in a hurry.md @@ -1,77 +1,79 @@ -10 个供管理员快速使用的杀手工具 +10 个供管理员救急的杀手级工具 ====== +> 可以让你赶快离开办公室的网络管理技巧和工具。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT) -当工作负载累计时,管理网络和系统变得富有压力。没有人能真正意识到需要花费多长时间,每个人都希望在昨天能够完成他们的具体事务。 +当工作任务堆积成山时,管理网络和系统就变得十分有压力了。没有人能真正意识到需要花费多长时间,每个人都希望在昨天就完成他们的工作。 所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。 -So, without further ado, here's my Swiss Army Knife of stuff to get you out of the office before dinner time. - 因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。 ### 服务器配置和脚本 让我们看一看! -**[NixCraft][1]** -用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 +- [NixCraft][1] -**[Webmin][2]** -它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。 + 使用该网站的搜索功能。经过十多年的定期更新,这里遍地是黄金!有用的脚本和方便的技巧可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 -**[Windows 下的 Linux 子系统][3]** +- [Webmin][2] -现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 + 它提供给你了一个很好的 Web 界面来帮助你远程编辑配置文件。它减少了在处理目录路径和 `sudo nano` 上花费的大量时间,在你处理多个客户时,非常方便。 -你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。 +- [Windows 下的 Linux 子系统][3] -这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。 + 现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中不断增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 -**[mRemoteNG][4]** -当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 + 你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置要少的多。 + + 这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制文件,可以完全访问 Windows 和 Linux 文件系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian 和 Kali 发行版。 + +- [mRemoteNG][4] + + 当你有 100 多个服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 ### 设置网络,这样你就无需再这样做了。 -一个考虑不周的网络是厌恶加班管理员的死敌。 +一个设计不周的网络是厌恶加班的管理员的死敌。 -**[可拓展的 IP 寻址方案][5]** +- [可拓展的 IP 寻址方案][5] -IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 + IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 -没有人有时间做这件事! + 没有人有时间做这件事! -到了某个时候,IPv6 终将到来,来拯救这世界。在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机,这些一刀切的IP 寻址方案都应该让我们继续前行。 + 到了某个时候,IPv6 终将到来,来拯救这世界。但在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP 耳机和浓缩咖啡机,这些以不变应万变的 IP 寻址方案都应该让我们继续前行。 +- [Linux Chmod 权限备忘录][6] -**[Linux Chmod 权限备忘录][6]** + 一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 -一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 +- [VLSM 子网计算器][7] -**[VLSM 子网计算器][7]** - -只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 + 只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 ### 单一用途的 Linux 发行版 -需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。 +需要一个只做一件事的 Linux 容器?如果其他人已经在一个操作系统上搞好了一个小东西,你就可以快速安装它并马上投入使用。 下面这些每一个都使得我的工作变得轻松了许多。 -**[Porteus Kiosk][8]** -这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 +- [Porteus Kiosk][8] -**[Parted Magic][9]** -这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 + 这个工具用来帮你把一台电脑上锁定到一个浏览器上。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 -**[IPFire][10]** +- [Parted Magic][9] -啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”(译者注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 + 这是一个你可以从 USB 驱动器启动的,可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 -那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松? +- [IPFire][10] -我很高兴知道,请在评论中分享您的工具。 + 啊哈~我还是不敢相信有人把路由器/防火墙/代理组合成为“我尿火”(LCTT 译注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 + +那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松?我很高兴知道,请在评论中分享您的工具。 -------------------------------------------------------------------------------- @@ -80,7 +82,7 @@ via: https://opensource.com/article/18/7/tools-admin 作者:[Grant Hamono][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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 28a84e33ee7b8322321e0f2b4bc9a4874aacbb15 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 22:27:18 +0800 Subject: [PATCH 0487/4278] PUB:20180703 10 killer tools for the admin in a hurry.md @bestony https://linux.cn/article-10422-1.html --- .../20180703 10 killer tools for the admin in a hurry.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180703 10 killer tools for the admin in a hurry.md (100%) diff --git a/translated/tech/20180703 10 killer tools for the admin in a hurry.md b/published/20180703 10 killer tools for the admin in a hurry.md similarity index 100% rename from translated/tech/20180703 10 killer tools for the admin in a hurry.md rename to published/20180703 10 killer tools for the admin in a hurry.md From b52ab9f4649ef4a9137adabcb20f01049cb21de1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 23:28:22 +0800 Subject: [PATCH 0488/4278] PRF:20171227 YAML- probably not so great after all.md @MjSeven --- ...7 YAML- probably not so great after all.md | 132 +++++++++++------- 1 file changed, 78 insertions(+), 54 deletions(-) diff --git a/translated/tech/20171227 YAML- probably not so great after all.md b/translated/tech/20171227 YAML- probably not so great after all.md index a64cb1e43d..02c80a6a11 100644 --- a/translated/tech/20171227 YAML- probably not so great after all.md +++ b/translated/tech/20171227 YAML- probably not so great after all.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (YAML: probably not so great after all) [#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) [#]: author: (Martin Tournoij https://arp242.net/) -YAML: 可能并不是那么完美 +YAML:可能并不是那么完美 ====== 我之前写过[为什么将 JSON 用于人类可编辑的配置文件是一个坏主意][1],今天我们将讨论 YAML 格式的一些常见问题。 @@ -15,19 +15,21 @@ YAML: 可能并不是那么完美 ### 默认情况下不安全 YAML 默认是不安全的。加载用户提供的(不可信的)YAML 字符串需要仔细考虑。 + ``` !!python/object/apply:os.system args: ['ls /'] ``` 用 `print(yaml.load(open('a.yaml')))` 运行它,应该给你这样的东西: + ``` -bin etc lib lost+found opt root sbin tmp var sys -boot dev efi home lib64 mnt proc run srv usr +bin etc lib lost+found opt root sbin tmp var sys +boot dev efi home lib64 mnt proc run srv usr 0 ``` -许多其他语言(包括 Ruby 和 PHP)默认情况下(to 校正:这里应该说的是解析 yaml)也不安全。[在 GitHub 上搜索 `yaml.load`][2] 会得到惊人的 280 万个结果,而 [`yaml.safe_load`][3] 只能得到 26,000 个结果。 +许多其他语言(包括 Ruby 和 PHP [^1] )默认情况下也不安全(LCTT 译注:这里应该说的是解析 yaml)。[在 GitHub 上搜索 yaml.load][2] 会得到惊人的 280 万个结果,而 [yaml.safe_load][3] 只能得到 26000 个结果。 提个醒,很多这样的 `yaml.load()` 都工作的很好,在配置文件中加载 `yaml.load()` 通常没问题,因为它通常(虽然并不总是!)来自“可靠源”,而且很多都来自静态的 YAML 测试文件。但是,人们还是不禁怀疑在这 280 万个结果中隐藏了多少漏洞。 @@ -41,57 +43,60 @@ boot dev efi home lib64 mnt proc run srv usr YAML 文件可能很难编辑,随着文件变大,这个难度会快速增大。 -一个很好的例子是 Ruby on Rails 的翻译文件。(to 校正:这里 translation files 是什么?)例如: +一个很好的例子是 Ruby on Rails 的本地化翻译文件。例如: + ``` en: - formtastic: - labels: - title: "Title" # Default global value - article: - body: "Article content" - post: - new: - title: "Choose a title..." - body: "Write something..." - edit: - title: "Edit title" - body: "Edit body" + formtastic: + labels: + title: "Title" # Default global value + article: + body: "Article content" + post: + new: + title: "Choose a title..." + body: "Write something..." + edit: + title: "Edit title" + body: "Edit body" ``` -看起来不错,对吧?但是如果这个文件有 100 行怎么办?或者 1,000 行?在文件中很难看到 "where",因为它可能在屏幕外。你需要向上滚动,但是你需要跟踪缩进,即使使用缩进指南也很难,特别是因为 2 个缩进是常态而且 [tab 缩进被禁止][5]。 +看起来不错,对吧?但是如果这个文件有 100 行怎么办?或者 1,000 行?在文件中很难看到 “where”,因为它可能在屏幕外。你需要向上滚动,但是你需要跟踪缩进,即使遵循缩进指南也很难,特别是因为 2 个空格缩进是常态而且 [制表符缩进被禁止][5] [^2] 。 -不小心缩进出错通常不是一个错误,它通常只是反序列化为你不想要的东西。这样只能祝你调试快乐! +不小心缩进出错通常不算错误,它通常只是反序列化为你不想要的东西。这样只能祝你调试快乐! -我已经愉快地编写 Python 长达十多年,所以我已经习惯了显著的空白,但有时候我仍在和 YAML 抗争。在 Python 中,缺点和清晰度的丧失是由于没有那种长达几页的函数,但数据或配置文件的长度没有这种自然限制。(to 校正:这里不太明白为什么没有长达几页函数会导致 python 清晰度的丧失,或许我的翻译有问题) +我已经愉快地编写 Python 长达十多年,所以我已经习惯了显眼的空白,但有时候我仍在和 YAML 抗争。在 Python 中,虽然没有那种长达几页的函数,但数据或配置文件的长度没有这种自然限制,这就带来了缺点和损失了清晰度。 对于小文件,这不是问题,但它确实无法很好地扩展到较大的文件,特别是如果你以后想编辑它们的话。 ### 这非常复杂 -在浏览一个基本的例子时,YAML 看似“简单”和“显而易见”,但事实证明并非如此。[YAML 规范][6]有 23,449 个单词,为了比较,[TOML][7] 有 3,339 个单词,[Json][8] 有 1,969 个单词,[XML][9] 有 20,603 个单词。 +在浏览一个基本的例子时,YAML 看似“简单”和“显而易见”,但事实证明并非如此。[YAML 规范][6]有 23449 个单词,为了比较,[TOML][7] 有 3339 个单词,[Json][8] 有 1969 个单词,[XML][9] 有 20603 个单词。 -我们中有谁读过全部吗?有谁读过并理解了全部?谁阅读过,理解进而**记住**所有这些? +我们中有谁读过全部规范吗?有谁读过并理解了全部?谁阅读过,理解进而**记住**所有这些? -例如,你知道有[ 9 种方法在 YAML 中编写多行字符串][10]吗?并且它们具有细微的不同行为。 +例如,你知道[在 YAML 中编写多行字符串有 9 种方法][10]吗?并且它们具有细微的不同行为。 是的 :-/ -如果你看一下[它的修订历史][11],那篇文章就会变得更加有趣,因为文章的作者发现了越来越多的方法可以实现这一点,以及更多的细微之处。 +如果你看一下[那篇文章的修订历史][11],它就会变得更加有趣,因为文章的作者发现了越来越多的方法可以实现这一点,以及更多的细微之处。 -它从预览开始告诉我们 YANL 规范,它表明(强调我的): +它从预览开始告诉我们 YAML 规范,它表明(强调我的): -> 本节简要介绍了 YAML 的表达能力。**初次阅读的人不可能熟读所有的例子**。相反,这些选择用作规范其余部分的动机。 +> 本节简要介绍了 YAML 的表达能力。**预计初次阅读的人不可能理解所有的例子**。相反,这些选择用作该规范其余部分的动机。 -#### 惊讶的行为 +#### 令人惊讶的行为 以下会解析成什么([Colm O’Connor][12] 提供的例子): + ``` - Don Corleone: Do you have faith in my judgment? - Clemenza: Yes - Don Corleone: Do I have your loyalty? ``` -结果为 +结果为: + ``` [ {'Don Corleone': 'Do you have faith in my judgment?'}, @@ -101,53 +106,60 @@ en: ``` 那么这个呢: + ``` python: 3.5.3 postgres: 9.3 ``` `3.5.3` 被识别为字符串,但 `9.3` 被识别为数字而不是字符串: + ``` {'python': '3.5.3', 'postgres': 9.3} ``` 这个呢: + ``` Effenaar: Eindhoven 013: Tilburg ``` -013 是蒂尔堡(Tilburg)的一个流行音乐场地,但 YAML 会告诉你错误答案,因为它被解析为八进制数字: +`013` 是蒂尔堡Tilburg的一个流行音乐场地,但 YAML 会告诉你错误答案,因为它被解析为八进制数字: + ``` {11: 'Tilburg', 'Effenaar': 'Eindhoven'} ``` -所有这一切,以及更多,就是为什么许多经验丰富的 YAMLers 经常会引用所有字符串的原因,即使它不是严格要求。许多人不使用引号,而且很容易忘记,特别是如果文件的其余部分(可能由其他人编写)不使用引号。 +所有这一切,以及更多,就是为什么许多经验丰富的 YAMLer 经常会将所有字符串用引号引起来的原因,即使它不是严格要求。许多人不使用引号,而且很容易忘记,特别是如果文件的其余部分(可能由其他人编写)不使用引号。 ### 它不方便 -因为它太复杂了,它声称的可移植性被夸大了。例如,考虑以下这个从 YAML 规范中获取的示例: +因为它太复杂了,它所声称的可移植性被夸大了。例如,考虑以下这个从 YAML 规范中获取的示例: + ``` ? - Detroit Tigers - - Chicago cubs + - Chicago cubs : - - 2001-07-23 + - 2001-07-23 ? [ New York Yankees, - Atlanta Braves ] + Atlanta Braves ] : [ 2001-07-02, 2001-08-12, - 2001-08-14 ] + 2001-08-14 ] ``` -除了大多数读者可能甚至不知道这样做的事实,还可以尝试使用 PyYAML 在 Python 中解析它: +抛开大多数读者可能甚至不知道这是在做什么之外,请尝试使用 PyYAML 在 Python 中解析它: + ``` yaml.constructor.ConstructorError: while constructing a mapping - in "a.yaml", line 1, column 1 + in "a.yaml", line 1, column 1 found unhashable key - in "a.yaml", line 1, column 3 + in "a.yaml", line 1, column 3 ``` 在 Ruby 中,它可以工作: + ``` { ["Detroit Tigers", "Chicago cubs"] => [ @@ -161,19 +173,21 @@ found unhashable key } ``` -原因是你不能在 Python 中使用列表作为一个字典(dict)键: +这个原因是你不能在 Python 中使用列表作为一个字典的键: + ``` >>> {['a']: 'zxc'} Traceback (most recent call last): - File "", line 1, in - TypeError: unhashable type: 'list' + File "", line 1, in + TypeError: unhashable type: 'list' ``` -而这种限制并不是 Python 特有的,PHP, JavaScript 和 Go 等常用语言都有此限制。 +而这种限制并不是 Python 特有的,PHP、JavaScript 和 Go 等常用语言都有此限制。 -因此,在 YAML 文件中使用它,你将无法在大多数语言中解析它。 +因此,在 YAML 文件中使用这种语法,你将无法在大多数语言中解析它。 这是另一个从 YAML 规范的示例部分中获取的: + ``` # Ranking of 1998 home runs --- @@ -191,12 +205,13 @@ Python 会输出: ``` yaml.composer.ComposerError: expected a single document in the stream - in "a.yaml", line 3, column 1 + in "a.yaml", line 3, column 1 but found another document - in "a.yaml", line 8, column 1 + in "a.yaml", line 8, column 1 ``` 然而 Ruby 输出: + ``` ["Mark McGwire", "Sammy Sosa", "Ken Griffey"] ``` @@ -215,32 +230,38 @@ but found another document > 2. YAML 数据在编程语言之间是可移植的。 > 3. YAML 匹配敏捷语言的原生数据结构。 > 4. YAML 有一个一致的模型来支持通用工具。 -> 5. YAML 支持一趟处理。(to 校正:这里 one-pass 是否有专业翻译?) +> 5. YAML 支持一次性处理。 > 6. YAML 具有表现力和可扩展性。 > 7. YAML 易于实现和使用。 -> -那么它有多好呢? +那么它做的如何呢? > YAML 很容易被人类阅读。 -只有坚持一小部分时才有效。完整集很复杂 - 远远超过 XML 或 JSON。 + +只有坚持一小部分子集时才有效。完整的规则集很复杂 —— 远远超过 XML 或 JSON。 > YAML 数据在编程语言之间是可移植的。 + 事实并非如此,因为创建常见语言不支持的结构太容易了。 > YAML 匹配敏捷语言的原生数据结构。 -往上看。另外,为什么只支持敏捷(或动态)语言?其他语言呢? + +参见上面。另外,为什么只支持敏捷(或动态)语言?其他语言呢? > YAML 有一个一致的模型来支持通用工具。 + 我甚至不确定这意味着什么,我找不到任何详细说明。 -> YAML 支持一趟处理。 +> YAML 支持一次性处理。 + 这点我接受。 > YAML 具有表现力和可扩展性。 + 嗯,是的,但它太富有表现力(例如太复杂)。 > YAML 易于实现和使用。 + ``` $ cat `ls -1 ~/gocode/src/github.com/go-yaml/yaml/*.go | grep -v _test` | wc -l 9247 @@ -251,7 +272,7 @@ $ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l ### 结论 -不要误解我的意思,并不是说 YAML 很糟糕 - 它肯定不像[使用 JSON 那么多的问题][1] - 但它也不是非常好。有一些一开始并不明显的缺点和惊喜,还有许多更好的替代品,如 [TOML][7] 和其他更专业的格式。 +不要误解我的意思,并不是说 YAML 很糟糕 —— 它肯定不像[使用 JSON 那么多的问题][1] —— 但它也不是非常好。有一些一开始并不明显的缺点和惊喜,还有许多更好的替代品,如 [TOML][7] 和其他更专业的格式。 就个人而言,当我有选择时,我不太可能再次使用它。 @@ -259,7 +280,10 @@ $ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l ### 反馈 -你可以发送电子邮件至 [martin@arp242.net][15] 或[创建 GitHub issue][16] 以获取反馈,问题等。 +你可以发送电子邮件至 [martin@arp242.net][15] 或[创建 GitHub issue][16] 以获取反馈、问题等。 + +[^1]: 在 PHP 中你需要修改一个 INI 设置来获得安全的行为,不能只是调用像 `yaml_safe()` 这样的东西。PHP 想尽办法让愚蠢的东西越发愚蠢。干得漂亮! +[^2]: 不要在这里做空格与制表符之争,如果这里可以用制表符的话,我可以(临时)增加制表符宽度来使它更易读——这是制表符的一种用途。 -------------------------------------------------------------------------------- From ac07a0f5c39e9fb087b9c57f56d814fb2649301c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 23:53:40 +0800 Subject: [PATCH 0489/4278] PUB:20171227 YAML- probably not so great after all.md @MjSeven https://linux.cn/article-10423-1.html --- .../20171227 YAML- probably not so great after all.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20171227 YAML- probably not so great after all.md (99%) diff --git a/translated/tech/20171227 YAML- probably not so great after all.md b/published/20171227 YAML- probably not so great after all.md similarity index 99% rename from translated/tech/20171227 YAML- probably not so great after all.md rename to published/20171227 YAML- probably not so great after all.md index 02c80a6a11..03efe649de 100644 --- a/translated/tech/20171227 YAML- probably not so great after all.md +++ b/published/20171227 YAML- probably not so great after all.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10423-1.html) [#]: subject: (YAML: probably not so great after all) [#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) [#]: author: (Martin Tournoij https://arp242.net/) @@ -292,7 +292,7 @@ via: https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html 作者:[Martin Tournoij][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 ccdbd5558391fb4dab71a1fe1b7e18b903cedc6f Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 8 Jan 2019 08:51:52 +0800 Subject: [PATCH 0490/4278] translated --- ...e at the Linux command line with nudoku.md | 54 ------------------- ...e at the Linux command line with nudoku.md | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md create mode 100644 translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md diff --git a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md deleted file mode 100644 index 664921bb87..0000000000 --- a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md +++ /dev/null @@ -1,54 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Solve a puzzle at the Linux command line with nudoku) -[#]: via: (https://opensource.com/article/18/12/linux-toy-nudoku) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Solve a puzzle at the Linux command line with nudoku -====== -Sudokus are simple logic games that can be enjoyed just about anywhere, including in your Linux terminal. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nudoku.png?itok=OS2o4Rot) - -Welcome back to another installment in our 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. - -Every year for Christmas, my mother-in-law gives my wife a Sudoku calendar. It sits on our coffee table for the year to follow. Each day is a separate sheet (except for Saturday and Sunday, that are combined onto one page), with the idea being that you have a new puzzle every day while also having a functioning calendar. - -The problem, in practice, is that it's a great pad of puzzles but not a great calendar because it turns out some days are harder than others and we just don't get through them at the necessary rate of one a day. Then, we may have a week's worth that gets batched on a lazy Sunday. - -Since I've already given you a [calendar][1] as a part of this series, I figure it's only fair to give you a Sudoku puzzle as well, except our command-line versions are decoupled so there's no pressure to complete exactly one a day. - -I found **nudoku** in my default repositories on Fedora, so installing it was as simple as: - -``` -$ sudo dnf install nudoku -``` - -Once installed, just invoke **nudoku** by name to launch it, and it should be fairly self-explanatory from there. If you've never played Sudoku before, it's fairly simple: You need to make sure that each row, each column, and each of the nine 3x3 squares that make up the large square each have one of every digit, 1-9. - -You can find **nudoku** 's c source code [on GitHub][2] under a GPLv3 license. -![](https://opensource.com/sites/default/files/uploads/linux-toy-nudoku-animated.gif) -Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, 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, [Use your Linux terminal to celebrate a banner][3] [year][3], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-nudoku - -作者:[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-cal -[2]: https://github.com/jubalh/nudoku -[3]: https://opensource.com/article/18/12/linux-toy-figlet diff --git a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md new file mode 100644 index 0000000000..a76fbbd50c --- /dev/null +++ b/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solve a puzzle at the Linux command line with nudoku) +[#]: via: (https://opensource.com/article/18/12/linux-toy-nudoku) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 命令行中使用 nudoku 解决谜题 +====== +数独是简单的逻辑游戏,它可以在任何地方玩,包括在 Linux 终端中。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nudoku.png?itok=OS2o4Rot) + +欢迎回到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们在考虑中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 + +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +每年圣诞节,我的婆婆都会给我妻子一本数独日历。它接着会在我们的咖啡桌上呆上一年。每天都是一张单独的表格(星期六和星期日除外,它们合并在一页上),这样你每天都有一个新的谜题,同时还有一本能用的日历。 + +问题在于在实际中它是一本很好的谜题,但不是一本好的日历,因为事实证明有些日子的题目比其他日子更难,我们没有以每天一个的速度解决它们。然后,我们会在懒散的周日来解决这周堆积的谜题。 + +既然我在这个系列的一部分中介绍过[日历][1],那么在这里介绍数独也是公平的,除了我们的命令行版本是解耦的,因此将来很容易就能完成它。 + +我在 Fedora 的默认仓库中找到了 **nudoku**,因此安装它就像下面这样简单: + +``` +$ sudo dnf install nudoku +``` + +安装完后,只需输入 **nudoku** 即可启动它,之后的操作就很明了。如果你以前从未玩过数独,它它很容易:你只需要确保每行、每列、每个 3x3 构成的方块里都包含了 1-9 的所有数字。 + +你可在 [Github][2] 中找到 GPLv3 许可的 **nudoku** 源码 +![](https://opensource.com/sites/default/files/uploads/linux-toy-nudoku-animated.gif) +你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上满了,但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言,我会查看的。记得让我知道你对今天玩具的看法。 + +一定要看看昨天的玩具,[使用 Linux 终端庆祝丰年][3],记得明天回来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-nudoku + +作者:[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-cal +[2]: https://github.com/jubalh/nudoku +[3]: https://opensource.com/article/18/12/linux-toy-figlet \ No newline at end of file From 1b97b347574b67e068d3920392fc1bcfcbe727a3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 8 Jan 2019 08:57:44 +0800 Subject: [PATCH 0491/4278] translating --- .../tech/20190103 How to create presentations with Beamer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190103 How to create presentations with Beamer.md b/sources/tech/20190103 How to create presentations with Beamer.md index 68997a146d..f6d910c348 100644 --- a/sources/tech/20190103 How to create presentations with Beamer.md +++ b/sources/tech/20190103 How to create presentations with Beamer.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 377dfc6f1f77912cf49f9b76af8f952b6777aa09 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 8 Jan 2019 09:04:30 +0800 Subject: [PATCH 0492/4278] translated --- ...nux terminal to celebrate a banner year.md | 100 ------------------ 1 file changed, 100 deletions(-) delete mode 100644 sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md diff --git a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md deleted file mode 100644 index c02371d1ed..0000000000 --- a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md +++ /dev/null @@ -1,100 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use your Linux terminal to celebrate a banner year) -[#]: via: (https://opensource.com/article/18/12/linux-toy-figlet) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Use your Linux terminal to celebrate a banner year -====== -Need make sure your command is heard? Pipe it to a banner and it won't be missed. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) - - -Hello again for another installment in our 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 toy if **figlet** , a utility for printing text in banner form across your Linux terminal. - -You'll likely find **figlet** packaged in your standard repositories. For me on Fedora, this meant installation was as simple as: - -``` -$ sudo dnf install figlet -``` - -After that, simply use the program's name to invoke it. You can either use it interactively, or, pipe some text to it, as below: - -``` -echo "Hello world" | figlet - _   _      _ _                            _     _ -| | | | ___| | | ___   __      _____  _ __| | __| | -| |_| |/ _ \ | |/ _ \  \ \ /\ / / _ \| '__| |/ _` | -|  _  |  __/ | | (_) |  \ V  V / (_) | |  | | (_| | -|_| |_|\___|_|_|\___/    \_/\_/ \___/|_|  |_|\__,_| -``` - -There are a number of different font options available for **figlet**. To see the options available to you, try the command **showfigfonts**. For me, this displayed over a dozen. I've copied out a few of my favorites below. - -``` -block : -                                            -_|        _|                      _|         -_|_|_|    _|    _|_|      _|_|_|  _|  _|     -_|    _|  _|  _|    _|  _|        _|_|       -_|    _|  _|  _|    _|  _|        _|  _|     -_|_|_|    _|    _|_|      _|_|_|  _|    _|   - - -bubble : -  _   _   _   _   _   _   - / \ / \ / \ / \ / \ / \ -( b | u | b | b | l | e ) - \_/ \_/ \_/ \_/ \_/ \_/ - - -lean : -                                      -    _/                               -   _/    _/_/      _/_/_/  _/_/_/     -  _/  _/_/_/_/  _/    _/  _/    _/   - _/  _/        _/    _/  _/    _/     -_/    _/_/_/    _/_/_/  _/    _/   - - -script : -                          -               o           - ,   __   ,_        _ _|_ -/ \_/    /  |  |  |/ \_|   - \/ \___/   |_/|_/|__/ |_/ -                 /|       -                 \|       -``` - -You can find out more about **figlet** on the project's [homepage][1]. The version I downloaded was made available as open source under an MIT license. - -You'll find that **figlet** isn't the only banner-printer available for the Linux terminal. Another option that you may choose to check out is [toilet][2], which comes with its own set of ASCII-art style printing options. - -Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, 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, [Take a swim at your Linux terminal with asciiquarium][3], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-figlet - -作者:[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]: http://www.figlet.org/ -[2]: http://caca.zoy.org/wiki/toilet -[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium From 8aef4983925255d9f67bd12a43206882f72a10b1 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Tue, 8 Jan 2019 10:00:59 +0800 Subject: [PATCH 0493/4278] Translating by qhwdw --- ...0120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index c5225cba1a..f16c290504 100644 --- a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 69a003aaa7e86cef8977875c92edf2aeb37e99ce Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 8 Jan 2019 13:32:56 +0800 Subject: [PATCH 0494/4278] Translating An Introduction to Go. --- .../tech/20181224 An Introduction to Go.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index e866c59da3..5edd8d3d19 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -14,9 +14,9 @@ Go 简介 Go 是一门用于并发编程的命令式编程语言,它主要由创造者 Google 进行开发,最初主要由 Robert Griesemer、Rob Pike 和 Ken Thompson开发。这门语言的设计起始于 2017 年,并在 2019 年推出最初版本;而第一个稳定版本是 2012 年发布的 1.0。 -Go 有 C 风格语法(没有预处理器),垃圾回收机制,并且类似它在贝尔实验室里被开发出来的前辈们,Newsqueak (Rob Pike)、Alef (Phil Winterbottom) 和 Inferno (Pike, Ritchie, et al.),使用所谓的 goroutines 和 channels(一种基于 Hoare 的“通信顺序进程”理论的协程)提供内建的并发支持。 +Go 有 C 风格语法(没有预处理器),垃圾回收机制,而且类似它在贝尔实验室里被开发出来的前辈们,Newsqueak (Rob Pike)、Alef (Phil Winterbottom) 和 Inferno (Pike, Ritchie, et al.),使用所谓的 goroutines 和 channels(一种基于 Hoare 的“通信顺序进程”理论的协程)提供内建的并发支持。 -Go programs are organised in packages. A package is essentially a directory containing Go files. All files in a package share the same namespace, and there are two visibilities for symbols in a package: Symbols starting with an upper case character are visible to other packages, others are private to the package: +Go 程序以包的形式组织。包本质是一个包含 Go 文件的文件夹。包内的所有文件共享相同的命名空间,而包内的符号有两种可见行:以大写字母开头的符号对于其他包是可见,而其他符号则是该包私有的: ``` func PublicFunction() { @@ -30,35 +30,35 @@ func privateFunction() { ### 类型 -Go has a fairly simple type system: There is no subtyping (but there are conversions), no generics, no polymorphic functions, and there are only a few basic categories of types: +Go 有一个相当简单的类型系统:没有子类型(但有类型转换),没有泛型,没有多态函数,只有一些基本的类型: - 1. base types: `int`, `int64`, `int8`, `uint`, `float32`, `float64`, etc. + 1. 基本类型:`int`、`int64`、`int8`、`uint`、`float32`、`float64` 等。 2. `struct` - 3. `interface` \- a set of methods + 3. `interface` \- 一类方法 - 4. `map[K, V]` \- a map from a key type to a value type + 4. `map[K, V]` \- 从键类型到值类型的映射 - 5. `[number]Type` \- an array of some element type + 5. `[number]Type` \- 一些元素类型组成的数组 - 6. `[]Type` \- a slice (pointer to array with length and capability) of some type + 6. `[]Type` \- 某种类型的切片(指向具有长度和功能的数组) - 7. `chan Type` \- a thread-safe queue + 7. `chan Type` \- 一个线程安全的队列 - 8. pointer `*T` to some other type + 8. 指针 `*T` 指向其他类型 - 9. functions + 9. 函数 - 10. named type - aliases for other types that may have associated methods: + 10. 命名类型 - 可能具有关联方法的其他类型的别名: -``` -type T struct { foo int } -type T *T -type T OtherNamedType -``` + ``` + type T struct { foo int } + type T *T + type T OtherNamedType + ``` -Named types are mostly distinct from their underlying types, so you cannot assign them to each other, but some operators like `+` do work on objects of named types with an underlying numerical type (so you could add two `T` in the example above). + Named types are mostly distinct from their underlying types, so you cannot assign them to each other, but some operators like `+` do work on objects of named types with an underlying numerical type (so you could add two `T` in the example above). Maps, slices, and channels are reference-like types - they essentially are structs containing pointers. Other types are passed by value (copied), including arrays (which have a fixed length and are copied). From 99c59bcae667c72261964d8356cc0c44f7dce369 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 14:47:30 +0800 Subject: [PATCH 0495/4278] APL:20181029 How I organize my knowledge as a Software Engineer.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译申请 --- ...181029 How I organize my knowledge as a Software Engineer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md index c11e1c9c38..448e9b564b 100644 --- a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md +++ b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md @@ -1,4 +1,4 @@ -@flowsnow is translating +wxy is translating How I organize my knowledge as a Software Engineer From 685dba0aaac8ad23b7d0572665f35585a1e49eb1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 15:23:47 +0800 Subject: [PATCH 0496/4278] TRD:20181029 How I organize my knowledge as a Software Engineer.md --- ...ize my knowledge as a Software Engineer.md | 98 +++++++++---------- 1 file changed, 45 insertions(+), 53 deletions(-) diff --git a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md index 448e9b564b..cb447b476d 100644 --- a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md +++ b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md @@ -1,101 +1,93 @@ -wxy is translating +我怎样如软件工程师一样组织知识 +========== + +总体上说,软件开发和技术是以非常快的速度发展的领域,所以持续学习是必不可少的。在互联网上花几分钟找一下,在 Twitter、媒体、RSS 订阅、Hacker News 和其它专业网站和社区等地方,就可以从文章、案例研究、教程、代码片段、新应用程序和信息中找到大量有用的信息。 + +保存和组织所有这些信息可能是一项艰巨的任务。在这篇文章中,我将介绍一些我用来组织信息的工具。 + +我认为在知识管理方面非常重要的一点就是避免锁定在特定平台。我使用的所有工具都允许以标准格式(如 Markdown 和 HTML)导出数据。 + +请注意,我的流程并不完美,我一直在寻找新工具和方法来优化它。每个人都不同,所以对我有用的东西可能不适合你。 -How I organize my knowledge as a Software Engineer -============================================================ +### 用 NotionHQ 做知识库 +对我来说,知识管理的基本部分是拥有某种个人知识库或维基。这是一个你可以以有组织的方式保存链接、书签、备注等的地方。 -Software Development and Technology in general are areas that evolve at a very fast pace and continuous learning is essential. -Some minutes navigating in the internet, in places like Twitter, Medium, RSS feeds, Hacker News and other specialized sites and communities, are enough to find lots of great pieces of information from articles, case studies, tutorials, code snippets, new applications and much more. +我使用 [NotionHQ][7] 做这件事。我使用它来记录各种主题,包括资源列表,如通过编程语言分组的优秀的库或教程,为有趣的博客文章和教程添加书签等等,不仅与软件开发有关,而且与我的个人生活有关。 -Saving and organizing all that information can be a daunting task. In this post I will present some tools tools that I use to do it. +我真正喜欢 NotionHQ 的是,创建新内容是如此简单。你可以使用 Markdown 编写它并将其组织为树状。 -One of the points I consider very important regarding knowledge management is to avoid lock-in in a particular platform. All the tools I use, allow to export your data in standard formats like Markdown and HTML. +这是我的“开发”工作区的顶级页面: -Note that, My workflow is not perfect and I am constantly searching for new tools and ways to optimize it. Also everyone is different, so what works for me might not working well for you. +[![Image](https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png)][8] -### Knowledge base with NotionHQ +NotionHQ 有一些很棒的其他功能,如集成了电子表格/数据库和任务板。 -For me, the fundamental piece of Knowledge management is to have some kind of personal Knowledge base / wiki. A place where you can save links, bookmarks, notes etc in an organized manner. +如果您想认真使用 NotionHQ,您将需要订阅付费个人计划,因为免费计划有所限制。我觉得它物有所值。NotionHQ 允许将整个工作区导出为 Markdown 文件。导出功能存在一些重要问题,例如丢失页面层次结构,希望 Notion 团队可以改进这一点。 -I use [NotionHQ][7] for that matter. I use it to keep notes on various topics, having lists of resources like great libraries or tutorials grouped by programming language, bookmarking interesting blog posts and tutorials, and much more, not only related to software development but also my personal life. +作为一个免费的替代方案,我可能会使用 [VuePress][9] 或 [GitBook][10] 来托管我自己的知识库。 -What I really like about Notion, is how simple it is to create new content. You write it using Markdown and it is organized as tree. +### 用 Pocket 保存感兴趣的文章 -Here is my top level pages of my "Development" workspace: +[Pocket][11] 是我最喜欢的应用之一!使用 Pocket,您可以创建一个来自互联网上的文章的阅读列表。每当我看到一篇看起来很有趣的文章时,我都会使用 Chrome 扩展程序将其保存到 Pocket。稍后,我会阅读它,如果我发现它足够有用,我将使用 Pocket 的“存档”功能永久保存该文章并清理我的 Pocket 收件箱。 - [![Image](https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png)][8] +我尽量保持这个阅读清单足够小,并存档我已经处理过的信息。Pocket 允许您标记文章,以便以后更轻松地搜索特定主题的文章。 -Notion has some nice other features like integrated spreadsheets / databases and Task boards. +如果原始网站消失,您还可以在 Pocket 服务器中保存文章的副本,但是您需要 Pocket Premium 订阅计划。 -You will need to subscribe to paid Personal Plan, if you want to use Notion seriously as the free plan is somewhat limited. I think its worth the price. Notion allows to export your entire workspace to Markdown files. The export has some important problems, like loosing the page hierarchy, but hope Notion Team can improve that. +Pocket 还具有“发现”功能,根据您保存的文章推荐类似的文章。这是找到可以阅读的新内容的好方法。 -As a free alternative I would probably use [VuePress][9] or [GitBook][10] to host my own. +### 用 SnippetStore 做代码片段管理 -### Save interesting articles with Pocket +从 GitHub 到 Stack Overflow 的答案,到博客文章,经常能找到一些你想要保存备用的好代码片段。它可能是一些不错的算法实现、一个有用的脚本或如何在某种语言中执行某种操作的示例。 -[Pocket][11] is one of my favorite applications ever! With Pocket you can create a reading list of articles from the Internet.  -Every time I see an article that looks interesting, I save it to Pocket using its Chrome Extension. Later on, I will read it and If I found it useful enough, I will use the "Archive" function of Pocket to permanently save that article and clean up my Pocket inbox. +我尝试了很多应用程序,从简单的 GitHub Gists 到 [Boostnote][12],直到我发现 [SnippetStore][13]。 -I try to keep the Reading list small enough and keep archiving information that I have dealt with. Pocket allows you to tag articles which will make it simpler to search articles for a particular topic later in time. +SnippetStore 是一个开源的代码片段管理应用。SnippetStore 与其他产品的区别在于其简单性。您可以按语言或标签整理片段,并且可以拥有多个文件片段。它不完美,但是可以用。例如,Boostnote 具有更多功能,但我更喜欢 SnippetStore 组织内容的简单方法。 -You can also save a copy of the article in Pocket servers in case of the original site disappears, but you will need Pocket Premium for that. +对于我每天使用的缩写和片段,我更喜欢使用我的编辑器 / IDE 的代码片段功能,因为它更便于使用。我使用 SnippetStore 更像是作为编码示例的参考。 -Pocket also have a "Discover" feature which suggests similar articles based on the articles you have saved. This is a great way to find new content to read. +[Cacher][14] 也是一个有趣的选择,因为它与许多编辑器进行了集成,他有一个命令行工具,并使用 Gi​​tHub Gists 作为后端,但其专业计划为 6 美元/月,我觉这有点太贵。 -### Snippet Management with SnippetStore +### 用 DevHints 管理速查表 -From GitHub, to Stack Overflow answers, to blog posts, its common to find some nice code snippets that you want to save for later. It could be some nice algorithm implementation, an useful script or an example of how to do X in Y language. +[Devhints][15] 是由 Rico Sta. Cruz 创建的一个速查表集合。它是开源的,是用 Jekyll 生成的,Jekyll 是最受欢迎的静态站点生成器之一。 -I tried many apps from simple GitHub Gists to [Boostnote][12] until I discovered [SnippetStore][13]. +这些速查表是用 Markdown 编写的,带有一些额外的格式化支持,例如支持列。 -SnippetStore is an open source snippet management app. What distinguish SnippetStore from others is its simplicity. You can organize snippets by Language or Tags and you can have multi file snippets. Its not perfect but it gets the job done. Boostnote, for example has more features, but I prefer the simpler way of organizing content of SnippetStore. +我非常喜欢其界面的外观,并且不像可以在 [Cheatography][16] 等网站上找到 PDF 或图像格式的速查表, Markdown 非常容易添加新内容并保持更新和进行版本控制。 -For abbreviations and snippets that I use on a daily basis, I prefer to use my Editor / IDE snippets feature as it is more convenient to use. I use SnippetStore more like a reference of coding examples. +因为它是开源,我创建了自己的分叉版本,删除了一些我不需要的速查表,并添加了更多。 -[Cacher][14] is also an interesting alternative, since it has integrations with many editors, have a cli tool and uses GitHub Gists as backend, but 6$/month for its pro plan, its too much IMO. +我使用速查表作为如何使用某些库或编程语言或记住一些命令的参考。速查表的单个页面非常方便,例如,可以列出特定编程语言的所有基本语法。 -### Managing cheat sheets with DevHints - -[Devhints][15] is a collection of cheat sheets created by Rico Sta. Cruz. Its open source and powered by Jekyll, one of the most popular static site generator. - -The cheat sheets are written in Markdown with some extra formatting goodies like support for columns. - -I really like the looks of the interface and being Markdown makes in incredibly easy to add new content and keep it updated and in version control, unlike cheat sheets in PDF or Image format, that you can find on sites like [Cheatography][16]. - -As it is open source I have created my own fork, removed some cheat sheets that I dont need and add some more. - -I use cheat sheets as reference of how to use some library or programming language or to remember some commands. Its very handy to have a single page, with all the basic syntax of a specific programming language for example. - -I am still experimenting with this but its working great so far. +我仍在尝试这个工具,但到目前为止它的工作很好。 ### Diigo -[Diigo][17] allows you to Annotate and Highlight parts of websites. I use it to annotate important information when studying new topics or to save particular paragraphs from articles, Stack Overflow answers or inspirational quotes from Twitter! ;) +[Diigo][17] 允许您注释和突出显示部分网站。我在研究新东西时使用它来注释重要信息,或者从文章、Stack Overflow 答案或来自 Twitter 的鼓舞人心的引语中保存特定段落!;) * * * -And thats it. There might be some overlap in terms of functionality in some of the tools, but like I said in the beginning, this is an always evolving workflow, as I am always experimenting and searching for ways to improve and be more productive. +就这些了。某些工具的功能方面可能存在一些重叠,但正如我在开始时所说的那样,这是一个不断演进的工作流程,因为我一直在尝试和寻找改进和提高工作效率的方法。 -What about you? How to you organize your Knowledge?. Please feel free to comment below. +你呢?是如何组织你的知识的?请随时在下面发表评论。 -Thank you for reading. +谢谢你的阅读。 ------------------------------------------------------------------------ -作者简介: - -Bruno Paz -Web Engineer. Expert in #PHP and @Symfony Framework. Enthusiast about new technologies. Sports and @FCPorto fan! +作者简介:Bruno Paz,Web 工程师,专精 #PHP 和 @Symfony 框架。热心于新技术。喜欢运动,@FCPorto 的粉丝! -------------------------------------------------------------------------------- via: https://dev.to/brpaz/how-do-i-organize-my-knowledge-as-a-software-engineer-4387 -作者:[ Bruno Paz][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +作者:[Bruno Paz][a] 选题:[oska874](https://github.com/oska874) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8009d8203b0db20d1031b0984444628ce5de99c8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 15:30:13 +0800 Subject: [PATCH 0497/4278] PRF:20181029 How I organize my knowledge as a Software Engineer.md --- ...181029 How I organize my knowledge as a Software Engineer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md index cb447b476d..73a46af506 100644 --- a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md +++ b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md @@ -1,4 +1,4 @@ -我怎样如软件工程师一样组织知识 +怎样如软件工程师一样组织知识 ========== 总体上说,软件开发和技术是以非常快的速度发展的领域,所以持续学习是必不可少的。在互联网上花几分钟找一下,在 Twitter、媒体、RSS 订阅、Hacker News 和其它专业网站和社区等地方,就可以从文章、案例研究、教程、代码片段、新应用程序和信息中找到大量有用的信息。 From dfe542ca54c4685394ec35fb785021e46b77e06b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 15:30:55 +0800 Subject: [PATCH 0498/4278] PRF:20181029 How I organize my knowledge as a Software Engineer.md --- ...ize my knowledge as a Software Engineer.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 translated/talk/20181029 How I organize my knowledge as a Software Engineer.md diff --git a/translated/talk/20181029 How I organize my knowledge as a Software Engineer.md b/translated/talk/20181029 How I organize my knowledge as a Software Engineer.md new file mode 100644 index 0000000000..73a46af506 --- /dev/null +++ b/translated/talk/20181029 How I organize my knowledge as a Software Engineer.md @@ -0,0 +1,111 @@ +怎样如软件工程师一样组织知识 +========== + +总体上说,软件开发和技术是以非常快的速度发展的领域,所以持续学习是必不可少的。在互联网上花几分钟找一下,在 Twitter、媒体、RSS 订阅、Hacker News 和其它专业网站和社区等地方,就可以从文章、案例研究、教程、代码片段、新应用程序和信息中找到大量有用的信息。 + +保存和组织所有这些信息可能是一项艰巨的任务。在这篇文章中,我将介绍一些我用来组织信息的工具。 + +我认为在知识管理方面非常重要的一点就是避免锁定在特定平台。我使用的所有工具都允许以标准格式(如 Markdown 和 HTML)导出数据。 + +请注意,我的流程并不完美,我一直在寻找新工具和方法来优化它。每个人都不同,所以对我有用的东西可能不适合你。 + + +### 用 NotionHQ 做知识库 + +对我来说,知识管理的基本部分是拥有某种个人知识库或维基。这是一个你可以以有组织的方式保存链接、书签、备注等的地方。 + +我使用 [NotionHQ][7] 做这件事。我使用它来记录各种主题,包括资源列表,如通过编程语言分组的优秀的库或教程,为有趣的博客文章和教程添加书签等等,不仅与软件开发有关,而且与我的个人生活有关。 + +我真正喜欢 NotionHQ 的是,创建新内容是如此简单。你可以使用 Markdown 编写它并将其组织为树状。 + +这是我的“开发”工作区的顶级页面: + +[![Image](https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png)][8] + +NotionHQ 有一些很棒的其他功能,如集成了电子表格/数据库和任务板。 + +如果您想认真使用 NotionHQ,您将需要订阅付费个人计划,因为免费计划有所限制。我觉得它物有所值。NotionHQ 允许将整个工作区导出为 Markdown 文件。导出功能存在一些重要问题,例如丢失页面层次结构,希望 Notion 团队可以改进这一点。 + +作为一个免费的替代方案,我可能会使用 [VuePress][9] 或 [GitBook][10] 来托管我自己的知识库。 + +### 用 Pocket 保存感兴趣的文章 + +[Pocket][11] 是我最喜欢的应用之一!使用 Pocket,您可以创建一个来自互联网上的文章的阅读列表。每当我看到一篇看起来很有趣的文章时,我都会使用 Chrome 扩展程序将其保存到 Pocket。稍后,我会阅读它,如果我发现它足够有用,我将使用 Pocket 的“存档”功能永久保存该文章并清理我的 Pocket 收件箱。 + +我尽量保持这个阅读清单足够小,并存档我已经处理过的信息。Pocket 允许您标记文章,以便以后更轻松地搜索特定主题的文章。 + +如果原始网站消失,您还可以在 Pocket 服务器中保存文章的副本,但是您需要 Pocket Premium 订阅计划。 + +Pocket 还具有“发现”功能,根据您保存的文章推荐类似的文章。这是找到可以阅读的新内容的好方法。 + +### 用 SnippetStore 做代码片段管理 + +从 GitHub 到 Stack Overflow 的答案,到博客文章,经常能找到一些你想要保存备用的好代码片段。它可能是一些不错的算法实现、一个有用的脚本或如何在某种语言中执行某种操作的示例。 + +我尝试了很多应用程序,从简单的 GitHub Gists 到 [Boostnote][12],直到我发现 [SnippetStore][13]。 + +SnippetStore 是一个开源的代码片段管理应用。SnippetStore 与其他产品的区别在于其简单性。您可以按语言或标签整理片段,并且可以拥有多个文件片段。它不完美,但是可以用。例如,Boostnote 具有更多功能,但我更喜欢 SnippetStore 组织内容的简单方法。 + +对于我每天使用的缩写和片段,我更喜欢使用我的编辑器 / IDE 的代码片段功能,因为它更便于使用。我使用 SnippetStore 更像是作为编码示例的参考。 + +[Cacher][14] 也是一个有趣的选择,因为它与许多编辑器进行了集成,他有一个命令行工具,并使用 Gi​​tHub Gists 作为后端,但其专业计划为 6 美元/月,我觉这有点太贵。 + +### 用 DevHints 管理速查表 + +[Devhints][15] 是由 Rico Sta. Cruz 创建的一个速查表集合。它是开源的,是用 Jekyll 生成的,Jekyll 是最受欢迎的静态站点生成器之一。 + +这些速查表是用 Markdown 编写的,带有一些额外的格式化支持,例如支持列。 + +我非常喜欢其界面的外观,并且不像可以在 [Cheatography][16] 等网站上找到 PDF 或图像格式的速查表, Markdown 非常容易添加新内容并保持更新和进行版本控制。 + +因为它是开源,我创建了自己的分叉版本,删除了一些我不需要的速查表,并添加了更多。 + +我使用速查表作为如何使用某些库或编程语言或记住一些命令的参考。速查表的单个页面非常方便,例如,可以列出特定编程语言的所有基本语法。 + +我仍在尝试这个工具,但到目前为止它的工作很好。 + +### Diigo + +[Diigo][17] 允许您注释和突出显示部分网站。我在研究新东西时使用它来注释重要信息,或者从文章、Stack Overflow 答案或来自 Twitter 的鼓舞人心的引语中保存特定段落!;) + +* * * + +就这些了。某些工具的功能方面可能存在一些重叠,但正如我在开始时所说的那样,这是一个不断演进的工作流程,因为我一直在尝试和寻找改进和提高工作效率的方法。 + +你呢?是如何组织你的知识的?请随时在下面发表评论。 + +谢谢你的阅读。 + +------------------------------------------------------------------------ + +作者简介:Bruno Paz,Web 工程师,专精 #PHP 和 @Symfony 框架。热心于新技术。喜欢运动,@FCPorto 的粉丝! + +-------------------------------------------------------------------------------- + +via: https://dev.to/brpaz/how-do-i-organize-my-knowledge-as-a-software-engineer-4387 + +作者:[Bruno Paz][a] +选题:[oska874](https://github.com/oska874) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://brunopaz.net/ +[1]:https://dev.to/brpaz +[2]:http://twitter.com/brunopaz88 +[3]:http://github.com/brpaz +[4]:https://dev.to/t/knowledge +[5]:https://dev.to/t/learning +[6]:https://dev.to/t/development +[7]:https://www.notion.so/ +[8]:https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png +[9]:https://vuepress.vuejs.org/ +[10]:https://www.gitbook.com/?t=1 +[11]:https://getpocket.com/ +[12]:https://boostnote.io/ +[13]:https://github.com/ZeroX-DG/SnippetStore +[14]:https://www.cacher.io/ +[15]:https://devhints.io/ +[16]:https://cheatography.com/ +[17]:https://www.diigo.com/index From 4b55f878b51d3c3cb05b9a8c0e84d1d3bc134af6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 15:31:29 +0800 Subject: [PATCH 0499/4278] PUB:20181029 How I organize my knowledge as a Software Engineer.md @wxy https://linux.cn/article-10425-1.html --- ...20181029 How I organize my knowledge as a Software Engineer.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20181029 How I organize my knowledge as a Software Engineer.md (100%) diff --git a/translated/talk/20181029 How I organize my knowledge as a Software Engineer.md b/published/20181029 How I organize my knowledge as a Software Engineer.md similarity index 100% rename from translated/talk/20181029 How I organize my knowledge as a Software Engineer.md rename to published/20181029 How I organize my knowledge as a Software Engineer.md From d26664d1742a96b2f114b998e9568aa5221eba5a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 18:36:30 +0800 Subject: [PATCH 0500/4278] PRF:20181219 Solve a puzzle at the Linux command line with nudoku.md @geekpi --- ...e at the Linux command line with nudoku.md | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md index a76fbbd50c..8e247e2c55 100644 --- a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md +++ b/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Solve a puzzle at the Linux command line with nudoku) @@ -9,29 +9,33 @@ 在 Linux 命令行中使用 nudoku 解决谜题 ====== -数独是简单的逻辑游戏,它可以在任何地方玩,包括在 Linux 终端中。 + +> 数独是简单的逻辑游戏,它可以在任何地方玩,包括在 Linux 终端中。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nudoku.png?itok=OS2o4Rot) -欢迎回到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们在考虑中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 +欢迎回到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问什么是命令行玩具。我们在考虑中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 -每年圣诞节,我的婆婆都会给我妻子一本数独日历。它接着会在我们的咖啡桌上呆上一年。每天都是一张单独的表格(星期六和星期日除外,它们合并在一页上),这样你每天都有一个新的谜题,同时还有一本能用的日历。 +每年圣诞节,我的岳母都会给我妻子一本数独日历。它接着会在我们的咖啡桌上呆上一年。每天都是一张单独的表格(星期六和星期日除外,它们合并在一页上),这样你每天都有一个新的谜题,同时还有一本能用的日历。 问题在于在实际中它是一本很好的谜题,但不是一本好的日历,因为事实证明有些日子的题目比其他日子更难,我们没有以每天一个的速度解决它们。然后,我们会在懒散的周日来解决这周堆积的谜题。 既然我在这个系列的一部分中介绍过[日历][1],那么在这里介绍数独也是公平的,除了我们的命令行版本是解耦的,因此将来很容易就能完成它。 -我在 Fedora 的默认仓库中找到了 **nudoku**,因此安装它就像下面这样简单: +我在 Fedora 的默认仓库中找到了 `nudoku`,因此安装它就像下面这样简单: ``` $ sudo dnf install nudoku ``` -安装完后,只需输入 **nudoku** 即可启动它,之后的操作就很明了。如果你以前从未玩过数独,它它很容易:你只需要确保每行、每列、每个 3x3 构成的方块里都包含了 1-9 的所有数字。 +安装完后,只需输入 `nudoku` 即可启动它,之后的操作就很明了。如果你以前从未玩过数独,它它很容易:你只需要确保每行、每列、每个 3x3 构成的方块里都包含了 1-9 的所有数字。 + +你可在 [Github][2] 中找到 GPLv3 许可的 `nudoku` 源码 -你可在 [Github][2] 中找到 GPLv3 许可的 **nudoku** 源码 ![](https://opensource.com/sites/default/files/uploads/linux-toy-nudoku-animated.gif) + 你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上满了,但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言,我会查看的。记得让我知道你对今天玩具的看法。 一定要看看昨天的玩具,[使用 Linux 终端庆祝丰年][3],记得明天回来! @@ -43,7 +47,7 @@ via: https://opensource.com/article/18/12/linux-toy-nudoku 作者:[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/) 荣誉推出 @@ -51,4 +55,4 @@ via: https://opensource.com/article/18/12/linux-toy-nudoku [b]: https://github.com/lujun9972 [1]: https://opensource.com/article/18/12/linux-toy-cal [2]: https://github.com/jubalh/nudoku -[3]: https://opensource.com/article/18/12/linux-toy-figlet \ No newline at end of file +[3]: https://opensource.com/article/18/12/linux-toy-figlet From d59f966ed25f67a596ef135393da248ad06c14ea Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 18:37:10 +0800 Subject: [PATCH 0501/4278] PUB:20181219 Solve a puzzle at the Linux command line with nudoku.md @geekpi https://linux.cn/article-10426-1.html --- ...19 Solve a puzzle at the Linux command line with nudoku.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181219 Solve a puzzle at the Linux command line with nudoku.md (97%) diff --git a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/published/20181219 Solve a puzzle at the Linux command line with nudoku.md similarity index 97% rename from translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md rename to published/20181219 Solve a puzzle at the Linux command line with nudoku.md index 8e247e2c55..714a6c7819 100644 --- a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md +++ b/published/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10426-1.html) [#]: subject: (Solve a puzzle at the Linux command line with nudoku) [#]: via: (https://opensource.com/article/18/12/linux-toy-nudoku) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From b84437f4932f9cc0d05d5df014ce223f6123f669 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 9 Jan 2019 08:58:25 +0800 Subject: [PATCH 0502/4278] translated --- ...nux terminal to celebrate a banner year.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md diff --git a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md new file mode 100644 index 0000000000..6b9a1d1108 --- /dev/null +++ b/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use your Linux terminal to celebrate a banner year) +[#]: via: (https://opensource.com/article/18/12/linux-toy-figlet) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +使用你的 Linux 终端庆祝新年 +====== +想让你的终端被记住么?将它打在横幅上,不要错过。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) + + +欢迎再次来到为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们也在思考,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 + +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +今天的玩具是 **figlet**,一个在 Linux 终端上以横幅形式打印文本的程序。 + +你可能会再标准仓库中找到 **figlet**。在我的 Fedora 上,这意味着安装就像下面这样简单: + +``` +$ sudo dnf install figlet +``` + +之后,只需使用程序的名称来调用它。你可以以交互方式使用它,或者将一些文本通过管道输入,如下所示: + +``` +echo "Hello world" | figlet + _ _ _ _ _ _ +| | | | ___| | | ___ __ _____ _ __| | __| | +| |_| |/ _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` | +| _ | __/ | | (_) | \ V V / (_) | | | | (_| | +|_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_| +``` + +**figlet** 有许多不同的字体。要查看可用的字体,请尝试使用命令 **showfigfonts**。在我这里显示了十几个。我在下面复制了一些我的最爱。 + +``` +block : + +_| _| _| +_|_|_| _| _|_| _|_|_| _| _| +_| _| _| _| _| _| _|_| +_| _| _| _| _| _| _| _| +_|_|_| _| _|_| _|_|_| _| _| + + +bubble : + _ _ _ _ _ _ + / \ / \ / \ / \ / \ / \ +( b | u | b | b | l | e ) + \_/ \_/ \_/ \_/ \_/ \_/ + + +lean : + + _/ + _/ _/_/ _/_/_/ _/_/_/ + _/ _/_/_/_/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ +_/ _/_/_/ _/_/_/ _/ _/ + + +script : + + o + , __ ,_ _ _|_ +/ \_/ / | | |/ \_| + \/ \___/ |_/|_/|__/ |_/ + /| + \| +``` + +你可以在项目的[主页][1]上找到有关 **figlet** 的更多信息。我下载的版本是以 MIT 许可开源的。 + +你会发现 **figlet** 不是唯一的 Linux 终端横幅打印机。另外一个你可以选择的是 [toilet][2],它有自己的一套 ASCII 艺术风格的打印选项。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上满了,但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言,我会查看的。记得让我知道你对今天玩具的看法。 + +一定要看看昨天的玩具,[使用 asciiquarium 在终端中游泳][3],记得明天回来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-figlet + +作者:[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]: http://www.figlet.org/ +[2]: http://caca.zoy.org/wiki/toilet +[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium \ No newline at end of file From 297006a8177e1be8ba957498af29901939c448e5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 9 Jan 2019 09:03:05 +0800 Subject: [PATCH 0503/4278] translating --- ...181128 Turn an old Linux desktop into a home media center.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181128 Turn an old Linux desktop into a home media center.md b/sources/tech/20181128 Turn an old Linux desktop into a home media center.md index f87750b513..eed213a42e 100644 --- a/sources/tech/20181128 Turn an old Linux desktop into a home media center.md +++ b/sources/tech/20181128 Turn an old Linux desktop into a home media center.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Turn an old Linux desktop into a home media center) From d547ea53bf24b010ac1fa16138d6426f00583969 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 9 Jan 2019 12:37:16 +0800 Subject: [PATCH 0504/4278] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=912?= =?UTF-8?q?0180614=20An=20introduction=20to=20the=20Tornado=20Python=20web?= =?UTF-8?q?=20app=20framework.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 An introduction to the Tornado Python web app framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180614 An introduction to the Tornado Python web app framework.md b/sources/tech/20180614 An introduction to the Tornado Python web app framework.md index 9c9e5c9500..74fdecb56c 100644 --- a/sources/tech/20180614 An introduction to the Tornado Python web app framework.md +++ b/sources/tech/20180614 An introduction to the Tornado Python web app framework.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (An introduction to the Tornado Python web app framework) From ce96576e612d2f6441a6599b71798cd01ee81acf Mon Sep 17 00:00:00 2001 From: belitex Date: Wed, 9 Jan 2019 15:21:07 +0800 Subject: [PATCH 0505/4278] =?UTF-8?q?=20=E7=BF=BB=E8=AF=91=E7=94=B3?= =?UTF-8?q?=E9=A2=86=EF=BC=9AGCC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...09 GCC- Optimizing Linux, the Internet, and Everything.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md b/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md index e7ac8d6c39..70405d6c70 100644 --- a/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md +++ b/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md @@ -1,3 +1,5 @@ +translating by belitex + GCC: Optimizing Linux, the Internet, and Everything ====== @@ -62,7 +64,6 @@ GCC was first released on March 22, 1987 by Richard Stallman, the founder of the There has been a lot of discussion about the licensing of GCC, most of which confuses rather than enlightens. GCC is distributed under the GNU General Public License version 3 or later with the Runtime Library Exception. This is a copyleft license, which means that derivative work can only be distributed under the same license terms. GPLv3 is intended to protect GCC from being made proprietary and requires that changes to GCC code are made available freely and openly. To the ‘end user’ the compiler is just the same as any other; using GCC makes no difference to any licensing choices you might make for your own code. [19] - -------------------------------------------------------------------------------- via: https://www.linux.com/blog/2018/10/gcc-optimizing-linux-internet-and-everything @@ -78,5 +79,5 @@ via: https://www.linux.com/blog/2018/10/gcc-optimizing-linux-internet-and-everyt [b]: https://github.com/lujun9972 [1]: https://www.openacc.org/tools [2]: /files/images/gccjpg-0 -[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/gcc_0.jpg?itok=HbGnRqWX (performance) +[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/gcc_0.jpg?itok=HbGnRqWX "performance" [4]: https://www.linux.com/licenses/category/used-permission From aa1cbdc5a60d50a23c2e70100495333c1304c04c Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 9 Jan 2019 15:58:53 +0800 Subject: [PATCH 0506/4278] Translating --- .../20180108 5 arcade-style games in your Linux repository.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180108 5 arcade-style games in your Linux repository.md b/sources/tech/20180108 5 arcade-style games in your Linux repository.md index 88c4e958d7..4e802bfbf0 100644 --- a/sources/tech/20180108 5 arcade-style games in your Linux repository.md +++ b/sources/tech/20180108 5 arcade-style games in your Linux repository.md @@ -1,3 +1,4 @@ +Scoutydren is translating. 5 arcade-style games in your Linux repository ====== From b984a7cefb8771a139c907ae65bfb82f19ef6d57 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 18:49:51 +0800 Subject: [PATCH 0507/4278] PRF:20181218 Use your Linux terminal to celebrate a banner year.md @geekpi --- ...nux terminal to celebrate a banner year.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md index 6b9a1d1108..f64124eee0 100644 --- a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md +++ b/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use your Linux terminal to celebrate a banner year) @@ -9,17 +9,18 @@ 使用你的 Linux 终端庆祝新年 ====== -想让你的终端被记住么?将它打在横幅上,不要错过。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) +> 想让你的终端被记住么?将它打在横幅上,不要错过。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) 欢迎再次来到为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们也在思考,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 -今天的玩具是 **figlet**,一个在 Linux 终端上以横幅形式打印文本的程序。 +今天的玩具是 `figlet`,一个在 Linux 终端上以横幅形式打印文本的程序。 -你可能会再标准仓库中找到 **figlet**。在我的 Fedora 上,这意味着安装就像下面这样简单: +你可能会再标准仓库中找到 `figlet`。在我的 Fedora 上,这意味着安装就像下面这样简单: ``` $ sudo dnf install figlet @@ -36,7 +37,7 @@ echo "Hello world" | figlet |_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_| ``` -**figlet** 有许多不同的字体。要查看可用的字体,请尝试使用命令 **showfigfonts**。在我这里显示了十几个。我在下面复制了一些我的最爱。 +`figlet` 有许多不同的字体。要查看可用的字体,请尝试使用命令 `showfigfonts`。在我这里显示了十几个。我在下面复制了一些我的最爱。 ``` block : @@ -74,9 +75,9 @@ script : \| ``` -你可以在项目的[主页][1]上找到有关 **figlet** 的更多信息。我下载的版本是以 MIT 许可开源的。 +你可以在项目的[主页][1]上找到有关 `figlet` 的更多信息。我下载的版本是以 MIT 许可开源的。 -你会发现 **figlet** 不是唯一的 Linux 终端横幅打印机。另外一个你可以选择的是 [toilet][2],它有自己的一套 ASCII 艺术风格的打印选项。 +你会发现 `figlet` 不是唯一的 Linux 终端横幅打印机。另外一个你可以选择的是 [toilet][2],它有一套自己的 ASCII 艺术风格的打印选项。 你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上满了,但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言,我会查看的。记得让我知道你对今天玩具的看法。 @@ -89,7 +90,7 @@ via: https://opensource.com/article/18/12/linux-toy-figlet 作者:[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/) 荣誉推出 @@ -97,4 +98,4 @@ via: https://opensource.com/article/18/12/linux-toy-figlet [b]: https://github.com/lujun9972 [1]: http://www.figlet.org/ [2]: http://caca.zoy.org/wiki/toilet -[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium \ No newline at end of file +[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium From 3b6bf63b54e5f8c6b5f637058a0cd2f929dfa007 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 18:50:24 +0800 Subject: [PATCH 0508/4278] PUB:20181218 Use your Linux terminal to celebrate a banner year.md @geekpi https://linux.cn/article-10428-1.html --- ...1218 Use your Linux terminal to celebrate a banner year.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181218 Use your Linux terminal to celebrate a banner year.md (98%) diff --git a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/published/20181218 Use your Linux terminal to celebrate a banner year.md similarity index 98% rename from translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md rename to published/20181218 Use your Linux terminal to celebrate a banner year.md index f64124eee0..035577a5ef 100644 --- a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md +++ b/published/20181218 Use your Linux terminal to celebrate a banner year.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10428-1.html) [#]: subject: (Use your Linux terminal to celebrate a banner year) [#]: via: (https://opensource.com/article/18/12/linux-toy-figlet) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From c26388f4f07ec1aa92515234626fef50d5406bbd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 22:04:36 +0800 Subject: [PATCH 0509/4278] PRF:20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @qhwdw --- ...y - Raspberry Pi- Lesson 0 Introduction.md | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index 8f4f6a4bcc..e5754cdc89 100644 --- a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -1,40 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 – 树莓派:课程 0:简介 +计算机实验室 – 树莓派:课程 0 简介 ====== 这个课程简介不包含实践内容,但它解释了一个操作系统的基本概念、汇编代码、和其它很重要的一些基本原理。如果你想直接进入实践环节,跳过本课程并不会有什么问题。 ### 1、操作系统 -一个操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话,也需要操作系统,它可能使用的操作系统是 Android、iOS 和 [Windows Phone][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note1] +操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话,也需要操作系统,它可能使用的操作系统是 Android、iOS 和 [Windows Phone](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note1)。 -由于操作系统是用来与计算机系统上的硬件进行交互的,所以它必须有系统上硬件专有的内容。为了能让操作系统适用于各种类型的计算机,发明了 **驱动程序** 的概念。驱动程序是为了能够让操作系统与特定的硬件进行交互而添加(并可删除)到操作系统上的一小部分代码。在本课程中,我们并不涉及如何创建可删除的驱动程序,而是专注于特定的一个硬件:树莓派。 +由于操作系统是用来与计算机系统上的硬件进行交互的,所以它必须了解系统上硬件专有的信息。为了能让操作系统适用于各种类型的计算机,发明了 **驱动程序** 的概念。驱动程序是为了能够让操作系统与特定的硬件进行交互而添加(并可删除)到操作系统上的一小部分代码。在本课程中,我们并不涉及如何创建可删除的驱动程序,而是专注于特定的一个硬件:树莓派。 操作系统有各种不同的设计方式,在本课程中,我们只触及操作系统设计的皮毛。本课程中,我们主要专注于操作系统与各种硬件的交互部分,因为这经常是比较棘手的部分,并且也是在网络上文档和帮助最少的部分。 ### 2、汇编代码 -``` -一个处理器每秒可以执行上百万的指令,但是这些指令必须要简单。 -``` +> 处理器每秒可以执行上百万的指令,但是这些指令必须要简单。 -本课程几乎要完全靠汇编代码来写。汇编代码非常接近计算机的底层。计算机其实是靠一个叫处理器的设备来工作的,处理器能够执行像加法这样的简单任务,还有一组叫做 **RAM** 的芯片,它能够用来保存数字。当计算机通电后,处理器执行程序员给定的一系列指令,这将导致内存中的数字发生变化,以及与连接的硬件进行交互。汇编代码只是将这些机器命令转换为人类可读的文本。 +本课程几乎要完全靠汇编代码来写。汇编代码非常接近计算机的底层。计算机其实是靠一个叫处理器的设备来工作的,处理器能够执行像加法这样的简单任务,还有一组叫做 RAM 的芯片,它能够用来保存数字。当计算机通电后,处理器执行程序员给定的一系列指令,这将导致内存中的数字发生变化,以及与连接的硬件进行交互。汇编代码只是将这些机器命令转换为人类可读的文本。 -常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic、等等来写代码,然后一个叫编译器的程序将程序员写的代码转换成汇编代码,然后进一步转换为[二进制代码][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note2]。二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。 +常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic 等等来写代码,然后一个叫编译器的程序将程序员写的代码转换成汇编代码,然后进一步转换为[二进制代码](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note2)。二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。 ![Compiler process][1] 和普通编程一样,也有很多不同的汇编代码编程语言,但与普通编程不一样的是,每个汇编编程语言是面对不同的处理器的,每种处理器设计为去理解不同的语言。因此,用一个针对某种机器设计的汇编语言所写的汇编代码,是不能在其它种类的机器上运行的。很多情况下,这都是一个大灾难,因此每个程序都必须在使用它的不同种类的机器上重写一遍,但对于操作系统,这不是个问题,因为在不同的硬件上它必须得重写。尽管如此,大多数操作系统都是用 C++ 或 C 来写的,这样它们就可以很容易地在不同种类的硬件上使用,只需要重写那些必须用汇编代码来实现的部分即可。 -现在,你已经准备好进入第一节课了,它是 [课程 1:OK01][2] +现在,你已经准备好进入第一节课了,它是 [课程 1 OK01][2] -------------------------------------------------------------------------------- @@ -43,7 +41,7 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.htm 作者:[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/) 荣誉推出 From 23f4104d1a40de6f308824ec3f7ffbdf628a336b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 22:05:11 +0800 Subject: [PATCH 0510/4278] PUB:20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @qhwdw https://linux.cn/article-10429-1.html --- ...mputer Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md (98%) diff --git a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md similarity index 98% rename from translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md rename to published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index e5754cdc89..0e108b4f15 100644 --- a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10429-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From 1779c949dd1418b4673f108fd1029af94b13fbc7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 22:54:14 +0800 Subject: [PATCH 0511/4278] PRF:20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md --- ...Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index 0e108b4f15..a9442dc04c 100644 --- a/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -7,7 +7,7 @@ [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 – 树莓派:课程 0 简介 +计算机实验室之树莓派:课程 0 简介 ====== 这个课程简介不包含实践内容,但它解释了一个操作系统的基本概念、汇编代码、和其它很重要的一些基本原理。如果你想直接进入实践环节,跳过本课程并不会有什么问题。 From e9168c8a9c990848284f82760268910607917987 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Wed, 9 Jan 2019 23:24:18 +0800 Subject: [PATCH 0512/4278] translated --- ...Programs Installed From Source In Linux.md | 200 ------------------ ...Programs Installed From Source In Linux.md | 200 ++++++++++++++++++ 2 files changed, 200 insertions(+), 200 deletions(-) delete mode 100644 sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md create mode 100644 translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md diff --git a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md deleted file mode 100644 index 1d3f35beaf..0000000000 --- a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md +++ /dev/null @@ -1,200 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( dianbanjiu ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) -[#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -An Easy Way To Remove Programs Installed From Source In Linux -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/stow-1-720x340.jpg) - -Not all programs available in the official or third-party repositories, so you can’t install them using the regular package managers. Some times, you have to install the programs by manually compiling from source. As you may already know, when you install programs from source, the package files will be copied to multiple locations, such as **/usr/local/bin** , **/usr/local/etc/** , on the filesystem. If the installed program from source doesn’t have a built-in uninstaller, it is going to be a tedious task to remove the packages when you don’t need it anymore. You may need to spend couple (or several) minutes to find those package files and remove them manually. This is what I have been doing up until I stumbled upon a utility named **“GNU Stow”**. Thankfully, Stow has a fantastic way to easily manage programs installed from source. - -To quote the official website, - -> **GNU Stow is a symlink farm manager which takes distinct packages of software and/or data located in separate directories on the filesystem, and makes them appear to be installed in the same place.** - -To put this simply, Stow helps you to keep the package files organized in a way to easily manageable. In this method, the files will not be copied to multiple locations. Instead, all files are saved in a specific folder, usually under the program name itself, and Stow creates symbolic links to all the programs’ files into the appropriate places. For example, **/usr/local/bin** could contain symlinks to files within **/usr/local/stow/vim/bin** , **/usr/local/stow/python/bin** etc., and likewise recursively for any other subdirectories such as **…/share** , **…/man** , and so on. In this tutorial, I will show you how to easily manage programs installed from source using Stow with a practical example. Read on. - -### Installing GNU Stow - -GNU Stow is available in the default repositories of popular Linux operating systems. - -On **Arch Linux** and its variants, run the following command to install Stow. - -``` -$ sudo pacman -S stow -``` - -On **Debian** , **Ubuntu** , **Linux Mint** : - -``` -$ sudo apt install stow -``` - -On **Fedora** : - -``` -$ sudo dnf install stow -``` - -On **RHEL/CentOS** : - -``` -$ sudo yum install epel-release - -$ sudo yum install stow -``` - -### Easily Remove Programs Installed From Source In Linux - -As I already mentioned earlier, all program files of a package will be saved in a root folder located in **/usr/local/stow/**. Under this root or parent directory, each package will be saved in its own private sub-directory. For example, if we install Vim editor from source, all program files and directories related to Vim will be saved under **/usr/local/stow/vim** folder. If you install python from source, all files related to python will be kept under **/usr/local/stow/python** and so on. - -Let me install a program, for example **hello** , from source. - -First download the ‘hello’ program’s tarball. - -``` -$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz -``` - -Extract the downloaded tarball using command: - -``` -$ tar -zxvf hello-2.10.tar.gz -``` - -The above command will create a directory named ‘hello-2.10’ in the current working directory and extract all contents in it. - -Switch to the extracted directory: - -``` -$ cd hello-2.10/ -``` - -Run the following command with –prefix option. - -``` -$ ./configure --prefix=/usr/local/stow/hello -``` - -The above command will save the build files in the specified location i.e **/usr/local/stow/hello** in our case. - -Finally, build and install the hello program using the following commands: - -``` -$ make - -$ sudo make install -``` - -That’s it. The hello program has been installed in **/usr/local/stow/hello/** location. You can verify it with ‘ls’ command as shown below. - -``` -$ ls /usr/local/stow/hello/ -bin share -``` - -Finally, go to the **/usr/local/stow/** directory and run the following command to generate the necessary symlinks. - -``` -$ cd /usr/local/stow/ - -$ sudo stow hello -``` - -All done! - -What just happened is all the files and directories contained in the hello package have been symlinked to the directory **/usr/local/**. In other words, **/usr/local/stow/hello/bin** has been symlinked to **/usr/local/bin** and **/usr/local/stow/hello/share** has been symlinked to **/usr/local/share** and **/usr/local/stow/hello/share/man** has been symlinked to **/usr/local/share/man** and so on. - -You can verify them using ‘ls’ command: - -``` -$ ls /usr/local/bin/ -hello -``` - -Let us check if the hello program is working or not using command: - -``` -$ hello -Hello, world! -``` - -Yeah, it is working!! - -Similarly, you can install programs as described above under its own sub-directory. - -Here is the contents of the Stow root directory: - -``` -$ tree /usr/local/stow/ -``` - -![][2] - -See? The hello program is installed /usr/local/stow/hello/ location. Like wise, all packages will be kept under their own directory. - -Here comes the main part. Let us remove the hello program. To do so, go to **/usr/local/stow/** directory: - -``` -$ cd /usr/local/stow/ -``` - -..and run the following command: - -``` -$ sudo stow --delete hello -``` - -The hello program has just been removed. You can verify if it is really removed using command: - -``` -$ hello --bash: /usr/local/bin/hello: No such file or directory -``` - -![][3] - -See? Hello program is removed! - -Please note that Stow has removed the symlinks only. All program files and directories related to hello program are still available in **/usr/local/stow/hello** folder. So, you can install the hello program again without having to download the actual source file. If you don’t want it anymore, simply delete the folder. - -``` -$ sudo rm -fr /usr/local/stow/hello/ -``` - -To know more details about Stow, refer the man pages. - -``` -$ man stow -``` - - -Stow helps you to uninstall the programs as easily as you install them. If you are wondering how to effectively manage a lot of programs installed from source, GNU Stow is one such program to make this task a lot easier. Give it a try, you won’t be disappointed. - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-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/2018/12/tree-command.png -[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/hello-world.png diff --git a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md new file mode 100644 index 0000000000..f33ff7af14 --- /dev/null +++ b/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( dianbanjiu ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) +[#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +在 Linux 中移除从源中安装的程序的一种简单的方法 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/stow-1-720x340.jpg) + +不是所有的程序都可以在官方或者第三方库中可用,因此你不能使用常规的包管理来安装它们。有时你不得不从源代码中手动构建这些程序。就跟你已经知道的一样,当你从源代码中安装一个程序的时候,这个包文件将会复制到本地的多个位置,例如 **/usr/local/bin**,**/usr/local/etc/**。如果从源代码中安装的程序没有内建的卸载器,当你不再需要这个程序的时候,卸载它就会很麻烦。你可能会话费双倍(甚至更多)的时间找出这些包文件然后手动删除它们。我以前一直是这样做的,直到我发现了 **GNU Stow**。谢天谢地,Stow 有一个很棒的方法可以轻松管理从源代码安装的程序。 + + +引用官方网站里的一段介绍, + +> **GNU Stow 是一个符号链接管理器,它可以收集文件系统上不同目录中的不同软件和/或数据包,使它们看起来像是一个整体** + +简单来说,Stow 帮助你把这些程序文件以一种容易管理的方式组织在了一起。在这个方法中,文件将不会被复制到多个位置。所有的这些文件都会被保存在一个特定的文件夹中,通常是以程序名命名的,然后 Stow 会在一个合适的位置为所有的程序文件创建符号连接。比如 **/usr/local/bin** 中会包含 **/usr/local/stow/vim/bin**,**/usr/local/stow/python/bin** 中文件的符号链接。并且同样递归地用于其他的任何的子目录,例如 **.../share**,**.../man**,等等。在这篇教程中,我将会举例教你如何轻松地使用 Stow 管理从源中安装的程序。 + +### 安装 GNU Stow + +GNU Stow 在流行 Linux 操作系统的默认库中都可用。 + +在 **Arch Linux** 及它的衍生版本中,运行下面的命令安装 Stow。 + +``` +$ sudo pacman -S stow +``` + +在 **Debian**,**Ubuntu**,**Linux Mint** 上: + +``` +$ sudo apt install stow +``` + +在 **Fedora** 上: + +``` +$ sudo dnf install stow +``` +在 **RHEL/CentOS** 上: + +``` +$ sudo yum install epel-release + +$ sudo yum install stow +``` + +### 在 Linux 上轻松移除从源代码安装的程序 + +就像我之前提到的,所有包的程序文件都将被保存在位于 **/usr/local/stow/** 的一个根文件夹。在这个根文件夹或者父目录之下,每个包都将保存在对应的子目录中。例如,如果我们从源代码中安装了 Vim 编辑器,所有关联到 Vim 的程序文件和目录都将保存在 **/usr/local/stow/vim** 文件夹之下。如果你从源代码中安装了 Python,所有关联到 python 的文件都会保存在 **/usr/local/stow/python** 之下。 + +我现在从源代码中来安装一个叫做 **hello** 的程序。 + +首先下载 ‘hello’ 程序的压缩包。 + +``` +$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz +``` + +使用下面的命令解压压缩包: + +``` +$ tar -zxvf hello-2.10.tar.gz +``` + +上面的命令将会在当前工作目录下创建一个叫做 ‘hello-2.10’ 的目录,并且提取压缩包中的所有内容到其中去。 + +切换到这个目录当中: + +``` +$ cd hello-2.10/ +``` + +运行下面的命令,并且添加 -prefix 选项。 + +``` +$ ./configure --prefix=/usr/local/stow/hello +``` + +上面的命令将会保存构建文件到一个指定位置,在这个例子中是 **/usr/local/stow/hello**。 + +最后,使用下面的命令构建并安装 hello 这个程序: + +``` +$ make + +$ sudo make install +``` + +就这样。hello 这个程序就已经安装在 **/usr/local/stow/hello/** 这个位置了。你可以使用下面的 ‘ls’ 命令确认一下。 + +``` +$ ls /usr/local/stow/hello/ +bin share +``` + +最后,进入 **/usr/local/stow/** 目录,运行下面的命令来生成必要的符号链接。 + +``` +$ cd /usr/local/stow/ + +$ sudo stow hello +``` + +大功告成! + +刚才那一步是将包含在 hello 这个程序中的所有文件或者目录创建了链接到 **/usr/local/** 目录中。换一种说法, **/usr/local/stow/hello/bin** 已经链接到 **/usr/local/share**,以及 **/usr/local/stow/hello/share/man** 已经链接到 **/usr/local/share**,还有 **/usr/local/stow/hello/share/man** 已经链接到 **/usr/local/share/man**。 + +你可以使用 ‘ls’ 命令来确认一下: + +``` +$ ls /usr/local/bin/ +hello +``` + +可以使用下面的命令来确认 hello 这个程序是否可以正常工作了: + +``` +$ hello +Hello, world! +``` + +很好,它已经开始工作了!! + +类似地,你可以像上面描述的那样安装程序到它对应的子目录下。 + +下面是 Stow 根目录包含的内容: + +``` +$ tree /usr/local/stow/ +``` + +![][2] + +看,hello 这个程序已经安装在 /usr/local/stow/hello/ 下。同样地,所有的包都将保存在它们对应的目录之下。 + +下面进入主要环节,移除 hello 这个程序。首先进入 **/usr/local/stow/** 目录: + +``` +$ cd /usr/local/stow/ +``` + +.. 然后运行下面的命令: + +``` +$ sudo stow --delete hello +``` + +hello 这个程序就会被移除了。你可以使用下面的命令确认它是否真的被移除了: + +``` +$ hello +-bash: /usr/local/bin/hello: No such file or directory +``` + +![][3] + +看, Hello 已经被移除了! + +请注意 Stow 仅仅只移除了符号链接。所有与 hello 这个程序相关的文件或者目录还保存在 **/usr/local/stow/hello** 目录下。所以你无需再次下载源文件就可以再次安装 hello 这个程序。如果你不再需要它了,直接删除这个文件夹即可。 + +``` +$ sudo rm -fr /usr/local/stow/hello/ +``` + +想了解更多 Stow 的细节,请参阅 man 手册。 + +``` +$ man stow +``` + + +Stow 可以像安装程序一样轻松地帮你移除它。如果你想知道如何高效的管理很多从源代码中安装的程序,GNU Stow 就是一个使得这个任务更加轻松的一个选择,尝试一下,你一定不会失望的。 + +这就是所有的内容了,希望对你有所帮助。还有更多干活即将到来,可以期待一下的! + +祝近祺! + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-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/2018/12/tree-command.png +[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/hello-world.png From 49da1fe38c0b3a7eb302a51bc6edca24bfc0bbd2 Mon Sep 17 00:00:00 2001 From: runningwater Date: Thu, 10 Jan 2019 00:44:16 +0800 Subject: [PATCH 0513/4278] =?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 --- .../20170921 The Rise and Rise of JSON.md | 102 ------------------ .../20170921 The Rise and Rise of JSON.md | 102 ++++++++++++++++++ 2 files changed, 102 insertions(+), 102 deletions(-) delete mode 100644 sources/talk/20170921 The Rise and Rise of JSON.md create mode 100644 translated/talk/20170921 The Rise and Rise of JSON.md diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md deleted file mode 100644 index f6d54edfc9..0000000000 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (runningwater) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (The Rise and Rise of JSON) -[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) -[#]: author: (https://twobithistory.org) -[#]: url: ( ) - -The Rise and Rise of JSON -====== -JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format. - -![][1] - -XML still survives in many places. It is used across the web for SVGs and for RSS and Atom feeds. When Android developers want to declare that their app requires a permission from the user, they do so in their app’s manifest, which is written in XML. XML also isn’t the only alternative to JSON—some people now use technologies like YAML or Google’s Protocol Buffers. But these are nowhere near as popular as JSON. For the time being, JSON appears to be the go-to format for communicating with other programs over the internet. - -JSON’s dominance is surprising when you consider that as recently as 2005 the web world was salivating over the potential of “Asynchronous JavaScript and XML” and not “Asynchronous JavaScript and JSON.” It is of course possible that this had nothing to do with the relative popularity of the two formats at the time and reflects only that “AJAX” must have seemed a more appealing acronym than “AJAJ.” But even if some people were already using JSON instead of XML in 2005 (and in fact not many people were yet), one still wonders how XML’s fortunes could have declined so precipitously that a mere decade or so later “Asynchronous JavaScript and XML” has become an ironic misnomer. What happened in that decade? How did JSON supersede XML in so many applications? And who came up with this data format now depended on by engineers and systems all over the world? - -### The Birth of JSON - -The first JSON message was sent in April of 2001. Since this was a historically significant moment in computing, the message was sent from a computer in a Bay-Area garage. Douglas Crockford and Chip Morningstar, co-founders of a technology consulting company called State Software, had gathered in Morningstar’s garage to test out an idea. - -Crockford and Morningstar were trying to build AJAX applications well before the term “AJAX” had been coined. Browser support for what they were attempting was not good. They wanted to pass data to their application after the initial page load, but they had not found a way to do this that would work across all the browsers they were targeting. - -Though it’s hard to believe today, Internet Explorer represented the bleeding edge of web browsing in 2001. As early as 1999, Internet Explorer 5 supported a primordial form of XMLHttpRequest, which programmers could access using a framework called ActiveX. Crockford and Morningstar could have used this technology to fetch data for their application, but they could not have used the same solution in Netscape 4, another browser that they sought to support. So Crockford and Morningstar had to use a different system that worked in both browsers. - -The first JSON message looked like this: - -``` - -``` - -Only a small part of the message resembles JSON as we know it today. The message itself is actually an HTML document containing some JavaScript. The part that resembles JSON is just a JavaScript object literal being passed to a function called `receive()`. - -Crockford and Morningstar had decided that they could abuse an HTML frame to send themselves data. They could point a frame at a URL that would return an HTML document like the one above. When the HTML was received, the JavaScript would be run, passing the object literal back to the application. This worked as long as you were careful to sidestep browser protections preventing a sub-window from accessing its parent; you can see that Crockford and Mornginstar did that by explicitly setting the document domain. (This frame-based technique, sometimes called the hidden frame technique, was commonly used in the late 90s before the widespread implementation of XMLHttpRequest.) - -The amazing thing about the first JSON message is that it’s not obviously the first usage of a new kind of data format at all. It’s just JavaScript! In fact the idea of using JavaScript this way is so straightforward that Crockford himself has said that he wasn’t the first person to do it—he claims that somebody at Netscape was using JavaScript array literals to communicate information as early as 1996. Since the message is just JavaScript, it doesn’t require any kind of special parsing. The JavaScript interpreter can do it all. - -The first ever JSON message actually ran afoul of the JavaScript interpreter. JavaScript reserves an enormous number of words—there are 64 reserved words as of ECMAScript 6—and Crockford and Morningstar had unwittingly used one in their message. They had used `do` as a key, but `do` is reserved. Since JavaScript has so many reserved words, Crockford decided that, rather than avoid using all those reserved words, he would just mandate that all JSON keys be quoted. A quoted key would be treated as a string by the JavaScript interpreter, meaning that reserved words could be used safely. This is why JSON keys are quoted to this day. - -Crockford and Morningstar realized they had something that could be used in all sorts of applications. They wanted to name their format “JSML”, for JavaScript Markup Language, but found that the acronym was already being used for something called Java Speech Markup Language. So they decided to go with “JavaScript Object Notation”, or JSON. They began pitching it to clients but soon found that clients were unwilling to take a chance on an unknown technology that lacked an official specification. So Crockford decided he would write one. - -In 2002, Crockford bought the domain [JSON.org][2] and put up the JSON grammar and an example implementation of a parser. The website is still up, though it now includes a prominent link to the JSON ECMA standard ratified in 2013. After putting up the website, Crockford did little more to promote JSON, but soon found that lots of people were submitting JSON parser implementations in all sorts of different programming languages. JSON’s lineage clearly tied it to JavaScript, but it became apparent that JSON was well-suited to data interchange between arbitrary pairs of languages. - -### Doing AJAX Wrong - -JSON got a big boost in 2005. That year, a web designer and developer named Jesse James Garrett coined the term “AJAX” in a blog post. He was careful to stress that AJAX wasn’t any one new technology, but rather “several technologies, each flourishing in its own right, coming together in powerful new ways.” AJAX was the name that Garrett was giving to a new approach to web application development that he had noticed gaining favor. His blog post went on to describe how developers could leverage JavaScript and XMLHttpRequest to build new kinds of applications that were more responsive and stateful than the typical web page. He pointed to Gmail and Flickr as examples of websites already relying on AJAX techniques. - -The “X” in “AJAX” stood for XML, of course. But in a follow-up Q&A post, Garrett pointed to JSON as an entirely acceptable alternative to XML. He wrote that “XML is the most fully-developed means of getting data in and out of an AJAX client, but there’s no reason you couldn’t accomplish the same effects using a technology like JavaScript Object Notation or any similar means of structuring data.” - -Developers indeed found that they could easily use JSON to build AJAX applications and many came to prefer it to XML. And so, ironically, the interest in AJAX led to an explosion in JSON’s popularity. It was around this time that JSON drew the attention of the blogosphere. - -In 2006, Dave Winer, a prolific blogger and the engineer behind a number of XML-based technologies such as RSS and XML-RPC, complained that JSON was reinventing XML for no good reason. Though one might think that a contest between data interchange formats would be unlikely to engender death threats, Winer wrote: - -> No doubt I can write a routine to parse [JSON], but look at how deep they went to re-invent, XML itself wasn’t good enough for them, for some reason (I’d love to hear the reason). Who did this travesty? Let’s find a tree and string them up. Now. - -It’s easy to understand Winer’s frustration. XML has never been widely loved. Even Winer has said that he does not love XML. But XML was designed to be a system that could be used by everyone for almost anything imaginable. To that end, XML is actually a meta-language that allows you to define domain-specific languages for individual applications—RSS, the web feed technology, and SOAP (Simple Object Access Protocol) are examples. Winer felt that it was important to work toward consensus because of all the benefits a common interchange format could bring. He felt that XML’s flexibility should be able to accommodate everybody’s needs. And yet here was JSON, a format offering no benefits over XML except those enabled by throwing out the cruft that made XML so flexible. - -Crockford saw Winer’s blog post and left a comment on it. In response to the charge that JSON was reinventing XML, Crockford wrote, “The good thing about reinventing the wheel is that you can get a round one.” - -### JSON vs XML - -By 2014, JSON had been officially specified by both an ECMA standard and an RFC. It had its own MIME type. JSON had made it to the big leagues. - -Why did JSON become so much more popular than XML? - -On [JSON.org][2], Crockford summarizes some of JSON’s advantages over XML. He writes that JSON is easier for both humans and machines to understand, since its syntax is minimal and its structure is predictable. Other bloggers have focused on XML’s verbosity and “the angle bracket tax.” Each opening tag in XML must be matched with a closing tag, meaning that an XML document contains a lot of redundant information. This can make an XML document much larger than an equivalent JSON document when uncompressed, but, perhaps more importantly, it also makes an XML document harder to read. - -Crockford has also claimed that another enormous advantage for JSON is that JSON was designed as a data interchange format. It was meant to carry structured information between programs from the very beginning. XML, though it has been used for the same purpose, was originally designed as a document markup language. It evolved from SGML (Standard Generalized Markup Language), which in turn evolved from a markup language called Scribe, intended as a word processing system similar to LaTeX. In XML, a tag can contain what is called “mixed content,” or text with inline tags surrounding words or phrases. This recalls the image of an editor marking up a manuscript with a red or blue pen, which is arguably the central metaphor of a markup language. JSON, on the other hand, does not support a clear analogue to mixed content, but that means that its structure can be simpler. A document is best modeled as a tree, but by throwing out the document idea Crockford could limit JSON to dictionaries and arrays, the basic and familiar elements all programmers use to build their programs. - -Finally, my own hunch is that people disliked XML because it was confusing, and it was confusing because it seemed to come in so many different flavors. At first blush, it’s not obvious where the line is between XML proper and its sub-languages like RSS, ATOM, SOAP, or SVG. The first lines of a typical XML document establish the XML version and then the particular sub-language the XML document should conform to. That is a lot of variation to account for already, especially when compared to JSON, which is so straightforward that no new version of the JSON specification is ever expected to be written. The designers of XML, in their attempt to make XML the one data interchange format to rule them all, fell victim to that classic programmer’s pitfall: over-engineering. XML was so generalized that it was hard to use for something simple. - -In 2000, a campaign was launched to get HTML to conform to the XML standard. A specification was published for XML-compliant HTML, thereafter known as XHTML. Some browser vendors immediately started supporting the new standard, but it quickly became obvious that the vast HTML-producing public were unwilling to revise their habits. The new standard called for stricter validation of XHTML than had been the norm for HTML, but too many websites depended on HTML’s forgiving rules. By 2009, an attempt to write a second version of the XHTML standard was aborted when it became clear that the future of HTML was going to be HTML5, a standard that did not insist on XML compliance. - -If the XHTML effort had succeeded, then maybe XML would have become the common data format that its designers hoped it would be. Imagine a world in which HTML documents and API responses had the exact same structure. In such a world, JSON might not have become as ubiquitous as it is today. But I read the failure of XHTML as a kind of moral defeat for the XML camp. If XML wasn’t the best tool for HTML, then maybe there were better tools out there for other applications also. In that world, our world, it is easy to see how a format as simple and narrowly tailored as JSON could find great success. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][3] on Twitter or subscribe to the [RSS feed][4] to make sure you know when a new post is out. - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://twobithistory.org/images/json.svg -[2]: http://JSON.org -[3]: https://twitter.com/TwoBitHistory -[4]: https://twobithistory.org/feed.xml diff --git a/translated/talk/20170921 The Rise and Rise of JSON.md b/translated/talk/20170921 The Rise and Rise of JSON.md new file mode 100644 index 0000000000..e5eb3b2dd6 --- /dev/null +++ b/translated/talk/20170921 The Rise and Rise of JSON.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (runningwater) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (The Rise and Rise of JSON) +[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) +[#]: author: (https://twobithistory.org) +[#]: url: ( ) + +JSON 的兴起与崛起 +====== +JSON 已经占领了全世界。当今,任何两个应用程序彼此通过网络通信时,它们很有可能在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口(主要由 Google、Facebook 和 Twitter 提供的)列表中,仅仅只有一个 API 接口是以 XML 的格式开放数据的。Twitter 给这个 API 添加了一个说明性示例:XML 格式的支持到 2013 年结束,到时候会发布一个新版本的 API,取消 XML 格式,转而使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。 + +![][1] + +XML 仍然在很多地方存在。在网页上有 SVG 和 RSS 订阅服务、Atom 提供商。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明。此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 +考虑到自 2005 年来网站编程世界对 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 技术潜力的垂涎欲滴状态,你可以发现 JSON 在其中的主导地位是如此让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,仅反映出 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2015 年时有好些人已经用 JSON 来取代 XML 了(实际上还没有很多人),我们不禁要问 XML 的噩运来的如此之快,以至于短短十年左右,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那个十年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? + +### JSON 之诞生 + +2001 年 4 月,首个 JSON 格式的消息被发送。此消息是从旧金山湾区某车库的一台计算机发出的,这是计算机历史上重要的的时刻。Douglas Crockford 和 Chip Morningstar 是一家名为 State Software 的技术咨询公司的联合创始人,他们当时聚集在 Morningstar 的车库里测试某个想法,发出了此消息。 + +在 “AJAX” 这个术语被创造之前, Crockford 和 Morningstar 就已经在尝试构建好用的 AJAX 应用程序了。可是浏览器对其兼容性不好。他们想要在初始页面加载后就将数据传递给应用程序,但其目标要针对所有的浏览器,这就实现不了。 + +这在今天看来不太可信,但是要记得 2001 年的时候 Internet Explorer(IE)代表了网页浏览器的最前沿技术产品。早在 1999 年的时候,Internet Explorer 5 就支持 `XMLHttpRequest 对象原型`,开发者可以使用名为 ActiveX 的框架来访问此对象。 Crockford 和 Morningstar 可能是使用此技术来获取数据,但是在 Netscape 4 中(这是他们想要支持的另一种浏览器)就无法使用这种解决方案。为此 Crockford 和 Morningstar 只得开发不同的系统程序以兼容不同的浏览器。 + +第一条 JSON 消息如下所示: + +``` + +``` + +消息中只有一小部分类似于今天我们所知的 JSON,本身其实是一个包含有 JavaScript 的 HTML 文档。类似于 JSON 的部分只是传递给名为`receive()` 的函数的 JavaScript 对象。 + +Crockford 和 Morningstar 决定滥用 HTML 的 frame,以发送数据。敲入 URL 返回的 HTML 文档(如上所示)可以指向一个 frame 标签。当接收到 HTML 时,JavaScript 代码段一运行,就可以把数据对象如实地传递回应用程序。只要小心的回避浏览器保护策略,即子窗口不允许访问父窗口,这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于 frame 的技术,有时称为隐藏 frame 技术,通常在90年代后期,即广泛使用 XMLHttpRequest 技术之前使用。) + +关于第一个 JSON 消息的惊人之处在于它显然不是第一次就使用新的数据格式。它仅仅是 JavaScript!实际上,以此使用 JavaScript 的想法如此简单,Crockford 自己也说过他不是第一个这样做的人。他声称 Netscape 公司的某人早在 1996 年就使用 JavaScript 数组文字来交换信息。因为消息就是 JavaScript 本身,其不需要任何特殊解析工作,JavaScript 解释器就可搞定一切。 + +最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 使用了大量的单词来做为保留字(ECMAScript 6 版本的就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中引入了一个保留字。他们使用了 `do` 这个关键字,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 关键字都加上引号。被引起来的关键字会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 关键字都要用引号引起来的原因。 + +Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言,但发现这个缩写已经被叫做 Java 标记语言的所使用了。因此他们决定采用 “JavaScript Object Notation” 或 JSON 命名。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 + +2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统明显与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 + + +### AJAX 导致的误会 + +2005 年,JSON 有了一次大扩展。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发人员在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种技术以某种强大的新方式汇集,其中的各技术各自发展。” AJAX 是 Garrett 给 Web 应用程序开发的新方法(其正获得青睐)的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 对象构建新的应用程序,这些应用程序比传统的网页更具响应性和状态性。 他还举了 Gmail 和 Flickr的网站已经使用 AJAX 技术的例子。 + +当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:虽然 XML 是 AJAX 客户端进行数据输入输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation (JSON)或任何类似的结构数据方法等技术。 + +开发者确实发现在构建 AJAX 应用程序时可以很容易的使用 JSON,并且很多人也开始喜欢上 XML。具有讽刺意味的是,对 AJAX 的兴趣逐渐的导致了 JSON 的普及。大约在这个时候,JSON 引起了博客圈的注意。 + +2006 年,Dave Winer,一位高产的博主,也是许多基于 XML 技术(如 RSS 和 XML-RPC)的后端开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。虽然他认为数据交换格式之间的竞争不会导致某一技术的消亡,其写到: + +> 让我们来比较下重构某结构数据的深度及难度,由于某些原因(我很想听听原因),XML 自身做的并不好,所以毫无疑问地,我会写一个例程来解析 JSON 格式的数据。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。 + +很容易理解 Winer 的挫败感,事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。但 XML 已被设计成一个可供任何人使用,并且几乎能想象到的事情都可以做到的系统。最终,XML 实际上是一门元语言,允许你为特定应用程序自定义特定域的语言。如 RSS、web feed 技术和 SOAP(简单对象访问协议)就是自定义的例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识就很重要了。XML 的灵活性应该能满足任何人的需求,然而这里是 JSON 格式,其并不比 XML 更具优势,但其抛弃了 XML 中不好的设计,可以使 XML 更加的灵活。 + +Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 重新发明 XML 的指责,Crockford 写到:重造轮子的好处是可以得到一个更好的轮子。 + +### JSON 与 XML 对比 + +到 2014 年,JSON 已经由 ECMA 标准和 RFC 官方正式认可。它有自己的 MIME 类型。JSON 已经进入了大联盟时代。 + +为什么 JSON 比 XML 更受欢迎? + +在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法很小,其结构可预测,因此 JSON 更容易被人类和机器理解。其他博主不得不关注 XML 的冗长啰嗦及“尖括号负担”。XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 + +Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它从 SGML(通用标准标记语言)演变而来,后来又从称为 Scribe 的标记语言是发展,旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”或包含有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型清晰构建,但也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本也最熟悉的元素。 + +最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。通用 XML 文档创建的版本做为第一个基线,然后特定的子语言 XML 版本应该在这基础上变动。这就有需要变化需要考虑的了,特别是跟 JSON 做比较。JSON 的是如此简单,以至于 JSON 新版本规范甚至都不用重写。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,会掉入那个经典程序员的陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 + +在 2000 年的时候,推出了一场活动,以使 HTML 符合 XML 标准。发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器供应商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准已经流产,因为未来已清晰可见, HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 + +如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者希望的通用数据格式。想象一下,HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我读懂了, XHTML 的失败是 XML 阵营的一种道德失败。如果 XML 不是 HTML 的最佳工具,那么为了其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣才能获得更大的成功。 + +如果你喜欢这博文,每两周会更新一次! 请在 Twitter 上关注 [@TwoBitHistory] [3] 或订阅 [RSS feed] [4], 以确保得到更新的通知。 + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[runningwater](https://github.com/runningwater) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://twobithistory.org/images/json.svg +[2]: http://JSON.org +[3]: https://twitter.com/TwoBitHistory +[4]: https://twobithistory.org/feed.xml From 87f5817ae1fd72be56f496efbd551a7fb9e12e63 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Wed, 9 Jan 2019 17:00:31 +0000 Subject: [PATCH 0514/4278] =?UTF-8?q?Revert=20"=E6=8C=89=E7=85=A7=E6=96=B0?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=9A=84=E6=A0=BC=E5=BC=8F=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=BA=86=E4=BF=AE=E6=94=B9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4aa8c8b3ab82d775ebb54d0bf892ce8b0725de0d. --- .../20181127 What the open source community means to me.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/talk/20181127 What the open source community means to me.md b/sources/talk/20181127 What the open source community means to me.md index b092c1c33e..ec4d8f7a6d 100644 --- a/sources/talk/20181127 What the open source community means to me.md +++ b/sources/talk/20181127 What the open source community means to me.md @@ -1,5 +1,7 @@ +translating by seriouszyx + [#]: collector: (lujun9972) -[#]: translator: (seriouszyx) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (What the open source community means to me) From 98d66e63ad196c120917d130466a1814dc48c872 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 10 Jan 2019 08:45:55 +0800 Subject: [PATCH 0515/4278] translated --- ...ake your way across your Linux terminal.md | 52 ------------------- ...ake your way across your Linux terminal.md | 52 +++++++++++++++++++ 2 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 sources/tech/20181210 Snake your way across your Linux terminal.md create mode 100644 translated/tech/20181210 Snake your way across your Linux terminal.md diff --git a/sources/tech/20181210 Snake your way across your Linux terminal.md b/sources/tech/20181210 Snake your way across your Linux terminal.md deleted file mode 100644 index 32c4aba096..0000000000 --- a/sources/tech/20181210 Snake your way across your Linux terminal.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Snake your way across your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-snake) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Snake your way across your Linux terminal -====== -Python isn't the only snake you'll find at the Linux command line with this classic 1970s game remake. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-snake.png?itok=oNhqUTDu) - -Welcome back to the 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. It's hard to say exactly, but my definition is anything that helps you have fun at the terminal. - -We've been on a roll with games over the weekend, and it was fun, so let's look at one more game today, Snake! - -Snake is an oldie but goodie; versions of it have been around seemingly forever. The first version I remember playing was one called [Nibbles][1] that came packaged with [QBasic][2] in the 1990s, and was probably pretty important to my understanding of what a programming language even was. Here I had the source code to a game that I could modify and just see what happens, and maybe learn something about what all of those funny little words that made up a programming language were all about. - -Today's [Snake][3] is written in Go, and while it's simple, it's just as much fun as the original. Like most simple old games, there are a ton of versions to choose from. In Snake's case, there's even a version in the classic [bsdgames][4] package that's almost certainly packaged for your distribution. - -But what I like about this version of Snake is that it's packaged for Docker so I can easily run it in one line from my terminal without worrying about anything disto-specific. That, and it makes use of 15 randomized food emojis for the snake to eat. I'm a sucker for food emojis. Anyway, give it a try using: - -``` -$ docker run -ti dyego/snake-game -``` - -This Snake is licensed as open source under an MIT license, and you can check out the source code [on GitHub][3]. -![](https://opensource.com/sites/default/files/uploads/linux-toy-snake-animated.gif) -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Powers of two, powers of Linux: 2048 at the command line][5], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-snake - -作者:[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://en.wikipedia.org/wiki/Nibbles_(video_game) -[2]: https://en.wikipedia.org/wiki/QBasic -[3]: https://github.com/DyegoCosta/snake-game -[4]: https://github.com/vattam/BSDGames -[5]: https://opensource.com/article/18/12/linux-toy-2048 diff --git a/translated/tech/20181210 Snake your way across your Linux terminal.md b/translated/tech/20181210 Snake your way across your Linux terminal.md new file mode 100644 index 0000000000..a9525a9970 --- /dev/null +++ b/translated/tech/20181210 Snake your way across your Linux terminal.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Snake your way across your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-snake) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端中玩贪吃蛇 +====== +有了这个 20 世纪 70 年代的经典重制游戏,Python 将不再是你在 Linux 终端能发现的唯一的“蛇”。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-snake.png?itok=oNhqUTDu) + +欢迎回到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己甚至是命令行玩具。这很难确切地说,但我的定义是任何可以帮助你在终端玩得开心的东西。 + +我们这周都在介绍游戏,这很有趣,接着让我们看下今天的游戏,贪吃蛇! + +贪吃蛇是一个古老又很好的游戏。它的版本似乎一直存在着。我记得我第一次玩得版本是 20 世纪 90 年代与 [QBasic][2] 一起打包发布的 [Nibbles][1],它对我理解什么是编程语言起了很重要的作用。我有游戏的源码,我可以修改并查看会发生什么,并学习到一些组成这个编程语言的有趣词汇究竟是什么意思。 + +今天的[贪吃蛇][3]是用 Go 写的,它很简单并且和原版的游戏一样有趣。像大多数简单的老游戏一样,它有很多版本可供选择。这今天的贪吃蛇中,甚至还有一个经典的 [bsdgames][4] 形式的包,它几乎一定为你的发行版打包了。 + +但我喜欢的是用 Docker 打包的贪吃蛇,因为我可以轻松地在命令行中运行,而不用担心发行版相关的问题。这个版本使用 15 个随机的食物 emoji 图案让蛇来吃。我玩得不好。不管怎样,请试一下: + +``` +$ docker run -ti dyego/snake-game +``` + +这个贪吃蛇以 MIT 许可证开源,你可在 [Github][3] 取得源码。 +![](https://opensource.com/sites/default/files/uploads/linux-toy-snake-animated.gif) +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +请查看昨天的玩具,[数字 2 的力量,Linux 的力量:在命令行中玩 2048][5],记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-snake + +作者:[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://en.wikipedia.org/wiki/Nibbles_(video_game) +[2]: https://en.wikipedia.org/wiki/QBasic +[3]: https://github.com/DyegoCosta/snake-game +[4]: https://github.com/vattam/BSDGames +[5]: https://opensource.com/article/18/12/linux-toy-2048 \ No newline at end of file From 6b677ae39598b21a2eb68e61141d01905674f846 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 10 Jan 2019 08:49:11 +0800 Subject: [PATCH 0516/4278] translating --- ... Powers of two, powers of Linux- 2048 at the command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md index da1b241713..1c7d61329f 100644 --- a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md +++ b/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ae82e4e8db2ce4ddb1ebede97abed6d224ba81a5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 11:16:50 +0800 Subject: [PATCH 0517/4278] =?UTF-8?q?=E5=9B=9E=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181127 What the open source community means to me.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sources/talk/20181127 What the open source community means to me.md b/sources/talk/20181127 What the open source community means to me.md index ec4d8f7a6d..a0f85846c9 100644 --- a/sources/talk/20181127 What the open source community means to me.md +++ b/sources/talk/20181127 What the open source community means to me.md @@ -1,12 +1,10 @@ -translating by seriouszyx - [#]: collector: (lujun9972) [#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (What the open source community means to me) [#]: via: (https://opensource.com/article/18/11/what-open-source-community-means-me) -[#]: author: ([Florian Effenberger](https://opensource.com/users/floeff)) +[#]: author: (Florian Effenberger https://opensource.com/users/floeff) [#]: url: ( ) What the open source community means to me From e3476218ac47ef2449b86d5119236780d1db6918 Mon Sep 17 00:00:00 2001 From: belitex Date: Thu, 10 Jan 2019 14:29:08 +0800 Subject: [PATCH 0518/4278] =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=BF=BB=E8=AF=91G?= =?UTF-8?q?CC:Optimizing=20Linux,the=20Internet,and=20Everything?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...81009 GCC- Optimizing Linux, the Internet, and Everything.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md b/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md index 70405d6c70..a0f6acbc39 100644 --- a/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md +++ b/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md @@ -1,5 +1,3 @@ -translating by belitex - GCC: Optimizing Linux, the Internet, and Everything ====== From d2cc6ea9da6e0c296b0c0dddc3548cdfb92e1c1d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 23:11:56 +0800 Subject: [PATCH 0519/4278] PRF:20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @qhwdw --- ...GP - Part 7- Protecting Online Accounts.md | 95 ++++++------------- 1 file changed, 30 insertions(+), 65 deletions(-) diff --git a/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md index 4cf1f321c1..2d136e324e 100644 --- a/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md +++ b/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @@ -1,98 +1,72 @@ 保护代码完整性(七):保护在线帐户 ====== +> 在这个系列的最后一篇当中,我们将为你展示如何用双因子认证保护你的在线账户。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/online-pgp.jpg?itok=BWc_Bk6q) + 到目前为止,本系列教程已经提供了 PGP 的实用指南,包括基本概念和工具、生成和保护你的密钥的步骤。如果你错过了前面的文章,可以通过下面的链接查看。在本系列的最后一篇文章中,我们将为你保护在线帐户提供一个额外的指南,保护在线帐户是当今非常重要的一件事情。 -[第一部分:基本概念和工具][1] +- [第一部分:基本概念和工具][1] +- [第二部分:生成你的主密钥][2] +- [第三部分:生成 PGP 子密钥][3] +- [第四部分:将主密钥移到离线存储中][4] +- [第五部分:将子密钥移到硬件设备中][5] +- [第六部分:在 Git 中使用 PGP][6] -[第二部分:生成你的主密钥][2] - -[第三部分:生成 PGP 子密钥][3] - -[第四部分:将主密钥移到离线存储中][4] - -[第五部分:将子密钥移到硬件设备中][5] - -[第六部分:在 Git 中使用 PGP][6] - -### 清单 +#### 清单 * 取得一个具备 U2F 功能的设备(必要) - * 为你的在线帐户启用双因子认证(必要) - * GitHub/GitLab - * Google - * 社交媒体 - * 使用 U2F 作为主验证机制,使用 TOTP 作为备选(必要) - - - #### 考虑事项 -你可能注意到,很多在线开发者身份是捆绑了你的 email 地址。如果有人能够访问你的邮箱,他们就能够去做一些对你会产生危害的事情,进而会损害你作为自由软件开发者的声誉。应该像保护你的 PGP 密钥那样保护你的 email 地址。 +你可能注意到,很多在线开发者身份是捆绑了 email 地址的。如果有人能够访问你的邮箱,他们就能够去做一些对你会产生危害的事情,进而会损害你作为自由软件开发者的声誉。应该像保护你的 PGP 密钥那样保护你的 email 地址。 ##### 使用 Fido U2F 的双因子认证 -[双因子认证][7] 是一种提升帐户安全性的机制,它除了要求用户名和密码之外,还要求一个物理令牌。它的目标是即便在有人窃取了你的密码(通过按键记录器、肩窥攻击、或其它方式)的情况下,仍然能确保你的帐户安全,他们在没有得到你的一个专用的物理设备(“必备”的那个因子)的情况下,始终不能获取你的帐户。 +[双因子认证][7] 是一种提升帐户安全性的机制,它除了要求用户名和密码之外,还要求一个物理令牌。它的目标是即便在有人窃取了你的密码(通过按键记录器、肩窥攻击或其它方式)的情况下,仍然能确保你的帐户安全,他们在没有得到你的一个专用的物理设备(“必备”的那个因子)的情况下,始终不能获取你的帐户。 广为人知的双因子认证机制有: * 基于 SMS 的验证 - - * 借助智能手机应用的基于时间的一次性令牌(TOTP),比如 "Google Authenticator" 或类似解决方案 - + * 借助智能手机应用程序的基于时间的一次性令牌(TOTP),比如 Google Authenticator 或类似解决方案 * 支持 Fido U2F 的硬件令牌 - - - 基于 SMS 的验证很容易配置,但是它有如下的缺点:它在没有手机信号的地方无法使用(比如,建筑物的地下室),并且如果攻击者能够阻断或转向 SMS 信息,这种方式可能就会失败,比如通过克隆你的 SIM 卡。 -基于 TOTP 的多因子认证提供了比 SMS 更好的安全保护,但它也有一些重要的缺点(在你能够找到一个合适的令牌之前,你只能在智能手机中添加那么多令牌)。此外,还不能避免一个事实,那就是你的密钥最终还是保存在你的智能手机中 —— 它是一个复杂的、全球连接的设备,它有可能还没有及时从制造商那儿收到安全补丁。 +基于 TOTP 的多因子认证提供了比 SMS 更好的安全保护,但它也有一些重要的缺点(你要在智能手机中添加的那么多令牌中找到正确的那个)。此外,还不能避免一个事实,那就是你的密钥最终还是保存在你的智能手机中 —— 它是一个复杂的、全球连接的设备,它有可能还没有及时从制造商那儿收到安全补丁。 -更重要的是,不论是使用 TOTP 还是 SMS 的方法保护你免受诱骗攻击 —— 如果诱骗攻击者能够窃取你的帐户密码和双因子令牌,他们就可以在合法的站点上使用它们,访问你的帐户。 +更重要的是,不论是使用 TOTP 还是 SMS 的方法来保护你免受诱骗攻击 —— 如果诱骗攻击者能够窃取你的帐户密码和双因子令牌,他们就可以在合法的站点上使用它们,访问你的帐户。 [Fido U2F][8] 是一个按标准开发的专用设备,它能够提供双因子认证机制来对付诱骗攻击。U2F 协议在 USB 令牌中保存每个站点的的唯一密钥,如果你在任何合法站点以外的地方尝试使用它,它将阻止你,以防范偶然让攻击者获得你的密码和一次性令牌。 Chrome 和 Firefox 都支持 U2F 双因子认证,希望其它浏览器也能够提供对 U2F 的支持。 -##### 获得一个支持 Fido U2F 功能的令牌 +#### 获得一个支持 Fido U2F 功能的令牌 支持 U2F 的硬件令牌的 [可选目标很多][9],但如果你已经订购了一个支持智能卡的物理设备,那么你最好的选择就是 Yubikey 4,它两者都支持。 -##### 启用你的在线帐户的双因子认证 +#### 启用你的在线帐户的双因子认证 -你要确定你想去启用的选项,你的 email 提供商已经使用了(特别是 Google,它对 U2F 的支持非常好)。其它的站点这个功能应该是启用了: +你要确定想启用双因子认证的在线账户,你的 email 提供商已经使用了(特别是 Google,它对 U2F 的支持非常好)。其它的站点这个功能应该是启用了: * GitHub:当你上传你的 PGP 公钥时,你应该要想到,如果其他人能够获得访问你的帐户,他们可以用他们自己的 PGP 公钥替换掉你的 PGP 公钥。如果在 GitHub 上发布代码,你应该使用 U2F 认证来保护你的帐户安全。 - * GitLab:理由同上 - * Google:如果你有 google 帐户,你就惊奇地发现,许多帐户都允许以 Google 帐户来代替站点专用的认证来登入它们。 - * Facebook:理由同上,许多在线站点都提供一个选择让你以 Facebook 的帐户来认证。即便你不使用 Facebook 也应该使用双因子认证来保护你的 Facebook 帐户。 - * 你认为必要的其它站点。查看 [dongleauth.info][10] 去找找灵感。 - - - -##### 如有可能,配置 TOTP 作为备选 +#### 如有可能,配置 TOTP 作为备选 许多站点都允许你配置多个双因子认证机制,推荐的设置是: * U2F 令牌作为主认证机制 - - * TOTP 手机 app 作为辅助认证机制 - - - + * TOTP 手机应用作为辅助认证机制 通过这种方式,即便你丢失了你的 U2F 令牌,你仍然能够重新获取对你的帐户的访问。或者,你可以注册多个 U2F 令牌(即:你可以用一个便宜的令牌仅用它做 U2F,并且将它用作备份)。 @@ -101,44 +75,35 @@ Chrome 和 Firefox 都支持 U2F 双因子认证,希望其它浏览器也能 到目前为止,你已经完成了下列的重要任务: 1. 创建你的开发者身份并使用 PGP 加密来保护它。 - 2. 通过将你的主密钥移到一个离线存储中并将子密钥移到一个外置硬件设备中的方式来配置你的环境,让窃取你的身份变得极为困难。 - 3. 配置你的 Git 环境去确保任何使用你项目的人都能够验证仓库的完整性和它的整个历史。 - 4. 使用双因子认证强化你的在线帐户。 - - - 在安全保护方面,你已经做的很好了,但是你还应该去阅读以下的主题: - * 如何去强化你的团队沟通(在这个仓库中查看相关文档)。你的项目开发和治理决策的要求应该和保护提交代码那样去保护,如果不这样做,应该确保你的团队沟通是可信任的,并且所有决策的完整性是可验证的。 - - * 如何去强化你的工作站的安全(在这个仓库中查看相关文档)。你的目标是最小化可能导致项目代码被污染的危险或你的开发者身份被窃的行为。 - + * 如何去强化你的团队沟通。你的项目开发和治理决策的要求应该和保护提交代码那样去保护,如果不这样做,应该确保你的团队沟通是可信任的,并且所有决策的完整性是可验证的。 + * 如何去强化你的工作站的安全。你的目标是尽可能减少导致项目代码被污染的危险或你的开发者身份被窃的行为。 * 如何写出安全的代码(查看相关编程语言和你项目所使用的库的各种文档)。即便引入它的提交代码上有一个 PGP 签名,糟糕的、不安全的代码仍然是糟糕的、不安全的代码! - -------------------------------------------------------------------------------- via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-7-protecting-online-accounts 作者:[Konstantin Ryabitsev][a] -译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) +译者:[qhwdw](https://github.com/qhwdw) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device -[6]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git +[1]:https://linux.cn/article-9524-1.html +[2]:https://linux.cn/article-9529-1.html +[3]:https://linux.cn/article-9607-1.html +[4]:https://linux.cn/article-10402-1.html +[5]:https://linux.cn/article-10415-1.html +[6]:https://linux.cn/article-10421-1.html [7]:https://en.wikipedia.org/wiki/Multi-factor_authentication [8]:https://en.wikipedia.org/wiki/Universal_2nd_Factor [9]:http://www.dongleauth.info/dongles/ From b2c24056035297d0c2bf5359f38c3787f1110f41 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 23:12:16 +0800 Subject: [PATCH 0520/4278] PUB:20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @qhwdw https://linux.cn/article-10432-1.html --- ...ode Integrity with PGP - Part 7- Protecting Online Accounts.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md (100%) diff --git a/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md similarity index 100% rename from translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md rename to published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md From 88b1c2bcb8663235fe9d86ffaddeb802f02c1139 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 23:14:09 +0800 Subject: [PATCH 0521/4278] PRF:20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md --- ...ting Code Integrity with PGP - Part 6- Using PGP with Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md index 688864d163..f87e1fee14 100644 --- a/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md +++ b/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @@ -1,4 +1,4 @@ -保护代码完整性(六):在 Git 上使用 PGP +用 PGP 保护代码完整性(六):在 Git 上使用 PGP ====== > 我们继续我们的 PGP 实践系列,来看看签名标签的标签和提交,这可以帮你确保你的仓库没有被篡改。 From c596d70a313694873c9ccfbf420c58e1314901c1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 23:15:50 +0800 Subject: [PATCH 0522/4278] PRF:20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md --- ...e Integrity with PGP - Part 7- Protecting Online Accounts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md index 2d136e324e..23a7dc54d0 100644 --- a/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md +++ b/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @@ -1,4 +1,4 @@ -保护代码完整性(七):保护在线帐户 +用 PGP 保护代码完整性(七):保护在线帐户 ====== > 在这个系列的最后一篇当中,我们将为你展示如何用双因子认证保护你的在线账户。 From 7ceddea1f847235ba8a991c032d33fe7f73d416b Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 11 Jan 2019 03:47:50 +0800 Subject: [PATCH 0523/4278] Update and rename sources/tech/20180108 5 arcade-style games in your Linux repository.md to translated/tech/20180108 5 arcade-style games in your Linux repository.md --- ...de-style games in your Linux repository.md | 99 ------------------- ...de-style games in your Linux repository.md | 97 ++++++++++++++++++ 2 files changed, 97 insertions(+), 99 deletions(-) delete mode 100644 sources/tech/20180108 5 arcade-style games in your Linux repository.md create mode 100644 translated/tech/20180108 5 arcade-style games in your Linux repository.md diff --git a/sources/tech/20180108 5 arcade-style games in your Linux repository.md b/sources/tech/20180108 5 arcade-style games in your Linux repository.md deleted file mode 100644 index 4e802bfbf0..0000000000 --- a/sources/tech/20180108 5 arcade-style games in your Linux repository.md +++ /dev/null @@ -1,99 +0,0 @@ -Scoutydren is translating. -5 arcade-style games in your Linux repository -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) - -Gaming has traditionally been one of Linux's weak points. That has changed somewhat in recent years thanks to [Steam][1], [GOG][2], and other efforts to bring commercial games to multiple operating systems, but those games often are not open source. Sure, the games can be played on an open source operating system, but that is not good enough for an open source purist. - -So, can someone who uses only free and open source software find games that are polished enough to present a solid gaming experience without compromising their open source ideals? Absolutely! While most open source games are unlikely to rival some of the AAA commercial games developed with massive budgets, there are plenty of open source games, in many genres, that are fun to play and can be installed from the repositories of most major Linux distributions. - -I am starting this series of articles on open source games for Linux by looking at arcade-style games. In future articles, I plan to cover board & card, puzzle, racing, role-playing, and strategy & simulation games. - -### AstroMenace - -![](https://opensource.com/sites/default/files/u128651/astromenace.png) - -[AstroMenace][3] is a scrolling space shooter for the modern era. It began as a closed source game, but the code and art assets have since been released under open licenses. Gameplay is fairly typical for the style of game, but it features nice, modern 3D graphics. Ship and weapon upgrades can be purchased using the points earned from shooting down enemies. The difficulty level can be tweaked by changing a wide variety of options, so the game is approachable to new players while still offering a challenge to experienced ones. - -To install AstroMenace, run the following command: - - * On Fedora: `dnf install astromenace` - * On Debian/Ubuntu: `apt install astromenace` - - - -### Battle Tanks - -![](https://opensource.com/sites/default/files/u128651/battle_tanks.png) - -[Battle Tanks][4] is a fast-paced tank battle game with an overhead perspective. Players maneuver one of three different vehicle types around a map, collecting power-ups and trying to blow up their opponents. It has deathmatch, team deathmatch, capture the flag, and cooperative game modes. There are nine maps for the deathmatch and capture the flag modes and four maps for cooperative mode. The game supports split-screen local multiplayer for two players and local area network multiplayer for larger matches. Gameplay is fast-paced, and the default match length of five minutes is short, which makes Battle Tanks a nice choice for gamers who want something quick to play. - -To install Battle Tanks, run the following command: - - * On Fedora: `dnf install btanks` - * On Debian/Ubuntu: `apt install btanks` - - - -### M.A.R.S. - -![](https://opensource.com/sites/default/files/u128651/m.a.r.s.png) - -[M.A.R.S.][5] is a top-down space shooter with physics similar to the classic Asteroids arcade game. Players control a spaceship while shooting at their opponents, maneuvering around the screen, and avoiding planets and opponents' incoming fire. The standard death match and team death match modes are available, but there are other modes, like one that requires pushing a ball into the opposing team's home planet, that provide some variety to the gameplay options. It supports local multiplayer, but unfortunately network multiplayer has not been implemented. Since development on the game appears to have stalled, network multiplayer is not likely to appear at any point in the near future, but the game is still fun and playable without it. - -To install M.A.R.S., run the following command: - - * On Fedora: `dnf install marsshooter` - * On Debian/Ubuntu: `apt install marsshooter` - - - -### Neverball - -![](https://opensource.com/sites/default/files/u128651/neverball.png) - -With gameplay inspired by Sega's Super Monkey Ball, [Neverball][6] challenges the player to move a ball through a 3D playing field by moving the playing field, not the ball. The objective is to collect enough coins to open a level's exit and maneuver the ball to the exit before time runs out. There are seven different sets of levels, which range in difficulty from easy to impossible. The game can be played using the keyboard, mouse, or joystick. - -To install Neverball, run the following command: - - * On Fedora: `dnf install neverball` - * On Debian/Ubuntu: `apt install neverball` - - - -### SuperTux - -![](https://opensource.com/sites/default/files/u128651/supertux.png) - -[SuperTux][7] is a 2D platformer modeled after Nintendo's Super Mario Bros. games. Linux's mascot, Tux the Penguin, takes the place of Mario with eggs serving as the equivalent of Super Mario Bros.'s mushroom power-ups. When Tux is powered up with an egg, he can collect flowers that grant him extra abilities. The fire flower, which lets Tux throw fireballs, is the most common in the game's levels, but ice, air, and earth flowers are included in the game's code. Collecting star power-ups makes Tux temporarily invincible, just like in the Super Mario games. The default level set, Icy Island, is 30 levels, making the game approximately the same length as the original Super Mario Bros., but SuperTux also comes with several contributed level sets, including three bonus islands, a forest island, a Halloween island, and incubator and test levels. SuperTux has a built-in level editor, so users can create their own. - -To install SuperTux, run the following command: - - * On Fedora: `dnf install supertux` - * On Debian/Ubuntu: `apt install supertux` - - - -Did I miss one of your favorite open source arcade games? Share it in the comments below. -### About the author -Joshua Allen Holm - Joshua Allen Holm, MLIS, MEd, is one of Opensource.com's Community Moderators. Joshua's main interests are digital humanities, open access, and open educational resources. You can find Joshua on GitHub, GitLab, LinkedIn, and Zotero. He can reached at holmja@opensource.com. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/arcade-games-linux - -作者:[Joshua Allen Holm][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/holmja -[1]:http://store.steampowered.com/ -[2]:https://www.gog.com/ -[3]:http://www.viewizard.com/ -[4]:http://btanks.sourceforge.net/blog/about-game -[5]:http://mars-game.sourceforge.net/?page_id=10 -[6]:https://neverball.org/index.php -[7]:http://supertux.org/ diff --git a/translated/tech/20180108 5 arcade-style games in your Linux repository.md b/translated/tech/20180108 5 arcade-style games in your Linux repository.md new file mode 100644 index 0000000000..d92ac7a4e0 --- /dev/null +++ b/translated/tech/20180108 5 arcade-style games in your Linux repository.md @@ -0,0 +1,97 @@ +# 10款Linux街机游戏 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) + +长久以来,游戏都是 Linux 的软肋。近些年,Steam,GOG等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 + +那么,我们能找到既免费开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。 + +本文首先介绍 Linux 开源游戏中的街机类型游戏,在之后的文章中,我将介绍桌面和卡牌游戏,解谜游戏,竞速游戏,以及策略模拟游戏。 + +### AstroMenace 太空危机 + +![](https://opensource.com/sites/default/files/u128651/astromenace.png) + +[AstroMenace][3] 是一个近现代太空背景下的滚动页面射击游戏。开发初期它是一个闭源游戏,但它的代码和美术而后在开源证书下被公开。游戏玩法和大多数此类游戏大同小异,但它有质量极高的 3D 画面。飞船和武器更新可以通过击杀敌人所获得的点数购买。游戏的难度可以选择,因此适合新手以及想要追求挑战的硬核玩家。 + +安装 AstroMenace,你只需要在终端下运行以下指令: + +- Fedora 用户: `dnf install astromenace` +- Debian/Ubuntu 用户: `apt install astromenace` + +### Battle Tanks 坦克战役 + +![](https://opensource.com/sites/default/files/u128651/battle_tanks.png) + +[Battle Tanks][4] 是一个俯瞰式视角的快节奏坦克战斗游戏。玩家可以选择三种不同的陆地坦克,操纵其在地图上前行,收集道具并且尝试炸飞敌军。它有四种游戏模式,死亡竞赛(又称“死斗”),团队死斗,夺旗模式和合作模式。死斗和夺旗模式下,分别有8张地图可供玩家选择,合作模式则有4张。该游戏支持分屏本地双人游戏,以及在线多人竞技。游戏节奏很快,默认一次战役仅5分钟,因此Battle Tank十分适合想要利用零碎时间快速来一局的玩家。 + +安装 Battle Tanks,你只需要在终端下运行以下指令: + +- Fedora 用户: `dnf install btanks` +- Debian/Ubuntu 用户: `apt install btanks` + + + +### M.A.R.S. 火星 + +![](https://opensource.com/sites/default/files/u128651/m.a.r.s.png) + +[M.A.R.S.][5] 是一个自上而下的太空射击游戏,游戏机制类似传统街机游戏 “爆破彗星(Asteroids)”。玩家在操控一个太空船的同时向敌方射击并躲避敌军的弹幕射击。游戏有标准的死斗和团体死斗模式,除此之外也有更新鲜的比赛形式——例如在一个模式下,玩家需要控制一个球使其进入敌方母星。该游戏支持本地多人游戏,但遗憾的是不支持多人联机。该游戏的开发更新似乎已经停止,所以该游戏之后增加联机模式的几率很小,但就算没有联机支持,这个游戏仍然值得一试。 + +安装 M.A.R.S. ,你只需要在终端下运行以下指令: + +- Fedora 用户: `dnf install marsshooter`` +- Debian/Ubuntu 用户: ``apt install marsshooter` + + + +### Neverball 不存在之球 + +![](https://opensource.com/sites/default/files/u128651/neverball.png) + +[Neverball][6] 的游戏灵感来源自世嘉的 “超级猴子球(Super Monkey Ball)” ,玩家需要将一个球在3D球场上运动起来,但是玩家控制的不是球,而是球场。游戏任务是在规定的时限内,收集足够多的金币从而打开该关卡的出口并且将小球落进该洞中。游戏可以调整难度,从休闲到黑魂能适应不同的玩家需求。该游戏支持键盘/鼠标以及控制杆操作。 + +安装 Neverball, 你只需要在终端下运行以下指令: + +- Fedora 用户:`dnf install neverball` +- Debian/Ubuntu 用户:`apt install neverball` + + + +### SuperTux 超级Tux + +![](https://opensource.com/sites/default/files/u128651/supertux.png) + +[SuperTux][7] 是继任天堂超级马里奥后的一款 2D 的平台跳跃游戏。Linux 的吉祥物,企鹅 Tux 代替了马里奥,而鸡蛋对应着马里奥系列中的蘑菇能力提升。当 Tux 获得了鸡蛋得到了能力提升,他便可以收集花朵,而花朵可以带来新的附加特殊能力。火焰花在关卡中最为常见,收集了火焰花的 Tux 可以掷出火球。除此之外,冰冻花/空气花/土地花也在游戏的程序中。收集星星的能力提升能使 Tux 暂时变得隐形,就如同马里奥系列游戏。该游戏最基础的一组关卡,冰之岛也有 30 关之多,因此游戏的内容和流程和超级马里奥系列一般长。SuperTux 还有一些附加关卡,例如三个额外奖励小岛,一个森林之岛,一个万圣节岛,一个孵化处,以及很多测试关卡。SuperTux 有一个自带的关卡编辑器,所以玩家可以创建他们的原创关卡。 + +安装 SuperTux,你只需要在终端下运行以下指令: + +- Fedora 用户:`dnf install supertux` +- Debian/Ubuntu 用户: `apt install supertux` + + + +如果我没有在上文中提及你最喜欢的开源街机游戏,欢迎在评论中分享。 + +### 有关作者 + +Joshua Allen Holm - Joshua Allen Holm, MLIS, MEd, 是 Opensource.com 的社区协调者之一。他的主要兴趣有数字人文,学术开放以及公开教育资源。你可以在 GitHub,GitLab,LinkedIn 和 Zotero 上找到他。可以通过 holmja@opensource.com 联系到他。 + +------ + +via: https://opensource.com/article/18/1/arcade-games-linux + +作者:[Joshua Allen Holm][a] +译者:[Scoutydren](https://github.com/Scoutydren) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[1]: http://store.steampowered.com/ +[2]: https://www.gog.com/ +[3]: http://www.viewizard.com/ +[4]: http://btanks.sourceforge.net/blog/about-game +[5]: http://mars-game.sourceforge.net/?page_id=10 +[6]: https://neverball.org/index.php +[7]: http://supertux.org/ From d8df97b646cbf76a5a54caf28d3716ced6777a5d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 11 Jan 2019 08:59:59 +0800 Subject: [PATCH 0524/4278] translated --- ...How to create presentations with Beamer.md | 138 ------------------ ...How to create presentations with Beamer.md | 138 ++++++++++++++++++ 2 files changed, 138 insertions(+), 138 deletions(-) delete mode 100644 sources/tech/20190103 How to create presentations with Beamer.md create mode 100644 translated/tech/20190103 How to create presentations with Beamer.md diff --git a/sources/tech/20190103 How to create presentations with Beamer.md b/sources/tech/20190103 How to create presentations with Beamer.md deleted file mode 100644 index f6d910c348..0000000000 --- a/sources/tech/20190103 How to create presentations with Beamer.md +++ /dev/null @@ -1,138 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to create presentations with Beamer) -[#]: via: (https://opensource.com/article/19/1/create-presentations-beamer) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -How to create presentations with Beamer -====== -Beamer brings LaTeX's powerful typesetting features and ecosystem to creating slides. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b) - -[Beamer][1] is a LaTeX package for generating presentation slide decks. One of its nicest features is that it can take advantage of LaTeX's powerful typesetting system and all the other packages in its ecosystem. For example, I often use LaTeX's [listings][2] package in Beamer presentations that include code. - -### Starting a presentation - -To begin a Beamer document, enter: - -``` -\documentclass{beamer} -``` - -As you would with any other LaTeX document, add any packages you want to use. For example, to use the **listings** package, enter: - -``` -\usepackage{listings} -``` - -Place all content inside the **document** environment: - -``` -\begin{document} -``` - -Beamer documents are usually a sequence of **frame** environments. Frames that contain code should be marked **fragile** : - -``` -\begin{frame}[fragile] -``` - -Begin your frames with a title: - -``` -\frametitle{Function to Do Stuff} -``` - -### Testing your code before you present it - -One of the worst feelings in the world is giving a talk and realizing, as you walk through the code, that there is a glaring bug in it—maybe a misspelled keyword or an unclosed brace. - -The solution is to test code that is presented. In most presentation environments, this means creating a separate file, writing tests, then copying and pasting. - -However, with Beamer, there is a better way. Imagine you have a file named **do_stuff.py** that contains code. You can write tests for the **do_stuff.py** code in a second file, which you call **test_do_stuff.py** , and can exercise it with, say, [pytest][3]. However, most of the lines in **do_stuff.py** lack pedagogic value, like defining helper functions. - -To simplify things for your audience, you can import just the lines you want to talk about into the frame in your presentation : - -``` -\lstinputlisting[ -    language=Python, -    firstline=8, -    lastline=15 -]{do_stuff.py} -``` - -Since you will be talking through those lines (from 8 to 15), you don't need any other content on the slide. Close the frame: - -``` -\end{frame} -``` - -On the next slide, you want to show a usage example for the **do_stuff()** function you just presented: - -``` -\begin{frame}[fragile] -\frametitle{Calling Function to Do Stuff} -\lstinputlisting[ -    language=Python, -    firstline=17, -    lastline=19 -]{do_stuff.py} -\end{frame} -``` - -You use the same file, but this time you show the lines that call the function. Finally, close the document: - -``` -\end{document} -``` - -Assuming you have an appropriate Python file in **do_stuff.py** , this will produce a short two-slide presentation. - -Beamer also supports necessary features such as progressive revelation, showing only one bullet at a time to prevent the audience from being distracted by reading ahead.": **\pause** inside a list will divide bullets into pages: - -``` -\begin{frame} -Remember: -\begin{itemize} -\item This will show up on the first slide. \pause -\item This will show up on the -      second slide, as well as the preceding point. \pause -\item Finally, on the third slide, -       all three bullets will show up. -\end{frame} -``` - -### Creating handouts - -My favorite feature in Beamer is that you can set it to ignore everything outside a frame with **\documentclass[ignorenonframetext]{beamer}**. When I prepare a presentation, I leave off the top (where the document class is declared) and auto-generate two versions of it: one with Beamer that ignores all text outside any frame, which I use for my presentation, and one with a header like: - -``` -\documentclass{article} -\usepackage{beamerarticle} -``` - -which generates a handout—a PDF that has all the frames and all the text between them. - -When a conference organizer asks me to publish my slides, I include the original slide deck as a reference, but the main thing I like people to have is the handout, which has all the explanatory text that I don't want to include on the slide deck itself. - -When creating presentation slides, people often wonder whether it's better to optimize their materials for the presentation or for people who want to read them afterward. Fortunately, Beamer provides the best of both worlds. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/create-presentations-beamer - -作者:[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://www.overleaf.com/learn/latex/Beamer -[2]: https://www.overleaf.com/learn/latex/Code_listing -[3]: https://docs.pytest.org/en/latest/ diff --git a/translated/tech/20190103 How to create presentations with Beamer.md b/translated/tech/20190103 How to create presentations with Beamer.md new file mode 100644 index 0000000000..8e98d98561 --- /dev/null +++ b/translated/tech/20190103 How to create presentations with Beamer.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create presentations with Beamer) +[#]: via: (https://opensource.com/article/19/1/create-presentations-beamer) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +如何使用 Beamer 创建演示文稿 +====== +Beamer 将 LaTeX 强大的排版功能和生态系统带进创建幻灯片中。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b) + +[Beamer][1] 是用于生成幻灯片的 LaTeX 包。它最棒的功能之一是它可以利用 LaTeX 强大的排版系统和其生态系统中的所有其他软件包。例如,我经常在包含代码的 Beamer 演示文稿中使用 LaTeX 的 [listings][2] 包。 + +### 创建演示文稿 + +要创建一个 Beamer 文档,输入: + +``` +\documentclass{beamer} +``` + +与任何其他 LaTeX 文档一样,添加你要使用的任何包。例如,要使用 **listings** 包,请输入: + +``` +\usepackage{listings} +``` + +将所有内容放在 **document** 环境中: + +``` +\begin{document} +``` + +Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame 应该被标记为 **fragile**: + +``` +\begin{frame}[fragile] +``` + +使用标题开始你的 frame: + +``` +\frametitle{Function to Do Stuff} +``` + +### 开始演示前测试你的代码 + +世上最糟糕的感受之一你在演讲中说到代码时,突然发现了一个 bug—也许是拼错了关键词或者漏掉了括号。 + +解决方法之一就是测试演示的代码。在多数演示环境中,这意味着创建一个单独的文件、编写测试接着拷贝和粘贴。 + +然而,在 Beamer 中有一种更好的方法。想象一下,你有一个名为 **do_stuff.py** 的文件,其中包含代码。你可以在第二个文件中编写 **do_stuff.py** 代码的测试,你可以将其命名为 **test_do_stuff.py**,并且可以使用 [pytest][3] 测试。但是,**do_stuff.py**中的大多数行都缺乏教学价值,比如定义辅助函数。 + +要简化你受众看到的东西,你可在演示文稿中只导入你要讨论的行到 frame 中: + +``` +\lstinputlisting[ + language=Python, + firstline=8, + lastline=15 +]{do_stuff.py} +``` + +由于你会对这几行(从 8 到 15)进行讨论,因此幻灯片上不需要任何其他内容。结束 frame: + +``` +\end{frame} +``` + +在下一张幻灯片中,你想展示刚才的 **do_stuff()** 函数的用法示例: + +``` +\begin{frame}[fragile] +\frametitle{Calling Function to Do Stuff} +\lstinputlisting[ + language=Python, + firstline=17, + lastline=19 +]{do_stuff.py} +\end{frame} +``` + +你使用相同的文件,但这次显示调用该函数的行。最后,结束 document: + +``` +\end{document} +``` + +假设你在 **do_stuff.py** 中有一个合适的 Python 文件,这将生成一个含有 2 页的幻灯片。 + +Beamer 还支持必要的功能如渐进式演示,每次给观众展示一部分以免受到前面的打扰。在行中放入 ”**\pause**“ 会将页面分成不同的部分: + +``` +\begin{frame} +Remember: +\begin{itemize} +\item This will show up on the first slide. \pause +\item This will show up on the + second slide, as well as the preceding point. \pause +\item Finally, on the third slide, + all three bullets will show up. +\end{frame} +``` + +### 创建讲义 + +Beamer 中我最喜欢的功能是你可以用 **\documentclass[ignorenonframetext]{beamer}** 设置忽略 frame 外的所有内容。当我准备演示文稿时,我离开顶部(声明文档类的位置)并自动生成它的两个版本:我的演示稿使用 Beamer 忽略任何 frame 之外的所有文本,另一个含有类似这样的头: + +``` +\documentclass{article} +\usepackage{beamerarticle} +``` + +这会生成一份讲义—一份含有所有 frame 和它们之间文字的 PDF。 + +当会议组织者要求我发布我的幻灯片时,我会包含原始幻灯片作为参考,但我希望人们拿到的是讲义,它包含了所有我不想在幻灯片上写的解释部分。 + +在创建幻灯片时,人们经常想是要为演讲优化资料还是方便那些想要日后阅读的人。幸运的是,Beamer 提供了两全其美的办法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/create-presentations-beamer + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://www.overleaf.com/learn/latex/Beamer +[2]: https://www.overleaf.com/learn/latex/Code_listing +[3]: https://docs.pytest.org/en/latest/ \ No newline at end of file From e8d606490124bf8d2077588623cb931667b961ea Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 11 Jan 2019 09:11:27 +0800 Subject: [PATCH 0525/4278] translating --- sources/tech/20181211 Winterize your Bash prompt in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181211 Winterize your Bash prompt in Linux.md b/sources/tech/20181211 Winterize your Bash prompt in Linux.md index bae5837a2c..c952f0c18d 100644 --- a/sources/tech/20181211 Winterize your Bash prompt in Linux.md +++ b/sources/tech/20181211 Winterize your Bash prompt in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b86fc5e81392c3d7c31419032613070a33cb8916 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 09:55:37 +0800 Subject: [PATCH 0526/4278] PRF:20180108 5 arcade-style games in your Linux repository.md @Scoutydren --- ...de-style games in your Linux repository.md | 53 ++++++++----------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/translated/tech/20180108 5 arcade-style games in your Linux repository.md b/translated/tech/20180108 5 arcade-style games in your Linux repository.md index d92ac7a4e0..98ace98e05 100644 --- a/translated/tech/20180108 5 arcade-style games in your Linux repository.md +++ b/translated/tech/20180108 5 arcade-style games in your Linux repository.md @@ -1,81 +1,74 @@ -# 10款Linux街机游戏 +5 款 Linux 街机游戏 +================ ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) -长久以来,游戏都是 Linux 的软肋。近些年,Steam,GOG等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 +长久以来,游戏都是 Linux 的软肋。近些年,Steam、GOG 等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 -那么,我们能找到既免费开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。 +那么,我们能找到既自由开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和 3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。 本文首先介绍 Linux 开源游戏中的街机类型游戏,在之后的文章中,我将介绍桌面和卡牌游戏,解谜游戏,竞速游戏,以及策略模拟游戏。 -### AstroMenace 太空危机 +### 太空危机AstroMenace ![](https://opensource.com/sites/default/files/u128651/astromenace.png) -[AstroMenace][3] 是一个近现代太空背景下的滚动页面射击游戏。开发初期它是一个闭源游戏,但它的代码和美术而后在开源证书下被公开。游戏玩法和大多数此类游戏大同小异,但它有质量极高的 3D 画面。飞船和武器更新可以通过击杀敌人所获得的点数购买。游戏的难度可以选择,因此适合新手以及想要追求挑战的硬核玩家。 +[太空危机][3] 是一个近现代太空背景下的滚动页面射击游戏。开发初期它是一个闭源游戏,但它的代码和素材而后以开源许可证发布了。游戏玩法和大多数此类游戏大同小异,但它有质量极高的 3D 画面。飞船和武器升级可以通过击杀敌人所获得的点数购买。游戏的难度可以选择,因此适合新手以及想要追求挑战的硬核玩家。 -安装 AstroMenace,你只需要在终端下运行以下指令: +安装太空危机,你只需要在终端下运行以下指令: - Fedora 用户: `dnf install astromenace` - Debian/Ubuntu 用户: `apt install astromenace` -### Battle Tanks 坦克战役 +### 坦克战役Battle Tanks ![](https://opensource.com/sites/default/files/u128651/battle_tanks.png) -[Battle Tanks][4] 是一个俯瞰式视角的快节奏坦克战斗游戏。玩家可以选择三种不同的陆地坦克,操纵其在地图上前行,收集道具并且尝试炸飞敌军。它有四种游戏模式,死亡竞赛(又称“死斗”),团队死斗,夺旗模式和合作模式。死斗和夺旗模式下,分别有8张地图可供玩家选择,合作模式则有4张。该游戏支持分屏本地双人游戏,以及在线多人竞技。游戏节奏很快,默认一次战役仅5分钟,因此Battle Tank十分适合想要利用零碎时间快速来一局的玩家。 +[坦克战役][4] 是一个俯瞰式视角的快节奏坦克战斗游戏。玩家可以选择三种不同的陆地坦克,操纵其在地图上前行,收集道具并且尝试炸飞敌军。它有四种游戏模式,死亡竞赛(又称“死斗”)、团队死斗、夺旗模式和合作模式。死斗和夺旗模式下,分别有 9 张地图可供玩家选择,合作模式则有 4 张。该游戏支持分屏本地双人游戏,以及在线多人竞技。游戏节奏很快,默认一次战役仅 5 分钟,因此,坦克战役十分适合想要利用零碎时间快速来一局的玩家。 -安装 Battle Tanks,你只需要在终端下运行以下指令: +安装坦克战役,你只需要在终端下运行以下指令: - Fedora 用户: `dnf install btanks` - Debian/Ubuntu 用户: `apt install btanks` - - -### M.A.R.S. 火星 +### 火星M.A.R.S. ![](https://opensource.com/sites/default/files/u128651/m.a.r.s.png) -[M.A.R.S.][5] 是一个自上而下的太空射击游戏,游戏机制类似传统街机游戏 “爆破彗星(Asteroids)”。玩家在操控一个太空船的同时向敌方射击并躲避敌军的弹幕射击。游戏有标准的死斗和团体死斗模式,除此之外也有更新鲜的比赛形式——例如在一个模式下,玩家需要控制一个球使其进入敌方母星。该游戏支持本地多人游戏,但遗憾的是不支持多人联机。该游戏的开发更新似乎已经停止,所以该游戏之后增加联机模式的几率很小,但就算没有联机支持,这个游戏仍然值得一试。 +[火星][5] 是一个自上而下的太空射击游戏,游戏机制类似传统街机游戏 “爆破彗星Asteroids”。玩家在操控一个太空船的同时向敌方射击并躲避敌军的弹幕射击。游戏有标准的死斗和团体死斗模式,除此之外也有更新鲜的比赛形式 —— 例如在一个模式下,玩家需要控制一个球使其进入敌方母星。该游戏支持本地多人游戏,但遗憾的是不支持多人联机。该游戏的开发更新似乎已经停止,所以该游戏之后增加联机模式的几率很小,但就算没有联机支持,这个游戏仍然值得一试。 -安装 M.A.R.S. ,你只需要在终端下运行以下指令: +安装火星,你只需要在终端下运行以下指令: -- Fedora 用户: `dnf install marsshooter`` -- Debian/Ubuntu 用户: ``apt install marsshooter` +- Fedora 用户: `dnf install marsshooter` +- Debian/Ubuntu 用户: `apt install marsshooter` - - -### Neverball 不存在之球 +### 不存在之球Neverball ![](https://opensource.com/sites/default/files/u128651/neverball.png) -[Neverball][6] 的游戏灵感来源自世嘉的 “超级猴子球(Super Monkey Ball)” ,玩家需要将一个球在3D球场上运动起来,但是玩家控制的不是球,而是球场。游戏任务是在规定的时限内,收集足够多的金币从而打开该关卡的出口并且将小球落进该洞中。游戏可以调整难度,从休闲到黑魂能适应不同的玩家需求。该游戏支持键盘/鼠标以及控制杆操作。 +[不存在之球][6] 的游戏灵感来源自世嘉的 “超级猴子球Super Monkey Ball” ,玩家需要将一个球在 3D 球场上运动起来,但是玩家控制的不是球,而是球场。游戏任务是在规定的时限内,收集足够多的金币从而打开该关卡的出口并且将小球落进该洞中。游戏可以调整难度,从休闲到难以超乎想象,可以适应不同的玩家需求。该游戏支持键盘/鼠标以及控制杆操作。 -安装 Neverball, 你只需要在终端下运行以下指令: +安装不存在之球,你只需要在终端下运行以下指令: - Fedora 用户:`dnf install neverball` - Debian/Ubuntu 用户:`apt install neverball` - - -### SuperTux 超级Tux +### 超级 TuxSuperTux ![](https://opensource.com/sites/default/files/u128651/supertux.png) -[SuperTux][7] 是继任天堂超级马里奥后的一款 2D 的平台跳跃游戏。Linux 的吉祥物,企鹅 Tux 代替了马里奥,而鸡蛋对应着马里奥系列中的蘑菇能力提升。当 Tux 获得了鸡蛋得到了能力提升,他便可以收集花朵,而花朵可以带来新的附加特殊能力。火焰花在关卡中最为常见,收集了火焰花的 Tux 可以掷出火球。除此之外,冰冻花/空气花/土地花也在游戏的程序中。收集星星的能力提升能使 Tux 暂时变得隐形,就如同马里奥系列游戏。该游戏最基础的一组关卡,冰之岛也有 30 关之多,因此游戏的内容和流程和超级马里奥系列一般长。SuperTux 还有一些附加关卡,例如三个额外奖励小岛,一个森林之岛,一个万圣节岛,一个孵化处,以及很多测试关卡。SuperTux 有一个自带的关卡编辑器,所以玩家可以创建他们的原创关卡。 +[超级 Tux][7] 是继任天堂超级马里奥后的一款 2D 的平台跳跃游戏。Linux 的吉祥物企鹅 Tux 代替了马里奥,而鸡蛋对应着马里奥系列中的蘑菇能力提升。当 Tux 获得了鸡蛋得到了能力提升,它便可以收集花朵,而花朵可以带来新的附加特殊能力。火焰花在关卡中最为常见,收集了火焰花的 Tux 可以掷出火球。除此之外,冰冻花/空气花/土地花也在游戏的程序中。收集星星的能力提升能使 Tux 暂时变得隐形,就如同马里奥系列游戏。该游戏最基础的一组关卡,冰之岛也有 30 关之多,因此游戏的内容和流程和超级马里奥系列一般长。SuperTux 还有一些附加关卡,例如三个额外奖励小岛、一个森林之岛、一个万圣节岛、一个孵化处,以及很多测试关卡。SuperTux 有一个自带的关卡编辑器,所以玩家可以创建他们的原创关卡。 -安装 SuperTux,你只需要在终端下运行以下指令: +安装超级 Tux,你只需要在终端下运行以下指令: - Fedora 用户:`dnf install supertux` - Debian/Ubuntu 用户: `apt install supertux` - - 如果我没有在上文中提及你最喜欢的开源街机游戏,欢迎在评论中分享。 ### 有关作者 -Joshua Allen Holm - Joshua Allen Holm, MLIS, MEd, 是 Opensource.com 的社区协调者之一。他的主要兴趣有数字人文,学术开放以及公开教育资源。你可以在 GitHub,GitLab,LinkedIn 和 Zotero 上找到他。可以通过 holmja@opensource.com 联系到他。 +Joshua Allen Holm - 是 Opensource.com 的社区协调者之一。他的主要兴趣有数字人文、学术开放以及公开教育资源。你可以在 GitHub、GitLab、LinkedIn 和 Zotero 上找到他。可以通过 holmja@opensource.com 联系到他。 ------ @@ -83,7 +76,7 @@ via: https://opensource.com/article/18/1/arcade-games-linux 作者:[Joshua Allen Holm][a] 译者:[Scoutydren](https://github.com/Scoutydren) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 92c1178998efe924dcaec19ea11ecebdac278bec Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 09:56:01 +0800 Subject: [PATCH 0527/4278] PUB:20180108 5 arcade-style games in your Linux repository.md @Scoutydren https://linux.cn/article-10433-1.html --- .../20180108 5 arcade-style games in your Linux repository.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180108 5 arcade-style games in your Linux repository.md (100%) diff --git a/translated/tech/20180108 5 arcade-style games in your Linux repository.md b/published/20180108 5 arcade-style games in your Linux repository.md similarity index 100% rename from translated/tech/20180108 5 arcade-style games in your Linux repository.md rename to published/20180108 5 arcade-style games in your Linux repository.md From 3f3c13273ef26c486129d97ba8407b89801df1e3 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 11 Jan 2019 09:58:30 +0800 Subject: [PATCH 0528/4278] Translating An Introduction to Go. --- .../tech/20181224 An Introduction to Go.md | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 5edd8d3d19..4f352a2bf0 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -50,7 +50,7 @@ Go 有一个相当简单的类型系统:没有子类型(但有类型转换 9. 函数 - 10. 命名类型 - 可能具有关联方法的其他类型的别名: + 10. 具名类型 - 可能具有关联方法的其他类型的别名(译者注:这里的别名并非指 Go 1.9 中的新特性“类型别名”): ``` type T struct { foo int } @@ -58,14 +58,13 @@ Go 有一个相当简单的类型系统:没有子类型(但有类型转换 type T OtherNamedType ``` - Named types are mostly distinct from their underlying types, so you cannot assign them to each other, but some operators like `+` do work on objects of named types with an underlying numerical type (so you could add two `T` in the example above). + 具名类型完全不同于他们的底层类型,所以你不能让他们互相赋值,但一些运输符,例如 `+`,能够处理同一底层数值类型的具名类型对象们(所以你可以在上面的示例中把两个 `T` 加起来)。 - -Maps, slices, and channels are reference-like types - they essentially are structs containing pointers. Other types are passed by value (copied), including arrays (which have a fixed length and are copied). +Maps、slices 和 channels 是类似于引用的类型——他们实际上是包含指针的结构。包括数组(具有固定长度并可被拷贝)在内的其他类型则是值(拷贝)传递。 #### 类型转换 -Conversions are the similar to casts in C and other languages. They are written like this: +类型转换类似于 C 或其他语言中的转换。它们写成这样子: ``` TypeName(value) @@ -73,23 +72,23 @@ TypeName(value) #### 常量 -Go has “untyped” literals and constants. +Go 有“无类型”字面量和常量。 ``` -1 // untyped integer literal -const foo = 1 // untyped integer constant -const foo int = 1 // int constant +1 // 无类型整数字面量 +const foo = 1 // 无类型整数常量 +const foo int = 1 // int 类型常量 ``` -Untyped values are classified into the following categories: `UntypedBool`, `UntypedInt`, `UntypedRune`, `UntypedFloat`, `UntypedComplex`, `UntypedString`, and `UntypedNil` (Go calls them basic kinds, other basic kinds are available for the concrete types like `uint8`). An untyped value can be assigned to a named type derived from a base type; for example: +无类型值可以分为以下几类:`UntypedBool`、`UntypedInt`、`UntypedRune`、`UntypedFloat`、`UntypedComplex`、`UntypedString` 以及 `UntypedNil`(Go 称它们为基础类型,other basic kinds are available for the concrete types like `uint8`)。一个无类型值可以赋值给一个从基础类型中派生的具名类型;例如: ``` type someType int const untyped = 2 // UntypedInt -const bar someType = untyped // OK: untyped can be assigned to someType +const bar someType = untyped // OK: untyped 可以被赋值给 someType const typed int = 2 // int -const bar2 someType = typed // error: int cannot be assigned to someType +const bar2 someType = typed // error: int 不能被赋值给 someType ``` ### 接口和对象 From 21712e7b526efe9dbfb5097053d1a3ea87a3ad9f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 17:20:38 +0800 Subject: [PATCH 0529/4278] TSL:20180302 How to manage your workstation configuration with Ansible.md --- ... workstation configuration with Ansible.md | 170 ------------------ ... workstation configuration with Ansible.md | 143 +++++++++++++++ 2 files changed, 143 insertions(+), 170 deletions(-) delete mode 100644 sources/tech/20180302 How to manage your workstation configuration with Ansible.md create mode 100644 translated/tech/20180302 How to manage your workstation configuration with Ansible.md diff --git a/sources/tech/20180302 How to manage your workstation configuration with Ansible.md b/sources/tech/20180302 How to manage your workstation configuration with Ansible.md deleted file mode 100644 index fd24cd48ed..0000000000 --- a/sources/tech/20180302 How to manage your workstation configuration with Ansible.md +++ /dev/null @@ -1,170 +0,0 @@ -How to manage your workstation configuration with Ansible -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) - -Configuration management is a very important aspect of both server administration and DevOps. The "infrastructure as code" methodology makes it easy to deploy servers in various configurations and dynamically scale an organization's resources to keep up with user demands. But less attention is paid to individual administrators who want to automate the setup of their own laptops and desktops (workstations). - -In this series, I'll show you how to automate your workstation setup via [Ansible][1] , which will allow you to easily restore your entire configuration if you want or need to reload your machine. In addition, if you have multiple workstations, you can use this same approach to make the configuration identical on each. In this first article, we'll set up basic configuration management for our personal or work computers and set the foundation for the rest of the series. By the end of this article, you'll have a working setup to benefit from right away. Each article will automate more things and grow in complexity. - -### Why Ansible? - -Many configuration management solutions are available, including Salt Stack, Chef, and Puppet. I prefer Ansible because it's lighter in terms of resource utilization, its syntax is easier to read, and when harnessed properly it can revolutionize your configuration management. Ansible's lightweight nature is especially relevant to the topic at hand, because we may not want to run an entire server just to automate the setup of our laptops and desktops. Ideally, we want something fast; something we can use to get up and running quickly should we need to restore our workstations or synchronize our configuration between multiple machines. My specific method for Ansible (which I'll demonstrate in this article) is perfect for this—there's no server to maintain. You just download your configuration and run it. - -### My approach - -Typically, Ansible is run from a central server. It utilizes an inventory file, which is a text file that contains a list of all the hosts and their IP addresses or domain names we want Ansible to manage. This is great for static environments, but it is not ideal for workstations. The reason being we really don't know what the status of our workstations will be at any one moment. Perhaps I powered down my desktop or my laptop may be suspended and stowed in my bag. In either case, the Ansible server would complain, as it can't reach my machines if they are offline. We need something that's more of an on-demand approach, and the way we'll accomplish that is by utilizing `ansible-pull`. The `ansible-pull` command, which is part of Ansible, allows you to download your configuration from a Git repository and apply it immediately. You won't need to maintain a server or an inventory list; you simply run the `ansible-pull` command, feed it a Git repository URL, and it will do the rest for you. - -### Getting started - -First, install Ansible on the computer you want it to manage. One problem is that a lot of distributions ship with an older version. I can tell you from experience you'll definitely want the latest version available. New features are introduced into Ansible quite frequently, and if you're running an older version, example syntax you find online may not be functional because it's using features that aren't implemented in the version you have installed. Even point releases have quite a few new features. One example of this is the `dconf` module, which is new to Ansible as of 2.4. If you try to utilize syntax that makes use of this module, unless you have 2.4 or newer it will fail. In Ubuntu and its derivatives, we can easily install the latest version of Ansible with the official personal package archive ([PPA][2]). The following commands will do the trick: -``` -sudo apt-get install software-properties-common - -sudo apt-add-repository ppa:ansible/ansible - -sudo apt-get update - -sudo apt-get install ansible - -``` - -If you're not using Ubuntu, [consult Ansible's documentation][3] on how to obtain it for your platform. - -Next, we'll need a Git repository to hold our configuration. The easiest way to satisfy this requirement is to create an empty repository on GitHub, or you can utilize your own Git server if you have one. To keep things simple, I'll assume you're using GitHub, so adjust the commands if you're using something else. Create a repository in GitHub; you'll end up with a repository URL that will be similar to this: -``` -git@github.com:/ansible.git - -``` - -Clone that repository to your local working directory (ignore any message that complains that the repository is empty): -``` -git clone git@github.com:/ansible.git - -``` - -Now we have an empty repository we can work with. Change your working directory to be inside the repository (`cd ./ansible` for example) and create a file named `local.yml` in your favorite text editor. Place the following configuration in that file: -``` -- hosts: localhost - -  become: true - -  tasks: - -  - name: Install htop - -    apt: name=htop - -``` - -The file you just created is known as a **playbook** , and the instruction to install `htop` (a package I arbitrarily picked to serve as an example) is known as a **play**. The playbook itself is a file in the YAML format, which is a simple to read markup language. A full walkthrough of YAML is beyond the scope of this article, but you don't need to have an expert understanding of it to be proficient with Ansible. The configuration is easy to read; by simply looking at this file, you can easily glean that we're installing the `htop` package. Pay special attention to the `apt` module on the last line, which will only work on Debian-based systems. You can change this to `yum` instead of `apt` if you're using a Red Hat platform or change it to `dnf` if you're using Fedora. The `name` line simply gives information regarding our task and will be shown in the output. Therefore, you'll want to make sure the name is descriptive so it's easy to find if you need to troubleshoot multiple plays. - -Next, let's commit our new file to our repository: -``` -git add local.yml - -git commit -m "initial commit" - -git push origin master - -``` - -Now our new playbook should be present in our repository on GitHub. We can apply the playbook we created with the following command: -``` -sudo ansible-pull -U https://github.com//ansible.git - -``` - -If executed properly, the `htop` package should be installed on your system. You might've seen some warnings near the beginning that complain about the lack of an inventory file. This is fine, as we're not using an inventory file (nor do we need to for this use). At the end of the output, it will give you an overview of what it did. If `htop` was installed properly, you should see `changed=1` on the last line of the output. - -How did this work? The `ansible-pull` command uses the `-U` option, which expects a repository URL. I gave it the `https` version of the repository URL for security purposes because I don't want any hosts to have write access back to the repository (`https` is read-only by default). The `local.yml` playbook name is assumed, so we didn't need to provide a filename for the playbook—it will automatically run a playbook named `local.yml` if it finds it in the repository's root. Next, we used `sudo` in front of the command since we are modifying the system. - -Let's go ahead and add additional packages to our playbook. I'll add two additional packages so that it looks like this: -``` -- hosts: localhost - -  become: true - -  tasks: - -  - name: Install htop - -    apt: name=htop - - - -  - name: Install mc - -    apt: name=mc - -    - -  - name: Install tmux - -    apt: name=tmux - -``` - -I added additional plays (tasks) for installing two other packages, `mc` and `tmux`. It doesn't matter what packages you choose to have this playbook install; I just picked these arbitrarily. You should install whichever packages you want all your systems to have. The only caveat is that you have to know that the packages exist in the repository for your distribution ahead of time. - -Before we commit and apply this updated playbook, we should clean it up. It will work fine as it is, but (to be honest) it looks kind of messy. Let's try installing all three packages in just one play. Replace the contents of your `local.yml` with this: -``` -- hosts: localhost - -  become: true - -  tasks: - -  - name: Install packages - -    apt: name={{item}} - -    with_items: - -      - htop - -      - mc - -      - tmux - -``` - -Now that looks cleaner and more efficient. We used `with_items` to consolidate our package list into one play. If we want to add additional packages, we simply add another line with a hyphen and a package name. Consider `with_items` to be similar to a `for` loop. Every package we list will be installed. - -Commit our new changes back to the repository: -``` -git add local.yml - -git commit -m "added additional packages, cleaned up formatting" - -git push origin master - -``` - -Now we can run our playbook to benefit from the new configuration: -``` -sudo ansible-pull -U https://github.com//ansible.git - -``` - -Admittedly, this example doesn't do much yet; all it does is install a few packages. You could've installed these packages much faster just using your package manager. However, as this series continues, these examples will become more complex and we'll automate more things. By the end, the Ansible configuration you'll create will automate more and more tasks. For example, the one I use automates the installation of hundreds of packages, sets up `cron` jobs, handles desktop configuration, and more. - -From what we've accomplished so far, you can probably already see the big picture. All we had to do was create a repository, put a playbook in that repository, then utilize the `ansible-pull` command to pull down that repository and apply it to our machine. We didn't need to set up a server. In the future, if we want to change our config, we can pull down the repo, update it, then push it back to our repository and apply it. If we're setting up a new machine, we only need to install Ansible and apply the configuration. - -In the next article, we'll automate this even further via `cron` and some additional items. In the meantime, I've copied the code for this article into [my GitHub repository][4] so you can check your syntax against mine. I'll update the code as we go along. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/manage-workstation-ansible - -作者:[Jay LaCroix][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/jlacroix -[1]:https://www.ansible.com/ -[2]:https://launchpad.net/ubuntu/+ppas -[3]:http://docs.ansible.com/ansible/latest/intro_installation.html -[4]:https://github.com/jlacroix82/ansible_article diff --git a/translated/tech/20180302 How to manage your workstation configuration with Ansible.md b/translated/tech/20180302 How to manage your workstation configuration with Ansible.md new file mode 100644 index 0000000000..e987e4a05a --- /dev/null +++ b/translated/tech/20180302 How to manage your workstation configuration with Ansible.md @@ -0,0 +1,143 @@ +如何使用 Ansible 管理你的工作站配置 +====== + +> 在这个系列的第一篇中,学习一下管理笔记本电脑和台式机配置的基础。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) + +配置管理是服务器管理和 DevOps 的一个非常重要的方面。“基础架构即代码infrastructure as code”方法可以轻松地以各种配置部署服务器,并动态扩展组织的资源以满足用户需求。但是,对于希望自动设置自己的笔记本电脑和台式机(工作站)的个人管理员的关注较少。 + +在本系列中,我将向你展示如何通过 [Ansible][1] 自动化你的工作站设置,如果你需要或需要重新安装你的机器,这可以让你轻松恢复整个配置。此外,如果你有多个工作站,则可以使用相同的方法在每个工作站上进行相同的配置。在第一篇文章中,我们将为个人或工作计算机设置基本的配置管理,并为本系列的其余部分奠定基础。到本文结束时,你将会因此得到一个可以运作的设置。每篇文章都会自动化更多内容并增加复杂性。 + +### 为什么用 Ansible? + +有许多配置管理解决方案,包括 Salt Stack、Chef 和 Puppet。我更喜欢 Ansible,因为它在资源利用方面更轻量级,语法更容易阅读,并且如果正确使用它可以彻底改变你的配置管理。Ansible 的轻量级特性与这个主题特别相关,因为我们可能不希望运行一整台服务器只是为了自动化我们的笔记本电脑和台式机的设置。一般我们总是想要快一些;我们可以使用某些东西来快速启动和运行,以在我们需要恢复的工作站或在多台机器之间同步我们的配置。我使用 Ansible 的具体方法(我将在本文中演示)非常适用于此:不需要服务器维护。你只需下载配置并运行它。 + +### 我的方法 + +通常,Ansible 运行于中央服务器。它使用一个库存清单inventory文件,该文件是一个文本文件,其中包含我们希望 Ansible 管理的所有主机及其 IP 地址或域名的列表。这对于静态环境非常有用,但对于工作站来说并不理想。原因是我们真的不知道我们的工作站在任一时刻的状态。也许我关闭了台式电脑或笔记本电脑可能会被挂起并放在我的包里。在任何一种情况下,Ansible 服务器都会抱怨,因为如果它们处于脱机状态,它就无法联系到我的机器。我们更需要的是按需方式,我们通过利用 `ansible-pull` 来实现这一目标。`ansible-pull` 命令是 Ansible 的一部分,允许你从 Git 仓库下载配置并立即应用它。你不需要维护服务器或库存清单;你只需运行 `ansible-pull` 命令,给它一个 Git 仓库 URL,它将为你完成剩下的工作。 + +### 起步 + +首先,在要管理的计算机上安装 Ansible。有一个问题是许多发行版都附带了旧版本的 Ansible。可以根据,你肯定希望获得最新版本。Ansible 中经常引入新功能,如果你运行的是旧版本,则你在网上找到的示例语法可能无法正常运行,因为它使用的功能未在你安装的版本中实现。甚至发布的小版本都有很多新功能。其中一个例子是 `dconf` 模块,它是从 Ansible 2.4 开始的新功能。如果你尝试使用使用此模块的语法,除非你使用 2.4 或更新版本,否则会失败。在 Ubuntu 及其衍生产品中,我们可以使用官方个人包存档([PPA][2])轻松安装最新版本的 Ansible。以下命令可以解决这个问题: + +``` +sudo apt-get install software-properties-common +sudo apt-add-repository ppa:ansible/ansible +sudo apt-get update +sudo apt-get install ansible +``` + +如果你没有使用 Ubuntu,请参阅 [Ansible 的文档][3] 了解如何为你的平台获取它。 + +接下来,我们需要一个 Git 仓库来保存我们的配置。满足此要求的最简单方法是在 GitHub 上创建一个空的仓库,或者如果有的话,也可以使用自己的 Git 服务器。为了简单起见,我假设你正在使用 GitHub,因此如果你正在使用其他仓库,请相应调整命令。在 GitHub 中创建一个仓库;你最终会得到一个与此类似的仓库 URL: + +``` +git@github.com:/ansible.git +``` +将该仓库克隆到你的本地工作目录(忽略任何抱怨仓库为空的消息): + +``` +git clone git@github.com:/ansible.git +``` + +现在我们有了一个可以使用的空仓库。将你的工作目录切换到仓库(例如 `cd ./ ansible`),并在你喜欢的文本编辑器中创建名为 `local.yml` 的文件。将以下配置放在该文件中: + +``` +- hosts: localhost +  become: true +  tasks: +  - name: Install htop +    apt: name=htop +``` + +你刚刚创建的文件被称为剧本playbook,安装 `htop` 的指令(我任意选择的一个包作为例子)被称为动作play。剧本本身是一个 YAML 格式的文件,它是一种易于阅读的标记语言。YAML 的完整讲述超出了本文的范围,但你无需专业理解即可熟练使用 Ansible。该配置易于阅读;只需查看此文件,你就可以轻松理解我们正在安装的 `htop` 软件包。要注意一下最后一行的 `apt` 模块,它只适用于基于 Debian 的系统。如果你使用的是 Red Hat 平台,你可以将其更改为 `yum` 而不是 `apt`,或者如果你正在使用 Fedora,则将其更改为 `dnf`。`name` 行只是提供有关我们任务的信息,并将显示在输出中。因此,你需要确保名称具有描述性,以便在需要对多个动作进行故障排除时很容易找到。 + +接下来,让我们将新文件提交到我们的仓库: + +``` +git add local.yml +git commit -m "initial commit" +git push origin master +``` + +现在我们的新剧本应该出现在我们的 GitHub 上的仓库中。我们可以使用以下命令应用我们创建的剧本: + +``` +sudo ansible-pull -U https://github.com//ansible.git +``` + +如果执行正确,`htop`包应该会安装在你的系统上。你可能会在开头附近看到一些警告,抱怨缺少库存清单文件。这很好,因为我们没有使用库存清单文件(我们也不需要这样做)。在输出结束时,它将概述它做的内容。如果 `htop` 安装正确,你应该在输出的最后一行看到 `changed = 1`。 + +它是如何工作的呢?`ansible-pull` 命令使用了 `-U` 选项,它需要一个存储库 URL。出于安全考虑,我给它提供了仓库 URL 的 https 版本,因为我不希望任何主机对仓库具有写访问权限(默认情况下 https 是只读的)。`local.yml` 是预设的剧本名称,因此我们不需要为剧本提供文件名:如果它在仓库的根目录中找到名为 `local.yml` 的剧本,它将自动运行它。接下来,我们在命令前面使用了 `sudo`,因为我们正在修改系统。 + +让我们继续为我们的剧本添加更多的包。我将添加两个包,使它看起来像这样: + +``` +- hosts: localhost +  become: true +  tasks: +  - name: Install htop +    apt: name=htop + +  - name: Install mc +    apt: name=mc +    +  - name: Install tmux +    apt: name=tmux +``` + +我添加了更多的动作(任务)来安装另外两个包,`mc` 和 `tmux`。在此剧本中选择安装的哪些软件包并不重要;我只是随意挑选这些。你应该安装你希望所有的系统都具有的软件包。唯一需要注意的是,在你分发前,你必须知道那个包存在于仓库中。 + +在我们提交并应用此更新的剧本之前,我们应该整理一下它。它可以很好地工作,但(说实话)它看起来有点混乱。让我们尝试在一个动作中安装所有三个包。用下面这个替换你的 `local.yml` 的内容: + +``` +- hosts: localhost +  become: true +  tasks: +  - name: Install packages +    apt: name={{item}} +    with_items: +      - htop +      - mc +      - tmux +``` + +现在看起来更干净、更有效率了。我们使用 `with_items` 将我们的包列表合并为一个动作。如果我们想要添加其他包,我们只需添加另一个带有连字符和包名称的行。可以把 `with_items` 看做类似于 `for` 循环。我们列出的每个包都将安装。 + +将我们的新更改提交回仓库: + +``` +git add local.yml +git commit -m "added additional packages, cleaned up formatting" +git push origin master +``` + +现在我们可以运行我们的剧本以接受新的新配置: + +``` +sudo ansible-pull -U https://github.com//ansible.git +``` + +不可否认,这个例子还没有做多少事情;它所做的就是安装一些软件包。你可以使用包管理器更快地安装这些包。然而,随着这个系列的继续,这些例子将变得更加复杂,我们将自动化更多的东西。最后,你将创建的 Ansible 配置将自动执行越来越多的任务。例如,我自己使用的那个可以自动安装数百个软件包,设置cron 作业,处理桌面配置等等。 + +从我们迄今为止所取得的成就来看,你可能已经有了大概了解。我们所要做的就是创建一个仓库,在该仓库中放置一个剧本,然后利用 `ansible-pull` 命令下拉该仓库并将其应用到我们的机器上。我们不需要设置服务器。将来,如果我们想要更改配置,我们可以拉取该仓库、更新它,然后将其推回到我们的仓库并应用它。如果我们要设置新机器,我们只需要安装 Ansible 并应用配置。 + +在下一篇文章中,我们将通过 cron 和一些其他项目进一步自动化。与此同时,我已将本文的代码复制到 +[我的 GitHub 仓库][4] 中,以便你可以用你的语法对比一下我的。随着我们的进展,我会不断更新代码。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/3/manage-workstation-ansible + +作者:[Jay LaCroix][a] +译者:[wxy](https://github.com/) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jlacroix +[1]:https://www.ansible.com/ +[2]:https://launchpad.net/ubuntu/+ppas +[3]:http://docs.ansible.com/ansible/latest/intro_installation.html +[4]:https://github.com/jlacroix82/ansible_article From 957fe94834b85d4098102f319cedc6b11e6e0d7d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 22:49:26 +0800 Subject: [PATCH 0530/4278] PRF:20180302 How to manage your workstation configuration with Ansible.md @wxy --- ... workstation configuration with Ansible.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/translated/tech/20180302 How to manage your workstation configuration with Ansible.md b/translated/tech/20180302 How to manage your workstation configuration with Ansible.md index e987e4a05a..017be8fefa 100644 --- a/translated/tech/20180302 How to manage your workstation configuration with Ansible.md +++ b/translated/tech/20180302 How to manage your workstation configuration with Ansible.md @@ -1,25 +1,25 @@ 如何使用 Ansible 管理你的工作站配置 ====== -> 在这个系列的第一篇中,学习一下管理笔记本电脑和台式机配置的基础。 +> 在这个系列的第一篇中,学习一下管理笔记本电脑和台式机配置的基础内容。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) 配置管理是服务器管理和 DevOps 的一个非常重要的方面。“基础架构即代码infrastructure as code”方法可以轻松地以各种配置部署服务器,并动态扩展组织的资源以满足用户需求。但是,对于希望自动设置自己的笔记本电脑和台式机(工作站)的个人管理员的关注较少。 -在本系列中,我将向你展示如何通过 [Ansible][1] 自动化你的工作站设置,如果你需要或需要重新安装你的机器,这可以让你轻松恢复整个配置。此外,如果你有多个工作站,则可以使用相同的方法在每个工作站上进行相同的配置。在第一篇文章中,我们将为个人或工作计算机设置基本的配置管理,并为本系列的其余部分奠定基础。到本文结束时,你将会因此得到一个可以运作的设置。每篇文章都会自动化更多内容并增加复杂性。 +在本系列中,我将向你展示如何通过 [Ansible][1] 自动化你的工作站设置,如果你想要或需要重新安装你的机器,这可以让你轻松恢复整个配置。此外,如果你有多个工作站,则可以使用相同的方法在每个工作站上进行相同的配置。在第一篇文章中,我们将为个人或工作计算机设置基本的配置管理,并为本系列的其余部分奠定基础。到本文结束时,你将会因此得到一个可以工作的环境。本系列之后的每篇文章都会自动化更多内容并增加复杂性。 ### 为什么用 Ansible? -有许多配置管理解决方案,包括 Salt Stack、Chef 和 Puppet。我更喜欢 Ansible,因为它在资源利用方面更轻量级,语法更容易阅读,并且如果正确使用它可以彻底改变你的配置管理。Ansible 的轻量级特性与这个主题特别相关,因为我们可能不希望运行一整台服务器只是为了自动化我们的笔记本电脑和台式机的设置。一般我们总是想要快一些;我们可以使用某些东西来快速启动和运行,以在我们需要恢复的工作站或在多台机器之间同步我们的配置。我使用 Ansible 的具体方法(我将在本文中演示)非常适用于此:不需要服务器维护。你只需下载配置并运行它。 +有许多配置管理解决方案,包括 Salt Stack、Chef 和 Puppet。我更喜欢 Ansible,因为它在资源利用方面更轻量级,语法更容易阅读,并且如果正确使用它可以彻底改变你的配置管理。Ansible 的轻量级特性与这个主题特别相关,因为我们可能不希望运行一整台服务器而只是为了自动化我们的笔记本电脑和台式机的设置。一般我们总是想要快一些;我们可以使用某些东西来快速启动和运行,以在我们需要恢复的工作站或在多台机器之间同步我们的配置。我使用 Ansible 的具体方法(我将在本文中演示)非常适用于此,而不需要维护服务器。你只需下载配置并运行它。 ### 我的方法 -通常,Ansible 运行于中央服务器。它使用一个库存清单inventory文件,该文件是一个文本文件,其中包含我们希望 Ansible 管理的所有主机及其 IP 地址或域名的列表。这对于静态环境非常有用,但对于工作站来说并不理想。原因是我们真的不知道我们的工作站在任一时刻的状态。也许我关闭了台式电脑或笔记本电脑可能会被挂起并放在我的包里。在任何一种情况下,Ansible 服务器都会抱怨,因为如果它们处于脱机状态,它就无法联系到我的机器。我们更需要的是按需方式,我们通过利用 `ansible-pull` 来实现这一目标。`ansible-pull` 命令是 Ansible 的一部分,允许你从 Git 仓库下载配置并立即应用它。你不需要维护服务器或库存清单;你只需运行 `ansible-pull` 命令,给它一个 Git 仓库 URL,它将为你完成剩下的工作。 +通常,Ansible 运行于中央服务器。它使用一个库存清单inventory文件,该文件是一个文本文件,其中包含我们希望 Ansible 管理的所有主机及其 IP 地址或域名的列表。这对于静态环境非常有用,但对于工作站来说并不理想。原因是我们真的不知道我们的工作站在某一时刻的状态。也许我关闭了台式电脑,或者笔记本电脑可能会被挂起并放在我的包里。在任何一种情况下,Ansible 服务器都会抱怨,因为如果它们处于脱机状态,Ansible 就无法联系到我的机器。我们更需要的是按需方式,我们通过利用 `ansible-pull` 来实现这一目标。`ansible-pull` 命令是 Ansible 的一个命令,允许你从 Git 仓库下载配置并立即应用它。你不需要维护服务器或库存清单;你只需运行 `ansible-pull` 命令,给它一个 Git 仓库 URL,它将为你完成剩下的工作。 ### 起步 -首先,在要管理的计算机上安装 Ansible。有一个问题是许多发行版都附带了旧版本的 Ansible。可以根据,你肯定希望获得最新版本。Ansible 中经常引入新功能,如果你运行的是旧版本,则你在网上找到的示例语法可能无法正常运行,因为它使用的功能未在你安装的版本中实现。甚至发布的小版本都有很多新功能。其中一个例子是 `dconf` 模块,它是从 Ansible 2.4 开始的新功能。如果你尝试使用使用此模块的语法,除非你使用 2.4 或更新版本,否则会失败。在 Ubuntu 及其衍生产品中,我们可以使用官方个人包存档([PPA][2])轻松安装最新版本的 Ansible。以下命令可以解决这个问题: +首先,在要管理的计算机上安装 Ansible。有一个问题是许多发行版都附带了旧版本的 Ansible。根据经验,你肯定希望获得最新版本。Ansible 中经常引入新功能,如果你运行的是旧版本,则你在网上找到的示例语法可能无法正常运行,因为它使用的功能未在你安装的版本中实现。甚至发布的小版本都有很多新功能。其中一个例子是 `dconf` 模块,它是从 Ansible 2.4 开始的新功能。如果你尝试使用使用此模块的语法,除非你使用 2.4 或更新版本,否则会失败。在 Ubuntu 及其衍生产品中,我们可以使用官方个人包存档([PPA][2])轻松安装最新版本的 Ansible。以下命令可以解决这个问题: ``` sudo apt-get install software-properties-common @@ -35,13 +35,14 @@ sudo apt-get install ansible ``` git@github.com:/ansible.git ``` + 将该仓库克隆到你的本地工作目录(忽略任何抱怨仓库为空的消息): ``` git clone git@github.com:/ansible.git ``` -现在我们有了一个可以使用的空仓库。将你的工作目录切换到仓库(例如 `cd ./ ansible`),并在你喜欢的文本编辑器中创建名为 `local.yml` 的文件。将以下配置放在该文件中: +现在我们有了一个可以使用的空仓库。将你的工作目录切换到仓库(例如 `cd ./ansible`),并在你喜欢的文本编辑器中创建名为 `local.yml` 的文件。将以下配置放在该文件中: ``` - hosts: localhost @@ -51,7 +52,7 @@ git clone git@github.com:/ansible.git     apt: name=htop ``` -你刚刚创建的文件被称为剧本playbook,安装 `htop` 的指令(我任意选择的一个包作为例子)被称为动作play。剧本本身是一个 YAML 格式的文件,它是一种易于阅读的标记语言。YAML 的完整讲述超出了本文的范围,但你无需专业理解即可熟练使用 Ansible。该配置易于阅读;只需查看此文件,你就可以轻松理解我们正在安装的 `htop` 软件包。要注意一下最后一行的 `apt` 模块,它只适用于基于 Debian 的系统。如果你使用的是 Red Hat 平台,你可以将其更改为 `yum` 而不是 `apt`,或者如果你正在使用 Fedora,则将其更改为 `dnf`。`name` 行只是提供有关我们任务的信息,并将显示在输出中。因此,你需要确保名称具有描述性,以便在需要对多个动作进行故障排除时很容易找到。 +你刚刚创建的文件被称为剧本playbook,安装 `htop` 的指令(我任意选择的一个包作为例子)被称为动作play。剧本本身是一个 YAML 格式的文件,它是一种易于阅读的标记语言。对 YAML 的完整讲述超出了本文的范围,但你无需专业理解即可熟练使用 Ansible。该配置易于阅读;只需查看此文件,你就可以轻松理解我们正在安装的 `htop` 软件包。要注意一下最后一行的 `apt` 模块,它只适用于基于 Debian 的系统。如果你使用的是 Red Hat 平台,你可以将其更改为 `yum` 而不是 `apt`,或者如果你正在使用 Fedora,则将其更改为 `dnf`。`name` 行只是提供有关我们任务的信息,并将显示在输出中。因此,你需要确保名称具有描述性,以便在需要对多个动作进行故障排除时很容易找到。 接下来,让我们将新文件提交到我们的仓库: @@ -69,7 +70,7 @@ sudo ansible-pull -U https://github.com//ansible.git 如果执行正确,`htop`包应该会安装在你的系统上。你可能会在开头附近看到一些警告,抱怨缺少库存清单文件。这很好,因为我们没有使用库存清单文件(我们也不需要这样做)。在输出结束时,它将概述它做的内容。如果 `htop` 安装正确,你应该在输出的最后一行看到 `changed = 1`。 -它是如何工作的呢?`ansible-pull` 命令使用了 `-U` 选项,它需要一个存储库 URL。出于安全考虑,我给它提供了仓库 URL 的 https 版本,因为我不希望任何主机对仓库具有写访问权限(默认情况下 https 是只读的)。`local.yml` 是预设的剧本名称,因此我们不需要为剧本提供文件名:如果它在仓库的根目录中找到名为 `local.yml` 的剧本,它将自动运行它。接下来,我们在命令前面使用了 `sudo`,因为我们正在修改系统。 +它是如何工作的呢?`ansible-pull` 命令使用了 `-U` 选项,它需要一个仓库 URL。出于安全考虑,我给它提供了仓库 URL 的 https 版本,因为我不希望任何主机对仓库具有写访问权限(默认情况下 https 是只读的)。`local.yml` 是预设的剧本名称,因此我们不需要为剧本提供文件名:如果它在仓库的根目录中找到名为 `local.yml` 的剧本,它将自动运行它。接下来,我们在命令前面使用了 `sudo`,因为我们正在修改系统。 让我们继续为我们的剧本添加更多的包。我将添加两个包,使它看起来像这样: @@ -87,9 +88,9 @@ sudo ansible-pull -U https://github.com//ansible.git     apt: name=tmux ``` -我添加了更多的动作(任务)来安装另外两个包,`mc` 和 `tmux`。在此剧本中选择安装的哪些软件包并不重要;我只是随意挑选这些。你应该安装你希望所有的系统都具有的软件包。唯一需要注意的是,在你分发前,你必须知道那个包存在于仓库中。 +我添加了更多的动作(任务)来安装另外两个包,`mc` 和 `tmux`。在此剧本中选择安装的哪些软件包并不重要;我只是随意挑选这些。你应该安装你希望所有的系统都具有的软件包。唯一需要注意的是,在你分发前,你必须知道那个包存在于软件仓库中。 -在我们提交并应用此更新的剧本之前,我们应该整理一下它。它可以很好地工作,但(说实话)它看起来有点混乱。让我们尝试在一个动作中安装所有三个包。用下面这个替换你的 `local.yml` 的内容: +在我们提交并应用这个更新的剧本之前,我们应该整理一下它。它可以很好地工作,但(说实话)它看起来有点混乱。让我们尝试在一个动作中安装所有三个包。用下面这个替换你的 `local.yml` 的内容: ``` - hosts: localhost @@ -119,9 +120,9 @@ git push origin master sudo ansible-pull -U https://github.com//ansible.git ``` -不可否认,这个例子还没有做多少事情;它所做的就是安装一些软件包。你可以使用包管理器更快地安装这些包。然而,随着这个系列的继续,这些例子将变得更加复杂,我们将自动化更多的东西。最后,你将创建的 Ansible 配置将自动执行越来越多的任务。例如,我自己使用的那个可以自动安装数百个软件包,设置cron 作业,处理桌面配置等等。 +不可否认,这个例子还没有做多少事情;它所做的就是安装一些软件包。你可以使用包管理器更快地安装这些包。然而,随着这个系列的继续,这些例子将变得更加复杂,我们将自动化更多的东西。最后,你创建的 Ansible 配置将自动执行越来越多的任务。例如,我自己使用的那个配置可以自动安装数百个软件包、设置cron 作业、处理桌面配置等等。 -从我们迄今为止所取得的成就来看,你可能已经有了大概了解。我们所要做的就是创建一个仓库,在该仓库中放置一个剧本,然后利用 `ansible-pull` 命令下拉该仓库并将其应用到我们的机器上。我们不需要设置服务器。将来,如果我们想要更改配置,我们可以拉取该仓库、更新它,然后将其推回到我们的仓库并应用它。如果我们要设置新机器,我们只需要安装 Ansible 并应用配置。 +从我们迄今为止所取得的成就来看,你可能已经有了大概了解。我们所要做的就是创建一个仓库,在该仓库中放置一个剧本,然后利用 `ansible-pull` 命令拉取该仓库并将其应用到我们的机器上。我们不需要设置服务器。将来,如果我们想要更改配置,我们可以拉取该仓库、更新它,然后将其推回到我们的仓库并应用它。如果我们要设置新机器,我们只需要安装 Ansible 并应用配置。 在下一篇文章中,我们将通过 cron 和一些其他项目进一步自动化。与此同时,我已将本文的代码复制到 [我的 GitHub 仓库][4] 中,以便你可以用你的语法对比一下我的。随着我们的进展,我会不断更新代码。 @@ -132,7 +133,7 @@ via: https://opensource.com/article/18/3/manage-workstation-ansible 作者:[Jay LaCroix][a] 译者:[wxy](https://github.com/) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1cbe2cf36175cff70fad37034551149d489d7a04 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 22:49:59 +0800 Subject: [PATCH 0531/4278] PUB:20180302 How to manage your workstation configuration with Ansible.md @wxy https://linux.cn/article-10434-1.html --- ...2 How to manage your workstation configuration with Ansible.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180302 How to manage your workstation configuration with Ansible.md (100%) diff --git a/translated/tech/20180302 How to manage your workstation configuration with Ansible.md b/published/20180302 How to manage your workstation configuration with Ansible.md similarity index 100% rename from translated/tech/20180302 How to manage your workstation configuration with Ansible.md rename to published/20180302 How to manage your workstation configuration with Ansible.md From f64dd70496bf538405613adedfb9eaf0fb9dde30 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 10:43:19 +0800 Subject: [PATCH 0532/4278] PRF:20181210 Snake your way across your Linux terminal.md @geekpi --- ...nake your way across your Linux terminal.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181210 Snake your way across your Linux terminal.md b/translated/tech/20181210 Snake your way across your Linux terminal.md index a9525a9970..d2fc1961a6 100644 --- a/translated/tech/20181210 Snake your way across your Linux terminal.md +++ b/translated/tech/20181210 Snake your way across your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Snake your way across your Linux terminal) @@ -9,16 +9,18 @@ 在 Linux 终端中玩贪吃蛇 ====== -有了这个 20 世纪 70 年代的经典重制游戏,Python 将不再是你在 Linux 终端能发现的唯一的“蛇”。 + +> 有了这个 20 世纪 70 年代的经典重制游戏,Python 将不再是你在 Linux 终端能发现的唯一的“蛇”。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-snake.png?itok=oNhqUTDu) -欢迎回到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己甚至是命令行玩具。这很难确切地说,但我的定义是任何可以帮助你在终端玩得开心的东西。 +欢迎回到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问什么是命令行玩具。这很难确切地说,但我的定义是任何可以帮助你在终端玩得开心的东西。 我们这周都在介绍游戏,这很有趣,接着让我们看下今天的游戏,贪吃蛇! -贪吃蛇是一个古老又很好的游戏。它的版本似乎一直存在着。我记得我第一次玩得版本是 20 世纪 90 年代与 [QBasic][2] 一起打包发布的 [Nibbles][1],它对我理解什么是编程语言起了很重要的作用。我有游戏的源码,我可以修改并查看会发生什么,并学习到一些组成这个编程语言的有趣词汇究竟是什么意思。 +贪吃蛇是一个古老又很好的游戏,这些年一直有各种版本。我记得我第一次玩得版本是 20 世纪 90 年代与 [QBasic][2] 一起打包发布的 [Nibbles][1],它对我理解什么是编程语言起了很重要的作用。我有游戏的源码,我可以修改并查看会发生什么,并学习到一些组成这个编程语言的有趣词汇究竟是什么意思。 -今天的[贪吃蛇][3]是用 Go 写的,它很简单并且和原版的游戏一样有趣。像大多数简单的老游戏一样,它有很多版本可供选择。这今天的贪吃蛇中,甚至还有一个经典的 [bsdgames][4] 形式的包,它几乎一定为你的发行版打包了。 +今天的[贪吃蛇][3]是用 Go 写的,它很简单并且和原版的游戏一样有趣。像大多数简单的老游戏一样,它有很多版本可供选择。这今天的贪吃蛇中,甚至还有一个经典的 [bsdgames][4] 形式的包,它的发行版几乎一定有它。 但我喜欢的是用 Docker 打包的贪吃蛇,因为我可以轻松地在命令行中运行,而不用担心发行版相关的问题。这个版本使用 15 个随机的食物 emoji 图案让蛇来吃。我玩得不好。不管怎样,请试一下: @@ -27,7 +29,9 @@ $ docker run -ti dyego/snake-game ``` 这个贪吃蛇以 MIT 许可证开源,你可在 [Github][3] 取得源码。 + ![](https://opensource.com/sites/default/files/uploads/linux-toy-snake-animated.gif) + 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 请查看昨天的玩具,[数字 2 的力量,Linux 的力量:在命令行中玩 2048][5],记得明天再来! @@ -39,7 +43,7 @@ via: https://opensource.com/article/18/12/linux-toy-snake 作者:[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/) 荣誉推出 @@ -49,4 +53,4 @@ via: https://opensource.com/article/18/12/linux-toy-snake [2]: https://en.wikipedia.org/wiki/QBasic [3]: https://github.com/DyegoCosta/snake-game [4]: https://github.com/vattam/BSDGames -[5]: https://opensource.com/article/18/12/linux-toy-2048 \ No newline at end of file +[5]: https://opensource.com/article/18/12/linux-toy-2048 From 739dae228527979915cf07a52d9a85708373b18f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 10:43:37 +0800 Subject: [PATCH 0533/4278] PUB:20181210 Snake your way across your Linux terminal.md @geekpi https://linux.cn/article-10435-1.html --- .../20181210 Snake your way across your Linux terminal.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181210 Snake your way across your Linux terminal.md (100%) diff --git a/translated/tech/20181210 Snake your way across your Linux terminal.md b/published/20181210 Snake your way across your Linux terminal.md similarity index 100% rename from translated/tech/20181210 Snake your way across your Linux terminal.md rename to published/20181210 Snake your way across your Linux terminal.md From 466f3d2042e3c5b6109c0ff68df1295530182e1a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 10:44:21 +0800 Subject: [PATCH 0534/4278] PUB:20181210 Snake your way across your Linux terminal.md @geekpi https://linux.cn/article-10435-1.html --- .../20181210 Snake your way across your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20181210 Snake your way across your Linux terminal.md b/published/20181210 Snake your way across your Linux terminal.md index d2fc1961a6..3e2a22209c 100644 --- a/published/20181210 Snake your way across your Linux terminal.md +++ b/published/20181210 Snake your way across your Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10435-1.html) [#]: subject: (Snake your way across your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-snake) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 4d6eb09e2f628efa33d10b0b533a70627d822b01 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 15:30:31 +0800 Subject: [PATCH 0535/4278] PRF:20181223 The Linux command line can fetch fun from afar.md @geekpi --- ...Linux command line can fetch fun from afar.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181223 The Linux command line can fetch fun from afar.md b/translated/tech/20181223 The Linux command line can fetch fun from afar.md index d9f64745f3..480736aeb7 100644 --- a/translated/tech/20181223 The Linux command line can fetch fun from afar.md +++ b/translated/tech/20181223 The Linux command line can fetch fun from afar.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The Linux command line can fetch fun from afar) @@ -9,7 +9,9 @@ 能从远程获得乐趣的 Linux 命令 ====== -使用这些工具从远程了解天气、阅读资料等。 + +> 使用这些工具从远程了解天气、阅读资料等。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi) 我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你有一直在看,如果没有,请回到[开始][1],从头看过来。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。 @@ -24,11 +26,11 @@ $ telnet towel.blinkenlights.nl ``` -我第一次看到它是十年之前,因此我对于它还存在优点惊奇。如果你还没看过,请留出一点时间看一下。你不会后悔的。 +我第一次看到它是十年之前,因此我对于它还存在有点惊奇。如果你还没看过,请留出一点时间看一下。你不会后悔的。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png) -接下来,Opensource.com 的撰稿人 [Manuel Dewald][2] 提出了一种从终端获取当地天气的方法。它很简单,你只需安装 **curl**(或者,**wget**)。 +接下来,Opensource.com 的撰稿人 [Manuel Dewald][2] 提出了一种从终端获取当地天气的方法。它很简单,你只需安装 `curl`(或者,`wget`)。 ``` $ curl wttr.in @@ -36,7 +38,7 @@ $ curl wttr.in ![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png) -最后,在假期中虽然你可以从[命令行 Web 浏览器][3]浏览你喜欢的网站(包括 Opensource.com),但有一些我最喜欢的网站可以通过专用客户端更轻松地浏览。其中两个是 Reddit 和 Hacker News,我被推荐过一些它们的客户端,你可能也想尝试,它们都使用开源许可。我尝试过 [haxor-news][4] (Hacker News) 和 [rtv][5] (Reddit),它们都还不错。 +最后,在假期中虽然你可以从[命令行 Web 浏览器][3]浏览你喜欢的网站(包括 Opensource.com),但有一些我最喜欢的网站可以通过专用客户端更轻松地浏览。其中两个是 Reddit 和 Hacker News,有人推荐给我一些它们的客户端,你可能也想尝试,它们都使用开源许可。我尝试过 [haxor-news][4] (Hacker News) 和 [rtv][5] (Reddit),它们都还不错。 你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。 @@ -49,7 +51,7 @@ via: https://opensource.com/article/18/12/linux-toy-remote 作者:[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/) 荣誉推出 @@ -60,4 +62,4 @@ via: https://opensource.com/article/18/12/linux-toy-remote [3]: https://opensource.com/article/16/12/web-browsers-linux-command-line [4]: https://github.com/donnemartin/haxor-news [5]: https://github.com/michael-lazar/rtv -[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl \ No newline at end of file +[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl From 0d8199c4b7045697f881dd8ab383b03d1a4f3099 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 15:31:25 +0800 Subject: [PATCH 0536/4278] PUB:20181223 The Linux command line can fetch fun from afar.md @geekpi https://linux.cn/article-10437-1.html --- ...20181223 The Linux command line can fetch fun from afar.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181223 The Linux command line can fetch fun from afar.md (97%) diff --git a/translated/tech/20181223 The Linux command line can fetch fun from afar.md b/published/20181223 The Linux command line can fetch fun from afar.md similarity index 97% rename from translated/tech/20181223 The Linux command line can fetch fun from afar.md rename to published/20181223 The Linux command line can fetch fun from afar.md index 480736aeb7..92b61d1721 100644 --- a/translated/tech/20181223 The Linux command line can fetch fun from afar.md +++ b/published/20181223 The Linux command line can fetch fun from afar.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10437-1.html) [#]: subject: (The Linux command line can fetch fun from afar) [#]: via: (https://opensource.com/article/18/12/linux-toy-remote) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 3c3d2ce32f40805c075ff48ae1e06bae0f356344 Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Sat, 12 Jan 2019 15:39:11 +0800 Subject: [PATCH 0537/4278] translated --- ...s To Find System-Server Uptime In Linux.md | 86 ++++++++++--------- 1 file changed, 46 insertions(+), 40 deletions(-) rename {sources => translated}/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md (51%) diff --git a/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md b/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md similarity index 51% rename from sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md rename to translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md index a2060fb130..68ca8a1371 100644 --- a/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md +++ b/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md @@ -1,27 +1,27 @@ -LuMing is translating -11 Methods To Find System/Server Uptime In Linux +Linux 上查看系统/服务器运行时间的 11 种方法 ====== -Do you want to know, how long your Linux system has been running without downtime? when the system is up and what date. +你是否想知道自己的 Linux 系统除宕机外正常运行了多长时间?系统什么时候启动以及现在的日期? -There are multiple commands is available in Linux to check server/system uptime and most of users prefer the standard and very famous command called `uptime` to get this details. +Linux 上有多个查看服务器/系统运行时间的命令,大多数用户喜欢使用标准并且很有名的 `uptime` 命令获取这些具体的信息。 -Server uptime is not important for some people but it’s very important for server administrators when the server running with mission-critical applications such as online shopping portal, netbanking portal, etc,. +服务器的运行时间对一些用户来说不那么重要,但是当服务器运行诸如在线商城门户portal、网上银行门户等关键任务应用mission-critical applications时,它对于服务器管理员server adminstrators来说就至关重要。 -It must be zero downtime because if there is a down time then it will impact badly to million users. +它必须做到 0 宕机,因为一旦停机就会影响到数百万用户。 -As i told, many commands are available to check server uptime in Linux. In this tutorial we are going teach you how to check this using below 11 methods. +正如我所说,许多命令都可以让用户看到 Linux 服务器的运行时间。在这篇教程里我会教你如何使用下面 11 种方式来查看。 -Uptime means how long the server has been up since its last shutdown or reboot. +正常运行时间uptime指的是服务器自从上次关闭或重启以来经过的时间。 -The uptime command the fetch the details from `/proc` files and print the server uptime, the `/proc` file is not directly readable by humans. +`uptime` 命令获取 `/proc` 文件中的详细信息并输出正常运行时间,`/proc` 文件不能直接读取。 -The below commands will print how long the system has been running and up. It also shows some additional information. +以下这些命令会输出系统运行和启动的时间。也会显示一些额外的信息。 -### Method-1 : Using uptime Command +### 方法 1:使用 uptime 命令 -uptime command will tell how long the system has been running. It gives a one line display of the following information. +`uptime` 命令会告诉你系统运行了多长时间。它会用一行显示以下信息。 + +当前时间,系统运行时间,当前登录用户的数量,过去 1 分钟、5 分钟、15 分钟系统负载的均值。 -The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes. ``` # uptime @@ -29,10 +29,9 @@ The current time, how long the system has been running, how many users are curre ``` -### Method-2 : Using w Command +### 方法 2:使用 w 命令 -w command provides a quick summary of every user logged into a computer, what each user is currently doing, -and what load all the activity is imposing on the computer itself. The command is a one-command combination of several other Unix programs: who, uptime, and ps -a. +`w` 命令为每个登录进系统的用户,每个用户当前所做的事情,所有活动的负载对计算机的影响提供了一个快速的概要。这个单一命令结合了多个 Unix 程序:who,uptime,和 ps -a。 ``` # w @@ -42,11 +41,11 @@ root pts/1 103.5.134.167 08:34 0.00s 0.01s 0.00s w ``` -### Method-3 : Using top Command +### 方法 3:使用 top 命令 -Top command is one of the basic command to monitor real-time system processes in Linux. It display system information and running processes information like uptime, average load, tasks running, number of users logged in, number of CPUs & cpu utilization, Memory & swap information. Run top command then hit E to bring the memory utilization in MB. +`top` 命令是 Linux 上监视实时系统进程的基础命令之一。它显示系统信息和运行进程的信息,例如正常运行时间,平均负载,运行的任务,登录用户数量,CPU 数量 & CPU 利用率,内存 & 交换空间信息。 -**Suggested Read :** [TOP Command Examples to Monitor Server Performance][1] +**推荐阅读:**[TOP 命令监视服务器性能的例子][1] ``` # top -c @@ -65,9 +64,10 @@ Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached ``` -### Method-4 : Using who Command +### 方法 4:使用 who 命令 + +`who` 命令列出当前登录进计算机的用户。`who` 命令与 `w` 命令类似,但后者还包含额外的数据和统计信息。 -who command displays a list of users who are currently logged into the computer. The who command is related to the command w, which provides the same information but also displays additional data and statistics. ``` # who -b @@ -75,9 +75,10 @@ system boot 2018-04-12 02:48 ``` -### Method-5 : Using last Command +### 方法 5:使用 last 命令 + +`last` 命令列出最近登录过的用户。`last` 往回查找 `/var/log/wtmp` 文件并显示自从文件创建后登录进(出)的用户。 -The last command displays a list of last logged in users. Last searches back through the file /var/log/wtmp and displays a list of all users logged in (and out) since that file was created. ``` # last reboot -F | head -1 | awk '{print $5,$6,$7,$8,$9}' @@ -85,11 +86,12 @@ Thu Apr 12 02:48:04 2018 ``` -### Method-6 : Using /proc/uptime File +### 方法 6:使用 /proc/uptime 文件 -This file contains information detailing how long the system has been on since its last restart. The output of `/proc/uptime` is quite minimal. +这个文件中包含系统上次启动后运行时间的详细信息。`/proc/uptime` 的输出相当精简。 + +第一个数字是系统自从启动的总秒数。第二个数字是总时间中系统空闲所花费的时间,以秒为单位。 -The first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds. ``` # cat /proc/uptime @@ -97,19 +99,21 @@ The first number is the total number of seconds the system has been up. The seco ``` -# date -d “$(Method-7 : Using tuptime Command +### 方法 7:使用 tuptime 命令 + +`tuptime` 是一个汇报系统运行时间的工具,输出历史信息并作以统计,保留重启之间的数据。和 `uptime` 命令很像,但输出更有意思一些。 -Tuptime is a tool for report the historical and statistical running time of the system, keeping it between restarts. Like uptime command but with more interesting output. ``` $ tuptime ``` -### Method-8 : Using htop Command +### 方法 8:使用 htop 命令 -htop is an interactive process viewer for Linux which was developed by Hisham using ncurses library. Htop have many of features and options compared to top command. +`htop` 是运行在 Linux 上一个由 Hisham 使用 ncurses 库开发的交互式进程查看器。`htop` 比起 `top` 有很多的特性和选项。 + +**推荐阅读:** [使用 Htop 命令监控系统资源][2] -**Suggested Read :** [Monitor system resources using Htop command][2] ``` # htop @@ -126,13 +130,13 @@ htop is an interactive process viewer for Linux which was developed by Hisham us ``` -### Method-9 : Using glances Command +### 方法 9:使用 glances 命令 -Glances is a cross-platform curses-based system monitoring tool written in Python. We can say all in one place, like maximum of information in a minimum of space. It uses psutil library to get information from your system. +`glances` 是一个跨平台基于 curses 使用 python 写的监控工具。我们可以说它非常强大,仅用一点空间就能获得很多信息。它使用 psutil 库从系统中获取信息。 -Glances capable to monitor CPU, Memory, Load, Process list, Network interface, Disk I/O, Raid, Sensors, Filesystem (and folders), Docker, Monitor, Alert, System info, Uptime, Quicklook (CPU, MEM, LOAD), etc,. +`glances` 可以监控 CPU,内存,负载,进程,网络接口,磁盘 I/O,磁盘阵列RAID,传感器,文件系统(与文件夹),容器,显示器,Alert 日志,系统信息,运行时间,快速查看Quicklook(CPU,内存等)。 -**Suggested Read :** [Glances (All in one Place)– An Advanced Real Time System Performance Monitoring Tool for Linux][3] +**推荐阅读:** [Glances (集大成)– Linux 上高级的实时系统运行监控工具][3] ``` glances @@ -157,9 +161,10 @@ sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox ``` -### Method-10 : Using stat Command +### 方法 10:使用 stat 命令 + +`stat` 命令显示指定文件或文件系统的详细状态。 -stat command displays the detailed status of a particular file or a file system. ``` # stat /var/log/dmesg | grep Modify @@ -167,9 +172,10 @@ Modify: 2018-04-12 02:48:04.027999943 -0400 ``` -### Method-11 : Using procinfo Command +### 方法 11:使用 procinfo 命令 + +`procinfo` 从 `/proc` 文件夹下收集一些系统数据并将其很好的格式化输出在标准输出设备上。 -procinfo gathers some system data from the /proc directory and prints it nicely formatted on the standard output device. ``` # procinfo | grep Bootup @@ -183,7 +189,7 @@ via: https://www.2daygeek.com/11-methods-to-find-check-system-server-uptime-in-l 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[LuuMing](https://github.com/LuuMing) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 74bf1a63035fea0cc74cb8ef90b7bf4d509734c6 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 12 Jan 2019 20:06:36 +0800 Subject: [PATCH 0538/4278] Translating --- ... Record Your Terminal Sessions As SVG Animations In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md index f25406a66a..7a50c13c20 100644 --- a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md +++ b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d6497e0eee7e47acb26c15e7c789affbc14f5020 Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Sat, 12 Jan 2019 21:47:53 +0800 Subject: [PATCH 0539/4278] Update 20171222 10 keys to quick game development.md XYenChi is translating --- sources/talk/20171222 10 keys to quick game development.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20171222 10 keys to quick game development.md b/sources/talk/20171222 10 keys to quick game development.md index 02f4388044..50c8164ae0 100644 --- a/sources/talk/20171222 10 keys to quick game development.md +++ b/sources/talk/20171222 10 keys to quick game development.md @@ -1,3 +1,4 @@ +XYenChi is translating 10 keys to quick game development ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) From 4dbebf2cdffebd4f0b9fa9f5f88ad8fb44e605a3 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 12 Jan 2019 22:01:08 +0800 Subject: [PATCH 0540/4278] Translated --- ...nal Sessions As SVG Animations In Linux.md | 107 +++++++++--------- 1 file changed, 52 insertions(+), 55 deletions(-) diff --git a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md index 7a50c13c20..45219568f8 100644 --- a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md +++ b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -7,96 +7,93 @@ [#]: via: (https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux +Termtosvg – 将你在 Linux 终端中操作录制成 SVG 动画 ====== -By default everyone prefer history command to review/recall the previously entered commands in terminal. +一般人喜欢使用历史命令功能来查看/再次调用之前在终端中输入的命令。 -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 中,有许多可以用来记录终端活动的实用工具。 -This tool will help us to record the users terminal activity, also will help us to identify other useful information from the output. +这种工具将会帮助我们记录用户在终端中的活动,并帮助我们识别输出中有用的信息。 -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]** and **[Terminalizer Tool][2]**. +如果你希望尝试其它一些记录你终端活动的工具,我推荐你试试 **[Script Command][1]** 和 **[Terminalizer Tool][2]**。 -But if you are looking for **[GIF Recorder][3]** then try **[Gifine][4]** , **[Kgif][5]** and **[Peek][6]** utilities. +不过,如果你在寻找 **[GIF 录制器][3]** ,你可以尝试 **[Gifine][4]** 、**[Kgif][5]** 和 **[Peek][6]** 。 -Script is one of the best utility to record your terminal session on headless server. +脚本是在无头服务器中记录终端活动的最佳方式之一。 -Script is a Unix command line utility that records a terminal session (in other terms, It’s record everything displayed on your terminal). +脚本是记录在终端中输入过的 Unix 命令的实用工具(在某些终端中,它会记录显示在你终端中的所有东西)。 -It stores the output in the current directory as a text file and the default file name is typescript. +它会在当前工作目录下以文本文件方式储存所有终端输出。 -### What is Termtosvg +### 什么是 Termtosvg -Termtosvg is a Unix terminal recorder written in Python that renders your command line sessions as standalone SVG animations. +Termtosvg 是一个用 Python 编写的 Unix 终端录制器,它可以将你的命令行会话保存为 SVG 动画。 -### Termtosvg Features +### Termtosvg 的特点 - * Produce lightweight and clean looking animations embeddable on a project page. - * Custom color themes, terminal UI and animation controls via SVG templates. - * Compatible with asciinema recording format. - * It requires Python >= 3.5 + * 可以制作用于某个项目主页且简洁美观的动画。 + * 可以在 SVG 模板中自定义配色、终端 UI 和动画。 + * 兼容 asciinema 录制格式。 + * 要求 Python 版本为 3.5 或更高。 + +### 如何在 Linux 中安装 Termtosvg +它是用 Python 编写的,所以我推荐使用 pip 来安装它。 +请确保你已经安装了 **python-pip** 包。如果你还没安装,请输入下面的命令。 +对于 Debian 或 Ubuntu 用户,请使用 **[apt][7]** 或 **[apt-get][8]** 来安装 pip。 -### How to Install Termtosvg In Linux - -It was written in Python and pip installation is a recommended method to install Termtosvg on Linux. - -Make sure you should have installed python-pip package on your system. If no, use the following command to install it. - -For Debian/Ubuntu users, use **[Apt Command][7]** or **[Apt-Get Command][8]** to install pip package. - -``` -$ sudo apt install python-pip +```shell +sudo apt install python-pip ``` -For Archlinux users, use **[Pacman Command][9]** to install pip package. +对于 Archlinux 用户,请使用 **[pacman][9]** 来安装 pip。 -``` -$ sudo pacman -S python-pip +```shell +sudo pacman -S python-pip ``` -For Fedora users, use **[DNF Command][10]** to install pip package. +对于 Fedora 用户,请使用 **[dnf][10]** 来安装 pip。 -``` -$ sudo dnf install python-pip +```shell +sudo dnf install python-pip ``` -For CentOS/RHEL users, use **[YUM Command][11]** to install pip package. +对于 CentOS 或 RHEL 用户,请使用 **[yum][11]** 来安装 pip。 -``` -$ sudo yum install python-pip +```shell +sudo yum install python-pip ``` -For openSUSE users, use **[Zypper Command][12]** to install pip package. +对于 openSUSE 用户,请使用 **[zypper][12]** 来安装 pip。 -``` -$ sudo zypper install python-pip +```shell +sudo zypper install python-pip ``` -Finally run the following **[pip command][13]** to install Termtosvg tool in Linux. +最后,请执行 **[pip][13]** 来安装 Termtosvg。 -``` -$ sudo pip3 install termtosvg pyte python-xlib svgwrite +```shell +sudo pip3 install termtosvg pyte python-xlib svgwrite ``` -### How to Record Your Terminal Session Using Termtosvg +### 如何使用 Termtosvg -Once you successfully installed Termtosvg. Just run the following command to start recording. +成功安装 Termtosvg 后,请使用以下命令来开始录制。 -``` +```shell $ termtosvg Recording started, enter "exit" command or Control-D to end ``` -For testing purpose run few commands and see whether it’s working fine or not. +如果只是想测试它是否正常工作,随意输入几行命令即可。 -``` +```shell $ 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 $ hostname @@ -124,21 +121,21 @@ $ pip3 --version pip 18.1 from /usr/lib/python3.7/site-packages/pip (python 3.7) ``` -Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in `/tmp` folder with a unique name. +完成后,你可以按下 `CTRL+D` 或输入 `exit` 来停止录制。录制完后,输出文件会以一个独一无二的名字被保存在 `/tmp` 文件夹中。 -``` +```shell $ exit exit Recording ended, SVG animation is /tmp/termtosvg_5waorper.svg ``` -We can open the SVG file output with help of any web browser. +我们可以在任意浏览器中打开 SVG 文件。 -``` -$ firefox /tmp/termtosvg_5waorper.svg +```shell +firefox /tmp/termtosvg_5waorper.svg ``` -![][15] +![最终效果][15] -------------------------------------------------------------------------------- @@ -146,7 +143,7 @@ via: https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-ani 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zhs852](https://github.com/zhs852) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6a64f3c74719536e3b0f33c9b4aab80c17667144 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 12 Jan 2019 23:14:50 +0800 Subject: [PATCH 0541/4278] Move translated file --- ... - Record Your Terminal Sessions As SVG Animations In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md (100%) diff --git a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md similarity index 100% rename from sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md rename to translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md From 5dcb60dff69d0cfc7be0008b3dce50168545398e Mon Sep 17 00:00:00 2001 From: wwhio Date: Sat, 12 Jan 2019 23:34:27 +0800 Subject: [PATCH 0542/4278] =?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/talk/20171119 The Ruby Story.md | 86 ---------------------- translated/talk/20171119 The Ruby Story.md | 85 +++++++++++++++++++++ 2 files changed, 85 insertions(+), 86 deletions(-) delete mode 100644 sources/talk/20171119 The Ruby Story.md create mode 100644 translated/talk/20171119 The Ruby Story.md diff --git a/sources/talk/20171119 The Ruby Story.md b/sources/talk/20171119 The Ruby Story.md deleted file mode 100644 index 4c6b46b7de..0000000000 --- a/sources/talk/20171119 The Ruby Story.md +++ /dev/null @@ -1,86 +0,0 @@ -Translating by wwhio - -The Ruby Story -====== -Ruby has always been one of my favorite languages, though I’ve sometimes found it hard to express why that is. The best I’ve been able to do is this musical analogy: Whereas Python feels to me like punk rock—it’s simple, predictable, but rigid—Ruby feels like jazz. Ruby gives programmers a radical freedom to express themselves, though that comes at the cost of added complexity and can lead to programmers writing programs that don’t make immediate sense to other people. - -I’ve always been aware that freedom of expression is a core value of the Ruby community. But what I didn’t appreciate is how deeply important it was to the development and popularization of Ruby in the first place. One might create a programming lanugage in pursuit of better peformance, or perhaps timesaving abstractions—the Ruby story is interesting because instead the goal was, from the very beginning, nothing more or less than the happiness of the programmer. - -### Yukihiro Matsumoto - -Yukihiro Matsumoto, also known as “Matz,” graduated from the University of Tsukuba in 1990. Tsukuba is a small town just northeast of Tokyo, known as a center for scientific research and technological devlopment. The University of Tsukuba is particularly well-regarded for its STEM programs. Matsumoto studied Information Science, with a focus on programming languages. For a time he worked in a programming language lab run by Ikuo Nakata. - -Matsumoto started working on Ruby in 1993, only a few years after graduating. He began working on Ruby because he was looking for a scripting language with features that no existing scripting language could provide. He was using Perl at the time, but felt that it was too much of a “toy language.” Python also fell short; in his own words: - -> I knew Python then. But I didn’t like it, because I didn’t think it was a true object-oriented language—OO features appeared to be an add-on to the language. As a language maniac and OO fan for 15 years, I really wanted a genuine object-oriented, easy-to-use scripting language. I looked for one, but couldn’t find one. - -So one way of understanding Matsumoto’s motivations in creating Ruby is that he was trying to create a better, object-oriented version of Perl. - -But at other times, Matsumoto has said that his primary motivation in creating Ruby was simply to make himself and others happier. Toward the end of a Google tech talk that Matsumoto gave in 2008, he showed the following slide: - -![][1] - -He told his audience, - -> I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of the Ruby language. - -Matsumoto goes on to joke that he created Ruby for selfish reasons, because he was so underwhelmed by other languages that he just wanted to create something that would make him happy. - -The slide epitomizes Matsumoto’s humble style. Matsumoto, it turns out, is a practicing Mormon, and I’ve wondered whether his religious commitments have any bearing on his legendary kindness. In any case, this kindness is so well known that the Ruby community has a principle known as MINASWAN, or “Matz Is Nice And So We Are Nice.” The slide must have struck the audience at Google as an unusual one—I imagine that any random slide drawn from a Google tech talk is dense with code samples and metrics showing how one engineering solution is faster or more efficient than another. Few, I suspect, come close to stating nobler goals more simply. - -Ruby was influenced primarily by Perl. Perl was created by Larry Wall in the late 1980s as a means of processing and transforming text-based reports. It became well-known for its text processing and regular expression capabilities. A Perl program contains many syntactic elements that would be familiar to a Ruby programmer—there are `$` signs, `@` signs, and even `elsif`s, which I’d always thought were one of Ruby’s less felicitous idiosyncracies. On a deeper level, Ruby borrows much of Perl’s regular expression handling and standard library. - -But Perl was by no means the only influence on Ruby. Prior to beginning work on Ruby, Matsumoto worked on a mail client written entirely in Emacs Lisp. The experience taught him a lot about the inner workings of Emacs and the Lisp language, which Matsumoto has said influenced the underlying object model of Ruby. On top of that he added a Smalltalk-style messsage passing system which forms the basis for any behavior relying on Ruby’s `#method_missing`. Matsumoto has also claimed Ada and Eiffel as influences on Ruby. - -When it came time to decide on a name for Ruby, Matsumoto and a colleague, Keiju Ishitsuka, considered several alternatives. They were looking for something that suggested Ruby’s relationship to Perl and also to shell scripting. In an [instant message exchange][2] that is well-worth reading, Ishitsuka and Matsumoto probably spend too much time thinking about the relationship between shells, clams, oysters, and pearls and get close to calling the Ruby language “Coral” or “Bisque” instead. Thankfully, they decided to go with “Ruby”, the idea being that it was, like “pearl”, the name of a valuable jewel. It also turns out that the birthstone for June is a pearl while the birthstone for July is a ruby, meaning that the name “Ruby” is another tongue-in-cheek “incremental improvement” name like C++ or C#. - -### Ruby Goes West - -Ruby grew popular in Japan very quickly. Soon after its initial release in 1995, Matz was hired by a Japanese software consulting group called Netlab (also known as Network Applied Communication Laboratory) to work on Ruby full-time. By 2000, only five years after it was initially released, Ruby was more popular in Japan than Python. But it was only just beginning to make its way to English-speaking countries. There had been a Japanese-language mailing list for Ruby discussion since almost the very beginning of Ruby’s existence, but the English-language mailing list wasn’t started until 1998. Initially, the English-language mailing list was used by Japanese Rubyists writing in English, but this gradually changed as awareness of Ruby grew. - -In 2000, Dave Thomas published Programming Ruby, the first English-language book to cover Ruby. The book became known as the “pickaxe” book for the pickaxe it featured on its cover. It introduced Ruby to many programmers in the West for the first time. Like it had in Japan, Ruby spread quickly, and by 2002 the English-language Ruby mailing list had more traffic than the original Japanese-language mailing list. - -By 2005, Ruby had become more popular, but it was still not a mainstream programming language. That changed with the release of Ruby on Rails. Ruby on Rails was the “killer app” for Ruby, and it did more than any other project to popularize Ruby. After the release of Ruby on Rails, interest in Ruby shot up across the board, as measured by the TIOBE language index: - -![][3] - -It’s sometimes joked that the only programs anybody writes in Ruby are Ruby-on-Rails web applications. That makes it sound as if Ruby on Rails completely took over the Ruby community, which is only partly true. While Ruby has certainly come to be known as that language people write Rails apps in, Rails owes as much to Ruby as Ruby owes to Rails. - -The Ruby philosophy heavily informed the design and implementation of Rails. David Heinemeier Hansson, who created Rails, often talks about how his first contact with Ruby was an almost religious experience. He has said that the encounter was so transformative that it “imbued him with a calling to do missionary work in service of Matz’s creation.” For Hansson, Ruby’s no-shackles approach was a politically courageous rebellion against the top-down impositions made by languages like Python and Java. He appreciated that the language trusted him and empowered him to make his own judgements about how best to express his programs. - -Like Matsumoto, Hansson claims that he created Rails out of a frustration with the status quo and a desire to make things better for himself. He, like Matsumoto, prioritized programmer happiness above all else, evaluating additions to Rails by what he calls “The Principle of The Bigger Smile.” Whatever made Hansson smile more was what made it into the Rails codebase. As a result, Rails would come to include unorthodox features like the “Inflector” class (which tries to map singular class names to plural database table names automatically) and Rails’ `Time` extensions (allowing programmers to write cute expressions like `2.days.ago`). To some, these features were truly weird, but the success of Rails is testament to the number of people who found it made their lives much easier. - -And so, while it might seem that Rails was an incidental application of Ruby that happened to become extremely popular, Rails in fact embodies many of Ruby’s core principles. Futhermore, it’s hard to see how Rails could have been built in any other language, given its dependence on Ruby’s macro-like class method calls to implement things like model associations. Some people might take the fact that so much of Ruby development revolves around Ruby on Rails as a sign of an unhealthy ecosystem, but there are good reasons that Ruby and Ruby on Rails are so intertwined. - -### The Future of Ruby - -People seem to have an inordinate amount of interest in whether or not Ruby (and Ruby on Rails) are dying. Since as early as 2011, it seems that Stack Overflow and Quora have been full of programmers asking whether or not they should bother learning Ruby if it will no longer be around in the next few years. These concerns are not unjustified; according to the TIOBE index and to Stack Overflow trends, Ruby and Ruby on Rails have been shrinking in popularity. Though Ruby on Rails was once the hot new thing, it has since been eclipsed by hotter and newer frameworks. - -One theory for why this has happened is that programmers are abandoning dynamically typed languages for statically typed ones. Analysts at TIOBE index figure that a rise in quality requirements have made runtime exceptions increasingly unacceptable. They cite TypeScript as an example of this trend—a whole new version of JavaScript was created just to ensure that client-side code could be written with the benefit of compile-time safety guarantees. - -A more likely answer, I think, is just that Ruby on Rails now has many more competitors than it once did. When Rails was first introduced in 2005, there weren’t that many ways to create web applications—the main alternative was Java. Today, you can create web applications using great frameworks built for Go, JavaScript, or Python, to name only the most popular options. The web world also seems to be moving toward a more distributed architecture for applications, meaning that, rather than having one codebase responsible for everything from database access to view rendering, responsibilites are split between different components that focus on doing one thing well. Rails feels overbroad and bloated for something as focused as a JSON API that talks to a JavaScript frontend. - -All that said, there are reasons to be optimistic about Ruby’s future. Both Rails and Ruby continue to be actively developed. Matsumoto and others are working hard on Ruby’s third major release, which they aim to make three times faster than the existing version of Ruby, possibly alleviating the performance concerns that have always dogged Ruby. And even if the world of web frameworks has become more diverse since 2005, that doesn’t mean that there won’t always be room for Ruby on Rails. It is now a mature tool with an enormous amount of built-in power that will always be a good choice for certain kinds of applications. - -But even if Ruby and Rails go the way of the dinosaurs, one thing that seems certain to survive is the Ruby ethos of programmer happiness. Ruby has had a profound influence on the design of many new programming languages, which have adopted many of its best ideas. Other new lanuages have tried to be “more modern” interpretations of Ruby: Elixir, for example, is a version of Ruby that emphasizes the functional programming paradigm, while Crystal, which is still in development, aims to be a statically typed version of Ruby. Many programmers around the world have fallen in love with Ruby and its syntax, so we can count on its influence persisting for a long while to come. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][4] on Twitter or subscribe to the [RSS feed][5] to make sure you know when a new post is out. - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2017/11/19/the-ruby-story.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://twobithistory.org/images/matz.png -[2]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88819 -[3]: https://twobithistory.org/images/tiobe_ruby.png -[4]: https://twitter.com/TwoBitHistory -[5]: https://twobithistory.org/feed.xml diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md new file mode 100644 index 0000000000..70827ca306 --- /dev/null +++ b/translated/talk/20171119 The Ruby Story.md @@ -0,0 +1,85 @@ +The Ruby Story +====== +尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,赋予了程序员灵活的表达freedom to express,虽然这可能会让代码变复杂、程序不直观。 + +Ruby 社区一直将灵活表达freedom of expression视为其核心价值。可我不认同这对于 Ruby 的开发和普及是最重要的。一个人创建一门编程语言也许是为了更高的性能,也许是为了在抽象上节省更多的时间,可 Ruby 就有趣在它并不关心这些,从它诞生之初,它的目标就是让程序员更快乐。 + +### 松本 行弘 + +松本行弘Yukihiro Matsumoto,也叫 “Matz”,于 1990 年毕业于筑波大学。筑波是东京东北方向上的一个小城市,是科学研究与技术开发的中心之一。那里的筑波大学以其 STEM 计划广为流传。松本行弘就在筑波大学的信息科学专业学习过,且专攻编程语言。他也在 Ikuo Nakata 的编程语言实验室工作过。 + +松本从 1993 年开始制作 Ruby,那时他才刚毕业几年。他制作 Ruby 的起因是觉得那时的脚本语言缺乏一些特性。他在使用 Perl 的时候觉得这门语言过于“玩具”,此外 Python 也有点弱,用他自己的话说: + +> 我那时就知道 Python 了,但我不喜欢它,因为我认为这不是一门真正的面向对象的语言。面向对象就像是 Python 的一个附件。作为一个编程语言狂热者,我在 15 年里一直是面向对象的忠实粉丝。我真的想要一门生来就面向对象而且易用的脚本语言。我为此特地寻找过,可事实并不如愿。 + +所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好的,而且面向对象的 Perl 版本。 + +但在其他场合,松本说他创造 Ruby 主要是为了让他自己和别人更快乐。2008 年,松本在谷歌技术讲座结束时放映了这张幻灯片: + +![][1] + +他对听众说到, + +> 我希望 Ruby 能帮助世界上的每一个程序员更有效率地工作,享受编程并感到快乐。这也是制作 Ruby 语言的主要意图。 + +松本开玩笑的说他制作 Ruby 的原因很自私,因为他觉得其他的语言乏味,所以需要创造一点让自己开心的东西。 + +这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教徒,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 + +Ruby 主要受到 Perl 的印象。Perl 则是由 Larry Wall 与 20 世纪 80 年代晚期创造的语言,主要用于处理和转换基于文本的数据。Perl 因其文本处理和正则表达式而闻名于世。对于 Ruby 程序员,Perl 程序中的很多语法元素都不陌生,例如符号`$`、符号`@`、`elsif`等等。虽然我觉得,这些不是 Ruby 应该具有的特征。除了这些符号外,Ruby 还借鉴了 Perl 中的正则表达式和标准库。 + +但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本使用过运行在 Emacs Lisp 上的邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本说 Ada 和 Eiffel 也影响了 Ruby 的设计。 + +当时间来到了给这门新语言命名的时候,松本和它的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段聊天记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby ,因为他就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的诞生石,而 Peral珍珠 则是 6 月的诞生石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。(LCTT译注:Perl 和 Pearl 发音相同;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关诞生石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) + +### Ruby 走向西方 + +Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询基团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,仅仅在 Ruby 发布 5 年后,Ruby 在日本的流行度就超过了 Python。可这是的 Ruby 从刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在日语邮件的列表,但是英语邮件的列表直到 1998 年才建立起来。而且起初在英语邮件的列表里交流的大多是日本的 Ruby 狂热者,但这一问题随着 Ruby 在西方国家的普及而逐渐得以改善。 + +在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。是它第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语邮件列表的流量超过了日语邮件列表。 + +时间来到了 2005 年,Ruby 更流行了,但它任然不是主流的编程语言。然而,Ruby on Rails 的发布让一切都不一样了。Ruby on Rails 是 Ruby 的“杀手应用”,没有别的什么项目比它更能推动 Ruby 的普及了。在 Ruby on Rails 发布后,人们对 Ruby 的兴趣爆发式的增长,看看 TIOBE 监测的语言排行: + +![][3] + +有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为 Rails 开发需要 Ruby,Ruby 在西方是随着 Rails 的发布才普及开的。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 + +Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之父 David Heinemeier Hansson 常常提起他第一次与 Ruby 的接触的情形,那简直就是一次传教。他说,那经历简直太有感召力了,让他感到要为松本的杰作(指 Ruby)“传教”的使命。对于 Hansson 来说,Ruby 的灵活性简直就是对 Python 或 Java 语言中自上而下的设计哲学的反抗。他很欣赏 Ruby 这门能够信任自己的语言,Ruby 赋予了他自由选择程序表达方式express his programs的权力。 + +就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非传统的功能,例如“Inflector”类和 `Time` 扩展("Inflector"类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 + +And so, while it might seem that Rails was an incidental application of Ruby that happened to become extremely popular, Rails in fact embodies many of Ruby’s core principles. Futhermore, it’s hard to see how Rails could have been built in any other language, given its dependence on Ruby’s macro-like class method calls to implement things like model associations. Some people might take the fact that so much of Ruby development revolves around Ruby on Rails as a sign of an unhealthy ecosystem, but there are good reasons that Ruby and Ruby on Rails are so intertwined. +因此,Rails 不但是 Ruby 的一个普及度很高的应用,而且体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails 的替代品,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法macro-like class method来实现模型关联的功能这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 + +### Ruby 的未来 + +人们似乎对 Ruby 是否正在灭亡有着异常的兴趣。早在 2011 年,Stack Overflow 和 Quora 上就有程序员在咨询“如果几年后不在使用 Ruby 那么现在是否有必要学它”。这些担忧对 Ruby 并不合理,虽然在 TIOBE 指数和 Stack Overflow 趋势上,Ruby 和 Ruby on Rails 的人气在萎缩,可它也曾是新兴的、热门的技术,但在更新更热的框架面前,排名自然会有所下降。 + +一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这使出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而它创造的目的正是为了保证客户端运行的代码能收益于编译所提供的安全保障。 + +我认为另一个原因可能是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以用 Go、Javascript 或者 Python 上的各种优秀的框架,而这还仅仅是主流的选择。 Web 的世界似乎正走向更加分布式的结构,与其使用一个代码仓库来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组建,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻与 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 + +总而言之,我们有理由对 Ruby 的未来持乐观态度。因为不管是 Ruby 还是 Rails 的开发都还很活跃。松本和其他的贡献者们都在努力开发 Ruby 的第三个主要版本。新的版本将比现在的版本快上 3 倍,以减轻制约着 Ruby 发展的性能问题。虽然从 2005 年起,越来越多的 Web 框架被开发出来,但这并不意味着 Ruby on Rails 就失去了其生存空间。Rails 是一个富有大量功能的成熟的工具,对于一些特定类型的应用开发一直是非常好的选择。 + +但就算 Ruby 和 Rails 走上了灭亡的道路,Ruby 让程序员更快乐的信条一定会存活下来。Ruby 已经深远的影响了许多新的编程语言的设计,这些语言的设计中能够看到来自 Ruby 的很多理念。而其他的新生语言则试着变成 Ruby 更现代的实现,例如 Elixir 是一个强调函数式编程的语言,仍在开发中的 Crystal 目标是成为使用静态类型的 Ruby 。世界上许多程序员都喜欢上了 Ruby,因此它的影响必将会在未来持续很长一段时间。 + +喜欢吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][4] 或者订阅我们的 [RSS][5],这样新文章发布的第一时间你就能得到通知。 + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2017/11/19/the-ruby-story.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[wwhio](https://github.com/wwhio) +校对:[校对者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://twobithistory.org/images/matz.png +[2]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88819 +[3]: https://twobithistory.org/images/tiobe_ruby.png +[4]: https://twitter.com/TwoBitHistory +[5]: https://twobithistory.org/feed.xml From 6f4b43cbff7bafcd32a6e9db3d56b2b91fa71612 Mon Sep 17 00:00:00 2001 From: wwhio Date: Sat, 12 Jan 2019 23:36:26 +0800 Subject: [PATCH 0543/4278] =?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 --- translated/talk/20171119 The Ruby Story.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md index 70827ca306..4b73462b5a 100644 --- a/translated/talk/20171119 The Ruby Story.md +++ b/translated/talk/20171119 The Ruby Story.md @@ -7,6 +7,7 @@ Ruby 社区一直将灵活表达freedom of expression视 ### 松本 行弘 松本行弘Yukihiro Matsumoto,也叫 “Matz”,于 1990 年毕业于筑波大学。筑波是东京东北方向上的一个小城市,是科学研究与技术开发的中心之一。那里的筑波大学以其 STEM 计划广为流传。松本行弘就在筑波大学的信息科学专业学习过,且专攻编程语言。他也在 Ikuo Nakata 的编程语言实验室工作过。 +(LCTT译注:STEM是科学(Science),技术(Technology),工程(Engineering),数学(Mathematics)四门学科英文首字母的缩写。) 松本从 1993 年开始制作 Ruby,那时他才刚毕业几年。他制作 Ruby 的起因是觉得那时的脚本语言缺乏一些特性。他在使用 Perl 的时候觉得这门语言过于“玩具”,此外 Python 也有点弱,用他自己的话说: @@ -30,7 +31,8 @@ Ruby 主要受到 Perl 的印象。Perl 则是由 Larry Wall 与 20 世纪 80 但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本使用过运行在 Emacs Lisp 上的邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本说 Ada 和 Eiffel 也影响了 Ruby 的设计。 -当时间来到了给这门新语言命名的时候,松本和它的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段聊天记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby ,因为他就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的诞生石,而 Peral珍珠 则是 6 月的诞生石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。(LCTT译注:Perl 和 Pearl 发音相同;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关诞生石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) +当时间来到了给这门新语言命名的时候,松本和它的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段聊天记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby ,因为他就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的诞生石,而 Peral珍珠 则是 6 月的诞生石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。 +(LCTT译注:Perl 和 Pearl 发音相同;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关诞生石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) ### Ruby 走向西方 From 7aed9e6508408718bff77f54be434c39347d41b8 Mon Sep 17 00:00:00 2001 From: wwhio Date: Sat, 12 Jan 2019 23:37:58 +0800 Subject: [PATCH 0544/4278] Update 20171119 The Ruby Story.md --- translated/talk/20171119 The Ruby Story.md | 1 - 1 file changed, 1 deletion(-) diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md index 4b73462b5a..bf370f00e6 100644 --- a/translated/talk/20171119 The Ruby Story.md +++ b/translated/talk/20171119 The Ruby Story.md @@ -50,7 +50,6 @@ Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之 就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非传统的功能,例如“Inflector”类和 `Time` 扩展("Inflector"类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 -And so, while it might seem that Rails was an incidental application of Ruby that happened to become extremely popular, Rails in fact embodies many of Ruby’s core principles. Futhermore, it’s hard to see how Rails could have been built in any other language, given its dependence on Ruby’s macro-like class method calls to implement things like model associations. Some people might take the fact that so much of Ruby development revolves around Ruby on Rails as a sign of an unhealthy ecosystem, but there are good reasons that Ruby and Ruby on Rails are so intertwined. 因此,Rails 不但是 Ruby 的一个普及度很高的应用,而且体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails 的替代品,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法macro-like class method来实现模型关联的功能这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 ### Ruby 的未来 From 3cbf4492e595b13d517a57b7f2a421f3a4877cb9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 23:54:51 +0800 Subject: [PATCH 0545/4278] PRF:20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @dianbanjiu --- ...Programs Installed From Source In Linux.md | 59 +++++++++---------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md index f33ff7af14..19a132c544 100644 --- a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md +++ b/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -1,62 +1,61 @@ [#]: collector: (lujun9972) -[#]: translator: ( dianbanjiu ) -[#]: reviewer: ( ) +[#]: translator: (dianbanjiu) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) [#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -在 Linux 中移除从源中安装的程序的一种简单的方法 +在 Linux 中移除从源代码安装的程序的一种简单的方法 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/12/stow-1-720x340.jpg) -不是所有的程序都可以在官方或者第三方库中可用,因此你不能使用常规的包管理来安装它们。有时你不得不从源代码中手动构建这些程序。就跟你已经知道的一样,当你从源代码中安装一个程序的时候,这个包文件将会复制到本地的多个位置,例如 **/usr/local/bin**,**/usr/local/etc/**。如果从源代码中安装的程序没有内建的卸载器,当你不再需要这个程序的时候,卸载它就会很麻烦。你可能会话费双倍(甚至更多)的时间找出这些包文件然后手动删除它们。我以前一直是这样做的,直到我发现了 **GNU Stow**。谢天谢地,Stow 有一个很棒的方法可以轻松管理从源代码安装的程序。 - +不是所有的程序都可以在官方或者第三方库中找到,因此你不能使用常规的包管理来安装它们。有时你不得不从源代码中手动构建这些程序。就如你已经知道的一样,当你从源代码中安装一个程序的时候,这个软件包所包含的文件将会复制到本地的多个位置,例如 `/usr/local/bin`、`/usr/local/etc/`。如果从源代码中安装的程序没有内置的卸载程序,当你不再需要这个程序的时候,卸载它就会很麻烦。你可能会花费双倍(甚至更多)的时间找出这些文件然后手动删除它们。我以前一直是这样做的,直到我发现了 GNU Stow。谢天谢地,Stow 有一个很棒的方法可以轻松管理从源代码安装的程序。 引用官方网站里的一段介绍, -> **GNU Stow 是一个符号链接管理器,它可以收集文件系统上不同目录中的不同软件和/或数据包,使它们看起来像是一个整体** +> GNU Stow 是一个符号链接归集管理器,它可以收集文件系统上不同目录中的不同软件和/或数据包,使它们看起来像是一个整体。 -简单来说,Stow 帮助你把这些程序文件以一种容易管理的方式组织在了一起。在这个方法中,文件将不会被复制到多个位置。所有的这些文件都会被保存在一个特定的文件夹中,通常是以程序名命名的,然后 Stow 会在一个合适的位置为所有的程序文件创建符号连接。比如 **/usr/local/bin** 中会包含 **/usr/local/stow/vim/bin**,**/usr/local/stow/python/bin** 中文件的符号链接。并且同样递归地用于其他的任何的子目录,例如 **.../share**,**.../man**,等等。在这篇教程中,我将会举例教你如何轻松地使用 Stow 管理从源中安装的程序。 +简单来说,Stow 帮助你把这些程序文件以一种容易管理的方式组织在了一起。在这个方法中,文件将不会被复制到多个位置。所有的这些文件都会被保存在一个特定的文件夹中,通常是以程序名命名的,然后 Stow 会在一个合适的位置为所有的程序文件创建符号连接。比如 `/usr/local/bin` 中会包含 `/usr/local/stow/vim/bin`、`/usr/local/stow/python/bin` 中文件的符号链接。并且同样递归地用于其他的任何的子目录,例如 `.../share`、`.../man`,等等。在这篇教程中,我将会举例教你如何轻松地使用 Stow 管理从源中安装的程序。 ### 安装 GNU Stow GNU Stow 在流行 Linux 操作系统的默认库中都可用。 -在 **Arch Linux** 及它的衍生版本中,运行下面的命令安装 Stow。 +在 Arch Linux 及它的衍生版本中,运行下面的命令安装 Stow。 ``` $ sudo pacman -S stow ``` -在 **Debian**,**Ubuntu**,**Linux Mint** 上: +在 Debian、Ubuntu、Linux Mint 上: ``` $ sudo apt install stow ``` -在 **Fedora** 上: +在 Fedora 上: ``` $ sudo dnf install stow ``` -在 **RHEL/CentOS** 上: + +在 RHEL/CentOS 上: ``` $ sudo yum install epel-release - $ sudo yum install stow ``` ### 在 Linux 上轻松移除从源代码安装的程序 -就像我之前提到的,所有包的程序文件都将被保存在位于 **/usr/local/stow/** 的一个根文件夹。在这个根文件夹或者父目录之下,每个包都将保存在对应的子目录中。例如,如果我们从源代码中安装了 Vim 编辑器,所有关联到 Vim 的程序文件和目录都将保存在 **/usr/local/stow/vim** 文件夹之下。如果你从源代码中安装了 Python,所有关联到 python 的文件都会保存在 **/usr/local/stow/python** 之下。 +就像我之前提到的,所有包的程序文件都将被保存在位于 `/usr/local/stow/` 的一个根文件夹。在这个根文件夹或者父目录之下,每个包都将保存在对应的子目录中。例如,如果我们从源代码中安装了 Vim 编辑器,所有关联到 Vim 的程序文件和目录都将保存在 `/usr/local/stow/vim` 文件夹之下。如果你从源代码中安装了 Python,所有关联到 python 的文件都会保存在 `/usr/local/stow/python` 之下。 -我现在从源代码中来安装一个叫做 **hello** 的程序。 +我现在从源代码中来安装一个叫做 hello 的程序。 -首先下载 ‘hello’ 程序的压缩包。 +首先下载 hello 程序的压缩包。 ``` $ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz @@ -68,7 +67,7 @@ $ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz $ tar -zxvf hello-2.10.tar.gz ``` -上面的命令将会在当前工作目录下创建一个叫做 ‘hello-2.10’ 的目录,并且提取压缩包中的所有内容到其中去。 +上面的命令将会在当前工作目录下创建一个叫做 `hello-2.10` 的目录,并且提取压缩包中的所有内容到其中去。 切换到这个目录当中: @@ -76,42 +75,40 @@ $ tar -zxvf hello-2.10.tar.gz $ cd hello-2.10/ ``` -运行下面的命令,并且添加 -prefix 选项。 +运行下面的命令,并且添加 `-prefix` 选项。 ``` $ ./configure --prefix=/usr/local/stow/hello ``` -上面的命令将会保存构建文件到一个指定位置,在这个例子中是 **/usr/local/stow/hello**。 +上面的命令将会保存构建文件到一个指定位置,在这个例子中是 `/usr/local/stow/hello`。 最后,使用下面的命令构建并安装 hello 这个程序: ``` $ make - $ sudo make install ``` -就这样。hello 这个程序就已经安装在 **/usr/local/stow/hello/** 这个位置了。你可以使用下面的 ‘ls’ 命令确认一下。 +就这样。hello 这个程序就已经安装在 `/usr/local/stow/hello/` 这个位置了。你可以使用下面的 `ls` 命令确认一下。 ``` $ ls /usr/local/stow/hello/ bin share ``` -最后,进入 **/usr/local/stow/** 目录,运行下面的命令来生成必要的符号链接。 +最后,进入 `/usr/local/stow/` 目录,运行下面的命令来生成必要的符号链接。 ``` $ cd /usr/local/stow/ - $ sudo stow hello ``` 大功告成! -刚才那一步是将包含在 hello 这个程序中的所有文件或者目录创建了链接到 **/usr/local/** 目录中。换一种说法, **/usr/local/stow/hello/bin** 已经链接到 **/usr/local/share**,以及 **/usr/local/stow/hello/share/man** 已经链接到 **/usr/local/share**,还有 **/usr/local/stow/hello/share/man** 已经链接到 **/usr/local/share/man**。 +刚才那一步是将包含在 hello 这个程序中的所有文件或者目录创建了链接到 `/usr/local/` 目录中。换一种说法, `/usr/local/stow/hello/bin` 链接到 `/usr/local/share`,以及 `/usr/local/stow/hello/share/man` 链接到 `/usr/local/share`,还有 `/usr/local/stow/hello/share/man` 链接到 `/usr/local/share/man`。 -你可以使用 ‘ls’ 命令来确认一下: +你可以使用 `ls` 命令来确认一下: ``` $ ls /usr/local/bin/ @@ -137,15 +134,15 @@ $ tree /usr/local/stow/ ![][2] -看,hello 这个程序已经安装在 /usr/local/stow/hello/ 下。同样地,所有的包都将保存在它们对应的目录之下。 +看,hello 这个程序已经安装在 `/usr/local/stow/hello/` 下。同样地,所有的包都将保存在它们对应的目录之下。 -下面进入主要环节,移除 hello 这个程序。首先进入 **/usr/local/stow/** 目录: +下面进入主要环节,移除 hello 这个程序。首先进入 `/usr/local/stow/` 目录: ``` $ cd /usr/local/stow/ ``` -.. 然后运行下面的命令: +然后运行下面的命令: ``` $ sudo stow --delete hello @@ -162,7 +159,7 @@ $ hello 看, Hello 已经被移除了! -请注意 Stow 仅仅只移除了符号链接。所有与 hello 这个程序相关的文件或者目录还保存在 **/usr/local/stow/hello** 目录下。所以你无需再次下载源文件就可以再次安装 hello 这个程序。如果你不再需要它了,直接删除这个文件夹即可。 +请注意 Stow 仅仅只移除了符号链接。所有与 hello 这个程序相关的文件或者目录还保存在 `/usr/local/stow/hello` 目录下。所以你无需再次下载源文件就可以再次安装 hello 这个程序。如果你不再需要它了,直接删除这个文件夹即可。 ``` $ sudo rm -fr /usr/local/stow/hello/ @@ -174,22 +171,20 @@ $ sudo rm -fr /usr/local/stow/hello/ $ man stow ``` - Stow 可以像安装程序一样轻松地帮你移除它。如果你想知道如何高效的管理很多从源代码中安装的程序,GNU Stow 就是一个使得这个任务更加轻松的一个选择,尝试一下,你一定不会失望的。 这就是所有的内容了,希望对你有所帮助。还有更多干活即将到来,可以期待一下的! 祝近祺! - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/ 作者:[SK][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 8930c409846d5aca4608cc475e4bc1a2a3f6ef8b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 23:55:34 +0800 Subject: [PATCH 0546/4278] PUB:20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @dianbanjiu https://linux.cn/article-10438-1.html --- ...y Way To Remove Programs Installed From Source In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md (99%) diff --git a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md similarity index 99% rename from translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md rename to published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md index 19a132c544..12411f8aa0 100644 --- a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md +++ b/published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (dianbanjiu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10438-1.html) [#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) [#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 3537ff1e62b53522ef5dbb3c19a55978ca42f05e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 13 Jan 2019 11:38:55 +0800 Subject: [PATCH 0547/4278] PRF:20190103 How to create presentations with Beamer.md @geekpi --- ...How to create presentations with Beamer.md | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/translated/tech/20190103 How to create presentations with Beamer.md b/translated/tech/20190103 How to create presentations with Beamer.md index 8e98d98561..ca0ac89875 100644 --- a/translated/tech/20190103 How to create presentations with Beamer.md +++ b/translated/tech/20190103 How to create presentations with Beamer.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to create presentations with Beamer) @@ -9,7 +9,9 @@ 如何使用 Beamer 创建演示文稿 ====== -Beamer 将 LaTeX 强大的排版功能和生态系统带进创建幻灯片中。 + +> Beamer 将 LaTeX 强大的排版功能和生态系统带进创建幻灯片中。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b) [Beamer][1] 是用于生成幻灯片的 LaTeX 包。它最棒的功能之一是它可以利用 LaTeX 强大的排版系统和其生态系统中的所有其他软件包。例如,我经常在包含代码的 Beamer 演示文稿中使用 LaTeX 的 [listings][2] 包。 @@ -22,25 +24,25 @@ Beamer 将 LaTeX 强大的排版功能和生态系统带进创建幻灯片中。 \documentclass{beamer} ``` -与任何其他 LaTeX 文档一样,添加你要使用的任何包。例如,要使用 **listings** 包,请输入: +与任何其他 LaTeX 文档一样,添加你要使用的任何包。例如,要使用 `listings` 包,请输入: ``` \usepackage{listings} ``` -将所有内容放在 **document** 环境中: +将所有内容放在 `document` 环境中: ``` \begin{document} ``` -Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame 应该被标记为 **fragile**: +Beamer 文档通常时是一系列的 `frame` 环境。包含代码的 `frame` 应该被标记为 `fragile`: ``` \begin{frame}[fragile] ``` -使用标题开始你的 frame: +使用标题开始你的 `frame`: ``` \frametitle{Function to Do Stuff} @@ -48,11 +50,11 @@ Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame ### 开始演示前测试你的代码 -世上最糟糕的感受之一你在演讲中说到代码时,突然发现了一个 bug—也许是拼错了关键词或者漏掉了括号。 +世上最糟糕的感受之一你在演讲中说到代码时,突然发现了一个 bug —— 也许是拼错了关键词或者漏掉了括号。 解决方法之一就是测试演示的代码。在多数演示环境中,这意味着创建一个单独的文件、编写测试接着拷贝和粘贴。 -然而,在 Beamer 中有一种更好的方法。想象一下,你有一个名为 **do_stuff.py** 的文件,其中包含代码。你可以在第二个文件中编写 **do_stuff.py** 代码的测试,你可以将其命名为 **test_do_stuff.py**,并且可以使用 [pytest][3] 测试。但是,**do_stuff.py**中的大多数行都缺乏教学价值,比如定义辅助函数。 +然而,在 Beamer 中有一种更好的方法。想象一下,你有一个名为 `do_stuff.py` 的文件,其中包含代码。你可以在第二个文件中编写 `do_stuff.py` 代码的测试,你可以将其命名为 `test_do_stuff.py`,并且可以使用 [pytest][3] 测试。但是,`do_stuff.py` 中的大多数行都缺乏教学价值,比如定义辅助函数。 要简化你受众看到的东西,你可在演示文稿中只导入你要讨论的行到 frame 中: @@ -64,13 +66,13 @@ Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame ]{do_stuff.py} ``` -由于你会对这几行(从 8 到 15)进行讨论,因此幻灯片上不需要任何其他内容。结束 frame: +由于你会对这几行(从 8 到 15)进行讨论,因此幻灯片上不需要任何其他内容。结束 `frame`: ``` \end{frame} ``` -在下一张幻灯片中,你想展示刚才的 **do_stuff()** 函数的用法示例: +在下一张幻灯片中,你想展示刚才的 `do_stuff()` 函数的用法示例: ``` \begin{frame}[fragile] @@ -83,15 +85,15 @@ Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame \end{frame} ``` -你使用相同的文件,但这次显示调用该函数的行。最后,结束 document: +你使用相同的文件,但这次显示调用该函数的行。最后,结束 `document`: ``` \end{document} ``` -假设你在 **do_stuff.py** 中有一个合适的 Python 文件,这将生成一个含有 2 页的幻灯片。 +假设你在 `do_stuff.py` 中有一个合适的 Python 文件,这将生成一个含有 2 页的幻灯片。 -Beamer 还支持必要的功能如渐进式演示,每次给观众展示一部分以免受到前面的打扰。在行中放入 ”**\pause**“ 会将页面分成不同的部分: +Beamer 还支持必要的功能如渐进式演示,每次给观众展示一部分以免受到前面的打扰。在行中放入 `\pause` 会将页面分成不同的部分: ``` \begin{frame} @@ -107,18 +109,18 @@ Remember: ### 创建讲义 -Beamer 中我最喜欢的功能是你可以用 **\documentclass[ignorenonframetext]{beamer}** 设置忽略 frame 外的所有内容。当我准备演示文稿时,我离开顶部(声明文档类的位置)并自动生成它的两个版本:我的演示稿使用 Beamer 忽略任何 frame 之外的所有文本,另一个含有类似这样的头: +Beamer 中我最喜欢的功能是可以用 `\documentclass[ignorenonframetext]{beamer}` 设置忽略 `frame` 外的所有内容。当我准备演示文稿时,我离开顶部(声明文档类的位置)并自动生成它的两个版本:我的演示稿使用 Beamer 忽略任何 `frame` 之外的所有文本,另一个含有类似这样的头: ``` \documentclass{article} \usepackage{beamerarticle} ``` -这会生成一份讲义—一份含有所有 frame 和它们之间文字的 PDF。 +这会生成一份讲义:一份含有所有 `frame` 和它们之间文字的 PDF。 当会议组织者要求我发布我的幻灯片时,我会包含原始幻灯片作为参考,但我希望人们拿到的是讲义,它包含了所有我不想在幻灯片上写的解释部分。 -在创建幻灯片时,人们经常想是要为演讲优化资料还是方便那些想要日后阅读的人。幸运的是,Beamer 提供了两全其美的办法。 +在创建幻灯片时,人们经常会考虑是为演讲优化讲稿还是为之后想要阅读它的人们优化。幸运的是,Beamer 提供了两全其美的办法。 -------------------------------------------------------------------------------- @@ -127,7 +129,7 @@ via: https://opensource.com/article/19/1/create-presentations-beamer 作者:[Moshe Zadka][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/) 荣誉推出 @@ -135,4 +137,4 @@ via: https://opensource.com/article/19/1/create-presentations-beamer [b]: https://github.com/lujun9972 [1]: https://www.overleaf.com/learn/latex/Beamer [2]: https://www.overleaf.com/learn/latex/Code_listing -[3]: https://docs.pytest.org/en/latest/ \ No newline at end of file +[3]: https://docs.pytest.org/en/latest/ From 9a8dae67fb4428b394d6154fdc9ae2a6ee6624bc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 13 Jan 2019 11:39:32 +0800 Subject: [PATCH 0548/4278] PUB:20190103 How to create presentations with Beamer.md @geekpi https://linux.cn/article-10439-1.html --- .../20190103 How to create presentations with Beamer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190103 How to create presentations with Beamer.md (98%) diff --git a/translated/tech/20190103 How to create presentations with Beamer.md b/published/20190103 How to create presentations with Beamer.md similarity index 98% rename from translated/tech/20190103 How to create presentations with Beamer.md rename to published/20190103 How to create presentations with Beamer.md index ca0ac89875..255db4e77a 100644 --- a/translated/tech/20190103 How to create presentations with Beamer.md +++ b/published/20190103 How to create presentations with Beamer.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10439-1.html) [#]: subject: (How to create presentations with Beamer) [#]: via: (https://opensource.com/article/19/1/create-presentations-beamer) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 50f8d717c65ee0d49d182d5719206a75a11eac0d Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 13 Jan 2019 21:03:34 +0800 Subject: [PATCH 0549/4278] Translated by qhwdw --- ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 232 ------------------ ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 230 +++++++++++++++++ 2 files changed, 230 insertions(+), 232 deletions(-) delete mode 100644 sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md create mode 100644 translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md diff --git a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md deleted file mode 100644 index f16c290504..0000000000 --- a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ /dev/null @@ -1,232 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) -[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) - -Computer Laboratory – Raspberry Pi: Lesson 1 OK01 -====== - -The OK01 lesson contains an explanation about how to get started and teaches how to enable the 'OK' or 'ACT' **LED** on the Raspberry Pi board near the RCA and USB ports. This light was originally labelled OK but has been renamed to ACT on the revision 2 Raspberry Pi boards. - -### 1 Getting Started - -I am assuming at this point that you have already visited the [Downloads][1] page, and got the necessary GNU Toolchain. Also on the downloads page is a file called OS Template. Please download this and extract its contents to a new directory. - -### 2 The Beginning - -``` -The '.s' file extension is commonly used for all forms of assembly code, it is up to us to remember this is ARMv6. -``` - -Now that you have extracted the template, create a new file in the 'source' directory called 'main.s'. This file will contain the code for this operating system. To be explicit, the folder structure should look like: - -``` -build/ - (empty) -source/ - main.s -kernel.ld -LICENSE -Makefile -``` - -Open 'main.s' in a text editor so that we can begin typing assembly code. The Raspberry Pi uses a variety of assembly code called ARMv6, so that is what we'll need to write in. - -Copy in these first commands. - -``` -.section .init -.globl _start -_start: -``` - -As it happens, none of these actually do anything on the Raspberry Pi, these are all instructions to the assembler. The assembler is the program that will translate between assembly code that we understand, and binary machine code that the Raspberry Pi understands. In Assembly Code, each line is a new command. The first line here tells the Assembler[1] where to put our code. The template I provided causes the code in the section called .init to be put at the start of the output. This is important, as we want to make sure we can control which code runs first. If we don't do this, the code in the alphabetically first file name will run first! The .section command simply tells the assembler which section to put the code in, from this point until the next .section or the end of the file. - -``` -In assembly code, you may skip lines, and put spaces before and after commands to aid readability. -``` - -The next two lines are there to stop a warning message and aren't all that important.[2] - -### 3 The First Line - -Now we're actually going to code something. In assembly code, the computer simply goes through the code, doing each instruction in order, unless told otherwise. Each instruction starts on a new line. - -Copy the following instruction. - -``` -ldr r0,=0x20200000 -``` - -``` -ldr reg,=val puts the number val into the register named reg. -``` - -That is our first command. It tells the processor to store the number 0x20200000 into the register r0. I shall need to answer two questions here, what is a register, and how is 0x20200000 a number? - -``` -A single register can store any integer between 0 and 4,294,967,295 inclusive on the Raspberry Pi, which might seem like a large amount of memory, but it is only 32 binary bits. -``` - -A register is a tiny piece of memory in the processor, which is where the processor stores the numbers it is working on right now. There are quite a few of these, many of which have a special meaning, which we will come to later. Importantly there are 13 (named r0,r1,r2,...,r9,r10,r11,r12) which are called General Purpose, and you can use them for whatever calculations you need to do. Since it's the first, I've used r0 in this example, but I could very well have used any of the others. As long as you're consistent, it doesn't matter. - -0x20200000 is indeed a number. However it is written in Hexadecimal notation. To learn more about hexadecimal expand the box below: -``` -Hexadecimal is an alternate system for writing numbers. You may only be aware of the decimal system for writing numbers in which we have 10 digits: 0,1,2,3,4,5,6,7,8 and 9. Hexadecimal is a system with 16 digits: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e and f. - -![567 is 5 hundreds, 6 tens and 7 units.][2] - -You may recall being taught how decimal numbers work in terms of place value. We say that the rightmost digits is the 'units' digits, the next one left is the 'tens' digit, the next is the 'hundreds' digit, and so on. What this actually meant is, the number is 100 × the value in the 'hundreds' digit, plus 10 × the value in the 'tens' digit, plus 1 × the value in the units digit. - -![567 is 5x10^2+6x10^1+7x10^0][3] - -More mathematically, we can now spot the pattern and say that the rightmost digit is the 100=1s digit, the next left is the 101=10s digit, the next is 102=100s digit, and so on. We have all agreed on the system that 0 is the lowest digit, 1 is the next and so on. But what if we used a different number instead of 10 in these powers? Hexadecimal is just the system in which we use 16 instead. - -![567 = 5x10^2+6x10^1+7x10^0 = 2x16^2+3x16^1+7x16^0][4] - -The mathematics to the right shows that the number 567 in decimal is equivalent to the number 237 in hexadecimal. Often when we need to be clear about what system we're using to write numbers in we put 10 for decimal and 16 for hexadecimal. Since it's difficult to write small numbers in assembly code, we use 0x instead to represent a number in hexadecimal notation. So 0x237 means 23716. - -So where do a,b,c,d,e and f come in? Well, in order to be able to write every number in hexadecimal, we need extra digits. For example 916 = 9×160 = 910, but 1016 = 1×161 + 1×160 = 1610. So if we just used 0,1,2,3,4,5,6,7,8 and 9 we would not be able to write 1010, 1110, 1210, 1310, 1410, 1510. So we introduce 6 new digits such that a16 = 1010, b16 = 1110, c16 = 1210, d16 = 1310, e16 = 1410, f16 = 1510 - -So, we now have another system for writing numbers. But why did we bother? Well, it turns out that since computers always work in binary, hexadecimal notation is very useful because every hexadecimal digit is exactly four binary digits long. This has the nice side effect that a lot of computer numbers are round numbers in hexadecimal, even though they're not in decimal. For example, in the assembly code just above I used the number 2020000016. If I had chose to write this in decimal it would have been 53896806410, which is much less memorable. - -To convert numbers from decimal to hexadecimal I find the following method easiest: - -![Conversion example][5] - - 1. Start with the decimal number, say 567. - 2. Divide by 16 and calculate the remainder. For example 567 ÷ 16 = 35 remainder 7. - 3. The remainder is the last digit of the answer in hexadecimal, in the example this is 7. - 4. Repeat steps 2 and 3 again with the result of the last division until the result is 0. For example 35 ÷ 16 = 2 remainder 3, so 3 is the next digit of the answer. 2 ÷ 16 = 0 remainder 2, so 2 is the next digit of the answer. - 5. Once the result of the division is 0, you can stop. The answer is just the remainders in the reverse order to which you got them, so 56710 = 23716. - - - -To convert hexadecimal numbers back to decimal, it is easiest to expand out the number, so 23716 = 2×162 + 3×161 +7 ×160 = 2×256 + 3×16 + 7×1 = 512 + 48 + 7 = 567. -``` - -So our first command is to put the number 2020000016 into r0. That doesn't sound like it would be much use, but it is. In computers, there are an awful lot of chunks of memory and devices. In order to access them all, we give each one an address. Much like a postal address or a web address this is just a means of identifying the location of the device or chunks of memory we want. Addresses in computers are just numbers, and so the number 2020000016 happens to be the address of the GPIO controller. This is just a design decision taken by the manufacturers, they could have used any other address (providing it didn't conflict with anything else). I know this address only because I looked it up in a manual[3], there is no particular system to the addresses (other than that they are all large round numbers in hexadecimal). - -### 4 Enabling Output - -![A diagram showing key parts of the GPIO controller.][6] - -Having read the manual, I know we're going to need to send two messages to the GPIO controller. We need to talk its language, but if we do, it will obligingly do what we want and turn on the OK LED. Fortunately, it is such a simple chip, that it only needs a few numbers in order to understand what to do. - -``` -mov r1,#1 -lsl r1,#18 -str r1,[r0,#4] -``` - -``` -mov reg,#val puts the number val into the register named reg. - -lsl reg,#val shifts the binary representation of the number in reg by val places to the left. - -str reg,[dest,#val] stores the number in reg at the address given by dest + val. -``` - -These commands enable output to the 16th GPIO pin. First we get a necessary value in r1, then send it to the GPIO controller. Since the first two instructions are just trying to get a value into r1, we could use another ldr command as before, but it will be useful to us later to be able to set any given GPIO pin, so it is better to deduce the value from a formula than write it straight in. The OK LED is wired to the 16th GPIO pin, and so we need to send a command to enable the 16th pin. - -The value in r1 is needed to enable the LED pin. The first line puts the number 110 into r1. The mov command is faster than the ldr command, because it does not involve a memory interaction, whereas ldr loads the value we want to put into the register from memory. However, mov can only be used to load certain values[4]. In ARM assembly code, almost every instruction begins with a three letter code. This is called the mnemonic, and is supposed to hint at what the operation does. mov is short for move and ldr is short for load register. mov moves the second argument #1 into the first r1. In general, # must be used to denote numbers, but we have already seen a counterexample to this. - -The second instruction is lsl or logical shift left. This means shift the binary representation for the first argument left by the second argument. In this case this will shift the binary representation of 110 (which is 12) left by 18 places (making it 10000000000000000002=26214410). - -If you are unfamiliar with binary, expand the box below: -``` -Just like hexadecimal binary is another way of writing numbers. In binary we only have 2 digits, 0 and 1. This is useful for computers because we can implement this in a circuit by saying that electricity flowing through the circuit means 1, and not means 0. This is how computers actually work and do maths. Despite only having 2 digits binary can still be used to represent every number, it just takes a lot longer. - -![567 in decimal = 1000110111 in binary][7] - -The image shows the binary representation of the number 56710 which is 10001101112. We use 2 to denote numbers written in binary. - -One of the quirks of binary that we make heavy use of in assembly code is the ease by which numbers can be multiplied or divided by powers of 2 (e.g. 1,2,4,8,16). Normally multiplications and divisions are tricky operations, however these special cases are very easy, and so are very important. - -![13*4 = 52, 1101*100=110100][8] - -Shifting a binary number left by **n** places is the same as multiplying the number by 2 **n**. So, if we want to multiply by 4, we just shift the number left 2 places. If we want to multiply by 256 we could shift it left by 8 places. If we wanted to multiply by a number like 12, we could instead multiply it by 8, then separately by 4 and add the results (N × 12 = N × (8 + 4) = N × 8 + N × 4). - -![53/16 = 3, 110100/10000=11][9] - -Shifting a binary number right by **n** places is the same as dividing the number by 2 **n**. The remainder of the division is the bits that were lost when shifted right. Unfortunately dividing by a binary number that is not an exact power of 2 is very difficult, and will be covered in [Lesson 9: Screen04][10]. - -![Binary Terminology][11] - -This diagram shows common terminology used with binary. A bit is a single binary digit. A nibble is 4 binary bits. A byte is 2 nibbles, or 8 bits. A half is half the size of a word, 2 bytes in this case. A word refers to the size of the registers on a processor, and so on the Raspberry Pi this is 4 bytes. The convention is to number the most significant bit of a word 31, and the least significant bit as 0. The top, or high bits refer to the most significant bits, and the low or bottom bits refer to the least significant. A kilobyte (KB) is 1000 bytes, a megabyte is 1000 KB. There is some confusion as to whether this should be 1000 or 1024 (a round number in binary). As such, the new international standard is that a KB is 1000 bytes, and a Kibibyte (KiB) is 1024 bytes. A Kb is 1000 bits, and a Kib is 1024 bits. - -The Raspberry Pi is little endian by default, meaning that loading a byte from an address you just wrote a word to will load the lowest byte of the word. -``` - -Once again, I only know that we need this value from reading the manual[3]. The manual says that there is a set of 24 bytes in the GPIO controller, which determine the settings of the GPIO pin. The first 4 relate to the first 10 GPIO pins, the second 4 relate to the next 10 and so on. There are 54 GPIO pins, so we need 6 sets of 4 bytes, which is 24 bytes in total. Within each 4 byte section, every 3 bits relates to a particular GPIO pin. Since we want the 16th GPIO pin, we need the second set of 4 bytes because we're dealing with pins 10-19, and we need the 6th set of 3 bits, which is where the number 18 (6×3) comes from in the code above. - -Finally the str 'store register' command stores the value in the first argument, r1 into the address computed from the expression afterwards. The expression can be a register, in this case r0, which we know to be the GPIO controller address, and another value to add to it, in this case #4. This means we add 4 to the GPIO controller address and write the value in r1 to that location. This happens to be the location of the second set of 4 bytes that I mentioned before, and so we send our first message to the GPIO controller, telling it to ready the 16th GPIO pin for output. - -### 5 A Sign Of Life - -Now that the LED is ready to turn on, we need to actually turn it on. This means sending a message to the GPIO controller to turn pin 16 off. Yes, turn it off. The chip manufacturers decided it made more sense[5] to have the LED turn on when the GPIO pin is off. Hardware engineers often seem to take these sorts of decisions, seemingly just to keep OS Developers on their toes. Consider yourself warned. - -``` -mov r1,#1 -lsl r1,#16 -str r1,[r0,#40] -``` - -Hopefully you should recognise all of the above commands, if not their values. The first puts a 1 into r1 as before. The second shifts the binary representation of this 1 left by 16 places. Since we want to turn pin 16 off, we need to have a 1 in the 16th bit of this next message (other values would work for other pins). Finally we write it out to the address which is 4010 added to the GPIO controller address, which happens to be the address to write to turn a pin off (28 would turn the pin on). - -### 6 Happily Ever After - -It might be tempting to finish now, but unfortunately the processor doesn't know we're done. In actuality, the processor never will stop. As long as it has power, it continues working. Thus, we need to give it a task to do forever more, or the Raspberry Pi will crash (not much of a problem in this example, the light is already on). - -``` -loop$: -b loop$ -``` - -``` -name: labels the next line name. - -b label causes the next line to be executed to be label. -``` - -The first line here is not a command, but a label. It names the next line loop$. This means we can now refer to the line by name. This is called a label. Labels get discarded when the code is turned into binary, but they're useful for our benefit for referring to lines by name, not number (address). By convention we use a $ for labels which are only important to the code in this block of code, to let others know they're not important to the overall program. The b (branch) command causes the next line to be executed to be the one at the label specified, rather than the one after it. Therefore, the next line to be executed will be this b, which will cause it to be executed again, and so on forever. Thus the processor is stuck in a nice infinite loop until it is switched off safely. - -The new line at the end of the block is intentional. The GNU toolchain expects all assembly code files to end in an empty line, so that it is sure you were really finished, and the file hasn't been cut off. If you don't put one, you get an annoying warning when the assembler runs. - -### 7 Pi Time - -So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory. Type make and then press enter. If any errors occur, please refer to the troubleshooting section. If not, you will have generated three files. kernel.img is the compiled image of your operating system. kernel.list is a listing of the assembly code you wrote, as it was actually generated. This is useful to check that things were generated correctly in future. The kernel.map file contains a map of where all the labels ended up, which can be useful for chasing around values. - -To install your operating system, first of all get a Raspberry PI SD card which has an operating system installed already. If you browse the files in the SD card, you should see one called kernel.img. Rename this file to something else, such as kernel_linux.img. Then, copy the file kernel.img that make generated onto the SD Card. You've just replaced the existing operating system with your own. To switch back, simply delete your kernel.img file, and rename the other one back to kernel.img. I find it is always helpful to keep a backup of you original Raspberry Pi operating system, in case you need it again. - -Put the SD card into a Raspberry Pi and turn it on. The OK LED should turn on. If not please see the troubleshooting page. If so, congratulations, you just wrote your first operating system. See [Lesson 2: OK02][12] for a guide to making the LED flash on and off. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html - -作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal1.png -[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal2.png -[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal3.png -[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal4.png -[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioController.png -[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary1.png -[8]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary2.png -[9]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary3.png -[10]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html -[11]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary4.png -[12]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md new file mode 100644 index 0000000000..db9854b04c --- /dev/null +++ b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -0,0 +1,230 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +计算机实验室 - 树莓派:课程 1:OK01 +====== + +OK01 课程讲解了树莓派如何开始,以及在树莓派上如何启用靠近 RCA 和 USB 端口的 `OK` 或 `ACT` 的 **LED** 指示灯。这个指示灯最初是为了指示 `OK` 的,但它在第二版的树莓派上被重命名为 `ACT`。 + +### 1、入门 + +我们假设你已经访问了[下载][1]页面,并且已经获得了必需的 GNU 工具链。也下载了一个称为操作系统模板的文件。请下载这个文件并在一个新目录中解开它。 + +### 2、开始 + +``` +扩展名为 '.s' 的文件一般是汇编代码,需要记住的是,在这里它是 ARMv6 的汇编代码。 +``` + +现在,你已经展开了这个模板,在 `source` 目录中创建一个名为 `main.s` 的文件。这个文件包含了这个操作系统的代码。具体来看,这个文件夹的结构应该像下面这样: + +``` +build/ + (empty) +source/ + main.s +kernel.ld +LICENSE +Makefile +``` + +用文本编辑器打开 `main.s` 文件,这样我们就可以输入汇编代码了。树莓派使用了称为 ARMv6 的汇编代码变体,这就是我们即将要写的汇编代码类型。 + +首先,我们复制下面的这些命令。 + +``` +.section .init +.globl _start +_start: +``` + +实际上,上面这些指令并没有在树莓派上做任何事情,它们是提供给汇编器的指令。汇编器是一个转换程序,它将树莓派能够理解的机器代码转换成我们能够理解的汇编代码,在汇编代码中,每个行都是一个新的命令。上面的第一行告诉汇编器在哪里放我们的代码。我们提供的模板中将它放到一个名为 `.init` 的节中的原因是,它是输出的起始点。这很重要,因为我们希望确保我们能够控制哪个代码首先运行。如果不这样做,首先运行的代码将是按字母顺序排在前面的代码!`.section` 命令简单地告诉汇编器,哪个节中放置代码,从这个点开始,直到下一个 `.section` 或文件结束为止。 + +``` +在汇编代码中,你可以跳行、在命令前或后放置空格去提升可读性。 +``` + +接下来两行是停止一个警告消息,它们并不重要。 + +### 3、第一行代码 + +现在,我们正式开始写代码。计算机执行汇编代码时,是简单地一行一行按顺序执行每个指令,除非明确告诉它不这样做。每个指令都是开始于一个新行。 + +复制下列指令。 + +``` +ldr r0,=0x20200000 +``` + +``` +ldr reg,=val 将数字 val 加载到名为 reg 的寄存器中。 +``` + +那是我们的第一个命令。它告诉处理器将数字 0x20200000 保存到寄存器 r0 中。在这里我需要去回答两个问题,寄存器是什么?0x20200000 是一个什么样的数字? + +``` +树莓派上的一个单独的寄存器能够保存任何介于 0 到 4,294,967,295(含) 之间的任意整数,它可能看起来像一个很大的内存,实际上它仅有 32 个二进制比特。 +``` + +一个寄存器在处理器中就是一个极小的内存块,它是处理器保存正在处理的数字的地方。处理器中有很多寄存器,很多都有专门的用途,我们在后面会一一接触到它们。重要的是,它们有十三个(命名为 r0、r1、r2、…、r9、r10、r11、r12),它们被称为通用寄存器,你可以使用它们做任何计算。由于是写我们的第一行代码,我们在示例中使用了 r0,当然你可以使用它们中的任何一个。只要后面始终如一就没有问题。 + +0x20200000 是一个准确的数字。只不过它是以十六进制表示的。下面的内容详细解释了十六进制的相关信息: + +十六进制是另一种表示数字的方式。你或许只知道十进制的数字表示方法,十进制共有十个数字:0、1、2、3、4、5、6、7、8 和 9。十六进制共有十六个数字:0、1、2、3、4、5、6、7、8、9、a、b、c、d、e 和 f。 + +![567 is 5 hundreds, 6 tens and 7 units.][2] + +你可能还记得十进制是如何用位制来表示的。即最右侧的数字是个位,紧接着的左边一位是十位,再接着的左边一位是百位,依此类推。也就是说,它的值是 100 × 百位的数字,再加上 10 × 十位的数字,再加上 1 × 个位的数字。 + +![567 is 5x10^2+6x10^1+7x10^0][3] + +从数学的角度来看,我们可以发现规律,最右侧的数字是 100=1s,紧接着的左边一位是 101=10s,再接着是 102=100s,依此类推。我们设定在系统中,0 是最低位,紧接着是 1,依此类推。但如果我们使用一个不同于 10 的数字为幂底会是什么样呢?我们在系统中使用的十六进制就是这样的一个数字。 + +![567 = 5x10^2+6x10^1+7x10^0 = 2x16^2+3x16^1+7x16^0][4] + +上面的数学等式表明,十进制的数字 567 等于十六进制的数字 237。通常我们需要在系统中明确它们,我们使用下标 10 表示它是十进制数字,用下标 16 表示它是十六进制数字。由于在汇编代码中写上下标的小数字很困难,因此我们使用 0x 来表示它是一个十六进制的数字,因此 0x237 的意思就是 23716 。 + +那么,后面的 a、b、c、d、e 和 f 又是什么呢?好问题!在十六进制中为了能够写每个数字,我们就需要额外的东西。例如 916 = 9×160 = 910 ,但是 1016 = 1×161 + 1×160 = 1610 。因此,如果我们只使用 0、1、2、3、4、5、6、7、8 和 9,我们就无法写出 1010 、1110 、1210 、1310 、1410 、1510 。因此我们引入了 6 个新的数字,这样 a16 = 1010 、b16 = 1110 、c16 = 1210 、d16 = 1310 、e16 = 1410 、f16 = 1510 。 + +所以,我们就有了另一种写数字的方式。但是我们为什么要这么麻烦呢?好问题!由于计算机总是工作在二进制中,事实证明,十六进制是非常有用的,因为每个十六进制数字正好是四个二进制数字的长度。这种方法还有另外一个好处,那就是许多计算机的数字都是十六进制的整数倍,而不是十进制的整数倍。比如,我在上面的汇编代码中使用的一个数字 2020000016 。如果我们用十进制来写,它就是一个不太好记住的数字 53896806410 。 + +我们可以用下面的简单方法将十进制转换成十六进制: + +![Conversion example][5] + + 1. 我们以十进制数字 567 为例来说明。 + 2. 将十进制数字 567 除以 16 并计算其余数。例如 567 ÷ 16 = 35 余数为 7。 + 3. 在十六进制中余数就是答案中的最后一位数字,在我们的例子中它是 7。 + 4. 重复第 2 步和第 3 步,直到除法结果的整数部分为 0。例如 35 ÷ 16 = 2 余数为 3,因此 3 就是答案中的下一位。2 ÷ 16 = 0 余数为 2,因此 2 就是答案的接下来一位。 + 5. 一旦除法结果的整数部分为 0 就结束了。答案就是反序的余数,因此 56710 = 23716。 + + + +转换十六进制数字为十进制,也很容易,将数字展开即可,因此 23716 = 2×162 + 3×161 +7 ×160 = 2×256 + 3×16 + 7×1 = 512 + 48 + 7 = 567。 + +因此,我们所写的第一个汇编命令是将数字 2020000016 加载到寄存器 r0 中。那个命令看起来似乎没有什么用,但事实并非如此。在计算机中,有大量的内存块和设备。为了能够访问它们,我们给每个内存块和设备指定了一个地址。就像邮政地址或网站地址一样,它用于标识我们想去访问的内存块或设备的位置。计算机中的地址就是一串数字,因此上面的数字 2020000016 就是 GPIO 控制器的地址。这个地址是由制造商的设计所决定的,他们也可以使用其它地址(只要不与其它的冲突即可)。我之所以知道这个地址是 GPIO 控制器的地址是因为我看了它的[手册][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf],地址的使用没有专门的规范(除了它们都是以十六进制表示的大数以外)。 + +### 4、启用输出 + +![A diagram showing key parts of the GPIO controller.][6] + +阅读了手册可以得知,我们需要给 GPIO 控制器发送两个消息。我们必须用它的语言告诉它,如果我们这样做了,它将非常乐意实现我们的意图,去打开 `OK` 的 LED 指示灯。幸运的是,它是一个非常简单的芯片,为了让它能够理解我们要做什么,只需要给它设定几个数字即可。 + +``` +mov r1,#1 +lsl r1,#18 +str r1,[r0,#4] +``` + +``` +mov reg,#val 将数字 val 放到名为 reg 的寄存器中。 + +lsl reg,#val 将寄存器 reg 中的二进制操作数左移 val 位。 + +str reg,[dest,#val] 将寄存器 reg 中的数字保存到地址 dest + val 上。 +``` + +这些命令的作用是在 GPIO 的第 16 号插针上启用输出。首先我们在寄存器 r1 中获取一个必需的值,接着将这个值发送到 GPIO 控制器。因此,前两个命令是尝试取值到寄存器 r1 中,我们可以像前面一样使用另一个命令 `ldr` 来实现,但 `lsl` 命令对我们后面能够设置任何给定的 GPIO 针比较有用,因此从一个公式中推导出值要比直接写入来好一些。表示 `OK` 的 LED 灯是直接连线到 GPIO 的第 16 号针脚上的,因此我们需要发送一个命令去启用第 16 号针脚。 + +寄存器 r1 中的值是启用 LED 针所需要的。第一行命令将数字 110 放到 r1 中。在这个操作中 `mov` 命令要比 `ldr` 命令快很多,因为它不需要与内存交互,而 `ldr` 命令是将需要的值从内存中加载到寄存器中。尽管如此,`mov` 命令仅能用于加载某些值。在 ARM 汇编代码中,基本上每个指令都使用一个三字母代码表示。它们被称为助记词,用于表示操作的用途。`mov` 是 “move" 的简写,而 `ldr` 是 “load register” 的简写。`mov` 是将第二个参数 #1 移动到前面的 r1 寄存器中。一般情况下,`#` 肯定是表示一个数字,但我们已经看到了不符合这种情况的一个反例。 + +第二个指令是 `lsl`(逻辑左移)。它的意思是将第一个参数的二进制操作数向左移第二个参数所表示的位数。在这个案例中,将 110 (即 12 )向左移 18 位(将它变成 10000000000000000002=26214410 )。 + +如果你不熟悉二进制表示法,可以看下面的内容: + +与十六进制一样,二进制是写数字的另一种方法。在二进制中只有两个数字,即 0 和 1。它在计算机中非常有用,因为我们可以用电路来实现它,即电流能够通过电路表示为 1,而电流不能通过电路表示为 0。这就是计算机能够完成真实工作和做数学运算的原理。尽管二进制只有两个数字,但它却能够表示任何一个数字,只是写起来有点长而已。 + +![567 in decimal = 1000110111 in binary][7] + +这个图片展示了 56710 的二进制表示是 10001101112 。我们使用下标 2 来表示这个数字是用二进制写的。 + +我们在汇编代码中大量使用二进制的其中一个巧合之处是,数字可以很容易地被 2 的幂(即 1、2、4、8、16)乘或除。通常乘法和除法都是非常难的,而在某些特殊情况下却变得非常容易,所以二进制非常重要。 + +![13*4 = 52, 1101*100=110100][8] + +将一个二进制数字左移 **n** 位就相当于将这个数字乘以 2 **n**。因此,如果我们想将一个数乘以 4,我们只需要将这个数字左移 2 位。如果我们想将它乘以 256,我们只需要将它左移 8 位。如果我们想将一个数乘以 12 这样的数字,我们可以有一个替代做法,就是先将这个数乘以 8,然后再将那个数乘以 4,最后将两次相乘的结果相加即可得到最终结果(N × 12 = N × (8 + 4) = N × 8 + N × 4)。 + +![53/16 = 3, 110100/10000=11][9] + +右移一个二进制数 **n** 位就相当于这个数除以 2 **n** 。在右移操作中,除法的余数位将被丢弃。不幸的是,如果对一个不能被 2 的幂次方除尽的二进制数字做除法是非常难的,这将在 [课程 9:Screen04][10] 中讲到。 + +![Binary Terminology][11] + +这个图展示了二进制常用的术语。一个比特bit就是一个单独的二进制位。一个“半字节nibble“ 是 4 个二进制位。一个字节byte是 2 个半字节,也就是 8 个比特。在一个word用两个字节来表示的情况下,一半是指一个字长度的一半。一个字是指处理器上寄存器的大小,因此,树莓派的字长是 4 字节。按惯例,将一个数字最高有效位标识为 31,而将最低有效位标识为 0。顶部或最高位表示最高有效位,而底部或最低位表示最低有效位。一个 kilobyte(KB)就是 1000 字节,一个 megabyte 就是 1000 KB。这样表示会导致一些困惑,到底应该是 1000 还是 1024(二进制中的整数)。鉴于这种情况,新的国际标准规定,一个 KB 等于 1000 字节,而一个 Kibibyte(KiB)是 1024 字节。一个 Kb 是 1000 比特,而一个 Kib 是 1024 比特。 + +树莓派默认采用小端法,也就是说,你刚才写的从地址上加载一个字节时,是从一个字的低位字节开始加载的。 + +再强调一次,我们只有去阅读手册才能知道我们所需要的值。手册上说,GPIO 控制器中有一个 24 字节的集合,由它来决定 GPIO 针脚的设置。第一个 4 字节与前 10 个 GPIO 针脚有关,第二个 4 字节与接下来的 10 个针脚有关,依此类推。总共有 54 个 GPIO 针脚,因此,我们需要 6 个 4 字节的一个集合,总共是 24 个字节。在每个 4 字节中,每 3 个比特与一个特定的 GPIO 针脚有关。我们想去启用的是第 16 号 GPIO 针脚,因此我们需要去设置第二组 4 字节,因为第二组的 4 字节用于处理 GPIO 针脚的第 10-19 号,而我们需要 3 比特集合的第 6 位,它在上面的代码中的编号是 18(6×3)。 + +最后的 `str`(store register)命令去保存第一个参数中的值,将寄存器 r1 中的值保存到后面的表达式计算出来的地址上。这个表达式可以是一个寄存器,在上面的例子中是 r0,我们知道 r0 中保存了GPIO 控制器的地址,而另一个值是加到它上面的,在这个例子中是 #4。它的意思是将 GPIO 控制器地址加上 4 得到一个新的地址,并将寄存器 r1 中的值写到那个地址上。那个地址就是我们前面提到的第二个 4 字节集合的位置,因此,我们发送我们的第一个消息到 GPIO 控制器上,告诉它准备启用 GPIO 第 16 号针脚的输出。 + +### 5、一个活跃信号 + +现在,LED 已经做好了打开准备,我们还需要实际去打开它。意味着需要给 GPIO 控制器发送一个消息去关闭 16 号针脚。是的,你没有看错,就是要发送一个关闭的消息。芯片制造商认为,在 GPIO 针脚关闭时打开 LED 更有意义。硬件工程师经常做这种反常理的决策,似乎是为了让操作系统开发者保持警觉。可以认为是给自己的一个警告。 + +``` +mov r1,#1 +lsl r1,#16 +str r1,[r0,#40] +``` + +希望你能够认识上面全部的命令,先不要管它的值。第一个命令和前面一样,是将值 1 推入到寄存器 r1 中。第二个命令是将二进制的 1 左移 16 位。由于我们是希望关闭 GPIO 的 16 号针脚,我们需要在下一个消息中将第 16 比特设置为 1(想设置其它针脚只需要改变相应的比特位即可)。最后,我们写这个值到 GPIO 控制器地址加上 4010 的地址上,这将使那个针脚关闭(加上 28 将打开针脚)。 + +### 6、永远幸福快乐 + +现在结束,可能有点意犹未尽,但不幸的是,处理器并不知道我们做了什么。事实上,处理器只要通电,它就永不停止地运转。因此,我们需要给它一个任务,让它一直运转下去,否则,树莓派将进入休眠(本示例中不会,因为 LED 灯一直亮着)。 + +``` +loop$: +b loop$ +``` + +``` +name: labels 下一行的名字。 + +b label 下一行将去运行标签。 +``` + +第一行不是一个命令,而是一个标签。它是下一行循环 `loop$` 的名字,这意味着我们能够通过名字来指向到行。这就称为一个标签。当代码被转换成二进制后,标签将被丢弃,但这对我们通过名字而不是数字(地址)找到行比较有用。按惯例,我们使用一个 ​$ 表示标签,这个标签只对这个代码块中的代码起作用,让其它人知道,它不对整个程序起作用。`b`(branch)命令将去运行指定的标签中的命令,而不是去运行它后面的下一个命令。因此,下一行将再次去运行这个 `b` 命令,这将导致永远循环下去。因此处理器将进入一个无限循环中,直到它安全关闭为止。 + +代码块结尾的新行是有意这样写的。GNU 工具链要求所有的汇编代码文件都是以空行结束的,因此,这就需要你确保确实是要结束了,并且文件不能被截断。如果你不这样处理,在汇编器运行时,你将收到烦人的警告。 + +### 7、树莓派上场 + +由于我们已经写完了代码,现在,我们可以将它上传到树莓派中了。在你的计算机上打开一个终端,改变当前工作目录为 `source` 文件夹的父级目录。输入 `make` 然后回车。如果报错,请参考排错章节。如果没有报错,你将生成三个文件。 `kernel.img` 是你的编译后的操作系统镜像。`kernel.list` 是你写的汇编代码的一个清单,它实际上是生成的。这在将来检查程序是否正确时非常有用。`kernel.map` 文件包含所有标签结束位置的一个映射,这对于跟踪值非常有用。 + +为安装你的操作系统,需要先有一个已经安装了树莓派操作系统的 SD 卡。如果你浏览 SD 卡中的文件,你应该能看到一个名为 `kernel.img` 的文件。将这个文件重命名为其它名字,比如 `kernel_linux.img`。然后,复制你编译的 `kernel.img` 文件到 SD 卡中原来的位置,这将用你的操作系统镜像文件替换现在的树莓派操作系统镜像。想切换回来时,只需要简单地删除你自己的 `kernel.img` 文件,然后将前面重命名的文件改回 `kernel.img` 即可。我发现,保留一个原始的树莓派操作系统的备份是非常有用的,万一你要用到它呢。 + +将这个 SD 卡插入到树莓派,并打开它的电源。这个 `OK` 的 LED 灯将亮起来。如果不是这样,请查看故障排除页面。如果一切如愿,恭喜你,你已经写出了你的第一个操作系统。[课程 2:OK02][12] 将指导你让 LED 灯闪烁和关闭闪烁。 + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/downloads.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal1.png +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal2.png +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal3.png +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal4.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioController.png +[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary1.png +[8]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary2.png +[9]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary3.png +[10]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html +[11]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary4.png +[12]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html From 73edbf08af4767b9f01694bd6052357ed3ad71d0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 13 Jan 2019 23:04:01 +0800 Subject: [PATCH 0550/4278] PRF:20170921 The Rise and Rise of JSON.md @runningwater --- .../20170921 The Rise and Rise of JSON.md | 75 +++++++++++-------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/translated/talk/20170921 The Rise and Rise of JSON.md b/translated/talk/20170921 The Rise and Rise of JSON.md index e5eb3b2dd6..8456a70fa5 100644 --- a/translated/talk/20170921 The Rise and Rise of JSON.md +++ b/translated/talk/20170921 The Rise and Rise of JSON.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (The Rise and Rise of JSON) [#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) @@ -9,61 +9,61 @@ JSON 的兴起与崛起 ====== -JSON 已经占领了全世界。当今,任何两个应用程序彼此通过网络通信时,它们很有可能在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口(主要由 Google、Facebook 和 Twitter 提供的)列表中,仅仅只有一个 API 接口是以 XML 的格式开放数据的。Twitter 给这个 API 添加了一个说明性示例:XML 格式的支持到 2013 年结束,到时候会发布一个新版本的 API,取消 XML 格式,转而使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。 + +JSON 已经占领了全世界。当今,任何两个应用程序彼此通过互联网通信时,可以打赌它们在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口(主要由 Google、Facebook 和 Twitter 提供的)列表中,仅仅只有一个 API 接口是以 XML 的格式开放数据的。[^1] Twitter 给这个 API 添加了一个说明性示例:XML 格式的支持到 2013 年结束,到时候会发布一个新版本的 API,取消 XML 格式,转而使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(LCTT 译注:一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。[^2] ![][1] -XML 仍然在很多地方存在。在网页上有 SVG 和 RSS 订阅服务、Atom 提供商。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明。此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 -考虑到自 2005 年来网站编程世界对 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 技术潜力的垂涎欲滴状态,你可以发现 JSON 在其中的主导地位是如此让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,仅反映出 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2015 年时有好些人已经用 JSON 来取代 XML 了(实际上还没有很多人),我们不禁要问 XML 的噩运来的如此之快,以至于短短十年左右,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那个十年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? +XML 仍然在很多地方存在。网络上它被用于 SVG 和 RSS / Atom 信息流。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明,此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 +考虑到自 2005 年来网站编程世界就垂涎于 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 的技术潜力,你可以发现 JSON 在其中的主导地位是如此让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,仅反映出缩写 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2015 年(LCTT 译注:原文此处为 2005 ,根据上下文,应该为 2015)时有些人已经用 JSON 来取代 XML 了(实际上还没有很多人),我们不禁要问 XML 的噩运来的如此之快,以至于短短十年左右,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那十年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? ### JSON 之诞生 -2001 年 4 月,首个 JSON 格式的消息被发送。此消息是从旧金山湾区某车库的一台计算机发出的,这是计算机历史上重要的的时刻。Douglas Crockford 和 Chip Morningstar 是一家名为 State Software 的技术咨询公司的联合创始人,他们当时聚集在 Morningstar 的车库里测试某个想法,发出了此消息。 +2001 年 4 月,首个 JSON 格式的消息被发送出来。此消息是从旧金山湾区某车库的一台计算机发出的,这是计算机历史上重要的的时刻。Douglas Crockford 和 Chip Morningstar 是一家名为 State Software 的技术咨询公司的联合创始人,他们当时聚集在 Morningstar 的车库里测试某个想法,发出了此消息。 在 “AJAX” 这个术语被创造之前, Crockford 和 Morningstar 就已经在尝试构建好用的 AJAX 应用程序了。可是浏览器对其兼容性不好。他们想要在初始页面加载后就将数据传递给应用程序,但其目标要针对所有的浏览器,这就实现不了。 -这在今天看来不太可信,但是要记得 2001 年的时候 Internet Explorer(IE)代表了网页浏览器的最前沿技术产品。早在 1999 年的时候,Internet Explorer 5 就支持 `XMLHttpRequest 对象原型`,开发者可以使用名为 ActiveX 的框架来访问此对象。 Crockford 和 Morningstar 可能是使用此技术来获取数据,但是在 Netscape 4 中(这是他们想要支持的另一种浏览器)就无法使用这种解决方案。为此 Crockford 和 Morningstar 只得开发不同的系统程序以兼容不同的浏览器。 +这在今天看来不太可信,但是要记得 2001 年的时候 Internet Explorer(IE)代表了网页浏览器的最前沿技术产品。早在 1999 年的时候,Internet Explorer 5 就支持了原始形式的 `XMLHttpRequest`,开发者可以使用名为 ActiveX 的框架来访问此对象。Crockford 和 Morningstar 能够使用此技术(在 IE 中)来获取数据,但是在 Netscape 4 中(这是他们想要支持的另一种浏览器)就无法使用这种解决方案。为此 Crockford 和 Morningstar 只得使用一套不同的系统以兼容不同的浏览器。 第一条 JSON 消息如下所示: ``` ``` -消息中只有一小部分类似于今天我们所知的 JSON,本身其实是一个包含有 JavaScript 的 HTML 文档。类似于 JSON 的部分只是传递给名为`receive()` 的函数的 JavaScript 对象。 +消息中只有一小部分类似于今天我们所知的 JSON,本身其实是一个包含有一些 JavaScript 的 HTML 文档。类似于 JSON 的部分只是传递给名为 `receive()` 的函数的 JavaScript 对象字面量。 -Crockford 和 Morningstar 决定滥用 HTML 的 frame,以发送数据。敲入 URL 返回的 HTML 文档(如上所示)可以指向一个 frame 标签。当接收到 HTML 时,JavaScript 代码段一运行,就可以把数据对象如实地传递回应用程序。只要小心的回避浏览器保护策略,即子窗口不允许访问父窗口,这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于 frame 的技术,有时称为隐藏 frame 技术,通常在90年代后期,即广泛使用 XMLHttpRequest 技术之前使用。) +Crockford 和 Morningstar 决定滥用 HTML 的帧(``)以发送数据。他们可以让一个帧指向一个返回的上述 HTML 文档的 URL。当接收到 HTML 时,JavaScript 代码段就会运行,就可以把数据对象字面量如实地传递回应用程序。只要小心的回避浏览器保护策略(即子窗口不允许访问父窗口),这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于帧的技术,有时称为隐藏帧技术,通常在 90 年代后期,即广泛使用 XMLHttpRequest 技术之前使用。[^3] ) -关于第一个 JSON 消息的惊人之处在于它显然不是第一次就使用新的数据格式。它仅仅是 JavaScript!实际上,以此使用 JavaScript 的想法如此简单,Crockford 自己也说过他不是第一个这样做的人。他声称 Netscape 公司的某人早在 1996 年就使用 JavaScript 数组文字来交换信息。因为消息就是 JavaScript 本身,其不需要任何特殊解析工作,JavaScript 解释器就可搞定一切。 +第一个 JSON 消息的惊人之处在于,它显然不是一种新的数据格式的首次使用。它就是 JavaScript!实际上,以此方式使用 JavaScript 的想法如此简单,Crockford 自己也说过他不是第一个这样做的人。他说 Netscape 公司的某人早在 1996 年就使用 JavaScript 数组字面量来交换信息。[^4] 因为消息就是 JavaScript,其不需要任何特殊解析工作,JavaScript 解释器就可搞定一切。 -最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 使用了大量的单词来做为保留字(ECMAScript 6 版本的就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中引入了一个保留字。他们使用了 `do` 这个关键字,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 关键字都加上引号。被引起来的关键字会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 关键字都要用引号引起来的原因。 +最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 保留了大量的关键字(ECMAScript 6 版本的就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中使用了一个保留字。他们使用了 `do` 作为了键名,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 键名都加上引号。被引起来的键名会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 键名都要用引号引起来的原因。 -Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言,但发现这个缩写已经被叫做 Java 标记语言的所使用了。因此他们决定采用 “JavaScript Object Notation” 或 JSON 命名。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 - -2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统明显与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 +Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言JavaScript Markup Language的意思,但发现这个缩写已经被叫做 Java Speech 标记语言所使用了。因此他们决定采用 “JavaScript Object Notation”,即 JSON。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 +2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。该网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在该网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统明显与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 ### AJAX 导致的误会 -2005 年,JSON 有了一次大扩展。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发人员在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种技术以某种强大的新方式汇集,其中的各技术各自发展。” AJAX 是 Garrett 给 Web 应用程序开发的新方法(其正获得青睐)的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 对象构建新的应用程序,这些应用程序比传统的网页更具响应性和状态性。 他还举了 Gmail 和 Flickr的网站已经使用 AJAX 技术的例子。 +2005 年,JSON 有了一次大爆发。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发者在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种蓬勃发展的技术以某种强大的新方式汇集在一起。[^5] ” AJAX 是 Garrett 给这种正受到青睐的新 Web 应用程序开发方法的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 构建新型应用程序,这些应用程序比传统的网页更具响应性和状态性。他还以 Gmail 和 Flickr 网站已经使用 AJAX 技术的例子。 -当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:虽然 XML 是 AJAX 客户端进行数据输入输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation (JSON)或任何类似的结构数据方法等技术。 +当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:“虽然 XML 是 AJAX 客户端进行数据输入输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation (JSON)或任何类似的结构数据方法等技术。 ”[^6] -开发者确实发现在构建 AJAX 应用程序时可以很容易的使用 JSON,并且很多人也开始喜欢上 XML。具有讽刺意味的是,对 AJAX 的兴趣逐渐的导致了 JSON 的普及。大约在这个时候,JSON 引起了博客圈的注意。 +开发者确实发现在构建 AJAX 应用程序时可以很容易的使用 JSON,许多人更喜欢它而不是 XML。具有讽刺意味的是,对 AJAX 的兴趣逐渐的导致了 JSON 的普及。大约在这个时候,JSON 引起了博客圈的注意。 -2006 年,Dave Winer,一位高产的博主,也是许多基于 XML 技术(如 RSS 和 XML-RPC)的后端开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。虽然他认为数据交换格式之间的竞争不会导致某一技术的消亡,其写到: +2006 年,Dave Winer,一位高产的博主,也是许多基于 XML 的技术(如 RSS 和 XML-RPC)背后的开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。尽管人们认为数据交换格式之间的竞争不会导致某一技术的消亡,其写到: -> 让我们来比较下重构某结构数据的深度及难度,由于某些原因(我很想听听原因),XML 自身做的并不好,所以毫无疑问地,我会写一个例程来解析 JSON 格式的数据。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。 +> 毫无疑问,我可以编写一个例程来分析 JSON,但看看他们有多大的意义要重新发明,出于某种原因 XML 本身对他们来说还不够好(我很想听听原因)。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。[^7] -很容易理解 Winer 的挫败感,事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。但 XML 已被设计成一个可供任何人使用,并且几乎能想象到的事情都可以做到的系统。最终,XML 实际上是一门元语言,允许你为特定应用程序自定义特定域的语言。如 RSS、web feed 技术和 SOAP(简单对象访问协议)就是自定义的例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识就很重要了。XML 的灵活性应该能满足任何人的需求,然而这里是 JSON 格式,其并不比 XML 更具优势,但其抛弃了 XML 中不好的设计,可以使 XML 更加的灵活。 +我很理解 Winer 的挫败感。事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。[^8] 但 XML 已被设计成一个可供任何人使用,并且几乎能想象到的事情都可以做到的系统。最终,XML 实际上是一门元语言,允许你为特定应用程序自定义特定领域的语言。如 Web 信息流技术 RSS 和 SOAP(简单对象访问协议)就是例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识就很重要了。XML 的灵活性应该能满足任何人的需求,然而 JSON 格式呢,其并没有比 XML 提供更多东西,除了它抛弃了使 XML 更灵活的繁琐的东西。 -Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 重新发明 XML 的指责,Crockford 写到:重造轮子的好处是可以得到一个更好的轮子。 +Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 重新发明 XML 的指责,Crockford 写到:“重造轮子的好处是可以得到一个更好的轮子。”[^9] ### JSON 与 XML 对比 @@ -71,18 +71,31 @@ Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 为什么 JSON 比 XML 更受欢迎? -在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法很小,其结构可预测,因此 JSON 更容易被人类和机器理解。其他博主不得不关注 XML 的冗长啰嗦及“尖括号负担”。XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 +在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法极少,其结构可预测,因此 JSON 更容易被人类和机器理解。[^10] 其他博主一直关注 XML 的冗长啰嗦及“尖括号负担”。[^11] XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 -Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它从 SGML(通用标准标记语言)演变而来,后来又从称为 Scribe 的标记语言是发展,旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”或包含有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型清晰构建,但也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本也最熟悉的元素。 +Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。[^12] 从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它演变自 SGML(通用标准标记语言),而它又是从称为 Scribe 的标记语言演变而来,旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”,即带有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型清晰构建,但也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了这种文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本也最熟悉的元素。 -最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。通用 XML 文档创建的版本做为第一个基线,然后特定的子语言 XML 版本应该在这基础上变动。这就有需要变化需要考虑的了,特别是跟 JSON 做比较。JSON 的是如此简单,以至于 JSON 新版本规范甚至都不用重写。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,会掉入那个经典程序员的陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 +最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。典型的 XML 文档的第一行标识了该 XML 的版本,然后该 XML 文档应该符合特定的子语言。这就有需要变化需要考虑的了,特别是跟 JSON 做比较,JSON 的是如此简单,以至于永远不需要编写新版本的 JSON 规范。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,会掉入那个经典程序员的陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 -在 2000 年的时候,推出了一场活动,以使 HTML 符合 XML 标准。发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器供应商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准已经流产,因为未来已清晰可见, HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 +在 2000 年的时候,发起了一场使 HTML 符合 XML 标准的活动。发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器供应商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准的努力已经流产,因为未来已清晰可见,HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 -如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者希望的通用数据格式。想象一下,HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我读懂了, XHTML 的失败是 XML 阵营的一种道德失败。如果 XML 不是 HTML 的最佳工具,那么为了其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣才能获得更大的成功。 +如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者希望的通用数据格式。想象一下,HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我把 HTML 的失败看做是 XML 阵营的一种道义上的失败。如果 XML 不是 HTML 的最佳工具,那么对于其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣的才能获得更大的成功。 如果你喜欢这博文,每两周会更新一次! 请在 Twitter 上关注 [@TwoBitHistory] [3] 或订阅 [RSS feed] [4], 以确保得到更新的通知。 +[^1]: http://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#software +[^2]: https://insights.stackoverflow.com/trends?tags=json%2Cxml%2Cprotocol-buffers%2Cyaml%2Ccsv +[^3]: Zakas, Nicholas C., et al. “What Is Ajax?” Professional Ajax, 2nd ed., Wiley, 2007. +[^4]: https://youtu.be/-C-JoyNuQJs?t=32s +[^5]: http://adaptivepath.org/ideas/ajax-new-approach-web-applications/ +[^6]: 同上 +[^7]: http://scripting.com/2006/12/20.html +[^8]: http://blogoscoped.com/archive/2009-03-05-n15.html +[^9]: https://scripting.wordpress.com/2006/12/20/scripting-news-for-12202006/#comment-26383 +[^10]: http://www.json.org/xml.html +[^11]: https://blog.codinghorror.com/xml-the-angle-bracket-tax +[^12]: https://youtu.be/-C-JoyNuQJs?t=33m50sgg + -------------------------------------------------------------------------------- via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html @@ -90,7 +103,7 @@ via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] 译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f83deae49e676bd4ffed77122e5b395c1956c400 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 14 Jan 2019 08:57:22 +0800 Subject: [PATCH 0551/4278] translated --- ... Linux desktop into a home media center.md | 87 ------------------- ... Linux desktop into a home media center.md | 87 +++++++++++++++++++ 2 files changed, 87 insertions(+), 87 deletions(-) delete mode 100644 sources/tech/20181128 Turn an old Linux desktop into a home media center.md create mode 100644 translated/tech/20181128 Turn an old Linux desktop into a home media center.md diff --git a/sources/tech/20181128 Turn an old Linux desktop into a home media center.md b/sources/tech/20181128 Turn an old Linux desktop into a home media center.md deleted file mode 100644 index eed213a42e..0000000000 --- a/sources/tech/20181128 Turn an old Linux desktop into a home media center.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Turn an old Linux desktop into a home media center) -[#]: via: (https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center) -[#]: author: ([Alan Formy-Duval](https://opensource.com/users/alanfdoss)) -[#]: url: ( ) - -Turn an old Linux desktop into a home media center -====== -Repurpose an outdated computer to browse the internet and watch videos on your big screen TV. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q) - -My first attempt to set up an "entertainment PC" was back in the late 1990s, using a plain old desktop computer with a Trident ProVidia 9685 PCI graphics card. I used what was known as a "TV-out" card, which had an extra output to connect to a standard television set. The onscreen result didn't look very nice and there was no audio output. And it was ugly: I had an S-Video cable running across my living room floor to my 19" Sony Trinitron CRT TV set. - -I had the same sad result from Linux and Windows 98. After struggling with systems that never looked right, I gave up for a few years. Thankfully, today we have HDMI with its vastly better performance and standardized resolution, which makes an inexpensive home media center a reality. - -My new media center entertainment computer is actually my old Ubuntu Linux desktop, which I recently replaced with something faster. The computer became too slow for work, but its AMD Phenom II X4 965 processor at 3.4GHz and 8GB of RAM are good enough for general browsing and video streaming. - -Here are the steps I took to get the best possible performance out of this old system for its new role. - -### Hardware - -First, I removed unnecessary devices including a card reader, hard drives, DVD drive, and a rear-mounted USB card, and I added a PCI-Express WiFi card. I installed Ubuntu to a single solid-state drive (SSD), which can really improve the performance of any older system. - -### BIOS - -In the BIOS, I disabled all unused devices, such as floppy and IDE drive controllers. I disabled onboard video because I installed an NVidia GeForce GTX 650 PCI Express graphics card with an HDMI output. I also disabled onboard audio because the NVidia graphics card chipset provides audio. - -### Audio - -The Nvidia GeForce GTX audio device is listed in the GNOME Control Center's sound settings as a GK107 HDMI Audio Controller, so a single HDMI cable handles both audio and video. There's no need for an audio cable connected to the onboard audio output jack. - -![Sound settings screenshot][2] - -HDMI audio controller shown in GNOME sound settings. - -### Keyboard and mouse - -I have a wireless keyboard and mouse, both from Logitech. When I installed them, I plugged in both peripherals' USB receivers; they worked, but I often had signal-response problems. Then I discovered one was labeled a Unifying Receiver, which meant it can handle multiple Logitech input devices on its own. Logitech doesn't provide software to configure Unifying Receivers in Linux; fortunately, the open source utility [Solaar][3] does. Using a single receiver solved my input performance issues. - -![Solaar][5] - -Solaar Unifying Receiver interface. - -### Video - -It was initially hard to read fonts on my 47" flat-panel TV, so I enabled "Large Text" under Universal Access. I downloaded some wallpapers matching the TV's 1920x1080 resolution that look fantastic! - -### Final touches - -I needed to balance the computer's cooling needs with my desire for unimpeded entertainment. Since this is a standard ATX mini-tower computer, I made sure I had just enough fans with carefully configured temperature settings in the BIOS to reduce fan noise. I also placed the computer behind my entertainment console to further block fan noise but positioned so I can reach the power button. - -The result is a simple machine that is not overly loud and uses only two cables—AC power and HDMI. It should be able to run any mainstream or specialized media center Linux distribution. I don't expect to do too much high-end gaming because that may require more processing horsepower. - -![Showing Ubuntu Linux About page onscreen][7] - -Ubuntu Linux About page. - -![YouTube on the big screen][9] - -Testing a YouTube video on the big screen. - -I haven't yet installed a dedicated media center distribution of Linux like [Kodi][10]. For now, it is running Ubuntu Linux 18.04.1 LTS and is very stable. - -This was a fun challenge to make the best of what I already had rather than buying new hardware. This is just one benefit of open source software. Eventually, I will probably replace it with a smaller, quieter system with a media-center case or another small box, but for now, it meets my needs quite well. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center - -作者:[Alan Formy-Duval][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/alanfdoss -[b]: https://github.com/lujun9972 -[2]: https://opensource.com/sites/default/files/uploads/soundsettings.png (Sound settings screenshot) -[3]: https://pwr.github.io/Solaar/ -[5]: https://opensource.com/sites/default/files/uploads/solaar_interface.png (Solaar) -[7]: https://opensource.com/sites/default/files/uploads/finalresult1.png (Showing Ubuntu Linux About page onscreen) -[9]: https://opensource.com/sites/default/files/uploads/finalresult2.png (YouTube on the big screen) -[10]: https://kodi.tv/ diff --git a/translated/tech/20181128 Turn an old Linux desktop into a home media center.md b/translated/tech/20181128 Turn an old Linux desktop into a home media center.md new file mode 100644 index 0000000000..1ad384583c --- /dev/null +++ b/translated/tech/20181128 Turn an old Linux desktop into a home media center.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Turn an old Linux desktop into a home media center) +[#]: via: (https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center) +[#]: author: ([Alan Formy-Duval](https://opensource.com/users/alanfdoss)) +[#]: url: ( ) + +将旧的 Linux 桌面变成家庭媒体中心 +====== +重新利用过时的计算机来浏览互联网并在大屏电视上观看视频。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q) + +我第一次尝试搭建一台“娱乐电脑”是在 20 世纪 90 年代后期,使用一台带 Trident ProVidia 9685 PCI 显卡的普通旧台式电脑。我使用了所谓的“电视输出”卡,它有一个额外的输出连接到标准电视端子上。屏幕显示看起来不太好,而且没有音频输出。并且外观很丑:有一条 S-Video 线穿过了客厅地板连接到我的 19 英寸 Sony Trinitron CRT 电视机上。 + +我在 Linux 和 Windows 98 上也得到了同样令人遗憾的结果。在和那些看起来不对劲的系统挣扎之后,我放弃了几年。值得庆幸的是,如今的 HDMI 拥有更好的性能和标准化的分辨率,这使得廉价的家庭媒体中心成为现实。 + +我的新媒体中心娱乐电脑实际上是我的旧 Ubuntu Linux 桌面,最近我用更快的电脑替换了它。这台电脑在工作中太慢,但是它的 3.4GHz 的 AMD Phenom II X4 965 处理器和 8GB 的 RAM 足以满足一般浏览和视频流的要求。 + +以下是我让旧系统在新角色中发挥最佳性能所采取的步骤。 + +### 硬件 + +首先,我移除了不必要的设备,包括读卡器、硬盘驱动器、DVD 驱动器和后置 USB 卡,我添加了一块 PCI-Express 无线网卡。我将 Ubuntu 安装到单个固态硬盘 (SSD) 上,这可以切实提高任何旧系统的性能。 + +### BIOS + +在 BIOS 中,我禁用了所有未使用的设备,例如软盘和 IDE 驱动器控制器。我禁用了板载显卡,因为我安装了带 HDMI 输出的 NVidia GeForce GTX 650 PCI Express 显卡。我还禁用了板载声卡,因为 NVidia 显卡芯片组提供音频。 + +### 音频 + +Nvidia GeForce GTX 音频设备在 GNOME 控制中心的声音设置中被列为 GK107 HDMI Audio Controller,因此单条 HDMI 线缆可同时处理音频和视频。无需将音频线连接到板载声卡的输出插孔。 + +![Sound settings screenshot][2] + +GNOME 音频设置中的 HDMI 音频控制器。 + +### 键盘和鼠标 + +我有罗技的无线键盘和鼠标。当我安装它们时,我插入了两个外置 USB 接收器,它们可以使用,但我经常遇到信号反应问题。接着我发现其中一个被标记为联合接收器,这意味着它可以自己处理多个罗技输入设备。罗技不提供在 Linux 中配置统一接收器的软件。但幸运的是,有个开源程序 [Solaar][3] 能够做到。使用单个接收器解决了我的输入性能问题。 + +![Solaar][5] + +Solaar 联合接收器界面。 + +### 视频 + +最初很难在我的 47 英寸平板电视上阅读,所以我在 Universal Access 下启用了“大文字”。我下载了一些与电视 1920x1080 分辨率相匹配的壁纸,这看起来很棒! + +### 最后处理 + +我需要在电脑的冷却需求和我对不受阻碍的娱乐的渴望之间取得平衡。由于这是一台标准的 ATX 微型塔式计算机,我确保我有足够的风扇,以及在 BIOS 中精心配置过的温度以减少噪音。我还把电脑放在我的娱乐控制台后面,以进一步减少风扇噪音,但同时我可以按到电源按钮。 + +最后得到一台简单的没有巨大噪音的机器,而且只使用了两根线缆—交流电源线和 HDMI。它应该能够运行任何主流或专门的媒体中心 Linux 发行版。我不期望去玩高端的游戏,因为这可能需要更多的处理能力。 + +![Showing Ubuntu Linux About page onscreen][7] + +Ubuntu Linux 的关于页面。 + +![YouTube on the big screen][9] + +在大屏幕上测试 YouTube 视频。 + +我还没安装像 [Kodi][10] 这样专门的媒体中心发行版。截至目前,它运行的是 Ubuntu Linux 18.04.1 LTS,而且很稳定。 + +这是一个有趣的挑战,可以充分利用我已经拥有的东西,而不是购买新的硬件。这只是开源软件的一个好处。最终,我可能会用一个更小,更安静的带有媒体中心的系统或其他小机顶盒替换它,但是现在,它很好地满足了我的需求。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[2]: https://opensource.com/sites/default/files/uploads/soundsettings.png (Sound settings screenshot) +[3]: https://pwr.github.io/Solaar/ +[5]: https://opensource.com/sites/default/files/uploads/solaar_interface.png (Solaar) +[7]: https://opensource.com/sites/default/files/uploads/finalresult1.png (Showing Ubuntu Linux About page onscreen) +[9]: https://opensource.com/sites/default/files/uploads/finalresult2.png (YouTube on the big screen) +[10]: https://kodi.tv/ \ No newline at end of file From 33d8bfcc20ca21bfc0f68dee92a0f11d547b02de Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 14 Jan 2019 09:02:53 +0800 Subject: [PATCH 0552/4278] translating --- sources/tech/20180606 Working with modules in Fedora 28.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180606 Working with modules in Fedora 28.md b/sources/tech/20180606 Working with modules in Fedora 28.md index 9a45d3367b..ba92a626f8 100644 --- a/sources/tech/20180606 Working with modules in Fedora 28.md +++ b/sources/tech/20180606 Working with modules in Fedora 28.md @@ -1,3 +1,5 @@ +translating----geekpi + Working with modules in Fedora 28 ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/05/modules-workingwith-816x345.jpg) From 727e34994fb2b11a3b2607d17cccb627d2f450dc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Jan 2019 11:52:11 +0800 Subject: [PATCH 0553/4278] PRF:20170921 The Rise and Rise of JSON.md @runningwater --- .../20170921 The Rise and Rise of JSON.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translated/talk/20170921 The Rise and Rise of JSON.md b/translated/talk/20170921 The Rise and Rise of JSON.md index 8456a70fa5..915fe93d0b 100644 --- a/translated/talk/20170921 The Rise and Rise of JSON.md +++ b/translated/talk/20170921 The Rise and Rise of JSON.md @@ -10,18 +10,18 @@ JSON 的兴起与崛起 ====== -JSON 已经占领了全世界。当今,任何两个应用程序彼此通过互联网通信时,可以打赌它们在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口(主要由 Google、Facebook 和 Twitter 提供的)列表中,仅仅只有一个 API 接口是以 XML 的格式开放数据的。[^1] Twitter 给这个 API 添加了一个说明性示例:XML 格式的支持到 2013 年结束,到时候会发布一个新版本的 API,取消 XML 格式,转而使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(LCTT 译注:一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。[^2] +JSON 已经占领了全世界。当今,任何两个应用程序彼此通过互联网通信时,可以打赌它们在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口列表中(主要由 Google、Facebook 和 Twitter 提供),仅仅只有一个 API 接口是以 XML 的格式开放数据的。[^1] 这个列表中的 Twitter API 为此做了一个鲜活的注脚:其对 XML 格式的支持到 2013 年结束,其时发布的新版本的 API 取消 XML 格式,转而仅使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(LCTT 译注:一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。[^2] ![][1] -XML 仍然在很多地方存在。网络上它被用于 SVG 和 RSS / Atom 信息流。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明,此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 -考虑到自 2005 年来网站编程世界就垂涎于 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 的技术潜力,你可以发现 JSON 在其中的主导地位是如此让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,仅反映出缩写 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2015 年(LCTT 译注:原文此处为 2005 ,根据上下文,应该为 2015)时有些人已经用 JSON 来取代 XML 了(实际上还没有很多人),我们不禁要问 XML 的噩运来的如此之快,以至于短短十年左右,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那十年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? +XML 仍然在很多地方存在。网络上它被用于 SVG 和 RSS / Atom 信息流。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明 —— 此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 +考虑到自 2005 年来 Web 编程世界就垂涎于 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 的技术潜力,你可以发现 JSON 的主导地位是如此的让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,而仅反映出缩写 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2005 年有些人(实际上没有太多人)已经用 JSON 来取代 XML 了,我们不禁要问为什么 XML 的噩运来的如此之快,以至于短短十来年,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那这十来年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? ### JSON 之诞生 2001 年 4 月,首个 JSON 格式的消息被发送出来。此消息是从旧金山湾区某车库的一台计算机发出的,这是计算机历史上重要的的时刻。Douglas Crockford 和 Chip Morningstar 是一家名为 State Software 的技术咨询公司的联合创始人,他们当时聚集在 Morningstar 的车库里测试某个想法,发出了此消息。 -在 “AJAX” 这个术语被创造之前, Crockford 和 Morningstar 就已经在尝试构建好用的 AJAX 应用程序了。可是浏览器对其兼容性不好。他们想要在初始页面加载后就将数据传递给应用程序,但其目标要针对所有的浏览器,这就实现不了。 +在 “AJAX” 这个术语被创造之前,Crockford 和 Morningstar 就已经在尝试构建好用的 AJAX 应用程序了,可是浏览器对其兼容性不好。他们想要在初始页面加载后就将数据传递给应用程序,但其目标要针对所有的浏览器,这就实现不了。 这在今天看来不太可信,但是要记得 2001 年的时候 Internet Explorer(IE)代表了网页浏览器的最前沿技术产品。早在 1999 年的时候,Internet Explorer 5 就支持了原始形式的 `XMLHttpRequest`,开发者可以使用名为 ActiveX 的框架来访问此对象。Crockford 和 Morningstar 能够使用此技术(在 IE 中)来获取数据,但是在 Netscape 4 中(这是他们想要支持的另一种浏览器)就无法使用这种解决方案。为此 Crockford 和 Morningstar 只得使用一套不同的系统以兼容不同的浏览器。 @@ -39,49 +39,49 @@ XML 仍然在很多地方存在。网络上它被用于 SVG 和 RSS / Atom 信 消息中只有一小部分类似于今天我们所知的 JSON,本身其实是一个包含有一些 JavaScript 的 HTML 文档。类似于 JSON 的部分只是传递给名为 `receive()` 的函数的 JavaScript 对象字面量。 -Crockford 和 Morningstar 决定滥用 HTML 的帧(``)以发送数据。他们可以让一个帧指向一个返回的上述 HTML 文档的 URL。当接收到 HTML 时,JavaScript 代码段就会运行,就可以把数据对象字面量如实地传递回应用程序。只要小心的回避浏览器保护策略(即子窗口不允许访问父窗口),这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于帧的技术,有时称为隐藏帧技术,通常在 90 年代后期,即广泛使用 XMLHttpRequest 技术之前使用。[^3] ) +Crockford 和 Morningstar 决定滥用 HTML 的帧(``)以发送数据。他们可以让一个帧指向一个返回的上述 HTML 文档的 URL。当接收到 HTML 时,JavaScript 代码段就会运行,就可以把数据对象字面量如实地传递回应用程序。只要小心的回避浏览器保护策略(即子窗口不允许访问父窗口),这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于帧的技术,有时称为隐藏帧技术,通常在 90 年代后期,即在广泛使用 XMLHttpRequest 技术之前使用。[^3] ) 第一个 JSON 消息的惊人之处在于,它显然不是一种新的数据格式的首次使用。它就是 JavaScript!实际上,以此方式使用 JavaScript 的想法如此简单,Crockford 自己也说过他不是第一个这样做的人。他说 Netscape 公司的某人早在 1996 年就使用 JavaScript 数组字面量来交换信息。[^4] 因为消息就是 JavaScript,其不需要任何特殊解析工作,JavaScript 解释器就可搞定一切。 -最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 保留了大量的关键字(ECMAScript 6 版本的就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中使用了一个保留字。他们使用了 `do` 作为了键名,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 键名都加上引号。被引起来的键名会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 键名都要用引号引起来的原因。 +最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 保留了大量的关键字(ECMAScript 6 版本就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中使用了一个保留字。他们使用了 `do` 作为了键名,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 键名都加上引号。被引起来的键名会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 键名都要用引号引起来的原因。 -Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言JavaScript Markup Language的意思,但发现这个缩写已经被叫做 Java Speech 标记语言所使用了。因此他们决定采用 “JavaScript Object Notation”,即 JSON。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 +Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言JavaScript Markup Language的意思,但发现这个缩写已经被一个名为 Java Speech 标记语言的东西所使用了。因此他们决定采用 “JavaScript Object Notation”,缩写为 JSON。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 -2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。该网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在该网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统明显与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 +2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。该网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在该网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统显然与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 ### AJAX 导致的误会 -2005 年,JSON 有了一次大爆发。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发者在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种蓬勃发展的技术以某种强大的新方式汇集在一起。[^5] ” AJAX 是 Garrett 给这种正受到青睐的新 Web 应用程序开发方法的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 构建新型应用程序,这些应用程序比传统的网页更具响应性和状态性。他还以 Gmail 和 Flickr 网站已经使用 AJAX 技术的例子。 +2005 年,JSON 有了一次大爆发。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发者在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种蓬勃发展的技术以某种强大的新方式汇集在一起。[^5] ” AJAX 是 Garrett 给这种正受到青睐的 Web 应用程序的新开发方法的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 构建新型应用程序,这些应用程序比传统的网页更具响应性和状态性。他还以 Gmail 和 Flickr 网站已经使用 AJAX 技术作为了例子。 -当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:“虽然 XML 是 AJAX 客户端进行数据输入输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation (JSON)或任何类似的结构数据方法等技术。 ”[^6] +当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:“虽然 XML 是 AJAX 客户端进行数据输入、输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation(JSON)或任何类似的结构数据方法等技术。 ”[^6] 开发者确实发现在构建 AJAX 应用程序时可以很容易的使用 JSON,许多人更喜欢它而不是 XML。具有讽刺意味的是,对 AJAX 的兴趣逐渐的导致了 JSON 的普及。大约在这个时候,JSON 引起了博客圈的注意。 -2006 年,Dave Winer,一位高产的博主,也是许多基于 XML 的技术(如 RSS 和 XML-RPC)背后的开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。尽管人们认为数据交换格式之间的竞争不会导致某一技术的消亡,其写到: +2006 年,Dave Winer,一位高产的博主,他也是许多基于 XML 的技术(如 RSS 和 XML-RPC)背后的开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。尽管人们认为数据交换格式之间的竞争不会导致某一技术的消亡。其写到: -> 毫无疑问,我可以编写一个例程来分析 JSON,但看看他们有多大的意义要重新发明,出于某种原因 XML 本身对他们来说还不够好(我很想听听原因)。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。[^7] +> 毫无疑问,我可以编写一个例程来解析 JSON,但来看看他们要重新发明一个东西有多大的意义,出于某种原因 XML 本身对他们来说还不够好(我很想听听原因)。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。[^7] -我很理解 Winer 的挫败感。事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。[^8] 但 XML 已被设计成一个可供任何人使用,并且几乎能想象到的事情都可以做到的系统。最终,XML 实际上是一门元语言,允许你为特定应用程序自定义特定领域的语言。如 Web 信息流技术 RSS 和 SOAP(简单对象访问协议)就是例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识就很重要了。XML 的灵活性应该能满足任何人的需求,然而 JSON 格式呢,其并没有比 XML 提供更多东西,除了它抛弃了使 XML 更灵活的繁琐的东西。 +我很理解 Winer 的挫败感。事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。[^8] 但 XML 已被设计成一个可供任何人使用,并且可以用于几乎能想象到的所有事情。归根到底,XML 实际上是一门元语言,允许你为特定应用程序自定义该领域特定的语言。如 Web 信息流技术 RSS 和 SOAP(简单对象访问协议)就是例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识非常重要。XML 的灵活性应该能满足任何人的需求,然而 JSON 格式呢,其并没有比 XML 提供更多东西,除了它抛弃了使 XML 更灵活的那些繁琐的东西。 Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 重新发明 XML 的指责,Crockford 写到:“重造轮子的好处是可以得到一个更好的轮子。”[^9] ### JSON 与 XML 对比 -到 2014 年,JSON 已经由 ECMA 标准和 RFC 官方正式认可。它有自己的 MIME 类型。JSON 已经进入了大联盟时代。 +到 2014 年,JSON 已经由 ECMA 标准和 RFC 官方正式认可。它有了自己的 MIME 类型。JSON 已经进入了大联盟时代。 为什么 JSON 比 XML 更受欢迎? -在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法极少,其结构可预测,因此 JSON 更容易被人类和机器理解。[^10] 其他博主一直关注 XML 的冗长啰嗦及“尖括号负担”。[^11] XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 +在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法极少,其结构可预测,因此 JSON 更容易被人类和机器理解。[^10] 其他博主一直关注 XML 的冗长啰嗦及“尖括号负担”。[^11] XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同等信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 -Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。[^12] 从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它演变自 SGML(通用标准标记语言),而它又是从称为 Scribe 的标记语言演变而来,旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”,即带有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型清晰构建,但也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了这种文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本也最熟悉的元素。 +Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。[^12] 从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它演变自 SGML(通用标准标记语言),而它又是从被称为 Scribe 的标记语言演变而来,其旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”,即带有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型的清晰构建,但这也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了这种文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本的、也最熟悉的元素。 -最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。典型的 XML 文档的第一行标识了该 XML 的版本,然后该 XML 文档应该符合特定的子语言。这就有需要变化需要考虑的了,特别是跟 JSON 做比较,JSON 的是如此简单,以至于永远不需要编写新版本的 JSON 规范。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,会掉入那个经典程序员的陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 +最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。典型的 XML 文档的第一行标识了该 XML 的版本,然后该 XML 文档应该符合特定的子语言。这就有变化需要考虑了,特别是跟 JSON 做比较,JSON 是如此简单,以至于永远不需要编写新版本的 JSON 规范。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,就会掉入那个经典的程序员陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 -在 2000 年的时候,发起了一场使 HTML 符合 XML 标准的活动。发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器供应商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准的努力已经流产,因为未来已清晰可见,HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 +在 2000 年的时候,发起了一场使 HTML 符合 XML 标准的活动,发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器厂商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准的努力已经流产,因为未来已清晰可见,HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 -如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者希望的通用数据格式。想象一下,HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我把 HTML 的失败看做是 XML 阵营的一种道义上的失败。如果 XML 不是 HTML 的最佳工具,那么对于其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣的才能获得更大的成功。 +如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者所希望的通用数据格式。想象一下,一个 HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我把 HTML 的失败看做是 XML 阵营的一种道义上的失败。如果 XML 不是 HTML 的最佳工具,那么对于其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣的才能获得更大的成功。 -如果你喜欢这博文,每两周会更新一次! 请在 Twitter 上关注 [@TwoBitHistory] [3] 或订阅 [RSS feed] [4], 以确保得到更新的通知。 +如果你喜欢这博文,每两周会更新一次! 请在 Twitter 上关注 [@TwoBitHistory][3] 或订阅 [RSS feed][4],以确保得到更新的通知。 [^1]: http://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#software [^2]: https://insights.stackoverflow.com/trends?tags=json%2Cxml%2Cprotocol-buffers%2Cyaml%2Ccsv From 644421e7c6f4a2b78fb06081fe3e3626e974c74f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Jan 2019 11:53:02 +0800 Subject: [PATCH 0554/4278] PUB:20170921 The Rise and Rise of JSON.md @runningwater https://linux.cn/article-10440-1.html --- .../20170921 The Rise and Rise of JSON.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/talk => published}/20170921 The Rise and Rise of JSON.md (98%) diff --git a/translated/talk/20170921 The Rise and Rise of JSON.md b/published/20170921 The Rise and Rise of JSON.md similarity index 98% rename from translated/talk/20170921 The Rise and Rise of JSON.md rename to published/20170921 The Rise and Rise of JSON.md index 915fe93d0b..ffc62b5afe 100644 --- a/translated/talk/20170921 The Rise and Rise of JSON.md +++ b/published/20170921 The Rise and Rise of JSON.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (The Rise and Rise of JSON) -[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) +[#]: via: (https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) [#]: author: (https://twobithistory.org) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10440-1.html) JSON 的兴起与崛起 ====== From 10f1b86aebd7a91f458c5bad3251d2947991e1a1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Jan 2019 12:13:07 +0800 Subject: [PATCH 0555/4278] PRF:20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @zhs852 --- ...nal Sessions As SVG Animations In Linux.md | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md index 45219568f8..748f678a5d 100644 --- a/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md +++ b/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -1,34 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux) [#]: via: (https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Termtosvg – 将你在 Linux 终端中操作录制成 SVG 动画 +Termtosvg:将你在 Linux 终端中操作录制成 SVG 动画 ====== -一般人喜欢使用历史命令功能来查看/再次调用之前在终端中输入的命令。 +一般人喜欢使用历史命令功能来查看/再次调用之前在终端中输入的命令。不幸的是,那样做只会显示先前输入的命令,而不是之前输出的内容。 -不幸的是,那样做只会显示先前输入的命令,而不是之前输出的内容。 - -在 Linux 中,有许多可以用来记录终端活动的实用工具。 - -这种工具将会帮助我们记录用户在终端中的活动,并帮助我们识别输出中有用的信息。 +在 Linux 中,有许多可以用来记录终端活动的实用工具。这种工具将会帮助我们记录用户在终端中的活动,并帮助我们识别输出中有用的信息。 在这之前,我们已经介绍了一些这类实用工具了。今天,让我们接着讨论这类工具。 -如果你希望尝试其它一些记录你终端活动的工具,我推荐你试试 **[Script Command][1]** 和 **[Terminalizer Tool][2]**。 +如果你希望尝试其它一些记录你终端活动的工具,我推荐你试试 [script][1] 命令和 [Terminalizer][2] 工具。`script` 是在无头服务器中记录终端活动的最佳方式之一。`script` 是一个记录在终端中输入过的 Unix 命令的实用工具(在某些终端中,它会记录显示在你终端中的所有东西)。它会在当前工作目录下以文本文件方式储存所有终端输出。 -不过,如果你在寻找 **[GIF 录制器][3]** ,你可以尝试 **[Gifine][4]** 、**[Kgif][5]** 和 **[Peek][6]** 。 - -脚本是在无头服务器中记录终端活动的最佳方式之一。 - -脚本是记录在终端中输入过的 Unix 命令的实用工具(在某些终端中,它会记录显示在你终端中的所有东西)。 - -它会在当前工作目录下以文本文件方式储存所有终端输出。 +不过,如果你在寻找 [GIF 录制器][3] ,你可以尝试 [Gifine][4]、[Kgif][5] 和 [Peek][6]。 ### 什么是 Termtosvg @@ -36,47 +26,47 @@ Termtosvg 是一个用 Python 编写的 Unix 终端录制器,它可以将你 ### Termtosvg 的特点 - * 可以制作用于某个项目主页且简洁美观的动画。 + * 可以制作嵌入于项目主页的简洁美观的动画。 * 可以在 SVG 模板中自定义配色、终端 UI 和动画。 * 兼容 asciinema 录制格式。 * 要求 Python 版本为 3.5 或更高。 ### 如何在 Linux 中安装 Termtosvg -它是用 Python 编写的,所以我推荐使用 pip 来安装它。 +它是用 Python 编写的,所以我推荐使用 `pip` 来安装它。 -请确保你已经安装了 **python-pip** 包。如果你还没安装,请输入下面的命令。 -对于 Debian 或 Ubuntu 用户,请使用 **[apt][7]** 或 **[apt-get][8]** 来安装 pip。 +请确保你已经安装了 python-pip 包。如果你还没安装,请输入下面的命令。 +对于 Debian 或 Ubuntu 用户,请使用 [apt][7] 或 [apt-get][8] 来安装 `pip`。 ```shell sudo apt install python-pip ``` -对于 Archlinux 用户,请使用 **[pacman][9]** 来安装 pip。 +对于 Archlinux 用户,请使用 [pacman][9] 来安装 `pip`。 ```shell sudo pacman -S python-pip ``` -对于 Fedora 用户,请使用 **[dnf][10]** 来安装 pip。 +对于 Fedora 用户,请使用 [dnf][10] 来安装 `pip`。 ```shell sudo dnf install python-pip ``` -对于 CentOS 或 RHEL 用户,请使用 **[yum][11]** 来安装 pip。 +对于 CentOS 或 RHEL 用户,请使用 [yum][11] 来安装 `pip`。 ```shell sudo yum install python-pip ``` -对于 openSUSE 用户,请使用 **[zypper][12]** 来安装 pip。 +对于 openSUSE 用户,请使用 [zypper][12] 来安装 `pip`。 ```shell sudo zypper install python-pip ``` -最后,请执行 **[pip][13]** 来安装 Termtosvg。 +最后,请执行 [pip][13] 来安装 Termtosvg。 ```shell sudo pip3 install termtosvg pyte python-xlib svgwrite From 06c95a5cb1d5ea9416f0f6fce78e8884ed09e444 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Jan 2019 12:13:41 +0800 Subject: [PATCH 0556/4278] PUB:20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @zhs852 https://linux.cn/article-10441-1.html --- ...ecord Your Terminal Sessions As SVG Animations In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md (98%) diff --git a/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md similarity index 98% rename from translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md rename to published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md index 748f678a5d..eb125ef003 100644 --- a/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md +++ b/published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10441-1.html) [#]: subject: (Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux) [#]: via: (https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 5e048ce0e696646c7815432b3d95fbf7e416be3b Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Mon, 14 Jan 2019 12:21:38 +0800 Subject: [PATCH 0557/4278] Translating by qhwdw --- ...0120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md index 9442a67708..fbdba984c3 100644 --- a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md +++ b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8fb0a9e8fe5c2b9bbc95e77bdd19153a2f8f1219 Mon Sep 17 00:00:00 2001 From: runningwater Date: Mon, 14 Jan 2019 17:10:02 +0800 Subject: [PATCH 0558/4278] =?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 --- ...0181220 How To Install Microsoft .NET Core SDK On Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md index 728db3b7be..e34ecaab9e 100644 --- a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md +++ b/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (runningwater) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -325,7 +325,7 @@ via: https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/ 作者:[SK][a] 选题:[lujun9972][b] -译者:[译者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 4ba64b24860ab5d07aef3f363444fdc7739f7f57 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 14 Jan 2019 17:15:45 +0800 Subject: [PATCH 0559/4278] Translating An Introduction to Go. --- translated/tech/20181224 An Introduction to Go.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 4f352a2bf0..a8b6fcf0c1 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -93,7 +93,7 @@ const bar2 someType = typed // error: int 不能被赋值给 someType ### 接口和对象 -As mentioned before, interfaces are a set of methods. Go is not an object-oriented language per se, but it has some support for associating methods with named types: When declaring a function, a receiver can be provided - a receiver is an additional function argument that is passed before the function and involved in the function lookup, like this: +正如上面所说的,接口是一组方法的集合。Go 本身不是一种面向对象的语言,但它支持将方法关联到命名类型上:当声明一个函数时,可以提供一个接收者。接收者是函数的一个额外参数,可以在函数之前传递并参与函数查找,就像这样: ``` type SomeType struct { ... } @@ -107,7 +107,7 @@ func main() { } ``` -An object implements an interface if it implements all methods; for example, the following interface `MyMethoder` is implemented by `*SomeType` (note the pointer), and values of `*SomeType` can thus be used as values of `MyMethoder`. The most basic interface is `interface{}`, that is an interface with an empty method set - any object satisfies that interface. +如果对象实现了所有方法,那么它就实现了接口;例如,`*SomeType`(注意指针)实现了下面的接口 `MyMethoder`,因此 `*SomeType` 类型的值就能作为 `MyMethoder` 类型的值使用。最基本的接口类型是 `interface{}`,它是一个带空方法集的接口——任何对象都满足该接口。 ``` type MyMethoder interface { @@ -115,7 +115,7 @@ type MyMethoder interface { } ``` -There are some restrictions on valid receiver types; for example, while a named type could be a pointer (for example, `type MyIntPointer *int`), such a type is not a valid receiver type. +合法的接收者类型是有些限制的;例如,命名类型可以是指针类型(例如,`type MyIntPointer *int`),但这种类型不是合法的接收者类型。 ### 控制流 From 6017c1a9b37bdb926ff00c205e484a91c2bf9b64 Mon Sep 17 00:00:00 2001 From: runningwater Date: Mon, 14 Jan 2019 20:31:56 +0800 Subject: [PATCH 0560/4278] =?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 --- ...nstall Microsoft .NET Core SDK On Linux.md | 108 +++++++++--------- 1 file changed, 55 insertions(+), 53 deletions(-) rename {sources => translated}/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md (53%) diff --git a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md similarity index 53% rename from sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md rename to translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md index e34ecaab9e..08b518e442 100644 --- a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md +++ b/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -7,20 +7,20 @@ [#]: via: (https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -How To Install Microsoft .NET Core SDK On Linux +如何在 Linux 中安装微软的 .NET Core SDK ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/12/NET-Core-SDK-720x340.png) -The **.NET Core** is a free, cross platform and open source framework developed by Microsoft to build desktop applications, mobile apps, web apps, IoT apps and gaming apps etc. If you’re dotnet developer coming from Windows platform, .NET core helps you to setup your development environment easily on any Linux and Unix-like operating systems. This step by step guide explains how to install Microsoft .NET Core SDK on Linux and how to write your first app using .Net. +**.NET Core** 是微软提供的免费、跨平台和开源的开发框架,可以构建桌面应用程序、移动端应用程序、网络应用程序、物联网应用程序和游戏应用程序等。如果你是 Windows 平台下的 dotnet 开发人员的话,使用 .NET core 可以很轻松就设置好任何 Linux 和类 Unix 操作系统下的开发环境。本分步操作指南文章解释了如何在 Linux 中安装 .NET Core SDK 以及如何使用 .NET 开发出第一个应用程序。 -### Install Microsoft .NET Core SDK On Linux +### Linux 中安装 .NET Core SDK -The .NET core supports GNU/Linux, Mac OS and Windows. .Net core can be installed on popular GNU/Linux operating systems including Debian, Fedora, CentOS, Oracle Linux, RHEL, SUSE/openSUSE, and Ubuntu. As of writing this guide, the latest .NET core version was **2.2**. +.NET Core 支持 GNU/Linux、Mac OS 和 Windows 系统,可以在主流的 GNU/Linux 操作系统上安装运行,包括 Debian、Fedora、CentOS、Oracle Linux、RHEL、SUSE/openSUSE 和 Ubuntu 。在撰写这篇教程时,其最新版本为 **2.2**。 -On **Debian 9** , you can install .NET Core SDK as shown below. +**Debian 9** 系统上安装 .NET Core SDK,请按如下步骤进行。 -First of all, you need to register Microsoft key and add .NET repository by running the following commands: +首先,需要注册微软的密钥,接着把 .NET 源仓库地址添加进来,运行的命令如下: ``` $ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg @@ -31,16 +31,16 @@ $ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg $ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list ``` -After registering the key and adding the repository, install .NET SDK using commands: +注册好密钥及添加完仓库源后,就可以安装 .NET SDK 了,命令如下: ``` $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**On Debian 8:** +**Debian 8 系统上安装:** -Add Microsoft key and enable .NET repository: +增加微软密钥,添加 .NET 仓库源: ``` $ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg @@ -51,16 +51,16 @@ $ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg $ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list ``` -Install .NET SDK: +安装 .NET SDK: ``` $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**On Fedora 28:** +**Fedora 28 系统上安装:** -Add Microsoft key and enable .NET repository: +增加微软密钥,添加 .NET 仓库源: ``` $ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc @@ -69,14 +69,16 @@ $ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo $ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo ``` -Now, Install .NET SDK: +现在, 可以安装 .NET SDK 了: ``` $ sudo dnf update $ sudo dnf install dotnet-sdk-2.2 ``` -On **Fedora 27** , add the key and repository using commands: +**Fedora 27 系统下:** + +增加微软密钥,添加 .NET 仓库源,命令如下: ``` $ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc @@ -85,31 +87,31 @@ $ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo $ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo ``` -And install .NET SDK using commands: +接着安装 .NET SDK ,命令如下: ``` $ sudo dnf update $ sudo dnf install dotnet-sdk-2.2 ``` -**On CentOS/Oracle Linux:** +**CentOS/Oracle 版本的 Linux 系统上:** -Add Microsoft key and enable .NET core repository: +增加微软密钥,添加 .NET 仓库源,使其可用 ``` $ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm ``` -Update the repositories and install .NET SDK: +更新源仓库,安装 .NET SDK: ``` $ sudo yum update $ sudo yum install dotnet-sdk-2.2 ``` -**On openSUSE Leap:** +**openSUSE Leap 版本的系统上:** -Add key, enable repository and install necessary dependencies using the following commands: +添加密钥,使仓库源可用,安装必需的依赖包,其命令如下: ``` $ sudo zypper install libicu @@ -119,29 +121,29 @@ $ sudo mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo $ sudo chown root:root /etc/zypp/repos.d/microsoft-prod.repo ``` -Update the repositories and Install .NET SDK using commands: +更新源仓库,安装 .NET SDK,命令如下: ``` $ sudo zypper update $ sudo zypper install dotnet-sdk-2.2 ``` -**On Ubuntu 18.04 LTS:** +**Ubuntu 18.04 LTS 版本的系统上:** -Register the Microsoft key and .NET core repository using commands: +注册微软的密钥和 .NET Core 仓库源,命令如下: ``` $ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb $ sudo dpkg -i packages-microsoft-prod.deb ``` -Enable ‘Universe’ repository using: +使 ‘Universe’ 仓库可用: ``` $ sudo add-apt-repository universe ``` -Then, install .NET Core SDK using command: +然后,安装 .NET Core SDK ,命令如下: ``` $ sudo apt-get install apt-transport-https @@ -149,16 +151,16 @@ $sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**On Ubuntu 16.04 LTS:** +**Ubuntu 16.04 LTS 版本的系统上:** -Register Microsoft key and .NET repository using commands: +注册微软的密钥和 .NET Core 仓库源,命令如下: ``` $ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb $ sudo dpkg -i packages-microsoft-prod.deb ``` -And then, Install .NET core SDK: +然后安装 .NET core SDK: ``` $ sudo apt-get install apt-transport-https @@ -166,17 +168,17 @@ $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -### Create Your First App +### 创建你的第一个应用程序 -We have successfully installed .Net Core SDK in our Linux box. It is time to create our first app using dotnet. +我们已经成功的在 Linux 机器中安装了 .NET Core SDK。是时候使用 dotnet 创建第一个应用程序了。 -For the purpose of this guide, I am going to create a new app called **“ostechnixApp”**. To do so, simply run the following command: +接下来的目的,我们会创建一个名为 **“ostechnixApp”** 的应用程序。为此,可以简单的运行如下命令: ``` $ dotnet new console -o ostechnixApp ``` -**Sample output:** +**简单的输出:** ``` Welcome to .NET Core! @@ -208,9 +210,9 @@ Restore completed in 894.27 ms for /home/sk/ostechnixApp/ostechnixApp.csproj. Restore succeeded. ``` -As you can see in the above output, .Net has created a new application of type console. The parameter -o creates a directory named “ostechnixApp” where you store your app data with all necessary files. +正如上面的输出所示的,.NET 已经为我们创建一个控制台类型的应用程序。`-o` 参数创建了一个名为 “ostechnixApp” 的目录,其包含有存储此应用程序数据所必需的文件。 -Let us switch to ostechnixApp directory and see what’s in there. +让我们切换到 ostechnixApp 目录,看看里面有些什么。 ``` $ cd ostechnixApp/ @@ -218,7 +220,7 @@ $ ls obj ostechnixApp.csproj Program.cs ``` -As you there are three files named **ostechnixApp.csproj** and **Program.cs** and one directory named **obj**. By default, the Program.cs file will contain the code to run the ‘Hello World’ program in the console. Let us have a look at the code. +可以看到有两个名为 **ostechnixApp.csproj** 和 **Program.cs** 的文件,以及一个名为 **ojb** 的目录。默认情况下, `Program.cs` 文件包含有可以在控制台中运行的 'Hello World' 程序代码。可以看看此代码: ``` $ cat Program.cs @@ -236,7 +238,7 @@ namespace ostechnixApp } ``` -To run the newly created app, simply run the following command: +要运行此应用程序,可以简单的使用如下命令: ``` $ dotnet run @@ -245,9 +247,9 @@ Hello World! ![](https://www.ostechnix.com/wp-content/uploads/2018/12/run-dotnet.png) -Simple, isn’t it? Yes, it is! Now, you can write your code in the **Program.cs** file and run it as shown above. +很简单,对吧?是的,就是如此简单。现在你可以在 **Program.cs** 这文件中写上自己的代码,然后像上面所示的执行。 -Alternatively, you can create a new directory, for example mycode, using commands: +或者,你可以创建一个新的目录,如例子所示的 `mycode` 目录,命令如下: ``` $ mkdir ~/.mycode @@ -255,13 +257,13 @@ $ mkdir ~/.mycode $ cd mycode/ ``` -…and make that as your new development environment by running the following command: +然后运行如下命令,使其成为你的新开发环境目录: ``` $ dotnet new console ``` -Sample output: +简单的输出: ``` The template "Console Application" was created successfully. @@ -276,46 +278,46 @@ Restore completed in 331.87 ms for /home/sk/mycode/mycode.csproj. Restore succeeded. ``` -The above command will create two files named **mycode.csproj** and **Program.cs** and one directory named **obj**. Open the Program.cs file in your favorite editor, delete or modify the existing ‘hello world’ code with your own code. +上的命令会创建两个名叫 **mycode.csproj** 和 **Program.cs** 的文件及一个名为 **obj** 的目录。用你喜欢的编辑器打开 `Program.cs` 文件, 删除或修改原来的 'hello world' 代码段,然后编写自己的代码。 -Once the code is written, save and close the Program.cs file and run the app using command: +写完代码,保存,关闭 Program.cs 文件,然后运行此应用程序,命令如下: ``` $ dotnet run ``` -To check the installed .NET core SDK version, simply run: +想要查看安装的 .NET core SDK 的版本的话,可以简单的运行: ``` $ dotnet --version 2.2.101 ``` -To get help, run: +要获得帮助,请运行: ``` $ dotnet --help ``` -### Get Microsoft Visual Studio Code Editor +### 使用微软的 Visual Studio Code 编辑器 -To write the code, you can use your favorite editors of your choice. Microsoft has also its own editor named “ **Microsoft Visual Studio Code** ” with support for .NET. It is an open source, lightweight and powerful source code editor. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Python, PHP, Go) and runtimes (such as .NET and Unity). It is a cross-platform code editor, so you can use it in Microsoft Windows, GNU/Linux, and Mac OS X. You can use it if you’re interested. +要编写代码,你可以任选自己喜欢的编辑器。同时微软自己也有一款支持 .NET 的编辑器,其名为 “ **Microsoft Visual Studio Code** ”。它是一款开源、轻量级、功能强大的源代码编辑器。其内置了对 JavaScript、TypeScript 和 Node.js 的支持,并为其它语言(如 C++、C#、Python、PHP、Go)和运行时态(如 .NET 和 Unity)提供了丰富的扩展,已经形成一个完整的生态系统。它是一款跨平台的代码编辑器,所以在微软的 Windows 系统、GNU/Linux 系统和 Mac OS X 系统都可以使用。如果对其感兴趣,就可以使用。 -To know how to install and use it on Linux, please refer the following guide. +To know how to install and use it on Linux, please refer the following guide.想了解如何在 Linux 上安装和使用,请参阅以下指南。 -[Install Microsoft Visual Studio Code In Linux][3] +[Linux 中安装 Microsoft Visual Studio Code][3] -[**This page**][1] has some basic tutorials to learn .NET Core and .NET Core SDK tools using Visual Studio Code editor. Go and check them to learn more. +关于 Visual Studio Code editor 中 .NET Core 和 .NET Core SDK 工具的使用,[**此网页**][1]有一些基础的教程。想了解更多就去看看吧。 ### Telemetry -By default, the .NET core SDK will collect the usage data using a feature called **‘Telemetry’**. The collected data is anonymous and shared to the development team and community under the [Creative Commons Attribution License][2]. So the .NET team will understand how the tools are used and decide how they can be improved over time. If you don’t want to share your usage information, you can simply opt-out of telemetry by setting the **DOTNET_CLI_TELEMETRY_OPTOUT** environment variable to **‘1’** or **‘true’** using your favorite shell. +默认情况下,.NET core SDK 会采集用户使用情况数据,此功能被称为 **‘Telemetry’**。采集数据是匿名的,并根据[知识共享署名许可][2]分享给其开发团队和社区。因此 .NET 团队会知道这些工具的使用状况,然后根据统计做出决策,改进产品。如果你不想分享自己的使用信息的话,可以使用顺手的 shell 工具把名为 **DOTNET_CLI_TELEMETRY_OPTOUT** 的环境变量参数设置为 **‘1’** 或 **‘true’**,这样就简单的关闭此功能了。 -And, that’s all. You know how to install .NET Core SDK on various Linux platforms and how to create a basic app using it. TO learn more about .NET usage, refer the links given at the end of this guide. +就这样。你已经知道如何在各 Linux 平台上安装 .NET Core SDK 以及知道如何创建基本的应用程序了。想了解更多 .NET 使用知识的话,请参阅此文章末尾给出的链接。 -More good stuffs to come. Stay tuned! +会爆出更多干货的。敬请关注! -Cheers! +祝贺下! From a6400e855fa826c57f4959d04e5659be3598ca4e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 15 Jan 2019 09:06:22 +0800 Subject: [PATCH 0561/4278] translated --- ...wers of Linux- 2048 at the command line.md | 52 ------------------- ...wers of Linux- 2048 at the command line.md | 52 +++++++++++++++++++ 2 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md create mode 100644 translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md diff --git a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md deleted file mode 100644 index 1c7d61329f..0000000000 --- a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Powers of two, powers of Linux: 2048 at the command line) -[#]: via: (https://opensource.com/article/18/12/linux-toy-2048) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Powers of two, powers of Linux: 2048 at the command line -====== -Looking for a terminal-based game to pass the time? Look no further than 2048-cli. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-2048.png?itok=3M6S-n1a) - -Hello and welcome to today's installment of the Linux command-line toys advent calendar. Every day, we look at a different toy for your terminal: it could be a game or any simple diversion that helps you have fun. - -Maybe you have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -Today's toy is a [command-line version][1] of one of my all-time favorite casual games, [2048][2] (which itself is a clone of another clone). - -To play, you just slide blocks up, down, left, and right to combine matching pairs and increment numbers, until you've made a block that is 2048 in size. The catch (and the challenge), is that you can't just move one block; instead, you move every block on the screen. - -It's simple, fun, and easy to get lost in it for hours. This 2048 clone, [2048-][1][cli][1], is by Marc Tiehuis and written in C, and made available as open source under an MIT license. You can find the source code [on GitHub][1], where you can also get installation instructions for your platform. Since it was packaged for Fedora, for me, installing it was as simple as: - -``` -$ sudo dnf install 2048-cli -``` - -That's it, have fun! - -![](https://opensource.com/sites/default/files/uploads/linux-toy-2048-animated_0.gif) - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Play Tetris at your Linux terminal][3], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-2048 - -作者:[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://github.com/tiehuis/2048-cli -[2]: https://github.com/gabrielecirulli/2048 -[3]: https://opensource.com/article/18/12/linux-toy-tetris diff --git a/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md new file mode 100644 index 0000000000..92b87ed8a6 --- /dev/null +++ b/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Powers of two, powers of Linux: 2048 at the command line) +[#]: via: (https://opensource.com/article/18/12/linux-toy-2048) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +2 的力量,Linux 的力量:终端中的 2048 +====== +正在寻找基于终端的游戏来打发时间么?来看看 2048-cli 吧。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-2048.png?itok=3M6S-n1a) + +你好,欢迎来到今天的 Linux 命令行玩具日历。每天,我们会为你的终端带来一个不同的玩具:它可能是一个游戏或任何简单的消遣,可以帮助你获得乐趣。 + +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +今天的玩具是我最喜欢的休闲游戏之一 [2048][2] (它本身就是另外一个克隆的克隆)的[命令行版本][1]。 + +要进行游戏,你只需将滑块向上、向下、向左、向右移动,组合成对的数字,并增加数字,直到你得到数字 2048 的块。吸引人的地方(以及挑战)是你不能只移动一个滑块,而是需要移动屏幕上的每一块。 + +它简单、有趣,很容易在里面沉迷几个小时。这个 2048 的克隆 [2048-cli][1] 是 Marc Tiehuis 用 C 编写的,并在 MIT 许可下开源。你可以在 [GitHub][1] 上找到源代码,你也可在这找到适用于你的平台的安装说明。由于它已为 Fedora 打包,因此我来说,安装就像下面那样简单: + +``` +$ sudo dnf install 2048-cli +``` + +这是这样,玩得开心! + +![](https://opensource.com/sites/default/files/uploads/linux-toy-2048-animated_0.gif) + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +查看昨天的玩具,[在 Linux 终端中玩俄罗斯方块][3],记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-2048 + +作者:[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://github.com/tiehuis/2048-cli +[2]: https://github.com/gabrielecirulli/2048 +[3]: https://opensource.com/article/18/12/linux-toy-tetris \ No newline at end of file From bb074365cf0eb88fc5620114f2301461b121564a Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 15 Jan 2019 09:13:49 +0800 Subject: [PATCH 0562/4278] translating --- ...tarted with Turtl, an open source alternative to Evernote.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md index 969ef39901..968f3c546a 100644 --- a/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md +++ b/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md @@ -1,3 +1,5 @@ +translating---geekpi + Getting started with Turtl, an open source alternative to Evernote ====== ![Using Turtl as an open source alternative to Evernote](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_brainstorm_island_520px.png?itok=6IUPyxkY) From af3e74a5d7a8b9197589a224b9a932237433fb0c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 15 Jan 2019 10:15:11 +0800 Subject: [PATCH 0563/4278] PRF:20180503 11 Methods To Find System-Server Uptime In Linux.md @LuuMing --- ...s To Find System-Server Uptime In Linux.md | 122 ++++++++---------- 1 file changed, 55 insertions(+), 67 deletions(-) diff --git a/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md b/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md index 68ca8a1371..865ee538df 100644 --- a/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md +++ b/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md @@ -1,18 +1,19 @@ Linux 上查看系统/服务器运行时间的 11 种方法 ====== -你是否想知道自己的 Linux 系统除宕机外正常运行了多长时间?系统什么时候启动以及现在的日期? + +你是否想知道自己的 Linux 系统正常运行了多长时间而没有宕机?系统是什么时候启动的? Linux 上有多个查看服务器/系统运行时间的命令,大多数用户喜欢使用标准并且很有名的 `uptime` 命令获取这些具体的信息。 服务器的运行时间对一些用户来说不那么重要,但是当服务器运行诸如在线商城门户portal、网上银行门户等关键任务应用mission-critical applications时,它对于服务器管理员server adminstrators来说就至关重要。 -它必须做到 0 宕机,因为一旦停机就会影响到数百万用户。 +它必须做到零宕机,因为一旦停机就会影响到数百万用户。 正如我所说,许多命令都可以让用户看到 Linux 服务器的运行时间。在这篇教程里我会教你如何使用下面 11 种方式来查看。 正常运行时间uptime指的是服务器自从上次关闭或重启以来经过的时间。 -`uptime` 命令获取 `/proc` 文件中的详细信息并输出正常运行时间,`/proc` 文件不能直接读取。 +`uptime` 命令获取 `/proc` 文件中的详细信息并输出正常运行时间,而 `/proc` 文件并不适合人直接看。 以下这些命令会输出系统运行和启动的时间。也会显示一些额外的信息。 @@ -20,48 +21,47 @@ Linux 上有多个查看服务器/系统运行时间的命令,大多数用户 `uptime` 命令会告诉你系统运行了多长时间。它会用一行显示以下信息。 -当前时间,系统运行时间,当前登录用户的数量,过去 1 分钟、5 分钟、15 分钟系统负载的均值。 +当前时间、系统运行时间、当前登录用户的数量、过去 1 分钟/5 分钟/15 分钟系统负载的均值。 ``` # uptime - 08:34:29 up 21 days, 5:46, 1 user, load average: 0.06, 0.04, 0.00 - + 08:34:29 up 21 days, 5:46, 1 user, load average: 0.06, 0.04, 0.00 ``` ### 方法 2:使用 w 命令 -`w` 命令为每个登录进系统的用户,每个用户当前所做的事情,所有活动的负载对计算机的影响提供了一个快速的概要。这个单一命令结合了多个 Unix 程序:who,uptime,和 ps -a。 +`w` 命令为每个登录进系统的用户,每个用户当前所做的事情,所有活动的负载对计算机的影响提供了一个快速的概要。这个单一命令结合了多个 Unix 程序:`who`、`uptime`,和 `ps -a` 的结果。 + ``` # w - 08:35:14 up 21 days, 5:47, 1 user, load average: 0.26, 0.09, 0.02 -USER TTY FROM [email protected] IDLE JCPU PCPU WHAT -root pts/1 103.5.134.167 08:34 0.00s 0.01s 0.00s w - + 08:35:14 up 21 days, 5:47, 1 user, load average: 0.26, 0.09, 0.02 +USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT +root pts/1 103.5.134.167 08:34 0.00s 0.01s 0.00s w ``` ### 方法 3:使用 top 命令 -`top` 命令是 Linux 上监视实时系统进程的基础命令之一。它显示系统信息和运行进程的信息,例如正常运行时间,平均负载,运行的任务,登录用户数量,CPU 数量 & CPU 利用率,内存 & 交换空间信息。 +`top` 命令是 Linux 上监视实时系统进程的基础命令之一。它显示系统信息和运行进程的信息,例如正常运行时间、平均负载、运行的任务、登录用户数量、CPU 数量 & CPU 利用率、内存 & 交换空间信息。 **推荐阅读:**[TOP 命令监视服务器性能的例子][1] + ``` # top -c -top - 08:36:01 up 21 days, 5:48, 1 user, load average: 0.12, 0.08, 0.02 -Tasks: 98 total, 1 running, 97 sleeping, 0 stopped, 0 zombie -Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st -Mem: 1872888k total, 1454644k used, 418244k free, 175804k buffers -Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached - - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND - 1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04 /sbin/init - 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd] - 3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [migration/0] - 4 root 20 0 0 0 0 S 0.0 0.0 0:34.32 [ksoftirqd/0] - 5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [stopper/0] +top - 08:36:01 up 21 days, 5:48, 1 user, load average: 0.12, 0.08, 0.02 +Tasks: 98 total, 1 running, 97 sleeping, 0 stopped, 0 zombie +Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st +Mem: 1872888k total, 1454644k used, 418244k free, 175804k buffers +Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04 /sbin/init + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd] + 3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [migration/0] + 4 root 20 0 0 0 0 S 0.0 0.0 0:34.32 [ksoftirqd/0] + 5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [stopper/0] ``` ### 方法 4:使用 who 命令 @@ -70,20 +70,16 @@ Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached ``` # who -b - system boot 2018-04-12 02:48 - ``` ### 方法 5:使用 last 命令 -`last` 命令列出最近登录过的用户。`last` 往回查找 `/var/log/wtmp` 文件并显示自从文件创建后登录进(出)的用户。 +`last` 命令列出最近登录过的用户。`last` 回溯 `/var/log/wtmp` 文件并显示自从文件创建后登录进(出)的用户。 ``` # last reboot -F | head -1 | awk '{print $5,$6,$7,$8,$9}' - Thu Apr 12 02:48:04 2018 - ``` ### 方法 6:使用 /proc/uptime 文件 @@ -94,9 +90,7 @@ Thu Apr 12 02:48:04 2018 ``` # cat /proc/uptime - 1835457.68 1809207.16 - ``` ### 方法 7:使用 tuptime 命令 @@ -105,60 +99,58 @@ Thu Apr 12 02:48:04 2018 ``` $ tuptime - ``` ### 方法 8:使用 htop 命令 -`htop` 是运行在 Linux 上一个由 Hisham 使用 ncurses 库开发的交互式进程查看器。`htop` 比起 `top` 有很多的特性和选项。 +`htop` 是运行在 Linux 上的一个交互式进程查看器,是 Hisham 使用 ncurses 库开发的。`htop` 比起 `top` 有很多的特性和选项。 **推荐阅读:** [使用 Htop 命令监控系统资源][2] ``` # htop - CPU[| 0.5%] Tasks: 48, 5 thr; 1 running - Mem[||||||||||||||||||||||||||||||||||||||||||||||||||| 165/1828MB] Load average: 0.10 0.05 0.01 - Swp[ 0/2047MB] Uptime: 21 days, 05:52:35 - - PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command -29166 root 20 0 110M 2484 1240 R 0.0 0.1 0:00.03 htop -29580 root 20 0 11464 3500 1032 S 0.0 0.2 55:15.97 /bin/sh ./OSWatcher.sh 10 1 - 1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04 /sbin/init - 486 root 16 -4 10780 900 348 S 0.0 0.0 0:00.07 /sbin/udevd -d - 748 root 18 -2 10780 932 360 S 0.0 0.0 0:00.00 /sbin/udevd -d + CPU[| 0.5%] Tasks: 48, 5 thr; 1 running + Mem[||||||||||||||||||||||||||||||||||||||||||||||||||| 165/1828MB] Load average: 0.10 0.05 0.01 + Swp[ 0/2047MB] Uptime: 21 days, 05:52:35 + PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command +29166 root 20 0 110M 2484 1240 R 0.0 0.1 0:00.03 htop +29580 root 20 0 11464 3500 1032 S 0.0 0.2 55:15.97 /bin/sh ./OSWatcher.sh 10 1 + 1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04 /sbin/init + 486 root 16 -4 10780 900 348 S 0.0 0.0 0:00.07 /sbin/udevd -d + 748 root 18 -2 10780 932 360 S 0.0 0.0 0:00.00 /sbin/udevd -d ``` ### 方法 9:使用 glances 命令 -`glances` 是一个跨平台基于 curses 使用 python 写的监控工具。我们可以说它非常强大,仅用一点空间就能获得很多信息。它使用 psutil 库从系统中获取信息。 +`glances` 是一个跨平台的基于 curses 库的监控工具,它是使用 python 编写的。可以说它非常强大,仅用一点空间就能获得很多信息。它使用 psutil 库从系统中获取信息。 -`glances` 可以监控 CPU,内存,负载,进程,网络接口,磁盘 I/O,磁盘阵列RAID,传感器,文件系统(与文件夹),容器,显示器,Alert 日志,系统信息,运行时间,快速查看Quicklook(CPU,内存等)。 +`glances` 可以监控 CPU、内存、负载、进程、网络接口、磁盘 I/O、磁盘阵列RAID、传感器、文件系统(与文件夹)、容器、监视器、Alert 日志、系统信息、运行时间、快速查看Quicklook(CPU,内存、负载)等。 **推荐阅读:** [Glances (集大成)– Linux 上高级的实时系统运行监控工具][3] + ``` glances -ubuntu (Ubuntu 17.10 64bit / Linux 4.13.0-37-generic) - IP 192.168.1.6/24 Uptime: 21 days, 05:55:15 +ubuntu (Ubuntu 17.10 64bit / Linux 4.13.0-37-generic) - IP 192.168.1.6/24 Uptime: 21 days, 05:55:15 -CPU [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 90.6%] CPU - 90.6% nice: 0.0% ctx_sw: 4K MEM \ 78.4% active: 942M SWAP - 5.9% LOAD 2-core -MEM [||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 78.0%] user: 55.1% irq: 0.0% inter: 1797 total: 1.95G inactive: 562M total: 12.4G 1 min: 4.35 -SWAP [|||| 5.9%] system: 32.4% iowait: 1.8% sw_int: 897 used: 1.53G buffers: 14.8M used: 749M 5 min: 4.38 - idle: 7.6% steal: 0.0% free: 431M cached: 273M free: 11.7G 15 min: 3.38 - -NETWORK Rx/s Tx/s TASKS 211 (735 thr), 4 run, 207 slp, 0 oth sorted automatically by memory_percent, flat view -docker0 0b 232b -enp0s3 12Kb 4Kb Systemd 7 Services loaded: 197 active: 196 failed: 1 -lo 616b 616b -_h478e48e 0b 232b CPU% MEM% VIRT RES PID USER NI S TIME+ R/s W/s Command - 63.8 18.9 2.33G 377M 2536 daygeek 0 R 5:57.78 0 0 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 -DefaultGateway 83ms 78.5 10.9 3.46G 217M 2039 daygeek 0 S 21:07.46 0 0 /usr/bin/gnome-shell - 8.5 10.1 2.32G 201M 2464 daygeek 0 S 8:45.69 0 0 /usr/lib/firefox/firefox -new-window -DISK I/O R/s W/s 1.1 8.5 2.19G 170M 2653 daygeek 0 S 2:56.29 0 0 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 -dm-0 0 0 1.7 7.2 2.15G 143M 2880 daygeek 0 S 7:10.46 0 0 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 -sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 +CPU [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 90.6%] CPU - 90.6% nice: 0.0% ctx_sw: 4K MEM \ 78.4% active: 942M SWAP - 5.9% LOAD 2-core +MEM [||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 78.0%] user: 55.1% irq: 0.0% inter: 1797 total: 1.95G inactive: 562M total: 12.4G 1 min: 4.35 +SWAP [|||| 5.9%] system: 32.4% iowait: 1.8% sw_int: 897 used: 1.53G buffers: 14.8M used: 749M 5 min: 4.38 + idle: 7.6% steal: 0.0% free: 431M cached: 273M free: 11.7G 15 min: 3.38 +NETWORK Rx/s Tx/s TASKS 211 (735 thr), 4 run, 207 slp, 0 oth sorted automatically by memory_percent, flat view +docker0 0b 232b +enp0s3 12Kb 4Kb Systemd 7 Services loaded: 197 active: 196 failed: 1 +lo 616b 616b +_h478e48e 0b 232b CPU% MEM% VIRT RES PID USER NI S TIME+ R/s W/s Command + 63.8 18.9 2.33G 377M 2536 daygeek 0 R 5:57.78 0 0 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 +DefaultGateway 83ms 78.5 10.9 3.46G 217M 2039 daygeek 0 S 21:07.46 0 0 /usr/bin/gnome-shell + 8.5 10.1 2.32G 201M 2464 daygeek 0 S 8:45.69 0 0 /usr/lib/firefox/firefox -new-window +DISK I/O R/s W/s 1.1 8.5 2.19G 170M 2653 daygeek 0 S 2:56.29 0 0 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 +dm-0 0 0 1.7 7.2 2.15G 143M 2880 daygeek 0 S 7:10.46 0 0 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 +sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 ``` ### 方法 10:使用 stat 命令 @@ -167,9 +159,7 @@ sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox ``` # stat /var/log/dmesg | grep Modify - Modify: 2018-04-12 02:48:04.027999943 -0400 - ``` ### 方法 11:使用 procinfo 命令 @@ -178,9 +168,7 @@ Modify: 2018-04-12 02:48:04.027999943 -0400 ``` # procinfo | grep Bootup - Bootup: Fri Apr 20 19:40:14 2018 Load average: 0.16 0.05 0.06 1/138 16615 - ``` -------------------------------------------------------------------------------- @@ -190,7 +178,7 @@ via: https://www.2daygeek.com/11-methods-to-find-check-system-server-uptime-in-l 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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 b63d6cf18dc8c94325c341efaf187d4c111ada24 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 15 Jan 2019 10:15:28 +0800 Subject: [PATCH 0564/4278] PUB:20180503 11 Methods To Find System-Server Uptime In Linux.md @LuuMing https://linux.cn/article-10443-1.html --- .../20180503 11 Methods To Find System-Server Uptime In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180503 11 Methods To Find System-Server Uptime In Linux.md (100%) diff --git a/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md b/published/20180503 11 Methods To Find System-Server Uptime In Linux.md similarity index 100% rename from translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md rename to published/20180503 11 Methods To Find System-Server Uptime In Linux.md From ad4111fd95c4bb3a85be8d8b89725a1de19bcc82 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 10:48:38 +0800 Subject: [PATCH 0565/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20XML=20vs=20JSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20150513 XML vs JSON.md | 107 +++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/talk/20150513 XML vs JSON.md diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md new file mode 100644 index 0000000000..d3928daa83 --- /dev/null +++ b/sources/talk/20150513 XML vs JSON.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (XML vs JSON) +[#]: via: (https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#xml-advantages) +[#]: author: (TOM STRASSNER tomstrassner@gmail.com) + +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 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] + +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. + +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. + +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. + +### 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. + +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. + +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. + +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. + +### 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. + +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. + +### Software + +The following major public APIs uses XML only: Amazon 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. + +The following major APIs use both XML and JSON: Google Cloud Storage, Linkedin 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. + +The following major databases support 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. + +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] + +### 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. + +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] + +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/) +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) + + +-------------------------------------------------------------------------------- + +via: https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#xml-advantages + +作者:[TOM STRASSNER][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: tomstrassner@gmail.com +[b]: https://github.com/lujun9972 +[1]: https://tools.ietf.org/html/rfc7159 +[2]: https://tools.ietf.org/html/rfc4825 From 207f93cdf1760f8f86ce4d42e07a4ac04ce0889c Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 10:51:41 +0800 Subject: [PATCH 0566/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Turn=20a=20Rasp?= =?UTF-8?q?berry=20Pi=203B+=20into=20a=20PriTunl=20VPN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n a Raspberry Pi 3B- into a PriTunl VPN.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md diff --git a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md new file mode 100644 index 0000000000..b7e55e0efb --- /dev/null +++ b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) +[#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +Turn a Raspberry Pi 3B+ into a PriTunl VPN +====== +PriTunl is a VPN solution for small businesses and individuals who want private access to their network. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2) + +[PriTunl][1] is a fantastic VPN terminator solution that's perfect for small businesses and individuals who want a quick and simple way to access their network privately. It's open source, and the basic free version is more than enough to get you started and cover most simple use cases. There is also a paid enterprise version with advanced features like Active Directory integration. + +### Special considerations on Raspberry Pi 3B+ + +PriTunl is generally simple to install, but this project—turning a Raspberry Pi 3B+ into a PriTunl VPN appliance—adds some complexity. For one thing, PriTunl is supplied only as AMD64 and i386 binaries, but the 3B+ uses ARM architecture. This means you must compile your own binaries from source. That's nothing to be afraid of; it can be as simple as copying and pasting a few commands and watching the terminal for a short while. + +Another problem: PriTunl seems to require 64-bit architecture. I found this out when I got errors when I tried to compile PriTunl on my Raspberry Pi's 32-bit operating system. Fortunately, Ubuntu's beta version of 18.04 for ARM64 boots on the Raspberry Pi 3B+. + +Also, the Raspberry Pi 3B+ uses a different bootloader from other Raspberry Pi models. This required a complicated set of steps to install and update the necessary files to get a Raspberry Pi 3B+ to boot. + +### Installing PriTunl + +You can overcome these problems by installing a 64-bit operating system on the Raspberry Pi 3B+ before installing PriTunl. I'll assume you have basic knowledge of how to get around the Linux command line and a Raspberry Pi. + +Start by opening a terminal and downloading the Ubuntu 18.04 ARM64 beta release by entering: + +``` +$ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img.xz +``` + +Unpack the download: + +``` +$ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz +``` + +Insert the SD card you'll use with your Raspberry Pi into your desktop or laptop computer. Your computer will assign the SD card a drive letter—something like **/dev/sda** or **/dev/sdb**. Enter the **dmesg** command and examine the last lines of the output to find out the card's drive assignment. + +**Be VERY CAREFUL with the next step! I can't stress that enough; if you get the drive assignment wrong, you could destroy your system.** + +Write the image to your SD card with the following command, changing **< DRIVE>** to your SD card's drive assignment (obtained in the previous step): + +``` +$ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of= bs=8M +``` + +After it finishes, insert the SD card into your Pi and power it up. Make sure the Pi is connected to your network, then log in with username/password combination ubuntu/ubuntu. + +Enter the following commands on your Pi to install a few things to prepare to compile PriTunl: + +``` +$ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb +``` + +There are a few changes from the standard PriTunl source [installation instructions on GitHub][2]. Make sure you are logged into your Pi and **sudo** to root: + +``` +$ sudo su - +``` + +This should leave you in root's home directory. To install PriTunl version 1.29.1914.98, enter (per GitHub): + +``` +export VERSION=1.29.1914.98 +tee -a ~/.bashrc << EOF +export GOPATH=\$HOME/go +export PATH=/usr/local/go/bin:\$PATH +EOF +source ~/.bashrc +mkdir pritunl && cd pritunl +go get -u github.com/pritunl/pritunl-dns +go get -u github.com/pritunl/pritunl-web +sudo ln -s ~/go/bin/pritunl-dns /usr/bin/pritunl-dns +sudo ln -s ~/go/bin/pritunl-web /usr/bin/pritunl-web +wget https://github.com/pritunl/pritunl/archive/$VERSION.tar.gz +tar -xf $VERSION.tar.gz +cd pritunl-$VERSION +python2 setup.py build +pip install -r requirements.txt +python2 setup.py install --prefix=/usr/local +``` + +Now the MongoDB and PriTunl systemd units should be ready to start up. Assuming you're still logged in as root, enter: + +``` +systemctl daemon-reload +systemctl start mongodb pritunl +systemctl enable mongodb pritunl +``` + +That's it! You're ready to hit PriTunl's browser user interface and configure it by following PriTunl's [installation and configuration instructions][3] on its website. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi + +作者:[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://pritunl.com/ +[2]: https://github.com/pritunl/pritunl +[3]: https://docs.pritunl.com/docs/configuration-5 From 47e7bf44c03016b2f3c9f9ab48a536811d3a19e8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 10:53:40 +0800 Subject: [PATCH 0567/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20What=20metrics?= =?UTF-8?q?=20matter:=20A=20guide=20for=20open=20source=20projects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atter- A guide for open source projects.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 sources/talk/20190111 What metrics matter- A guide for open source projects.md diff --git a/sources/talk/20190111 What metrics matter- A guide for open source projects.md b/sources/talk/20190111 What metrics matter- A guide for open source projects.md new file mode 100644 index 0000000000..1438450a99 --- /dev/null +++ b/sources/talk/20190111 What metrics matter- A guide for open source projects.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What metrics matter: A guide for open source projects) +[#]: via: (https://opensource.com/article/19/1/metrics-guide-open-source-projects) +[#]: author: (Gordon Haff https://opensource.com/users/ghaff) + +What metrics matter: A guide for open source projects +====== +5 principles for deciding what to measure. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI-) + +"Without data, you're just a person with an opinion." + +Those are the words of W. Edwards Deming, the champion of statistical process control, who was credited as one of the inspirations for what became known as the Japanese post-war economic miracle of 1950 to 1960. Ironically, Japanese manufacturers like Toyota were far more receptive to Deming’s ideas than General Motors and Ford were. + +Community management is certainly an art. It’s about mentoring. It’s about having difficult conversations with people who are hurting the community. It’s about negotiation and compromise. It’s about interacting with other communities. It’s about making connections. In the words of Red Hat’s Diane Mueller, it’s about "nurturing conversations." + +However, it’s also about metrics and data. + +Some have much in common with software development projects more broadly. Others are more specific to the management of the community itself. I think of deciding what to measure and how as adhering to five principles. + +### 1. Recognize that behaviors aren't independent of the measurements you choose to highlight. + +In 2008, Daniel Ariely published Predictably Irrational, one of a number of books written around that time that introduced behavioral psychology and behavioral economics to the general public. One memorable quote from that book is the following: “Human beings adjust behavior based on the metrics they’re held against. Anything you measure will impel a person to optimize his score on that metric. What you measure is what you’ll get. Period.” + +This shouldn’t be surprising. It’s a finding that’s been repeatedly confirmed by research. It should also be familiar to just about anyone with business experience. It’s certainly not news to anyone in sales management, for example. Base sales reps’ (or their managers’) bonuses solely on revenue, and they’ll try to discount whatever it takes to maximize revenue, even if it puts margin in the toilet. Conversely, want the sales force to push a new product line—which will probably take extra effort—but skip the spiffs? Probably not happening. + +And lest you think I’m unfairly picking on sales, this behavior is pervasive, all the way up to the CEO, as Ariely describes in a 2010 Harvard Business Review article: “CEOs care about stock value because that’s how we measure them. If we want to change what they care about, we should change what we measure.” + +Developers and other community members are not immune. + +### 2. You need to choose relevant metrics. + +There’s a lot of folk wisdom floating around about what’s relevant and important that’s not necessarily true. My colleague [Dave Neary offers an example from baseball][1]: “In the late '90s, the key measurements that were used to measure batter skill were RBI (runs batted in) and batting average (how often a player got on base with a hit, divided by the number of at-bats). The Oakland A’s were the first major league team to recruit based on a different measurement of player performance: on-base percentage. This measures how often they get to first base, regardless of how it happens.” + +Indeed, the whole revolution of sabermetrics in baseball and elsewhere, which was popularized in Michael Lewis’ Moneyball, often gets talked about in terms of introducing data in a field that historically was more about gut feel and personal experience. But it was also about taking a game that had actually always been fairly numbers-obsessed and coming up with new metrics based on mostly existing data to better measure player value. (The data revolution going on in sports today is more about collecting much more data through video and other means than was previously available.) + +### 3. Quantity may not lead to quality. + +As a corollary, collecting lots of tangential but easy-to-capture data isn’t better than just selecting a few measurements you’ve determined are genuinely useful. In a world where online behavior can be tracked with great granularity and displayed in colorful dashboards, it’s tempting to be distracted by sheer data volume, even when it doesn’t deliver any great insight into community health and trajectory. + +This may seem like an obvious point: Why measure something that isn’t relevant? In practice, metrics often get chosen because they’re easy to measure, not because they’re particularly useful. They tend to be more about inputs than outputs: The number of developers. The number of forum posts. The number of commits. Collectively, measures like this often get called vanity metrics. They’re ubiquitous, but most people involved with community management don’t think much of them. + +Number of downloads may be the worst of the bunch. It’s true that, at some level, they’re an indication of interest in a project. That’s something. But it’s sufficiently distant from actively using the project, much less engaging with the project deeply, that it’s hard to view downloads as a very useful number. + +Is there any harm in these vanity metrics? Yes, to the degree that you start thinking that they’re something to base action on. Probably more seriously, stakeholders like company management or industry observers can come to see them as meaningful indicators of project health. + +### 4. Understand what measurements really mean and how they relate to each other. + +Neary makes this point to caution against myopia. “In one project I worked on,” he says, ”some people were concerned about a recent spike in the number of bug reports coming in because it seemed like the project must have serious quality issues to resolve. However, when we looked at the numbers, it turned out that many of the bugs were coming in because a large company had recently started using the project. The increase in bug reports was actually a proxy for a big influx of new users, which was a good thing.” + +In practice, you often have to measure through proxies. This isn’t an inherent problem, but the further you get between what you want to measure and what you’re actually measuring, the harder it is to connect the dots. It’s fine to track progress in closing bugs, writing code, and adding new features. However, those don’t necessarily correlate with how happy users are or whether the project is doing a good job of working towards its long-term objectives, whatever those may be. + +### 5. Different measurements serve different purposes. + +Some measurements may be non-obvious but useful for tracking the success of a project and community relative to internal goals. Others may be better suited for a press release or other external consumption. For example, as a community manager, you may really care about the number of meetups, mentoring sessions, and virtual briefings your community has held over the past three months. But it’s the number of contributions and contributors that are more likely to grab the headlines. You probably care about those too. But maybe not as much, depending upon your current priorities. + +Still, other measurements may relate to the goals of any sponsoring organizations. The measurements most relevant for projects tied to commercial products are likely to be different from pure community efforts. + +Because communities differ and goals differ, it’s not possible to simply compile a metrics checklist, but here are some ideas to think about: + +Consider qualitative metrics in addition to quantitative ones. Conducting surveys and other studies can be time-consuming, especially if they’re rigorous enough to yield better-than-anecdotal data. It also requires rigor to construct studies so that they can be used to track changes over time. In other words, it’s a lot easier to measure quantitative contributor activity than it is to suss out if the community members are happier about their participation today than they were a year ago. However, given the importance of culture to the health of a community, measuring it in a systematic way can be a worthwhile exercise. + +Breadth of community, including how many are unaffiliated with commercial entities, is important for many projects. The greater the breadth, the greater the potential leverage of the open source development process. It can also be instructive to see how companies and individuals are contributing. Projects can be explicitly designed to better accommodate casual contributors. + +Are new contributors able to have an impact, or are they ignored? How long does it take for code contributions to get committed? How long does it take for a reported bug to be fixed or otherwise responded to? If they asked a question in a forum, did anyone answer them? In other words, are you letting contributors contribute? + +Advancement within the project is also an important metric. [Mikeal Rogers of the Node.js community][2] explains: “The shift that we made was to create a support system and an education system to take a user and turn them into a contributor, first at a very low level, and educate them to bring them into the committer pool and eventually into the maintainer pool. The end result of this is that we have a wide range of skill sets. Rather than trying to attract phenomenal developers, we’re creating new phenomenal developers.” + +Whatever metrics you choose, don’t forget why you made them metrics in the first place. I find a helpful question to ask is: “What am I going to do with this number?” If the answer is to just put it in a report or in a press release, that’s not a great answer. Metrics should be measurements that tell you either that you’re on the right path or that you need to take specific actions to course-correct. + +For this reason, Stormy Peters, who handles community leads at Red Hat, [argues for keeping it simple][3]. She writes, “It’s much better to have one or two key metrics than to worry about all the possible metrics. You can capture all the possible metrics, but as a project, you should focus on moving one. It’s also better to have a simple metric that correlates directly to something in the real world than a metric that is a complicated formula or ration between multiple things. As project members make decisions, you want them to be able to intuitively feel whether or not it will affect the project’s key metric in the right direction.” + +The article is adapted from [How Open Source Ate Software][4] by Gordon Haff (Apress 2018). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/metrics-guide-open-source-projects + +作者:[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://community.redhat.com/blog/2014/07/when-metrics-go-wrong/ +[2]: https://opensource.com/article/17/3/nodejs-community-casual-contributors +[3]: https://medium.com/open-source-communities/3-important-things-to-consider-when-measuring-your-success-50e21ad82858 +[4]: https://www.apress.com/us/book/9781484238936 From 18a409110a31eec11b8a9b0fd143277b9032f883 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:18:24 +0800 Subject: [PATCH 0568/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Buil?= =?UTF-8?q?d=20a=20Netboot=20Server,=20Part=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 How to Build a Netboot Server, Part 4.md | 632 ++++++++++++++++++ 1 file changed, 632 insertions(+) create mode 100644 sources/tech/20190114 How to Build a Netboot Server, Part 4.md diff --git a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md b/sources/tech/20190114 How to Build a Netboot Server, Part 4.md new file mode 100644 index 0000000000..aadd3c0b01 --- /dev/null +++ b/sources/tech/20190114 How to Build a Netboot Server, Part 4.md @@ -0,0 +1,632 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Build a Netboot Server, Part 4) +[#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +How to Build a Netboot Server, Part 4 +====== +![](https://fedoramagazine.org/wp-content/uploads/2018/11/netboot4-816x345.jpg) + +One significant limitation of the netboot server built in this series is the operating system image being served is read-only. Some use cases may require the end user to modify the image. For example, an instructor may want to have the students install and configure software packages like MariaDB and Node.js as part of their course walk-through. + +An added benefit of writable netboot images is the end user’s “personalized” operating system can follow them to different workstations they may use at later times. + +### Change the Bootmenu Application to use HTTPS + +Create a self-signed certificate for the bootmenu application: + +``` +$ sudo -i +# MY_NAME=$( .*#listen => ['https://$MY_NAME:443?cert=$MY_TLSD/$MY_NAME.pem\&key=$MY_TLSD/$MY_NAME.key\&ciphers=AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA'],#" /opt/bootmenu/bootmenu.conf +``` + +Note the ciphers have been restricted to [those currently supported by iPXE][1]. + +GnuTLS requires the “CAP_DAC_READ_SEARCH” capability, so add it to the bootmenu application’s systemd service: + +``` +# sed -i '/^AmbientCapabilities=/ s/$/ CAP_DAC_READ_SEARCH/' /etc/systemd/system/bootmenu.service +# sed -i 's/Serves iPXE Menus over HTTP/Serves iPXE Menus over HTTPS/' /etc/systemd/system/bootmenu.service +# systemctl daemon-reload +``` + +Now, add an exception for the bootmenu service to the firewall and restart the service: + +``` +# MY_SUBNET=192.0.2.0 +# MY_PREFIX=24 +# firewall-cmd --add-rich-rule="rule family='ipv4' source address='$MY_SUBNET/$MY_PREFIX' service name='https' accept" +# firewall-cmd --runtime-to-permanent +# systemctl restart bootmenu.service +``` + +Use wget to verify it’s working: + +``` +$ MY_NAME=server-01.example.edu +$ MY_TLSD=/opt/bootmenu/tls +$ wget -q --ca-certificate=$MY_TLSD/$MY_NAME.pem -O - https://$MY_NAME/menu +``` + +### Add HTTPS to iPXE + +Update init.ipxe to use HTTPS. Then recompile the ipxe bootloader with options to embed and trust the self-signed certificate you created for the bootmenu application: + +``` +$ echo '#define DOWNLOAD_PROTO_HTTPS' >> $HOME/ipxe/src/config/local/general.h +$ sed -i 's/^chain http:/chain https:/' $HOME/ipxe/init.ipxe +$ cp $MY_TLSD/$MY_NAME.pem $HOME/ipxe +$ cd $HOME/ipxe/src +$ make clean +$ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe CERT="../$MY_NAME.pem" TRUST="../$MY_NAME.pem" +``` + +You can now copy the HTTPS-enabled iPXE bootloader out to your clients and test that everything is working correctly: + +``` +$ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi +``` + +### Add User Authentication to Mojolicious + +Create a PAM service definition for the bootmenu application: + +``` +# dnf install -y pam_krb5 +# echo 'auth required pam_krb5.so' > /etc/pam.d/bootmenu +``` + +Add a library to the bootmenu application that uses the Authen-PAM perl module to perform user authentication: + +``` +# dnf install -y perl-Authen-PAM; +# MY_MOJO=/opt/bootmenu +# mkdir $MY_MOJO/lib +# cat << 'END' > $MY_MOJO/lib/PAM.pm +package PAM; + +use Authen::PAM; + +sub auth { + my $success = 0; + + my $username = shift; + my $password = shift; + + my $callback = sub { + my @res; + while (@_) { + my $code = shift; + my $msg = shift; + my $ans = ""; + + $ans = $username if ($code == PAM_PROMPT_ECHO_ON()); + $ans = $password if ($code == PAM_PROMPT_ECHO_OFF()); + + push @res, (PAM_SUCCESS(), $ans); + } + push @res, PAM_SUCCESS(); + + return @res; + }; + + my $pamh = new Authen::PAM('bootmenu', $username, $callback); + + { + last unless ref $pamh; + last unless $pamh->pam_authenticate() == PAM_SUCCESS; + $success = 1; + } + + return $success; +} + +return 1; +END +``` + +The above code is taken almost verbatim from the Authen::PAM::FAQ man page. + +Redefine the bootmenu application so it returns a netboot template only if a valid username and password are supplied: + +``` +# cat << 'END' > $MY_MOJO/bootmenu.pl +#!/usr/bin/env perl + +use lib 'lib'; + +use PAM; +use Mojolicious::Lite; +use Mojolicious::Plugins; +use Mojo::Util ('url_unescape'); + +plugin 'Config'; + +get '/menu'; +get '/boot' => sub { + my $c = shift; + + my $instance = $c->param('instance'); + my $username = $c->param('username'); + my $password = $c->param('password'); + + my $template = 'menu'; + + { + last unless $instance =~ /^fc[[:digit:]]{2}$/; + last unless $username =~ /^[[:alnum:]]+$/; + last unless PAM::auth($username, url_unescape($password)); + $template = $instance; + } + + return $c->render(template => $template); +}; + +app->start; +END +``` + +The bootmenu application now looks for the lib directory relative to its WorkingDirectory. However, by default the working directory is set to the root directory of the server for systemd units. Therefore, you must update the systemd unit to set WorkingDirectory to the root of the bootmenu application instead: + +``` +# sed -i "/^RuntimeDirectory=/ a WorkingDirectory=$MY_MOJO" /etc/systemd/system/bootmenu.service +# systemctl daemon-reload +``` + +Update the templates to work with the redefined bootmenu application: + +``` +# cd $MY_MOJO/templates +# MY_BOOTMENU_SERVER=$( fc$i.html.ep; grep "^kernel\|initrd" menu.html.ep | grep "fc$i" >> fc$i.html.ep; echo "boot || chain https://$MY_BOOTMENU_SERVER/menu" >> fc$i.html.ep; sed -i "/^:f$i$/,/^boot /c :f$i\nlogin\nchain https://$MY_BOOTMENU_SERVER/boot?instance=fc$i\&username=\${username}\&password=\${password:uristring} || goto failed" menu.html.ep; done +``` + +The result of the last command above should be three files similar to the following: + +**menu.html.ep** : + +``` +#!ipxe + +set timeout 5000 + +:menu +menu iPXE Boot Menu +item --key 1 lcl 1. Microsoft Windows 10 +item --key 2 f29 2. RedHat Fedora 29 +item --key 3 f28 3. RedHat Fedora 28 +choose --timeout ${timeout} --default lcl selected || goto shell +set timeout 0 +goto ${selected} + +:failed +echo boot failed, dropping to shell... +goto shell + +:shell +echo type 'exit' to get the back to the menu +set timeout 0 +shell +goto menu + +:lcl +exit + +:f29 +login +chain https://server-01.example.edu/boot?instance=fc29&username=${username}&password=${password:uristring} || goto failed + +:f28 +login +chain https://server-01.example.edu/boot?instance=fc28&username=${username}&password=${password:uristring} || goto failed +``` + +**fc29.html.ep** : + +``` +#!ipxe +kernel --name kernel.efi ${prefix}/vmlinuz-4.19.5-300.fc29.x86_64 initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.0.2.91 nameserver=192.0.2.92 root=/dev/disk/by-path/ip-192.0.2.158:3260-iscsi-iqn.edu.example.server-01:fc29-lun-1 netroot=iscsi:192.0.2.158::::iqn.edu.example.server-01:fc29 console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img +boot || chain https://server-01.example.edu/menu +``` + +**fc28.html.ep** : + +``` +#!ipxe +kernel --name kernel.efi ${prefix}/vmlinuz-4.19.3-200.fc28.x86_64 initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.0.2.91 nameserver=192.0.2.92 root=/dev/disk/by-path/ip-192.0.2.158:3260-iscsi-iqn.edu.example.server-01:fc28-lun-1 netroot=iscsi:192.0.2.158::::iqn.edu.example.server-01:fc28 console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img ${prefix}/initramfs-4.19.3-200.fc28.x86_64.img +boot || chain https://server-01.example.edu/menu +``` + +Now, restart the bootmenu application and verify authentication is working: + +``` +# systemctl restart bootmenu.service +``` + +### Make the iSCSI Target Writeable + +Now that user authentication works through iPXE, you can create per-user, writeable overlays on top of the read-only image on demand when users connect. Using a [copy-on-write][2] overlay has three advantages over simply copying the original image file for each user: + + 1. The copy can be created very quickly. This allows creation on-demand. + 2. The copy does not increase the disk usage on the server. Only what the user writes to their personal copy of the image is stored in addition to the original image. + 3. Since most sectors for each copy are the same sectors on the server’s storage, they’ll likely already be loaded in RAM when subsequent users access their copies of the operating system. This improves the server’s performance because RAM is faster than disk I/O. + + + +One potential pitfall of using copy-on-write is that once overlays are created, the images on which they are overlayed must not be changed. If they are changed, all the overlays will be corrupted. Then the overlays must be deleted and replaced with new, blank overlays. Even simply mounting the image file in read-write mode can cause sufficient filesystem updates to corrupt the overlays. + +Due to the potential for the overlays to be corrupted if the original image is modified, mark the original image as immutable by running: + +``` +# chattr +i +``` + +You can use lsattr to view the status of the immutable flag and use to chattr -i unset the immutable flag. While the immutable flag is set, even the root user or a system process running as root cannot modify or delete the file. + +Begin by stopping the tgtd.service so you can change the image files: + +``` +# systemctl stop tgtd.service +``` + +It’s normal for this command to take a minute or so to stop when there are connections still open. + +Now, remove the read-only iSCSI export. Then update the readonly-root configuration file in the template so the image is no longer read-only: + +``` +# MY_FC=fc29 +# rm -f /etc/tgt/conf.d/$MY_FC.conf +# TEMP_MNT=$(mktemp -d) +# mount /$MY_FC.img $TEMP_MNT +# sed -i 's/^READONLY=yes$/READONLY=no/' $TEMP_MNT/etc/sysconfig/readonly-root +# sed -i 's/^Storage=volatile$/#Storage=auto/' $TEMP_MNT/etc/systemd/journald.conf +# umount $TEMP_MNT +``` + +Journald was changed from logging to volatile memory back to its default (log to disk if /var/log/journal exists) because a user reported his clients would freeze with an out-of-memory error due to an application generating excessive system logs. The downside to setting logging to disk is that extra write traffic is generated by the clients, and might burden your netboot server with unnecessary I/O. You should decide which option — log to memory or log to disk — is preferable depending on your environment. + +Since you won’t make any further changes to the template image, set the immutable flag on it and restart the tgtd.service: + +``` +# chattr +i /$MY_FC.img +# systemctl start tgtd.service +``` + +Now, update the bootmenu application: + +``` +# cat << 'END' > $MY_MOJO/bootmenu.pl +#!/usr/bin/env perl + +use lib 'lib'; + +use PAM; +use Mojolicious::Lite; +use Mojolicious::Plugins; +use Mojo::Util ('url_unescape'); + +plugin 'Config'; + +get '/menu'; +get '/boot' => sub { + my $c = shift; + + my $instance = $c->param('instance'); + my $username = $c->param('username'); + my $password = $c->param('password'); + + my $chapscrt; + my $template = 'menu'; + + { + last unless $instance =~ /^fc[[:digit:]]{2}$/; + last unless $username =~ /^[[:alnum:]]+$/; + last unless PAM::auth($username, url_unescape($password)); + last unless $chapscrt = `sudo scripts/mktgt $instance $username`; + $template = $instance; + } + + return $c->render(template => $template, username => $username, chapscrt => $chapscrt); +}; + +app->start; +END +``` + +This new version of the bootmenu application calls a custom mktgt script which, on success, returns a random [CHAP][3] password for each new iSCSI target that it creates. The CHAP password prevents one user from mounting another user’s iSCSI target by indirect means. The app only returns the correct iSCSI target password to a user who has successfully authenticated. + +The mktgt script is prefixed with sudo because it needs root privileges to create the target. + +The $username and $chapscrt variables also pass to the render command so they can be incorporated into the templates returned to the user when necessary. + +Next, update our boot templates so they can read the username and chapscrt variables and pass them along to the end user. Also update the templates to mount the root filesystem in rw (read-write) mode: + +``` +# cd $MY_MOJO/templates +# sed -i "s/:$MY_FC/:$MY_FC-<%= \$username %>/g" $MY_FC.html.ep +# sed -i "s/ netroot=iscsi:/ netroot=iscsi:<%= \$username %>:<%= \$chapscrt %>@/" $MY_FC.html.ep +# sed -i "s/ ro / rw /" $MY_FC.html.ep +``` + +After running the above commands, you should have boot templates like the following: + +``` +#!ipxe +kernel --name kernel.efi ${prefix}/vmlinuz-4.19.5-300.fc29.x86_64 initrd=initrd.img rw ip=dhcp rd.peerdns=0 nameserver=192.0.2.91 nameserver=192.0.2.92 root=/dev/disk/by-path/ip-192.0.2.158:3260-iscsi-iqn.edu.example.server-01:fc29-<%= $username %>-lun-1 netroot=iscsi:<%= $username %>:<%= $chapscrt %>@192.0.2.158::::iqn.edu.example.server-01:fc29-<%= $username %> console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img +boot || chain https://server-01.example.edu/menu +``` + +NOTE: If you need to view the boot template after the variables have been [interpolated][4], you can insert the “shell” command on its own line just before the “boot” command. Then, when you netboot your client, iPXE gives you an interactive shell where you can enter “imgstat” to view the parameters being passed to the kernel. If everything looks correct, you can type “exit” to leave the shell and continue the boot process. + +Now allow the bootmenu user to run the mktgt script (and only that script) as root via sudo: + +``` +# echo "bootmenu ALL = NOPASSWD: $MY_MOJO/scripts/mktgt *" > /etc/sudoers.d/bootmenu +``` + +The bootmenu user should not have write access to the mktgt script or any other files under its home directory. All the files under /opt/bootmenu should be owned by root, and should not be writable by any user other than root. + +Sudo does not work well with systemd’s DynamicUser option, so create a normal user account and set the systemd service to run as that user: + +``` +# useradd -r -c 'iPXE Boot Menu Service' -d /opt/bootmenu -s /sbin/nologin bootmenu +# sed -i 's/^DynamicUser=true$/User=bootmenu/' /etc/systemd/system/bootmenu.service +# systemctl daemon-reload +``` + +Finally, create a directory for the copy-on-write overlays and create the mktgt script that manages the iSCSI targets and their overlayed backing stores: + +``` +# mkdir /$MY_FC.cow +# mkdir $MY_MOJO/scripts +# cat << 'END' > $MY_MOJO/scripts/mktgt +#!/usr/bin/env perl + +# if another instance of this script is running, wait for it to finish +"$ENV{FLOCKER}" eq 'MKTGT' or exec "env FLOCKER=MKTGT flock /tmp $0 @ARGV"; + +# use "RETURN" to print to STDOUT; everything else goes to STDERR by default +open(RETURN, '>&', STDOUT); +open(STDOUT, '>&', STDERR); + +my $instance = shift or die "instance not provided"; +my $username = shift or die "username not provided"; + +my $img = "/$instance.img"; +my $dir = "/$instance.cow"; +my $top = "$dir/$username"; + +-f "$img" or die "'$img' is not a file"; +-d "$dir" or die "'$dir' is not a directory"; + +my $base; +die unless $base = `losetup --show --read-only --nooverlap --find $img`; +chomp $base; + +my $size; +die unless $size = `blockdev --getsz $base`; +chomp $size; + +# create the per-user sparse file if it does not exist +if (! -e "$top") { + die unless system("dd if=/dev/zero of=$top status=none bs=512 count=0 seek=$size") == 0; +} + +# create the copy-on-write overlay if it does not exist +my $cow="$instance-$username"; +my $dev="/dev/mapper/$cow"; +if (! -e "$dev") { + my $over; + die unless $over = `losetup --show --nooverlap --find $top`; + chomp $over; + die unless system("echo 0 $size snapshot $base $over p 8 | dmsetup create $cow") == 0; +} + +my $tgtadm = '/usr/sbin/tgtadm --lld iscsi'; + +# get textual representations of the iscsi targets +my $text = `$tgtadm --op show --mode target`; +my @targets = $text =~ /(?:^T.*\n)(?:^ .*\n)*/mg; + +# convert the textual representations into a hash table +my $targets = {}; +foreach (@targets) { + my $tgt; + my $sid; + + foreach (split /\n/) { + /^Target (\d+)(?{ $tgt = $targets->{$^N} = [] })/; + /I_T nexus: (\d+)(?{ $sid = $^N })/; + /Connection: (\d+)(?{ push @{$tgt}, [ $sid, $^N ] })/; + } +} + +my $hostname; +die unless $hostname = `hostname`; +chomp $hostname; + +my $target = 'iqn.' . join('.', reverse split('\.', $hostname)) . ":$cow"; + +# find the target id corresponding to the provided target name and +# close any existing connections to it +my $tid = 0; +foreach (@targets) { + next unless /^Target (\d+)(?{ $tid = $^N }): $target$/m; + foreach (@{$targets->{$tid}}) { + die unless system("$tgtadm --op delete --mode conn --tid $tid --sid $_->[0] --cid $_->[1]") == 0; + } +} + +# create a new target if an existing one was not found +if ($tid == 0) { + # find an available target id + my @ids = (0, sort keys %{$targets}); + $tid = 1; while ($ids[$tid]==$tid) { $tid++ } + + # create the target + die unless -e "$dev"; + die unless system("$tgtadm --op new --mode target --tid $tid --targetname $target") == 0; + die unless system("$tgtadm --op new --mode logicalunit --tid $tid --lun 1 --backing-store $dev") == 0; + die unless system("$tgtadm --op bind --mode target --tid $tid --initiator-address ALL") == 0; +} + +# (re)set the provided target's chap password +my $password = join('', map(chr(int(rand(26))+65), 1..8)); +my $accounts = `$tgtadm --op show --mode account`; +if ($accounts =~ / $username$/m) { + die unless system("$tgtadm --op delete --mode account --user $username") == 0; +} +die unless system("$tgtadm --op new --mode account --user $username --password $password") == 0; +die unless system("$tgtadm --op bind --mode account --tid $tid --user $username") == 0; + +# return the new password to the iscsi target on stdout +print RETURN $password; +END +# chmod +x $MY_MOJO/scripts/mktgt +``` + +The above script does five things: + + 1. It creates the /.cow/ sparse file if it does not already exist. + 2. It creates the /dev/mapper/- device node that serves as the copy-on-write backing store for the iSCSI target if it does not already exist. + 3. It creates the iqn.:- iSCSI target if it does not exist. Or, if the target does exist, it closes any existing connections to it because the image can only be opened in read-write mode from one place at a time. + 4. It (re)sets the chap password on the iqn.:- iSCSI target to a new random value. + 5. It prints the new chap password on [standard output][5] if all of the previous tasks compeleted successfully. + + + +You should be able to test the mktgt script from the command line by running it with valid test parameters. For example: + +``` +# echo `$MY_MOJO/scripts/mktgt fc29 jsmith` +``` + +When run from the command line, the mktgt script should print out either the eight-character random password for the iSCSI target if it succeeded or the line number on which something went wrong if it failed. + +On occasion, you may want to delete an iSCSI target without having to stop the entire service. For example, a user might inadvertently corrupt their personal image, in which case you would need to systematically undo everything that the above mktgt script does so that the next time they log in they will get a copy of the original image. + +Below is an rmtgt script that undoes, in reverse order, what the above mktgt script did: + +``` +# mkdir $HOME/bin +# cat << 'END' > $HOME/bin/rmtgt +#!/usr/bin/env perl + +@ARGV >= 2 or die "usage: $0 [+d|+f]\n"; + +my $instance = shift; +my $username = shift; + +my $rmd = ($ARGV[0] eq '+d'); #remove device node if +d flag is set +my $rmf = ($ARGV[0] eq '+f'); #remove sparse file if +f flag is set +my $cow = "$instance-$username"; + +my $hostname; +die unless $hostname = `hostname`; +chomp $hostname; + +my $tgtadm = '/usr/sbin/tgtadm'; +my $target = 'iqn.' . join('.', reverse split('\.', $hostname)) . ":$cow"; + +my $text = `$tgtadm --op show --mode target`; +my @targets = $text =~ /(?:^T.*\n)(?:^ .*\n)*/mg; + +my $targets = {}; +foreach (@targets) { + my $tgt; + my $sid; + + foreach (split /\n/) { + /^Target (\d+)(?{ $tgt = $targets->{$^N} = [] })/; + /I_T nexus: (\d+)(?{ $sid = $^N })/; + /Connection: (\d+)(?{ push @{$tgt}, [ $sid, $^N ] })/; + } +} + +my $tid = 0; +foreach (@targets) { + next unless /^Target (\d+)(?{ $tid = $^N }): $target$/m; + foreach (@{$targets->{$tid}}) { + die unless system("$tgtadm --op delete --mode conn --tid $tid --sid $_->[0] --cid $_->[1]") == 0; + } + die unless system("$tgtadm --op delete --mode target --tid $tid") == 0; + print "target $tid deleted\n"; + sleep 1; +} + +my $dev = "/dev/mapper/$cow"; +if ($rmd or ($rmf and -e $dev)) { + die unless system("dmsetup remove $cow") == 0; + print "device node $dev deleted\n"; +} + +if ($rmf) { + my $sf = "/$instance.cow/$username"; + die "sparse file $sf not found" unless -e "$sf"; + die unless system("rm -f $sf") == 0; + die unless not -e "$sf"; + print "sparse file $sf deleted\n"; +} +END +# chmod +x $HOME/bin/rmtgt +``` + +For example, to use the above script to completely remove the fc29-jsmith target including its backing store device node and its sparse file, run the following: + +``` +# rmtgt fc29 jsmith +f +``` + +Once you’ve verified that the mktgt script is working properly, you can restart the bootmenu service. The next time someone netboots, they should receive a personal copy of the the netboot image they can write to: + +``` +# systemctl restart bootmenu.service +``` + +Users should now be able to modify the root filesystem as demonstrated in the below screenshot: + +![][6] + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/ + +作者:[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]: http://ipxe.org/crypto +[2]: https://en.wikipedia.org/wiki/Copy-on-write +[3]: https://en.wikipedia.org/wiki/Challenge-Handshake_Authentication_Protocol +[4]: https://en.wikipedia.org/wiki/String_interpolation +[5]: https://en.wikipedia.org/wiki/Standard_streams +[6]: https://fedoramagazine.org/wp-content/uploads/2018/11/netboot-fix-pam_mount-1024x819.png From 3d53ff2022265753c02fc219fa8e74205f01aee9 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:19:50 +0800 Subject: [PATCH 0569/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Build=20a=20ret?= =?UTF-8?q?ro=20gaming=20console=20with=20RetroPie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ld a retro gaming console with RetroPie.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/tech/20190111 Build a retro gaming console with RetroPie.md diff --git a/sources/tech/20190111 Build a retro gaming console with RetroPie.md b/sources/tech/20190111 Build a retro gaming console with RetroPie.md new file mode 100644 index 0000000000..eedac575c9 --- /dev/null +++ b/sources/tech/20190111 Build a retro gaming console with RetroPie.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a retro gaming console with RetroPie) +[#]: via: (https://opensource.com/article/19/1/retropie) +[#]: author: (Jay LaCroix https://opensource.com/users/jlacroix) + +Build a retro gaming console with RetroPie +====== +Play your favorite classic Nintendo, Sega, and Sony console games on Linux. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_gaming_games_roundup_news.png?itok=KM0ViL0f) + +The most common question I get on [my YouTube channel][1] and in person is what my favorite Linux distribution is. If I limit the answer to what I run on my desktops and laptops, my answer will typically be some form of an Ubuntu-based Linux distro. My honest answer to this question may surprise many. My favorite Linux distribution is actually [RetroPie][2]. + +As passionate as I am about Linux and open source software, I'm equally passionate about classic gaming, specifically video games produced in the '90s and earlier. I spend most of my surplus income on older games, and I now have a collection of close to a thousand games for over 20 gaming consoles. In my spare time, I raid flea markets, yard sales, estate sales, and eBay buying games for various consoles, including almost every iteration made by Nintendo, Sega, and Sony. There's something about classic games that I adore, a charm that seems lost in games released nowadays. + +Unfortunately, collecting retro games has its fair share of challenges. Cartridges with memory for save files will lose their charge over time, requiring the battery to be replaced. While it's not hard to replace save batteries (if you know how), it's still time-consuming. Games on CD-ROMs are subject to disc rot, which means that even if you take good care of them, they'll still lose data over time and become unplayable. Also, sometimes it's difficult to find replacement parts for some consoles. This wouldn't be so much of an issue if the majority of classic games were available digitally, but the vast majority are never re-released on a digital platform. + +### Gaming on RetroPie + +RetroPie is a great project and an asset to retro gaming enthusiasts like me. RetroPie is a Raspbian-based distribution designed for use on the Raspberry Pi (though it is possible to get it working on other platforms, such as a PC). RetroPie boots into a graphical interface that is completely controllable via a gamepad or joystick and allows you to easily manage digital copies (ROMs) of your favorite games. You can scrape information from the internet to organize your collection better and manage lists of favorite games, and the entire interface is very user-friendly and efficient. From the interface, you can launch directly into a game, then exit the game by pressing a combination of buttons on your gamepad. You rarely need a keyboard, unless you have to enter your WiFi password or manually edit configuration files. + +I use RetroPie to host a digital copy of every physical game I own in my collection. When I purchase a game from a local store or eBay, I also download the ROM. As a collector, this is very convenient. If I don't have a particular physical console within arms reach, I can boot up RetroPie and enjoy a game quickly without having to connect cables or clean cartridge contacts. There's still something to be said about playing a game on the original hardware, but if I'm pressed for time, RetroPie is very convenient. I also don't have to worry about dead save batteries, dirty cartridge contacts, disc rot, or any of the other issues collectors like me have to regularly deal with. I simply play the game. + +Also, RetroPie allows me to be very clever and utilize my technical know-how to achieve additional functionality that's not normally available. For example, I have three RetroPies set up, each of them synchronizing their files between each other by leveraging [Syncthing][3], a popular open source file synchronization tool. The synchronization happens automatically, and it means I can start a game on one television and continue in the same place on another unit since the save files are included in the synchronization. To take it a step further, I also back up my save and configuration files to [Backblaze B2][4], so I'm protected if an SD card becomes defective. + +### Setting up RetroPie + +Setting up RetroPie is very easy, and if you've ever set up a Raspberry Pi Linux distribution before (such as Raspbian) the process is essentially the same—you simply download the IMG file and flash it to your SD card by utilizing another tool, such as [Etcher][5], and insert it into your RetroPie. Then plug in an AC adapter and gamepad and hook it up to your television via HDMI. Optionally, you can buy a case to protect your RetroPie from outside elements and add visual appeal. Here is a listing of things you'll need to get started: + + * Raspberry Pi board (Model 3B+ or higher recommended) + * SD card (16GB or larger recommended) + * A USB gamepad + * UL-listed micro USB power adapter, at least 2.5 amp + + + +If you choose to add the optional Raspberry Pi case, I recommend the Super NES and Super Famicom themed cases from [RetroFlag][6]. Not only do these cases look cool, but they also have fully functioning power and reset buttons. This means you can configure the reset and power buttons to directly trigger the operating system's halt process, rather than abruptly terminating power. This definitely makes for a more professional experience, but it does require the installation of a special script. The instructions are on [RetroFlag's GitHub page][7]. Be wary: there are many cases available on Amazon and eBay of varying quality. Some of them are cheap knock-offs of RetroFlag cases, and others are just a lower quality overall. In fact, even cases by RetroFlag vary in quality—I had some power-distribution issues with the NES-themed case that made for an unstable experience. If in doubt, I've found that RetroFlag's Super NES and Super Famicom themed cases work very well. + +### Adding games + +When you boot RetroPie for the first time, it will resize the filesystem to ensure you have full access to the available space on your SD card and allow you to set up your gamepad. I can't give you links for game ROMs, so I'll leave that part up to you to figure out. When you've found them, simply add them to the RetroPie SD card in the designated folder, which would be located under **/home/pi/RetroPie/roms/ **. You can use your favorite tool for transferring the ROMs to the Pi, such as [SCP][8] in a terminal, [WinSCP][9], [Samba][10], etc. Once you've added the games, you can rescan them by pressing start and choosing the option to restart EmulationStation. When it restarts, it should automatically add menu entries for the ROMs you've added. That's basically all there is to it. + +(The rescan updates EmulationStation’s game inventory. If you don’t do that, it won’t list any newly added games you copy over.) + +Regarding the games' performance, your mileage will vary depending on which consoles you're emulating. For example, I've noticed that Sega Dreamcast games barely run at all, and most Nintendo 64 games will run sluggishly with a bad framerate. Many PlayStation Portable (PSP) games also perform inconsistently. However, all of the 8-bit and 16-bit consoles emulate seemingly perfectly—I haven't run into a single 8-bit or 16-bit game that doesn't run well. Surprisingly, games designed for the original PlayStation run great for me, which is a great feat considering the lower-performance potential of the Raspberry Pi. + +Overall, RetroPie's performance is great, but the Raspberry Pi is not as powerful as a gaming PC, so adjust your expectations accordingly. + +### Conclusion + +RetroPie is a fantastic open source project dedicated to preserving classic games and an asset to game collectors everywhere. Having a digital copy of my physical game collection is extremely convenient. If I were to tell my childhood self that one day I could have an entire game collection on one device, I probably wouldn't believe it. But RetroPie has become a staple in my household and provides hours of fun and enjoyment. + +If you want to see the parts I mentioned as well as a quick installation overview, I have [a video][11] on [my YouTube channel][12] that goes over the process and shows off some gameplay at the end. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/retropie + +作者:[Jay LaCroix][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jlacroix +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/channel/UCxQKHvKbmSzGMvUrVtJYnUA +[2]: https://retropie.org.uk/ +[3]: https://syncthing.net/ +[4]: https://www.backblaze.com/b2/cloud-storage.html +[5]: https://www.balena.io/etcher/ +[6]: https://www.amazon.com/shop/learnlinux.tv?listId=1N9V89LEH5S8K +[7]: https://github.com/RetroFlag/retroflag-picase +[8]: https://en.wikipedia.org/wiki/Secure_copy +[9]: https://winscp.net/eng/index.php +[10]: https://www.samba.org/ +[11]: https://www.youtube.com/watch?v=D8V-KaQzsWM +[12]: http://www.youtube.com/c/LearnLinuxtv From 99131600b62f723c6783fccc6f078c09a8b0a716 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:20:59 +0800 Subject: [PATCH 0570/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Move?= =?UTF-8?q?=20Multiple=20File=20Types=20Simultaneously=20From=20Commandlin?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e Types Simultaneously From Commandline.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md diff --git a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md new file mode 100644 index 0000000000..1b342b12ef --- /dev/null +++ b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) +[#]: via: (https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Move Multiple File Types Simultaneously From Commandline +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/Move-Multiple-File-Types-720x340.png) + +The other day I was wondering how can I move (not copy) multiple file types from directory to another. I already knew how to [**find and copy certain type of files from one directory to another**][1]. But, I don’t know how to move multiple file types simultaneously. If you’re ever in a situation like this, I know a easy way to do it from commandline in Unix-like systems. + +### Move Multiple File Types Simultaneously + +Picture this scenario.You have multiple type of files, for example .pdf, .doc, .mp3, .mp4, .txt etc., on a directory named **‘dir1’**. Let us take a look at the dir1 contents: + +``` +$ ls dir1 +file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 +``` + +You want to move some of the file types (not all of them) to different location. For example, let us say you want to move doc, pdf and txt files only to another directory named **‘dir2’** in one go. + +To copy .doc, .pdf and .txt files from dir1 to dir2 simultaneously, the command would be: + +``` +$ mv dir1/*.{doc,pdf,txt} dir2/ +``` + +It’s easy, isn’t it? + +Now, let us check the contents of dir2: + +``` +$ ls dir2/ +file.txt mydoc.doc personal.pdf +``` + +See? Only the file types .doc, .pdf and .txt from dir1 have been moved to dir2. + +![][3] + +You can add as many file types as you want to inside curly braces in the above command to move them across different directories. The above command just works fine for me on Bash. + +Another way to move multiple file types is go to the source directory i.e dir1 in our case: + +``` +$ cd ~/dir1 +``` + +And, move file types of your choice to the destination (E.g dir2) as shown below. + +``` +$ mv *.doc *.txt *.pdf /home/sk/dir2/ +``` + +To move all files having a particular extension, for example **.doc** only, run: + +``` +$ mv dir1/*.doc dir2/ +``` + +For more details, refer man pages. + +``` +$ man mv +``` + +Moving a few number of same or different file types is easy! You could do this with couple mouse clicks in GUI mode or use a one-liner command in CLI mode. However, If you have thousands of different file types in a directory and wanted to move multiple file types to different directory in one go, it would be a cumbersome task. To me, the above method did the job easily! If you know any other one-liner commands to move multiple file types at a time, please share it in the comment section below. I will check and update the guide accordingly. + +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-move-multiple-file-types-simultaneously-from-commandline/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/find-copy-certain-type-files-one-directory-another-linux/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/mv-command.gif From 4a8e74b50ce03261a4f5d0ee9443a96fa8ede517 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:30:44 +0800 Subject: [PATCH 0571/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20useful=20Vi?= =?UTF-8?q?m=20plugins=20for=20developers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...110 5 useful Vim plugins for developers.md | 369 ++++++++++++++++++ 1 file changed, 369 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..985f6104cc --- /dev/null +++ b/sources/tech/20190110 5 useful Vim plugins for developers.md @@ -0,0 +1,369 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者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 e78b49a5f1f75bfa621ef4169d357f604d0993e4 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:32:44 +0800 Subject: [PATCH 0572/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20You=20(probably?= =?UTF-8?q?)=20don't=20need=20Kubernetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...14 You (probably) don-t need Kubernetes.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/talk/20190114 You (probably) don-t need Kubernetes.md diff --git a/sources/talk/20190114 You (probably) don-t need Kubernetes.md b/sources/talk/20190114 You (probably) don-t need Kubernetes.md new file mode 100644 index 0000000000..5526f48f48 --- /dev/null +++ b/sources/talk/20190114 You (probably) don-t need Kubernetes.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (You (probably) don't need Kubernetes) +[#]: via: (https://arp242.net/weblog/dont-need-k8s.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +You (probably) don't need Kubernetes +====== + +This may perhaps be an unpopular opinion, but the overwhelming majority of companies are probably better off not using k8s. + +You know those old “Hello world according to programmer skill” jokes that start with `printf("hello, world\n")` for a junior programmer and end with some convoluted Java OOP design pattern solution for senior software architect engineer? This is kind of like that. + +* Junior sysops + `./binary` +* Experienced sysops + `./binary` on EC2. +* devops + Self-deployed CI pipeline to run `./binary` on EC2. +* Senior cloud orchestration engineer + k8s orchestrated self-deployed CI pipeline to run `./binary` on E2C platform. + + + +¯\\_(ツ)_/¯ + +That doesn’t mean that Kubernetes or any of these things are bad per se, just as Java or OOP aren’t bad per se, but rather that they’re horribly misapplied in many cases, just as using several Java OOP design patterns are horribly misapplied to a hello world program. For most companies the sysops requirements are fundamentally not very complex, and applying k8s to them makes litle sense. + +Complexity creates work by its very nature, and I’m skeptical that using k8s is a time-saver for most users. It’s like spending a day on a script to automate some 10-minute task that you do once a month. That’s not a good time investment (especially since the chances are you’ll have to invest further time in the future by expanding or debugging that script at some point). + +Your deployments probably should be automated – lest you [end up like Knightmare][1] – but k8s can often be replaced by a simple shell script. + +In our own company the sysops team spent a lot of time setting up k8s. They also had to spend a lot of time on updating to a newer version a while ago (1.6 ➙ 1.8). And the result is something no one really understands without really diving in to k8s, and even then it’s hard (those YAML files, yikes!) + +Before I could debug and fix deploy issues myself. Now that’s a lot harder. I understand the basic concepts, but that’s not all that useful when actually debugging practical issues. I don’t deal with k8s often enough to justify learning this. + +That k8s is really hard is not a novel insight, which is why there are a host of “k8s made easy” solutions out there. The idea of adding another layer on top of k8s to “make it easier” strikes me as, ehh, unwise. It’s not like that complexity disappears; you’ve just hidden it. + +I have said this many times before: when determining if something is “easy” then my prime concern is not how easy something is to write, but how easy something is to debug when things fail. Wrapping k8s will not make things easier to debug, quite the opposite: it will make it even harder. + +There is a famous Blaise Pascal quote: + +> All human evil comes from a single cause, man’s inability to sit still in a room. + +k8s – and to lesser extent, Docker – seem to be an example of that. A lot of people seem lost in the excitement of the moment and are “k8s al the things!”, just as some people were lost in the excitement when Java OOP was new, so everything has to be converted from the “old” way to the “new” ones, even though the “old” ways still worked fine. + +Sometimes the IT industry is pretty silly. + +Or to summarize this post [with a Tweet][2]: + +> 2014 - We must adopt #microservices to solve all problems with monoliths +> 2016 - We must adopt #docker to solve all problems with microservices +> 2018 - We must adopt #kubernetes to solve all problems with docker + +You can mail me at [martin@arp242.net][3] or [create a GitHub issue][4] for feedback, questions, etc. + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/dont-need-k8s.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://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ +[2]: https://twitter.com/sahrizv/status/1018184792611827712 +[3]: mailto:martin@arp242.net +[4]: https://github.com/Carpetsmoker/arp242.net/issues/new From e35207fc1a47958479e2224f1b70aad62954ff1e Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:35:34 +0800 Subject: [PATCH 0573/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Get=20started?= =?UTF-8?q?=20with=20Joplin,=20a=20note-taking=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... started with Joplin, a note-taking app.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190113 Get started with Joplin, a note-taking app.md diff --git a/sources/tech/20190113 Get started with Joplin, a note-taking app.md b/sources/tech/20190113 Get started with Joplin, a note-taking app.md new file mode 100644 index 0000000000..2498435040 --- /dev/null +++ b/sources/tech/20190113 Get started with Joplin, a note-taking app.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Joplin, a note-taking app) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Joplin, a note-taking app +====== +Learn how open source tools can help you be more productive in 2019. First up, Joplin. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S) + +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 first of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Joplin + +In the realm of productivity tools, note-taking apps are VERY handy. Yes, you can use the open source [NixNote][1] to access [Evernote][2] notes, but it's still linked to the Evernote servers and still relies on a third party for security. And while you CAN export your Evernote notes from NixNote, the only format options are NixNote XML or PDF files. + +![](https://opensource.com/sites/default/files/uploads/joplin-1.png) + +Enter [Joplin][3]. Joplin is a NodeJS application that runs and stores notes locally, allows you to encrypt your notes and supports multiple sync methods. Joplin can run as a console or graphical application on Windows, Mac, and Linux. Joplin also has mobile apps for Android and iOS, meaning you can take your notes with you without a major hassle. Joplin even allows you to format notes with Markdown, HTML, or plain text. + +![](https://opensource.com/sites/default/files/uploads/joplin-3.png) + +One really nice thing about Joplin is it supports two kinds of notes: plain notes and to-do notes. Plain notes are what you expect—documents containing text. To-do notes, on the other hand, have a checkbox in the notes list that allows you to mark them "done." And since the to-do note is still a note, you can include lists, documentation, and additional to-do items in a to-do note. + +When using the GUI, you can toggle editor views between plain text, WYSIWYG, and a split screen showing both the source text and the rendered view. You can also specify an external editor in the GUI, making it easy to update notes with Vim, Emacs, or any other editor capable of handling text documents. + +![Joplin console version][5] + +Joplin in the console. + +The console interface is absolutely fantastic. While it lacks a WYSIWYG editor, it defaults to the text editor for your login. It also has a powerful command mode that allows you to do almost everything you can do in the GUI version. And it renders Markdown correctly in the viewer. + +You can group notes in notebooks and tag notes for easy grouping across your notebooks. And it even has built-in search, so you can find things if you forget where you put them. + +Overall, Joplin is a first-class note-taking app ([and a great alternative to Evernote][6]) that will help you be organized and more productive over the next year. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-joplin + +作者:[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://nixnote.org/NixNote-Home/ +[2]: https://evernote.com/ +[3]: https://joplin.cozic.net/ +[4]: https://opensource.com/article/19/1/file/419776 +[5]: https://opensource.com/sites/default/files/uploads/joplin-2_0.png (Joplin console version) +[6]: https://opensource.com/article/17/12/joplin-open-source-evernote-alternative From 925dae2cb1aeaeac8ba00b0078aba09a3fb42ca0 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Tue, 15 Jan 2019 13:59:17 +0800 Subject: [PATCH 0574/4278] translating by hopefully2333 translating by hopefully2333 --- sources/talk/20180919 5 ways DevSecOps changes security.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180919 5 ways DevSecOps changes security.md b/sources/talk/20180919 5 ways DevSecOps changes security.md index 28e4b90eec..aef3780fdb 100644 --- a/sources/talk/20180919 5 ways DevSecOps changes security.md +++ b/sources/talk/20180919 5 ways DevSecOps changes security.md @@ -1,3 +1,5 @@ + translating by hopefully2333 + 5 ways DevSecOps changes security ====== From 5dddca68ef8c2b56b757e8a179b877539ce7c1f0 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 14:37:23 +0800 Subject: [PATCH 0575/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Getting=20start?= =?UTF-8?q?ed=20with=20Pelican:=20A=20Python-based=20static=20site=20gener?= =?UTF-8?q?ator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n- A Python-based static site generator.md | 223 ++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md diff --git a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md new file mode 100644 index 0000000000..29772d473c --- /dev/null +++ b/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -0,0 +1,223 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Pelican: A Python-based static site generator) +[#]: via: (https://opensource.com/article/19/1/getting-started-pelican) +[#]: author: (Craig Sebenik https://opensource.com/users/craig5) + +Getting started with Pelican: A Python-based static site generator +====== +Pelican is a great choice for Python users who want to self-host a simple website or blog. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0) + +If you want to create a custom website or blog, you have a lot of options. Many providers will host your website and do much of the work for you. (WordPress is an extremely popular option.) But you lose some flexibility by using a hosted solution. As a software developer, I prefer to manage my own server and keep more freedom in how my website operates. + +However, it is a fair amount of work to manage a web server. Installing it and getting a simple application up to serve content is easy enough. But keeping on top of security patches and updates is very time-consuming. If you just want to serve static web pages, having a web server and a host of applications may be more effort than it's worth. Creating HTML pages by hand is also not a good option. + +This is where a static site generator can come in. These applications use templates to create all the static pages you want and cross-link them with associated metadata. (e.g., showing all the pages with a common tag or keyword.) Static site generators help you create a site with a common look and feel using elements like navigation areas and a header and footer. + +I have been using [Python][1] for years now. So, when I first started looking for something to generate static HTML pages, I wanted something written in Python. The main reason is that I often want to peek into the internals of how an application works, and using a language that I already know makes that easier. (If that isn't important to you or you don't use Python, there are some other great [static site generators][2] that use Ruby, JavaScript, and other languages.) + +I decided to give [Pelican][3] a try. It is a commonly used static site generator written in Python. It directly supports [reStructuredText][4] and can support [Markdown][5] when the required package is installed. All the tasks are performed via command-line interface (CLI) tools, which makes it simple for anyone familiar with the command line. And its simple quickstart CLI tool makes creating a website extremely easy. + +In this article, I'll explain how to install Pelican 4, add an article, and change the default theme. (Note: This was all developed on MacOS; it should work the same using any flavor of Unix/Linux, but I don't have a Windows host to test on.) + +### Installation and configuration + +The first step is to create a [virtualenv][6] and install Pelican. + +``` +$ mkdir test-site +$ cd test-site +$ python3 -m venv venv +$ ./venv/bin/pip install --upgrade pip +... +Successfully installed pip-18.1 +$ ./venv/bin/pip install pelican +Collecting pelican +... +Successfully installed MarkupSafe-1.1.0 blinker-1.4 docutils-0.14 feedgenerator-1.9 jinja2-2.10 pelican-4.0.1 pygments-2.3.1 python-dateutil-2.7.5 pytz-2018.7 six-1.12.0 unidecode-1.0.23 +``` + +To keep things simple, I entered values for the title and author and replied N to URL prefix and article pagination. (For the rest of the questions, I used the default given.) + +Pelican's quickstart CLI tool will create the basic layout and a few files to get you started. Run the **pelican-quickstart** command. To keep things simple, I entered values for the **title** and **author** and replied **N** to URL prefix and article pagination. It is very easy to change these settings in the configuration file later. + +``` +$ ./venv/bin/pelicanquickstart +Welcome to pelicanquickstart v4.0.1. + +This script will help you create a new Pelican-based website. + +Please answer the following questions so this script can generate the files needed by Pelican. + +> Where do you want to create your new web site? [.] +> What will be the title of this web site? My Test Blog +> Who will be the author of this web site? Craig +> What will be the default language of this web site? [en] +> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n +> Do you want to enable article pagination? (Y/n) n +> What is your time zone? [Europe/Paris] +> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) +> Do you want to upload your website using FTP? (y/N) +> Do you want to upload your website using SSH? (y/N) +> Do you want to upload your website using Dropbox? (y/N) +> Do you want to upload your website using S3? (y/N) +> Do you want to upload your website using Rackspace Cloud Files? (y/N) +> Do you want to upload your website using GitHub Pages? (y/N) +Done. Your new project is available at /Users/craig/tmp/pelican/test-site +``` + +All the files you need to get started are ready to go. + +The quickstart defaults to the Europe/Paris time zone, so change that before proceeding. Open the **pelicanconf.py** file in your favorite text editor. Look for the **TIMEZONE** variable. + +``` +TIMEZONE = 'Europe/Paris' +``` + +Change it to **UTC**. + +``` +TIMEZONE = 'UTC' +``` + +To update the social settings, look for the **SOCIAL** variable in **pelicanconf.py**. + +``` +SOCIAL = (('You can add links in your config file', '#'), +          ('Another social link', '#'),) +``` + +I'll add a link to my Twitter account. + +``` +SOCIAL = (('Twitter (#craigs55)', 'https://twitter.com/craigs55'),) +``` + +Notice that trailing comma—it's important. That comma helps Python recognize the variable is actually a set. Make sure you don't delete that comma. + +Now you have the basics of a site. The quickstart created a Makefile with a number of targets. Giving the **devserver** target to **make** will start a development server on your machine so you can preview everything. The CLI commands used in the Makefile are assumed to be part of your **PATH** , so you need to **activate** the **virtualenv** first. + +``` +$ source ./venv/bin/activate +$ make devserver +pelican -lr /Users/craig/tmp/pelican/test-site/content o +/Users/craig/tmp/pelican/test-site/output -s /Users/craig/tmp/pelican/test-site/pelicanconf.py + +-> Modified: theme, settings. regenerating... +WARNING: No valid files found in content for the active readers: +   | BaseReader (static) +   | HTMLReader (htm, html) +   | RstReader (rst) +Done: Processed 0 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.18 seconds. +``` + +Point your favorite browser to to see your simple test blog. + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site1.png) + +You can see the Twitter link on the right side and some links to Pelican, Python, and Jinja to the left of it. (Jinja is a great templating language that Pelican can use. You can learn more about it in [Jinja's documentation][7].) + +### Adding content + +Now that you have a basic site, add some content. First, add a file called **welcome.rst** to the site's **content** directory. In your favorite text editor, create a file with the following text: + +``` +$ pwd +/Users/craig/tmp/pelican/test-site +$ cat content/welcome.rst + +Welcome to my blog! +################### + +:date: 20181216 08:30 +:tags: welcome +:category: Intro +:slug: welcome +:author: Craig +:summary: Welcome document + +Welcome to my blog. +This is a short page just to show how to put up a static page. +``` + +The metadata lines—date, tags, etc.—are automatically parsed by Pelican. + +After you write the file, the **devserver** should output something like this: + +``` +-> Modified: content. regenerating... +Done: Processed 1 article, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.10 seconds. +``` + +Reload your test site in your browser to view the changes. + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site2.png) + +The metadata (e.g., date and tags) were automatically added to the page. Also, Pelican automatically detected the **intro** category and added the section to the top navigation. + +### Change the theme + +One of the nicest parts of working with popular, open source software like Pelican is that many users will make changes and contribute them back to the project. Many of the contributions are in the form of themes. + +A site's theme sets colors, layout options, etc. It's really easy to try out new themes. You can preview many of them at [Pelican Themes][8]. + +First, clone the GitHub repo: + +``` +$ cd .. +$ git clone --recursive https://github.com/getpelican/pelicanthemes +Cloning into 'pelicanthemes'... +``` + +Since I like the color blue, I'll try [blueidea][9]. + +Edit **pelicanconf.py** and add the following line: + +``` +THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' +``` + +The **devserver** will regenerate your output. Reload the webpage in your browser to see the new theme. + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site3.png) + +The theme controls many aspects of the layout. For example, in the default theme, you can see the category (Intro) with the meta tags next to the article. But that category is not displayed in the blueidea theme. + +### Other considerations + +This was a pretty quick introduction to Pelican. There are a couple of important topics that I did not cover. + +First, one reason I was hesitant to move to a static site was that it wouldn't allow discussions on the articles. Fortunately, there are some third-party providers that will host discussions for you. The one I am currently looking at is [Disqus][10]. + +Next, everything above was done on my local machine. If I want others to view my site, I'll have to upload the pre-generated HTML files somewhere. If you look at the **pelican-quickstart** output, you will see options for using FTP, SSH, S3, and even GitHub Pages. Each option has its pros and cons. But, if I had to choose one, I would likely publish to GitHub Pages. + +Pelican has many other features—I am still learning more about it every day. If you want to self-host a website or a blog with simple, static content and you want to use Python, Pelican is a great choice. It has an active user community that is fixing bugs, adding features, and creating new and interesting themes. Give it a try! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/getting-started-pelican + +作者:[Craig Sebenik][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/craig5 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/resources/python +[2]: https://opensource.com/sitewide-search?search_api_views_fulltext=static%20site%20generator +[3]: http://docs.getpelican.com/en/stable/ +[4]: http://docutils.sourceforge.net/rst.html +[5]: https://daringfireball.net/projects/markdown/ +[6]: https://virtualenv.pypa.io/en/latest/ +[7]: http://jinja.pocoo.org/docs/2.10/ +[8]: http://www.pelicanthemes.com/ +[9]: https://github.com/nasskach/pelican-blueidea/tree/58fb13112a2707baa7d65075517c40439ab95c0a +[10]: https://disqus.com/ From bdf7923d01f12f6e8cfddffd227de0aeb4e5d96c Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 14:44:31 +0800 Subject: [PATCH 0576/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20What=20is=20Dev?= =?UTF-8?q?SecOps=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20191110 What is DevSecOps.md | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/talk/20191110 What is DevSecOps.md diff --git a/sources/talk/20191110 What is DevSecOps.md b/sources/talk/20191110 What is DevSecOps.md new file mode 100644 index 0000000000..007f8f0c76 --- /dev/null +++ b/sources/talk/20191110 What is DevSecOps.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is DevSecOps?) +[#]: via: (https://opensource.com/article/19/1/what-devsecops) +[#]: author: (Brett Hunoldt https://opensource.com/users/bretthunoldtcom) + +What is DevSecOps? +====== +The journey to DevSecOps begins with empowerment, enablement, and education. Here's how to get started. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devop.png?itok=Yicb2nnZ) + +> “DevSecOps enables organizations to deliver inherently secure software at DevOps speed.” -Stefan Streichsbier + +DevSecOps as a practice or an art form is an evolution on the concept of DevOps. To better understand DevSecOps, you should first have an understanding of what DevOps means. + +DevOps was born from merging the practices of development and operations, removing the silos, aligning the focus, and improving efficiency and performance of both the teams and the product. A new synergy was formed, with DevOps focused on building products and services that are easy to maintain and that automate typical operations functions. + +Security is a common silo in many organizations. Security’s core focus is protecting the organization, and sometimes this means creating barriers or policies that slow down the execution of new services or products to ensure that everything is well understood and done safely and that nothing introduces unnecessary risk to the organization. + +**[[Download the Getting started with DevSecOps guide]][1]** + +Because of the distinct nature of the security silo and the friction it can introduce, development and operations sometimes bypass or work around security to meet their objectives. At some firms, the silo creates an expectation that security is entirely the responsibility of the security team and it is up to them to figure out what security defects or issues may be introduced as a result of a product. + +DevSecOps looks at merging the security discipline within DevOps. By enhancing or building security into the developer and/or operational role, or including a security role within the product engineering team, security naturally finds itself in the product by design. + +This allows companies to release new products and updates more quickly and with full confidence that security is embedded into the product. + +### Where does rugged software fit into DevSecOps? + +Building rugged software is more an aspect of the DevOps culture than a distinct practice, and it complements and enhances a DevSecOps practice. Think of a rugged product as something that has been battle-hardened through experimentation or experience. + +It’s important to note that rugged software is not necessarily 100% secure (although it may have been at some point in time). However, it has been designed to handle most of what is thrown at it. + +The key tenets of a rugged software practice are fostering competition, experimentation, controlled failure, and cooperation. + +### How do you get started in DevSecOps? + +Gettings started with DevSecOps involves shifting security requirements and execution to the earliest possible stage in the development process. It ultimately creates a shift in culture where security becomes everyone’s responsibility, not only the security team’s. + +You may have heard teams talking about a "shift left." If you flatten the development pipeline into a horizontal line to include the key stages of the product evolution—from initiation to design, building, testing, and finally to operating—the goal of a security is to be involved as early as possible. This allows the risks to be better evaluated, socialized, and mitigated by design. The "shift-left" mentality is about moving this engagement far left in this pipeline. + +This journey begins with three key elements: + + * empowerment + * enablement + * education + + + +Empowerment, in my view, is about releasing control and allowing teams to make independent decisions without fear of failure or repercussion (within reason). The only caveat in this process is that information is critical to making informed decisions (more on that below). + +To achieve empowerment, business and executive support (which can be created through internal sales, presentations, and establishing metrics to show the return on this investment) is critical to break down the historic barriers and siloed teams. Integrating security into the development and operations teams and increasing both communication and transparency can help you begin the journey to DevSecOps. + +This integration and mobilization allows teams to focus on a single outcome: Building a product for which they share responsibility and collaborate on development and security in a reliable way. This will take you most of the way towards empowerment. It places the shared responsibility for the product with the teams building it and ensures that any part of the product can be taken apart and maintain its security. + +Enablement involves placing the right tools and resources in the hands of the teams. It’s about creating a culture of knowledge-sharing through forums, wikis, and informal gatherings. + +Creating a culture that focuses on automation and the concept that repetitive tasks should be coded will likely reduce operational overhead and strengthen security. This scenario is about more than providing knowledge; it is about making this knowledge highly accessible through multiple channels and mediums (which are enabled through tools) so that it can be consumed and shared in whatever way teams or individuals prefer. One medium might work best when team members are coding and another when they are on the road. Make the tools accessible and simple and let the team play with them. + +Different DevSecOp teams will have different preferences, so allow them to be independent whenever possible. This is a delicate balancing exercise because you do want economies of scale and the ability to share among products. Collaboration and involvement in the selection and renewal of these tools will help lower the barriers of adoption. + +Finally, and perhaps most importantly, DevSecOps is about training and awareness building. Meetups, social gatherings, or formal presentations within the organization are great ways for peers to teach and share their learnings. Sometimes these highlight shared challenges, concerns, or risks others may not have considered. Sharing and teaching are also effective ways to learn and to mentor teams. + +In my experience, each organization's culture is unique, so you can’t take a “one-size-fits-all” approach. Reach out to your teams and find out what tools they want to use. Test different forums and gatherings and see what works best for your culture. Seek feedback and ask the teams what is working, what they like, and why. Adapt and learn, be positive, and never stop trying, and you’ll almost always succeed. + +[Download the Getting started with DevSecOps guide][1] + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/what-devsecops + +作者:[Brett Hunoldt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bretthunoldtcom +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/downloads/devsecops From 97fc9f6aa1afb02c3ff42d7babb9864529b424e8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 14:47:51 +0800 Subject: [PATCH 0577/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Editing=20Subti?= =?UTF-8?q?tles=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190113 Editing Subtitles in Linux.md | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 sources/tech/20190113 Editing Subtitles in Linux.md diff --git a/sources/tech/20190113 Editing Subtitles in Linux.md b/sources/tech/20190113 Editing Subtitles in Linux.md new file mode 100644 index 0000000000..1eaa6a68fd --- /dev/null +++ b/sources/tech/20190113 Editing Subtitles in Linux.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Editing Subtitles in Linux) +[#]: via: (https://itsfoss.com/editing-subtitles) +[#]: author: (Shirish https://itsfoss.com/author/shirish/) + +Editing Subtitles in Linux +====== + +I have been a world movie and regional movies lover for decades. Subtitles are the essential tool that have enabled me to enjoy the best movies in various languages and from various countries. + +If you enjoy watching movies with subtitles, you might have noticed that sometimes the subtitles are not synced or not correct. + +Did you know that you can edit subtitles and make them better? Let me show you some basic subtitle editing in Linux. + +![Editing subtitles in Linux][1] + +### Extracting subtitles from closed captions data + +Around 2012, 2013 I came to know of a tool called [CCEextractor.][2] As time passed, it has become one of the vital tools for me, especially if I come across a media file which has the subtitle embedded in it. + +CCExtractor analyzes video files and produces independent subtitle files from the closed captions data. + +CCExtractor is a cross-platform, free and open source tool. The tool has matured quite a bit from its formative years and has been part of [GSOC][3] and Google Code-in now and [then.][4] + +The tool, to put it simply, is more or less a set of scripts which work one after another in a serialized order to give you an extracted subtitle. + +You can follow the installation instructions for CCExtractor on [this page][5]. + +After installing when you want to extract subtitles from a media file, do the following: + +``` +ccextractor +``` + +The output of the command will be something like this: + +It basically scans the media file. In this case, it found that the media file is in malyalam and that the media container is an [.mkv][6] container. It extracted the subtitle file with the same name as the video file adding _eng to it. + +CCExtractor is a wonderful tool which can be used to enhance subtitles along with Subtitle Edit which I will share in the next section. + +``` +Interesting Read: There is an interesting synopsis of subtitles at [vicaps][7] which tells and shares why subtitles are important to us. It goes into quite a bit of detail of movie-making as well for those interested in such topics. +``` + +### Editing subtitles with SubtitleEditor Tool + +You probably are aware that most subtitles are in [.srt format][8] . The beautiful thing about this format is and was you could load it in your text editor and do little fixes in it. + +A srt file looks something like this when launched into a simple text-editor: + +The excerpt subtitle I have shared is from a pretty Old German Movie called [The Cabinet of Dr. Caligari (1920)][9] + +Subtitleeditor is a wonderful tool when it comes to editing subtitles. Subtitle Editor is and can be used to manipulate time duration, frame-rate of the subtitle file to be in sync with the media file, duration of breaks in-between and much more. I’ll share some of the basic subtitle editing here. + +![][10] + +First install subtitleeditor the same way you installed ccextractor, using your favorite installation method. In Debian, you can use this command: + +``` +sudo apt install subtitleeditor +``` + +When you have it installed, let’s see some of the common scenarios where you need to edit a subtitle. + +#### Manipulating Frame-rates to sync with Media file + +If you find that the subtitles are not synced with the video, one of the reasons could be the difference between the frame rates of the video file and the subtitle file. + +How do you know the frame rates of these files, then? + +To get the frame rate of a video file, you can use the mediainfo tool. You may need to install it first using your distribution’s package manager. + +Using mediainfo is simple: + +``` +$ mediainfo somefile.mkv | grep Frame + Format settings : CABAC / 4 Ref Frames + Format settings, ReFrames : 4 frames + Frame rate mode : Constant + Frame rate : 25.000 FPS + Bits/(Pixel*Frame) : 0.082 + Frame rate : 46.875 FPS (1024 SPF) +``` + +Now you can see that framerate of the video file is 25.000 FPS. The other Frame-rate we see is for the audio. While I can share why particular fps are used in Video-encoding, Audio-encoding etc. it would be a different subject matter. There is a lot of history associated with it. + +Next is to find out the frame rate of the subtitle file and this is a slightly complicated. + +Usually, most subtitles are in a zipped format. Unzipping the .zip archive along with the subtitle file which ends in something.srt. Along with it, there is usually also a .info file with the same name which sometime may have the frame rate of the subtitle. + +If not, then it usually is a good idea to go some site and download the subtitle from a site which has that frame rate information. For this specific German file, I will be using [Opensubtitle.org][11] + +As you can see in the link, the frame rate of the subtitle is 23.976 FPS. Quite obviously, it won’t play well with my video file with frame rate 25.000 FPS. + +In such cases, you can change the frame rate of the subtitle file using the Subtitle Editor tool: + +Select all the contents from the subtitle file by doing CTRL+A. Go to Timings -> Change Framerate and change frame rates from 23.976 fps to 25.000 fps or whatever it is that is desired. Save the changed file. + +![synchronize frame rates of subtitles in Linux][12] + +#### Changing the Starting position of a subtitle file + +Sometimes the above method may be enough, sometimes though it will not be enough. + +You might find some cases when the start of the subtitle file is different from that in the movie or a media file while the frame rate is the same. + +In such cases, do the following: + +Select all the contents from the subtitle file by doing CTRL+A. Go to Timings -> Select Move Subtitle. + +![Move subtitles using Subtitle Editor on Linux][13] + +Change the new Starting position of the subtitle file. Save the changed file. + +![Move subtitles using Subtitle Editor in Linux][14] + +If you wanna be more accurate, then use [mpv][15] to see the movie or media file and click on the timing, if you click on the timing bar which shows how much the movie or the media file has elapsed, clicking on it will also reveal the microsecond. + +I usually like to be accurate so I try to be as precise as possible. It is very difficult in MPV as human reaction time is imprecise. If I wanna be super accurate then I use something like [Audacity][16] but then that is another ball-game altogether as you can do so much more with it. That may be something to explore in a future blog post as well. + +#### Manipulating Duration + +Sometimes even doing both is not enough and you even have to shrink or add the duration to make it sync with the media file. This is one of the more tedious works as you have to individually fix the duration of each sentence. This can happen especially if you have variable frame rates in the media file (nowadays rare but you still get such files). + +In such a scenario, you may have to edit the duration manually and automation is not possible. The best way is either to fix the video file (not possible without degrading the video quality) or getting video from another source at a higher quality and then [transcode][17] it with the settings you prefer. This again, while a major undertaking I could shed some light on in some future blog post. + +### Conclusion + +What I have shared in above is more or less on improving on existing subtitle files. If you were to start a scratch you need loads of time. I haven’t shared that at all because a movie or any video material of say an hour can easily take anywhere from 4-6 hours or even more depending upon skills of the subtitler, patience, context, jargon, accents, native English speaker, translator etc. all of which makes a difference to the quality of the subtitle. + +I hope you find this interesting and from now onward, you’ll handle your subtitles slightly better. If you have any suggestions to add, please leave a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/editing-subtitles + +作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?resize=800%2C450&ssl=1 +[2]: https://www.ccextractor.org/ +[3]: https://itsfoss.com/best-open-source-internships/ +[4]: https://www.ccextractor.org/public:codein:google_code-in_2018 +[5]: https://github.com/CCExtractor/ccextractor/wiki/Installation +[6]: https://en.wikipedia.org/wiki/Matroska +[7]: https://www.vicaps.com/blog/history-of-silent-movies-and-subtitles/ +[8]: https://en.wikipedia.org/wiki/SubRip#SubRip_text_file_format +[9]: https://www.imdb.com/title/tt0010323/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/subtitleeditor.jpg?ssl=1 +[11]: https://www.opensubtitles.org/en/search/sublanguageid-eng/idmovie-4105 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/subtitleeditor-frame-rate-sync.jpg?resize=800%2C450&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Move-subtitles-Caligiri.jpg?resize=800%2C450&ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/move-subtitles.jpg?ssl=1 +[15]: https://itsfoss.com/mpv-video-player/ +[16]: https://www.audacityteam.org/ +[17]: https://en.wikipedia.org/wiki/Transcoding +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?fit=800%2C450&ssl=1 From 7bcdb65e17ef5b4a84501462ee533619625bd1de Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 14:50:56 +0800 Subject: [PATCH 0578/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Top=205=20Linux?= =?UTF-8?q?=20Distributions=20for=20Productivity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... 5 Linux Distributions for Productivity.md | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 sources/tech/20190111 Top 5 Linux Distributions for Productivity.md diff --git a/sources/tech/20190111 Top 5 Linux Distributions for Productivity.md b/sources/tech/20190111 Top 5 Linux Distributions for Productivity.md new file mode 100644 index 0000000000..fbd8b9d120 --- /dev/null +++ b/sources/tech/20190111 Top 5 Linux Distributions for Productivity.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Distributions for Productivity) +[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-distributions-productivity) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +Top 5 Linux Distributions for Productivity +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/productivity_main.jpg?itok=2IKyg_7_) + +I have to confess, this particular topic is a tough one to address. Why? First off, Linux is a productive operating system by design. Thanks to an incredibly reliable and stable platform, getting work done is easy. Second, to gauge effectiveness, you have to consider what type of work you need a productivity boost for. General office work? Development? School? Data mining? Human resources? You see how this question can get somewhat complicated. + +That doesn’t mean, however, that some distributions aren’t able to do a better job of configuring and presenting that underlying operating system into an efficient platform for getting work done. Quite the contrary. Some distributions do a much better job of “getting out of the way,” so you don’t find yourself in a work-related hole, having to dig yourself out and catch up before the end of day. These distributions help strip away the complexity that can be found in Linux, thereby making your workflow painless. + +Let’s take a look at the distros I consider to be your best bet for productivity. To help make sense of this, I’ve divided them into categories of productivity. That task itself was challenging, because everyone’s productivity varies. For the purposes of this list, however, I’ll look at: + + * General Productivity: For those who just need to work efficiently on multiple tasks. + + * Graphic Design: For those that work with the creation and manipulation of graphic images. + + * Development: For those who use their Linux desktops for programming. + + * Administration: For those who need a distribution to facilitate their system administration tasks. + + * Education: For those who need a desktop distribution to make them more productive in an educational environment. + + + + +Yes, there are more categories to be had, many of which can get very niche-y, but these five should fill most of your needs. + +### General Productivity + +For general productivity, you won’t get much more efficient than [Ubuntu][1]. The primary reason for choosing Ubuntu for this category is the seamless integration of apps, services, and desktop. You might be wondering why I didn’t choose Linux Mint for this category? Because Ubuntu now defaults to the GNOME desktop, it gains the added advantage of GNOME Extensions (Figure 1). + +![GNOME Clipboard][3] + +Figure 1: The GNOME Clipboard Indicator extension in action. + +[Used with permission][4] + +These extensions go a very long way to aid in boosting productivity (so Ubuntu gets the nod over Mint). But Ubuntu didn’t just accept a vanilla GNOME desktop. Instead, they tweaked it to make it slightly more efficient and user-friendly, out of the box. And because Ubuntu contains just the right mixture of default, out-of-the-box, apps (that just work), it makes for a nearly perfect platform for productivity. + +Whether you need to write a paper, work on a spreadsheet, code a new app, work on your company website, create marketing images, administer a server or network, or manage human resources from within your company HR tool, Ubuntu has you covered. The Ubuntu desktop distribution also doesn’t require the user to jump through many hoops to get things working … it simply works (and quite well). Finally, thanks to it’s Debian base, Ubuntu makes installing third-party apps incredibly easy. + +Although Ubuntu tends to be the go-to for nearly every list of “top distributions for X,” it’s very hard to argue against this particular distribution topping the list of general productivity distributions. + +### Graphic Design + +If you’re looking to up your graphic design productivity, you can’t go wrong with [Fedora Design Suite][5]. This Fedora respin was created by the team responsible for all Fedora-related art work. Although the default selection of apps isn’t a massive collection of tools, those it does include are geared specifically for the creation and manipulation of images. + +With apps like GIMP, Inkscape, Darktable, Krita, Entangle, Blender, Pitivi, Scribus, and more (Figure 2), you’ll find everything you need to get your image editing jobs done and done well. But Fedora Design Suite doesn’t end there. This desktop platform also includes a bevy of tutorials that cover countless subjects for many of the installed applications. For anyone trying to be as productive as possible, this is some seriously handy information to have at the ready. I will say, however, the tutorial entry in the GNOME Favorites is nothing more than a link to [this page][6]. + +![Fedora Design Suite Favorites][8] + +Figure 2: The Fedora Design Suite Favorites menu includes plenty of tools for getting your graphic design on. + +[Used with permission][4] + +Those that work with a digital camera will certainly appreciate the inclusion of the Entangle app, which allows you to control your DSLR from the desktop. + +### Development + +Nearly all Linux distributions are great platforms for programmers. However, one particular distributions stands out, above the rest, as one of the most productive tools you’ll find for the task. That OS comes from [System76][9] and it’s called [Pop!_OS][10]. Pop!_OS is tailored specifically for creators, but not of the artistic type. Instead, Pop!_OS is geared toward creators who specialize in developing, programming, and making. If you need an environment that is not only perfected suited for your development work, but includes a desktop that’s sure to get out of your way, you won’t find a better option than Pop!_OS (Figure 3). + +What might surprise you (given how “young” this operating system is), is that Pop!_OS is also one of the single most stable GNOME-based platforms you’ll ever use. This means Pop!_OS isn’t just for creators and makers, but anyone looking for a solid operating system. One thing that many users will greatly appreciate with Pop!_OS, is that you can download an ISO specifically for your video hardware. If you have Intel hardware, [download][10] the version for Intel/AMD. If your graphics card is NVIDIA, download that specific release. Either way, you are sure go get a solid platform for which to create your masterpiece. + +![Pop!_OS][12] + +Figure 3: The Pop!_OS take on GNOME Overview. + +[Used with permission][4] + +Interestingly enough, with Pop!_OS, you won’t find much in the way of pre-installed development tools. You won’t find an included IDE, or many other dev tools. You can, however, find all the development tools you need in the Pop Shop. + +### Administration + +If you’re looking to find one of the most productive distributions for admin tasks, look no further than [Debian][13]. Why? Because Debian is not only incredibly reliable, it’s one of those distributions that gets out of your way better than most others. Debian is the perfect combination of ease of use and unlimited possibility. On top of which, because this is the distribution for which so many others are based, you can bet if there’s an admin tool you need for a task, it’s available for Debian. Of course, we’re talking about general admin tasks, which means most of the time you’ll be using a terminal window to SSH into your servers (Figure 4) or a browser to work with web-based GUI tools on your network. Why bother making use of a desktop that’s going to add layers of complexity (such as SELinux in Fedora, or YaST in openSUSE)? Instead, chose simplicity. + +![Debian][15] + +Figure 4: SSH’ing into a remote server on Debian. + +[Used with permission][4] + +And because you can select which desktop you want (from GNOME, Xfce, KDE, Cinnamon, MATE, LXDE), you can be sure to have the interface that best matches your work habits. + +### Education + +If you are a teacher or student, or otherwise involved in education, you need the right tools to be productive. Once upon a time, there existed the likes of Edubuntu. That distribution never failed to be listed in the top of education-related lists. However, that distro hasn’t been updated since it was based on Ubuntu 14.04. Fortunately, there’s a new education-based distribution ready to take that title, based on openSUSE. This spin is called [openSUSE:Education-Li-f-e][16] (Linux For Education - Figure 5), and is based on openSUSE Leap 42.1 (so it is slightly out of date). + +openSUSE:Education-Li-f-e includes tools like: + + * Brain Workshop - A dual n-back brain exercise + + * GCompris - An educational software suite for young children + + * gElemental - A periodic table viewer + + * iGNUit - A general purpose flash card program + + * Little Wizard - Development environment for children based on Pascal + + * Stellarium - An astronomical sky simulator + + * TuxMath - An math tutor game + + * TuxPaint - A drawing program for young children + + * TuxType - An educational typing tutor for children + + * wxMaxima - A cross platform GUI for the computer algebra system + + * Inkscape - Vector graphics program + + * GIMP - Graphic image manipulation program + + * Pencil - GUI prototyping tool + + * Hugin - Panorama photo stitching and HDR merging program + + +![Education][18] + +Figure 5: The openSUSE:Education-Li-f-e distro has plenty of tools to help you be productive in or for school. + +[Used with permission][4] + +Also included with openSUSE:Education-Li-f-e is the [KIWI-LTSP Server][19]. The KIWI-LTSP Server is a flexible, cost effective solution aimed at empowering schools, businesses, and organizations all over the world to easily install and deploy desktop workstations. Although this might not directly aid the student to be more productive, it certainly enables educational institutions be more productive in deploying desktops for students to use. For more information on setting up KIWI-LTSP, check out the openSUSE [KIWI-LTSP quick start guide][20]. + +Learn more about Linux through the free ["Introduction to Linux" ][21]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/top-5-linux-distributions-productivity + +作者:[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.ubuntu.com/ +[2]: /files/images/productivity1jpg +[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/productivity_1.jpg?itok=yxez3X1w (GNOME Clipboard) +[4]: /licenses/category/used-permission +[5]: https://labs.fedoraproject.org/en/design-suite/ +[6]: https://fedoraproject.org/wiki/Design_Suite/Tutorials +[7]: /files/images/productivity2jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/productivity_2.jpg?itok=ke0b8qyH (Fedora Design Suite Favorites) +[9]: https://system76.com/ +[10]: https://system76.com/pop +[11]: /files/images/productivity3jpg-0 +[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/productivity_3_0.jpg?itok=8UkCUfsD (Pop!_OS) +[13]: https://www.debian.org/ +[14]: /files/images/productivity4jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/productivity_4.jpg?itok=c9yD3Xw2 (Debian) +[16]: https://en.opensuse.org/openSUSE:Education-Li-f-e +[17]: /files/images/productivity5jpg +[18]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/productivity_5.jpg?itok=oAFtV8nT (Education) +[19]: https://en.opensuse.org/Portal:KIWI-LTSP +[20]: https://en.opensuse.org/SDB:KIWI-LTSP_quick_start +[21]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 1eb2ed51231bce43b96dd1e02534da77905f5206 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 14:55:44 +0800 Subject: [PATCH 0579/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Understanding?= =?UTF-8?q?=20/etc/services=20file=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...derstanding -etc-services file in Linux.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20190109 Understanding -etc-services file in Linux.md diff --git a/sources/tech/20190109 Understanding -etc-services file in Linux.md b/sources/tech/20190109 Understanding -etc-services file in Linux.md new file mode 100644 index 0000000000..1b1028ca6d --- /dev/null +++ b/sources/tech/20190109 Understanding -etc-services file in Linux.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding /etc/services file in Linux) +[#]: via: (https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/) +[#]: author: (kerneltalks https://kerneltalks.com) + +Understanding /etc/services file in Linux +====== + +Article which helps you to understand /etc/services file in Linux. Learn about content, format & importance of this file. + +![/etc/services file in Linux][1] +/etc/services file in Linux + +Internet daemon is important service in Linux world. It takes care of all network services with the help of `/etc/services` file. In this article we will walk you through content, format of this file and what it means to a Linux system. + +`/etc/services` file contains list of network services and ports mapped to them. `inetd` or `xinetd` looks at these details so that it can call particular program when packet hits respective port and demand for service. + +As a normal user you can view this file since file is world readable. To edit this file you need to have root privileges. + +``` +$ ll /etc/services +-rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services +``` + +### `/etc/services` file format + +``` +service-name port/protocol [aliases..] [#comment] +``` + +Last two fields are optional hence denoted in `[` `]` + +where – + + * service-name is name of the network service. e.g. [telnet][2], [ftp][3] etc. + * port/protocol is port being used by that network service (numerical value) and protocol (TCP/UDP) used for communication by service. + * alias is alternate name for service. + * comment is note or description you can add to service. Starts with `#` mark + + + +### Sample` /etc/services` file + +``` +# Each line describes one service, and is of the form: +# +# service-name port/protocol [aliases ...] [# comment] + +tcpmux 1/tcp # TCP port service multiplexer +rje 5/tcp # Remote Job Entry +echo 7/udp +discard 9/udp sink null +``` + +Here, you can see use of optional last two fields as well. `discard` service has alternate name as `sink` or `null`. + +-------------------------------------------------------------------------------- + +via: https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/ + +作者:[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/01/undestanding-etc-service-file-in-linux.png?ssl=1 +[2]: https://kerneltalks.com/config/configure-telnet-server-linux/ +[3]: https://kerneltalks.com/config/ftp-server-configuration-steps-rhel-6/ From 08a416d51b9dcd71f4e115bb58f0aa1f7207ffc4 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 15:27:45 +0800 Subject: [PATCH 0580/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Automating=20de?= =?UTF-8?q?ployment=20strategies=20with=20Ansible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ting deployment strategies with Ansible.md | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 sources/tech/20190109 Automating deployment strategies with Ansible.md diff --git a/sources/tech/20190109 Automating deployment strategies with Ansible.md b/sources/tech/20190109 Automating deployment strategies with Ansible.md new file mode 100644 index 0000000000..175244e760 --- /dev/null +++ b/sources/tech/20190109 Automating deployment strategies with Ansible.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automating deployment strategies with Ansible) +[#]: via: (https://opensource.com/article/19/1/automating-deployment-strategies-ansible) +[#]: author: (Jario da Silva Junior https://opensource.com/users/jairojunior) + +Automating deployment strategies with Ansible +====== +Use automation to eliminate time sinkholes due to repetitive tasks and unplanned work. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) + +When you examine your technology stack from the bottom layer to the top—hardware, operating system (OS), middleware, and application—with their respective configurations, it's clear that changes are far more frequent as you go up in the stack. Your hardware will hardly change, your OS has a long lifecycle, and your middleware will keep up with the application's needs, but even if your release cycle is long (weeks or months), your applications will be the most volatile. + +![](https://opensource.com/sites/default/files/uploads/osdc-deployment-strategies.png) + +In [The Practice of System and Network Administration][1], the authors categorize the biggest "time sinkholes" in IT as manual/non-standard provisioning of OSes and application deployments. These time sinkholes will consume you with repetitive tasks or unplanned work. + +How so? Let's say you provision a new server without Network Time Protocol (NTP) properly configured, and a small percentage of your requests—in a cluster of dozens of servers—start to behave strangely because an application uses some sort of scheduler that relies on correct time. When you look at it like this, it is an easy problem to fix, but how long it would it take your team figure it out? Incidents or unplanned work consume a lot of your time and, even worse, your greatest talents. Should you really be wasting time investigating production systems like this? Wouldn't it be better to set this server aside and automatically provision a new one from scratch? + +What about manual deployment? Imagine 20 binaries deployed across a farm or nodes with their respective configuration files? How error-prone is this? Inevitably, it will eventually end up in unplanned work. + +The [State of DevOps Report 2018][2] introduces the stages of DevOps adoption, and it's no surprise that Stage 0 includes deployment automation and reuse of deployment patterns, while Stage 1 and 2 focus on standardization of your infrastructure stack to reduce inconsistencies across your environment. + +Note that, more than once, I have seen an ops team using this "standardization" as an excuse to limit a development team's ability to deliver, forcing them to use a hammer on something that is definitely not a nail. Don't do it; the price is extremely high. + +The lesson to be learned here is that lack of automation not only increases your lead time but also the rate of problems in your process and the amount of unplanned work you face. If you've read [The Phoenix Project][3], you know this is the root of all evil in any value stream, and if you don't get rid of it, it will eventually kill your business. + +When trying to fill the biggest time sinkholes, why not start with automating operating system installation? We could, but the results would take longer to appear since new virtual machines are not created as frequently as applications are deployed. In other words, this may not free up the time we need to power our initiative, so it could die prematurely. + +Still not convinced? Smaller and more frequent releases are also extremely positive from the development side. Let's explain a little further… + +### Deploy ≠ Release + +The first thing to understand is that, although they're used interchangeably, deployment and release do **NOT** mean the same thing. Release refers to providing the user a new version, while deployment is the technical process of deploying the new version. Let's focus on the technical process of deployment. + +### Tasks, groups, and Ansible + +We need to understand the deployment process from the beginning to the end, including everything in the middle—the tasks, which servers are involved in the process, and which steps are executed—to avoid falling into the pitfalls described by Mattias Geniar in [Automating the unknown][4]. + +#### Tasks + +The steps commonly executed in a regular deployment process include: + + * Deploy application(s)/database(s) or database(s) change(s) + * Stop/start services and monitoring + * Add/remove the server from our load balancers + * Verify application state—is it ready to serve requests? + * Manual approval—is it necessary? + + + +For some people, automating the deployment process but leaving a manual approval step is like riding a bike with training wheels. As someone once told me: "It's better to ride with training wheels than not ride at all." + +What if a tool doesn't include an API or a command-line interface (CLI) to enable task automation? Well, maybe it's time to think about changing tools. There are many open source application servers, databases, monitoring systems, and load balancers that are easily automated—thanks in large part to the [Unix way][5]. When adopting a new technology, eliminate options that are not automated and use your creativity to support your legacy technologies. For example, I've seen people versioning network appliance configuration files and updating them using FTP. + +And guess what? It's a wonderful time to adopt open source tools. The recent [Accelerate: State of DevOps][6] report found that open source technologies are in predominant use in high-performance organizations. The logic is pretty simple: open source projects function in a "Darwinist" model, where those that do not adapt and evolve will die for lack of a user base or contributions. Feedback is paramount to software evolution. + +#### Groups + +To identify groups of servers to target for automation, think about the most tasks you want to automate, such as those that: + + * Deploy application(s)/database(s) or database change(s) + * Stop/start services and monitoring + * Add/remove server(s) from load balancer(s) + * Verify application state—is it ready to serve requests? + + + +#### The playbook + +A high-level deployment process could be: + + 1. Stop monitoring (to avoid false-positives) + 2. Remove server from the load balancer (to prevent the user from receiving an error code) + 3. Stop the service (to enable a graceful shutdown) + 4. Deploy the new version of the application + 5. Wait for the application to be ready to receive new requests + 6. Execute steps 3, 2, and 1. + 7. Do the same for the next N servers. + + + +Having documentation of your process is nice, but having an executable documenting your deployment is better! Here's what steps 1–5 would look like in Ansible for a fully open source stack: + +``` +- name: Disable alerts +  nagios: +    action: disable_alerts +    host: "{{ inventory_hostname }}" +    services: webserver +  delegate_to: "{{ item }}" +  loop: "{{ groups.monitoring }}" + +- name: Disable servers in the LB +  haproxy: +    host: "{{ inventory_hostname }}" +    state: disabled +    backend: app +  delegate_to: "{{ item }}" +  loop: " {{ groups.lbserver }}" + +- name: Stop the service +  service: name=httpd state=stopped + +- name: Deploy a new version +  unarchive: src=app.tar.gz dest=/var/www/app + +- name: Verify application state +  uri: +    url: "http://{{ inventory_hostname }}/app/healthz" +    status_code: 200 +  retries: 5 +``` + +### Why Ansible? + +There are other alternatives for application deployment, but the things that make Ansible an excellent choice include: + + * Multi-tier orchestration (i.e., **delegate_to** ) allowing you to orderly target different groups of servers: monitoring, load balancer, application server, database, etc. + * Rolling upgrade (i.e., serial) to control how changes are made (e.g., 1 by 1, N by N, X% at a time, etc.) + * Error control, **max_fail_percentage** and **any_errors_fatal** , is my process all-in or will it tolerate fails? + * A vast library of modules for: + * Monitoring (e.g., Nagios, Zabbix, etc.) + * Load balancers (e.g., HAProxy, F5, Netscaler, Cisco, etc.) + * Services (e.g., service, command, file) + * Deployment (e.g., copy, unarchive) + * Programmatic verifications (e.g., command, Uniform Resource Identifier) + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/automating-deployment-strategies-ansible + +作者:[Jario 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://www.amazon.com/Practice-System-Network-Administration-Enterprise/dp/0321919165/ref=dp_ob_title_bk +[2]: https://puppet.com/resources/whitepaper/state-of-devops-report +[3]: https://www.amazon.com/Phoenix-Project-DevOps-Helping-Business/dp/0988262592 +[4]: https://ma.ttias.be/automating-unknown/ +[5]: https://en.wikipedia.org/wiki/Unix_philosophy +[6]: https://cloudplatformonline.com/2018-state-of-devops.html From f5a4e776820d58cb19e2fbbcc9c105cd795efc40 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 15:31:38 +0800 Subject: [PATCH 0581/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Create=20your?= =?UTF-8?q?=20own=20video=20streaming=20server=20with=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...r own video streaming server with Linux.md | 301 ++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 sources/tech/20190108 Create your own video streaming server with Linux.md diff --git a/sources/tech/20190108 Create your own video streaming server with Linux.md b/sources/tech/20190108 Create your own video streaming server with Linux.md new file mode 100644 index 0000000000..24dd44524d --- /dev/null +++ b/sources/tech/20190108 Create your own video streaming server with Linux.md @@ -0,0 +1,301 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create your own video streaming server with Linux) +[#]: via: (https://opensource.com/article/19/1/basic-live-video-streaming-server) +[#]: author: (Aaron J.Prisk https://opensource.com/users/ricepriskytreat) + +Create your own video streaming server with Linux +====== +Set up a basic live streaming server on a Linux or BSD operating system. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/shortcut_command_function_editing_key.png?itok=a0sEc5vo) + +Live video streaming is incredibly popular—and it's still growing. Platforms like Amazon's Twitch and Google's YouTube boast millions of users that stream and consume countless hours of live and recorded media. These services are often free to use but require you to have an account and generally hold your content behind advertisements. Some people don't need their videos to be available to the masses or just want more control over their content. Thankfully, with the power of open source software, anyone can set up a live streaming server. + +### Getting started + +In this tutorial, I'll explain how to set up a basic live streaming server with a Linux or BSD operating system. + +This leads to the inevitable question of system requirements. These can vary, as there are a lot of variables involved with live streaming, such as: + + * **Stream quality:** Do you want to stream in high definition or will standard definition fit your needs? + * **Viewership:** How many viewers are you expecting for your videos? + * **Storage:** Do you plan on keeping saved copies of your video stream? + * **Access:** Will your stream be private or open to the world? + + + +There are no set rules when it comes to system requirements, so I recommend you experiment and find what works best for your needs. I installed my server on a virtual machine with 4GB RAM, a 20GB hard drive, and a single Intel i7 processor core. + +This project uses the Real-Time Messaging Protocol (RTMP) to handle audio and video streaming. There are other protocols available, but I chose RTMP because it has broad support. As open standards like WebRTC become more compatible, I would recommend that route. + +It's also very important to know that "live" doesn't always mean instant. A video stream must be encoded, transferred, buffered, and displayed, which often adds delays. The delay can be shortened or lengthened depending on the type of stream you're creating and its attributes. + +### Setting up a Linux server + +You can use many different distributions of Linux, but I prefer Ubuntu, so I downloaded the [Ubuntu Server][1] edition for my operating system. If you prefer your server to have a graphical user interface (GUI), feel free to use [Ubuntu Desktop][2] or one of its many flavors. Then, I fired up the Ubuntu installer on my computer or virtual machine and chose the settings that best matched my environment. Below are the steps I took. + +Note: Because this is a server, you'll probably want to set some static network settings. + +![](https://opensource.com/sites/default/files/uploads/stream-server_profilesetup.png) + +After the installer finishes and your system reboots, you'll be greeted with a lovely new Ubuntu system. As with any newly installed operating system, install any updates that are available: + +``` +sudo apt update +sudo apt upgrade +``` + +This streaming server will use the very powerful and versatile Nginx web server, so you'll need to install it: + +``` +sudo apt install nginx +``` + +Then you'll need to get the RTMP module so Nginx can handle your media stream: + +``` +sudo add-apt-repository universe +sudo apt install libnginx-mod-rtmp +``` + +Adjust your web server's configuration so it can accept and deliver your media stream. + +``` +sudo nano /etc/nginx/nginx.conf +``` + +Scroll to the bottom of the configuration file and add the following code: + +``` +rtmp { +        server { +                listen 1935; +                chunk_size 4096; + +                application live { +                        live on; +                        record off; +                } +        } +} +``` + +![](https://opensource.com/sites/default/files/uploads/stream-server_config.png) + +Save the config. Because I'm a heretic, I use [Nano][3] for editing configuration files. In Nano, you can save your config by pressing **Ctrl+X** , **Y** , and then **Enter.** + +This is a very minimal config that will create a working streaming server. You'll add to this config later, but this is a great starting point. + +However, before you can begin your first stream, you'll need to restart Nginx with its new configuration: + +``` +sudo systemctl restart nginx +``` + +### Setting up a BSD server + +If you're of the "beastie" persuasion, getting a streaming server up and running is also devilishly easy. + +Head on over to the [FreeBSD][4] website and download the latest release. Fire up the FreeBSD installer on your computer or virtual machine and go through the initial steps and choose settings that best match your environment. Since this is a server, you'll likely want to set some static network settings. + +After the installer finishes and your system reboots, you should have a shiny new FreeBSD system. Like any other freshly installed system, you'll likely want to get everything updated (from this step forward, make sure you're logged in as root): + +``` +pkg update +pkg upgrade +``` + +I install [Nano][3] for editing configuration files: + +``` +pkg install nano +``` + +This streaming server will use the very powerful and versatile Nginx web server. You can build Nginx using the excellent ports system that FreeBSD boasts. + +First, update your ports tree: + +``` +portsnap fetch +portsnap extract +``` + +Browse to the Nginx ports directory: + +``` +cd /usr/ports/www/nginx +``` + +And begin building Nginx by running: + +``` +make install +``` + +You'll see a screen asking what modules to include in your Nginx build. For this project, you'll need to add the RTMP module. Scroll down until the RTMP module is selected and press **Space**. Then Press **Enter** to proceed with the rest of the build and installation. + +Once Nginx has finished installing, it's time to configure it for streaming purposes. + +First, add an entry into **/etc/rc.conf** to ensure the Nginx server starts when your system boots: + +``` +nano /etc/rc.conf +``` + +Add this text to the file: + +``` +nginx_enable="YES" +``` + +![](https://opensource.com/sites/default/files/uploads/stream-server_streamingconfig.png) + +Next, create a webroot directory from where Nginx will serve its content. I call mine **stream** : + +``` +cd /usr/local/www/ +mkdir stream +chmod -R 755 stream/ +``` + +Now that you have created your stream directory, configure Nginx by editing its configuration file: + +``` +nano /usr/local/etc/nginx/nginx.conf +``` + +Load your streaming modules at the top of the file: + +``` +load_module /usr/local/libexec/nginx/ngx_stream_module.so; +load_module /usr/local/libexec/nginx/ngx_rtmp_module.so; +``` + +![](https://opensource.com/sites/default/files/uploads/stream-server_modules.png) + +Under the **Server** section, change the webroot location to match the one you created earlier: + +``` +Location / { +root /usr/local/www/stream +} +``` + +![](https://opensource.com/sites/default/files/uploads/stream-server_webroot.png) + +And finally, add your RTMP settings so Nginx will know how to handle your media streams: + +``` +rtmp { +        server { +                listen 1935; +                chunk_size 4096; + +                application live { +                        live on; +                        record off; +                } +        } +} +``` + +Save the config. In Nano, you can do this by pressing **Ctrl+X** , **Y** , and then **Enter.** + +As you can see, this is a very minimal config that will create a working streaming server. Later, you'll add to this config, but this will provide you with a great starting point. + +However, before you can begin your first stream, you'll need to restart Nginx with its new config: + +``` +service nginx restart +``` + +### Set up your streaming software + +#### Broadcasting with OBS + +Now that your server is ready to accept your video streams, it's time to set up your streaming software. This tutorial uses the powerful and open source Open Broadcast Studio (OBS). + +Head over to the [OBS website][5] and find the build for your operating system and install it. Once OBS launches, you should see a first-time-run wizard that will help you configure OBS with the settings that best fit your hardware. + +![](https://opensource.com/sites/default/files/uploads/stream-server_autoconfig.png) + +OBS isn't capturing anything because you haven't supplied it with a source. For this tutorial, you'll just capture your desktop for the stream. Simply click the **+** button under **Source** , choose **Screen Capture** , and select which desktop you want to capture. + +Click OK, and you should see OBS mirroring your desktop. + +Now it's time to send your newly configured video stream to your server. In OBS, click **File** > **Settings**. Click on the **Stream** section, and set **Stream Type** to **Custom Streaming Server**. + +In the URL box, enter the prefix **rtmp://** followed the IP address of your streaming server followed by **/live**. For example, **rtmp://IP-ADDRESS/live**. + +Next, you'll probably want to enter a Stream key—a special identifier required to view your stream. Enter whatever key you want (and can remember) in the **Stream key** box. + +![](https://opensource.com/sites/default/files/uploads/stream-server_streamkey.png) + +Click **Apply** and then **OK**. + +Now that OBS is configured to send your stream to your server, you can start your first stream. Click **Start Streaming**. + +If everything worked, you should see the button change to **Stop Streaming** and some bandwidth metrics will appear at the bottom of OBS. + +![](https://opensource.com/sites/default/files/uploads/stream-server_metrics.png) + +If you receive an error, double-check Stream Settings in OBS for misspellings. If everything looks good, there could be another issue preventing it from working. + +### Viewing your stream + +A live video isn't much good if no one is watching it, so be your first viewer! + +There are a multitude of open source media players that support RTMP, but the most well-known is probably [VLC media player][6]. + +After you install and launch VLC, open your stream by clicking on **Media** > **Open Network Stream**. Enter the path to your stream, adding the Stream Key you set up in OBS, then click **Play**. For example, **rtmp://IP-ADDRESS/live/SECRET-KEY**. + +You should now be viewing your very own live video stream! + +![](https://opensource.com/sites/default/files/uploads/stream-server_livevideo.png) + +### Where to go next? + +This is a very simple setup that will get you off the ground. Here are two other features you likely will want to use. + + * **Limit access:** The next step you might want to take is to limit access to your server, as the default setup allows anyone to stream to and from the server. There are a variety of ways to set this up, such as an operating system firewall, [.htaccess file][7], or even using the [built-in access controls in the STMP module][8]. + + * **Record streams:** This simple Nginx configuration will only stream and won't save your videos, but this is easy to add. In the Nginx config, under the RTMP section, set up the recording options and the location where you want to save your videos. Make sure the path you set exists and Nginx is able to write to it. + + + + +``` +application live { +             live on; +             record all; +             record_path /var/www/html/recordings; +             record_unique on; +} +``` + +The world of live streaming is constantly evolving, and if you're interested in more advanced uses, there are lots of other great resources you can find floating around the internet. Good luck and happy streaming! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/basic-live-video-streaming-server + +作者:[Aaron J.Prisk][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ricepriskytreat +[b]: https://github.com/lujun9972 +[1]: https://www.ubuntu.com/download/server +[2]: https://www.ubuntu.com/download/desktop +[3]: https://www.nano-editor.org/ +[4]: https://www.freebsd.org/ +[5]: https://obsproject.com/ +[6]: https://www.videolan.org/vlc/index.html +[7]: https://httpd.apache.org/docs/current/howto/htaccess.html +[8]: https://github.com/arut/nginx-rtmp-module/wiki/Directives#access From 1095d67586b37a81715ae970df6fed2932cff21c Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 15:33:59 +0800 Subject: [PATCH 0582/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Toyota=20Motors?= =?UTF-8?q?=20and=20its=20Linux=20Journey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...110 Toyota Motors and its Linux Journey.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/talk/20190110 Toyota Motors and its Linux Journey.md diff --git a/sources/talk/20190110 Toyota Motors and its Linux Journey.md b/sources/talk/20190110 Toyota Motors and its Linux Journey.md new file mode 100644 index 0000000000..1d76ffe0b6 --- /dev/null +++ b/sources/talk/20190110 Toyota Motors and its Linux Journey.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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/) + +Toyota Motors and its Linux Journey +====== + +**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. + +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. + +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”. + +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. + +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. + +I was curious when Toyota decided to use the [Automotive Grade Linux][2] (AGL). According to Mr. Lyons, it goes back to 2011. + +> “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” + +![Toyota Infotainment][3] + +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. + +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. + +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. + +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. + +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. + +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. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/toyota-motors-linux-journey + +作者:[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.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/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/toyota-interiors.jpg?resize=800%2C450&ssl=1 +[4]: https://www.linuxfoundation.org/press-release/2011/07/toyota-joins-linux-foundation/ From 07f29374b0e0292bf4b8ae8b8cb9255778ee9ead Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 15:39:21 +0800 Subject: [PATCH 0583/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Hacking=20math?= =?UTF-8?q?=20education=20with=20Python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0108 Hacking math education with Python.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/talk/20190108 Hacking math education with Python.md diff --git a/sources/talk/20190108 Hacking math education with Python.md b/sources/talk/20190108 Hacking math education with Python.md new file mode 100644 index 0000000000..111b306c7a --- /dev/null +++ b/sources/talk/20190108 Hacking math education with Python.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Hacking math education with Python) +[#]: via: (https://opensource.com/article/19/1/hacking-math) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Hacking math education with Python +====== +Teacher, programmer, and author Peter Farrell explains why teaching math with Python works better than the traditional approach. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl) + +Mathematics instruction has a bad reputation, especially with people (like me) who've had trouble with the traditional approach, which emphasizes rote memorization and theory that seems far removed from students' real world. + +While teaching a student who was baffled by his math lessons, [Peter Farrell][1], a Python developer and mathematics teacher, decided to try using Python to teach the boy the math concepts he was having trouble learning. + +Peter was inspired by the work of [Seymour Papert][2], the father of the Logo programming language, which lives on in Python's [Turtle module][3]. The Turtle metaphor hooked Peter on Python and using it to teach math, much like [I was drawn to Python][4]. + +Peter shares his approach in his new book, [Math Adventures with Python][5]: An Illustrated Guide to Exploring Math with Code. And, I recently interviewed him to learn more about it. + +**Don Watkins:** What is your background? + +**Peter Farrell:** I was a math teacher for eight years, and I tutored math for 10 years after that. When I was a teacher, I read Papert's [Mindstorms][6] and was inspired to introduce all my math classes to Logo and Turtles. + +**DW:** Why did you start using Python? + +**PF:** I was working with a homeschooled boy on a very dry, textbook-driven math curriculum, which at the time seemed like a curse to me. But I found ways to sneak in the Logo Turtles, and he was a programming fan, so he liked that. Once we got into functions and real programming, he asked if we could continue in Python. I didn't know any Python but it didn't seem that different from Logo, so I agreed. And I never looked back! + +I was also looking for a 3D graphics package I could use to model a solar system and lead students through making planets move and get pulled by the force of attraction between the bodies, according to Newton's formula. Many graphics packages required programming in C or something hard, but I found an excellent package called Visual Python that was very easy to use. I used [VPython][7] for years after that. + +So, I was introduced to Python in the context of working with a student on math. For some time after that, he was my programming tutor while I was his math tutor! + +**DW:** What got you interested in math? + +**PF:** I learned it the old-fashioned way: by hand, on paper and blackboards. I was good at manipulating symbols, so algebra was never a problem, and I liked drawing and graphing, so geometry and trig could be fun, too. I did some programming in BASIC and Fortran in college, but it never inspired me. Later on, programming inspired me greatly! I'm still tickled by the way programming makes easy work of the laborious stuff you have to do in math class, freeing you up to do the more fun of exploring, graphing, tweaking, and discovering. + +**DW:** What inspired you to consider your Python approach to math? + +**PF:** When I was teaching the homeschooled student, I was amazed at what we could do by writing a simple function and then calling it a bunch of times with different values using a loop. That would take a half an hour by hand, but the computer spit it out instantly! Then we could look for patterns (which is what a math student should be doing), express the pattern as a function, and extend it further. + +**DW:** How does your approach to teaching help students—especially those who struggle with math? How does it make math more relevant? + +**PF:** Students, especially high-schoolers, question the need to be doing all this calculating, graphing, and solving by hand in the 21st century, and I don't disagree with them. Learning to use Excel, for example, to crunch numbers should be seen as a basic necessity to work in an office. Learning to code, in any language, is becoming a very valuable skill to companies. So, there's a real-world appeal to me. + +But the idea of making art with code can revolutionize math class. Just putting a shape on a screen requires math—the position (x-y coordinates), the dimensions, and even the color are all numbers. If you want something to move or change, you'll need to use variables, and not the "guess what x equals" kind of variable. You'll vary the position using a variable or, more efficiently, using a vector. [This makes] math topics like vectors and matrices seen as helpful tools you can use, rather than required information you'll never use. + +Students who struggle with math might just be turned off to "school math," which is heavy on memorization and following rules and light on creativity and real applications. They might find they're actually good at math, just not the way it was taught in school. I've had parents see the cool graphics their kids have created with code and say, "I never knew that's what sines and cosines were used for!" + +**DW:** How do you see your approach to math and programming encouraging STEM in schools? + +**PF:** I love the idea of combining previously separated topics into an idea like STEM or STEAM! Unfortunately for us math folks, the "M" is very often neglected. I see lots of fun projects being done in STEM labs, even by very young children, and they're obviously getting an education in technology, engineering, and science. But I see precious little math material in the projects. STEM/[mechatronics][8] teacher extraordinaire Ken Hawthorn and I are creating projects to try to remedy that. + +Hopefully, my book helps encourage students, girls and boys, to get creative with technology, real and virtual. There are a lot of beautiful graphics in the book, which I hope will inspire people to go through the coding adventure and make them. All the software I use ([Python Processing][9]) is available for free and can be easily installed, or is already installed, on the Raspberry Pi. Entry into the STEM world should not be cost-prohibitive to schools or individuals. + +**DW:** What would you like to share with other math teachers? + +**PF:** If the math establishment is really serious about teaching students the standards they have agreed upon, like numerical reasoning, logic, analysis, modeling, geometry, interpreting data, and so on, they're going to have to admit that coding can help with every single one of those goals. My approach was born, as I said before, from just trying to enrich a dry, traditional approach, and I think any teacher can do that. They just need somebody who can show them how to do everything they're already doing, just using code to automate the laborious stuff. + +My graphics-heavy approach is made possible by the availability of free graphics software. Folks might need to be shown where to find these packages and how to get started. But a math teacher can soon be leading students through solving problems using 21st-century technology and visualizing progress or results and finding more patterns to pursue. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/hacking-math + +作者:[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://twitter.com/hackingmath +[2]: https://en.wikipedia.org/wiki/Seymour_Papert +[3]: https://en.wikipedia.org/wiki/Turtle_graphics +[4]: https://opensource.com/life/15/8/python-turtle-graphics +[5]: https://nostarch.com/mathadventures +[6]: https://en.wikipedia.org/wiki/Mindstorms_(book) +[7]: http://vpython.org/ +[8]: https://en.wikipedia.org/wiki/Mechatronics +[9]: https://processing.org/ From b544c0cf9b845fb73242f3b1333cceb1c34f2077 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 15:59:22 +0800 Subject: [PATCH 0584/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Bash=205.0=20Re?= =?UTF-8?q?leased=20with=20New=20Features?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...109 Bash 5.0 Released with New Features.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20190109 Bash 5.0 Released with New Features.md diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md new file mode 100644 index 0000000000..46d9aeae59 --- /dev/null +++ b/sources/tech/20190109 Bash 5.0 Released with New Features.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash 5.0 Released with New Features) +[#]: via: (https://itsfoss.com/bash-5-release) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Bash 5.0 Released with New Features +====== + +The [mailing list][1] confirmed the release of Bash-5.0 recently. And, it is exciting to know that it comes baked with new features and variable. + +Well, if you’ve been using Bash 4.4.XX, you will definitely love the fifth major release of [Bash][2]. + +The fifth release focuses on new shell variables and a lot of major bug fixes with an overhaul. It also introduces a couple of new features along with some incompatible changes between bash-4.4 and bash-5.0. + +![Bash logo][3] + +### What about the new features? + +The mailing list explains the bug fixed in this new release: + +> This release fixes several outstanding bugs in bash-4.4 and introduces several new features. The most significant bug fixes are an overhaul of how nameref variables resolve and a number of potential out-of-bounds memory errors discovered via fuzzing. There are a number of changes to the expansion of $@ and $* in various contexts where word splitting is not performed to conform to a Posix standard interpretation, and additional changes to resolve corner cases for Posix conformance. + +It also introduces some new features. As per the release note, these are the most notable new features are several new shell variables: + +> The BASH_ARGV0, EPOCHSECONDS, and EPOCHREALTIME. The ‘history’ builtin can remove ranges of history entries and understands negative arguments as offsets from the end of the history list. There is an option to allow local variables to inherit the value of a variable with the same name at a preceding scope. There is a new shell option that, when enabled, causes the shell to attempt to expand associative array subscripts only once (this is an issue when they are used in arithmetic expressions). The ‘globasciiranges‘ shell option is now enabled by default; it can be set to off by default at configuration time. + +### What about the changes between Bash-4.4 and Bash-5.0? + +The update log mentioned about the incompatible changes and the supported readline version history. Here’s what it said: + +> There are a few incompatible changes between bash-4.4 and bash-5.0. The changes to how nameref variables are resolved means that some uses of namerefs will behave differently, though I have tried to minimize the compatibility issues. By default, the shell only sets BASH_ARGC and BASH_ARGV at startup if extended debugging mode is enabled; it was an oversight that it was set unconditionally and caused performance issues when scripts were passed large numbers of arguments. +> +> Bash can be linked against an already-installed Readline library rather than the private version in lib/readline if desired. Only readline-8.0 and later versions are able to provide all of the symbols that bash-5.0 requires; earlier versions of the Readline library will not work correctly. + +I believe some of the features/variables added are very useful. Some of my favorites are: + + * There is a new (disabled by default, undocumented) shell option to enable and disable sending history to syslog at runtime. + * The shell doesn’t automatically set BASH_ARGC and BASH_ARGV at startup unless it’s in debugging mode, as the documentation has always said, but will dynamically create them if a script references them at the top level without having enabled debugging mode. + * The ‘history’ can now delete ranges of history entries using ‘-d start-end’. + * If a non-interactive shell with job control enabled detects that a foreground job died due to SIGINT, it acts as if it received the SIGINT. + * BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment. + + + +To check the complete list of changes and features you should refer to the [Mailing list post][1]. + +### Wrapping Up + +You can check your current Bash version, using this command: + +``` +bash --version +``` + +It’s more likely that you’ll have Bash 4.4 installed. If you want to get the new version, I would advise waiting for your distribution to provide it. + +With Bash-5.0 available, what do you think about it? Are you using any alternative to bash? If so, would this update change your mind? + +Let us know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bash-5-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://lists.gnu.org/archive/html/bug-bash/2019-01/msg00063.html +[2]: https://www.gnu.org/software/bash/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 From 85802d4d68b5fb0ae436292abdf00765318ba9b5 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:04:54 +0800 Subject: [PATCH 0585/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Unde?= =?UTF-8?q?rstand=20And=20Identify=20File=20types=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rstand And Identify File types in Linux.md | 359 ++++++++++++++++++ 1 file changed, 359 insertions(+) create mode 100644 sources/tech/20190108 How To Understand And Identify File types in Linux.md diff --git a/sources/tech/20190108 How To Understand And Identify File types in Linux.md b/sources/tech/20190108 How To Understand And Identify File types in Linux.md new file mode 100644 index 0000000000..c1c4ca4c0a --- /dev/null +++ b/sources/tech/20190108 How To Understand And Identify File types in Linux.md @@ -0,0 +1,359 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Understand And Identify File types in Linux) +[#]: via: (https://www.2daygeek.com/how-to-understand-and-identify-file-types-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How To Understand And Identify File types in Linux +====== + +We all are knows, that everything is a file in Linux which includes Hard Disk, Graphics Card, etc. + +When you are navigating the Linux filesystem most of the files are fall under regular files and directories. + +But it has other file types as well for different purpose which fall in five categories. + +So, it’s very important to understand the file types in Linux that helps you in many ways. + +If you can’t believe this, you just gone through the complete article then you come to know how important is. + +If you don’t understand the file types you can’t make any changes on that without fear. + +If you made the changes wrongly that damage your system very badly so be careful when you are doing that. + +Files are very important in Linux because all the devices and daemon’s were stored as a file in Linux system. + +### How Many Types of File is Available in Linux? + +As per my knowledge, totally 7 types of files are available in Linux with 3 Major categories. The details are below. + + * Regular File + * Directory File + * Special Files (This category having five type of files) + * Link File + * Character Device File + * Socket File + * Named Pipe File + * Block File + + + +Refer the below table for better understanding of file types in Linux. +| Symbol | Meaning | +| – | Regular File. It starts with underscore “_”. | +| d | Directory File. It starts with English alphabet letter “d”. | +| l | Link File. It starts with English alphabet letter “l”. | +| c | Character Device File. It starts with English alphabet letter “c”. | +| s | Socket File. It starts with English alphabet letter “s”. | +| p | Named Pipe File. It starts with English alphabet letter “p”. | +| b | Block File. It starts with English alphabet letter “b”. | + +### Method-1: Manual Way to Identify File types in Linux + +If you are having good knowledge in Linux then you can easily identify the files type with help of above table. + +#### How to view the Regular files in Linux? + +Use the below command to view the Regular files in Linux. Regular files are available everywhere in Linux filesystem. +The Regular files color is `WHITE` + +``` +# ls -la | grep ^- +-rw-------. 1 mageshm mageshm 1394 Jan 18 15:59 .bash_history +-rw-r--r--. 1 mageshm mageshm 18 May 11 2012 .bash_logout +-rw-r--r--. 1 mageshm mageshm 176 May 11 2012 .bash_profile +-rw-r--r--. 1 mageshm mageshm 124 May 11 2012 .bashrc +-rw-r--r--. 1 root root 26 Dec 27 17:55 liks +-rw-r--r--. 1 root root 104857600 Jan 31 2006 test100.dat +-rw-r--r--. 1 root root 104874307 Dec 30 2012 test100.zip +-rw-r--r--. 1 root root 11536384 Dec 30 2012 test10.zip +-rw-r--r--. 1 root root 61 Dec 27 19:05 test2-bzip2.txt +-rw-r--r--. 1 root root 61 Dec 31 14:24 test3-bzip2.txt +-rw-r--r--. 1 root root 60 Dec 27 19:01 test-bzip2.txt +``` + +#### How to view the Directory files in Linux? + +Use the below command to view the Directory files in Linux. Directory files are available everywhere in Linux filesystem. The Directory files colour is `BLUE` + +``` +# ls -la | grep ^d +drwxr-xr-x. 3 mageshm mageshm 4096 Dec 31 14:24 links/ +drwxrwxr-x. 2 mageshm mageshm 4096 Nov 16 15:44 perl5/ +drwxr-xr-x. 2 mageshm mageshm 4096 Nov 16 15:37 public_ftp/ +drwxr-xr-x. 3 mageshm mageshm 4096 Nov 16 15:37 public_html/ +``` + +#### How to view the Link files in Linux? + +Use the below command to view the Link files in Linux. Link files are available everywhere in Linux filesystem. +Two type of link files are available, it’s Soft link and Hard link. The Link files color is `LIGHT TURQUOISE` + +``` +# ls -la | grep ^l +lrwxrwxrwx. 1 root root 31 Dec 7 15:11 s-link-file -> /links/soft-link/test-soft-link +lrwxrwxrwx. 1 root root 38 Dec 7 15:12 s-link-folder -> /links/soft-link/test-soft-link-folder +``` + +#### How to view the Character Device files in Linux? + +Use the below command to view the Character Device files in Linux. Character Device files are available only in specific location. + +It’s available under `/dev` directory. The Character Device files color is `YELLOW` + +``` +# ls -la | grep ^c +crw-------. 1 root root 5, 1 Jan 28 14:05 console +crw-rw----. 1 root root 10, 61 Jan 28 14:05 cpu_dma_latency +crw-rw----. 1 root root 10, 62 Jan 28 14:05 crash +crw-rw----. 1 root root 29, 0 Jan 28 14:05 fb0 +crw-rw-rw-. 1 root root 1, 7 Jan 28 14:05 full +crw-rw-rw-. 1 root root 10, 229 Jan 28 14:05 fuse +``` + +#### How to view the Block files in Linux? + +Use the below command to view the Block files in Linux. The Block files are available only in specific location. +It’s available under `/dev` directory. The Block files color is `YELLOW` + +``` +# ls -la | grep ^b +brw-rw----. 1 root disk 7, 0 Jan 28 14:05 loop0 +brw-rw----. 1 root disk 7, 1 Jan 28 14:05 loop1 +brw-rw----. 1 root disk 7, 2 Jan 28 14:05 loop2 +brw-rw----. 1 root disk 7, 3 Jan 28 14:05 loop3 +brw-rw----. 1 root disk 7, 4 Jan 28 14:05 loop4 +``` + +#### How to view the Socket files in Linux? + +Use the below command to view the Socket files in Linux. The Socket files are available only in specific location. +The Socket files color is `PINK` + +``` +# ls -la | grep ^s +srw-rw-rw- 1 root root 0 Jan 5 16:36 system_bus_socket +``` + +#### How to view the Named Pipe files in Linux? + +Use the below command to view the Named Pipe files in Linux. The Named Pipe files are available only in specific location. The Named Pipe files color is `YELLOW` + +``` +# ls -la | grep ^p +prw-------. 1 root root 0 Jan 28 14:06 replication-notify-fifo| +prw-------. 1 root root 0 Jan 28 14:06 stats-mail| +``` + +### Method-2: How to Identify File types in Linux Using file Command? + +The file command allow us to determine various file types in Linux. There are three sets of tests, performed in this order: filesystem tests, magic tests, and language tests to identify file types. + +#### How to view the Regular files in Linux Using file Command? + +Simple enter the file command on your terminal and followed by Regular file. The file command will read the given file contents and display exactly what kind of file it is. + +That’s why we are seeing different results for each Regular files. See the below various results for Regular files. + +``` +# file 2daygeek_access.log +2daygeek_access.log: ASCII text, with very long lines + +# file powertop.html +powertop.html: HTML document, ASCII text, with very long lines + +# file 2g-test +2g-test: JSON data + +# file powertop.txt +powertop.txt: HTML document, UTF-8 Unicode text, with very long lines + +# file 2g-test-05-01-2019.tar.gz +2g-test-05-01-2019.tar.gz: gzip compressed data, last modified: Sat Jan 5 18:22:20 2019, from Unix, original size 450560 +``` + +#### How to view the Directory files in Linux Using file Command? + +Simple enter the file command on your terminal and followed by Directory file. See the results below. + +``` +# file Pictures/ +Pictures/: directory +``` + +#### How to view the Link files in Linux Using file Command? + +Simple enter the file command on your terminal and followed by Link file. See the results below. + +``` +# file log +log: symbolic link to /run/systemd/journal/dev-log +``` + +#### How to view the Character Device files in Linux Using file Command? + +Simple enter the file command on your terminal and followed by Character Device file. See the results below. + +``` +# file vcsu +vcsu: character special (7/64) +``` + +#### How to view the Block files in Linux Using file Command? + +Simple enter the file command on your terminal and followed by Block file. See the results below. + +``` +# file sda1 +sda1: block special (8/1) +``` + +#### How to view the Socket files in Linux Using file Command? + +Simple enter the file command on your terminal and followed by Socket file. See the results below. + +``` +# file system_bus_socket +system_bus_socket: socket +``` + +#### How to view the Named Pipe files in Linux Using file Command? + +Simple enter the file command on your terminal and followed by Named Pipe file. See the results below. + +``` +# file pipe-test +pipe-test: fifo (named pipe) +``` + +### Method-3: How to Identify File types in Linux Using stat Command? + +The stat command allow us to check file types or file system status. This utility giving more information than file command. It shows lot of information about the given file such as Size, Block Size, IO Block Size, Inode Value, Links, File permission, UID, GID, File Access, Modify and Change time details. + +#### How to view the Regular files in Linux Using stat Command? + +Simple enter the stat command on your terminal and followed by Regular file. + +``` +# stat 2daygeek_access.log + File: 2daygeek_access.log + Size: 14406929 Blocks: 28144 IO Block: 4096 regular file +Device: 10301h/66305d Inode: 1727555 Links: 1 +Access: (0644/-rw-r--r--) Uid: ( 1000/ daygeek) Gid: ( 1000/ daygeek) +Access: 2019-01-03 14:05:26.430328867 +0530 +Modify: 2019-01-03 14:05:26.460328868 +0530 +Change: 2019-01-03 14:05:26.460328868 +0530 + Birth: - +``` + +#### How to view the Directory files in Linux Using stat Command? + +Simple enter the stat command on your terminal and followed by Directory file. See the results below. + +``` +# stat Pictures/ + File: Pictures/ + Size: 4096 Blocks: 8 IO Block: 4096 directory +Device: 10301h/66305d Inode: 1703982 Links: 3 +Access: (0755/drwxr-xr-x) Uid: ( 1000/ daygeek) Gid: ( 1000/ daygeek) +Access: 2018-11-24 03:22:11.090000828 +0530 +Modify: 2019-01-05 18:27:01.546958817 +0530 +Change: 2019-01-05 18:27:01.546958817 +0530 + Birth: - +``` + +#### How to view the Link files in Linux Using stat Command? + +Simple enter the stat command on your terminal and followed by Link file. See the results below. + +``` +# stat /dev/log + File: /dev/log -> /run/systemd/journal/dev-log + Size: 28 Blocks: 0 IO Block: 4096 symbolic link +Device: 6h/6d Inode: 278 Links: 1 +Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root) +Access: 2019-01-05 16:36:31.033333447 +0530 +Modify: 2019-01-05 16:36:30.766666768 +0530 +Change: 2019-01-05 16:36:30.766666768 +0530 + Birth: - +``` + +#### How to view the Character Device files in Linux Using stat Command? + +Simple enter the stat command on your terminal and followed by Character Device file. See the results below. + +``` +# stat /dev/vcsu + File: /dev/vcsu + Size: 0 Blocks: 0 IO Block: 4096 character special file +Device: 6h/6d Inode: 16 Links: 1 Device type: 7,40 +Access: (0660/crw-rw----) Uid: ( 0/ root) Gid: ( 5/ tty) +Access: 2019-01-05 16:36:31.056666781 +0530 +Modify: 2019-01-05 16:36:31.056666781 +0530 +Change: 2019-01-05 16:36:31.056666781 +0530 + Birth: - +``` + +#### How to view the Block files in Linux Using stat Command? + +Simple enter the stat command on your terminal and followed by Block file. See the results below. + +``` +# stat /dev/sda1 + File: /dev/sda1 + Size: 0 Blocks: 0 IO Block: 4096 block special file +Device: 6h/6d Inode: 250 Links: 1 Device type: 8,1 +Access: (0660/brw-rw----) Uid: ( 0/ root) Gid: ( 994/ disk) +Access: 2019-01-05 16:36:31.596666806 +0530 +Modify: 2019-01-05 16:36:31.596666806 +0530 +Change: 2019-01-05 16:36:31.596666806 +0530 + Birth: - +``` + +#### How to view the Socket files in Linux Using stat Command? + +Simple enter the stat command on your terminal and followed by Socket file. See the results below. + +``` +# stat /var/run/dbus/system_bus_socket + File: /var/run/dbus/system_bus_socket + Size: 0 Blocks: 0 IO Block: 4096 socket +Device: 15h/21d Inode: 576 Links: 1 +Access: (0666/srw-rw-rw-) Uid: ( 0/ root) Gid: ( 0/ root) +Access: 2019-01-05 16:36:31.823333482 +0530 +Modify: 2019-01-05 16:36:31.810000149 +0530 +Change: 2019-01-05 16:36:31.810000149 +0530 + Birth: - +``` + +#### How to view the Named Pipe files in Linux Using stat Command? + +Simple enter the stat command on your terminal and followed by Named Pipe file. See the results below. + +``` +# stat pipe-test + File: pipe-test + Size: 0 Blocks: 0 IO Block: 4096 fifo +Device: 10301h/66305d Inode: 1705583 Links: 1 +Access: (0644/prw-r--r--) Uid: ( 1000/ daygeek) Gid: ( 1000/ daygeek) +Access: 2019-01-06 02:00:03.040394731 +0530 +Modify: 2019-01-06 02:00:03.040394731 +0530 +Change: 2019-01-06 02:00:03.040394731 +0530 + Birth: - +``` +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-understand-and-identify-file-types-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 From 57a019d54ce3c4638d92652ba0d89d68f8ec3823 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:06:15 +0800 Subject: [PATCH 0586/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20ASLR=20pr?= =?UTF-8?q?otects=20Linux=20systems=20from=20buffer=20overflow=20attacks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ux systems from buffer overflow attacks.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..41d4e47acc --- /dev/null +++ b/sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/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 10864a91fed56c42ebe2188901e35b3f27c1fa16 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:21:50 +0800 Subject: [PATCH 0587/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20s-tui:=20A=20Te?= =?UTF-8?q?rminal=20Tool=20To=20Monitor=20CPU=20Temperature,=20Frequency,?= =?UTF-8?q?=20Power=20And=20Utilization=20In=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...equency, Power And Utilization In Linux.md | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md diff --git a/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md new file mode 100644 index 0000000000..276d87049d --- /dev/null +++ b/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) +[#]: via: (https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux +====== + +By default every Linux administrator would go with **[lm_sensors to monitor CPU temperature][1]**. + +lm_sensors (Linux monitoring sensors) is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans. + +It’s a CLI utility and if you are looking for alternative tools. + +I would suggest you to go for s-tui. + +It’s a Stress Terminal UI which helps administrator to view CPU temperature with colors. + +### What is s-tui + +s-tui is a terminal UI for monitoring your computer. s-tui allows to monitor CPU temperature, frequency, power and utilization in a graphical way from the terminal. + +Also, shows performance dips caused by thermal throttling, it requires minimal resources and doesn’t requires X-server. It was written in Python and requires root privilege to use this. + +s-tui is a self-contained application which can run out-of-the-box and doesn’t need config files to drive its core features. + +s-tui uses psutil to probe some of your hardware information. If your hardware is not supported, you might not see all the information. + +Running s-tui as root gives access to the maximum Turbo Boost frequency available to your CPU when stressing all cores. + +It uses Stress utility in the background to check the temperature of its components do not exceed their acceptable range by imposes certain types of compute stress on your system. + +Running an overclocked PC is fine as long as it is stable and that the temperature of its components do not exceed their acceptable range. + +There are several programs available to assess system stability through stress testing the system and thereby the overclock level. + +### How to Install s-tui In Linux + +It was written in Python and pip installation is a recommended method to install s-tui on Linux. Make sure you should have installed python-pip package on your system. If no, use the following command to install it. + +For Debian/Ubuntu users, use **[Apt Command][2]** or **[Apt-Get Command][3]** to install pip package. + +``` +$ sudo apt install python-pip stress +``` + +For Archlinux users, use **[Pacman Command][4]** to install pip package. + +``` +$ sudo pacman -S python-pip stress +``` + +For Fedora users, use **[DNF Command][5]** to install pip package. + +``` +$ sudo dnf install python-pip stress +``` + +For CentOS/RHEL users, use **[YUM Command][6]** to install pip package. + +``` +$ sudo yum install python-pip stress +``` + +For openSUSE users, use **[Zypper Command][7]** to install pip package. + +``` +$ sudo zypper install python-pip stress +``` + +Finally run the following **[pip command][8]** to install s-tui tool in Linux. + +For Python 2.x: + +``` +$ sudo pip install s-tui +``` + +For Python 3.x: + +``` +$ sudo pip3 install s-tui +``` + +### How to Access s-tui + +As i told in the beginning of the article. It requires root privilege to get all the information from your system. Just run the following command to launch s-tui. + +``` +$ sudo s-tui +``` + +![][10] + +By default it enable hardware monitoring and select the “Stress” option to do the stress test on your system. +![][11] + +To check other options, navigate to help page. + +``` +$ s-tui --help +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ + +作者:[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/view-check-cpu-hard-disk-temperature-linux/ +[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-get-apt-cache-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/dnf-command-examples-manage-packages-fedora-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/ +[8]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-1.jpg +[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-2.jpg From cc93dab2f4c8ab52d548c283cafe2cae55e16a3e Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:32:31 +0800 Subject: [PATCH 0588/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Different=20Way?= =?UTF-8?q?s=20To=20Update=20Linux=20Kernel=20For=20Ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Ways To Update Linux Kernel For Ubuntu.md | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md diff --git a/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md b/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md new file mode 100644 index 0000000000..32a6a7dd3e --- /dev/null +++ b/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Different Ways To Update Linux Kernel For Ubuntu) +[#]: via: (https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +Different Ways To Update Linux Kernel For Ubuntu +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/ubuntu-linux-kernel-720x340.png) + +In this guide, we have given 7 different ways to update Linux kernel for Ubuntu. Among the 7 methods, five methods requires system reboot to apply the new Kernel and two methods don’t. Before updating Linux Kernel, it is **highly recommended to backup your important data!** All methods mentioned here are tested on Ubuntu OS only. We are not sure if they will work on other Ubuntu flavors (Eg. Xubuntu) and Ubuntu derivatives (Eg. Linux Mint). + +### Part A – Kernel Updates with reboot + +The following methods requires you to reboot your system to apply the new Linux Kernel. All of the following methods are recommended for personal or testing systems. Again, please backup your important data, configuration files and any other important stuff from your Ubuntu system. + +#### Method 1 – Update the Linux Kernel with dpkg (The manual way) + +This method helps you to manually download and install the latest available Linux kernel from **[kernel.ubuntu.com][1]** website. If you want to install most recent version (either stable or release candidate), this method will help. Download the Linux kernel version from the above link. As of writing this guide, the latest available version was **5.0-rc1** and latest stable version was **v4.20**. + +![][3] + +Click on the Linux Kernel version link of your choice and find the section for your architecture (‘Build for XXX’). In that section, download the two files with these patterns (where X.Y.Z is the highest version): + + 1. linux-image-*X.Y.Z*-generic-*.deb + 2. linux-modules-X.Y.Z*-generic-*.deb + + + +In a terminal, change directory to where the files are and run this command to manually install the kernel: + +``` +$ sudo dpkg --install *.deb +``` + +Reboot to use the new kernel: + +``` +$ sudo reboot +``` + +Check the kernel is as expected: + +``` +$ uname -r +``` + +For step by step instructions, please check the section titled under “Install Linux Kernel 4.15 LTS On DEB based systems” in the following guide. + ++ [Install Linux Kernel 4.15 In RPM And DEB Based Systems](https://www.ostechnix.com/install-linux-kernel-4-15-rpm-deb-based-systems/) + +The above guide is specifically written for 4.15 version. However, all the steps are same for installing latest versions too. + +**Pros:** No internet needed (You can download the Linux Kernel from any system). + +**Cons:** Manual update. Reboot necessary. + +#### Method 2 – Update the Linux Kernel with apt-get (The recommended method) + +This is the recommended way to install latest Linux kernel on Ubuntu-like systems. Unlike the previous method, this method will download and install latest Kernel version from Ubuntu official repositories instead of **kernel.ubuntu.com** website.. + +To update the whole system including the Kernel, just do: + +``` +$ sudo apt-get update + +$ sudo apt-get upgrade +``` + +If you want to update the Kernel only, run: + +``` +$ sudo apt-get upgrade linux-image-generic +``` + +**Pros:** Simple. Recommended method. + +**Cons:** Internet necessary. Reboot necessary. + +Updating Kernel from official repositories will mostly work out of the box without any problems. If it is the production system, this is the recommended way to update the Kernel. + +Method 1 and 2 requires user intervention to update Linux Kernels. The following methods (3, 4 & 5) are mostly automated. + +#### Method 3 – Update the Linux Kernel with Ukuu + +**Ukuu** is a Gtk GUI and command line tool that downloads the latest main line Linux kernel from **kernel.ubuntu.com** , and install it automatically in your Ubuntu desktop and server editions. Ukku is not only simplifies the process of manually downloading and installing new Kernels, but also helps you to safely remove the old and unnecessary Kernels. For more details, refer the following guide. + ++ [Ukuu – An Easy Way To Install And Upgrade Linux Kernel In Ubuntu-based Systems](https://www.ostechnix.com/ukuu-an-easy-way-to-install-and-upgrade-linux-kernel-in-ubuntu-based-systems/) + +**Pros:** Easy to install and use. Automatically installs main line Kernel. + +**Cons:** Internet necessary. Reboot necessary. + +#### Method 4 – Update the Linux Kernel with UKTools + +Just like Ukuu, the **UKTools** also fetches the latest stable Kernel from from **kernel.ubuntu.com** site and installs it automatically on Ubuntu and its derivatives like Linux Mint. More details about UKTools can be found in the link given below. + ++ [UKTools – Upgrade Latest Linux Kernel In Ubuntu And Derivatives](https://www.ostechnix.com/uktools-upgrade-latest-linux-kernel-in-ubuntu-and-derivatives/) + +**Pros:** Simple. Automated. + +**Cons:** Internet necessary. Reboot necessary. + +#### Method 5 – Update the Linux Kernel with Linux Kernel Utilities + +**Linux Kernel Utilities** is yet another program that makes the process of updating Linux kernel easy in Ubuntu-like systems. It is actually a set of BASH shell scripts used to compile and/or update latest Linux kernels for Debian and derivatives. It consists of three utilities, one for manually compiling and installing Kernel from source from [**http://www.kernel.org**][4] website, another for downloading and installing pre-compiled Kernels from from **** website. and third script is for removing the old kernels. For more details, please have a look at the following link. + ++ [Linux Kernel Utilities – Scripts To Compile And Update Latest Linux Kernel For Debian And Derivatives](https://www.ostechnix.com/linux-kernel-utilities-scripts-compile-update-latest-linux-kernel-debian-derivatives/) + +**Pros:** Simple. Automated. + +**Cons:** Internet necessary. Reboot necessary. + + +### Part B – Kernel Updates without reboot + +As I already said, all of above methods need you to reboot the server before the new kernel is active. If they are personal systems or testing machines, you could simply reboot and start using the new Kernel. But, what if they are production systems that requires zero downtime? No problem. This is where **Livepatching** comes in handy! + +The **livepatching** (or hot patching) allows you to install Linux updates or patches without rebooting, keeping your server at the latest security level, without any downtime. This is attractive for ‘always-on’ servers, such as web hosts, gaming servers, in fact, any situation where the server needs to stay on all the time. Linux vendors maintain patches only for security fixes, so this approach is best when security is your main concern. + +The following two methods doesn’t require system reboot and useful for updating Linux Kernel on production and mission-critical Ubuntu servers. + +#### Method 6 – Update the Linux Kernel Canonical Livepatch Service + +![][5] + +[**Canonical Livepatch Service**][6] applies Kernel updates, patches and security hotfixes automatically without rebooting the Ubuntu systems. It reduces the Ubuntu systems downtime and keep them secure. Canonical Livepatch Service can be set up either during or after installation. If you are using desktop Ubuntu, the Software Updater will automatically check for kernel patches and notify you. In a console-based system, it is up to you to run apt-get update regularly. It will install kernel security patches only when you run the command “apt-get upgrade”, hence is semi-automatic. + +Livepatch is free for three systems. If you have more than three, you need to upgrade to enterprise support solution named **Ubuntu Advantage** suite. This suite includes **Kernel Livepatching** and other services such as, + + * Extended Security Maintenance – critical security updates after Ubuntu end-of-life. + * Landscape – the systems management tool for using Ubuntu at scale. + * Knowledge Base – A private collection of articles and tutorials written by Ubuntu experts. + * Phone and web-based support. + + + +**Cost** + +Ubuntu Advantage includes three paid plans namely, Essential, Standard and Advanced. The basic plan (Essential plan) starts from **225 USD per year for one physical node** and **75 USD per year for one VPS**. It seems there is no monthly subscription for Ubuntu servers and desktops. You can view detailed information on all plans [**here**][7]. + +**Pros:** Simple. Semi-automatic. No reboot necessary. Free for 3 systems. + +**Cons:** Expensive for 4 or more hosts. No patch rollback. + +**Enable Canonical Livepatch Service** + +If you want to setup Livepatch service after installation, just do the following steps. + +Get a key at [**https://auth.livepatch.canonical.com/**][8]. + +``` +$ sudo snap install canonical-livepatch + +$ sudo canonical-livepatch enable your-key +``` + +#### Method 7 – Update the Linux Kernel with KernelCare + +![][9] + +[**KernelCare**][10] is the newest of all the live patching solutions. It is the product of [CloudLinux][11]. KernelCare runs on Ubuntu and other flavors of Linux. It checks for patch releases every 4 hours and will install them without confirmation. Patches can be rolled back if there are problems. + +**Cost** + +Fees, per server: **4 USD per month** , **45 USD per year**. + +Compared to Ubuntu Livepatch, kernelCare seems very cheap and affordable. Good thing is **monthly subscriptions are also available**. Another notable feature is it supports other Linux distributions, such as Red Hat, CentOS, Debian, Oracle Linux, Amazon Linux and virtualization platforms like OpenVZ, Proxmox etc. + +You can read all the features and benefits of KernelCare [**here**][12] and check all available plan details [**here**][13]. + +**Pros:** Simple. Fully automated. Wide OS coverage. Patch rollback. No reboot necessary. Free license for non-profit organizations. Low cost. + +**Cons:** Not free (except for 30 day trial). + +**Enable KernelCare Service** + +Get a 30-day trial key at [**https://cloudlinux.com/kernelcare-free-trial5**][14]. + +Run the following commands to enable KernelCare and register the key. + +``` +$ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash + +$ sudo /usr/bin/kcarectl --register KEY +``` + +If you’re looking for an affordable and reliable commercial service to keep the Linux Kernel updated on your Linux servers, KernelCare is good to go. + +*with inputs from **Paul A. Jacobs** , a Technical Evangelist and Content Writer from Cloud Linux.* + +**Suggested read:** + +And, that’s all for now. Hope this was useful. If you believe any other tools/methods should include in this list, feel free to let us know in the comment section below. I will check and update this guide accordingly. + +More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-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]: http://kernel.ubuntu.com/~kernel-ppa/mainline/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/Ubuntu-mainline-kernel.png +[4]: http://www.kernel.org +[5]: http://www.ostechnix.com/wp-content/uploads/2019/01/Livepatch.png +[6]: https://www.ubuntu.com/livepatch +[7]: https://www.ubuntu.com/support/plans-and-pricing +[8]: https://auth.livepatch.canonical.com/ +[9]: http://www.ostechnix.com/wp-content/uploads/2019/01/KernelCare.png +[10]: https://www.kernelcare.com/ +[11]: https://www.cloudlinux.com/ +[12]: https://www.kernelcare.com/update-kernel-linux/ +[13]: https://www.kernelcare.com/pricing/ +[14]: https://cloudlinux.com/kernelcare-free-trial5 From 44a1d33682986ee6a4cbd4afedb846e2bcfbfa7a Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:36:43 +0800 Subject: [PATCH 0589/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Search,=20Study?= =?UTF-8?q?=20And=20Practice=20Linux=20Commands=20On=20The=20Fly!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... And Practice Linux Commands On The Fly.md | 223 ++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 sources/tech/20190104 Search, Study And Practice Linux Commands On The Fly.md diff --git a/sources/tech/20190104 Search, Study And Practice Linux Commands On The Fly.md b/sources/tech/20190104 Search, Study And Practice Linux Commands On The Fly.md new file mode 100644 index 0000000000..fa92d3450a --- /dev/null +++ b/sources/tech/20190104 Search, Study And Practice Linux Commands On The Fly.md @@ -0,0 +1,223 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Search, Study And Practice Linux Commands On The Fly!) +[#]: via: (https://www.ostechnix.com/search-study-and-practice-linux-commands-on-the-fly/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +Search, Study And Practice Linux Commands On The Fly! +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/tldr-720x340.png) + +The title may look like sketchy and click bait. Allow me to explain what I am about to explain in this tutorial. Let us say you want to download an archive file, extract it and move the file from one location to another from command line. As per the above scenario, we may need at least three Linux commands, one for downloading the file, one for extracting the downloaded file and one for moving the file. If you’re intermediate or advanced Linux user, you could do this easily with an one-liner command or a script in few seconds/minutes. But, if you are a noob who don’t know much about Linux commands, you might need little help. + +Of course, a quick google search may yield many results. Or, you could use [**man pages**][1]. But some man pages are really long, comprehensive and lack in useful example. You might need to scroll down for quite a long time when you’re looking for a particular information on the specific flags/options. Thankfully, there are some [**good alternatives to man pages**][2], which are focused on mostly practical commands. One such good alternative is **TLDR pages**. Using TLDR pages, we can quickly and easily learn a Linux command with practical examples. To access the TLDR pages, we require a TLDR client. There are many clients available. Today, we are going to learn about one such client named **“Tldr++”**. + +Tldr++ is a fast and interactive tldr client written with **Go** programming language. Unlike the other Tldr clients, it is fully interactive. That means, you can pick a command, read all examples , and immediately run any command without having to retype or copy/paste each command in the Terminal. Still don’t get it? No problem. Read on to learn and practice Linux commands on the fly. + +### Install Tldr++ + +Installing Tldr++ is very simple. Download tldr++ latest version from the [**releases page**][3]. Extract it and move the tldr++ binary to your $PATH. + +``` +$ wget https://github.com/isacikgoz/tldr/releases/download/v0.5.0/tldr_0.5.0_linux_amd64.tar.gz + +$ tar xzf tldr_0.5.0_linux_amd64.tar.gz + +$ sudo mv tldr /usr/local/bin + +$ sudo chmod +x /usr/local/bin/tldr +``` + +Now, run ‘tldr’ binary to populate the tldr pages in your local system. + +``` +$ tldr +``` + +Sample output: + +``` +Enumerating objects: 6, done. +Counting objects: 100% (6/6), done. +Compressing objects: 100% (6/6), done. +Total 18157 (delta 0), reused 3 (delta 0), pack-reused 18151 +Successfully cloned into: /home/sk/.local/share/tldr +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/tldr-2.png) + +Tldr++ is available in AUR. If you’re on Arch Linux, you can install it using any AUR helper, for example [**YaY**][4]. Make sure you have removed any existing tldr client from your system and run the following command to install tldr++. + +``` +$ yay -S tldr++ +``` + +Alternatively, you can build from source as described below. Since Tldr++ is written using Go language, make sure you have installed it on your Linux box. If it isn’t installed yet, refer the following guide. + ++ [How To Install Go Language In Linux](https://www.ostechnix.com/install-go-language-linux/) + +After installing Go, run the following command to install Tldr++. + +``` +$ go get -u github.com/isacikgoz/tldr +``` + +This command will download the contents of tldr repository in a folder named **‘go’** in the current working directory. + +Now run the ‘tldr’ binary to populate all tldr pages in your local system using command: + +``` +$ go/bin/tldr +``` + +Sample output: + +![][6] + +Finally, copy the tldr binary to your PATH. + +``` +$ sudo mv tldr /usr/local/bin +``` + +It is time to see some examples. + +### Tldr++ Usage + +Type ‘tldr’ command without any options to display all command examples in alphabetical order. + +![][7] + +Use the **UP/DOWN arrows** to navigate through the commands, type any letters to search or type a command name to view the examples of that respective command. Press **?** for more and **Ctrl+c** to return/exit. + +To display the example commands of a specific command, for example **apt** , simply do: + +``` +$ tldr apt +``` + +![][8] + +Choose any example command from the list and hit ENTER. You will see a *** symbol** before the selected command. For example, I choose the first command i.e ‘sudo apt update’. Now, it will ask you whether to continue or not. If the command is correct, just type ‘y’ to continue and type your sudo password to run the selected command. + +![][9] + +See? You don’t need to copy/paste or type the actual command in the Terminal. Just choose it from the list and run on the fly! + +There are hundreds of Linux command examples are available in Tldr pages. You can choose one or two commands per day and learn them thoroughly. And keep this practice everyday to learn as much as you can. + +### Learn And Practice Linux Commands On The Fly Using Tldr++ + +Now think of the scenario that I mentioned in the first paragraph. You want to download a file, extract it and move it to different location and make it executable. Let us see how to do it interactively using Tldr++ client. + +**Step 1 – Download a file from Internet** + +To download a file from command line, we mostly use **‘curl’** or **‘wget’** commands. Let me use ‘wget’ to download the file. To open tldr page of wget command, just run: + +``` +$ tldr wget +``` + +Here is the examples of wget command. + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/wget-tldr.png) + +You can use **UP/DOWN** arrows to go through the list of commands. Once you choose the command of your choice, press ENTER. Here I chose the first command. + +Now, enter the path of the file to download. + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/tldr-3.png) + +You will then be asked to confirm if it is the correct command or not. If the command is correct, simply type ‘yes’ or ‘y’ to start downloading the file. + +![][10] + +We have downloaded the file. Let us go ahead and extract this file. + +**Step 2 – Extract downloaded archive** + +We downloaded the **tar.gz** file. So I am going to open the ‘tar’ tldr page. + +``` +$ tldr tar +``` + +You will see the list of example commands. Go through the examples and find which command is suitable to extract tar.gz(gzipped archive) file and hit ENTER key. In our case, it is the third command. + +![][11] + +Now, you will be prompted to enter the path of the tar.gz file. Just type the path and hit ENTER key. Tldr++ supports smart file suggestions. That means it will suggest the file name automatically as you type. Just press TAB key for auto-completion. + +![][12] + +If you downloaded the file to some other location, just type the full path, for example **/home/sk/Downloads/tldr_0.5.0_linux_amd64.tar.gz.** + +Once you enter the path of the file to extract, press ENTER and then, type ‘y’ to confirm. + +![][13] + +**Step 3 – Move file from one location to another** + +We extracted the archive. Now we need to move the file to another location. To move the files from one location to another, we use ‘mv’ command. So, let me open the tldr page for mv command. + +``` +$ tldr mv +``` + +Choose the correct command to move the files from one location to another. In our case, the first command will work, so let me choose it. + +![][14] + +Type the path of the file that you want to move and enter the destination path and hit ENTER key. + +![][15] + +**Note:** Type **y!** or **yes!** to run command with **sudo** privileges. + +As you see in the above screenshot, I moved the file named **‘tldr’** to **‘/usr/local/bin/’** location. + +For more details, refer the project’s GitHub page given at the end. + + +### Conclusion + +Don’t get me wrong. **Man pages are great!** There is no doubt about it. But, as I already said, many man pages are comprehensive and doesn’t have useful examples. There is no way I could memorize all lengthy commands with tricky flags. Some times I spent much time on man pages and remained clueless. The Tldr pages helped me to find what I need within few minutes. Also, we use some commands once in a while and then we forget them completely. Tldr pages on the other hand actually helps when it comes to using commands we rarely use. Tldr++ client makes this task much easier with smart user interaction. Give it a go and let us know what you think about this tool in the comment section below. + +And, that’s all. More good stuffs to come. Stay tuned! + +Good luck! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/search-study-and-practice-linux-commands-on-the-fly/ + +作者:[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/learn-use-man-pages-efficiently/ +[2]: https://www.ostechnix.com/3-good-alternatives-man-pages-every-linux-user-know/ +[3]: https://github.com/isacikgoz/tldr/releases +[4]: https://www.ostechnix.com/yay-found-yet-another-reliable-aur-helper/ +[5]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[6]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-1.png +[7]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-11.png +[8]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-12.png +[9]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-13.png +[10]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-4.png +[11]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-6.png +[12]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-7.png +[13]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-8.png +[14]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-9.png +[15]: http://www.ostechnix.com/wp-content/uploads/2019/01/tldr-10.png From 1b66288f41e36a5bbe333a435d07c4c28ea0825a Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:40:07 +0800 Subject: [PATCH 0590/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Aliases:=20To?= =?UTF-8?q?=20Protect=20and=20Serve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190107 Aliases- To Protect and Serve.md | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 sources/tech/20190107 Aliases- To Protect and Serve.md diff --git a/sources/tech/20190107 Aliases- To Protect and Serve.md b/sources/tech/20190107 Aliases- To Protect and Serve.md new file mode 100644 index 0000000000..783c59dc41 --- /dev/null +++ b/sources/tech/20190107 Aliases- To Protect and Serve.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Aliases: To Protect and Serve) +[#]: via: (https://www.linux.com/blog/learn/2019/1/aliases-protect-and-serve) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +Aliases: To Protect and Serve +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/prairie-path_1920.jpg?itok=wRARsM7p) + +Happy 2019! Here in the new year, we’re continuing our series on aliases. By now, you’ve probably read our [first article on aliases][1], and it should be quite clear how they are the easiest way to save yourself a lot of trouble. You already saw, for example, that they helped with muscle-memory, but let's see several other cases in which aliases come in handy. + +### Aliases as Shortcuts + +One of the most beautiful things about Linux's shells is how you can use zillions of options and chain commands together to carry out really sophisticated operations in one fell swoop. All right, maybe beauty is in the eye of the beholder, but let's agree that this feature published practical. + +The downside is that you often come up with recipes that are often hard to remember or cumbersome to type. Say space on your hard disk is at a premium and you want to do some New Year's cleaning. Your first step may be to look for stuff to get rid off in you home directory. One criteria you could apply is to look for stuff you don't use anymore. `ls` can help with that: + +``` +ls -lct +``` + +The instruction above shows the details of each file and directory (`-l`) and also shows when each item was last accessed (`-c`). It then orders the list from most recently accessed to least recently accessed (`-t`). + +Is this hard to remember? You probably don’t use the `-c` and `-t` options every day, so perhaps. In any case, defining an alias like + +``` +alias lt='ls -lct' +``` + +will make it easier. + +Then again, you may want to have the list show the oldest files first: + +``` +alias lo='lt -F | tac' +``` + +![aliases][3] + +Figure 1: The lt and lo aliases in action. + +[Used with permission][4] + +There are a few interesting things going here. First, we are using an alias (`lt`) to create another alias -- which is perfectly okay. Second, we are passing a new parameter to `lt` (which, in turn gets passed to `ls` through the definition of the `lt` alias). + +The `-F` option appends special symbols to the names of items to better differentiate regular files (that get no symbol) from executable files (that get an `*`), files from directories (end in `/`), and all of the above from links, symbolic and otherwise (that end in an `@` symbol). The `-F` option is throwback to the days when terminals where monochrome and there was no other way to easily see the difference between items. You use it here because, when you pipe the output from `lt` through to `tac` you lose the colors from `ls`. + +The third thing to pay attention to is the use of piping. Piping happens when you pass the output from an instruction to another instruction. The second instruction can then use that output as its own input. In many shells (including Bash), you pipe something using the pipe symbol (`|`). + +In this case, you are piping the output from `lt -F` into `tac`. `tac`'s name is a bit of a joke. You may have heard of `cat`, the instruction that was nominally created to con _cat_ enate files together, but that in practice is used to print out the contents of a file to the terminal. `tac` does the same, but prints out the contents it receives in reverse order. Get it? `cat` and `tac`. Developers, you so funny! + +The thing is both `cat` and `tac` can also print out stuff piped over from another instruction, in this case, a list of files ordered chronologically. + +So... after that digression, what comes out of the other end is the list of files and directories of the current directory in inverse order of freshness. + +The final thing you have to bear in mind is that, while `lt` will work the current directory and any other directory... + +``` +# This will work: +lt +# And so will this: +lt /some/other/directory +``` + +... `lo` will only work with the current directory: + +``` +# This will work: +lo +# But this won't: +lo /some/other/directory +``` + +This is because Bash expands aliases into their components. When you type this: + +``` +lt /some/other/directory +``` + +Bash REALLY runs this: + +``` +ls -lct /some/other/directory +``` + +which is a valid Bash command. + +However, if you type this: + +``` +lo /some/other/directory +``` + +Bash tries to run this: + +``` +ls -lct -F | tac /some/other/directory +``` + +which is not a valid instruction, because `tac` mainly because _/some/other/directory_ is a directory, and `cat` and `tac` don't do directories. + +### More Alias Shortcuts + + * `alias lll='ls -R'` prints out the contents of a directory and then drills down and prints out the contents of its subdirectories and the subdirectories of the subdirectories, and so on and so forth. It is a way of seeing everything you have under a directory. + + * `mkdir='mkdir -pv'` let's you make directories within directories all in one go. With the base form of `mkdir`, to make a new directory containing a subdirectory you have to do this: + +``` + mkdir newdir +mkdir newdir/subdir +``` + +Or this: + +``` +mkdir -p newdir/subdir +``` + +while with the alias you would only have to do this: + +``` +mkdir newdir/subdir +``` + +Your new `mkdir` will also tell you what it is doing while is creating new directories. + + + + +### Aliases as Safeguards + +The other thing aliases are good for is as safeguards against erasing or overwriting your files accidentally. At this stage you have probably heard the legendary story about the new Linux user who ran: + +``` +rm -rf / +``` + +as root, and nuked the whole system. Then there's the user who decided that: + +``` +rm -rf /some/directory/ * +``` + +was a good idea and erased the complete contents of their home directory. Notice how easy it is to overlook that space separating the directory path and the `*`. + +Both things can be avoided with the `alias rm='rm -i'` alias. The `-i` option makes `rm` ask the user whether that is what they really want to do and gives you a second chance before wreaking havoc in your file system. + +The same goes for `cp`, which can overwrite a file without telling you anything. Create an alias like `alias cp='cp -i'` and stay safe! + +### Next Time + +We are moving more and more into scripting territory. Next time, we'll take the next logical step and see how combining instructions on the command line gives you really interesting and sophisticated solutions to everyday admin problems. + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/aliases-protect-and-serve + +作者:[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/aliases-protect-and-serve +[2]: https://www.linux.com/files/images/fig01png-0 +[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fig01_0.png?itok=crqTm_va (aliases) +[4]: https://www.linux.com/licenses/category/used-permission From 831d6ccf02932dd925a5d66296ecbaf7c3038841 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:41:20 +0800 Subject: [PATCH 0591/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20NSA=20to=20Open?= =?UTF-8?q?=20Source=20its=20Reverse=20Engineering=20Tool=20GHIDRA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rce its Reverse Engineering Tool GHIDRA.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md diff --git a/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md b/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md new file mode 100644 index 0000000000..78922f9525 --- /dev/null +++ b/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NSA to Open Source its Reverse Engineering Tool GHIDRA) +[#]: via: (https://itsfoss.com/nsa-ghidra-open-source) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +NSA to Open Source its Reverse Engineering Tool GHIDRA +====== + +GHIDRA – NSA’s reverse engineering tool is getting ready for a free public release this March at the [RSA Conference 2019][1] to be held in San Francisco. + +The National Security Agency (NSA) did not officially announce this – however – a senior NSA advisor, Robert Joyce’s [session description][2] on the official RSA conference website revealed about it before any official statement or announcement. + +Here’s what it mentioned: + +![][3] +Image Credits: [Twitter][4] + +In case the text in the image isn’t properly visible, let me quote the description here: + +> NSA has developed a software reverse engineering framework known as GHIDRA, which will be demonstrated for the first time at RSAC 2019. An interactive GUI capability enables reverse engineers to leverage an integrated set of features that run on a variety of platforms including Windows, Mac OS, and Linux and supports a variety of processor instruction sets. The GHISDRA platform includes all the features expected in high-end commercial tools, with new and expanded functionality NSA uniquely developed. and will be released for free public use at RSA. + +### What is GHIDRA? + +GHIDRA is a software reverse engineering framework developed by [NSA][5] that is in use by the agency for more than a decade. + +Basically, a software reverse engineering tool helps to dig up the source code of a proprietary program which further gives you the ability to detect virus threats or potential bugs. You should read how [reverse engineering][6] works to know more. + +The tool is is written in Java and quite a few people compared it to high-end commercial reverse engineering tools available like [IDA][7]. + +A [Reddit thread][8] involves more detailed discussion where you will find some ex-employees giving good amount of details before the availability of the tool. + +![NSA open source][9] + +### GHIDRA was a secret tool, how do we know about it? + +The existence of the tool was uncovered in a series of leaks by [WikiLeaks][10] as part of [Vault 7 documents of CIA][11]. + +### Is it going to be open source? + +We do think that the reverse engineering tool to be released could be made open source. Even though there is no official confirmation mentioning “open source” – but a lot of people do believe that NSA is definitely targeting the open source community to help improve their tool while also reducing their effort to maintain this tool. + +This way the tool can remain free and the open source community can help improve GHIDRA as well. + +You can also check out the existing [Vault 7 document at WikiLeaks][12] to come up with your prediction. + +### Is NSA doing a good job here? + +The reverse engineering tool is going to be available for Windows, Linux, and Mac OS for free. + +Of course, we care about the Linux platform here – which could be a very good option for people who do not want to or cannot afford a thousand dollar license for a reverse engineering tool with the best-in-class features. + +### Wrapping Up + +If GHIDRA becomes open source and is available for free, it would definitely help a lot of researchers and students and on the other side – the competitors will be forced to adjust their pricing. + +What are your thoughts about it? Is it a good thing? What do you think about the tool going open sources Let us know what you think in the comments below. + +![][13] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/nsa-ghidra-open-source + +作者:[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.rsaconference.com/events/us19 +[2]: https://www.rsaconference.com/events/us19/agenda/sessions/16608-come-get-your-free-nsa-reverse-engineering-tool +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/come-get-your-free-nsa.jpg?fit=800%2C337&ssl=1 +[4]: https://twitter.com/0xffff0800/status/1080909700701405184 +[5]: http://nsa.gov +[6]: https://en.wikipedia.org/wiki/Reverse_engineering +[7]: https://en.wikipedia.org/wiki/Interactive_Disassembler +[8]: https://www.reddit.com/r/ReverseEngineering/comments/ace2m3/come_get_your_free_nsa_reverse_engineering_tool/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/nsa-open-source.jpeg?resize=800%2C450&ssl=1 +[10]: https://www.wikileaks.org/ +[11]: https://en.wikipedia.org/wiki/Vault_7 +[12]: https://wikileaks.org/ciav7p1/cms/page_9536070.html +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/nsa-open-source.jpeg?fit=800%2C450&ssl=1 From 2c15ff7cfdcf3976eee14faf1e707f4d3eedbb70 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:43:52 +0800 Subject: [PATCH 0592/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20DriveSync=20?= =?UTF-8?q?=E2=80=93=20Easy=20Way=20to=20Sync=20Files=20Between=20Local=20?= =?UTF-8?q?And=20Google=20Drive=20from=20Linux=20CLI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n Local And Google Drive from Linux CLI.md | 239 ++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 sources/tech/20190107 DriveSync - Easy Way to Sync Files Between Local And Google Drive from Linux CLI.md diff --git a/sources/tech/20190107 DriveSync - Easy Way to Sync Files Between Local And Google Drive from Linux CLI.md b/sources/tech/20190107 DriveSync - Easy Way to Sync Files Between Local And Google Drive from Linux CLI.md new file mode 100644 index 0000000000..6552cc3905 --- /dev/null +++ b/sources/tech/20190107 DriveSync - Easy Way to Sync Files Between Local And Google Drive from Linux CLI.md @@ -0,0 +1,239 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DriveSync – Easy Way to Sync Files Between Local And Google Drive from Linux CLI) +[#]: via: (https://www.2daygeek.com/drivesync-google-drive-sync-client-for-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +DriveSync – Easy Way to Sync Files Between Local And Google Drive from Linux CLI +====== + +Google Drive is an one of the best cloud storage compared with other cloud storage. + +It’s one of the application which is used by millions of users in daily basics. + +It allow users to access the application anywhere irrespective of devices. + +We can upload, download & share documents, photo, files, docs, spreadsheet, etc to anyone with securely. + +We had already written few articles in 2daygeek website about google drive mapping with Linux. + +If you would like to check those, navigate to the following link. + +GNOME desktop offers easy way to **[Integrate Google Drive Using Gnome Nautilus File Manager in Linux][1]** without headache. + +Also, you can give a try with **[Google Drive Ocamlfuse Client][2]**. + +### What’s DriveSync? + +[DriveSync][3] is a command line utility that synchronizes your files between local system and Google Drive via command line. + +Downloads new remote files, uploads new local files to your Drive and deletes or updates files both locally and on Drive if they have changed in one place. + +Allows blacklisting or whitelisting of files and folders that should not / should be synced. + +It was written in Ruby scripting language so, make sure your system should have ruby installed. If it’s not installed then install it as a prerequisites for DriveSync. + +### DriveSync Features + + * Downloads new remote files + * Uploads new local files + * Delete or Update files in both locally and Drive + * Allow blacklist to disable sync for files and folders + * Automate the sync using cronjob + * Allow us to set file upload/download size (Defautl 512MB) + * Allow us to modify Timeout threshold + + + +### How to Install Ruby Scripting Language in Linux? + +Ruby is an interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (like in Perl). It is simple, straight-forward, and extensible. + +It’s available in all the Linux distribution official repository. Hence we can easily install it with help of distribution official **[Package Manager][4]**. + +For **`Fedora`** system, use **[DNF Command][5]** to install Ruby. + +``` +$ sudo dnf install ruby rubygem-bundler +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][6]** or **[APT Command][7]** to install Ruby. + +``` +$ sudo apt install ruby ruby-bundler +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][8]** to install Ruby. + +``` +$ sudo pacman -S ruby ruby-bundler +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][9]** to install Ruby. + +``` +$ sudo yum install ruby ruby-bundler +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][10]** to install Ruby. + +``` +$ sudo zypper install ruby ruby-bundler +``` + +### How to Install DriveSync in Linux? + +DriveSync installation also easy to do it. Follow the below procedure to get it done. + +``` +$ git clone https://github.com/MStadlmeier/drivesync.git +$ cd drivesync/ +$ bundle install +``` + +### How to Set Up DriveSync in Linux? + +As of now, we had successfully installed DriveSync and still we need to perform few steps to use this. + +Run the following command to set up this and Sync the files. + +``` +$ ruby drivesync.rb +``` + +When you ran the above command you will be getting the below url. +![][12] + +Navigate to the given URL in your preferred Web Browser and follow the instruction. It will open a google sign-in page in default web browser. Enter your credentials then hit Sign in button. +![][13] + +Input your password. +![][14] + +Hit **`Allow`** button to allow DriveSync to access your Google Drive. +![][15] + +Finally, it will give you an authorization code. +![][16] + +Just copy and past it on the terminal and hit **`Enter`** button to start the sync. +![][17] + +Yes, it’s syncing the files from Google Drive to my local folder. + +``` +$ ruby drivesync.rb +Warning: Could not find config file at /home/daygeek/.drivesync/config.yml . Creating default config... +Open the following URL in the browser and enter the resulting code after authorization +https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com&include_granted_scopes=true&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/drive +4/ygAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +Local folder is 1437 files behind and 0 files ahead of remote +Starting sync at 2019-01-06 19:48:49 +0530 +Downloading file 2018-07-31-17-48-54-635_1533039534635_XXXPM0534X_ITRV.zip ... +Downloading file 5459XXXXXXXXXX25_11-03-2018.PDF ... +Downloading file 2g-image-design/new-design-28-Mar-2018/new-base-format-icon-theme.svg ... +Downloading file 2g-image-design/new-design-28-Mar-2018/2g-banner-format.svg ... +Downloading file 2g-image-design/new-design-28-Mar-2018/new-base-format.svg ... +Downloading file documents/Magesh_Resume_Updated_26_Mar_2018.doc ... +Downloading file documents/Magesh_Resume_updated-new.doc ... +Downloading file documents/Aadhaar-Thanu.PNG ... +Downloading file documents/Aadhaar-Magesh.PNG ... +Downloading file documents/Copy of PP-docs.pdf ... +Downloading file EAadhaar_2189821080299520170807121602_25082017123052_172991.pdf ... +Downloading file Tanisha/VID_20170223_113925.mp4 ... +Downloading file Tanisha/VID_20170224_073234.mp4 ... +Downloading file Tanisha/VID_20170304_170457.mp4 ... +Downloading file Tanisha/IMG_20170225_203243.jpg ... +Downloading file Tanisha/IMG_20170226_123949.jpg ... +Downloading file Tanisha/IMG_20170226_123953.jpg ... +Downloading file Tanisha/IMG_20170304_184227.jpg ... +. +. +. +Sync complete. +``` + +It will create the **`drive`** folder under **`/home/user/Documents/`** and sync all the files in it. +![][18] + +DriveSync configuration files are located in the following location **`/home/user/.drivesync/`** if you had installed it on your **home** directory. + +``` +$ ls -lh ~/.drivesync/ +total 176K +-rw-r--r-- 1 daygeek daygeek 1.9K Jan 6 19:42 config.yml +-rw-r--r-- 1 daygeek daygeek 170K Jan 6 21:31 manifest +``` + +You can make your changes by modifying the **`config.yml`** file. + +### How to Verify Whether Sync is Working Fine or Not? + +To test this, we are going to create a new folder called **`2g-docs-2019`**. Also, adding an image file in it. Once it’s done, run the **`drivesync.rb`** command again. + +``` +$ ruby drivesync.rb +Local folder is 0 files behind and 1 files ahead of remote +Starting sync at 2019-01-06 21:59:32 +0530 +Uploading file 2g-docs-2019/Asciinema - Record And Share Your Terminal Activity On The Web.png ... +``` + +Yes, it has been synced to Google Drive. The same has been verified through Web Browser. +![][19] + +Create the below **CronJob** to enable an auto sync. The following “CronJob” will be running an every mins. + +``` +$ vi crontab +*/1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated ruby ~/drivesync/drivesync.rb +``` + +I have added one more file to test this. Yes, it got success. + +``` +Jan 07 09:36:01 daygeek-Y700 crond[590]: (daygeek) RELOAD (/var/spool/cron/daygeek) +Jan 07 09:36:01 daygeek-Y700 crond[20942]: pam_unix(crond:session): session opened for user daygeek by (uid=0) +Jan 07 09:36:01 daygeek-Y700 CROND[20943]: (daygeek) CMD (ruby ~/drivesync/drivesync.rb) +Jan 07 09:36:29 daygeek-Y700 CROND[20942]: (daygeek) CMDOUT (Local folder is 0 files behind and 1 files ahead of remote) +Jan 07 09:36:29 daygeek-Y700 CROND[20942]: (daygeek) CMDOUT (Starting sync at 2019-01-07 09:36:26 +0530) +Jan 07 09:36:29 daygeek-Y700 CROND[20942]: (daygeek) CMDOUT (Uploading file 2g-docs-2019/Check CPU And HDD Temperature In Linux.png ...) +Jan 07 09:36:29 daygeek-Y700 CROND[20942]: (daygeek) CMDOUT () +Jan 07 09:36:29 daygeek-Y700 CROND[20942]: (daygeek) CMDOUT (Sync complete.) +Jan 07 09:36:29 daygeek-Y700 CROND[20942]: pam_unix(crond:session): session closed for user daygeek +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/drivesync-google-drive-sync-client-for-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/mount-access-setup-google-drive-in-linux/ +[2]: https://www.2daygeek.com/mount-access-google-drive-on-linux-with-google-drive-ocamlfuse-client/ +[3]: https://github.com/MStadlmeier/drivesync +[4]: https://www.2daygeek.com/category/package-management/ +[5]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[6]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[7]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[8]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[9]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[10]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[11]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/drivesync-easy-way-to-sync-files-between-local-and-google-drive-from-linux-cli-1.jpg +[13]: https://www.2daygeek.com/wp-content/uploads/2019/01/drivesync-easy-way-to-sync-files-between-local-and-google-drive-from-linux-cli-2.png +[14]: https://www.2daygeek.com/wp-content/uploads/2019/01/drivesync-easy-way-to-sync-files-between-local-and-google-drive-from-linux-cli-3.png +[15]: https://www.2daygeek.com/wp-content/uploads/2019/01/drivesync-easy-way-to-sync-files-between-local-and-google-drive-from-linux-cli-4.png +[16]: https://www.2daygeek.com/wp-content/uploads/2019/01/drivesync-easy-way-to-sync-files-between-local-and-google-drive-from-linux-cli-5.png +[17]: https://www.2daygeek.com/wp-content/uploads/2019/01/drivesync-easy-way-to-sync-files-between-local-and-google-drive-from-linux-cli-6.jpg +[18]: https://www.2daygeek.com/wp-content/uploads/2019/01/drivesync-easy-way-to-sync-files-between-local-and-google-drive-from-linux-cli-7.jpg +[19]: https://www.2daygeek.com/wp-content/uploads/2019/01/drivesync-easy-way-to-sync-files-between-local-and-google-drive-from-linux-cli-8.png From ed01245772ace0aeae1f4a7bb84c9a767fab8654 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 16:48:26 +0800 Subject: [PATCH 0593/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20mana?= =?UTF-8?q?ge=20your=20media=20with=20Kodi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0107 How to manage your media with Kodi.md | 303 ++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 sources/tech/20190107 How to manage your media with Kodi.md diff --git a/sources/tech/20190107 How to manage your media with Kodi.md b/sources/tech/20190107 How to manage your media with Kodi.md new file mode 100644 index 0000000000..cea446c5b0 --- /dev/null +++ b/sources/tech/20190107 How to manage your media with Kodi.md @@ -0,0 +1,303 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to manage your media with Kodi) +[#]: via: (https://opensource.com/article/19/1/manage-your-media-kodi) +[#]: author: (Steve Ovens https://opensource.com/users/stratusss) + +How to manage your media with Kodi +====== + +![](Get control over your home media content with Kodi media player software.) + +If you, like me, like to own your own data, chances are you also like to purchase movies and TV shows on Blu-Ray or DVD discs. And you may also like to make [ISOs][1] of the videos to keep exact digital copies, as I do. + +For a little while, it might be manageable to have a bunch of files stored in some sort of directory structure. However, as your collection grows, you may want features like resuming from a specific spot; keeping track of where you left off watching a video (i.e., its watched status); storing episode or movie summaries and movie trailers; buying media in multiple languages; or just having a sane way to play all those ISOs you ripped. + +This is where Kodi comes in. + +### What is Kodi? + +Modern [Kodi][2] is the successor to Xbox Media Player, which was discontinued way back in 2003. In June 2004, Xbox Media Center (XBMC) was born. For over three years, XBMC remained on the Xbox. Then in 2007, work began in earnest to port the media player over to Linux. + +![](https://opensource.com/sites/default/files/uploads/00_xbmc_500x300.png) + +Aside from some uninteresting technical history, things remained fairly stable, and XBMC grew in prominence. By 2014, XBMC had a thriving community, and its core functionality grew to include playing games, streaming content from the web, and connecting to mobile devices. This, combined with legal issues involving Xbox in the name, lead the team behind XBMC to rename it Kodi. Kodi is now branded as an "entertainment hub that brings all your digital media together into a beautiful and user-friendly package." + +Today, Kodi has an extensible interface that has allowed the open source community to build new functionality using plugins. Note that, as with all open source software, Kodi's developers are not responsible for the ecosystem's plugins. + +### How do I start? + +For Ubuntu-based distributions, Kodi is just a few short commands away: + +``` +sudo apt install software-properties-common +sudo add-apt-repository ppa:team-xbmc/ppa +sudo apt update +sudo apt install kodi +``` + +In Arch Linux, you can install the latest version from the community repo: + +``` +sudo pacman -S kodi +``` + +Packages were maintained for Fedora 26 by RPM Fusion (referenced in the [Kodi documentation][3]). I tried it on Fedora 29, and it was quite unstable. I'm sure that this will improve over time, but my experience is that Fedora 29 is not the ideal platform for Kodi. + +### OK, it's installed… now what? + +Before we proceed, note that I am making two assumptions about your media content: + + 1. You have your own local, legally attained content. + 2. You have already transferred this content from your DVDs, Blu-Rays, or another digital distribution source to your local directory or network. + + + +Kodi uses a scraping service to pull down TV and movie metadata. For Kodi to match things appropriately, I recommend adopting a directory and file-naming structure similar to this: + +``` +Utopia +├── Utopia.S01.dvd_rip.x264 +│   ├── Utopia.S01E01.dvd_rip.x264.mkv +│   ├── Utopia.S01E02.dvd_rip.x264.mkv +│   ├── Utopia.S01E03.dvd_rip.x264.mkv +│   ├── Utopia.S01E04.dvd_rip.x264.mkv +│   ├── Utopia.S01E05.dvd_rip.x264.mkv +│   ├── Utopia.S01E06.dvd_rip.x264.mkv +└── Utopia.S02.dvd_rip.x264 +    ├── Utopia.S02E01.dvd_rip.x264.mkv +    ├── Utopia.S02E02.dvd_rip.x264.mkv +    ├── Utopia.S02E03.dvd_rip.x264.mkv +    ├── Utopia.S02E04.dvd_rip.x264.mkv +    ├── Utopia.S02E05.dvd_rip.x264.mkv +    └── Utopia.S02E06.dvd_rip.x264.mkv +``` + +I put the source (my DVD) and the codec (x264) in the title, but these are optional. For a TV series, you can include the episode title in the filename if you like. The important part is **SxxExx** , which stands for Season and Episode. This is how Kodi (and by extension the scrapers) can identify your media. + +Assuming you have organized your media like this, let's do some basic Kodi configuration. + +### Add video sources + +Adding video sources is a simple, six-step process: + + 1. Enter the files section + 2. Select **Files** + 3. Click **Add source** + 4. Browse to your source + 5. Define the video content type + 6. Refresh the metadata + + + +If you're impatient, feel free to navigate these steps on your own. But if you want details, keep reading. + +When you first launch Kodi, you'll see the home screen below. Click **Enter files section**. It doesn't matter whether you do this under Movies (as shown here) or TV shows. + +![](https://opensource.com/sites/default/files/uploads/01_fresh_kodi_main_screen.png) + +Next, select the **Videos** folder, click **Files** , and choose **Add videos**. + +![](https://opensource.com/sites/default/files/uploads/02_videos_folder.png) + +![](https://opensource.com/sites/default/files/uploads/03_add_videos.png) + +Either click on **None** and start typing the path to your files or click **Browse** and use the file navigation. + +![](https://opensource.com/sites/default/files/uploads/04_browse_video_source.png) + +![](https://opensource.com/sites/default/files/uploads/05_add_video_source_name.png) + +As you can see in this screenshot, I added my local **Videos** directory. You can set some default options through **Browse** , such as specifying your home folder and any drives you have mounted—maybe on a network file system (NFS), universal plug and play (UPnP) device, Windows Network ([SMB/CIFS][4]), or [zeroconf][5]. I won't cover most of these, as they are outside the scope of this article, but we will use NFS later for one of Kodi's advanced features. + +After you select your path and click OK, identify the type of content you're working with. + +![](https://opensource.com/sites/default/files/uploads/06_define_video_content.png) + +Next, Kodi prompts you to refresh the metadata for the content in the selected directory. This is how Kodi knows what videos you have and their synopsis, cast information, thumbnails, fan art, etc. Select **Yes** , and you can watch the video-scanning progress in the top right-hand corner. + +![](https://opensource.com/sites/default/files/uploads/07_refresh.png) + +![](https://opensource.com/sites/default/files/uploads/08_active_scan_in_progress.png) + +When the scan completes, you'll see lots of useful information, such as video overviews and season and episode descriptions for TV shows. + +![](https://opensource.com/sites/default/files/uploads/09_screen_after_scan.png) + +![](https://opensource.com/sites/default/files/uploads/10_show_description.png) + +You can use the same process for other types of content, such as music or music videos. + +### Increase functionality with add-ons + +One of the most interesting things about open source projects is that the community often extends them well beyond their initial scope. Kodi has a very robust add-on infrastructure. Most of them are produced by Kodi fans who want to extend its default functionality, and sometimes companies (such as the [Plex][6] content streaming service) release official plugins. Be very careful about adding plugins from untrusted sources. Just because you find an add-on on the internet does not mean it is safe! + +**Be warned:** Add-ons are not supported by Kodi's core team! + +Having said that, there are many useful add-ons that are worth your consideration. In my house, we use Kodi for local playback and Plex when we want to access our content outside the house—with one exception. One of our rooms has a poor WiFi signal. I rip my Blu-Rays to very large MKV files (usually 20–40GB each), and the WiFi (and therefore Kodi) can't handle the files without stuttering. Although you can (and we have) dug into some of the advanced buffering options, even those tweaks have proved insufficient with very large files. Since we already have a Plex server that can transcode content, we solved our problem with a Kodi add-on. + +To show how to install an add-on, I'll use Plex as an example. First, click on **Add-ons** in the side panel and select **Enter add-on browser**. Either use the search function or scroll down until you find Plex. + +![](https://opensource.com/sites/default/files/uploads/11_addons.png) + +Select the Plex add-on and click the **Install** button in the lower right-hand corner. + +![](https://opensource.com/sites/default/files/uploads/13_install_plex_addon.png) + +Once the download completes, you can access Plex on the main Kodi screen under **Add-ons**. + +![](https://opensource.com/sites/default/files/uploads/14_addons_finished_installing.png) + +There are several ways to configure an add-on. Some add-ons, such as NHL TV, are configured via a menu accessed by right-clicking the add-on and selecting Configure. Others, such as Plex, display a configuration walk-through when they launch. If an add-on doesn't seem to be configured when you first launch it, try right-clicking its menu and see if a settings option is available there. + +### Coordinating metadata across Kodi devices + +In our house, we have multiple machines that run Kodi. By default, Kodi tracks metadata, such as a video's watched status and show information, locally. Therefore, content updates on one machine won't appear on any other machine—unless you configure all your Kodi devices to store metadata inside an SQL database (which is a feature Kodi supports). This technique is not particularly difficult, but it is more advanced. If you're willing to put in the effort, here's how to do it. + +#### Before you begin + +There are a few things you need to know before configuring shared status for Kodi. + + 1. All content must be on a network share ([Samba][7], NFS, etc.). + 2. All content must be mounted via the network protocol, even if the disks are local to the machine. That means that no matter where the content is physically located, each client must be configured to use a network fileshare source. + 3. You need to be running an SQL-style database. Kodi's official guide walks through MySQL, but I chose MariaDB. + 4. All clients need to have the database port open (port 3306 in the case of MySQL/MariaDB) or the firewalls disabled. + 5. All clients must be running the same version of Kodi + + + +#### Install and configure the database + +If you're running Ubuntu, you can install MariaDB with the following commands: + +``` +sudo apt update +sudo apt install mariadb-server -y +``` + +I am running MariaDB on an Arch Linux machine. The [Arch Wiki][8] documents the initial setup process well, but I'll summarize it here. + +To install, issue the following command: + +``` +sudo pacman -S mariadb +``` + +Most distributions of MariaDB will have the same setup commands. I recommend that you understand what the commands do, but you can safely take the defaults if you're in a home environment. + +``` +sudo systemctl start mariadb +sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql +sudo mysql_secure_installation +``` + +Next, edit the MariaDB config file. This file is different depending on your distribution. On Ubuntu, you want to edit **/etc/mysql/mariadb.conf.d/50-server.cnf**. On Arch, the file is either **/etc/my.cnf** or **/etc/mysql/my.cnf**. Locate the line that says **bind-address = 127.0.0.1** and change it to your desired Ethernet port's IP address or to **bind-address = 0.0.0.0** if you want it to listen on all interfaces. + +Restart the service so the change will take effect: + +``` +sudo systemctl restart mariadb +``` + +#### Configure Kodi and MariaDB/MySQL + +To enable Kodi to write to the database, one of two things needs to happen: You can create the database yourself, or you can let Kodi do it for you. In this case, since the only database on this system is for Kodi, I'll create a user with the rights to create any databases that Kodi requires. Do NOT do this if the machine runs more than one database. + +``` +mysql -u root -p +CREATE USER 'kodi' IDENTIFIED BY 'kodi'; +GRANT ALL ON core.md Dict.md lctt2014.md lctt2016.md lctt2018.md README.md TO 'kodi'; +flush privileges; +\q +``` + +This grants the user all rights—essentially enabling it to act as a root user. For my purposes, this is fine. + +Next, on each Kodi device where you want to share metadata, create the following file: **/home/ /.kodi/userdata/advancedsettings.xml**. This file can contain a lot of very advanced, tweakable settings. My devices have these settings: + +``` + +    +        mysql +        mysql-arch.example.com +        3306 +        kodi +        kodi +    +    +        true +        true +    +    +        +        1 +        322122547 +        20 +    + +``` + +The **< cache>** section—which sets how much of a file Kodi will buffer over the network— is optional in this scenario. See the [Kodi wiki][9] for a full breakdown of this file and its options. + +Once the configuration is complete, it's a good idea to close and reopen Kodi to make sure the settings are applied. + +The final step is configuring all the Kodi clients to use the same network share for all their content. Only one client needs to scrap/refresh the metadata if everything is created successfully. When data is collected, you should see that Kodi creates a new database on your SQL server: + +``` +[kodi@kodi-mysql ~]$ mysql -u root -p +Enter password: +Welcome to the MariaDB monitor.  Commands end with ; or \g. +Your MariaDB connection id is 180 +Server version: 10.1.37-MariaDB MariaDB Server + +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +MariaDB [(none)]> show databases; ++--------------------+ +| Database           | ++--------------------+ +| MyVideos107        | +| information_schema | +| mysql              | +| performance_schema | ++--------------------+ +4 rows in set (0.00 sec) +``` + +### Wrapping up + +This article walked through how to get up and running with the basic functionality of Kodi. You should be able to add content and pull down metadata to make browsing your media more convenient. + +You also know how to search for, install, and potentially configure add-ons for additional features. Be extra careful when downloading add-ons, as they are provided by the community at large and not the core developers. It's best to use add-ons only from organizations or companies you trust. + +And you know a bit about sharing metadata across multiple devices. You've been introduced to **advancedsettings.xml** ; hopefully it has piqued your interest. Kodi has a lot of dials and knobs to turn, and you can squeeze a lot of performance and functionality out of the platform with enough experimentation. + +Are you interested in doing more tweaking? What are some of your favorite add-ons or settings? Do you want to know how to change the user interface? What are some of your favorite skins? Let me know in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/manage-your-media-kodi + +作者:[Steve Ovens][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stratusss +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/ISO_image +[2]: https://kodi.tv/ +[3]: https://kodi.wiki/view/HOW-TO:Install_Kodi_for_Linux#Fedora +[4]: https://en.wikipedia.org/wiki/Server_Message_Block +[5]: https://en.wikipedia.org/wiki/Zero-configuration_networking +[6]: https://www.plex.tv +[7]: https://www.samba.org/ +[8]: https://wiki.archlinux.org/index.php/MySQL +[9]: https://kodi.wiki/view/Advancedsettings.xml From 0d601499310938115b6a8233acc2c55fd3ce04ac Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 17:05:39 +0800 Subject: [PATCH 0594/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Managing=20dotf?= =?UTF-8?q?iles=20with=20rcm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190104 Managing dotfiles with rcm.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20190104 Managing dotfiles with rcm.md diff --git a/sources/tech/20190104 Managing dotfiles with rcm.md b/sources/tech/20190104 Managing dotfiles with rcm.md new file mode 100644 index 0000000000..88e239caf8 --- /dev/null +++ b/sources/tech/20190104 Managing dotfiles with rcm.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing dotfiles with rcm) +[#]: via: (https://fedoramagazine.org/managing-dotfiles-rcm/) +[#]: author: (Link Dupont https://fedoramagazine.org/author/linkdupont/) + +Managing dotfiles with rcm +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/12/dotfiles-816x345.jpg) + +A hallmark feature of many GNU/Linux programs is the easy-to-edit configuration file. Nearly all common free software programs store configuration settings inside a plain text file, often in a structured format like JSON, YAML or [“INI-like”][1]. These configuration files are frequently found hidden inside a user’s home directory. However, a basic ls won’t reveal them. UNIX standards require that any file or directory name that begins with a period (or “dot”) is considered “hidden” and will not be listed in directory listings unless requested by the user. For example, to list all files using the ls program, pass the -a command-line option. + +Over time, these configuration files become highly customized, and managing them becomes increasingly more challenging as time goes on. Not only that, but keeping them synchronized between multiple computers is a common challenge in large organizations. Finally, many users find a sense of pride in their unique configuration settings and want an easy way to share them with friends. That’s where **rcm** steps in. + +**rcm** is a “rc” file management suite (“rc” is another convention for naming configuration files that has been adopted by some GNU/Linux programs like screen or bash). **rcm** provides a suite of commands to manage and list files it tracks. Install **rcm** using **dnf**. + +### Getting started + +By default, **rcm** uses ~/.dotfiles for storing all the dotfiles it manages. A managed dotfile is actually stored inside ~/.dotfiles, and a symlink is placed in the expected file’s location. For example, if ~/.bashrc is tracked by **rcm** , a long listing would look like this. + +``` +[link@localhost ~]$ ls -l ~/.bashrc +lrwxrwxrwx. 1 link link 27 Dec 16 05:19 .bashrc -> /home/link/.dotfiles/bashrc +[link@localhost ~]$ +``` + +**rcm** consists of 4 commands: + + * mkrc – convert a file into a dotfile managed by rcm + * lsrc – list files managed by rcm + * rcup – synchronize dotfiles managed by rcm + * rcdn – remove all the symlinks managed by rcm + + + +### Share bashrc across two computers + +It is not uncommon today for a user to have shell accounts on more than one computer. Keeping dotfiles synchronized between those computers can be a challenge. This scenario will present one possible solution, using only **rcm** and **git**. + +First, convert (or “bless”) a file into a dotfile managed by **rcm** with mkrc. + +``` +[link@localhost ~]$ mkrc -v ~/.bashrc +Moving... +'/home/link/.bashrc' -> '/home/link/.dotfiles/bashrc' +Linking... +'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' +[link@localhost ~]$ +``` + +Next, verify the listings are correct with lsrc. + +``` +[link@localhost ~]$ lsrc +/home/link/.bashrc:/home/link/.dotfiles/bashrc +[link@localhost ~]$ +``` + +Now create a git repository inside ~/.dotfiles and set up an accessible remote repository using your choice of hosted git repositories. Commit the bashrc file and push a new branch. + +``` +[link@localhost ~]$ cd ~/.dotfiles +[link@localhost .dotfiles]$ git init +Initialized empty Git repository in /home/link/.dotfiles/.git/ +[link@localhost .dotfiles]$ git remote add origin git@github.com:linkdupont/dotfiles.git +[link@localhost .dotfiles]$ git add bashrc +[link@localhost .dotfiles]$ git commit -m "initial commit" +[master (root-commit) b54406b] initial commit +1 file changed, 15 insertions(+) +create mode 100644 bashrc +[link@localhost .dotfiles]$ git push -u origin master +... +[link@localhost .dotfiles]$ +``` + +On the second machine, clone this repository into ~/.dotfiles. + +``` +[link@remotehost ~]$ git clone git@github.com:linkdupont/dotfiles.git ~/.dotfiles +... +[link@remotehost ~]$ +``` + +Now update the symlinks managed by **rcm** with rcup. + +``` +[link@remotehost ~]$ rcup -v +replacing identical but unlinked /home/link/.bashrc +removed '/home/link/.bashrc' +'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' +[link@remotehost ~]$ +``` + +Overwrite the existing ~/.bashrc (if it exists) and restart the shell. + +That’s it! The host-specific option (-o) is a useful addition to the scenario above. And as always, be sure to read the manpages; they contain a wealth of example commands. + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/managing-dotfiles-rcm/ + +作者:[Link Dupont][a] +选题:[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/linkdupont/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/INI_file From 6fbc7480ff5288fc8e39fd4aeec5139c922ef384 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 17:07:01 +0800 Subject: [PATCH 0595/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Setting=20up=20?= =?UTF-8?q?an=20email=20server,=20part=201:=20The=20Forwarder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... an email server, part 1- The Forwarder.md | 224 ++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 sources/tech/20190105 Setting up an email server, part 1- The Forwarder.md diff --git a/sources/tech/20190105 Setting up an email server, part 1- The Forwarder.md b/sources/tech/20190105 Setting up an email server, part 1- The Forwarder.md new file mode 100644 index 0000000000..c6c520e339 --- /dev/null +++ b/sources/tech/20190105 Setting up an email server, part 1- The Forwarder.md @@ -0,0 +1,224 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Setting up an email server, part 1: The Forwarder) +[#]: via: (https://blog.jak-linux.org/2019/01/05/setting-up-an-email-server-part1/) +[#]: author: (Julian Andres Klode https://blog.jak-linux.org/) + +Setting up an email server, part 1: The Forwarder +====== + +This week, I’ve been working on rolling out mail services on my server. I started working on a mail server setup at the end of November, while the server was not yet in use, but only for about two days, and then let it rest. + +As my old shared hosting account expired on January 1, I had to move mail forwarding duties over to the new server. Yes forwarding - I do plan to move hosting the actual email too, but at the moment it’s “just” forwarding to gmail. + +### The Software + +As you might know from the web server story, my server runs on Ubuntu 18.04. I set up a mail server on this system using + + * [Postfix][1] for SMTP duties (warning, they oddly do not have an https page) + * [rspamd][2] for spam filtering, and signing DKIM / ARC + * [bind9][3] for DNS resolving + * [postsrsd][4] for SRS + + + +You might wonder why bind9 is in there. It turns out that DNS blacklists used by spam filters block the caching DNS servers you usually use, so you have to use your own recursive DNS server. Ubuntu offers you the choice between bind9 and dnsmasq in main, and it seems like bind9 is more appropriate here than dnsmasq. + +### Setting up postfix + +Most of the postfix configuration is fairly standard. So, let’s skip TLS configuration and outbound SMTP setups (this is email, and while they support TLS, it’s all optional, so let’s not bother that much here). + +The most important part is restrictions in `main.cf`. + +First of all, relay restrictions prevent us from relaying emails to weird domains: + +``` +# Relay Restrictions +smtpd_relay_restrictions = reject_non_fqdn_recipient reject_unknown_recipient_domain permit_mynetworks permit_sasl_authenticated defer_unauth_destination +``` + +We also only accept mails from hosts that know their own full qualified name: + +``` +# Helo restrictions (hosts not having a proper fqdn) +smtpd_helo_required = yes +smtpd_helo_restrictions = permit_mynetworks reject_invalid_helo_hostname reject_non_fqdn_helo_hostname reject_unknown_helo_hostname +``` + +We also don’t like clients (other servers) that send data too early, or have an unknown hostname: + +``` +smtpd_data_restrictions = reject_unauth_pipelining +smtpd_client_restrictions = permit_mynetworks reject_unknown_client_hostname +``` + +I also set up a custom apparmor profile that’s pretty lose, I plan to migrate to the one in the apparmor git eventually but it needs more testing and some cleanup. + +### Sender rewriting scheme + +For SRS using postsrsd, we define the `SRS_DOMAIN` in `/etc/default/postsrsd` and then configure postfix to talk to it: + +``` +# Handle SRS for forwarding +recipient_canonical_maps = tcp:localhost:10002 +recipient_canonical_classes= envelope_recipient,header_recipient + +sender_canonical_maps = tcp:localhost:10001 +sender_canonical_classes = envelope_sender +``` + +This has a minor issue that it also rewrites the `Return-Path` when it delivers emails locally, but as I am only forwarding, I’m worrying about that later. + +### rspamd basics + +rspamd is a great spam filtering system. It uses a small core written in C and a bunch of Lua plugins, such as: + + * IP score, which keeps track of how good a specific server was in the past + * Replies, which can check whether an email is a reply to another one + * DNS blacklisting + * DKIM and ARC validation and signing + * DMARC validation + * SPF validation + + + +It also has a nice web UI: + +![rspamd web ui status][5] + +rspamd web ui status + +![rspamd web ui investigating a spam message][6] + +rspamd web ui investigating a spam message + +Setting up rspamd is quite easy. You basically just drop a bunch of configuration overrides into `/etc/rspamd/local.d` and you’re done. Heck, it mostly works out of the box. There’s a fancy `rspamadm configwizard` too. + +What you do want for rspamd is a redis server. redis is needed in [many places][7], such as rate limiting, greylisting, dmarc, reply tracking, ip scoring, neural networks. + +I made a few changes to the defaults: + + * I enabled subject rewriting instead of adding headers, so spam mail subjects get `[SPAM]` prepended, in `local.d/actions.conf`: + +``` + reject = 15; +rewrite_subject = 6; +add_header = 6; +greylist = 4; +subject = "[SPAM] %s"; +``` + + * I set `autolearn = true;` in `local.d/classifier-bayes.conf` to make it learn that an email that has a score of at least 15 (those that are rejected) is spam, and emails with negative scores are ham. + + * I set `extended_spam_headers = true;` in `local.d/milter_headers.conf` to get a report from rspamd in the header seeing the score and how the score came to be. + + + + +### ARC setup + +[ARC][8] is the ‘Authenticated Received Chain’ and is currently a DMARC working group work item. It allows forwarders / mailing lists to authenticate their forwarding of the emails and the checks they have performed. + +rspamd is capable of validating and signing emails with ARC, but I’m not sure how much influence ARC has on gmail at the moment, for example. + +There are three parts to setting up ARC: + + 1. Generate a DKIM key pair (use `rspamadm dkim_keygen`) + 2. Setup rspamd to sign incoming emails using the private key + 3. Add a DKIM `TXT` record for the public key. `rspamadm` helpfully tells you how it looks like. + + + +For step two, what we need to do is configure `local.d/arc.conf`. You can basically use the example configuration from the [rspamd page][9], the key point for signing incoming email is to specifiy `sign_incoming = true;` and `use_domain_sign_inbound = "recipient";` (FWIW, none of these options are documented, they are fairly new, and nobody updated the documentation for them). + +My configuration looks like this at the moment: + +``` +# If false, messages with empty envelope from are not signed +allow_envfrom_empty = true; +# If true, envelope/header domain mismatch is ignored +allow_hdrfrom_mismatch = true; +# If true, multiple from headers are allowed (but only first is used) +allow_hdrfrom_multiple = false; +# If true, username does not need to contain matching domain +allow_username_mismatch = false; +# If false, messages from authenticated users are not selected for signing +auth_only = true; +# Default path to key, can include '$domain' and '$selector' variables +path = "${DBDIR}/arc/$domain.$selector.key"; +# Default selector to use +selector = "arc"; +# If false, messages from local networks are not selected for signing +sign_local = true; +# +sign_inbound = true; +# Symbol to add when message is signed +symbol_signed = "ARC_SIGNED"; +# Whether to fallback to global config +try_fallback = true; +# Domain to use for ARC signing: can be "header" or "envelope" +use_domain = "header"; +use_domain_sign_inbound = "recipient"; +# Whether to normalise domains to eSLD +use_esld = true; +# Whether to get keys from Redis +use_redis = false; +# Hash for ARC keys in Redis +key_prefix = "ARC_KEYS"; +``` + +This would also sign any outgoing email, but I’m not sure that’s necessary - my understanding is that we only care about ARC when forwarding/receiving incoming emails, not when sending them (at least that’s what gmail does). + +### Other Issues + +There are few other things to keep in mind when running your own mail server. I probably don’t know them all yet, but here we go: + + * You must have a fully qualified hostname resolving to a public IP address + + * Your public IP address must resolve back to the fully qualified host name + + * Again, you should run a recursive DNS resolver so your DNS blacklists work (thanks waldi for pointing that out) + + * Setup an SPF record. Mine looks like this: + +`jak-linux.org. 3600 IN TXT "v=spf1 +mx ~all"` + +this states that all my mail servers may send email, but others probably should not (a softfail). Not having an SPF record can punish you; for example, rspamd gives missing SPF and DKIM a score of 1. + + * All of that software is sandboxed using AppArmor. Makes you question its security a bit less! + + + + +### Source code, outlook + +As always, you can find the Ansible roles on [GitHub][10]. Feel free to point out bugs! 😉 + +In the next installment of this series, we will be looking at setting up Dovecot, and configuring DKIM. We probably also want to figure out how to run notmuch on the server, keep messages in matching maildirs, and have my laptop synchronize the maildir and notmuch state with the server. Ugh, sounds like a lot of work. + +-------------------------------------------------------------------------------- + +via: https://blog.jak-linux.org/2019/01/05/setting-up-an-email-server-part1/ + +作者:[Julian Andres Klode][a] +选题:[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.jak-linux.org/ +[b]: https://github.com/lujun9972 +[1]: http://www.postfix.org/ +[2]: https://rspamd.com/ +[3]: https://www.isc.org/downloads/bind/ +[4]: https://github.com/roehling/postsrsd +[5]: https://blog.jak-linux.org/2019/01/05/setting-up-an-email-server-part1/rspamd-status.png +[6]: https://blog.jak-linux.org/2019/01/05/setting-up-an-email-server-part1/rspamd-spam.png +[7]: https://rspamd.com/doc/configuration/redis.html +[8]: http://arc-spec.org/ +[9]: https://rspamd.com/doc/modules/arc.html +[10]: https://github.com/julian-klode/ansible.jak-linux.org From e0797ad45f4ebfec38794b30628413bdb1e772a8 Mon Sep 17 00:00:00 2001 From: Bestony Date: Tue, 15 Jan 2019 17:09:14 +0800 Subject: [PATCH 0596/4278] feat translated --- ...ons for open source project maintainers.md | 64 ----------------- ...ons for open source project maintainers.md | 70 +++++++++++++++++++ 2 files changed, 70 insertions(+), 64 deletions(-) delete mode 100644 sources/talk/20181212 5 resolutions for open source project maintainers.md create mode 100644 translated/talk/20181212 5 resolutions for open source project maintainers.md diff --git a/sources/talk/20181212 5 resolutions for open source project maintainers.md b/sources/talk/20181212 5 resolutions for open source project maintainers.md deleted file mode 100644 index 8004b05745..0000000000 --- a/sources/talk/20181212 5 resolutions for open source project maintainers.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (bestony) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 resolutions for open source project maintainers) -[#]: via: (https://opensource.com/article/18/12/resolutions-open-source-project-maintainers) -[#]: author: (Ben Cotton https://opensource.com/users/bcotton) - -5 resolutions for open source project maintainers -====== -No matter how you say it, good communication is essential to strong open source communities. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/spark_sparkler_fire_new_year_idea.png?itok=rnyMpVP8) - -I'm generally not big on New Year's resolutions. I have no problem with self-improvement, of course, but I tend to anchor around other parts of the calendar. Even so, there's something about taking down this year's free calendar and replacing it with next year's that inspires some introspection. - -In 2017, I resolved to not share articles on social media until I'd read them. I've kept to that pretty well, and I'd like to think it has made me a better citizen of the internet. For 2019, I'm thinking about resolutions to make me a better open source software maintainer. - -Here are some resolutions I'll try to stick to on the projects where I'm a maintainer or co-maintainer. - -### 1\. Include a code of conduct - -Jono Bacon included "not enforcing the code of conduct" in his article "[7 mistakes you're probably making][1]." Of course, to enforce a code of conduct, you must first have a code of conduct. I plan on defaulting to the [Contributor Covenant][2], but you can use whatever you like. As with licenses, it's probably best to use one that's already written instead of writing your own. But the important thing is to find something that defines how you want your community to behave, whatever that looks like. Once it's written down and enforced, people can decide for themselves if it looks like the kind of community they want to be a part of. - -### 2\. Make the license clear and specific - -You know what really stinks? Unclear licenses. "This software is licensed under the GPL" with no further text doesn't tell me much. Which version of the [GPL][3]? Do I get to pick? For non-code portions of a project, "licensed under a Creative Commons license" is even worse. I love the [Creative Commons licenses][4], but there are several different licenses with significantly different rights and obligations. So, I will make it very clear which variant and version of a license applies to my projects. I will include the full text of the license in the repo and a concise note in the other files. - -Sort of related to this is using an [OSI][5]-approved license. It's tempting to come up with a new license that says exactly what you want it to say, but good luck if you ever need to enforce it. Will it hold up? Will the people using your project understand it? - -### 3\. Triage bug reports and questions quickly - -Few things in technology scale as poorly as open source maintainers. Even on small projects, it can be hard to find the time to answer every question and fix every bug. But that doesn't mean I can't at least acknowledge the person. It doesn't have to be a multi-paragraph reply. Even just labeling the GitHub issue shows that I saw it. Maybe I'll get to it right away. Maybe I'll get to it a year later. But it's important for the community to see that, yes, there is still someone here. - -### 4\. Don't push features or bug fixes without accompanying documentation - -For as much as my open source contributions over the years have revolved around documentation, my projects don't reflect the importance I put on it. There aren't many commits I can push that don't require some form of documentation. New features should obviously be documented at (or before!) the time they're committed. But even bug fixes should get an entry in the release notes. If nothing else, a push is a good opportunity to also make a commit to improving the docs. - -### 5\. Make it clear when I'm abandoning a project - -I'm really bad at saying "no" to things. I told the editors I'd write one or two articles for [Opensource.com][6] and here I am almost 60 articles later. Oops. But at some point, the things that once held my interests no longer do. Maybe the project is unnecessary because its functionality got absorbed into a larger project. Maybe I'm just tired of it. But it's unfair to the community (and potentially dangerous, as the recent [event-stream malware injection][7] showed) to leave a project in limbo. Maintainers have the right to walk away whenever and for whatever reason, but it should be clear that they have. - -Whether you're an open source maintainer or contributor, if you know other resolutions project maintainers should make, please share them in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/resolutions-open-source-project-maintainers - -作者:[Ben Cotton][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bcotton -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/17/8/mistakes-open-source-avoid -[2]: https://www.contributor-covenant.org/ -[3]: https://opensource.org/licenses/gpl-license -[4]: https://creativecommons.org/share-your-work/licensing-types-examples/ -[5]: https://opensource.org/ -[6]: http://Opensource.com -[7]: https://arstechnica.com/information-technology/2018/11/hacker-backdoors-widely-used-open-source-software-to-steal-bitcoin/ diff --git a/translated/talk/20181212 5 resolutions for open source project maintainers.md b/translated/talk/20181212 5 resolutions for open source project maintainers.md new file mode 100644 index 0000000000..2384da4c3c --- /dev/null +++ b/translated/talk/20181212 5 resolutions for open source project maintainers.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (bestony) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 resolutions for open source project maintainers) +[#]: via: (https://opensource.com/article/18/12/resolutions-open-source-project-maintainers) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +5个为开源项目维护者而生的解决方案 +====== + +不管你怎么说,好的交流是一个活跃的开源社区的必备品。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/spark_sparkler_fire_new_year_idea.png?itok=rnyMpVP8) + +我不会给你一个大而全的新年的解决方案。关于自我提升,我没有任何问题,这篇文章我希望锚定这个日历中的另外一部分。不过即使是这样,这里也有一些关于取消今年的免费日历并将其替换为新的日历的内容,以激发自省。 + +在 2017 年,我从不在社交媒体上分享我从未阅读过的文章。我一直保持这样的状态,我也认为它让我成为了一个更好的互联网公民。对于 2019 年,我正在考虑让我成为更好的开源软件维护者的解决方案。 + + +下面是一些我在一些项目中担任维护者或共同维护者时坚持的决议: + +### 1\. 包含行为准则 + +Jono Bacon 在他的文章“[7个你可能犯的错误][1]”中包含了“不强制执行行为准则”。当然,去强制执行行为准则,你首先需要有一个行为准则。我设计了一个默认的[贡献者契约][2],但是你可以使用其他你喜欢的。关于这个 License ,最好的方法是使用别人已经写好的,而不是你自己写的。但是重要的是,要找到一些能够定义你希望你的社区执行的,无论他们是什么样子。一旦这些被记录下来并强制执行,人们就能自行决定是否成为他们想象中社区的一份子。 + + +### 2\. 使许可证清晰且明确 + +你知道什么真的很烦么?不清晰的许可证。"这个软件基于 GPL 授权",如果没有进一步提供更多信息的文字,我无法知道更多信息。基于哪个版本的[GPL][3]?对于项目的非代码部分,“根据知识共享许可证授权”更糟糕。我喜欢[知识共享许可证][4],但其中有几个不同的许可证包含着不同的权利和义务。因此,我将清楚的说明许可证的版本适用于我的项目。我将会在 repo 中包含许可的全文,并在其他文件中包含简明的注释。 + +与此相关的一类是使用 [OSI][5]批准的许可证。想出一个新的准确的说明了你想要表达什么的许可证是有可能的,但是如果你需要强制执行它,祝你好运。会坚持使用它么?使用您项目的人会理解么? + + + +### 3\. 快速分类错误报告和问题 + +技术的规模很难会和开源维护者一样差。即使在小型项目中,也很难找到时间去回答每个问题并修复每个错误。但这并不意味着我至少不能去回应这个人,它没必要是多段的回复。即使只是标记了 Github Issue 也表明了我看见它了。也许我马上就会处理它,也许一年后我会处理它。但是让社区看到它很重要。是的,这里还有其他人。 + +### 4\. 如果没有伴随的文档,请不要推送新特性或 Bugfix + +尽管多年来我的开源贡献都围绕着文档,但我的项目并没有反映出我对他们的重视。我很少有不需要某种形式文档的推送。新的特性显然应该在他们被提交甚至是之前编写文档。但即使是错误修复,也应该在发行说明中有一个条目。如果没有什么其他的,一个 push 也是很好的改善文档的机会。 + +### 5\. 放弃一个项目时,要说清楚 + +我很擅长对事情说“不”,我告诉编辑我会为 [Opensource.com][6] 写一到两篇文章,现在我有了将近 60 篇文章。Oops。但在某些时候,曾经符合我利益的事情不再有用。也许该项目是不必要的,因为它的功能被吸收到更大的项目中,也许只是我厌倦了它。但这对社区是不公平的(并且存在潜在的危险,正如最近的[event-stream 恶意软件注入][7]所示),会让项目陷入困境。维护者有权随时离开,但他们离开时应该清清楚楚。 + +无论你是开源维护者还是贡献者,如果你知道项目维护者应该作出的其他决议,请在评论中分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/resolutions-open-source-project-maintainers + +作者:[Ben Cotton][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/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/8/mistakes-open-source-avoid +[2]: https://www.contributor-covenant.org/ +[3]: https://opensource.org/licenses/gpl-license +[4]: https://creativecommons.org/share-your-work/licensing-types-examples/ +[5]: https://opensource.org/ +[6]: http://Opensource.com +[7]: https://arstechnica.com/information-technology/2018/11/hacker-backdoors-widely-used-open-source-software-to-steal-bitcoin/ From bf093a5afc300f85a48427548ed082d3372d335b Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 17:38:07 +0800 Subject: [PATCH 0597/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=20JSON=20vs=20XML?= =?UTF-8?q?=20vs=20TOML=20vs=20CSON=20vs=20YAML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...220 JSON vs XML vs TOML vs CSON vs YAML.md | 212 ++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..eeb290c82b --- /dev/null +++ b/sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md @@ -0,0 +1,212 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 8b091115e6fc855210b0df1078092b9250651607 Mon Sep 17 00:00:00 2001 From: pityonline Date: Tue, 15 Jan 2019 23:57:36 +0800 Subject: [PATCH 0598/4278] translating by pityonline --- sources/tech/20190110 5 useful Vim plugins for developers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190110 5 useful Vim plugins for developers.md b/sources/tech/20190110 5 useful Vim plugins for developers.md index 985f6104cc..2b5b9421d4 100644 --- a/sources/tech/20190110 5 useful Vim plugins for developers.md +++ b/sources/tech/20190110 5 useful Vim plugins for developers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (pityonline) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -350,7 +350,7 @@ via: https://opensource.com/article/19/1/vim-plugins-developers 作者:[Ricardo Gerardi][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 107a0472fe96d5dc8048bc9144d25c3623c82cc4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 01:07:36 +0800 Subject: [PATCH 0599/4278] PRF:20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qhwdw 请补充一下脚注,然后我再校对发布~(第一篇也缺了脚注,我会补充) @lujun9972 对于这种带有脚注的文章(这个系列 和 2 bit history 的),可能需要手工调整来增加脚注。 此外,最好补充一下这个系列的开篇。 --- ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 153 +++++++++--------- 1 file changed, 78 insertions(+), 75 deletions(-) diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index db9854b04c..43c76fa0c5 100644 --- a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,16 +1,16 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 - 树莓派:课程 1:OK01 +计算机实验室之树莓派:课程 1 OK01 ====== -OK01 课程讲解了树莓派如何开始,以及在树莓派上如何启用靠近 RCA 和 USB 端口的 `OK` 或 `ACT` 的 **LED** 指示灯。这个指示灯最初是为了指示 `OK` 的,但它在第二版的树莓派上被重命名为 `ACT`。 +OK01 课程讲解了树莓派如何入门,以及在树莓派上如何启用靠近 RCA 和 USB 端口的 OK 或 ACT 的 LED 指示灯。这个指示灯最初是为了指示 OK 状态的,但它在第二版的树莓派上被改名为 ACT。 ### 1、入门 @@ -18,17 +18,13 @@ OK01 课程讲解了树莓派如何开始,以及在树莓派上如何启用靠 ### 2、开始 -``` -扩展名为 '.s' 的文件一般是汇编代码,需要记住的是,在这里它是 ARMv6 的汇编代码。 -``` - -现在,你已经展开了这个模板,在 `source` 目录中创建一个名为 `main.s` 的文件。这个文件包含了这个操作系统的代码。具体来看,这个文件夹的结构应该像下面这样: +现在,你已经展开了这个模板文件,在 `source` 目录中创建一个名为 `main.s` 的文件。这个文件包含了这个操作系统的代码。具体来看,这个文件夹的结构应该像下面这样: ``` build/ - (empty) + (empty) source/ - main.s + main.s kernel.ld LICENSE Makefile @@ -36,6 +32,8 @@ Makefile 用文本编辑器打开 `main.s` 文件,这样我们就可以输入汇编代码了。树莓派使用了称为 ARMv6 的汇编代码变体,这就是我们即将要写的汇编代码类型。 +> 扩展名为 `.s` 的文件一般是汇编代码,需要记住的是,在这里它是 ARMv6 的汇编代码。 + 首先,我们复制下面的这些命令。 ``` @@ -44,13 +42,13 @@ Makefile _start: ``` -实际上,上面这些指令并没有在树莓派上做任何事情,它们是提供给汇编器的指令。汇编器是一个转换程序,它将树莓派能够理解的机器代码转换成我们能够理解的汇编代码,在汇编代码中,每个行都是一个新的命令。上面的第一行告诉汇编器在哪里放我们的代码。我们提供的模板中将它放到一个名为 `.init` 的节中的原因是,它是输出的起始点。这很重要,因为我们希望确保我们能够控制哪个代码首先运行。如果不这样做,首先运行的代码将是按字母顺序排在前面的代码!`.section` 命令简单地告诉汇编器,哪个节中放置代码,从这个点开始,直到下一个 `.section` 或文件结束为止。 +实际上,上面这些指令并没有在树莓派上做任何事情,它们是提供给汇编器的指令。汇编器是一个转换程序,它将我们能够理解的汇编代码转换成树莓派能够理解的机器代码。在汇编代码中,每个行都是一个新的命令。上面的第一行告诉汇编器 [^1] 在哪里放我们的代码。我们提供的模板中将它放到一个名为 `.init` 的节中的原因是,它是输出的起始点。这很重要,因为我们希望确保我们能够控制哪个代码首先运行。如果不这样做,首先运行的代码将是按字母顺序排在前面的代码!`.section` 命令简单地告诉汇编器,哪个节中放置代码,从这个点开始,直到下一个 `.section` 或文件结束为止。 ``` 在汇编代码中,你可以跳行、在命令前或后放置空格去提升可读性。 ``` -接下来两行是停止一个警告消息,它们并不重要。 +接下来两行是停止一个警告消息,它们并不重要。[^2] ### 3、第一行代码 @@ -62,59 +60,55 @@ _start: ldr r0,=0x20200000 ``` -``` -ldr reg,=val 将数字 val 加载到名为 reg 的寄存器中。 -``` +> `ldr reg,=val` 将数字 `val` 加载到名为 `reg` 的寄存器中。 -那是我们的第一个命令。它告诉处理器将数字 0x20200000 保存到寄存器 r0 中。在这里我需要去回答两个问题,寄存器是什么?0x20200000 是一个什么样的数字? +那是我们的第一个命令。它告诉处理器将数字 `0x20200000` 保存到寄存器 `r0` 中。在这里我需要去回答两个问题,寄存器register是什么?`0x20200000` 是一个什么样的数字? -``` -树莓派上的一个单独的寄存器能够保存任何介于 0 到 4,294,967,295(含) 之间的任意整数,它可能看起来像一个很大的内存,实际上它仅有 32 个二进制比特。 -``` +寄存器在处理器中就是一个极小的内存块,它是处理器保存正在处理的数字的地方。处理器中有很多寄存器,很多都有专门的用途,我们在后面会一一接触到它们。最重要的有十三个(命名为 `r0`、`r1`、`r2`、…、`r9`、`r10`、`r11`、`r12`),它们被称为通用寄存器,你可以使用它们做任何计算。由于是写我们的第一行代码,我们在示例中使用了 `r0`,当然你可以使用它们中的任何一个。只要后面始终如一就没有问题。 -一个寄存器在处理器中就是一个极小的内存块,它是处理器保存正在处理的数字的地方。处理器中有很多寄存器,很多都有专门的用途,我们在后面会一一接触到它们。重要的是,它们有十三个(命名为 r0、r1、r2、…、r9、r10、r11、r12),它们被称为通用寄存器,你可以使用它们做任何计算。由于是写我们的第一行代码,我们在示例中使用了 r0,当然你可以使用它们中的任何一个。只要后面始终如一就没有问题。 +> 树莓派上的一个单独的寄存器能够保存任何介于 `0` 到 `4,294,967,295`(含)之间的任意整数,它可能看起来像一个很大的内存,实际上它仅有 32 个二进制比特。 -0x20200000 是一个准确的数字。只不过它是以十六进制表示的。下面的内容详细解释了十六进制的相关信息: +`0x20200000` 确实是一个数字。只不过它是以十六进制表示的。下面的内容详细解释了十六进制的相关信息: -十六进制是另一种表示数字的方式。你或许只知道十进制的数字表示方法,十进制共有十个数字:0、1、2、3、4、5、6、7、8 和 9。十六进制共有十六个数字:0、1、2、3、4、5、6、7、8、9、a、b、c、d、e 和 f。 +> 延伸阅读:十六进制解释 -![567 is 5 hundreds, 6 tens and 7 units.][2] +> 十六进制是另一种表示数字的方式。你或许只知道十进制的数字表示方法,十进制共有十个数字:`0`、`1`、`2`、`3`、`4`、`5`、`6`、`7`、`8` 和 `9`。十六进制共有十六个数字:`0`、`1`、`2`、`3`、`4`、`5`、`6`、`7`、`8`、`9`、`a`、`b`、`c`、`d`、`e` 和 `f`。 -你可能还记得十进制是如何用位制来表示的。即最右侧的数字是个位,紧接着的左边一位是十位,再接着的左边一位是百位,依此类推。也就是说,它的值是 100 × 百位的数字,再加上 10 × 十位的数字,再加上 1 × 个位的数字。 +> 你可能还记得十进制是如何用位制来表示的。即最右侧的数字是个位,紧接着的左边一位是十位,再接着的左边一位是百位,依此类推。也就是说,它的值是 100 × 百位的数字,再加上 10 × 十位的数字,再加上 1 × 个位的数字。 -![567 is 5x10^2+6x10^1+7x10^0][3] +> ![567 is 5 hundreds, 6 tens and 7 units.][2] -从数学的角度来看,我们可以发现规律,最右侧的数字是 100=1s,紧接着的左边一位是 101=10s,再接着是 102=100s,依此类推。我们设定在系统中,0 是最低位,紧接着是 1,依此类推。但如果我们使用一个不同于 10 的数字为幂底会是什么样呢?我们在系统中使用的十六进制就是这样的一个数字。 +> 从数学的角度来看,我们可以发现规律,最右侧的数字是 100 = 1s,紧接着的左边一位是 101 = 10s,再接着是 102 = 100s,依此类推。我们设定在系统中,0 是最低位,紧接着是 1,依此类推。但如果我们使用一个不同于 10 的数字为幂底会是什么样呢?我们在系统中使用的十六进制就是这样的一个数字。 -![567 = 5x10^2+6x10^1+7x10^0 = 2x16^2+3x16^1+7x16^0][4] +> ![567 is 5x10^2+6x10^1+7x10^0][3] -上面的数学等式表明,十进制的数字 567 等于十六进制的数字 237。通常我们需要在系统中明确它们,我们使用下标 10 表示它是十进制数字,用下标 16 表示它是十六进制数字。由于在汇编代码中写上下标的小数字很困难,因此我们使用 0x 来表示它是一个十六进制的数字,因此 0x237 的意思就是 23716 。 +> ![567 = 5x10^2+6x10^1+7x10^0 = 2x16^2+3x16^1+7x16^0][4] -那么,后面的 a、b、c、d、e 和 f 又是什么呢?好问题!在十六进制中为了能够写每个数字,我们就需要额外的东西。例如 916 = 9×160 = 910 ,但是 1016 = 1×161 + 1×160 = 1610 。因此,如果我们只使用 0、1、2、3、4、5、6、7、8 和 9,我们就无法写出 1010 、1110 、1210 、1310 、1410 、1510 。因此我们引入了 6 个新的数字,这样 a16 = 1010 、b16 = 1110 、c16 = 1210 、d16 = 1310 、e16 = 1410 、f16 = 1510 。 +> 上面的数学等式表明,十进制的数字 567 等于十六进制的数字 237。通常我们需要在系统中明确它们,我们使用下标 10 表示它是十进制数字,用下标 16 表示它是十六进制数字。由于在汇编代码中写上下标的小数字很困难,因此我们使用 0x 来表示它是一个十六进制的数字,因此 0x237 的意思就是 23716 。 -所以,我们就有了另一种写数字的方式。但是我们为什么要这么麻烦呢?好问题!由于计算机总是工作在二进制中,事实证明,十六进制是非常有用的,因为每个十六进制数字正好是四个二进制数字的长度。这种方法还有另外一个好处,那就是许多计算机的数字都是十六进制的整数倍,而不是十进制的整数倍。比如,我在上面的汇编代码中使用的一个数字 2020000016 。如果我们用十进制来写,它就是一个不太好记住的数字 53896806410 。 +> 那么,后面的 `a`、`b`、`c`、`d`、`e` 和 `f` 又是什么呢?好问题!在十六进制中为了能够写每个数字,我们就需要额外的东西。例如 916 = 9×160 = 910 ,但是 1016 = 1×161 + 1×160 = 1610 。因此,如果我们只使用 0、1、2、3、4、5、6、7、8 和 9,我们就无法写出 1010 、1110 、1210 、1310 、1410 、1510 。因此我们引入了 6 个新的数字,这样 a16 = 1010 、b16 = 1110 、c16 = 1210 、d16 = 1310 、e16 = 1410 、f16 = 1510 。 -我们可以用下面的简单方法将十进制转换成十六进制: +> 所以,我们就有了另一种写数字的方式。但是我们为什么要这么麻烦呢?好问题!由于计算机总是工作在二进制中,事实证明,十六进制是非常有用的,因为每个十六进制数字正好是四个二进制数字的长度。这种方法还有另外一个好处,那就是许多计算机的数字都是十六进制的整数倍,而不是十进制的整数倍。比如,我在上面的汇编代码中使用的一个数字 2020000016 。如果我们用十进制来写,它就是一个不太好记住的数字 53896806410 。 -![Conversion example][5] +> 我们可以用下面的简单方法将十进制转换成十六进制: - 1. 我们以十进制数字 567 为例来说明。 - 2. 将十进制数字 567 除以 16 并计算其余数。例如 567 ÷ 16 = 35 余数为 7。 - 3. 在十六进制中余数就是答案中的最后一位数字,在我们的例子中它是 7。 - 4. 重复第 2 步和第 3 步,直到除法结果的整数部分为 0。例如 35 ÷ 16 = 2 余数为 3,因此 3 就是答案中的下一位。2 ÷ 16 = 0 余数为 2,因此 2 就是答案的接下来一位。 - 5. 一旦除法结果的整数部分为 0 就结束了。答案就是反序的余数,因此 56710 = 23716。 +> ![Conversion example][5] +> 1. 我们以十进制数字 567 为例来说明。 +> 2. 将十进制数字 567 除以 16 并计算其余数。例如 567 ÷ 16 = 35 余数为 7。 +> 3. 在十六进制中余数就是答案中的最后一位数字,在我们的例子中它是 7。 +> 4. 重复第 2 步和第 3 步,直到除法结果的整数部分为 0。例如 35 ÷ 16 = 2 余数为 3,因此 3 就是答案中的下一位。2 ÷ 16 = 0 余数为 2,因此 2 就是答案的接下来一位。 +> 5. 一旦除法结果的整数部分为 0 就结束了。答案就是反序的余数,因此 56710 = 23716。 +> 转换十六进制数字为十进制,也很容易,将数字展开即可,因此 23716 = 2×162 + 3×161 +7 ×160 = 2×256 + 3×16 + 7×1 = 512 + 48 + 7 = 567。 -转换十六进制数字为十进制,也很容易,将数字展开即可,因此 23716 = 2×162 + 3×161 +7 ×160 = 2×256 + 3×16 + 7×1 = 512 + 48 + 7 = 567。 - -因此,我们所写的第一个汇编命令是将数字 2020000016 加载到寄存器 r0 中。那个命令看起来似乎没有什么用,但事实并非如此。在计算机中,有大量的内存块和设备。为了能够访问它们,我们给每个内存块和设备指定了一个地址。就像邮政地址或网站地址一样,它用于标识我们想去访问的内存块或设备的位置。计算机中的地址就是一串数字,因此上面的数字 2020000016 就是 GPIO 控制器的地址。这个地址是由制造商的设计所决定的,他们也可以使用其它地址(只要不与其它的冲突即可)。我之所以知道这个地址是 GPIO 控制器的地址是因为我看了它的[手册][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf],地址的使用没有专门的规范(除了它们都是以十六进制表示的大数以外)。 +因此,我们所写的第一个汇编命令是将数字 2020000016 加载到寄存器 `r0` 中。那个命令看起来似乎没有什么用,但事实并非如此。在计算机中,有大量的内存块和设备。为了能够访问它们,我们给每个内存块和设备指定了一个地址。就像邮政地址或网站地址一样,它用于标识我们想去访问的内存块或设备的位置。计算机中的地址就是一串数字,因此上面的数字 2020000016 就是 GPIO 控制器的地址。这个地址是由制造商的设计所决定的,他们也可以使用其它地址(只要不与其它的冲突即可)。我之所以知道这个地址是 GPIO 控制器的地址是因为我看了它的手册,[^3] 地址的使用没有专门的规范(除了它们都是以十六进制表示的大数以外)。 ### 4、启用输出 ![A diagram showing key parts of the GPIO controller.][6] -阅读了手册可以得知,我们需要给 GPIO 控制器发送两个消息。我们必须用它的语言告诉它,如果我们这样做了,它将非常乐意实现我们的意图,去打开 `OK` 的 LED 指示灯。幸运的是,它是一个非常简单的芯片,为了让它能够理解我们要做什么,只需要给它设定几个数字即可。 +阅读了手册可以得知,我们需要给 GPIO 控制器发送两个消息。我们必须用它的语言告诉它,如果我们这样做了,它将非常乐意实现我们的意图,去打开 OK 的 LED 指示灯。幸运的是,它是一个非常简单的芯片,为了让它能够理解我们要做什么,只需要给它设定几个数字即可。 ``` mov r1,#1 @@ -122,51 +116,51 @@ lsl r1,#18 str r1,[r0,#4] ``` -``` -mov reg,#val 将数字 val 放到名为 reg 的寄存器中。 +> `mov reg,#val` 将数字 `val` 放到名为 `reg` 的寄存器中。 -lsl reg,#val 将寄存器 reg 中的二进制操作数左移 val 位。 +> `lsl reg,#val` 将寄存器 `reg` 中的二进制操作数左移 `val` 位。 -str reg,[dest,#val] 将寄存器 reg 中的数字保存到地址 dest + val 上。 -``` +> `str reg,[dest,#val]` 将寄存器 `reg` 中的数字保存到地址 `dest + val` 上。 -这些命令的作用是在 GPIO 的第 16 号插针上启用输出。首先我们在寄存器 r1 中获取一个必需的值,接着将这个值发送到 GPIO 控制器。因此,前两个命令是尝试取值到寄存器 r1 中,我们可以像前面一样使用另一个命令 `ldr` 来实现,但 `lsl` 命令对我们后面能够设置任何给定的 GPIO 针比较有用,因此从一个公式中推导出值要比直接写入来好一些。表示 `OK` 的 LED 灯是直接连线到 GPIO 的第 16 号针脚上的,因此我们需要发送一个命令去启用第 16 号针脚。 +这些命令的作用是在 GPIO 的第 16 号插针上启用输出。首先我们在寄存器 `r1` 中获取一个必需的值,接着将这个值发送到 GPIO 控制器。因此,前两个命令是尝试取值到寄存器 `r1` 中,我们可以像前面一样使用另一个命令 `ldr` 来实现,但 `lsl` 命令对我们后面能够设置任何给定的 GPIO 针比较有用,因此从一个公式中推导出值要比直接写入来好一些。表示 OK 的 LED 灯是直接连线到 GPIO 的第 16 号针脚上的,因此我们需要发送一个命令去启用第 16 号针脚。 -寄存器 r1 中的值是启用 LED 针所需要的。第一行命令将数字 110 放到 r1 中。在这个操作中 `mov` 命令要比 `ldr` 命令快很多,因为它不需要与内存交互,而 `ldr` 命令是将需要的值从内存中加载到寄存器中。尽管如此,`mov` 命令仅能用于加载某些值。在 ARM 汇编代码中,基本上每个指令都使用一个三字母代码表示。它们被称为助记词,用于表示操作的用途。`mov` 是 “move" 的简写,而 `ldr` 是 “load register” 的简写。`mov` 是将第二个参数 #1 移动到前面的 r1 寄存器中。一般情况下,`#` 肯定是表示一个数字,但我们已经看到了不符合这种情况的一个反例。 +寄存器 `r1` 中的值是启用 LED 针所需要的。第一行命令将数字 110 放到 `r1` 中。在这个操作中 `mov` 命令要比 `ldr` 命令快很多,因为它不需要与内存交互,而 `ldr` 命令是将需要的值从内存中加载到寄存器中。尽管如此,`mov` 命令仅能用于加载某些值。[^4] 在 ARM 汇编代码中,基本上每个指令都使用一个三字母代码表示。它们被称为助记词,用于表示操作的用途。`mov` 是 “move” 的简写,而 `ldr` 是 “load register” 的简写。`mov` 是将第二个参数 `#1` 移动到前面的 `r1` 寄存器中。一般情况下,`#` 肯定是表示一个数字,但我们已经看到了不符合这种情况的一个反例。 第二个指令是 `lsl`(逻辑左移)。它的意思是将第一个参数的二进制操作数向左移第二个参数所表示的位数。在这个案例中,将 110 (即 12 )向左移 18 位(将它变成 10000000000000000002=26214410 )。 如果你不熟悉二进制表示法,可以看下面的内容: -与十六进制一样,二进制是写数字的另一种方法。在二进制中只有两个数字,即 0 和 1。它在计算机中非常有用,因为我们可以用电路来实现它,即电流能够通过电路表示为 1,而电流不能通过电路表示为 0。这就是计算机能够完成真实工作和做数学运算的原理。尽管二进制只有两个数字,但它却能够表示任何一个数字,只是写起来有点长而已。 +> 延伸阅读: 二进制解释 -![567 in decimal = 1000110111 in binary][7] +> 与十六进制一样,二进制是写数字的另一种方法。在二进制中只有两个数字,即 `0` 和 `1`。它在计算机中非常有用,因为我们可以用电路来实现它,即电流能够通过电路表示为 `1`,而电流不能通过电路表示为 `0`。这就是计算机能够完成真实工作和做数学运算的原理。尽管二进制只有两个数字,但它却能够表示任何一个数字,只是写起来有点长而已。 -这个图片展示了 56710 的二进制表示是 10001101112 。我们使用下标 2 来表示这个数字是用二进制写的。 +> ![567 in decimal = 1000110111 in binary][7] -我们在汇编代码中大量使用二进制的其中一个巧合之处是,数字可以很容易地被 2 的幂(即 1、2、4、8、16)乘或除。通常乘法和除法都是非常难的,而在某些特殊情况下却变得非常容易,所以二进制非常重要。 +> 这个图片展示了 56710 的二进制表示是 10001101112 。我们使用下标 2 来表示这个数字是用二进制写的。 -![13*4 = 52, 1101*100=110100][8] +> 我们在汇编代码中大量使用二进制的其中一个巧合之处是,数字可以很容易地被 `2` 的幂(即 `1`、`2`、`4`、`8`、`16`)乘或除。通常乘法和除法都是非常难的,而在某些特殊情况下却变得非常容易,所以二进制非常重要。 -将一个二进制数字左移 **n** 位就相当于将这个数字乘以 2 **n**。因此,如果我们想将一个数乘以 4,我们只需要将这个数字左移 2 位。如果我们想将它乘以 256,我们只需要将它左移 8 位。如果我们想将一个数乘以 12 这样的数字,我们可以有一个替代做法,就是先将这个数乘以 8,然后再将那个数乘以 4,最后将两次相乘的结果相加即可得到最终结果(N × 12 = N × (8 + 4) = N × 8 + N × 4)。 +> ![13*4 = 52, 1101*100=110100][8] -![53/16 = 3, 110100/10000=11][9] +> 将一个二进制数字左移 `n` 位就相当于将这个数字乘以 2n。因此,如果我们想将一个数乘以 4,我们只需要将这个数字左移 2 位。如果我们想将它乘以 256,我们只需要将它左移 8 位。如果我们想将一个数乘以 12 这样的数字,我们可以有一个替代做法,就是先将这个数乘以 8,然后再将那个数乘以 4,最后将两次相乘的结果相加即可得到最终结果(N × 12 = N × (8 + 4) = N × 8 + N × 4)。 -右移一个二进制数 **n** 位就相当于这个数除以 2 **n** 。在右移操作中,除法的余数位将被丢弃。不幸的是,如果对一个不能被 2 的幂次方除尽的二进制数字做除法是非常难的,这将在 [课程 9:Screen04][10] 中讲到。 +> ![53/16 = 3, 110100/10000=11][9] -![Binary Terminology][11] +> 右移一个二进制数 `n` 位就相当于这个数除以 2n 。在右移操作中,除法的余数位将被丢弃。不幸的是,如果对一个不能被 2 的幂次方除尽的二进制数字做除法是非常难的,这将在 [课程 9 Screen04][10] 中讲到。 -这个图展示了二进制常用的术语。一个比特bit就是一个单独的二进制位。一个“半字节nibble“ 是 4 个二进制位。一个字节byte是 2 个半字节,也就是 8 个比特。在一个word用两个字节来表示的情况下,一半是指一个字长度的一半。一个字是指处理器上寄存器的大小,因此,树莓派的字长是 4 字节。按惯例,将一个数字最高有效位标识为 31,而将最低有效位标识为 0。顶部或最高位表示最高有效位,而底部或最低位表示最低有效位。一个 kilobyte(KB)就是 1000 字节,一个 megabyte 就是 1000 KB。这样表示会导致一些困惑,到底应该是 1000 还是 1024(二进制中的整数)。鉴于这种情况,新的国际标准规定,一个 KB 等于 1000 字节,而一个 Kibibyte(KiB)是 1024 字节。一个 Kb 是 1000 比特,而一个 Kib 是 1024 比特。 +> ![Binary Terminology][11] -树莓派默认采用小端法,也就是说,你刚才写的从地址上加载一个字节时,是从一个字的低位字节开始加载的。 +> 这个图展示了二进制常用的术语。一个比特bit就是一个单独的二进制位。一个“半字节nibble“ 是 4 个二进制位。一个字节byte是 2 个半字节,也就是 8 个比特。半字half是指一个字长度的一半,这里是 2 个字节。word是指处理器上寄存器的大小,因此,树莓派的字长是 4 字节。按惯例,将一个字最高有效位标识为 31,而将最低有效位标识为 0。顶部或最高位表示最高有效位,而底部或最低位表示最低有效位。一个 kilobyte(KB)就是 1000 字节,一个 megabyte 就是 1000 KB。这样表示会导致一些困惑,到底应该是 1000 还是 1024(二进制中的整数)。鉴于这种情况,新的国际标准规定,一个 KB 等于 1000 字节,而一个 Kibibyte(KiB)是 1024 字节。一个 Kb 是 1000 比特,而一个 Kib 是 1024 比特。 -再强调一次,我们只有去阅读手册才能知道我们所需要的值。手册上说,GPIO 控制器中有一个 24 字节的集合,由它来决定 GPIO 针脚的设置。第一个 4 字节与前 10 个 GPIO 针脚有关,第二个 4 字节与接下来的 10 个针脚有关,依此类推。总共有 54 个 GPIO 针脚,因此,我们需要 6 个 4 字节的一个集合,总共是 24 个字节。在每个 4 字节中,每 3 个比特与一个特定的 GPIO 针脚有关。我们想去启用的是第 16 号 GPIO 针脚,因此我们需要去设置第二组 4 字节,因为第二组的 4 字节用于处理 GPIO 针脚的第 10-19 号,而我们需要 3 比特集合的第 6 位,它在上面的代码中的编号是 18(6×3)。 +> 树莓派默认采用小端法,也就是说,从你刚才写的地址上加载一个字节时,是从一个字的低位字节开始加载的。 -最后的 `str`(store register)命令去保存第一个参数中的值,将寄存器 r1 中的值保存到后面的表达式计算出来的地址上。这个表达式可以是一个寄存器,在上面的例子中是 r0,我们知道 r0 中保存了GPIO 控制器的地址,而另一个值是加到它上面的,在这个例子中是 #4。它的意思是将 GPIO 控制器地址加上 4 得到一个新的地址,并将寄存器 r1 中的值写到那个地址上。那个地址就是我们前面提到的第二个 4 字节集合的位置,因此,我们发送我们的第一个消息到 GPIO 控制器上,告诉它准备启用 GPIO 第 16 号针脚的输出。 +再强调一次,我们只有去阅读手册才能知道我们所需要的值。手册上说,GPIO 控制器中有一个 24 字节的集合,由它来决定 GPIO 针脚的设置。第一个 4 字节与前 10 个 GPIO 针脚有关,第二个 4 字节与接下来的 10 个针脚有关,依此类推。总共有 54 个 GPIO 针脚,因此,我们需要 6 个 4 字节的一个集合,总共是 24 个字节。在每个 4 字节中,每 3 个比特与一个特定的 GPIO 针脚有关。我们想去启用的是第 16 号 GPIO 针脚,因此我们需要去设置第二组 4 字节,因为第二组的 4 字节用于处理 GPIO 针脚的第 10-19 号,而我们需要第 6 组 3 比特,它在上面的代码中的编号是 18(6×3)。 -### 5、一个活跃信号 +最后的 `str`(“store register”)命令去保存第一个参数中的值,将寄存器 `r1` 中的值保存到后面的表达式计算出来的地址上。这个表达式可以是一个寄存器,在上面的例子中是 `r0`,我们知道 `r0` 中保存了 GPIO 控制器的地址,而另一个值是加到它上面的,在这个例子中是 `#4`。它的意思是将 GPIO 控制器地址加上 `4` 得到一个新的地址,并将寄存器 `r1` 中的值写到那个地址上。那个地址就是我们前面提到的第二组 4 字节的位置,因此,我们发送我们的第一个消息到 GPIO 控制器上,告诉它准备启用 GPIO 第 16 号针脚的输出。 -现在,LED 已经做好了打开准备,我们还需要实际去打开它。意味着需要给 GPIO 控制器发送一个消息去关闭 16 号针脚。是的,你没有看错,就是要发送一个关闭的消息。芯片制造商认为,在 GPIO 针脚关闭时打开 LED 更有意义。硬件工程师经常做这种反常理的决策,似乎是为了让操作系统开发者保持警觉。可以认为是给自己的一个警告。 +### 5、生命的信号 + +现在,LED 已经做好了打开准备,我们还需要实际去打开它。意味着需要给 GPIO 控制器发送一个消息去关闭 16 号针脚。是的,你没有看错,就是要发送一个关闭的消息。芯片制造商认为,在 GPIO 针脚关闭时打开 LED 更有意义。[^5] 硬件工程师经常做这种反常理的决策,似乎是为了让操作系统开发者保持警觉。可以认为是给自己的一个警告。 ``` mov r1,#1 @@ -174,26 +168,25 @@ lsl r1,#16 str r1,[r0,#40] ``` -希望你能够认识上面全部的命令,先不要管它的值。第一个命令和前面一样,是将值 1 推入到寄存器 r1 中。第二个命令是将二进制的 1 左移 16 位。由于我们是希望关闭 GPIO 的 16 号针脚,我们需要在下一个消息中将第 16 比特设置为 1(想设置其它针脚只需要改变相应的比特位即可)。最后,我们写这个值到 GPIO 控制器地址加上 4010 的地址上,这将使那个针脚关闭(加上 28 将打开针脚)。 +希望你能够认识上面全部的命令,先不要管它的值。第一个命令和前面一样,是将值 `1` 推入到寄存器 `r1` 中。第二个命令是将二进制的 `1` 左移 16 位。由于我们是希望关闭 GPIO 的 16 号针脚,我们需要在下一个消息中将第 16 比特设置为 1(想设置其它针脚只需要改变相应的比特位即可)。最后,我们写这个值到 GPIO 控制器地址加上 4010 的地址上,这将使那个针脚关闭(加上 28 将打开针脚)。 ### 6、永远幸福快乐 -现在结束,可能有点意犹未尽,但不幸的是,处理器并不知道我们做了什么。事实上,处理器只要通电,它就永不停止地运转。因此,我们需要给它一个任务,让它一直运转下去,否则,树莓派将进入休眠(本示例中不会,因为 LED 灯一直亮着)。 +似乎我们现在就可以结束了,但不幸的是,处理器并不知道我们做了什么。事实上,处理器只要通电,它就永不停止地运转。因此,我们需要给它一个任务,让它一直运转下去,否则,树莓派将进入休眠(本示例中不会,LED 灯会一直亮着)。 ``` loop$: b loop$ -``` ``` -name: labels 下一行的名字。 -b label 下一行将去运行标签。 -``` +> `name:` 下一行的名字。 -第一行不是一个命令,而是一个标签。它是下一行循环 `loop$` 的名字,这意味着我们能够通过名字来指向到行。这就称为一个标签。当代码被转换成二进制后,标签将被丢弃,但这对我们通过名字而不是数字(地址)找到行比较有用。按惯例,我们使用一个 ​$ 表示标签,这个标签只对这个代码块中的代码起作用,让其它人知道,它不对整个程序起作用。`b`(branch)命令将去运行指定的标签中的命令,而不是去运行它后面的下一个命令。因此,下一行将再次去运行这个 `b` 命令,这将导致永远循环下去。因此处理器将进入一个无限循环中,直到它安全关闭为止。 +> `b label` 下一行将去标签 `label` 处运行。 -代码块结尾的新行是有意这样写的。GNU 工具链要求所有的汇编代码文件都是以空行结束的,因此,这就需要你确保确实是要结束了,并且文件不能被截断。如果你不这样处理,在汇编器运行时,你将收到烦人的警告。 +第一行不是一个命令,而是一个标签。它给下一行命名为 `loop$`,这意味着我们能够通过名字来指向到该行。这就称为一个标签。当代码被转换成二进制后,标签将被丢弃,但这对我们通过名字而不是数字(地址)找到行比较有用。按惯例,我们使用一个 `​$` 表示这个标签只对这个代码块中的代码起作用,让其它人知道,它不对整个程序起作用。`b`(“branch”)命令将去运行指定的标签中的命令,而不是去运行它后面的下一个命令。因此,下一行将再次去运行这个 `b` 命令,这将导致永远循环下去。因此处理器将进入一个无限循环中,直到它安全关闭为止。 + +代码块结尾的一个空行是有意这样写的。GNU 工具链要求所有的汇编代码文件都是以空行结束的,因此,这就可以你确实是要结束了,并且文件没有被截断。如果你不这样处理,在汇编器运行时,你将收到烦人的警告。 ### 7、树莓派上场 @@ -201,7 +194,17 @@ b label 下一行将去运行标签。 为安装你的操作系统,需要先有一个已经安装了树莓派操作系统的 SD 卡。如果你浏览 SD 卡中的文件,你应该能看到一个名为 `kernel.img` 的文件。将这个文件重命名为其它名字,比如 `kernel_linux.img`。然后,复制你编译的 `kernel.img` 文件到 SD 卡中原来的位置,这将用你的操作系统镜像文件替换现在的树莓派操作系统镜像。想切换回来时,只需要简单地删除你自己的 `kernel.img` 文件,然后将前面重命名的文件改回 `kernel.img` 即可。我发现,保留一个原始的树莓派操作系统的备份是非常有用的,万一你要用到它呢。 -将这个 SD 卡插入到树莓派,并打开它的电源。这个 `OK` 的 LED 灯将亮起来。如果不是这样,请查看故障排除页面。如果一切如愿,恭喜你,你已经写出了你的第一个操作系统。[课程 2:OK02][12] 将指导你让 LED 灯闪烁和关闭闪烁。 +将这个 SD 卡插入到树莓派,并打开它的电源。这个 OK 的 LED 灯将亮起来。如果不是这样,请查看故障排除页面。如果一切如愿,恭喜你,你已经写出了你的第一个操作系统。[课程 2 OK02][12] 将指导你让 LED 灯闪烁和关闭闪烁。 + +[^1]: OK, I'm lying it tells the linker, which is another program used to link several assembled files together. It doesn't really matter. +[^2]: Clearly they're important to you. Since the GNU toolchain is mainly used for creating programs, it expects there to be an entry point labelled `_start`. As we're making an operating system, the `_start` is always whatever comes first, which we set up with the `.section .init` command. However, if we don't say where the entry point is, the toolchain gets upset. Thus, the first line says that we are going to define a symbol called `_start` for all to see (globally), and the second line says to make the symbol `_start` the address of the next line. We will come onto addresses shortly. +[^3]: This tutorial is designed to spare you the pain of reading it, but, if you must, it can be found here [SoC-Peripherals.pdf](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf). For added confusion, the manual uses a different addressing system. An address listed as 0x7E200000 would be 0x20200000 in our OS. +[^4]: Only values which have a binary representation which only has 1s in the first 8 bits of the representation. In other words, 8 1s or 0s followed by only 0s. +[^5]: A hardware engineer was kind enough to explain this to me as follows: + + The reason is that modern chips are made of a technology called CMOS, which stands for Complementary Metal Oxide Semiconductor. The Complementary part means each signal is connected to two transistors, one made of material called N-type semiconductor which is used to pull it to a low voltage and another made of P-type material to pull it to a high voltage. Only one transistor of the pair turns on at any time, otherwise we'd get a short circuit. P-type isn't as conductive as N-type, which means the P-type transistor has to be about 3 times as big to provide the same current. This is why LEDs are often wired to turn on by pulling them low, because the N-type is stronger at pulling low than the P-type is in pulling high. + + There's another reason. Back in the 1970s chips were made out of entirely out of N-type material ('NMOS'), with the P-type replaced by a resistor. That means that when a signal is pulled low the chip is consuming power (and getting hot) even while it isn't doing anything. Your phone getting hot and flattening the battery when it's in your pocket doing nothing wouldn't be good. So signals were designed to be 'active low' so that they're high when inactive and so don't take any power. Even though we don't use NMOS any more, it's still often quicker to pull a signal low with the N-type than to pull it high with the P-type. Often a signal that's 'active low' is marked with a bar over the top of the name, or written as SIGNAL_n or /SIGNAL. But it can still be confusing, even for hardware engineers! -------------------------------------------------------------------------------- @@ -210,7 +213,7 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.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/) 荣誉推出 From 6e248c3019e4b50fc51d641f493cd2cfb1629f78 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 01:14:37 +0800 Subject: [PATCH 0600/4278] PRF:20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md --- ...ter Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index a9442dc04c..7feabfede3 100644 --- a/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -14,7 +14,7 @@ ### 1、操作系统 -操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话,也需要操作系统,它可能使用的操作系统是 Android、iOS 和 [Windows Phone](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note1)。 +操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话,也需要操作系统,它可能使用的操作系统是 Android、iOS 和 Windows Phone。 [^1] 由于操作系统是用来与计算机系统上的硬件进行交互的,所以它必须了解系统上硬件专有的信息。为了能让操作系统适用于各种类型的计算机,发明了 **驱动程序** 的概念。驱动程序是为了能够让操作系统与特定的硬件进行交互而添加(并可删除)到操作系统上的一小部分代码。在本课程中,我们并不涉及如何创建可删除的驱动程序,而是专注于特定的一个硬件:树莓派。 @@ -26,7 +26,7 @@ 本课程几乎要完全靠汇编代码来写。汇编代码非常接近计算机的底层。计算机其实是靠一个叫处理器的设备来工作的,处理器能够执行像加法这样的简单任务,还有一组叫做 RAM 的芯片,它能够用来保存数字。当计算机通电后,处理器执行程序员给定的一系列指令,这将导致内存中的数字发生变化,以及与连接的硬件进行交互。汇编代码只是将这些机器命令转换为人类可读的文本。 -常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic 等等来写代码,然后一个叫编译器的程序将程序员写的代码转换成汇编代码,然后进一步转换为[二进制代码](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note2)。二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。 +常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic 等等来写代码,然后一个叫编译器的程序将程序员写的代码转换成汇编代码,然后进一步转换为二进制代码。[^2] 二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。 ![Compiler process][1] @@ -34,6 +34,9 @@ 现在,你已经准备好进入第一节课了,它是 [课程 1 OK01][2] +[^1]: 要查看更完整的操作系统列表,请参照:[操作系统列表 - Wikipedia](http://en.wikipedia.org/wiki/List_of_operating_systems) +[^2]: 当然,我简化了普通编程的这种解释,实际上它在很大程度上取决于语言和机器。感兴趣的话,参见 [编译器 - Wikipedia](http://en.wikipedia.org/wiki/Compiler) + -------------------------------------------------------------------------------- via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html From ef7693b4ce3682acd28840d8d69c1bd6825430d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 08:38:45 +0800 Subject: [PATCH 0601/4278] PRF:20181128 Turn an old Linux desktop into a home media center.md @geekpi --- ... Linux desktop into a home media center.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/translated/tech/20181128 Turn an old Linux desktop into a home media center.md b/translated/tech/20181128 Turn an old Linux desktop into a home media center.md index 1ad384583c..938e10d3ac 100644 --- a/translated/tech/20181128 Turn an old Linux desktop into a home media center.md +++ b/translated/tech/20181128 Turn an old Linux desktop into a home media center.md @@ -1,20 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Turn an old Linux desktop into a home media center) [#]: via: (https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center) [#]: author: ([Alan Formy-Duval](https://opensource.com/users/alanfdoss)) [#]: url: ( ) -将旧的 Linux 桌面变成家庭媒体中心 +将旧的 Linux 台式机变成家庭媒体中心 ====== -重新利用过时的计算机来浏览互联网并在大屏电视上观看视频。 + +> 重新利用过时的计算机来浏览互联网并在大屏电视上观看视频。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q) -我第一次尝试搭建一台“娱乐电脑”是在 20 世纪 90 年代后期,使用一台带 Trident ProVidia 9685 PCI 显卡的普通旧台式电脑。我使用了所谓的“电视输出”卡,它有一个额外的输出连接到标准电视端子上。屏幕显示看起来不太好,而且没有音频输出。并且外观很丑:有一条 S-Video 线穿过了客厅地板连接到我的 19 英寸 Sony Trinitron CRT 电视机上。 +我第一次尝试搭建一台“娱乐电脑”是在 20 世纪 90 年代后期,使用了一台带 Trident ProVidia 9685 PCI 显卡的普通旧台式电脑。我使用了所谓的“电视输出”卡,它有一个额外的输出可以连接到标准电视端子上。屏幕显示看起来不太好,而且没有音频输出。并且外观很丑:有一条 S-Video 线穿过了客厅地板连接到我的 19 英寸 Sony Trinitron CRT 电视机上。 -我在 Linux 和 Windows 98 上也得到了同样令人遗憾的结果。在和那些看起来不对劲的系统挣扎之后,我放弃了几年。值得庆幸的是,如今的 HDMI 拥有更好的性能和标准化的分辨率,这使得廉价的家庭媒体中心成为现实。 +我在 Linux 和 Windows 98 上得到了同样令人遗憾的结果。在和那些看起来不对劲的系统挣扎之后,我放弃了几年。值得庆幸的是,如今的 HDMI 拥有更好的性能和标准化的分辨率,这使得廉价的家庭媒体中心成为现实。 我的新媒体中心娱乐电脑实际上是我的旧 Ubuntu Linux 桌面,最近我用更快的电脑替换了它。这台电脑在工作中太慢,但是它的 3.4GHz 的 AMD Phenom II X4 965 处理器和 8GB 的 RAM 足以满足一般浏览和视频流的要求。 @@ -30,37 +32,37 @@ ### 音频 -Nvidia GeForce GTX 音频设备在 GNOME 控制中心的声音设置中被列为 GK107 HDMI Audio Controller,因此单条 HDMI 线缆可同时处理音频和视频。无需将音频线连接到板载声卡的输出插孔。 +Nvidia GeForce GTX 音频设备在 GNOME 控制中心的声音设置中被显示为 GK107 HDMI Audio Controller,因此单条 HDMI 线缆可同时处理音频和视频。无需将音频线连接到板载声卡的输出插孔。 ![Sound settings screenshot][2] -GNOME 音频设置中的 HDMI 音频控制器。 +*GNOME 音频设置中的 HDMI 音频控制器。* ### 键盘和鼠标 -我有罗技的无线键盘和鼠标。当我安装它们时,我插入了两个外置 USB 接收器,它们可以使用,但我经常遇到信号反应问题。接着我发现其中一个被标记为联合接收器,这意味着它可以自己处理多个罗技输入设备。罗技不提供在 Linux 中配置统一接收器的软件。但幸运的是,有个开源程序 [Solaar][3] 能够做到。使用单个接收器解决了我的输入性能问题。 +我有罗技的无线键盘和鼠标。当我安装它们时,我插入了两个外置 USB 接收器,它们可以使用,但我经常遇到信号反应问题。接着我发现其中一个被标记为联合接收器,这意味着它可以自己处理多个罗技输入设备。罗技不提供在 Linux 中配置联合接收器的软件。但幸运的是,有个开源程序 [Solaar][3] 能够做到。使用单个接收器解决了我的输入性能问题。 ![Solaar][5] -Solaar 联合接收器界面。 +*Solaar 联合接收器界面。* ### 视频 -最初很难在我的 47 英寸平板电视上阅读,所以我在 Universal Access 下启用了“大文字”。我下载了一些与电视 1920x1080 分辨率相匹配的壁纸,这看起来很棒! +最初很难在我的 47 英寸平板电视上阅读文字,所以我在 Universal Access 下启用了“大文字”。我下载了一些与电视 1920x1080 分辨率相匹配的壁纸,这看起来很棒! ### 最后处理 -我需要在电脑的冷却需求和我对不受阻碍的娱乐的渴望之间取得平衡。由于这是一台标准的 ATX 微型塔式计算机,我确保我有足够的风扇,以及在 BIOS 中精心配置过的温度以减少噪音。我还把电脑放在我的娱乐控制台后面,以进一步减少风扇噪音,但同时我可以按到电源按钮。 +我需要在电脑的冷却需求和我对不受阻碍的娱乐的渴望之间取得平衡。由于这是一台标准的 ATX 微型塔式计算机,我确保我有足够的风扇转速,以及在 BIOS 中精心配置过的温度以减少噪音。我还把电脑放在我的娱乐控制台后面,以进一步减少风扇噪音,但同时我可以按到电源按钮。 -最后得到一台简单的没有巨大噪音的机器,而且只使用了两根线缆—交流电源线和 HDMI。它应该能够运行任何主流或专门的媒体中心 Linux 发行版。我不期望去玩高端的游戏,因为这可能需要更多的处理能力。 +最后得到一台简单的、没有巨大噪音的机器,而且只使用了两根线缆:交流电源线和 HDMI。它应该能够运行任何主流或专门的媒体中心 Linux 发行版。我不期望去玩高端的游戏,因为这可能需要更多的处理能力。 ![Showing Ubuntu Linux About page onscreen][7] -Ubuntu Linux 的关于页面。 +*Ubuntu Linux 的关于页面。* ![YouTube on the big screen][9] -在大屏幕上测试 YouTube 视频。 +*在大屏幕上测试 YouTube 视频。* 我还没安装像 [Kodi][10] 这样专门的媒体中心发行版。截至目前,它运行的是 Ubuntu Linux 18.04.1 LTS,而且很稳定。 @@ -73,7 +75,7 @@ via: https://opensource.com/article/18/11/old-linux-desktop-new-home-media-cente 作者:[Alan Formy-Duval][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/) 荣誉推出 @@ -84,4 +86,4 @@ via: https://opensource.com/article/18/11/old-linux-desktop-new-home-media-cente [5]: https://opensource.com/sites/default/files/uploads/solaar_interface.png (Solaar) [7]: https://opensource.com/sites/default/files/uploads/finalresult1.png (Showing Ubuntu Linux About page onscreen) [9]: https://opensource.com/sites/default/files/uploads/finalresult2.png (YouTube on the big screen) -[10]: https://kodi.tv/ \ No newline at end of file +[10]: https://kodi.tv/ From 921383ef5302c1f00da343f21ca519334bab8aa9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 08:39:55 +0800 Subject: [PATCH 0602/4278] PUB:20181128 Turn an old Linux desktop into a home media center.md @geekpi https://linux.cn/article-10446-1.html --- ...1128 Turn an old Linux desktop into a home media center.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181128 Turn an old Linux desktop into a home media center.md (98%) diff --git a/translated/tech/20181128 Turn an old Linux desktop into a home media center.md b/published/20181128 Turn an old Linux desktop into a home media center.md similarity index 98% rename from translated/tech/20181128 Turn an old Linux desktop into a home media center.md rename to published/20181128 Turn an old Linux desktop into a home media center.md index 938e10d3ac..e1acc79691 100644 --- a/translated/tech/20181128 Turn an old Linux desktop into a home media center.md +++ b/published/20181128 Turn an old Linux desktop into a home media center.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Turn an old Linux desktop into a home media center) [#]: via: (https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center) [#]: author: ([Alan Formy-Duval](https://opensource.com/users/alanfdoss)) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10446-1.html) 将旧的 Linux 台式机变成家庭媒体中心 ====== From 4dc8cc50e38baec8b047a220949b1c0919d7b24e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 08:53:24 +0800 Subject: [PATCH 0603/4278] PRF:20181209 Powers of two, powers of Linux- 2048 at the command line.md @geekpi --- ... powers of Linux- 2048 at the command line.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md index 92b87ed8a6..c53f4f97ae 100644 --- a/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md +++ b/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md @@ -1,24 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Powers of two, powers of Linux: 2048 at the command line) [#]: via: (https://opensource.com/article/18/12/linux-toy-2048) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -2 的力量,Linux 的力量:终端中的 2048 +2 的威力,Linux 的威力:终端中的 2048 ====== -正在寻找基于终端的游戏来打发时间么?来看看 2048-cli 吧。 + +> 正在寻找基于终端的游戏来打发时间么?来看看 2048-cli 吧。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-2048.png?itok=3M6S-n1a) 你好,欢迎来到今天的 Linux 命令行玩具日历。每天,我们会为你的终端带来一个不同的玩具:它可能是一个游戏或任何简单的消遣,可以帮助你获得乐趣。 很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 -今天的玩具是我最喜欢的休闲游戏之一 [2048][2] (它本身就是另外一个克隆的克隆)的[命令行版本][1]。 +今天的玩具是我最喜欢的休闲游戏之一 [2048][2] (它本身就是另外一个克隆品的克隆)的[命令行版本][1]。 -要进行游戏,你只需将滑块向上、向下、向左、向右移动,组合成对的数字,并增加数字,直到你得到数字 2048 的块。吸引人的地方(以及挑战)是你不能只移动一个滑块,而是需要移动屏幕上的每一块。 +要进行游戏,你只需将滑块向上、向下、向左、向右移动,组合成对的数字,并增加数值,直到你得到数字为 2048 的块。最吸引人的地方(以及挑战)是你不能只移动一个滑块,而是需要移动屏幕上的每一块。(LCTT 译注:不知道有没有人在我们 Linux 中国的网站上遇到过 404 页面?那就是一个 2048 游戏,经常我错误地打开一个不存在的页面时,本应该去修复这个问题,却不小心沉迷于其中……) 它简单、有趣,很容易在里面沉迷几个小时。这个 2048 的克隆 [2048-cli][1] 是 Marc Tiehuis 用 C 编写的,并在 MIT 许可下开源。你可以在 [GitHub][1] 上找到源代码,你也可在这找到适用于你的平台的安装说明。由于它已为 Fedora 打包,因此我来说,安装就像下面那样简单: @@ -41,7 +43,7 @@ via: https://opensource.com/article/18/12/linux-toy-2048 作者:[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/) 荣誉推出 @@ -49,4 +51,4 @@ via: https://opensource.com/article/18/12/linux-toy-2048 [b]: https://github.com/lujun9972 [1]: https://github.com/tiehuis/2048-cli [2]: https://github.com/gabrielecirulli/2048 -[3]: https://opensource.com/article/18/12/linux-toy-tetris \ No newline at end of file +[3]: https://opensource.com/article/18/12/linux-toy-tetris From bc8ede9058a357f80478144a970bdef41d92819f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 08:54:02 +0800 Subject: [PATCH 0604/4278] PUB:20181209 Powers of two, powers of Linux- 2048 at the command line.md @geekpi https://linux.cn/article-10447-1.html --- ...owers of two, powers of Linux- 2048 at the command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181209 Powers of two, powers of Linux- 2048 at the command line.md (97%) diff --git a/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/published/20181209 Powers of two, powers of Linux- 2048 at the command line.md similarity index 97% rename from translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md rename to published/20181209 Powers of two, powers of Linux- 2048 at the command line.md index c53f4f97ae..1deb9a3c3d 100644 --- a/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md +++ b/published/20181209 Powers of two, powers of Linux- 2048 at the command line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10447-1.html) [#]: subject: (Powers of two, powers of Linux: 2048 at the command line) [#]: via: (https://opensource.com/article/18/12/linux-toy-2048) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 55836cf80b31c4e411b025f5e5aca27416920f79 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 16 Jan 2019 08:56:04 +0800 Subject: [PATCH 0605/4278] translated --- ...211 Winterize your Bash prompt in Linux.md | 85 ------------------- ...211 Winterize your Bash prompt in Linux.md | 80 +++++++++++++++++ 2 files changed, 80 insertions(+), 85 deletions(-) delete mode 100644 sources/tech/20181211 Winterize your Bash prompt in Linux.md create mode 100644 translated/tech/20181211 Winterize your Bash prompt in Linux.md diff --git a/sources/tech/20181211 Winterize your Bash prompt in Linux.md b/sources/tech/20181211 Winterize your Bash prompt in Linux.md deleted file mode 100644 index c952f0c18d..0000000000 --- a/sources/tech/20181211 Winterize your Bash prompt in Linux.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Winterize your Bash prompt in Linux) -[#]: via: (https://opensource.com/article/18/12/linux-toy-bash-prompt) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Winterize your Bash prompt in Linux -====== -Your Linux terminal probably supports Unicode, so why not take advantage of that and add a seasonal touch to your prompt? -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-bash-prompt.png?itok=HK_kVn37) - -Hello once again for another installment of the 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? Really, we're keeping it pretty open-ended: It's anything that's a fun diversion at the terminal, and we're giving bonus points for anything holiday-themed. - -Maybe you've seen some of these before, maybe you haven't. Either way, we hope you have fun. - -Today's toy is super-simple: It's your Bash prompt. Your Bash prompt? Yep! We've got a few more weeks of the holiday season left to stare at it, and even more weeks of winter here in the northern hemisphere, so why not have some fun with it. - -Your Bash prompt currently might be a simple dollar sign ( **$** ), or more likely, it's something a little longer. If you're not sure what makes up your Bash prompt right now, you can find it in an environment variable called $PS1. To see it, type: - -``` -echo $PS1 -``` - -For me, this returns: - -``` -[\u@\h \W]\$ -``` - -The **\u** , **\h** , and **\W** are special characters for username, hostname, and working directory. There are others you can use as well; for help building out your Bash prompt, you can use [EzPrompt][1], an online generator of PS1 configurations that includes lots of options including date and time, Git status, and more. - -You may have other variables that make up your Bash prompt set as well; **$PS2** for me contains the closing brace of my command prompt. See [this article][2] for more information. - -To change your prompt, simply set the environment variable in your terminal like this: - -``` -$ PS1='\u is cold: ' -jehb is cold: -``` - -To set it permanently, add the same code to your **/etc/bashrc **using your favorite text editor. - -So what does this have to do with winterization? Well, chances are on a modern machine, your terminal support Unicode, so you're not limited to the standard ASCII character set. You can use any emoji that's a part of the Unicode specification, including a snowflake ❄, a snowman ☃, or a pair of skis 🎿. You've got plenty of wintery options to choose from. - -``` -🎄 Christmas Tree -🧥 Coat -🦌 Deer -🧤 Gloves -🤶 Mrs. Claus -🎅 Santa Claus -🧣 Scarf -🎿 Skis -🏂 Snowboarder -❄ Snowflake -☃ Snowman -⛄ Snowman Without Snow -🎁 Wrapped Gift -``` - -Pick your favorite, and enjoy some winter cheer. Fun fact: modern filesystems also support Unicode characters in their filenames, meaning you can technically name your next program **"❄❄❄❄❄.py"**. That said, please don't. - -Do you have a favorite command-line toy that you think I ought to include? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Snake your way across your Linux terminal][3], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-bash-prompt - -作者:[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]: http://ezprompt.net/ -[2]: https://access.redhat.com/solutions/505983 -[3]: https://opensource.com/article/18/12/linux-toy-snake diff --git a/translated/tech/20181211 Winterize your Bash prompt in Linux.md b/translated/tech/20181211 Winterize your Bash prompt in Linux.md new file mode 100644 index 0000000000..4e0a17be07 --- /dev/null +++ b/translated/tech/20181211 Winterize your Bash prompt in Linux.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Winterize your Bash prompt in Linux) +[#]: via: (https://opensource.com/article/18/12/linux-toy-bash-prompt) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 中冬季化你的 Bash 提示符 +====== +你的 Linux 终端可能支持 Unicode,那么为何不利用它在提示符中添加季节性的图标呢? +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-bash-prompt.png?itok=HK_kVn37) + +欢迎再次来到 Linux 命令行玩具日历的另一篇。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具?我们对此非常开放:它会是终端上有任何有趣的消遣,对于任何节日主题相关的还有额外的加分。 + +也许你以前见过其中的一些,也许你没有。不管怎样,我们希望你玩得开心。 + +今天的玩具非常简单:它是你的 Bash 提示符。你的 Bash 提示符?是的!我们还有几个星期的假期可以盯着它看,在北半球冬天还会再多几周,所以为什么不玩玩它。 + +目前你的 Bash 提示符号可能是一个简单的美元符号( **$**),或者更有可能是一个更长的东西。如果你不确定你的 Bash 提示符是什么,你可以在环境变量 $PS1 中找到它。要查看它,请输入: + +``` +echo $PS1 +``` + +对于我而言,它返回: + +``` +[\u@\h \W]\$ +``` + +**\u**、 **\h** 和 **\W** 分别是用户名、主机名和工作目录的特殊字符。你还可以使用其他一些符号。为了帮助构建你的 Bash 提示符,你可以使用 [EzPrompt][1],这是一个 PS1 配置的在线生成器,它包含了许多选项,包括日期和时间、Git 状态等。 + +你可能还有其他变量来组成 Bash 提示符。对我来说,**$PS2** 包含了我命令提示符的结束括号。有关详细信息,请参阅[这篇文章][2]。 + +要更改提示符,只需在终端中设置环境变量,如下所示: + +``` +$ PS1='\u is cold: ' +jehb is cold: +``` + +要永久设置它,请使用你喜欢的文本编辑器将相同的代码添加到 **/etc/bashrc** 中。 + +那么这些与冬季化有什么关系呢?好吧,你很有可能有现代机器,你的终端支持 Unicode,所以你不仅限于标准的 ASCII 字符集。你可以使用任何符合 Unicode 规范的 emoji,包括雪花 ❄、雪人 ☃ 或一对滑雪者 🎿。你有很多冬季 emoji 可供选择。 + +``` +🎄 圣诞树 +🧥 外套 +🦌 鹿 +🧤 手套 +🤶 圣诞夫人 +🎅 圣诞老人 +🧣 围巾 +🎿 滑雪者 +🏂 滑雪板 +❄ 雪花 +☃ 雪人 +⛄ 没有雪的雪人 +🎁 包装好的礼物 +``` +选择你最喜欢的,享受冬天的欢乐。有趣的事实:现代文件系统也支持文件名中的 Unicode 字符,这意味着技术上你可以将你下个程序命名为 **“❄❄❄❄❄.py”**。只是说说,不要这么做。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +查看昨天的玩具,[在 Linux 终端玩贪吃蛇][3],记得明天再来! + +-------------------------------------------------------------------------------- +via: https://opensource.com/article/18/12/linux-toy-bash-prompt +作者:[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]: http://ezprompt.net/ +[2]: https://access.redhat.com/solutions/505983 +[3]: https://opensource.com/article/18/12/linux-toy-snake From ec9958acbdeeba62a33979a1c6e93c34dae1fde4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 16 Jan 2019 08:58:46 +0800 Subject: [PATCH 0606/4278] translating --- ...PU Temperature, Frequency, Power And Utilization In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md index 276d87049d..8861e90cac 100644 --- a/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md +++ b/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8fecc60623f196607da3014983a74d9f6407503e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 09:38:34 +0800 Subject: [PATCH 0607/4278] PRF:20181212 5 resolutions for open source project maintainers.md @bestony --- ...ons for open source project maintainers.md | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/translated/talk/20181212 5 resolutions for open source project maintainers.md b/translated/talk/20181212 5 resolutions for open source project maintainers.md index 2384da4c3c..1cde9684cf 100644 --- a/translated/talk/20181212 5 resolutions for open source project maintainers.md +++ b/translated/talk/20181212 5 resolutions for open source project maintainers.md @@ -1,52 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (bestony) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 resolutions for open source project maintainers) [#]: via: (https://opensource.com/article/18/12/resolutions-open-source-project-maintainers) [#]: author: (Ben Cotton https://opensource.com/users/bcotton) -5个为开源项目维护者而生的解决方案 +一位开源项目维护者的 5 个决心 ====== -不管你怎么说,好的交流是一个活跃的开源社区的必备品。 +> 不管怎么说,好的交流是一个活跃的开源社区的必备品。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/spark_sparkler_fire_new_year_idea.png?itok=rnyMpVP8) -我不会给你一个大而全的新年的解决方案。关于自我提升,我没有任何问题,这篇文章我希望锚定这个日历中的另外一部分。不过即使是这样,这里也有一些关于取消今年的免费日历并将其替换为新的日历的内容,以激发自省。 +我通常不会定下大的新年决心。当然,我在自我提升方面没有任何问题,这篇文章我希望锚定的是这个日历中的另外一部分。不过即使是这样,这里也有一些东西要从今年的免费日历上划掉,并将其替换为一些可以激发我的自省的新日历内容。 -在 2017 年,我从不在社交媒体上分享我从未阅读过的文章。我一直保持这样的状态,我也认为它让我成为了一个更好的互联网公民。对于 2019 年,我正在考虑让我成为更好的开源软件维护者的解决方案。 +在 2017 年,我从不在社交媒体上分享我从未阅读过的文章。我一直保持这样的状态,我也认为它让我成为了一个更好的互联网公民。对于 2019 年,我正在考虑让我成为更好的开源软件维护者的决心。 +下面是一些我在一些项目中担任维护者或共同维护者时坚持的决心: -下面是一些我在一些项目中担任维护者或共同维护者时坚持的决议: +### 1、包含行为准则 -### 1\. 包含行为准则 +Jono Bacon 在他的文章“[7 个你可能犯的错误][1]”中包含了一条“不强制执行行为准则”。当然,要强制执行行为准则,你首先需要有一个行为准则。我打算默认用[贡献者契约][2],但是你可以使用其他你喜欢的。关于这个许可协议,最好的方法是使用别人已经写好的,而不是你自己写的。但是重要的是,要找到一些能够定义你希望你的社区执行的,无论它们是什么样子。一旦这些被记录下来并强制执行,人们就能自行决定是否成为他们想象中社区的一份子。 -Jono Bacon 在他的文章“[7个你可能犯的错误][1]”中包含了“不强制执行行为准则”。当然,去强制执行行为准则,你首先需要有一个行为准则。我设计了一个默认的[贡献者契约][2],但是你可以使用其他你喜欢的。关于这个 License ,最好的方法是使用别人已经写好的,而不是你自己写的。但是重要的是,要找到一些能够定义你希望你的社区执行的,无论他们是什么样子。一旦这些被记录下来并强制执行,人们就能自行决定是否成为他们想象中社区的一份子。 +### 2、使许可证清晰且明确 +你知道什么真的很烦么?不清晰的许可证。"这个软件基于 GPL 授权",如果没有进一步提供更多信息的文字,我无法知道更多信息。基于哪个版本的[GPL][3]?我可以用它吗?对于项目的非代码部分,“根据知识共享许可证(CC)授权”更糟糕。我喜欢[知识共享许可证][4],但它有几个不同的许可证包含着不同的权利和义务。因此,我将非常清楚的说明哪个许可证的变种和版本适用于我的项目。我将会在仓库中包含许可的全文,并在其他文件中包含简明的注释。 -### 2\. 使许可证清晰且明确 +与此相关的一类问题是使用 [OSI][5] 批准的许可证。想出一个新的准确的说明了你想要表达什么的许可证是有可能的,但是如果你需要强制推行它,祝你好运。会坚持使用它么?使用您项目的人会理解么? -你知道什么真的很烦么?不清晰的许可证。"这个软件基于 GPL 授权",如果没有进一步提供更多信息的文字,我无法知道更多信息。基于哪个版本的[GPL][3]?对于项目的非代码部分,“根据知识共享许可证授权”更糟糕。我喜欢[知识共享许可证][4],但其中有几个不同的许可证包含着不同的权利和义务。因此,我将清楚的说明许可证的版本适用于我的项目。我将会在 repo 中包含许可的全文,并在其他文件中包含简明的注释。 +### 3、快速分类错误报告和问题 -与此相关的一类是使用 [OSI][5]批准的许可证。想出一个新的准确的说明了你想要表达什么的许可证是有可能的,但是如果你需要强制执行它,祝你好运。会坚持使用它么?使用您项目的人会理解么? +在技术领域, 很少有比开源维护者更贫乏的东西了。即使在小型项目中,也很难找到时间去回答每个问题并修复每个错误。但这并不意味着我不能哪怕回应一下,它没必要是多段的回复。即使只是给 GitHub 问题贴了个标签也表明了我看见它了。也许我马上就会处理它,也许一年后我会处理它。但是让社区看到它很重要,是的,这里还有人管。 +### 4、如果没有伴随的文档,请不要推送新特性或错误修复 +尽管多年来我的开源贡献都围绕着文档,但我的项目并没有反映出我对它的重视。我能推送的提交不多,并不不需要某种形式的文档。新的特性显然应该在他们被提交时甚至是在之前就编写文档。但即使是错误修复,也应该在发行说明中有一个条目提及。如果没有什么意外,推送提交也是很好的改善文档的机会。 -### 3\. 快速分类错误报告和问题 +### 5、放弃一个项目时,要说清楚 -技术的规模很难会和开源维护者一样差。即使在小型项目中,也很难找到时间去回答每个问题并修复每个错误。但这并不意味着我至少不能去回应这个人,它没必要是多段的回复。即使只是标记了 Github Issue 也表明了我看见它了。也许我马上就会处理它,也许一年后我会处理它。但是让社区看到它很重要。是的,这里还有其他人。 +我很不擅长对事情说“不”,我告诉编辑我会为 [Opensource.com][6] 写一到两篇文章,而现在我有了将近 60 篇文章。哎呀。但在某些时候,曾经我有兴趣的事情也会不再有兴趣。也许该项目是不必要的,因为它的功能被吸收到更大的项目中;也许只是我厌倦了它。但这对社区是不公平的(并且存在潜在的危险,正如最近的 [event-stream 恶意软件注入][7]所示),会让该项目陷入困境。维护者有权随时离开,但他们离开时应该说清楚。 -### 4\. 如果没有伴随的文档,请不要推送新特性或 Bugfix - -尽管多年来我的开源贡献都围绕着文档,但我的项目并没有反映出我对他们的重视。我很少有不需要某种形式文档的推送。新的特性显然应该在他们被提交甚至是之前编写文档。但即使是错误修复,也应该在发行说明中有一个条目。如果没有什么其他的,一个 push 也是很好的改善文档的机会。 - -### 5\. 放弃一个项目时,要说清楚 - -我很擅长对事情说“不”,我告诉编辑我会为 [Opensource.com][6] 写一到两篇文章,现在我有了将近 60 篇文章。Oops。但在某些时候,曾经符合我利益的事情不再有用。也许该项目是不必要的,因为它的功能被吸收到更大的项目中,也许只是我厌倦了它。但这对社区是不公平的(并且存在潜在的危险,正如最近的[event-stream 恶意软件注入][7]所示),会让项目陷入困境。维护者有权随时离开,但他们离开时应该清清楚楚。 - -无论你是开源维护者还是贡献者,如果你知道项目维护者应该作出的其他决议,请在评论中分享! +无论你是开源维护者还是贡献者,如果你知道项目维护者应该作出的其他决心,请在评论中分享! -------------------------------------------------------------------------------- @@ -55,7 +51,7 @@ via: https://opensource.com/article/18/12/resolutions-open-source-project-mainta 作者:[Ben Cotton][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 5bd624df8713af3e623e450fc07e64122a65bbc0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 09:39:20 +0800 Subject: [PATCH 0608/4278] PUB:20181212 5 resolutions for open source project maintainers.md @bestony https://linux.cn/article-10448-1.html --- ...81212 5 resolutions for open source project maintainers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20181212 5 resolutions for open source project maintainers.md (98%) diff --git a/translated/talk/20181212 5 resolutions for open source project maintainers.md b/published/20181212 5 resolutions for open source project maintainers.md similarity index 98% rename from translated/talk/20181212 5 resolutions for open source project maintainers.md rename to published/20181212 5 resolutions for open source project maintainers.md index 1cde9684cf..b39ffc1a51 100644 --- a/translated/talk/20181212 5 resolutions for open source project maintainers.md +++ b/published/20181212 5 resolutions for open source project maintainers.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (bestony) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10448-1.html) [#]: subject: (5 resolutions for open source project maintainers) [#]: via: (https://opensource.com/article/18/12/resolutions-open-source-project-maintainers) [#]: author: (Ben Cotton https://opensource.com/users/bcotton) From d29171fc05b45ef39f2cd445d3a94c09b1e86b03 Mon Sep 17 00:00:00 2001 From: HuanCheng Bai <13283837+bestony@users.noreply.github.com> Date: Wed, 16 Jan 2019 10:02:56 +0800 Subject: [PATCH 0609/4278] =?UTF-8?q?Bestony=20=E8=AE=A4=E9=A2=86=E6=AD=A4?= =?UTF-8?q?=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nema - Record And Share Your Terminal Sessions On The Fly.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md b/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md index 769780a79f..20bcfbe26d 100644 --- a/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md +++ b/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (bestony) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0c91f7163124d3f5931b92a601cf063f44b4d671 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 10:09:26 +0800 Subject: [PATCH 0610/4278] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=81=97=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ize my knowledge as a Software Engineer.md | 111 ------------------ 1 file changed, 111 deletions(-) delete mode 100644 sources/talk/20181029 How I organize my knowledge as a Software Engineer.md diff --git a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md deleted file mode 100644 index 73a46af506..0000000000 --- a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md +++ /dev/null @@ -1,111 +0,0 @@ -怎样如软件工程师一样组织知识 -========== - -总体上说,软件开发和技术是以非常快的速度发展的领域,所以持续学习是必不可少的。在互联网上花几分钟找一下,在 Twitter、媒体、RSS 订阅、Hacker News 和其它专业网站和社区等地方,就可以从文章、案例研究、教程、代码片段、新应用程序和信息中找到大量有用的信息。 - -保存和组织所有这些信息可能是一项艰巨的任务。在这篇文章中,我将介绍一些我用来组织信息的工具。 - -我认为在知识管理方面非常重要的一点就是避免锁定在特定平台。我使用的所有工具都允许以标准格式(如 Markdown 和 HTML)导出数据。 - -请注意,我的流程并不完美,我一直在寻找新工具和方法来优化它。每个人都不同,所以对我有用的东西可能不适合你。 - - -### 用 NotionHQ 做知识库 - -对我来说,知识管理的基本部分是拥有某种个人知识库或维基。这是一个你可以以有组织的方式保存链接、书签、备注等的地方。 - -我使用 [NotionHQ][7] 做这件事。我使用它来记录各种主题,包括资源列表,如通过编程语言分组的优秀的库或教程,为有趣的博客文章和教程添加书签等等,不仅与软件开发有关,而且与我的个人生活有关。 - -我真正喜欢 NotionHQ 的是,创建新内容是如此简单。你可以使用 Markdown 编写它并将其组织为树状。 - -这是我的“开发”工作区的顶级页面: - -[![Image](https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png)][8] - -NotionHQ 有一些很棒的其他功能,如集成了电子表格/数据库和任务板。 - -如果您想认真使用 NotionHQ,您将需要订阅付费个人计划,因为免费计划有所限制。我觉得它物有所值。NotionHQ 允许将整个工作区导出为 Markdown 文件。导出功能存在一些重要问题,例如丢失页面层次结构,希望 Notion 团队可以改进这一点。 - -作为一个免费的替代方案,我可能会使用 [VuePress][9] 或 [GitBook][10] 来托管我自己的知识库。 - -### 用 Pocket 保存感兴趣的文章 - -[Pocket][11] 是我最喜欢的应用之一!使用 Pocket,您可以创建一个来自互联网上的文章的阅读列表。每当我看到一篇看起来很有趣的文章时,我都会使用 Chrome 扩展程序将其保存到 Pocket。稍后,我会阅读它,如果我发现它足够有用,我将使用 Pocket 的“存档”功能永久保存该文章并清理我的 Pocket 收件箱。 - -我尽量保持这个阅读清单足够小,并存档我已经处理过的信息。Pocket 允许您标记文章,以便以后更轻松地搜索特定主题的文章。 - -如果原始网站消失,您还可以在 Pocket 服务器中保存文章的副本,但是您需要 Pocket Premium 订阅计划。 - -Pocket 还具有“发现”功能,根据您保存的文章推荐类似的文章。这是找到可以阅读的新内容的好方法。 - -### 用 SnippetStore 做代码片段管理 - -从 GitHub 到 Stack Overflow 的答案,到博客文章,经常能找到一些你想要保存备用的好代码片段。它可能是一些不错的算法实现、一个有用的脚本或如何在某种语言中执行某种操作的示例。 - -我尝试了很多应用程序,从简单的 GitHub Gists 到 [Boostnote][12],直到我发现 [SnippetStore][13]。 - -SnippetStore 是一个开源的代码片段管理应用。SnippetStore 与其他产品的区别在于其简单性。您可以按语言或标签整理片段,并且可以拥有多个文件片段。它不完美,但是可以用。例如,Boostnote 具有更多功能,但我更喜欢 SnippetStore 组织内容的简单方法。 - -对于我每天使用的缩写和片段,我更喜欢使用我的编辑器 / IDE 的代码片段功能,因为它更便于使用。我使用 SnippetStore 更像是作为编码示例的参考。 - -[Cacher][14] 也是一个有趣的选择,因为它与许多编辑器进行了集成,他有一个命令行工具,并使用 Gi​​tHub Gists 作为后端,但其专业计划为 6 美元/月,我觉这有点太贵。 - -### 用 DevHints 管理速查表 - -[Devhints][15] 是由 Rico Sta. Cruz 创建的一个速查表集合。它是开源的,是用 Jekyll 生成的,Jekyll 是最受欢迎的静态站点生成器之一。 - -这些速查表是用 Markdown 编写的,带有一些额外的格式化支持,例如支持列。 - -我非常喜欢其界面的外观,并且不像可以在 [Cheatography][16] 等网站上找到 PDF 或图像格式的速查表, Markdown 非常容易添加新内容并保持更新和进行版本控制。 - -因为它是开源,我创建了自己的分叉版本,删除了一些我不需要的速查表,并添加了更多。 - -我使用速查表作为如何使用某些库或编程语言或记住一些命令的参考。速查表的单个页面非常方便,例如,可以列出特定编程语言的所有基本语法。 - -我仍在尝试这个工具,但到目前为止它的工作很好。 - -### Diigo - -[Diigo][17] 允许您注释和突出显示部分网站。我在研究新东西时使用它来注释重要信息,或者从文章、Stack Overflow 答案或来自 Twitter 的鼓舞人心的引语中保存特定段落!;) - -* * * - -就这些了。某些工具的功能方面可能存在一些重叠,但正如我在开始时所说的那样,这是一个不断演进的工作流程,因为我一直在尝试和寻找改进和提高工作效率的方法。 - -你呢?是如何组织你的知识的?请随时在下面发表评论。 - -谢谢你的阅读。 - ------------------------------------------------------------------------- - -作者简介:Bruno Paz,Web 工程师,专精 #PHP 和 @Symfony 框架。热心于新技术。喜欢运动,@FCPorto 的粉丝! - --------------------------------------------------------------------------------- - -via: https://dev.to/brpaz/how-do-i-organize-my-knowledge-as-a-software-engineer-4387 - -作者:[Bruno Paz][a] -选题:[oska874](https://github.com/oska874) -译者:[wxy](https://github.com/wxy) -校对:[wxy](https://github.com/wxy) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://brunopaz.net/ -[1]:https://dev.to/brpaz -[2]:http://twitter.com/brunopaz88 -[3]:http://github.com/brpaz -[4]:https://dev.to/t/knowledge -[5]:https://dev.to/t/learning -[6]:https://dev.to/t/development -[7]:https://www.notion.so/ -[8]:https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png -[9]:https://vuepress.vuejs.org/ -[10]:https://www.gitbook.com/?t=1 -[11]:https://getpocket.com/ -[12]:https://boostnote.io/ -[13]:https://github.com/ZeroX-DG/SnippetStore -[14]:https://www.cacher.io/ -[15]:https://devhints.io/ -[16]:https://cheatography.com/ -[17]:https://www.diigo.com/index From 955edea1af47ba7bed10a9b41f1a7eb854c84d7c Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Wed, 16 Jan 2019 10:26:28 +0800 Subject: [PATCH 0611/4278] Delete 20180419 5 guiding principles you should know before you design a microservice.md --- ...d know before you design a microservice.md | 158 ------------------ 1 file changed, 158 deletions(-) delete mode 100644 sources/talk/20180419 5 guiding principles you should know before you design a microservice.md diff --git a/sources/talk/20180419 5 guiding principles you should know before you design a microservice.md b/sources/talk/20180419 5 guiding principles you should know before you design a microservice.md deleted file mode 100644 index fae228867e..0000000000 --- a/sources/talk/20180419 5 guiding principles you should know before you design a microservice.md +++ /dev/null @@ -1,158 +0,0 @@ -translated by lixinyuxx -5 guiding principles you should know before you design a microservice -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_OpenInnovation.png?itok=l29msbql) -One of the biggest challenges for teams starting off with microservices is adhering to the Goldilocks Principle: Not too big, not too small, and not too tightly coupled. Part of this challenge arises from confusion about what, exactly, constitutes a well-designed microservice. - -Dozens of CTOs shared their experiences through interviews, and those conversations illuminated five characteristics of well-designed microservices. This article will help guide teams as they design microservices. (For more information, check out the upcoming book [Microservices for Startups][1]). This article will briefly touch on microservice boundaries and arbitrary "rules" to avoid before diving into the five characteristics to guide your design of microservices. - -### Microservice boundaries - -One of the [core benefits of developing new systems with microservices][2] is that the architecture allows developers to build and modify individual components independently—but problems can arise when it comes to minimizing the number of callbacks between each API. The solution, according to Chris McFadden, VP of engineering at [SparkPost][3] , is to apply the appropriate service boundaries. - -With respect to boundaries, in contrast to the sometimes difficult-to-grasp and abstract concept of domain-driven design (DDD)—a framework for microservices—this article focuses on practical principles for creating well-defined microservice boundaries with some of our industry's top CTOs. - -### Avoid arbitrary "rules" - -If you read enough advice about designing and creating a microservice, you're bound to come across some of the "rules" below. Although it's tempting to use them as guideposts for creating microservices, adhesion to these arbitrary rules is not a principled way to determine thoughtful boundaries for microservices. - -#### "A microservice should have X lines of code" - -Let's get one thing straight: There are no limitations on how many lines of code there are in a microservice. A microservice doesn't suddenly become a monolith just because you write a few lines of extra code. The key is ensuring there is high cohesion for the code within a service (more on this later). - -#### "Turn each function into a microservice" - -If a function computes something based on three input values and returns a result, is it a good candidate for a microservice? Should it be a separately deployable application of its own? This really depends on what the function is and how it serves to the entire system. Turning each function into a microservice simply might not make sense in your context. - -Other arbitrary rules include those that don't take into account your entire context, such as the team's experience, DevOps capacity, what the service is doing, and availability needs of the data. - -### 5 characteristics of a well-designed service - -If you've read about microservices, you've no doubt come across advice on what makes a well-designed service. Simply put, high cohesion and loose coupling. There are [many][4] [articles][5] on these concepts to review if you're not familiar with them. And while they offer sound advice, these concepts are quite abstract. Below, based on conversations with experienced CTOs, are key characteristics to keep in mind when creating well-designed microservices. - -#### #1: It doesn't share database tables with another service - -In the early days of SparkPost, Chris McFadden and his team had to solve a problem that every SaaS business faces: They needed to provide basic services like authentication, account management, and billing. - -To tackle this, they created two microservices: a Users API and an Accounts API. The Users API would handle user accounts, API keys, and authentication, while the Accounts API would handle all of the billing-related logic. A very logical separation—but before long, they spotted a problem. - -"We had one service that was called the User API, and we had another one called the Account API. The problem was that they were actually having several calls back and forth between them. So you would do something in accounts and have a call and endpoint in users or vice versa," McFadden explained. - -The two services were too tightly coupled. - -When it comes to designing a microservice, it's a red flag if you have multiple services referencing the same table, as it likely means your DB is a source of coupling. - -It is really about how the service relates to the data, which is exactly what Oleksiy Kovrin, head of [Swiftype SRE, Elastic][6], told me. "One of the main foundational principles we use when developing new services is that they should not cross database boundaries. Each service should rely on its own set of underlying data stores. This allows us to centralize access controls, audit logging, caching logic, etc.," he said. - -Kovyrin went on to explain that if a subset of your database tables "have no or very little connections to the rest of the dataset, it is a strong signal that component could be isolated into a separate API or a separate service." - -Darby Frey, co-founder of [Lead Honestly][7], echoed this sentiment: "Each service should have its own tables [and] should never share database tables." - -#### #2: It has a minimal amount of database tables - -The ideal size of a microservice is small enough, but no smaller. And the same goes for the number of database tables per service. - -Steven Czerwinski, head of engineering, [Scaylr][8], explained during an interview that the sweet spot for Scaylr is "one or two database tables for a service." - -SparkPost's Chris McFadden agreed: "We have a suppression microservices, and it handles, keeps track of, millions and billions of entries around suppressions, but it's all very focused just around suppression, so there's really only one or two tables there. The same goes for other services like webhooks." - -#### #3: It's thoughtfully stateful or stateless - -When designing your microservice, you need to ask yourself whether it requires access to a database or whether it's going to be a stateless service processing terabytes of data like emails or logs. - -Julien Lemoine, CTO of [Algolia][9], explained, "We define the boundaries of a service by defining its input and output. Sometimes a service is a network API, but it can also be a process consuming files and producing records in a database (this is the case of our log-processing service)." - -Be clear about statefulness up front and it will lead to a better-designed service. - -#### #4: Its data availability needs are accounted for - -When designing a microservice, keep in mind what services will rely on this new service and the system-wide impact if that data becomes unavailable. Taking that into account allows you to properly design data backup and recovery systems for this service - -Steven Czerwinski mentioned that at Scaylr, critical customer row space mapping data is replicated and separated in different ways due to its importance. - -In contrast, he added, "The per shard information, that's in its own little partition. It sucks if it goes down because that portion of the customer population is not going to have their logs available, but it's only impacting 5 percent of the customers rather than 100 percent of the customers." - -#### #5: It's a single source of truth - -Design a service to be the single source of truth for something in your system - -For example, when you order something from an e-commerce site, an order ID is generated. This order ID can be used by other services to query an order service for complete information about the order. Using the [publish/subscribe pattern][10], the data that is passed around between services should be the order ID, not the attributes/information of the order itself. Only the order service has complete information and is the single source of truth for a given order. - -### Considerations for larger teams - -Keeping in mind the five considerations listed above, larger teams should be aware of the impacts of their organizational structure on microservice boundaries. - -For larger organizations, where entire teams can be dedicated to owning a service, organizational consideration comes into play when determining service boundaries. And there are two considerations to consider: **independent release schedule** and **different uptime importance**. - -"The most successful implementation of microservices we've seen is either based on a software design principle like domain-driven design, for example, and service-oriented architecture, or the ones that reflect an organizational approach," said Khash Sajadi, CEO of [Cloud66.][11] - -"So [for the] payments team," Sajadi continued, "they have the payment service or credit card validation service, and that's the service they provide to the outside world. So it's not necessarily anything about software. It's mostly about the business unit [that] provides one more service to the outside world." - -### The two-pizza principle - -Amazon is a perfect example of a large organization with multiple teams. As mentioned in an article published in [API Evangelist][12], Jeff Bezos issued a mandate to all employees informing them that every team within the company had to communicate via API. Anyone who didn't would be fired. - -This way, all the data and functionality was exposed through the interface. Bezos also managed to get every team to decouple, define what their resources are, and make them available through the API. Amazon was building a system from the ground up. This allows every team within the company to become a partner of one another. - -I spoke to Travis Reeder, CTO of [Iron.io][13], about Bezos' internal initiative. - -"Jeff Bezos mandated that all teams had to build API's to communicate with other teams," Reeder said. "He's also the guy who came up with the 'two-pizza' rule: A team shouldn't be larger than what two pizzas can feed. - -"I think the same could apply here: Whatever a small team can develop, manage, and be productive with. If it starts to get unwieldy or starts to slow down, it's probably getting too big," Reeder told me. - -### Final considerations: Is your service the right size and properly defined? - -During the testing and implementation phase of your microservice system, there are indicators to keep in mind. - -#### Indicator #1: Is there over-reliance between services? - -If two services are constantly calling back to one another, then that's a strong indication of coupling and a signal that they might be better off combined into one service. - -Going back to Chris McFadden's example where he had two API services, accounts, and users that were constantly communicating with one another, McFadden came up an idea to merge the services and decided to call it the Accuser's API. This turned out to be a fruitful strategy. - -"What we started doing was eliminating these links [which were the] internal API calls between them," McFadden told me. "It's helped simplify the code." - -#### Indicator #2: Does the overhead of setting up the service outweigh the benefit of having the service be independent? - -Darby Frey explained, "Every app needs to have its logs aggregated somewhere and needs to be monitored. You need to set up alerting for it. You need to have standard operating procedures and run books for when things break. You have to manage SSH access to that thing. There's a huge foundation of things that have to exist in order for an app to just run." - -### Key takeaways - -Designing microservices can often feel more like an art than a science. For engineers, that may not sit well. There's lots of general advice out there, but at times it can be a bit too abstract. Let's recap the five specific characteristics to look for when designing your next set of microservices: - - 1. It doesn't share database tables with another service - 2. It has a minimal amount of database tables - 3. It's thoughtfully stateful or stateless - 4. Its data availability needs are accounted for - 5. It's a single source of truth - - - -Next time you're designing a set of microservices and determining service boundaries, referring back to these principles should make the task easier. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/4/guide-design-microservices - -作者:[Jake Lumetta][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/jakelumetta -[1]:https://buttercms.com/books/microservices-for-startups/ -[2]:https://buttercms.com/books/microservices-for-startups/should-you-always-start-with-a-monolith -[3]:https://www.sparkpost.com/ -[4]:https://thebojan.ninja/2015/04/08/high-cohesion-loose-coupling/ -[5]:https://en.wikipedia.org/wiki/Single_responsibility_principle -[6]:https://www.elastic.co/solutions/site-search -[7]:https://leadhonestly.com/ -[8]:https://www.scalyr.com/ -[9]:https://www.algolia.com/ -[10]:https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern -[11]:https://www.cloud66.com/ -[12]:https://apievangelist.com/2012/01/12/the-secret-to-amazons-success-internal-apis/ -[13]:https://www.iron.io/ From 430db9e88fea7283bf936e787643e05f0ca74cfb Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Wed, 16 Jan 2019 10:27:14 +0800 Subject: [PATCH 0612/4278] Add files via upload --- ...d know before you design a microservice.md | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 translated/talk/20180419 5 guiding principles you should know before you design a microservice.md diff --git a/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md b/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md new file mode 100644 index 0000000000..6eee610d0b --- /dev/null +++ b/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md @@ -0,0 +1,155 @@ +设计微服务架构前,您应该了解的5项指导原则 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_OpenInnovation.png?itok=l29msbql) +对于从微服务开始的团队来说,最大的挑战之一就是坚持金发姑娘原则(The *Goldilocks principle*):不要太大, 不要太小,不能太紧密耦合。之所以是挑战的原因是会对究竟什么是设计良好的微服务感到疑惑。 + +数十家 CTOs 通过采访分享了他们的经验, 这些对话说明了设计良好的微服务的五个特点。本文将帮助指导团队设计微服务。(有关详细信息, 请查看即将出版的书籍 [Microservices for Startups][1])。本文将简要介绍微服务的边界和主观的 ”规则“,以避免在深入了解五个特征之前就开始指导您的微服务设计。 + +### 微服务边界 + + [core benefits of developing new systems with microservices][2] (开发具有微服务的新系统的核心优势)其中之一是该体系结构允许开发人员独立构建和修改单个组件, 但在最大限度地减少每个 API 之间的回调数量方面可能会出现问题。 根据 Chris McFadden 的解决方法,[SparkPost ][3] 的工程副总裁,应用适当的服务边界去解决问题。 + +关于边界, 与 domain-driven design (DDD)—a framework for microservices (域驱动设计--微服务框架)有时难以理解和抽象的概念形成鲜明对比,本文重点介绍了与我们行业的一些顶级 CTOs 建立明确定义的微服务边界的实用原则。 + +### 避免主观的 ”规则“ + +如果您阅读了足够多的关于设计和创建微服务的建议,您一定会遇到下面的一些 ”规则“。 尽管将它们用作创建微服务的指南很有吸引力, 但加入这些主观规则并不是思考确定微服务的边界的原则性方式。 + +#### ”微服务应该有 X 行代码“ + +让我们直说:微服务中有多少行代码没有限制。微服务不会因为您写了几行额外的代码而突然变成一个巨无霸。关键是要确保服务中的代码具有很高的内聚性 (稍后将对此进行更多介绍)。 + +#### “将每个功能转换为微服务” + +如果函数基于三个输入值计算某些内容并返回结果,它是否是微服务的理想候选项?它是否应该是单独可部署应用程序?这确实取决于函数是什么以及它是如何服务于整个系统。将每个函数转换为微服务在您的内容中可能根本没有意义。 + +其他主观规则包括不考虑整个内容的规则, 例如团队的经验、 DevOps (Development和Operations的组合词)容量、服务正在执行的操作以及数据的可用性需求。 + +### 精心设计的服务的5个特点 + +如果您读过关于微服务的文章, 您无疑会遇到关于什么是设计良好的服务的建议。简单地说, 高内聚和低耦合。如果您不熟悉这些概念, 有许多文章需要查看 [many][4] [articles][5] 。虽然他们提供了合理的建议,但这些概念是相当抽象的。下面, 基于与经验丰富的 CTOs 的对话, 在创建设计良好的微服务时需要牢记的关键特征。 + +#### #1: 不与其他服务共享数据库表 + +在 SparkPost 的早期, Chris McFadden 和他的团队必须解决一个问题,,每个 SaaS 生意(Software-as-a-Service,软件即服务)都要面对的:他们需要提供基本服务,如身份验证、帐户管理和计费。 + +为了解决这个问题,他们创建了两个微服务:用户 API 和帐户 API。用户 API 将处理用户帐户、API 密钥和身份验证,而帐户 API 将处理所有与计费相关的逻辑。一个非常符合逻辑的分离--但没过多久,他们发现了一个问题。 + +McFadden 解释说,“我们有一个名为 ”用户 API “的服务,还有一个名为”帐户 API “的服务。问题是,他们之间实际上有几个来回的电话。因此, 您会在帐户中执行一些操作,并在用户中具有调用和终结点,反之亦然” + +这两个服务的耦合太紧密了。 + +在设计微服务时, 如果您有多个服务引用同一个表, 则它是一个危险的信号,因为这可能意味着您的数据库是耦合的源头。 + +这确实是关于服务与数据的关系, 这正是Oleksiy Kovrin,[Swiftype SRE, Elastic][6] 的领导者, 告诉我。“我们在开发新服务时使用的主要基本原则之一是, 它们不应跨越数据库边界。每个服务都应依赖于自己的一组基础数据存储。这使我们能够集中访问控制、审计日志记录、缓存逻辑等。” + +Kovrin 接着解释说,如果数据库表的子集 “与数据集的其余部分没有或很少连接,则这是一个强烈的信号, 表明组件可以被隔离到单独的 API 或单独的服务中”。 + +Darby Frey , [Lead Honestly][7] 的联合创始人,与此的观点相呼应:”每个服务都应该有自己的表 [并且] 永远不应该共享数据库表。“ + +#### #2: 数据库表数量最小化 + +微服务的理想尺寸足够小,但不会更小。每个服务的数据库表的数量也是如此。 + +Steven Czerwinski,[Scaylr][8] 的工程主管, 在接受采访时解释说 Scaylr 的最佳选择是 ”一个或两个服务的数据库表“。 + +SparkPost's Chris McFadden 同意:”我们有一个(suppression)限制微服务,它处理, 跟踪, 数以百万计和数十亿的条目周围的限制,但它都非常集中只是围绕限制,所以实际上只有一个或两个表。其他服务也是如此,比如 *webhooks* 。 + +#### #3: 考虑有状态和无状态 + +在设计微服务时,您需要问问自己它是否需要访问数据库,或者它是否会是处理 TB 级数据 (如电子邮件或日志) 的无状态服务。 + +Julien Lemoine, [Algolia][9] 的 CTO,解释说::“我们通过定义服务的输入和输出来定义服务的边界。有时服务是网络 API ,但它也可能是在数据库中使用文件和生成记录的进程 (这就是我们的日志处理服务)。 + +事先要清楚状态,这将引导一个更好的服务设计。 + +#### #4: 考虑数据可用性需求 + +在设计微服务时,请记住哪些服务将依赖于此新服务, 以及在该数据不可用时的全系统影响。考虑到这一点,您可以正确地设计此服务的数据备份和恢复系统。 + +Steven Czerwinski 在 Scaylr 提到,由于关键客户行空间映射数据的重要性,它将以不同的方式复制和分离。 + +他补充说,”每个分片信息,在自己的小分区里。如果因为这部分客户群体不会有他们的可用日志而下降,那很糟糕,但它只影响5% 的客户,而不是100% 的客户。 + +#### #5: 真理的唯一来源 + +设计服务,使其成为系统中某些内容的唯一实际来源 + +例如,当您从电子商务网站订购内容时, 则会生成订单 ID ,其他服务可以使用此订单 ID 来查询订单服务,以获取有关订单的完整信息。使用 [publish/subscribe pattern][10] ,在服务之间传递的数据应该是订单 ID , 而不是订单本身的属性信息。只有订单服务具有完整的信息,并且是给定订单的唯一实际来源。 + +### 大型团队的注意事项 + +考虑到上面列出的五个注意事项,较大的团队应了解其组织结构对微服务边界的影响。 + +对于大型组织,整个团队可以专门拥有服务,在确定服务边界时, 有组织性的考虑因素就会发挥作用。还有两个需要考虑的因素: **独立的发布计划**和**不同的正常运行时间**的重要性。 + +Khash Sajadi , [Cloud66.][11] 的 CEO 说:”我们所看到的微服务最成功的实现要么基于软件设计原则 (例如域驱动设计和面向服务的体系结构), 要么基于反映组织方法的设计原则“ + +”所以 (对于) 支付团队“ Sajadi 继续说,,”他们有支付服务或信用卡验证服务, 这就是他们向外界提供的服务。所以这不一定是关于软件的。这主要是关于为外界提供更多服务的业务单位 “ + +### 双披萨原理 + +Amazon 是一个拥有多个团队的大型组织的完美示例。正如在一篇文章中所提到的, [API Evangelist][12] ,Jeff Bezos向所有员工发出授权,告知他们公司内的每个团队都必须通过 API 进行沟通。任何没有被解雇的人都会被解雇。 + +这样,所有数据和功能都通过接口公开。Bezos 还设法让每个团队分离,定义他们的资源是什么, 并通过 API 使它们可用。亚马逊正在从地面上建立一个系统。这使得公司内的每一支团队都能成为彼此的合作伙伴。 + +Travis Reeder , [Iron.io][13] 的CTO,谈论关于 Bezos 的内部提议。 + +”Jeff Bezos 规定所有团队都必须构建 API 才能与其他团队进行沟通,“ Reeder 说。”他也是提出‘双披萨’规则的人:一支球队不应该比两个比萨饼能养活的大。 + +“我认为这里也可以适用同样的方法:无论一个小型团队是否能够开发、管理和富有成效。如果它开始变得笨重或开始后退。可能会变得太大” Reeder 告诉我。 + +### 最后注意事项: 您的服务是否具有正确的大小和正确定义? + +在微服务系统的测试和实施阶段,有一些指标需要记住。 + +#### 指标 #1: 服务之间是否存在过度依赖? + +如果两个服务不断地相互回调,那么这就是耦合的强烈信号,也是它们可能更好地合并为一个服务的信号。 + +回到 Chris McFadden 的例子, 他有两个 API 服务、帐户和用户不断地相互通信, McFadden 提出了一个合并服务的想法, 并决定将其称为 “原告 API”。事实证明, 这是一项富有成效的战略。”我们开始做的是消除这些链接 [这是] 内部 API 调用投注他们之间“ McFadden 告诉我。这有助于简化代码。 + +#### 指标 #2: 设置服务的开销是否超过了服务独立的好处? + +Darby Frey 解释说,“每个应用都需要将其日志聚合到某个位置,并需要进行监视。你需要设置它的警报。你需要有标准的作业程序,并在事情发生时运行书籍。您必须管理 SSH 对该事物的访问。为了让一个应用单纯运行, 必须存在一个巨大的基础。 + +### 主要外包 + +设计微服务往往会让人感觉更像是一门艺术, 而不是一门科学。对工程师来说, 这可能不是很好。外面有很多一般性的建议, 但有时可能有点太抽象了。让我们回顾一下在设计下一组微服务时要注意的五个具体特征: + + 1. 不与其他服务共享数据库表 + 2. 数据库表数量最小化 + 3. 考虑有状态和无状态 + 4. 考虑数据可用性需求 + 5. 真理的唯一来源 + + + +下次设计一组微服务并确定服务边界时,回顾这些原则应该会使任务变得更容易。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/4/guide-design-microservices + +作者:[Jake Lumetta][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[lixinyuxx](https://github.com/lixinyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jakelumetta +[1]:https://buttercms.com/books/microservices-for-startups/ +[2]:https://buttercms.com/books/microservices-for-startups/should-you-always-start-with-a-monolith +[3]:https://www.sparkpost.com/ +[4]:https://thebojan.ninja/2015/04/08/high-cohesion-loose-coupling/ +[5]:https://en.wikipedia.org/wiki/Single_responsibility_principle +[6]:https://www.elastic.co/solutions/site-search +[7]:https://leadhonestly.com/ +[8]:https://www.scalyr.com/ +[9]:https://www.algolia.com/ +[10]:https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern +[11]:https://www.cloud66.com/ +[12]:https://apievangelist.com/2012/01/12/the-secret-to-amazons-success-internal-apis/ +[13]:https://www.iron.io/ From 7bc0a24f8210871b9960bbe84a385866d7f28f0c Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 16 Jan 2019 11:35:21 +0800 Subject: [PATCH 0613/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190107=20Test?= =?UTF-8?q?ing=20isn't=20everything\n=20=20sources/tech/20190107=20Testing?= =?UTF-8?q?=20isn-t=20everything.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190107 Testing isn-t everything.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 sources/tech/20190107 Testing isn-t everything.md diff --git a/sources/tech/20190107 Testing isn-t everything.md b/sources/tech/20190107 Testing isn-t everything.md new file mode 100644 index 0000000000..b2a2daaaac --- /dev/null +++ b/sources/tech/20190107 Testing isn-t everything.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Testing isn't everything) +[#]: via: (https://arp242.net/weblog/testing.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +Testing isn't everything +====== + +This is adopted from a discussion about [Want to write good unit tests in go? Don’t panic… or should you?][1] While this mainly talks about Go a lot of the points also apply to other languages. + +Some of the most difficult code I’ve worked with is code that is “easily testable”. Code that abstracts everything to the point where you have no idea what’s going on, just so that it can add a “unit test” to what would otherwise be a very straightforward function. DHH called this [Test-induced design damage][2]. + +Testing is just one tool to make sure that your program works, out of several. Another very important tool is writing code in such a way that it is easy to understand and reason about (“simplicity”). + +Books that advocate extensive testing – such as Robert C. Martin’s Clean Code – were written, in part, as a response to ever more complex programs, where you read 1,000 lines of code but still had no idea what’s going on. I recently had to port a simple Java “emoji replacer” (😂 ➙ 😂) to Go. To ensure compatibility I looked up the im­ple­men­ta­tion. It was a whole bunch of classes, factories, and whatnot which all just resulted in calling a regexp on a string. 🤷 + +In dynamic languages like Ruby and Python tests are important for a different reason, as something like this will “work” just fine: + +``` +if condition: + print('w00t') +else: + nonexistent_function() +``` + +Except of course if that `else` branch is entered. It’s easy to typo stuff, or mix stuff up. + +In Go, both of these problems are less of a concern. It has a good static type system, and the focus is on simple straightforward code that is easy to comprehend. Even for a number of dynamic languages there are optional typing systems (function annotations in Python, TypeScript for JavaScript). + +Sometimes you can do a straightforward implementation that doesn’t sacrifice anything for testability; great! But sometimes you have to strike a balance. For some code, not adding a unit test is fine. + +Intensive focus on “unit tests” can be incredibly damaging to a code base. Some codebases have a gazillion unit tests, which makes any change excessively time-consuming as you’re fixing up a whole bunch of tests for even trivial changes. Often times a lot of these tests are just duplicates; adding tests to every layer of a simple CRUD HTTP endpoint is a common example. In many apps it’s fine to just rely on a single integration test. + +Stuff like SQL mocks is another great example. It makes code more complex, harder to change, all so we can say we added a “unit test” to `select * from foo where x=?`. The worst part is, it doesn’t even test anything other than verifying you didn’t typo an SQL query. As soon as the test starts doing anything useful, such as verifying that it actually returns the correct rows from the database, the Unit Test purists will start complaining that it’s not a True Unit Test™ and that You’re Doing It Wrong™. +For most queries, the integration tests and/or manual tests are fine, and extensive SQL mocks are entirely superfluous at best, and harmful at worst. + +There are exceptions, of course; if you’ve got a lot of `if cond { q += "more sql" }` then adding SQL mocks to verify the correctness of that logic might be a good idea. Even in those cases a “non-unit unit test” (e.g. one that just accesses the database) is still a viable option. Integration tests are also still an option. A lot of applications don’t have those kind of complex queries anyway. + +One important reason for the focus on unit tests is to ensure test code runs fast. This was a response to massive test harnesses that take a day to run. This, again, is not really a problem in Go. All integration tests I’ve written run in a reasonable amount of time (several seconds at most, usually faster). The test cache introduced in Go 1.10 makes it even less of a concern. + +Last year a coworker refactored our ETag-based caching library. The old code was very straightforward and easy to understand, and while I’m not claiming it was guaranteed bug-free, it did work very well for a long time. + +It should have been written with some tests in place, but it wasn’t (I didn’t write the original version). Note that the code was not completely untested, as we did have integration tests. + +The refactored version is much more complex. Aside from the two weeks lost on refactoring a working piece of code to … another working piece of code (topic for another post), I’m not so convinced it’s actually that much better. I consider myself a reasonably accomplished and experienced programmer, with a reasonable knowledge and experience in Go. I think that in general, based on feedback from peers and performance reviews, I am at least a programmer of “average” skill level, if not more. + +If an average programmer has trouble comprehending what is in essence a handful of simple functions because there are so many layers of abstractions, then something has gone wrong. The refactor traded one tool to verify correctness (simplicity) with another (testing). Simplicity is hardly a guarantee to ensure correctness, but neither are unit tests. Ideally, we should do both. + +Postscript: the refactor introduced a bug and removed a feature that was useful, but is now harder to add, not in the least because the code is much more complex. + +All units working correctly gives exactly zero guarantees that the program is working correctly. A lot of logic errors won’t be caught because the logic consists of several units working together. So you need integration tests, and if the integration tests duplicate half of your unit tests, then why bother with those unit tests? + +Test Driven Development (TDD) is also just one tool. It works well for some problems; not so much for others. In particular, I think that “forced to write code in tiny units” can be terribly harmful in some cases. Some code is just a serial script which says “do this, and then that, and then this”. Splitting that up in a whole bunch of “tiny units” can greatly reduce how easy the code is to understand, and thus harder to verify that it is correct. + +I’ve had to fix some Ruby code where everything was in tiny units – there is a strong culture of TDD in the Ruby community – and even though the units were easy to understand I found it incredibly hard to understand the application logic. If everything is split in “tiny units” then understanding how everything fits together to create an actual program that does something useful will be much harder. + +You see the same friction in the old microkernel vs. monolithic kernel debate, or the more recent microservices vs. monolithic app one. In principle splitting everything up in small parts sounds like a great idea, but in practice it turns out that making all the small parts work together is a very hard problem. A hybrid approach seems to work best for kernels and app design, balancing the ad­van­tages and downsides of both approaches. I think the same applies to code. + +To be clear, I am not against unit tests or TDD and claiming we should all gung-go cowboy code our way through life 🤠. I write unit tests and practice TDD, when it makes sense. My point is that unit tests and TDD are not the solution to every single last problem and should applied indiscriminately. This is why I use words such as “some” and “often” so frequently. + +This brings me to the topic of testing frameworks. I have never understood what problem libraries such as [goblin][3] are solving. How is this: + +``` +Expect(err).To(nil) +Expect(out).To(test.wantOut) +``` + +An improvement over this? + +``` +if err != nil { + t.Fatal(err) +} + +if out != tt.want { + t.Errorf("out: %q\nwant: %q", out, tt.want) +} +``` + +What’s wrong with `if` and `==`? Why do we need to abstract it? Note that with table-driven tests you’re only typing these checks once, so you’re saving just a few lines here. + +[Ginkgo][4] is even worse. It turns a very simple, straightforward, and understandable piece of code and doesn’t just abstract `if`, it also chops up the execution in several different functions (`BeforeEach()` and `DescribeTable()`). + +This is known as Behaviour-driven development (BDD). I am not entirely sure what to think of BDD. I am skeptical, but I’ve never properly used it in a large project so I’m hesitant to just dismiss it. Note that I said “properly”: most projects don’t really use BDD, they just use a library with a BDD syntax and shoehorn their testing code in to that. That’s ad-hoc BDD, or faux-BDD. + +Whatever merits BDD may have, they are not present simply because your testing code vaguely resembles BDD-style syntax. This on its own demonstrates that BDD is perhaps not a great idea for many projects. + +I think there are real problems with these BDD(-ish) test tools, as they obfuscate what you’re actually doing. No matter what, testing remains a matter of getting the output of a function and checking if that matches what you expected. No testing methodology is going to change that fundamental. The more layers you add on top of that, the harder it will be to debug. + +When determining if something is “easy” then my prime concern is not how easy something is to write, but how easy something is to debug when things fail. I will gladly spend a bit more effort writing things if that makes things a lot easier to debug. + +All code – including testing code – can fail in confusing, surprising, and unexpected ways (a “bug”), and then you’re expected to debug that code. The more complex the code, the harder it is to debug. + +You should expect all code – including testing code – to go through several debugging cycles. Note that with debugging cycle I don’t mean “there is a bug in the code you need to fix”, but rather “I need to look at this code to fix the bug”. + +In general, I already find testing code harder to debug than regular code, as the “code surface” tends to be larger. You have the testing code and the actual implementation code to think of. That’s a lot more than just thinking of the implementation code. + +Adding these abstractions means you will now also have to think about that, too! This might be okay if the abstractions would reduce the scope of what you have to think about, which is a common reason to add abstractions in regular code, but it doesn’t. It just adds more things to think about. + +So these are exactly the wrong kind of abstractions: they wrap and obfuscate, rather than separate concerns and reduce the scope. + +If you’re interested in soliciting contributions from other people in open source projects then making your tests understandable is a very important concern (it’s also important in business context, but a bit less so, as you’ve got actual time to train people). + +Seeing PRs with “here’s the code, it works, but I couldn’t figure out the tests, plz halp!” is not uncommon; and I’m fairly sure that at least a few people never even bothered to submit PRs just because they got stuck on the tests. I know I have. + +There is one open source project that I contributed to, and would like to contribute more to, but don’t because it’s just too hard to write and run tests. Every change is “write working code in 15 minutes, spend 45 minutes dealing with tests”. It’s … no fun at all. + +Writing good software is hard. I’ve got some ideas on how to do it, but don’t have a comprehensive view. I’m not sure if anyone really does. I do know that “always add unit tests” and “always practice TDD” isn’t the answer, in spite of them being useful concepts. To give an analogy: most people would agree that a free market is a good idea, but at the same time even most libertarians would agree it’s not the complete solution to every single problem (well, [some do][5], but those ideas are … rather misguided). + +You can mail me at [martin@arp242.net][6] or [create a GitHub issue][7] for feedback, questions, etc. + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/testing.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://medium.com/@jens.neuse/want-to-write-good-unit-tests-in-go-dont-panic-or-should-you-ba3eb5bf4f51 +[2]: http://david.heinemeierhansson.com/2014/test-induced-design-damage.html +[3]: https://github.com/franela/goblin +[4]: https://github.com/onsi/ginkgo +[5]: https://en.wikipedia.org/wiki/Murray_Rothbard#Children's_rights_and_parental_obligations +[6]: mailto:martin@arp242.net +[7]: https://github.com/Carpetsmoker/arp242.net/issues/new From 90cc9626c8df423c54ef404bfdd9451f64b65dad Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 16 Jan 2019 11:49:40 +0800 Subject: [PATCH 0614/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190114=20Get?= =?UTF-8?q?=20started=20with=20Wekan,=20an=20open=20source=20kanban=20boar?= =?UTF-8?q?d=20sources/tech/20190114=20Get=20started=20with=20Wekan,=20an?= =?UTF-8?q?=20open=20source=20kanban=20board.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...with Wekan, an open source kanban board.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/tech/20190114 Get started with Wekan, an open source kanban board.md diff --git a/sources/tech/20190114 Get started with Wekan, an open source kanban board.md b/sources/tech/20190114 Get started with Wekan, an open source kanban board.md new file mode 100644 index 0000000000..cdceb44b1b --- /dev/null +++ b/sources/tech/20190114 Get started with Wekan, an open source kanban board.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Wekan, an open source kanban board) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-wekan) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Wekan, an open source kanban board +====== +In the second article in our series on open source tools that will make you more productive in 2019, check out Wekan. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban-board.png?itok=tXC0dkKV) + +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 second of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Wekan + +[Kanban][1] boards are a mainstay of today's agile processes. And many of us (myself included) use them to organize not just our work but also our personal lives. I know several artists who use apps like [Trello][2] to keep track of their commision lists as well as what's in progress and what's complete. + +![](https://opensource.com/sites/default/files/uploads/wekan-1.png) + +But these apps are often linked to a work account or a commercial service. Enter [Wekan][3], an open source kanban board you can run locally or on the service of your choice. Wekan offers much of the same functionality as other Kanban apps, such as creating boards, lists, swimlanes, and cards, dragging and dropping between lists, assigning to users, labeling cards, and doing pretty much everything else you'd expect in a modern kanban board. + +![](https://opensource.com/sites/default/files/uploads/wekan-2.png) + +The thing that distinguishes Wekan from most other kanban boards is the built-in rules. While most other boards support emailing updates, Wekan allows you to set up triggers when taking actions on cards, checklists, and labels. + +![](https://opensource.com/sites/default/files/uploads/wekan-3.png) + +Wekan can then take actions like moving cards, updating labels, adding checklists, and sending emails. + +![](https://opensource.com/sites/default/files/uploads/wekan-4.png) + +Setting up Wekan locally is a snap—literally. If your desktop supports [Snapcraft][4] applications, installing is as easy as: + +``` +sudo snap install wekan +``` + +It also supports Docker, which means installing on a server is reasonably straightforward on most servers and desktops. + +Overall, if you want a nice kanban board that you can run yourself, Wekan has you covered. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-wekan + +作者:[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/Kanban +[2]: https://www.trello.com +[3]: https://wekan.github.io/ +[4]: https://snapcraft.io/ From 7658be87dd81d172d706dda92a0f3b4b01f69224 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 16 Jan 2019 11:55:13 +0800 Subject: [PATCH 0615/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190115=20The?= =?UTF-8?q?=20Art=20of=20Unix=20Programming,=20reformatted=20sources/talk/?= =?UTF-8?q?20190115=20The=20Art=20of=20Unix=20Programming,=20reformatted.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...he Art of Unix Programming, reformatted.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/talk/20190115 The Art of Unix Programming, reformatted.md diff --git a/sources/talk/20190115 The Art of Unix Programming, reformatted.md b/sources/talk/20190115 The Art of Unix Programming, reformatted.md new file mode 100644 index 0000000000..73ffb4c955 --- /dev/null +++ b/sources/talk/20190115 The Art of Unix Programming, reformatted.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Art of Unix Programming, reformatted) +[#]: via: (https://arp242.net/weblog/the-art-of-unix-programming.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +The Art of Unix Programming, reformatted +====== + +tl;dr: I reformatted Eric S. Raymond’s The Art of Unix Programming for readability; [read it here][1]. + +I recently wanted to look up a quote for an article I was writing, and I was fairly sure I had read it in The Art of Unix Programming. Eric S. Raymond (esr) has [kindly published it online][2], but it’s difficult to search as it’s distributed over many different pages, and the formatting is not exactly conducive for readability. + +I `wget --mirror`’d it to my drive, and started out with a simple [script][3] to join everything to a single page, but eventually ended up rewriting a lot of the HTML from crappy 2003 docbook-generated tagsoup to more modern standards, and I slapped on some CSS to make it more readable. + +The results are fairly nice, and it should work well in any version of any browser (I haven’t tested Internet Explorer and Edge, lacking access to a Windows computer, but I’m reasonably confident it should work without issues; if not, see the bottom of this page on how to get in touch). + +The HTML could be simplified further (so rms can read it too), but dealing with 360k lines of ill-formatted HTML is not exactly my idea of fun, so this will have to do for now. + +The entire page is self-contained. You can save it to your laptop or mobile phone and read it on a plane or whatnot. + +Why spend so much work on an IT book from 2003? I think a substantial part of the book still applies very much today, for all programmers (not just Unix programmers). For example the [Basics of the Unix Philosophy][4] was good advice in 1972, is still good advice in 2019, and will continue to be good advice well in to the future. + +Other parts have aged less gracefully; for example “since 2000, practice has been moving toward use of XML-DocBook as a documentation interchange format” doesn’t really represent the current state of things, and the [Data File Metaformats][5] section mentions XML and INI, but not JSON or YAML (as they weren’t invented until after the book was written) + +I find this adds, rather than detracts. It makes for an interesting window in to past. The downside is that the uninitiated will have a bit of a hard time distinguishing between the good and outdated parts; as a rule of thumb: if it talks about abstract concepts, it probably still applies today. If it talks about specific software, it may be outdated. + +I toyed with the idea of updating or annotating the text, but the license doesn’t allow derivative works, so that’s not going to happen. Perhaps I’ll email esr and ask nicely. Another project, for another weekend :-) + +You can mail me at [martin@arp242.net][6] or [create a GitHub issue][7] for feedback, questions, etc. + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/the-art-of-unix-programming.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://arp242.net/the-art-of-unix-programming/ +[2]: http://catb.org/~esr/writings/taoup/html/ +[3]: https://arp242.net/the-art-of-unix-programming/fix-taoup.py +[4]: https://arp242.net/the-art-of-unix-programming#ch01s06 +[5]: https://arp242.net/the-art-of-unix-programming/#ch05s02 +[6]: mailto:martin@arp242.net +[7]: https://github.com/Carpetsmoker/arp242.net/issues/new From 44d319d939653b01583a8cbe3a42a1f1aabbf860 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 16 Jan 2019 12:00:02 +0800 Subject: [PATCH 0616/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190114=20Hege?= =?UTF-8?q?mon=20=E2=80=93=20A=20Modular=20System=20And=20Hardware=20Monit?= =?UTF-8?q?oring=20Tool=20For=20Linux=20sources/tech/20190114=20Hegemon=20?= =?UTF-8?q?-=20A=20Modular=20System=20And=20Hardware=20Monitoring=20Tool?= =?UTF-8?q?=20For=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... And Hardware Monitoring Tool For Linux.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md diff --git a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md new file mode 100644 index 0000000000..28b5d5cd27 --- /dev/null +++ b/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Hegemon – A Modular System And Hardware Monitoring Tool For Linux) +[#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Hegemon – A Modular System And Hardware Monitoring Tool For Linux +====== + +I know that everybody is preferring for **[TOP Command][1]** to monitor system utilization. + +It’s one of the best and native command which used by vast of Linux administrators. + +In Linux there is an alternative for everything respective of packages. + +There are many utilities are available for this purpose in Linux and i prefer **[HTOP Command][2]**. + +If you want to know about other alternatives, i would suggest you to navigate to the each link to know more about it. + +Those are htop, CorFreq, glances, atop, Dstat, Gtop, Linux Dash, Netdata, Monit, etc. + +All these tools only allow us to monitor system utilization and not for the system hardware’s. + +But Hegemon is allow us to monitor both in the single dashboard. + +If you are looking for system hardware monitoring then i would suggest you to check **[lm_sensors][3]** and **[s-tui Stress Terminal UI][4]** utilities. + +### What’s Hegemon? + +Hegemon is a work-in-progress modular system monitor written in safe Rust. + +It allow users to monitor both utilization in a single dashboard. It’s system utilization and hardware temperatures. + +### Currently Available Features in Hegemon + + * Monitor CPU and memory usage, temperatures, and fan speeds + * Expand any data stream to reveal a more detailed graph and additional information + * Adjustable update interval + * Clean MVC architecture with good code quality + * Unit tests + + + +### Planned Features include + + * macOS and BSD support (only Linux is supported at the moment) + * Monitor disk and network I/O, GPU usage (maybe), and more + * Select and reorder data streams + * Mouse control + + + +### How to Install Hegemon in Linux? + +Hegemon is requires Rust 1.26 or later and the development files for libsensors. So, make sure these packages were installed before your perform Hegemon installation. + +libsensors library package is available in most of the distribution official repository so, use the following command to install it. + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][5]** or **[APT Command][6]** to install libsensors on your systems. + +``` +# apt install lm_sensors-devel +``` + +For **`Fedora`** system, use **[DNF Package Manager][7]** to install libsensors on your system. + +``` +# dnf install libsensors4-dev +``` + +Run the following command to install Rust programming language and follow the instruction. Navigate to the following URL if you want handy tutorials for **[Rust installation][8]**. + +``` +$ curl https://sh.rustup.rs -sSf | sh +``` + +If you have successfully installed Rust. Run the following command to install Hegemon. + +``` +$ cargo install hegemon +``` + +### How to Lunch Hegemon in Linux? + +Once you successfully install Hegemon package. Run run the below command to launch it. + +``` +$ hegemon +``` + +![][10] + +I was facing an issue when i was launching the “Hegemon” application due to libsensors.so.4 libraries issue. + +``` +$ hegemon +error while loading shared libraries: libsensors.so.4: cannot open shared object file: No such file or directory manjaro +``` + +I’m using Manjaro 18.04. It has the libsensors.so & libsensors.so.5 shared libraries and not for libsensors.so.4. So, i just created the following symlink to fix the issue. + +``` +$ sudo ln -s /usr/lib/libsensors.so /usr/lib/libsensors.so.4 +``` + +Here is the sample gif file which was taken from my Lenovo-Y700 laptop. +![][11] + +By default it shows only overall summary and if you would like to see the detailed output then you need to expand the each section. See the expanded output with Hegemon. +![][12] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-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/top-command-examples-to-monitor-server-performance/ +[2]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/ +[3]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ +[4]: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ +[5]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[7]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[8]: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ +[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-1.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-2a.gif +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-3.png From b39a87179d8b90e5b37476fc6ad19b5d055ecca0 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 16 Jan 2019 12:02:33 +0800 Subject: [PATCH 0617/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190115=20Linu?= =?UTF-8?q?x=20Tools:=20The=20Meaning=20of=20Dot=20sources/tech/20190115?= =?UTF-8?q?=20Linux=20Tools-=20The=20Meaning=20of=20Dot.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0190115 Linux Tools- The Meaning of Dot.md | 183 ++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 sources/tech/20190115 Linux Tools- The Meaning of Dot.md diff --git a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md new file mode 100644 index 0000000000..5e18c7603d --- /dev/null +++ b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Tools: The Meaning of Dot) +[#]: via: (https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +Linux Tools: The Meaning of Dot +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/psychedelic-dot.jpg?itok=giKEHvwQ) + +Let's face it: writing one-liners and scripts using shell commands can be confusing. Many of the names of the tools at your disposal are far from obvious in terms of what they do ( _grep_ , _tee_ and _awk_ , anyone?) and, when you combine two or more, the resulting "sentence" looks like some kind of alien gobbledygook. + +None of the above is helped by the fact that many of the symbols you use to build a chain of instructions can mean different things depending on their context. + +### Location, location, location + +Take the humble dot (`.`) for example. Used with instructions that are expecting the name of a directory, it means "this directory" so this: + +``` +find . -name "*.jpg" +``` + +translates to " _find in this directory (and all its subdirectories) files that have names that end in`.jpg`_ ". + +Both `ls .` and `cd .` act as expected, so they list and "change" to the current directory, respectively, although including the dot in these two cases is not necessary. + +Two dots, one after the other, in the same context (i.e., when your instruction is expecting a directory path) means " _the directory immediately above the current one_ ". If you are in _/home/your_directory_ and run + +``` +cd .. +``` + +you will be taken to _/home_. So, you may think this still kind of fits into the “dots represent nearby directories” narrative and is not complicated at all, right? + +How about this, then? If you use a dot at the beginning of a directory or file, it means the directory or file will be hidden: + +``` +$ touch somedir/file01.txt somedir/file02.txt somedir/.secretfile.txt +$ ls -l somedir/ +total 0 +-rw-r--r-- 1 paul paul 0 Jan 13 19:57 file01.txt +-rw-r--r-- 1 paul paul 0 Jan 13 19:57 file02.txt +$ # Note how there is no .secretfile.txt in the listing above +$ ls -la somedir/ +total 8 +drwxr-xr-x 2 paul paul 4096 Jan 13 19:57 . +drwx------ 48 paul paul 4096 Jan 13 19:57 .. +-rw-r--r-- 1 paul paul 0 Jan 13 19:57 file01.txt +-rw-r--r-- 1 paul paul 0 Jan 13 19:57 file02.txt +-rw-r--r-- 1 paul paul 0 Jan 13 19:57 .secretfile.txt +$ # The -a option tells ls to show "all" files, including the hidden ones +``` + +And then there's when you use `.` as a command. Yep! You heard me: `.` is a full-fledged command. It is a synonym of `source` and you use that to execute a file in the current shell, as opposed to running a script some other way (which usually mean Bash will spawn a new shell in which to run it). + +Confused? Don't worry -- try this: Create a script called _myscript_ that contains the line + +``` +myvar="Hello" +``` + +and execute it the regular way, that is, with `sh myscript` (or by making the script executable with `chmod a+x myscript` and then running `./myscript`). Now try and see the contents of `myvar` with `echo $myvar` (spoiler: You will get nothing). This is because, when your script plunks " _Hello_ " into `myvar`, it does so in a separate bash shell instance. When the script ends, the spawned instance disappears and control returns to the original shell, where `myvar` never even existed. + +However, if you run _myscript_ like this: + +``` +. myscript +``` + +`echo $myvar` will print _Hello_ to the command line. + +You will often use the `.` (or `source`) command after making changes to your _.bashrc_ file, [like when you need to expand your `PATH` variable][1]. You use `.` to make the changes available immediately in your current shell instance. + +### Double Trouble + +Just like the seemingly insignificant single dot has more than one meaning, so has the double dot. Apart from pointing to the parent of the current directory, the double dot (`..`) is also used to build sequences. + +Try this: + +``` +echo {1..10} +``` + +It will print out the list of numbers from 1 to 10. In this context, `..` means " _starting with the value on my left, count up to the value on my right_ ". + +Now try this: + +``` +echo {1..10..2} +``` + +You'll get _1 3 5 7 9_. The `..2` part of the command tells Bash to print the sequence, but not one by one, but two by two. In other words, you'll get all the odd numbers from 1 to 10. + +It works backwards, too: + +``` +echo {10..1..2} +``` + +You can also pad your numbers with 0s. Doing: + +``` +echo {000..121..2} +``` + +will print out every even number from 0 to 121 like this: + +``` +000 002 004 006 ... 050 052 054 ... 116 118 120 +``` + +But how is this sequence-generating construct useful? Well, suppose one of your New Year's resolutions is to be more careful with your accounts. As part of that, you want to create directories in which to classify your digital invoices of the last 10 years: + +``` +mkdir {2009..2019}_Invoices +``` + +Job done. + +Or maybe you have a hundreds of numbered files, say, frames extracted from a video clip, and, for whatever reason, you want to remove only every third frame between the frames 43 and 61: + +``` +rm frame_{043..61..3} +``` + +It is likely that, if you have more than 100 frames, they will be named with padded 0s and look like this: + +``` +frame_000 frame_001 frame_002 ... +``` + +That’s why you will use `043` in your command instead of just `43`. + +### Curly~Wurly + +Truth be told, the magic of sequences lies not so much in the double dot as in the sorcery of the curly braces (`{}`). Look how it works for letters, too. Doing: + +``` +touch file_{a..z}.txt +``` + +creates the files _file_a.txt_ through _file_z.txt_. + +You must be careful, however. Using a sequence like `{Z..a}` will run through a bunch of non-alphanumeric characters (glyphs that are neither numbers or letters) that live between the uppercase alphabet and the lowercase one. Some of these glyphs are unprintable or have a special meaning of their own. Using them to generate names of files could lead to a whole bevy of unexpected and potentially unpleasant effects. + +One final thing worth pointing out about sequences encased between `{...}` is that they can also contain lists of strings: + +``` +touch {blahg, splurg, mmmf}_file.txt +``` + +Creates _blahg_file.txt_ , _splurg_file.txt_ and _mmmf_file.txt_. + +Of course, in other contexts, the curly braces have different meanings (surprise!). But that is the stuff of another article. + +### Conclusion + +Bash and the utilities you can run within it have been shaped over decades by system administrators looking for ways to solve very particular problems. To say that sysadmins and their ways are their own breed of special would be an understatement. Consequently, as opposed to other languages, Bash was not designed to be user-friendly, easy or even logical. + +That doesn't mean it is not powerful -- quite the contrary. Bash's grammar and shell tools may be inconsistent and sprawling, but they also provide a dizzying range of ways to do everything you can possibly imagine. It is like having a toolbox where you can find everything from a power drill to a spoon, as well as a rubber duck, a roll of duct tape, and some nail clippers. + +Apart from fascinating, it is also fun to discover all you can achieve directly from within the shell, so next time we will delve ever deeper into how you can build bigger and better Bash command lines. + +Until then, have fun! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot + +作者:[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/2018/12/bash-variables-environmental-and-otherwise From 92615dab5a0abc49a52d652a31f28151b8c74fb5 Mon Sep 17 00:00:00 2001 From: runningwater Date: Wed, 16 Jan 2019 14:16:11 +0800 Subject: [PATCH 0618/4278] =?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/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 29a76f810f..2e7b9a9b74 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: ( ) +[#]: translator: (runningwater) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -96,7 +96,7 @@ via: https://anarc.at/blog/2018-12-21-large-files-with-git/ 作者:[Anarc.at][a] 选题:[lujun9972][b] -译者:[译者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 c8bf110d3e97a73c04201d5a8d8e56766a8be09d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 16 Jan 2019 14:48:48 +0800 Subject: [PATCH 0619/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190114=20Remo?= =?UTF-8?q?te=20Working=20Survival=20Guide=20sources/talk/20190114=20Remot?= =?UTF-8?q?e=20Working=20Survival=20Guide.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190114 Remote Working Survival Guide.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/talk/20190114 Remote Working Survival Guide.md diff --git a/sources/talk/20190114 Remote Working Survival Guide.md b/sources/talk/20190114 Remote Working Survival Guide.md new file mode 100644 index 0000000000..42b151f4cb --- /dev/null +++ b/sources/talk/20190114 Remote Working Survival Guide.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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/) + +Remote Working Survival Guide +====== +![](https://www.jonobacon.com/wp-content/uploads/2019/01/5b5471d7eadb585ec8b8a0c3_featureimage-remotejob-1080x675.jpg) + +Remote working seems to be all the buzz. Apparently, [70% of professionals work from home at least once a week][1]. Similarly, [77% of people work more productively][2] and [68% of millennials would consider a company more if they offered remote working][3]. It seems to make sense: technology, connectivity, and culture seem to be setting the world up more and more for remote working. Oh, and home-brewed coffee is better than ever too. + +Now, I am going to write another piece for how companies should optimize for remote working (so make sure you [Join As a Member][4] to stay tuned — it is free). + +Today though I want to **share recommendations for how individuals can do remote working well themselves**. Whether you are a full-time remote worker or have the option of working from home a few days a week, this article should hopefully be helpful. + +Now, you need to know that **remote working is not a panacea**. Sure, it seems like hanging around at home in your jimjams, listening to your antisocial music, and sipping on buckets of coffee is perfect, but it isn’t for everyone. + +Some people need the structure of an office. Some people need the social element of an office. Some people need to get out the house. Some people lack the discipline to stay focused at home. Some people are avoiding the government coming and knocking on the door due to years of unpaid back taxes. + +**Remote working is like a muscle: it can bring enormous strength and capabilities IF you train and maintain it**. If you don’t, your results are going to vary. + +I have worked from home for the vast majority of my career. I love it. I am more productive, happier, and empowered when I work from home. I don’t dislike working in an office, and I enjoy the social element, but I am more in my “zone” when I work from home. I also love blisteringly heavy metal, which can pose a problem when the office don’t want to listen to [After The Burial][5]. + +![][6] +“Squirrel.” +[Credit][7] + +I have learned how I need to manage remote work, using the right balance of work routine, travel, and other elements, and here are some of my recommendations. Be sure to **share yours in the comments**. + +### 1\. You need discipline and routine (and to understand your “waves”) + +Remote work really is a muscle that needs to be trained. Just like building actual muscle, there needs to be a clear routine and a healthy dollop of discipline mixed in. + +Always get dressed (no jimjams). Set your start and end time for your day (I work 9am – 6pm most days). Choose your lunch break (mine is 12pm). Choose your morning ritual (mine is email followed by a full review of my client needs). Decide where your main workplace will be (mine is my home office). Decide when you will exercise each day (I do it at 5pm most days). + +**Design a realistic routine and do it for 66 days**. It takes this long to build a habit. Try not to deviate from the routine. The more you stick the routine, the less work it will seem further down the line. By the end of the 66 days it will feel natural and you won’t have to think about it. + +Here’s the deal though, we don’t live in a vacuum ([cleaner, or otherwise][8]). We all have waves. + +A wave is when you need a change of routine to mix things up. For example, in summertime I generally want more sunlight. I will often work outside in the garden. Near the holidays I get more distracted, so I need more structure in my day. Sometimes I just need more human contact, so I will work from coffee shops for a few weeks. Sometimes I just fancy working in the kitchen or on the couch. You need to learn your waves and listen to your body. **Build your habit first, and then modify it as you learn your waves**. + +### 2\. Set expectations with your management and colleagues + +Not everyone knows how to do remote working, and if your company is less familiar with remote working, you especially need to set expectations with colleagues. + +This can be pretty simple: **when you have designed your routine, communicate it clearly to your management and team**. Let them know how they can get hold of you, how to contact you in an emergency, and how you will be collaborating while at home. + +The communication component here is critical. There are some remote workers who are scared to leave their computer for fear that someone will send them a message while they are away (and they are worried people may think they are just eating Cheetos and watching Netflix). + +You need time away. You need to eat lunch without one eye on your computer. You are not a 911 emergency responder. **Set expectations that sometimes you may not be immediately responsive, but you will get back to them as soon as possible**. + +Similarly, set expectations on your general availability. For example, I set expectations with clients that I generally work from 9am – 6pm every day. Sure, if a client needs something urgently, I am more than happy to respond outside of those hours, but as a general rule I am usually working between those hours. This is necessary for a balanced life. + +### 3\. Distractions are your enemy and they need managing + +We all get distracted. It is human nature. It could be your young kid getting home and wanting to play Rescue Bots. It could be checking Facebook, Instagram, or Twitter to ensure you don’t miss any unwanted political opinions or photos of people’s lunches. It could be that there is something else going on your life that is taking your attention (such as an upcoming wedding, event, or big trip.) + +**You need to learn what distracts you and how to manage it**. For example, I know I get distracted by my email and Twitter. I check it religiously and every check gets me out of the zone of what I am working on. I also get distracted by grabbing coffee and water, which then may turn into a snack and a YouTube video. + +![][9] +My nemesis for distractions. + +The digital distractions have a simple solution: **lock them out**. Close down the tabs until you complete what you are doing. I do this all the time with big chunks of work: I lock out the distractions until I am done. It requires discipline, but all of this does. + +The human elements are tougher. If you have a family you need to make it clear that when you are work, you need to be generally left alone. This is why a home office is so important: you need to set boundaries that mum or dad is working. Come in if there is emergency, but otherwise they need to be left alone. + +There are all kinds of opportunities for locking these distractions out. Put your phone on silent. Set yourself as away. Move to a different room (or building) where the distraction isn’t there. Again, be honest in what distracts you and manage it. If you don’t, you will always be at their mercy. + +### 4\. Relationships need in-person attention + +Some roles are more attuned to remote working than others. For example, I have seen great work from engineering, quality assurance, support, security, and other teams (typically more focused on digital collaboration). Other teams such as design or marketing often struggle more in remote environments (as they are often more tactile.) + +With any team though, having strong relationship is critical, and in-person discussion, collaboration, and socializing is essential to this. So many of our senses (such as body language) are removed in a digital environment, and these play a key role in how we build trust and relationships. + +![][10] +Rockets also help. + +This is especially important if (a) you are new a company and need to build these relationships, (b) are new to a role and need to build relationships with your team, or (c) are in a leadership position where building buy-in and engagement is a key part of your job. + +**The solution? A sensible mix of remote and in-person time.** If your company is nearby, work from home part of the week and at the office part of the week. If your company is further a away, schedule regular trips to the office (and set expectations with your management that you need this). For example, when I worked at XPRIZE I flew to LA every few weeks for a few days. When I worked at Canonical (who were based in London), we had sprints every three months. + +### 5\. Stay focused, but cut yourself some slack + +The crux of everything in this article is about building a capability, and developing a remote working muscle. This is as simple as building a routine, sticking to it, and having an honest view of your “waves” and distractions and how to manage them. + +I see the world in a fairly specific way: **everything we do has the opportunity to be refined and improved**. For example, I have been public speaking now for over 15 years, but I am always discovering new ways to improve, and new mistakes to fix (speaking of which, see my [10 Ways To Up Your Public Speaking Game][11].) + +There is a thrill in the discovery of new ways to get better, and to see every stumbling block and mistake as an “aha!” moment to kick ass in new and different ways. It is no different with remote working: look for patterns that help to unlock ways in which you can make your remote working time more efficient, more comfortable, and more fun. + +![][12] +Get these books. They are fantastic for personal development. +See my [$150 Personal Development Kit][13] article + +…but don’t go crazy over it. There are some people who obsesses every minute of their day about how to get better. They beat themselves up constantly for “not doing well enough”, “not getting more done”, and not meeting their internal unrealistic view of perfection. + +We are humans. We are animals, and we are not robots. Always strive to improve, but be realistic that not everything will be perfect. You are going to have some off-days or off-weeks. You are going to struggle at times with stress and burnout. You are going to handle a situation poorly remotely that would have been easier in the office. Learn from these moments but don’t obsess over them. Life is too damn short. + +**What are your tips, tricks, and recommendations? How do you manage remote working? What is missing from my recommendations? Share them in the comments box!** + + +-------------------------------------------------------------------------------- + +via: https://www.jonobacon.com/2019/01/14/remote-working-survival/ + +作者:[Jono Bacon][a] +选题:[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.jonobacon.com/author/admin/ +[b]: https://github.com/lujun9972 +[1]: https://www.cnbc.com/2018/05/30/70-percent-of-people-globally-work-remotely-at-least-once-a-week-iwg-study.html +[2]: http://www.cosocloud.com/press-release/connectsolutions-survey-shows-working-remotely-benefits-employers-and-employees +[3]: https://www.aftercollege.com/cf/2015-annual-survey +[4]: https://www.jonobacon.com/join/ +[5]: https://www.facebook.com/aftertheburial/ +[6]: https://www.jonobacon.com/wp-content/uploads/2019/01/aftertheburial2.jpg +[7]: https://skullsnbones.com/burial-live-photos-vans-warped-tour-denver-co/ +[8]: https://www.youtube.com/watch?v=wK1PNNEKZBY +[9]: https://www.jonobacon.com/wp-content/uploads/2019/01/IMG_20190114_102429-1024x768.jpg +[10]: https://www.jonobacon.com/wp-content/uploads/2019/01/15381733956_3325670fda_k-1024x576.jpg +[11]: https://www.jonobacon.com/2018/12/11/10-ways-to-up-your-public-speaking-game/ +[12]: https://www.jonobacon.com/wp-content/uploads/2019/01/DwVBxhjX4AgtJgV-1024x532.jpg +[13]: https://www.jonobacon.com/2017/11/13/150-dollar-personal-development-kit/ From 523c1b784561fb77d042e033406e42cf6be6a07b Mon Sep 17 00:00:00 2001 From: wwhio Date: Wed, 16 Jan 2019 15:25:27 +0800 Subject: [PATCH 0620/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90114 Get started with Wekan, an open source kanban board.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 Get started with Wekan, an open source kanban board.md b/sources/tech/20190114 Get started with Wekan, an open source kanban board.md index cdceb44b1b..3e2ee79ecc 100644 --- a/sources/tech/20190114 Get started with Wekan, an open source kanban board.md +++ b/sources/tech/20190114 Get started with Wekan, an open source kanban board.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wwhio) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f4e4f9c5c20aae569d776853625cd4ed87ab3324 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 16:25:44 +0800 Subject: [PATCH 0621/4278] PRF:20180326 Manage your workstation with Ansible- Automating configuration.md @FelixYFZ --- ... with Ansible- Automating configuration.md | 162 ++++++++---------- 1 file changed, 68 insertions(+), 94 deletions(-) diff --git a/translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md b/translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md index c464f4ea32..9f8c7a4b15 100644 --- a/translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md +++ b/translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md @@ -1,231 +1,205 @@ -使用Ansible来管理你的工作站:配置自动化 +使用 Ansible 来管理你的工作站:配置自动化 ====== +> 学习如何使 Ansible 自动对一系列台式机和笔记本应用配置。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/robot_arm_artificial_ai.png?itok=8CUU3U_7) -Ansible是一个令人惊讶的自动化的配置管理工具。主要应用在服务器和云部署上,但在工作站上的应用(无论是台式机还是笔记本)却得到了很少的关注,这就是本系列所要关注的。 +Ansible 是一个令人惊讶的自动化的配置管理工具。其主要应用在服务器和云部署上,但在工作站上的应用(无论是台式机还是笔记本)却鲜少得到关注,这就是本系列所要关注的。 -在这个系列的第一部分,我会向你展示'ansible-pull'命令的基本用法,我们创建了一个安装了少量包的palybook.它本身是没有多大的用处的,但是它为后续的自动化做了准备。 +在这个系列的[第一部分][1],我向你展示了 `ansible-pull` 命令的基本用法,我们创建了一个安装了少量包的剧本。它本身是没有多大的用处的,但是为后续的自动化做了准备。 -在这篇文章中,所有的事件操作都是闭环的,而且在最后部分,我们将会有一个针对工作站自动配置的完整的工作解决方案。现在,我们将要设置Ansible的配置,这样未来将要做的改变将会自动的部署应用到我们的工作站上。现阶段,假设你已经完成了第一部分的工作。如果没有的话,当你完成的时候回到本文。你应该已经有一个包含第一篇文章中代码的Github库。我们将直接按照之前的方式创建。 +在这篇文章中,将会达成闭环,而且在最后部分,我们将会有一个针对工作站自动配置的完整的工作解决方案。现在,我们将要设置 Ansible 的配置,这样未来将要做的改变将会自动的部署应用到我们的工作站上。现阶段,假设你已经完成了[第一部分][1]的工作。如果没有的话,当你完成的时候回到本文。你应该已经有一个包含第一篇文章中代码的 GitHub 库。我们将直接在之前创建的部分之上继续。 + +首先,因为我们要做的不仅仅是安装包文件,所以我们要做一些重新的组织工作。现在,我们已经有一个名为 `local.yml` 并包含以下内容的剧本: -首先,因为我们要做的不仅仅是安装包文件,所以我们要做一些重新的组织工作。现在,我们已经有一个名为'local.yml'并包含以下内容的playbook: ``` - hosts: localhost - become: true - tasks: - - name: Install packages - apt: name={{item}} - with_items: - - htop - - mc - - tmux - ``` -如果我们仅仅想实现一个任务那么上面的配置就足够了。随着向我们的配置中不断的添加内容,这个文件将会变的相当的庞大和杂乱。最好能够根据不同类型的配置将play文件分为独立的文件。为了达到这个要求,创建一个名为taskbook的文件,它和playbook很像但内容更加的流线型。让我们在Git库中为taskbook创建一个目录。 +如果我们仅仅想实现一个任务那么上面的配置就足够了。随着向我们的配置中不断的添加内容,这个文件将会变的相当的庞大和杂乱。最好能够根据不同类型的配置将我们的动作play分为独立的文件。为了达到这个要求,创建一个名为任务手册taskbook的东西,它和剧本playbook很像但内容更加的流线型。让我们在 Git 库中为任务手册创建一个目录。 + ``` mkdir tasks - ``` -在'local.yml'playbook中的代码使它很好过过渡到成为安装包文件的taskbook.让我们把这个文件移动到刚刚创建好并新命名的目录中。 +`local.yml ` 剧本中的代码可以很好地过渡为安装包文件的任务手册。让我们把这个文件移动到刚刚创建好的 `task` 目录中,并重新命名。 ``` mv local.yml tasks/packages.yml - ``` -现在,我们编辑'packages.yml'文件将它进行大幅的瘦身,事实上,我们可以精简除了独立任务本身之外的所有内容。让我们把'packages.yml'编辑成如下的形式: + +现在,我们编辑 `packages.yml` 文件将它进行大幅的瘦身,事实上,我们可以精简除了独立任务本身之外的所有内容。让我们把 `packages.yml` 编辑成如下的形式: + ``` - name: Install packages - apt: name={{item}} - with_items: - - htop - - mc - - tmux - ``` -正如你所看到的,它使用同样的语法,但我们去掉了对这个任务无用没有必要的所有内容。现在我们有了一个专门安装包文件的taskbook.然而我们仍然需要一个名为'local.yml'的文件,因为执行'ansible-pull'命令时仍然会去发现这个文件。所以我们将在我们库的根目录下(不是在'task'目录下)创建一个包含这些内容的全新文件: +正如你所看到的,它使用同样的语法,但我们去掉了对这个任务无用没有必要的所有内容。现在我们有了一个专门安装包文件的任务手册。然而我们仍然需要一个名为 `local.yml` 的文件,因为执行 `ansible-pull` 命令时仍然会去找这个文件。所以我们将在我们库的根目录下(不是在 `task` 目录下)创建一个包含这些内容的全新文件: + ``` - hosts: localhost - become: true - pre_tasks: - - name: update repositories - apt: update_cache=yes - changed_when: False - - tasks: - - include: tasks/packages.yml - ``` -这个新的'local.yml'扮演的是将要导入我们的taksbooks的主页的角色。我已经在这个文件中添加了一些你在这个系列中看不到的内容。首先,在这个文件的开头处,我添加了'pre——tasks',这个任务的作用是在其他所有任务运行之前先运行某个任务。在这种情况下,我们给Ansible的命令是让它去更新我们的分布存储库主页,下面的配置将执行这个任务要求: +这个新的 `local.yml` 扮演的是导入我们的任务手册的索引的角色。我已经在这个文件中添加了一些你在这个系列中还没见到的内容。首先,在这个文件的开头处,我添加了 `pre_tasks`,这个任务的作用是在其他所有任务运行之前先运行某个任务。在这种情况下,我们给 Ansible 的命令是让它去更新我们的发行版的软件库的索引,下面的配置将执行这个任务要求: ``` apt: update_cache=yes - ``` -通常'apt'模块是用来安装包文件的,但我们也能够让它来更新库索引。这样做的目的是让我们的每个play在Ansible运行的时候能够以最新的索引工作。这将确保我们在使用一个老旧的索引安装一个包的时候不会出现问题。因为'apt'模块仅仅在Debian,Ubuntu和他们的衍生环境下工作。如果你运行的一个不同的环境,你期望在你的环境中使用一个特殊的模块而不是'apt'。如果你需要使用一个不同的模块请查看Ansible的相关文档。 -下面这行值得以后解释: +通常 `apt` 模块是用来安装包文件的,但我们也能够让它来更新软件库索引。这样做的目的是让我们的每个动作在 Ansible 运行的时候能够以最新的索引工作。这将确保我们在使用一个老旧的索引安装一个包的时候不会出现问题。因为 `apt` 模块仅仅在 Debian、Ubuntu 及它们的衍生发行版下工作。如果你运行的一个不同的发行版,你要使用特定于你的发行版的模块而不是 `apt`。如果你需要使用一个不同的模块请查看 Ansible 的相关文档。 + +下面这行也需要进一步解释: + ``` changed_when: False - ``` -在独立任务中的这行阻止了Ansible去报告play改变的结果即使是它本身在系统中导致的一个改变。在这中情况下,我们不会去在意库索引是否包含新的数据;它几乎总是会的,因为库总是在改变的。我们不会去在意'apt'库的改变,因为索引的改变是正常的过程。如果我们删除这行,我们将在过程保告的后面看到所有的变动,即使仅仅库的更新而已。最好能够去忽略这类的改变。 -接下来是常规任务的阶段,我们将创建好的taskbook导入。我们每次添加另一个taskbook的时候,要添加下面这一行: +在某个任务中的这行阻止了 Ansible 去报告动作改变的结果,即使是它本身在系统中导致的一个改变。在这里,我们不会去在意库索引是否包含新的数据;它几乎总是会的,因为库总是在改变的。我们不会去在意 `apt` 库的改变,因为索引的改变是正常的过程。如果我们删除这行,我们将在过程报告的后面看到所有的变动,即使仅仅库的更新而已。最好忽略这类的改变。 + +接下来是常规任务的阶段,我们将创建好的任务手册导入。我们每次添加另一个任务手册的时候,要添加下面这一行: + ``` tasks: - - include: tasks/packages.yml - ``` -如果你将要运行'ansible-pull'命令,他应该向上一篇文章中的那样做同样重要的事情。 不同的是我们已经提高了我们的组织并且能够更有效的扩展它。'ansible-pull'命令的语法,为了节省你到上一篇文章中去寻找,参考如下: +如果你现在运行 `ansible-pull` 命令,它应该基本上像上一篇文章中做的一样。不同的是我们已经改进了我们的组织方式,并且能够更有效的扩展它。为了节省你到上一篇文章中去寻找,`ansible-pull` 命令的语法参考如下: + ``` sudo ansible-pull -U https://github.com//ansible.git - ``` -如果你还记得话,'ansible-pull'的命令拉取一个Git库并且应用了它所包含的配置。 -既然我们的基础已经搭建好,我们现在可以扩展我们的Ansible并且添加功能。更特别的是,我们将添加配置来自动化的部署对工作站要做的改变。为了支撑这个要求,首先我们要创建一个特殊的账户来应用我们的Ansible配置。这个不是必要的,我们仍然能够在我们自己的用户下运行Ansible配置。但是使用一个隔离的用户能够将其隔离到不需要我们参与的在后台运行的一个系统进程中, +如果你还记得话,`ansible-pull` 的命令拉取一个 Git 仓库并且应用它所包含的配置。 -我们可以使用常规的方式来创建这个用户,但是既然我们正在使用Ansible,我们应该尽量避开使用手动的改变。替代的是,我们将会创建一个taskbook来处理用户的创建任务。这个taskbook目前将会仅仅创建一个用户,但你可以在这个taskbook中添加额外的plays来创建更多的用户。我将这个用户命名为'ansible',你可以按照自己的想法来命名(如果你做了这个改变要确保更新所有的变动)。让我们来创建一个名为'user.yml'的taskbook并且将以下代码写进去: +既然我们的基础已经搭建好,我们现在可以扩展我们的 Ansible 并且添加功能。更特别的是,我们将添加配置来自动化的部署对工作站要做的改变。为了支撑这个要求,首先我们要创建一个特殊的账户来应用我们的 Ansible 配置。这个不是必要的,我们仍然能够在我们自己的用户下运行 Ansible 配置。但是使用一个隔离的用户能够将其隔离到不需要我们参与的在后台运行的一个系统进程中, + +我们可以使用常规的方式来创建这个用户,但是既然我们正在使用 Ansible,我们应该尽量避开使用手动的改变。替代的是,我们将会创建一个任务手册来处理用户创建任务。这个任务手册目前将会仅仅创建一个用户,但你可以在这个任务手册中添加额外的动作来创建更多的用户。我将这个用户命名为 `ansible`,你可以按照自己的想法来命名(如果你做了这个改变要确保更新所有出现地方)。让我们来创建一个名为 `user.yml` 的任务手册并且将以下代码写进去: ``` - name: create ansible user - user: name=ansible uid=900 - ``` -下一步,我们需要编辑'local.yml'文件,将这个新的taskbook添加进去,像如下这样写: + +下一步,我们需要编辑 `local.yml` 文件,将这个新的任务手册添加进去,像如下这样写: ``` - hosts: localhost - become: true - pre_tasks: - - name: update repositories - apt: update_cache=yes - changed_when: False - - tasks: - - include: tasks/users.yml - - include: tasks/packages.yml - ``` -现在当我们运行'ansible-pull'命令的时候,一个名为'ansible'的用户将会在系统中被创建。注意我特地通过参数'UID'为这个用户声明了用户ID为900。这个不是必须的,但建议直接创建好UID。因为在1000以下的UID在登陆界面是不会显示的,这样是很棒的因为我们根本没有需要去使用'ansibe'账户来登陆我们的桌面。UID 900是固定的;它应该是在1000以下没有被使用的任何一个数值。你可以使用以下命令在系统中去验证UID 900是否已经被使用了: + +现在当我们运行 `ansible-pull` 命令的时候,一个名为 `ansible` 的用户将会在系统中被创建。注意我特地通过参数 `uid` 为这个用户声明了用户 ID 为 900。这个不是必须的,但建议直接创建好 UID。因为在 1000 以下的 UID 在登录界面是不会显示的,这样是很棒的,因为我们根本没有需要去使用 `ansibe` 账户来登录我们的桌面。UID 900 是随便定的;它应该是在 1000 以下没有被使用的任何一个数值。你可以使用以下命令在系统中去验证 UID 900 是否已经被使用了: ``` cat /etc/passwd |grep 900 - ``` -然而,你使用这个UID应该不会遇到什么问题,因为迄今为止在我使用的任何发行版中我还没遇到过它是被默认使用的。 -现在,我们已经拥有了一个名为'ansible'的账户,它将会在之后的自动化配置中使用。接下来,我们可以创建实际的定时作业来自动操作它。而不是将其放置到我们刚刚创建的'users.yml'文件中,我们应该将其分开放到它自己的文件中。在任务目录中创建一个名为'cron.yml'的taskbook并且将以下的代买写进去: +不过,你使用这个 UID 应该不会遇到什么问题,因为迄今为止在我使用的任何发行版中我还没遇到过它是被默认使用的。 + +现在,我们已经拥有了一个名为 `ansible` 的账户,它将会在之后的自动化配置中使用。接下来,我们可以创建实际的定时作业来自动操作。我们应该将其分开放到它自己的文件中,而不是将其放置到我们刚刚创建的 `users.yml` 文件中。在任务目录中创建一个名为 `cron.yml` 的任务手册并且将以下的代码写进去: + ``` - name: install cron job (ansible-pull) - cron: user="ansible" name="ansible provision" minute="*/10" job="/usr/bin/ansible-pull -o -U https://github.com//ansible.git > /dev/null" - ``` -定时模块的语法几乎是不需加以说明的。通过这个play,我们创建了一个通过用户'ansible'运行的定时作业。这个作业将每隔10分钟执行一次,下面是它将要执行的命令: + +`cron` 模块的语法几乎不需加以说明。通过这个动作,我们创建了一个通过用户 `ansible` 运行的定时作业。这个作业将每隔 10 分钟执行一次,下面是它将要执行的命令: ``` /usr/bin/ansible-pull -o -U https://github.com//ansible.git > /dev/null - ``` -同样,我们也可以添加想要我们的所有工作站部署的额外定时作业到这个文件中。我们只需要在新的定时作业中添加额外的palys即可。然而,仅仅是添加一个定时的taskbook是不够的,我们还需要将它添加到'local.yml'文件中以便它能够被调用。将下面的一行添加到末尾: + +同样,我们也可以添加想要我们的所有工作站部署的额外的定时作业到这个文件中。我们只需要在新的定时作业中添加额外的动作即可。然而,仅仅是添加一个定时的任务手册是不够的,我们还需要将它添加到 `local.yml` 文件中以便它能够被调用。将下面的一行添加到末尾: + ``` - include: tasks/cron.yml - ``` -现在当'ansible-pull'命令执行的时候,它将会以通过用户'ansible'每个十分钟设置一个新的定时作业。但是,每个十分钟运行一个Ansible作业并不是一个好的方式因为这个将消耗很多的CPU资源。每隔十分钟来运行对于Ansible来说是毫无意义的除非欧文已经在Git库中改变一些东西。 -然而,我们已经解决了这个问题。注意到我在定时作业中的命令'ansible-pill'添加的我们之前从未用到过的参数'-o'.这个参数告诉Ansible只有在从上次'ansible-pull'被调用以后库有了变化后才会运行。如果库没有任何变化,他将不会做任何事情。通过这个方法,你将不会无端的浪费CPU资源。当然,一些CPU资源将会在下来存储库的时候被使用,但不会像再一次应用整个配置的时候使用的那么多。当'ansible-pull'执行的时候,它将会遍历在playbooks和taskbooks中的所有任务,但至少它不会毫无目的的运行。 +现在当 `ansible-pull` 命令执行的时候,它将会以用户 `ansible` 每隔十分钟设置一个新的定时作业。但是,每个十分钟运行一个 Ansible 作业并不是一个好的方式,因为这个将消耗很多的 CPU 资源。每隔十分钟来运行对于 Ansible 来说是毫无意义的,除非我们已经在 Git 仓库中改变一些东西。 -尽管我们已经添加了所有必须的配置要素来自动化'ansible-pull',它任然还不能正常的工作。'ansible-pull'命令需要sudo的权限来运行,这将允许它执行系统级的命令。然而我们创建的用户'ansible'并没有被设置为以'sudo'的权限来执行命令,因此当定时作业触发的时候,执行将会失败。通常沃恩可以使用命令'visudo'来手动的去设置用户'ansible'的拥有这个权限。然而我们现在应该以Ansible的方式来操作,而且这将会是一个向你展示'copy'模块是如何工作的机会。'copy'模块允许你从库复制一个文件到文件系统的任何位置。在这个案列中,我们将会复制'sudo'的一个配置文件到'/etc/sudoers.d/'以便用户'ansible'能够以管理员的权限执行任务。 +然而,我们已经解决了这个问题。注意我在定时作业中的命令 `ansible-pill` 添加的我们之前从未用到过的参数 `-o`。这个参数告诉 Ansible 只有在从上次 `ansible-pull` 被调用以后库有了变化后才会运行。如果库没有任何变化,它将不会做任何事情。通过这个方法,你将不会无端的浪费 CPU 资源。当然在拉取存储库的时候会使用一些 CPU 资源,但不会像再一次应用整个配置的时候使用的那么多。当 `ansible-pull` 执行的时候,它将会遍历剧本和任务手册中的所有任务,但至少它不会毫无目的的运行。 -打开'users.yml',将下面的play添加到文件末尾。 +尽管我们已经添加了所有必须的配置要素来自动化 `ansible-pull`,它仍然还不能正常的工作。`ansible-pull` 命令需要 `sudo` 的权限来运行,这将允许它执行系统级的命令。然而我们创建的用户 `ansible` 并没有被设置为以 `sudo` 的权限来执行命令,因此当定时作业触发的时候,执行将会失败。通常我们可以使用命令 `visudo` 来手动的去设置用户 `ansible` 去拥有这个权限。然而我们现在应该以 Ansible 的方式来操作,而且这将会是一个向你展示 `copy` 模块是如何工作的机会。`copy` 模块允许你从库复制一个文件到文件系统的任何位置。在这个案列中,我们将会复制 `sudo` 的一个配置文件到 `/etc/sudoers.d/` 以便用户 `ansible` 能够以管理员的权限执行任务。 + +打开 `users.yml`,将下面的的动作添加到文件末尾。 ``` - name: copy sudoers_ansible - copy: src=files/sudoers_ansible dest=/etc/sudoers.d/ansible owner=root group=root mode=0440 - ``` -'copy'模块,正如我们看到的,从库复制一个文件到其他任何位置。在这个过程中,我们正在抓取一个名为'sudoers_ansible'(我们将在后续创建)的文件并将它复制到拥有者为'root'的'/etc/sudoers/ansible'中。 -接下来,我们需要创建我们将要复制的文件。在你的库的根目录下,创建一个名为'files'的目录: +正如我们看到的,`copy`模块从我们的仓库中复制一个文件到其他任何位置。在这个过程中,我们正在抓取一个名为 `sudoers_ansible`(我们将在后续创建)的文件并将它复制为 `/etc/sudoers/ansible`,并且拥有者为 `root`。 + +接下来,我们需要创建我们将要复制的文件。在你的仓库的根目录下,创建一个名为 `files` 的目录: ``` mkdir files - ``` -然后,在我们刚刚创建的'files'目录里,创建包含以下内容的名为'sudoers_ansible'的文件: + +然后,在我们刚刚创建的 `files` 目录里,创建名为 `sudoers_ansible` 的文件,包含以下内容: + ``` ansible ALL=(ALL) NOPASSWD: ALL - ``` -在'/etc/sudoer.d'目录里创建一个文件,就像我们正在这样做的,允许我们为一个特殊的用户配置'sudo'权限。现在我们正在通过'sudo'允许用户'ansible'不需要密码拥有完全控制权限。这将允许'ansible-pull'以后台任务的形式运行而不需要手动去运行。 -现在,你可以通过再次运行'ansible-pull'来拉取最新的变动: +就像我们正在这样做的,在 `/etc/sudoer.d` 目录里创建一个文件允许我们为一个特殊的用户配置 `sudo` 权限。现在我们正在通过 `sudo` 允许用户 `ansible` 不需要密码提示就拥有完全控制权限。这将允许 `ansible-pull` 以后台任务的形式运行而不需要手动去运行。 + +现在,你可以通过再次运行 `ansible-pull` 来拉取最新的变动: + ``` sudo ansible-pull -U https://github.com//ansible.git - ``` -从这个节点开始,'ansible-pull'的定时作业将会在后台每隔十分钟运行一次来检查你的库是否有变化,如果它发现有变化,将会运行你的palybook并且应用你的taskbooks. -所以现在我们有了一个完整的工作方案。当你第一次设置一台新的笔记本或者台式机的时候,你要去手动的运行'ansible-pull'命令,但仅仅是在第一次的时候。从第一次之后,用户'ansible'将会在后台接手后续的运行任务。当你想对你的机器做变动的时候,你只需要简单的去拉取你的Git库来做变动,然后将这些变化回传到库中。接着,当定时作业下次在每台机器上运行的时候,它将会拉取变动的部分并应用它们。你现在只需要做一次变动,你的所有工作站将会跟着一起变动。这方法尽管有一点不方便,通常,你会有一个你的机器列表的文件和包含不同机器的规则。不管怎样,'ansible-pull'的方法,就像在文章中描述的,是管理工作站配置的非常有效的方法。 +从这里开始,`ansible-pull` 的定时作业将会在后台每隔十分钟运行一次来检查你的仓库是否有变化,如果它发现有变化,将会运行你的剧本并且应用你的任务手册。 -我已经在我的[Github repository]中更新了这篇文章中的代码,所以你可以随时去浏览来再一次检查你的语法。同时我将前一篇文章中的代码移到了它自己的目录中。 +所以现在我们有了一个完整的可工作方案。当你第一次设置一台新的笔记本或者台式机的时候,你要去手动的运行 `ansible-pull` 命令,但仅仅是在第一次的时候。从第一次之后,用户 `ansible` 将会在后台接手后续的运行任务。当你想对你的机器做变动的时候,你只需要简单的去拉取你的 Git 仓库来做变动,然后将这些变化回传到库中。接着,当定时作业下次在每台机器上运行的时候,它将会拉取变动的部分并应用它们。你现在只需要做一次变动,你的所有工作站将会跟着一起变动。这方法尽管有一点不同寻常,通常,你会有一个包含你的机器列表和不同机器所属规则的清单文件。然而,`ansible-pull` 的方法,就像在文章中描述的,是管理工作站配置的非常有效的方法。 -在第三部分,我们将通过介绍使用Ansible来配置GNOME桌面设置来结束这个系列。我将会告诉你如何设置你的墙纸和锁屏壁纸,应用一个桌面主题以及更多的东西。 +我已经在我的 [Github 仓库][2]中更新了这篇文章中的代码,所以你可以随时去浏览来对比检查你的语法。同时我将前一篇文章中的代码移到了它自己的目录中。 -同时,到了布置一些作业的时候了,大多数人有我们使用的各种应用的配置文件。可能是Bash,Vim或者其他你使用的工具的配置文件。现在你可以尝试通过我们在使用的Ansible库来自动复制这些配置到你的机器中。在这篇文章中,我已将想你展示了如何去复制文件,所以去尝试以下看看你是都已经能应用这些知识。 +在[第三部分][3],我们将通过介绍使用 Ansible 来配置 GNOME 桌面设置来结束这个系列。我将会告诉你如何设置你的墙纸和锁屏壁纸、应用一个桌面主题以及更多的东西。 + +同时,到了布置一些作业的时候了,大多数人都有我们所使用的各种应用的配置文件。可能是 Bash、Vim 或者其他你使用的工具的配置文件。现在你可以尝试通过我们在使用的 Ansible 库来自动复制这些配置到你的机器中。在这篇文章中,我已将向你展示了如何去复制文件,所以去尝试以下看看你是都已经能应用这些知识。 -------------------------------------------------------------------------------- via: https://opensource.com/article/18/3/manage-your-workstation-configuration-ansible-part-2 作者:[Jay LaCroix][a] -译者:[FelixYFZ](https://github.com/FelixYFZ) -校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) +译者:[FelixYFZ](https://github.com/FelixYFZ) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://opensource.com/users/jlacroix -[1]:https://opensource.com/article/18/3/manage-workstation-ansible +[1]:https://linux.cn/article-10434-1.html [2]:https://github.com/jlacroix82/ansible_article.git +[3]:https://opensource.com/article/18/5/manage-your-workstation-ansible-part-3 From 66532eb1ac61a359df65167b53f0ddd7302f5117 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 16:26:08 +0800 Subject: [PATCH 0622/4278] PUB:20180326 Manage your workstation with Ansible- Automating configuration.md @FelixYFZ https://linux.cn/article-10449-1.html --- ...age your workstation with Ansible- Automating configuration.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180326 Manage your workstation with Ansible- Automating configuration.md (100%) diff --git a/translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md b/published/20180326 Manage your workstation with Ansible- Automating configuration.md similarity index 100% rename from translated/tech/20180326 Manage your workstation with Ansible- Automating configuration.md rename to published/20180326 Manage your workstation with Ansible- Automating configuration.md From 8801141ca10dac6f05640725e628766dc2480489 Mon Sep 17 00:00:00 2001 From: wwhio Date: Wed, 16 Jan 2019 18:00:18 +0800 Subject: [PATCH 0623/4278] Update and rename sources/tech/20190114 Get started with Wekan, an open source kanban board.md to translated/tech/20190114 Get started with Wekan, an open source kanban board.md --- ...with Wekan, an open source kanban board.md | 64 ------------------- ...with Wekan, an open source kanban board.md | 64 +++++++++++++++++++ 2 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 sources/tech/20190114 Get started with Wekan, an open source kanban board.md create mode 100644 translated/tech/20190114 Get started with Wekan, an open source kanban board.md diff --git a/sources/tech/20190114 Get started with Wekan, an open source kanban board.md b/sources/tech/20190114 Get started with Wekan, an open source kanban board.md deleted file mode 100644 index 3e2ee79ecc..0000000000 --- a/sources/tech/20190114 Get started with Wekan, an open source kanban board.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wwhio) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with Wekan, an open source kanban board) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-wekan) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with Wekan, an open source kanban board -====== -In the second article in our series on open source tools that will make you more productive in 2019, check out Wekan. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban-board.png?itok=tXC0dkKV) - -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 second of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Wekan - -[Kanban][1] boards are a mainstay of today's agile processes. And many of us (myself included) use them to organize not just our work but also our personal lives. I know several artists who use apps like [Trello][2] to keep track of their commision lists as well as what's in progress and what's complete. - -![](https://opensource.com/sites/default/files/uploads/wekan-1.png) - -But these apps are often linked to a work account or a commercial service. Enter [Wekan][3], an open source kanban board you can run locally or on the service of your choice. Wekan offers much of the same functionality as other Kanban apps, such as creating boards, lists, swimlanes, and cards, dragging and dropping between lists, assigning to users, labeling cards, and doing pretty much everything else you'd expect in a modern kanban board. - -![](https://opensource.com/sites/default/files/uploads/wekan-2.png) - -The thing that distinguishes Wekan from most other kanban boards is the built-in rules. While most other boards support emailing updates, Wekan allows you to set up triggers when taking actions on cards, checklists, and labels. - -![](https://opensource.com/sites/default/files/uploads/wekan-3.png) - -Wekan can then take actions like moving cards, updating labels, adding checklists, and sending emails. - -![](https://opensource.com/sites/default/files/uploads/wekan-4.png) - -Setting up Wekan locally is a snap—literally. If your desktop supports [Snapcraft][4] applications, installing is as easy as: - -``` -sudo snap install wekan -``` - -It also supports Docker, which means installing on a server is reasonably straightforward on most servers and desktops. - -Overall, if you want a nice kanban board that you can run yourself, Wekan has you covered. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-wekan - -作者:[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/Kanban -[2]: https://www.trello.com -[3]: https://wekan.github.io/ -[4]: https://snapcraft.io/ diff --git a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md new file mode 100644 index 0000000000..4ecf61008d --- /dev/null +++ b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (wwhio) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Wekan, an open source kanban board) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-wekan) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 Wekan 吧,一款开源看板软件 +====== +这是开源工具类软件推荐的第二期,本文将让你在 2019 年更具生产力。来,让我们一起看看 Wekan 吧。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban-board.png?itok=tXC0dkKV) + +每年年初,人们似乎都想方设法地让自己更具生产力。对新年目标、期待,当然还有“新年新气象”等待都促人上进。可大部分生产力软件的推荐都严重偏向闭源的专有软件,其实不用这样。 + +这是我挑选的 19 款帮助你在 2019 年提升生产力的开源工具中的第 2 个。 + +### Wekan + +[看板][1]是当今敏捷开发流程中的重要组成部分。我们中的很多人使用它同时管理自己的工作和生活。我知道有很多艺人在用 [Trello][2] 这样的 APP 来跟踪他们的档期,哪些事务正在处理,哪些事务已经完成。 + +![](https://opensource.com/sites/default/files/uploads/wekan-1.png) + +但这些 APP 通常需要连接到一个工作账户或者商用服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让他完全在本地运行,或者使用你自己选择的服务运行。其他的看板 APP 中拥有的功能在 Wekan 中也有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,几乎你对一款现代看板软件的功能需求它都有。 + +![](https://opensource.com/sites/default/files/uploads/wekan-2.png) + +Wekan 的独到之处在于它的内置规则。虽然其他的看板软件支持邮件更新,但 Wekan 允许用户自行设定触发器,其触发条件可以是卡片变动、清单变动或标签变动等等。 + +![](https://opensource.com/sites/default/files/uploads/wekan-3.png) + +当触发条件满足时, Wekan 可以自动执行如移动卡片、更新标签、添加清单或者发送邮件等操作。 + +![](https://opensource.com/sites/default/files/uploads/wekan-4.png) + +在本地搭建 Wekan 可以直接使用 snap。如果你的桌面支持 [Snapcraft][4] 构建的应用,那么只需要一条命令就能安装 Wekan : + +``` +sudo snap install wekan +``` + +此外 Wekan 还支持 Docker 安装,这使它在大部分服务器环境和桌面环境下的搭建变得相当容易。 + +最后,如果你想寻找一款能自建又好用的看板软件,你已经遇上了 Wekan 。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-wekan + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[wwhio](https://github.com/wwhio) +校对:[校对者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/Kanban +[2]: https://www.trello.com +[3]: https://wekan.github.io/ +[4]: https://snapcraft.io/ From 457ab460183c3616724fb04a807de5b21a3bff03 Mon Sep 17 00:00:00 2001 From: wwhio Date: Wed, 16 Jan 2019 18:00:41 +0800 Subject: [PATCH 0624/4278] Update 20190114 Get started with Wekan, an open source kanban board.md --- ...90114 Get started with Wekan, an open source kanban board.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md index 4ecf61008d..e89e0d46b6 100644 --- a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md +++ b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md @@ -12,7 +12,7 @@ 这是开源工具类软件推荐的第二期,本文将让你在 2019 年更具生产力。来,让我们一起看看 Wekan 吧。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban-board.png?itok=tXC0dkKV) -每年年初,人们似乎都想方设法地让自己更具生产力。对新年目标、期待,当然还有“新年新气象”等待都促人上进。可大部分生产力软件的推荐都严重偏向闭源的专有软件,其实不用这样。 +每年年初,人们似乎都在想方设法地让自己更具生产力。对新年目标、期待,当然还有“新年新气象”等待都促人上进。可大部分生产力软件的推荐都严重偏向闭源的专有软件,其实不用这样。 这是我挑选的 19 款帮助你在 2019 年提升生产力的开源工具中的第 2 个。 From 99c031a0d820d507d82e127d675d28562328dabc Mon Sep 17 00:00:00 2001 From: wwhio Date: Wed, 16 Jan 2019 18:06:35 +0800 Subject: [PATCH 0625/4278] Update 20190114 Get started with Wekan, an open source kanban board.md --- ... started with Wekan, an open source kanban board.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md index e89e0d46b6..807f8394b4 100644 --- a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md +++ b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md @@ -12,21 +12,21 @@ 这是开源工具类软件推荐的第二期,本文将让你在 2019 年更具生产力。来,让我们一起看看 Wekan 吧。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban-board.png?itok=tXC0dkKV) -每年年初,人们似乎都在想方设法地让自己更具生产力。对新年目标、期待,当然还有“新年新气象”等待都促人上进。可大部分生产力软件的推荐都严重偏向闭源的专有软件,其实不用这样。 +每年年初,人们似乎都在想方设法地让自己更具生产力。对新年目标、期待,当然还有“新年新气象”这样的口号等等都促人上进。可大部分生产力软件的推荐都严重偏向闭源的专有软件,但事实上并不用这样。 这是我挑选的 19 款帮助你在 2019 年提升生产力的开源工具中的第 2 个。 ### Wekan -[看板][1]是当今敏捷开发流程中的重要组成部分。我们中的很多人使用它同时管理自己的工作和生活。我知道有很多艺人在用 [Trello][2] 这样的 APP 来跟踪他们的档期,哪些事务正在处理,哪些事务已经完成。 +[看板][1]是当今敏捷开发流程中的重要组成部分。我们中的很多人使用它同时管理自己的工作和生活。有些人在用 [Trello][2] 这样的 APP 来跟踪他们的项目,例如哪些事务正在处理,哪些事务已经完成。 ![](https://opensource.com/sites/default/files/uploads/wekan-1.png) -但这些 APP 通常需要连接到一个工作账户或者商用服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让他完全在本地运行,或者使用你自己选择的服务运行。其他的看板 APP 中拥有的功能在 Wekan 中也有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,几乎你对一款现代看板软件的功能需求它都有。 +但这些 APP 通常需要连接到一个工作账户或者商业服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让他完全在本地运行,或者使用你自己选择的服务运行它。其他的看板 APP 中拥有的功能在 Wekan 中也有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,几乎你对一款现代看板软件的功能需求它都有。 ![](https://opensource.com/sites/default/files/uploads/wekan-2.png) -Wekan 的独到之处在于它的内置规则。虽然其他的看板软件支持邮件更新,但 Wekan 允许用户自行设定触发器,其触发条件可以是卡片变动、清单变动或标签变动等等。 +Wekan 的独到之处在于它的内置规则。虽然其他的看板软件支持邮件更新emailing updates,但 Wekan 允许用户自行设定触发器,其触发条件可以是卡片变动、清单变动或标签变动等等。 ![](https://opensource.com/sites/default/files/uploads/wekan-3.png) @@ -34,7 +34,7 @@ Wekan 的独到之处在于它的内置规则。虽然其他的看板软件支 ![](https://opensource.com/sites/default/files/uploads/wekan-4.png) -在本地搭建 Wekan 可以直接使用 snap。如果你的桌面支持 [Snapcraft][4] 构建的应用,那么只需要一条命令就能安装 Wekan : +可以直接使用 snap 在本地搭建 Wekan 。如果你的桌面支持 [Snapcraft][4] 构建的应用,那么只需要一条命令就能安装 Wekan : ``` sudo snap install wekan From e16a7d6bd25f48762b5802cd84baac8b38dfbf6e Mon Sep 17 00:00:00 2001 From: wwhio Date: Wed, 16 Jan 2019 18:10:45 +0800 Subject: [PATCH 0626/4278] Update 20190114 Get started with Wekan, an open source kanban board.md --- ...114 Get started with Wekan, an open source kanban board.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md index 807f8394b4..e774987979 100644 --- a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md +++ b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md @@ -22,7 +22,7 @@ ![](https://opensource.com/sites/default/files/uploads/wekan-1.png) -但这些 APP 通常需要连接到一个工作账户或者商业服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让他完全在本地运行,或者使用你自己选择的服务运行它。其他的看板 APP 中拥有的功能在 Wekan 中也有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,几乎你对一款现代看板软件的功能需求它都有。 +但这些 APP 通常需要连接到一个工作账户或者商业服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让他完全在本地运行,或者使用你自己选择的服务运行它。其他的看板 APP 提供的功能在 Wekan 里几乎都有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,基本上你对一款现代看板软件的功能需求它都能提供。 ![](https://opensource.com/sites/default/files/uploads/wekan-2.png) @@ -34,7 +34,7 @@ Wekan 的独到之处在于它的内置规则。虽然其他的看板软件支 ![](https://opensource.com/sites/default/files/uploads/wekan-4.png) -可以直接使用 snap 在本地搭建 Wekan 。如果你的桌面支持 [Snapcraft][4] 构建的应用,那么只需要一条命令就能安装 Wekan : +Wekan 的本地搭建可以直接使用 snap 。如果你的桌面环境支持 [Snapcraft][4] 构建的应用,那么只需要一条命令就能安装 Wekan : ``` sudo snap install wekan From 063e8d650a4158244c2e36a3571ed00e6e235efb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 18:40:42 +0800 Subject: [PATCH 0627/4278] PRF:20181211 Winterize your Bash prompt in Linux.md @geekpi --- ...211 Winterize your Bash prompt in Linux.md | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/translated/tech/20181211 Winterize your Bash prompt in Linux.md b/translated/tech/20181211 Winterize your Bash prompt in Linux.md index 4e0a17be07..d7ffe00ec3 100644 --- a/translated/tech/20181211 Winterize your Bash prompt in Linux.md +++ b/translated/tech/20181211 Winterize your Bash prompt in Linux.md @@ -1,24 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Winterize your Bash prompt in Linux) [#]: via: (https://opensource.com/article/18/12/linux-toy-bash-prompt) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -在 Linux 中冬季化你的 Bash 提示符 +在 Linux 中打扮你的冬季 Bash 提示符 ====== -你的 Linux 终端可能支持 Unicode,那么为何不利用它在提示符中添加季节性的图标呢? + +> 你的 Linux 终端可能支持 Unicode,那么为何不利用它在提示符中添加季节性的图标呢? + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-bash-prompt.png?itok=HK_kVn37) -欢迎再次来到 Linux 命令行玩具日历的另一篇。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具?我们对此非常开放:它会是终端上有任何有趣的消遣,对于任何节日主题相关的还有额外的加分。 +欢迎再次来到 Linux 命令行玩具日历的另一篇。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具?我们对此比较随意:它会是终端上有任何有趣的消遣,对于任何节日主题相关的还有额外的加分。 也许你以前见过其中的一些,也许你没有。不管怎样,我们希望你玩得开心。 今天的玩具非常简单:它是你的 Bash 提示符。你的 Bash 提示符?是的!我们还有几个星期的假期可以盯着它看,在北半球冬天还会再多几周,所以为什么不玩玩它。 -目前你的 Bash 提示符号可能是一个简单的美元符号( **$**),或者更有可能是一个更长的东西。如果你不确定你的 Bash 提示符是什么,你可以在环境变量 $PS1 中找到它。要查看它,请输入: +目前你的 Bash 提示符号可能是一个简单的美元符号( `$`),或者更有可能是一个更长的东西。如果你不确定你的 Bash 提示符是什么,你可以在环境变量 `$PS1` 中找到它。要查看它,请输入: ``` echo $PS1 @@ -30,9 +32,9 @@ echo $PS1 [\u@\h \W]\$ ``` -**\u**、 **\h** 和 **\W** 分别是用户名、主机名和工作目录的特殊字符。你还可以使用其他一些符号。为了帮助构建你的 Bash 提示符,你可以使用 [EzPrompt][1],这是一个 PS1 配置的在线生成器,它包含了许多选项,包括日期和时间、Git 状态等。 +`\u`、`\h` 和 `\W` 分别是用户名、主机名和工作目录的特殊字符。你还可以使用其他一些符号。为了帮助构建你的 Bash 提示符,你可以使用 [EzPrompt][1],这是一个 `PS1` 配置的在线生成器,它包含了许多选项,包括日期和时间、Git 状态等。 -你可能还有其他变量来组成 Bash 提示符。对我来说,**$PS2** 包含了我命令提示符的结束括号。有关详细信息,请参阅[这篇文章][2]。 +你可能还有其他变量来组成 Bash 提示符。对我来说,`$PS2` 包含了我命令提示符的结束括号。有关详细信息,请参阅 [这篇文章][2]。 要更改提示符,只需在终端中设置环境变量,如下所示: @@ -41,9 +43,9 @@ $ PS1='\u is cold: ' jehb is cold: ``` -要永久设置它,请使用你喜欢的文本编辑器将相同的代码添加到 **/etc/bashrc** 中。 +要永久设置它,请使用你喜欢的文本编辑器将相同的代码添加到 `/etc/bashrc` 中。 -那么这些与冬季化有什么关系呢?好吧,你很有可能有现代机器,你的终端支持 Unicode,所以你不仅限于标准的 ASCII 字符集。你可以使用任何符合 Unicode 规范的 emoji,包括雪花 ❄、雪人 ☃ 或一对滑雪者 🎿。你有很多冬季 emoji 可供选择。 +那么这些与冬季化有什么关系呢?好吧,你很有可能有现代一下的机器,你的终端支持 Unicode,所以你不仅限于标准的 ASCII 字符集。你可以使用任何符合 Unicode 规范的 emoji,包括雪花 ❄、雪人 ☃ 或一对滑雪板 🎿。你有很多冬季 emoji 可供选择。 ``` 🎄 圣诞树 @@ -60,7 +62,8 @@ jehb is cold: ⛄ 没有雪的雪人 🎁 包装好的礼物 ``` -选择你最喜欢的,享受冬天的欢乐。有趣的事实:现代文件系统也支持文件名中的 Unicode 字符,这意味着技术上你可以将你下个程序命名为 **“❄❄❄❄❄.py”**。只是说说,不要这么做。 + +选择你最喜欢的,享受冬天的欢乐。有趣的事实:现代文件系统也支持文件名中的 Unicode 字符,这意味着技术上你可以将你下个程序命名为 `❄❄❄❄❄.py`。只是说说,不要这么做。 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -68,11 +71,14 @@ jehb is cold: -------------------------------------------------------------------------------- via: https://opensource.com/article/18/12/linux-toy-bash-prompt + 作者:[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/) 荣誉推出 + [a]: https://opensource.com/users/jason-baker [b]: https://github.com/lujun9972 [1]: http://ezprompt.net/ From a7fdb08522d417994e515c4abd21b22dcc79f611 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 16 Jan 2019 18:41:17 +0800 Subject: [PATCH 0628/4278] PUB:20181211 Winterize your Bash prompt in Linux.md @geekpi https://linux.cn/article-10450-1.html --- .../20181211 Winterize your Bash prompt in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181211 Winterize your Bash prompt in Linux.md (98%) diff --git a/translated/tech/20181211 Winterize your Bash prompt in Linux.md b/published/20181211 Winterize your Bash prompt in Linux.md similarity index 98% rename from translated/tech/20181211 Winterize your Bash prompt in Linux.md rename to published/20181211 Winterize your Bash prompt in Linux.md index d7ffe00ec3..f8b2a50a83 100644 --- a/translated/tech/20181211 Winterize your Bash prompt in Linux.md +++ b/published/20181211 Winterize your Bash prompt in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10450-1.html) [#]: subject: (Winterize your Bash prompt in Linux) [#]: via: (https://opensource.com/article/18/12/linux-toy-bash-prompt) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 1ebd38072ec73e2d9feb1f6a5316424e48a2907d Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 16 Jan 2019 11:42:48 -0500 Subject: [PATCH 0629/4278] Translating by Scoutydren --- ...0814 5 open source strategy and simulation games for Linux.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180814 5 open source strategy and simulation games for Linux.md b/sources/tech/20180814 5 open source strategy and simulation games for Linux.md index 1f7e94c22f..feb71a5b9a 100644 --- a/sources/tech/20180814 5 open source strategy and simulation games for Linux.md +++ b/sources/tech/20180814 5 open source strategy and simulation games for Linux.md @@ -1,3 +1,4 @@ +Scoutydren is translating. 5 open source strategy and simulation games for Linux ====== From 6952434d0959acc2995b780fefb2719b5b0c7199 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Jan 2019 09:04:59 +0800 Subject: [PATCH 0630/4278] translated --- ...80606 Working with modules in Fedora 28.md | 141 ------------------ ...80606 Working with modules in Fedora 28.md | 134 +++++++++++++++++ 2 files changed, 134 insertions(+), 141 deletions(-) delete mode 100644 sources/tech/20180606 Working with modules in Fedora 28.md create mode 100644 translated/tech/20180606 Working with modules in Fedora 28.md diff --git a/sources/tech/20180606 Working with modules in Fedora 28.md b/sources/tech/20180606 Working with modules in Fedora 28.md deleted file mode 100644 index ba92a626f8..0000000000 --- a/sources/tech/20180606 Working with modules in Fedora 28.md +++ /dev/null @@ -1,141 +0,0 @@ -translating----geekpi - -Working with modules in Fedora 28 -====== -![](https://fedoramagazine.org/wp-content/uploads/2018/05/modules-workingwith-816x345.jpg) -The recent Fedora Magazine article entitled [Modularity in Fedora 28 Server Edition][1] did a great job of explaining Modularity in Fedora 28. It also pointed out a few example modules and explained the problems they solve. This article puts one of those modules to practical use, covering installation and setup of Review Board 3.0 using modules. - -### Getting started - -To follow along with this article and use modules, you need a system running [Fedora 28 Server Edition][2] along with [sudo administrative privileges][3]. Also, run this command to make sure all the packages on the system are current: -``` -sudo dnf -y update - -``` - -While you can use modules on Fedora 28 non-server editions, be aware of the [caveats described in the comments of the previous article][4]. - -### Examining modules - -First, take a look at what modules are available for Fedora 28. Run the following command: -``` -dnf module list - -``` - -The output lists a collection of modules that shows the associated stream, version, and available installation profiles for each. A [d] next to a particular module stream indicates the default stream used if the named module is installed. - -The output also shows most modules have a profile named default. That’s not a coincidence, since default is the name used for the default profile. - -To see where all those modules are coming from, run: -``` -dnf repolist - -``` - -Along with the usual [fedora and updates package repositories][5], the output shows the fedora-modular and updates-modular repositories. - -The introduction stated you’d be setting up Review Board 3.0. Perhaps a module named reviewboard caught your attention in the earlier output. Next, to get some details about that module, run this command: -``` -dnf module info reviewboard - -``` - -The description confirms it is the Review Board module, but also says it’s the 2.5 stream. However, you want 3.0. Look at the available reviewboard modules: -``` -dnf module list reviewboard - -``` - -The [d] next to the 2.5 stream means it is configured as the default stream for reviewboard. Therefore, be explicit about the stream you want: -``` -dnf module info reviewboard:3.0 - -``` - -Now for even more details about the reviewboard:3.0 module, add the verbose option: -``` -dnf module info reviewboard:3.0 -v - -``` - -### Installing the Review Board 3.0 module - -Now that you’ve tracked down the module you want, install it with this command: -``` -sudo dnf -y module install reviewboard:3.0 - -``` - -The output shows the ReviewBoard package was installed, along with several other dependent packages, including several from the django:1.6 module. The installation also enabled the reviewboard:3.0 module and the dependent django:1.6 module. - -Next, to see enabled modules, use this command: -``` -dnf module list --enabled - -``` - -The output shows [e] for enabled streams, and [i] for installed profiles. In the case of the reviewboard:3.0 module, the default profile was installed. You could have specified a different profile when installing the module. In fact, you still can — and this time you don’t need to specify the 3.0 stream since it was already enabled: -``` -sudo dnf -y module install reviewboard/server - -``` - -However, installation of the reviewboard:3.0/server profile is rather uneventful. The reviewboard:3.0 module’s server profile is the same as the default profile — so there’s nothing more to install. - -### Spin up a Review Board site - -Now that the Review Board 3.0 module and its dependent packages are installed, [create a Review Board site][6] running on the local system. Without further ado or explanation, copy and paste the following commands to do that: -``` -sudo rb-site install --noinput \ - --domain-name=localhost --db-type=sqlite3 \ - --db-name=/var/www/rev.local/data/reviewboard.db \ - --admin-user=rbadmin --admin-password=secret \ - /var/www/rev.local -sudo chown -R apache /var/www/rev.local/htdocs/media/uploaded \ - /var/www/rev.local/data -sudo ln -s /var/www/rev.local/conf/apache-wsgi.conf \ - /etc/httpd/conf.d/reviewboard-localhost.conf -sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \ - httpd_can_network_memcache=1 httpd_unified=1 -sudo systemctl enable --now httpd - -``` - -Now fire up a web browser on the system, point it at , and enjoy the shiny new Review Board site! To login as the Review Board admin, use the userid and password seen in the rb-site command above. - -### Module cleanup - -It’s good practice to clean up after yourself. To do that, remove the Review Board module and the site directory: -``` -sudo dnf -y module remove reviewboard:3.0 -sudo rm -rf /var/www/rev.local - -``` - -### Closing remarks - -Now that you’ve explored how to examine and administer the Review Board module, go experiment with the other modules available in Fedora 28. - -Learn more about using modules in Fedora 28 on the [Fedora Modularity][7] web site. The dnf manual page’s Module Command section also contains useful information. - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/working-modules-fedora-28/ - -作者:[Merlin Mathesius][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://fedoramagazine.org/author/merlinm/ -[1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/ -[2]:https://getfedora.org/server/ -[3]:https://fedoramagazine.org/howto-use-sudo/ -[4]:https://fedoramagazine.org/modularity-fedora-28-server-edition/#comment-476696 -[5]:https://fedoraproject.org/wiki/Repositories -[6]:https://www.reviewboard.org/docs/manual/dev/admin/installation/creating-sites/ -[7]:https://docs.pagure.org/modularity/ diff --git a/translated/tech/20180606 Working with modules in Fedora 28.md b/translated/tech/20180606 Working with modules in Fedora 28.md new file mode 100644 index 0000000000..c4cfcfe1d6 --- /dev/null +++ b/translated/tech/20180606 Working with modules in Fedora 28.md @@ -0,0 +1,134 @@ +使用 Fedora 28 中的模块 +====== +![](https://fedoramagazine.org/wp-content/uploads/2018/05/modules-workingwith-816x345.jpg) +最近 Fedora Magazine 中题为 [Fedora 28 服务器版的模块化][1]在解释 Fedora 28 中的模块化方面做得很好。它还给出了一些示例模块并解释了它们解决的问题。本文将其中一个模块用于实际应用,包括使用模块安装设置 Review Board 3.0。 + +### 入门 + +想要继续并使用模块,你需要一个 [Fedora 28 服务器版][2]并拥有 [sudo 管理权限][3]。另外,运行此命令以确保系统上的所有软件包都是最新的: + +``` +sudo dnf -y update +``` + +虽然你可以在 Fedora 28 非服务器版本上使用模块,但请注意[上一篇文章评论中提到的警告][4]。 + +### 检查模块 + +首先,看看 Fedora 28 可用的模块。运行以下命令: + +``` +dnf module list +``` + +输出列出了一组模块,这些模块显示了每个模块的关联流,版本和可用安装配置文件。模块流旁边的 [d] 表示安装命名模块时使用的默认流。 + +输出还显示大多数模块都有名为 default 的配置文件。这不是巧合,因为 default 是默认配置文件使用的名称。 + +要查看所有这些模块的来源,请运行: + +``` +dnf repolist +``` + +与通常的 [fedora 和更新包仓库][5]一起,输出还显示了fedora-modular 和 updates-modular 仓库。 + +介绍声明你将设置 Review Board 3.0。也许名为 reviewboard 的模块在之前的输出中引起了你的注意。接下来,要获取有关该模块的一些详细信息,请运行以下命令: + +``` +dnf module info reviewboard +``` + +根据描述确认它是 Review Board 模块,但也说明是 2.5 的流。然而你想要 3.0 的。查看可用的 reviewboard 模块: + +``` +dnf module list reviewboard +``` + +2.5 旁边的 [d] 表示它被配置为 reviewboard 的默认流。因此,请明确你想要的流: + +``` +dnf module info reviewboard:3.0 +``` + +有关 reviewboard:3.0 模块的更多详细信息,请添加详细选项: + +``` +dnf module info reviewboard:3.0 -v +``` + +### 安装 Review Board 3.0 模块 + +现在你已经跟踪了所需的模块,请使用以下命令安装它: + +``` +sudo dnf -y module install reviewboard:3.0 +``` + +输出显示已安装 ReviewBoard 以及其他几个依赖软件包,其中包括 django:1.6 模块中的几个软件包。安装还启用了reviewboard:3.0 模块和相关的 django:1.6 模块。 + +接下来,要查看已启用的模块,请使用以下命令: + +``` +dnf module list --enabled +``` + +输出中,[e] 表示已启用的流,[i] 表示已安装的配置。对于 reviewboard:3.0 模块,已安装默认配置。你可以在安装模块时指定其他配置。实际上,你仍然可以安装它,而且这次你不需要指定 3.0,因为它已经启用: + +``` +sudo dnf -y module install reviewboard/server +``` + +但是,安装 reviewboard:3.0/服务配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 - 因此无需安装。 + +### 启动 Review Board 网站 + +现在已经安装了 Review Board 3.0 模块及其相关软件包,[创建一个本地运行的 Review Board 网站][6]。无需解释,请复制并粘贴以下命令: + +``` +sudo rb-site install --noinput \ + --domain-name=localhost --db-type=sqlite3 \ + --db-name=/var/www/rev.local/data/reviewboard.db \ + --admin-user=rbadmin --admin-password=secret \ + /var/www/rev.local +sudo chown -R apache /var/www/rev.local/htdocs/media/uploaded \ + /var/www/rev.local/data +sudo ln -s /var/www/rev.local/conf/apache-wsgi.conf \ + /etc/httpd/conf.d/reviewboard-localhost.conf +sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \ + httpd_can_network_memcache=1 httpd_unified=1 +sudo systemctl enable --now httpd +``` + +现在启动系统中的 Web 浏览器,打开 ,然后享受全新的 Review Board 网站!要以 Review Board 管理员身份登录,请使用上面 rb-site 命令中的用户 ID 和密码。 + +### 模块清理 + +完成后清理是个好习惯。为此,删除 Review Board 模块和站点目录: + +``` +sudo dnf -y module remove reviewboard:3.0 +sudo rm -rf /var/www/rev.local +``` + +### 总结 + +现在你已经探索了如何检测和管理 Review Board 模块,那么去体验 Fedora 28 中提供的其他模块吧。 + +在 [Fedora 模块化][7]网站上了解有关在 Fedora 28 中使用模块的更多信息。dnf 手册页中的 module 命令部分也包含了有用的信息。 + +-------------------------------------------------------------------------------- +via: https://fedoramagazine.org/working-modules-fedora-28/ +作者:[Merlin Mathesius][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://fedoramagazine.org/author/merlinm/ +[1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/ +[2]:https://getfedora.org/server/ +[3]:https://fedoramagazine.org/howto-use-sudo/ +[4]:https://fedoramagazine.org/modularity-fedora-28-server-edition/#comment-476696 +[5]:https://fedoraproject.org/wiki/Repositories +[6]:https://www.reviewboard.org/docs/manual/dev/admin/installation/creating-sites/ +[7]:https://docs.pagure.org/modularity/ From e9fa8ea72b8964b8310077abd17635d02c54a258 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Jan 2019 09:09:31 +0800 Subject: [PATCH 0631/4278] translating --- sources/tech/20190104 Managing dotfiles with rcm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190104 Managing dotfiles with rcm.md b/sources/tech/20190104 Managing dotfiles with rcm.md index 88e239caf8..f046c70538 100644 --- a/sources/tech/20190104 Managing dotfiles with rcm.md +++ b/sources/tech/20190104 Managing dotfiles with rcm.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a42facff9180a09e3e72e20aa774e8b5466f9031 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 17 Jan 2019 13:29:16 +0800 Subject: [PATCH 0632/4278] Translating An Introduction to Go. --- .../tech/20181224 An Introduction to Go.md | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index a8b6fcf0c1..0f68678f14 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -119,24 +119,21 @@ type MyMethoder interface { ### 控制流 -Go provides three primary statements for control flow: `if`, `switch`, and `for`. The statements are fairly similar to their equivalent in other C-like languages, with some exceptions: +Go 提供了三个主要的控制了语句:`if`、`switch` 和 `for`。这些语句同其他 C 风格语言内的语句非常类似,但有一些不同: - * There are no parentheses around conditions, so it is `if a == b {}`, not `if (a == b) {}`. The braces are mandatory. + * 条件语句没有括号,所以条件语句是 `if a == b {}` 而不是 `if (a == b) {}`。大括号是必须的。 - * All of them can have initialisers, like this - -`if result, err := someFunction(); err == nil { // use result }` - - * The `switch` statement can use arbitrary expressions in cases - - * The `switch` statement can switch over nothing (equals switching over true) - - * Cases do not fall through by default (no `break` needed), use `fallthrough` at the end of a block to fall through. - - * The `for` loop can loop over ranges: `for key, val := range map { do something }` + * 所有的语句都可以有初始化,比如这个 + + `if result, err := someFunction(); err == nil { // use result }` + + * `switch` 语句在 cases 里可以使用任何表达式 + * `switch` 语句可以处理空的表达式(等于 true) + * 默认情况下,Go 不会从一个 case 进入下一个 case(不需要 `break`),在程序块的末尾使用 `fallthrough` 则会进入下一个 case。 + * 循环语句 `for` 不止能循环值域:`for key, val := range map { do something }` ### Goroutines From ca03798353994ff31073d6fe4495fb9d0c653ea2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 17 Jan 2019 20:50:30 +0800 Subject: [PATCH 0633/4278] PRF:20181016 Lab 6- Network Driver.md @qhwdw --- .../tech/20181016 Lab 6- Network Driver.md | 352 ++++++++---------- 1 file changed, 155 insertions(+), 197 deletions(-) diff --git a/translated/tech/20181016 Lab 6- Network Driver.md b/translated/tech/20181016 Lab 6- Network Driver.md index 39a2689473..86e321e8c8 100644 --- a/translated/tech/20181016 Lab 6- Network Driver.md +++ b/translated/tech/20181016 Lab 6- Network Driver.md @@ -1,67 +1,66 @@ -实验 6:网络驱动程序 +Caffeinated 6.828:实验 6:网络驱动程序 ====== -### 实验 6:网络驱动程序(缺省的最终设计) ### 简介 -这个实验是缺省的最终项目中你自己能够做的最后的实验。 +这个实验是默认你能够自己完成的最终项目。 -现在你有了一个文件系统,一个典型的操作系统都应该有一个网络栈。在本实验中,你将继续为一个网卡去写一个驱动程序。这个网卡基于 Intel 82540EM 芯片,也就是众所周知的 E1000 芯片。 +现在你已经有了一个文件系统,一个典型的操作系统都应该有一个网络栈。在本实验中,你将继续为一个网卡去写一个驱动程序。这个网卡基于 Intel 82540EM 芯片,也就是众所周知的 E1000 芯片。 -##### 预备知识 +#### 预备知识 使用 Git 去提交你的实验 5 的源代码(如果还没有提交的话),获取课程仓库的最新版本,然后创建一个名为 `lab6` 的本地分支,它跟踪我们的远程分支 `origin/lab6`: ```c - athena% cd ~/6.828/lab - athena% add git - athena% git commit -am 'my solution to lab5' - nothing to commit (working directory clean) - athena% git pull - Already up-to-date. - athena% git checkout -b lab6 origin/lab6 - Branch lab6 set up to track remote branch refs/remotes/origin/lab6. - Switched to a new branch "lab6" - athena% git merge lab5 - Merge made by recursive. - fs/fs.c | 42 +++++++++++++++++++ - 1 files changed, 42 insertions(+), 0 deletions(-) - athena% +athena% cd ~/6.828/lab +athena% add git +athena% git commit -am 'my solution to lab5' +nothing to commit (working directory clean) +athena% git pull +Already up-to-date. +athena% git checkout -b lab6 origin/lab6 +Branch lab6 set up to track remote branch refs/remotes/origin/lab6. +Switched to a new branch "lab6" +athena% git merge lab5 +Merge made by recursive. + fs/fs.c | 42 +++++++++++++++++++ + 1 files changed, 42 insertions(+), 0 deletions(-) +athena% ``` -然后,仅有网卡驱动程序并不能够让你的操作系统接入因特网。在新的实验 6 的代码中,我们为你提供了网络栈和一个网络服务器。与以前的实验一样,使用 git 去拉取这个实验的代码,合并到你自己的代码中,并去浏览新的 `net/` 目录中的内容,以及在 `kern/` 中的新文件。 +然后,仅有网卡驱动程序并不能够让你的操作系统接入互联网。在新的实验 6 的代码中,我们为你提供了网络栈和一个网络服务器。与以前的实验一样,使用 git 去拉取这个实验的代码,合并到你自己的代码中,并去浏览新的 `net/` 目录中的内容,以及在 `kern/` 中的新文件。 除了写这个驱动程序以外,你还需要去创建一个访问你的驱动程序的系统调用。你将要去实现那些在网络服务器中缺失的代码,以便于在网络栈和你的驱动程序之间传输包。你还需要通过完成一个 web 服务器来将所有的东西连接到一起。你的新 web 服务器还需要你的文件系统来提供所需要的文件。 大部分的内核设备驱动程序代码都需要你自己去从头开始编写。本实验提供的指导比起前面的实验要少一些:没有框架文件、没有现成的系统调用接口、并且很多设计都由你自己决定。因此,我们建议你在开始任何单独练习之前,阅读全部的编写任务。许多学生都反应这个实验比前面的实验都难,因此请根据你的实际情况计划你的时间。 -##### 实验要求 +#### 实验要求 与以前一样,你需要做实验中全部的常规练习和至少一个挑战问题。在实验中写出你的详细答案,并将挑战问题的方案描述写入到 `answers-lab6.txt` 文件中。 -#### QEMU 的虚拟网络 +### QEMU 的虚拟网络 我们将使用 QEMU 的用户模式网络栈,因为它不需要以管理员权限运行。QEMU 的文档的[这里][1]有更多关于用户网络的内容。我们更新后的 makefile 启用了 QEMU 的用户模式网络栈和虚拟的 E1000 网卡。 缺省情况下,QEMU 提供一个运行在 IP 地址 10.2.2.2 上的虚拟路由器,它给 JOS 分配的 IP 地址是 10.0.2.15。为了简单起见,我们在 `net/ns.h` 中将这些缺省值硬编码到网络服务器上。 -虽然 QEMU 的虚拟网络允许 JOS 随意连接因特网,但 JOS 的 10.0.2.15 的地址并不能在 QEMU 中的虚拟网络之外使用(也就是说,QEMU 还得做一个 NAT),因此我们并不能直接连接到 JOS 上运行的服务器,即便是从运行 QEMU 的主机上连接也不行。为解决这个问题,我们配置 QEMU 在主机的某些端口上运行一个服务器,这个服务器简单地连接到 JOS 中的一些端口上,并在你的真实主机和虚拟网络之间传递数据。 +虽然 QEMU 的虚拟网络允许 JOS 随意连接互联网,但 JOS 的 10.0.2.15 的地址并不能在 QEMU 中的虚拟网络之外使用(也就是说,QEMU 还得做一个 NAT),因此我们并不能直接连接到 JOS 上运行的服务器,即便是从运行 QEMU 的主机上连接也不行。为解决这个问题,我们配置 QEMU 在主机的某些端口上运行一个服务器,这个服务器简单地连接到 JOS 中的一些端口上,并在你的真实主机和虚拟网络之间传递数据。 你将在端口 7(echo)和端口 80(http)上运行 JOS,为避免在共享的 Athena 机器上发生冲突,makefile 将为这些端口基于你的用户 ID 来生成转发端口。你可以运行 `make which-ports` 去找出是哪个 QEMU 端口转发到你的开发主机上。为方便起见,makefile 也提供 `make nc-7` 和 `make nc-80`,它允许你在终端上直接与运行这些端口的服务器去交互。(这些目标仅能连接到一个运行中的 QEMU 实例上;你必须分别去启动它自己的 QEMU) -##### 包检查 +#### 包检查 makefile 也可以配置 QEMU 的网络栈去记录所有的入站和出站数据包,并将它保存到你的实验目录中的 `qemu.pcap` 文件中。 使用 `tcpdump` 命令去获取一个捕获的 hex/ASCII 包转储: ``` - tcpdump -XXnr qemu.pcap +tcpdump -XXnr qemu.pcap ``` 或者,你可以使用 [Wireshark][2] 以图形化界面去检查 pcap 文件。Wireshark 也知道如何去解码和检查成百上千的网络协议。如果你在 Athena 上,你可以使用 Wireshark 的前辈:ethereal,它运行在加锁的保密互联网协议网络中。 -##### 调试 E1000 +#### 调试 E1000 我们非常幸运能够去使用仿真硬件。由于 E1000 是在软件中运行的,仿真的 E1000 能够给我们提供一个人类可读格式的报告、它的内部状态以及它遇到的任何问题。通常情况下,对祼机上做驱动程序开发的人来说,这是非常难能可贵的。 @@ -78,15 +77,15 @@ E1000 能够产生一些调试输出,因此你可以去打开一个专门的 | eeprom | 读取 EEPROM 的日志 | | interrupt | 中断和中断寄存器变更日志 | -例如,你可以使用 `make E1000_DEBUG=tx,txerr` 去打开 "tx" 和 "txerr" 日志功能。 +例如,你可以使用 `make E1000_DEBUG=tx,txerr` 去打开 “tx” 和 “txerr” 日志功能。 注意:`E1000_DEBUG` 标志仅能在打了 6.828 补丁的 QEMU 版本上工作。 你可以使用软件去仿真硬件,来做进一步的调试工作。如果你使用它时卡壳了,不明白为什么 E1000 没有如你预期那样响应你,你可以查看在 `hw/e1000.c` 中的 QEMU 的 E1000 实现。 -#### 网络服务器 +### 网络服务器 -从头开始写一个网络栈是很困难的。因此我们将使用 lwIP,它是一个开源的、轻量级 TCP/IP 协议套件,它能做包括一个网络栈在内的很多事情。你能在 [这里][3] 找到很多关于 IwIP 的信息。在这个任务中,对我们而言,lwIP 就是一个实现了一个 BSD 套接字接口和拥有一个包输入端口和包输出端口的黑盒子。 +从头开始写一个网络栈是很困难的。因此我们将使用 lwIP,它是一个开源的、轻量级 TCP/IP 协议套件,它能做包括一个网络栈在内的很多事情。你能在 [这里][3] 找到很多关于 lwIP 的信息。在这个任务中,对我们而言,lwIP 就是一个实现了一个 BSD 套接字接口和拥有一个包输入端口和包输出端口的黑盒子。 一个网络服务器其实就是一个有以下四个环境的混合体: @@ -95,59 +94,53 @@ E1000 能够产生一些调试输出,因此你可以去打开一个专门的 * 输出环境 * 定时器环境 - - 下图展示了各个环境和它们之间的关系。下图展示了包括设备驱动的整个系统,我们将在后面详细讲到它。在本实验中,你将去实现图中绿色高亮的部分。 ![Network server architecture][4] -##### 核心网络服务器环境 +#### 核心网络服务器环境 -核心网络服务器环境由套接字调用派发器和 IwIP 自身组成的。套接字调用派发器就像一个文件服务器一样。用户环境使用 stubs(可以在 `lib/nsipc.c` 中找到它)去发送 IPC 消息到核心网络服务器环境。如果你看了 `lib/nsipc.c`,你就会发现核心网络服务器与我们创建的文件服务器 `i386_init` 的工作方式是一样的,`i386_init` 是使用 NS_TYPE_NS 创建的 NS 环境,因此我们检查 `envs`,去查找这个特殊的环境类型。对于每个用户环境的 IPC,网络服务器中的派发器将调用相应的、由 IwIP 提供的、代表用户的 BSD 套接字接口函数。 +核心网络服务器环境由套接字调用派发器和 lwIP 自身组成的。套接字调用派发器就像一个文件服务器一样。用户环境使用 stubs(可以在 `lib/nsipc.c` 中找到它)去发送 IPC 消息到核心网络服务器环境。如果你看了 `lib/nsipc.c`,你就会发现核心网络服务器与我们创建的文件服务器 `i386_init` 的工作方式是一样的,`i386_init` 是使用 NS_TYPE_NS 创建的 NS 环境,因此我们检查 `envs`,去查找这个特殊的环境类型。对于每个用户环境的 IPC,网络服务器中的派发器将调用相应的、由 lwIP 提供的、代表用户的 BSD 套接字接口函数。 -普通用户环境不能直接使用 `nsipc_*` 调用。而是通过在 `lib/sockets.c` 中的函数来使用它们,这些函数提供了基于文件描述符的套接字 API。以这种方式,用户环境通过文件描述符来引用套接字,就像它们引用磁盘上的文件一样。一些操作(`connect`、`accept`、等等)是特定于套接字的,但 `read`、`write`、和 `close` 是通过 `lib/fd.c` 中一般的文件描述符设备派发代码的。就像文件服务器对所有的打开的文件维护唯一的内部 ID 一样,lwIP 也为所有的打开的套接字生成唯一的 ID。不论是文件服务器还是网络服务器,我们都使用存储在 `struct Fd` 中的信息去映射每个环境的文件描述符到这些唯一的 ID 空间上。 +普通用户环境不能直接使用 `nsipc_*` 调用。而是通过在 `lib/sockets.c` 中的函数来使用它们,这些函数提供了基于文件描述符的套接字 API。以这种方式,用户环境通过文件描述符来引用套接字,就像它们引用磁盘上的文件一样。一些操作(`connect`、`accept` 等等)是特定于套接字的,但 `read`、`write` 和 `close` 是通过 `lib/fd.c` 中一般的文件描述符设备派发代码的。就像文件服务器对所有的打开的文件维护唯一的内部 ID 一样,lwIP 也为所有的打开的套接字生成唯一的 ID。不论是文件服务器还是网络服务器,我们都使用存储在 `struct Fd` 中的信息去映射每个环境的文件描述符到这些唯一的 ID 空间上。 尽管看起来文件服务器的网络服务器的 IPC 派发器行为是一样的,但它们之间还有很重要的差别。BSD 套接字调用(像 `accept` 和 `recv`)能够无限期阻塞。如果派发器让 lwIP 去执行其中一个调用阻塞,派发器也将被阻塞,并且在整个系统中,同一时间只能有一个未完成的网络调用。由于这种情况是无法接受的,所以网络服务器使用用户级线程以避免阻塞整个服务器环境。对于每个入站 IPC 消息,派发器将创建一个线程,然后在新创建的线程上来处理请求。如果线程被阻塞,那么只有那个线程被置入休眠状态,而其它线程仍然处于运行中。 除了核心网络环境外,还有三个辅助环境。核心网络服务器环境除了接收来自用户应用程序的消息之外,它的派发器也接收来自输入环境和定时器环境的消息。 -##### 输出环境 +#### 输出环境 -在为用户环境套接字调用提供服务时,lwIP 将为网卡生成用于发送的包。IwIP 将使用 `NSREQ_OUTPUT` 去发送在 IPC 消息页参数中附加了包的 IPC 消息。输出环境负责接收这些消息,并通过你稍后创建的系统调用接口来转发这些包到设备驱动程序上。 +在为用户环境套接字调用提供服务时,lwIP 将为网卡生成用于发送的包。lwIP 将使用 `NSREQ_OUTPUT` 去发送在 IPC 消息页参数中附加了包的 IPC 消息。输出环境负责接收这些消息,并通过你稍后创建的系统调用接口来转发这些包到设备驱动程序上。 -##### 输入环境 +#### 输入环境 -网卡接收到的包需要传递到 lwIP 中。输入环境将每个由设备驱动程序接收到的包拉进内核空间(使用你将要实现的内核系统调用),并使用 `NSREQ_INPUT` IPC 消息将这些包发送到核心网络服务器环境。 +网卡接收到的包需要传递到 lwIP 中。输入环境将每个由设备驱动程序接收到的包拉进内核空间(使用你将要实现的内核系统调用),并使用 `NSREQ_INPUT` IPC 消息将这些包发送到核心网络服务器环境。 包输入功能是独立于核心网络环境的,因为在 JOS 上同时实现接收 IPC 消息并从设备驱动程序中查询或等待包有点困难。我们在 JOS 中没有实现 `select` 系统调用,这是一个允许环境去监视多个输入源以识别准备处理哪个输入的系统调用。 如果你查看了 `net/input.c` 和 `net/output.c`,你将会看到在它们中都需要去实现那个系统调用。这主要是因为实现它要依赖你的系统调用接口。在你实现了驱动程序和系统调用接口之后,你将要为这两个辅助环境写这个代码。 -##### 定时器环境 +#### 定时器环境 -定时器环境周期性发送 `NSREQ_TIMER` 类型的消息到核心服务器,以提醒它那个定时器已过期。IwIP 使用来自线程的定时器消息来实现各种网络超时。 +定时器环境周期性发送 `NSREQ_TIMER` 类型的消息到核心服务器,以提醒它那个定时器已过期。lwIP 使用来自线程的定时器消息来实现各种网络超时。 ### Part A:初始化和发送包 你的内核还没有一个时间概念,因此我们需要去添加它。这里有一个由硬件产生的每 10 ms 一次的时钟中断。每收到一个时钟中断,我们将增加一个变量值,以表示时间已过去 10 ms。它在 `kern/time.c` 中已实现,但还没有完全集成到你的内核中。 -```markdown -练习 1、为 `kern/trap.c` 中的每个时钟中断增加一个到 `time_tick` 的调用。实现 `sys_time_msec` 并增加到 `kern/syscall.c` 中的 `syscall`,以便于用户空间能够访问时间。 -``` +> **练习 1**、为 `kern/trap.c` 中的每个时钟中断增加一个到 `time_tick` 的调用。实现 `sys_time_msec` 并增加到 `kern/syscall.c` 中的 `syscall`,以便于用户空间能够访问时间。 -使用 `make INIT_CFLAGS=-DTEST_NO_NS run-testtime` 去测试你的代码。你应该会看到环境计数从 5 开始以 1 秒为间隔减少。"-DTEST_NO_NS” 参数禁止在网络服务器环境上启动,因为在当前它将导致 JOS 崩溃。 +使用 `make INIT_CFLAGS=-DTEST_NO_NS run-testtime` 去测试你的代码。你应该会看到环境计数从 5 开始以 1 秒为间隔减少。`-DTEST_NO_NS` 参数禁止在网络服务器环境上启动,因为在当前它将导致 JOS 崩溃。 #### 网卡 写驱动程序要求你必须深入了解硬件和软件中的接口。本实验将给你提供一个如何使用 E1000 接口的高度概括的文档,但是你在写驱动程序时还需要大量去查询 Intel 的手册。 -```markdown -练习 2、为开发 E1000 驱动,去浏览 Intel 的 [软件开发者手册][5]。这个手册涵盖了几个与以太网控制器紧密相关的东西。QEMU 仿真了 82540EM。 +> **练习 2**、为开发 E1000 驱动,去浏览 Intel 的 [软件开发者手册][5]。这个手册涵盖了几个与以太网控制器紧密相关的东西。QEMU 仿真了 82540EM。 -现在,你应该去浏览第 2 章,以对设备获得一个整体概念。写驱动程序时,你需要熟悉第 3 到 14 章,以及 4.1(不包括 4.1 的子节)。你也应该去参考第 13 章。其它章涵盖了 E1000 的组件,你的驱动程序并不与这些组件去交互。现在你不用担心过多细节的东西;只需要了解文档的整体结构,以便于你后面需要时容易查找。 +> 现在,你应该去浏览第 2 章,以对设备获得一个整体概念。写驱动程序时,你需要熟悉第 3 到 14 章,以及 4.1(不包括 4.1 的子节)。你也应该去参考第 13 章。其它章涵盖了 E1000 的组件,你的驱动程序并不与这些组件去交互。现在你不用担心过多细节的东西;只需要了解文档的整体结构,以便于你后面需要时容易查找。 -在阅读手册时,记住,E1000 是一个拥有很多高级特性的很复杂的设备,一个能让 E1000 工作的驱动程序仅需要它一小部分的特性和 NIC 提供的接口即可。仔细考虑一下,如何使用最简单的方式去使用网卡的接口。我们强烈推荐你在使用高级特性之前,只去写一个基本的、能够让网卡工作的驱动程序即可。 -``` +> 在阅读手册时,记住,E1000 是一个拥有很多高级特性的很复杂的设备,一个能让 E1000 工作的驱动程序仅需要它一小部分的特性和 NIC 提供的接口即可。仔细考虑一下,如何使用最简单的方式去使用网卡的接口。我们强烈推荐你在使用高级特性之前,只去写一个基本的、能够让网卡工作的驱动程序即可。 ##### PCI 接口 @@ -156,10 +149,10 @@ E1000 是一个 PCI 设备,也就是说它是插到主板的 PCI 总线插槽 我们在 `kern/pci.c` 中已经为你提供了使用 PCI 的代码。PCI 初始化是在引导期间执行的,PCI 代码遍历PCI 总线来查找设备。当它找到一个设备时,它读取它的供应商 ID 和设备 ID,然后使用这两个值作为关键字去搜索 `pci_attach_vendor` 数组。这个数组是由像下面这样的 `struct pci_driver` 条目组成: ```c - struct pci_driver { - uint32_t key1, key2; - int (*attachfn) (struct pci_func *pcif); - }; +struct pci_driver { + uint32_t key1, key2; + int (*attachfn) (struct pci_func *pcif); +}; ``` 如果发现的设备的供应商 ID 和设备 ID 与数组中条目匹配,那么 PCI 代码将调用那个条目的 `attachfn` 去执行设备初始化。(设备也可以按类别识别,那是通过 `kern/pci.c` 中其它的驱动程序表来实现的。) @@ -167,50 +160,46 @@ E1000 是一个 PCI 设备,也就是说它是插到主板的 PCI 总线插槽 绑定函数是传递一个 _PCI 函数_ 去初始化。一个 PCI 卡能够发布多个函数,虽然这个 E1000 仅发布了一个。下面是在 JOS 中如何去表示一个 PCI 函数: ```c - struct pci_func { - struct pci_bus *bus; +struct pci_func { + struct pci_bus *bus; - uint32_t dev; - uint32_t func; + uint32_t dev; + uint32_t func; - uint32_t dev_id; - uint32_t dev_class; + uint32_t dev_id; + uint32_t dev_class; - uint32_t reg_base[6]; - uint32_t reg_size[6]; - uint8_t irq_line; - }; + uint32_t reg_base[6]; + uint32_t reg_size[6]; + uint8_t irq_line; +}; ``` 上面的结构反映了在 Intel 开发者手册里第 4.1 节的表 4-1 中找到的一些条目。`struct pci_func` 的最后三个条目我们特别感兴趣的,因为它们将记录这个设备协商的内存、I/O、以及中断资源。`reg_base` 和 `reg_size` 数组包含最多六个基址寄存器或 BAR。`reg_base` 为映射到内存中的 I/O 区域(对于 I/O 端口而言是基 I/O 端口)保存了内存的基地址,`reg_size` 包含了以字节表示的大小或来自 `reg_base` 的相关基值的 I/O 端口号,而 `irq_line` 包含了为中断分配给设备的 IRQ 线。在表 4-2 的后半部分给出了 E1000 BAR 的具体涵义。 当设备调用了绑定函数后,设备已经被发现,但没有被启用。这意味着 PCI 代码还没有确定分配给设备的资源,比如地址空间和 IRQ 线,也就是说,`struct pci_func` 结构的最后三个元素还没有被填入。绑定函数将调用 `pci_func_enable`,它将去启用设备、协商这些资源、并在结构 `struct pci_func` 中填入它。 -```markdown -练习 3、实现一个绑定函数去初始化 E1000。添加一个条目到 `kern/pci.c` 中的数组 `pci_attach_vendor` 上,如果找到一个匹配的 PCI 设备就去触发你的函数(确保一定要把它放在表末尾的 `{0, 0, 0}` 条目之前)。你在 5.2 节中能找到 QEMU 仿真的 82540EM 的供应商 ID 和设备 ID。在引导期间,当 JOS 扫描 PCI 总线时,你也可以看到列出来的这些信息。 +> **练习 3**、实现一个绑定函数去初始化 E1000。添加一个条目到 `kern/pci.c` 中的数组 `pci_attach_vendor` 上,如果找到一个匹配的 PCI 设备就去触发你的函数(确保一定要把它放在表末尾的 `{0, 0, 0}` 条目之前)。你在 5.2 节中能找到 QEMU 仿真的 82540EM 的供应商 ID 和设备 ID。在引导期间,当 JOS 扫描 PCI 总线时,你也可以看到列出来的这些信息。 -到目前为止,我们通过 `pci_func_enable` 启用了 E1000 设备。通过本实验我们将添加更多的初始化。 +> 到目前为止,我们通过 `pci_func_enable` 启用了 E1000 设备。通过本实验我们将添加更多的初始化。 -我们已经为你提供了 `kern/e1000.c` 和 `kern/e1000.h` 文件,这样你就不会把构建系统搞糊涂了。不过它们现在都是空的;你需要在本练习中去填充它们。你还可能在内核的其它地方包含这个 `e1000.h` 文件。 +> 我们已经为你提供了 `kern/e1000.c` 和 `kern/e1000.h` 文件,这样你就不会把构建系统搞糊涂了。不过它们现在都是空的;你需要在本练习中去填充它们。你还可能在内核的其它地方包含这个 `e1000.h` 文件。 -当你引导你的内核时,你应该会看到它输出的信息显示 E1000 的 PCI 函数已经启用。这时你的代码已经能够通过 `make grade` 的 `pci attach` 测试了。 -``` +> 当你引导你的内核时,你应该会看到它输出的信息显示 E1000 的 PCI 函数已经启用。这时你的代码已经能够通过 `make grade` 的 `pci attach` 测试了。 ##### 内存映射的 I/O -软件与 E1000 通过内存映射的 I/O(MMIO) 来沟通。你在 JOS 的前面部分可能看到过 MMIO 两次:CGA 控制台和 LAPIC 都是通过写入和读取“内存”来控制和查询设备的。但这些读取和写入不是去往内存芯片的,而是直接到这些设备的。 +软件与 E1000 通过内存映射的 I/O(MMIO)来沟通。你在 JOS 的前面部分可能看到过 MMIO 两次:CGA 控制台和 LAPIC 都是通过写入和读取“内存”来控制和查询设备的。但这些读取和写入不是去往内存芯片的,而是直接到这些设备的。 `pci_func_enable` 为 E1000 协调一个 MMIO 区域,来存储它在 BAR 0 的基址和大小(也就是 `reg_base[0]` 和 `reg_size[0]`),这是一个分配给设备的一段物理内存地址,也就是说你可以通过虚拟地址访问它来做一些事情。由于 MMIO 区域一般分配高位物理地址(一般是 3GB 以上的位置),因此你不能使用 `KADDR` 去访问它们,因为 JOS 被限制为最大使用 256MB。因此,你可以去创建一个新的内存映射。我们将使用 `MMIOBASE`(从实验 4 开始,你的 `mmio_map_region` 区域应该确保不能被 LAPIC 使用的映射所覆盖)以上的部分。由于在 JOS 创建用户环境之前,PCI 设备就已经初始化了,因此你可以在 `kern_pgdir` 处创建映射,并且让它始终可用。 -```markdown -练习 4、在你的绑定函数中,通过调用 `mmio_map_region`(它就是你在实验 4 中写的,是为了支持 LAPIC 内存映射)为 E1000 的 BAR 0 创建一个虚拟地址映射。 +> **练习 4**、在你的绑定函数中,通过调用 `mmio_map_region`(它就是你在实验 4 中写的,是为了支持 LAPIC 内存映射)为 E1000 的 BAR 0 创建一个虚拟地址映射。 -你将希望在一个变量中记录这个映射的位置,以便于后面访问你映射的寄存器。去看一下 `kern/lapic.c` 中的 `lapic` 变量,它就是一个这样的例子。如果你使用一个指针指向设备寄存器映射,一定要声明它为 `volatile`;否则,编译器将允许缓存它的值,并可以在内存中再次访问它。 +> 你将希望在一个变量中记录这个映射的位置,以便于后面访问你映射的寄存器。去看一下 `kern/lapic.c` 中的 `lapic` 变量,它就是一个这样的例子。如果你使用一个指针指向设备寄存器映射,一定要声明它为 `volatile`;否则,编译器将允许缓存它的值,并可以在内存中再次访问它。 -为测试你的映射,尝试去输出设备状态寄存器(第 12.4.2 节)。这是一个在寄存器空间中以字节 8 开头的 4 字节寄存器。你应该会得到 `0x80080783`,它表示以 1000 MB/s 的速度启用一个全双工的链路,以及其它信息。 -``` +> 为测试你的映射,尝试去输出设备状态寄存器(第 12.4.2 节)。这是一个在寄存器空间中以字节 8 开头的 4 字节寄存器。你应该会得到 `0x80080783`,它表示以 1000 MB/s 的速度启用一个全双工的链路,以及其它信息。 -提示:你将需要一些常数,像寄存器位置和掩码位数。如果从开发者手册中复制这些东西很容易出错,并且导致调试过程很痛苦。我们建议你使用 QEMU 的 [`e1000_hw.h`][6] 头文件做为基准。我们不建议完全照抄它,因为它定义的值远超过你所需要,并且定义的东西也不见得就是你所需要的,但它仍是一个很好的参考。 +提示:你将需要一些常数,像寄存器位置和掩码位数。如果从开发者手册中复制这些东西很容易出错,并且导致调试过程很痛苦。我们建议你使用 QEMU 的 [e1000_hw.h][6] 头文件做为基准。我们不建议完全照抄它,因为它定义的值远超过你所需要,并且定义的东西也不见得就是你所需要的,但它仍是一个很好的参考。 ##### DMA @@ -224,13 +213,13 @@ E1000 是一个 PCI 设备,也就是说它是插到主板的 PCI 总线插槽 #### 发送包 -E1000 中的发送和接收功能本质上是独立的,因此我们可以同时进行发送接收。我们首先去攻克简单的数据包发送,因为我们在没有先去发送一个 “I'm here!" 包之前是无法测试接收包功能的。 +E1000 中的发送和接收功能本质上是独立的,因此我们可以同时进行发送接收。我们首先去攻克简单的数据包发送,因为我们在没有先去发送一个 “I'm here!” 包之前是无法测试接收包功能的。 首先,你需要初始化网卡以准备发送,详细步骤查看 14.5 节(不必着急看子节)。发送初始化的第一步是设置发送队列。队列的详细结构在 3.4 节中,描述符的结构在 3.3.3 节中。我们先不要使用 E1000 的 TCP offload 特性,因此你只需专注于 “传统的发送描述符格式” 即可。你应该现在就去阅读这些章节,并要熟悉这些结构。 ##### C 结构 -你可以用 C `struct` 很方便地描述 E1000 的结构。正如你在 `struct Trapframe` 中所看到的结构那样,C `struct` 可以让你很方便地在内存中描述准确的数据布局。C 可以在字段中插入数据,但是 E1000 的结构就是这样布局的,这样就不会是个问题。如果你遇到字段对齐问题,进入 GCC 查看它的 "packed” 属性。 +你可以用 C `struct` 很方便地描述 E1000 的结构。正如你在 `struct Trapframe` 中所看到的结构那样,C `struct` 可以让你很方便地在内存中描述准确的数据布局。C 可以在字段中插入数据,但是 E1000 的结构就是这样布局的,这样就不会是个问题。如果你遇到字段对齐问题,进入 GCC 查看它的 "packed” 属性。 查看手册中表 3-8 所给出的一个传统的发送描述符,将它复制到这里作为一个示例: @@ -246,31 +235,29 @@ E1000 中的发送和接收功能本质上是独立的,因此我们可以同 从结构右上角第一个字节开始,我们将它转变成一个 C 结构,从上到下,从右到左读取。如果你从右往左看,你将看到所有的字段,都非常适合一个标准大小的类型: ```c - struct tx_desc - { - uint64_t addr; - uint16_t length; - uint8_t cso; - uint8_t cmd; - uint8_t status; - uint8_t css; - uint16_t special; - }; +struct tx_desc +{ + uint64_t addr; + uint16_t length; + uint8_t cso; + uint8_t cmd; + uint8_t status; + uint8_t css; + uint16_t special; +}; ``` 你的驱动程序将为发送描述符数组去保留内存,并由发送描述符指向到包缓冲区。有几种方式可以做到,从动态分配页到在全局变量中简单地声明它们。无论你如何选择,记住,E1000 是直接访问物理内存的,意味着它能访问的任何缓存区在物理内存中必须是连续的。 处理包缓存也有几种方式。我们推荐从最简单的开始,那就是在驱动程序初始化期间,为每个描述符保留包缓存空间,并简单地将包数据复制进预留的缓冲区中或从其中复制出来。一个以太网包最大的尺寸是 1518 字节,这就限制了这些缓存区的大小。主流的成熟驱动程序都能够动态分配包缓存区(即:当网络使用率很低时,减少内存使用量),或甚至跳过缓存区,直接由用户空间提供(就是“零复制”技术),但我们还是从简单开始为好。 -```markdown -练习 5、执行一个 14.5 节中的初始化步骤(它的子节除外)。对于寄存器的初始化过程使用 13 节作为参考,对发送描述符和发送描述符数组参考 3.3.3 节和 3.4 节。 +> **练习 5**、执行一个 14.5 节中的初始化步骤(它的子节除外)。对于寄存器的初始化过程使用 13 节作为参考,对发送描述符和发送描述符数组参考 3.3.3 节和 3.4 节。 -要记住,在发送描述符数组中要求对齐,并且数组长度上有限制。因为 TDLEN 必须是 128 字节对齐的,而每个发送描述符是 16 字节,你的发送描述符数组必须是 8 个发送描述符的倍数。并且不能使用超过 64 个描述符,以及不能在我们的发送环形缓存测试中溢出。 +> 要记住,在发送描述符数组中要求对齐,并且数组长度上有限制。因为 TDLEN 必须是 128 字节对齐的,而每个发送描述符是 16 字节,你的发送描述符数组必须是 8 个发送描述符的倍数。并且不能使用超过 64 个描述符,以及不能在我们的发送环形缓存测试中溢出。 -对于 TCTL.COLD,你可以假设为全双工操作。对于 TIPG、IEEE 802.3 标准的 IPG(不要使用 14.5 节中表上的值),参考在 13.4.34 节中表 13-77 中描述的缺省值。 -``` +> 对于 TCTL.COLD,你可以假设为全双工操作。对于 TIPG、IEEE 802.3 标准的 IPG(不要使用 14.5 节中表上的值),参考在 13.4.34 节中表 13-77 中描述的缺省值。 -尝试运行 `make E1000_DEBUG=TXERR,TX qemu`。如果你使用的是打了 6.828 补丁的 QEMU,当你设置 TDT(发送描述符尾部)寄存器时你应该会看到一个 “e1000: tx disabled" 的信息,并且不会有更多 "e1000” 信息了。 +尝试运行 `make E1000_DEBUG=TXERR,TX qemu`。如果你使用的是打了 6.828 补丁的 QEMU,当你设置 TDT(发送描述符尾部)寄存器时你应该会看到一个 “e1000: tx disabled” 的信息,并且不会有更多 “e1000” 信息了。 现在,发送初始化已经完成,你可以写一些代码去发送一个数据包,并且通过一个系统调用使它可以访问用户空间。你可以将要发送的数据包添加到发送队列的尾部,也就是说复制数据包到下一个包缓冲区中,然后更新 TDT 寄存器去通知网卡在发送队列中有另外的数据包。(注意,TDT 是一个进入发送描述符数组的索引,不是一个字节偏移量;关于这一点文档中说明的不是很清楚。) @@ -278,76 +265,64 @@ E1000 中的发送和接收功能本质上是独立的,因此我们可以同 如果用户调用你的发送系统调用,但是下一个描述符的 DD 位没有设置,表示那个发送队列已满,该怎么办?在这种情况下,你该去决定怎么办了。你可以简单地丢弃数据包。网络协议对这种情况的处理很灵活,但如果你丢弃大量的突发数据包,协议可能不会去重新获得它们。可能需要你替代网络协议告诉用户环境让它重传,就像你在 `sys_ipc_try_send` 中做的那样。在环境上回推产生的数据是有好处的。 -``` -练习 6、写一个函数去发送一个数据包,它需要检查下一个描述符是否空闲、复制包数据到下一个描述符并更新 TDT。确保你处理的发送队列是满的。 -``` +> **练习 6**、写一个函数去发送一个数据包,它需要检查下一个描述符是否空闲、复制包数据到下一个描述符并更新 TDT。确保你处理的发送队列是满的。 现在,应该去测试你的包发送代码了。通过从内核中直接调用你的发送函数来尝试发送几个包。在测试时,你不需要去创建符合任何特定网络协议的数据包。运行 `make E1000_DEBUG=TXERR,TX qemu` 去测试你的代码。你应该看到类似下面的信息: ```c - e1000: index 0: 0x271f00 : 9000002a 0 - ... +e1000: index 0: 0x271f00 : 9000002a 0 +... ``` -在你发送包时,每行都给出了在发送数组中的序号、那个发送的描述符的缓存地址、`cmd/CSO/length` 字段、以及 `special/CSS/status` 字段。如果 QEMU 没有从你的发送描述符中输出你预期的值,检查你的描述符中是否有合适的值和你配置的正确的 TDBAL 和 TDBAH。如果你收到的是 "e1000: TDH wraparound @0, TDT x, TDLEN y" 的信息,意味着 E1000 的发送队列持续不断地运行(如果 QEMU 不去检查它,它将是一个无限循环),这意味着你没有正确地维护 TDT。如果你收到了许多 "e1000: tx disabled" 的信息,那么意味着你没有正确设置发送控制寄存器。 +在你发送包时,每行都给出了在发送数组中的序号、那个发送的描述符的缓存地址、`cmd/CSO/length` 字段、以及 `special/CSS/status` 字段。如果 QEMU 没有从你的发送描述符中输出你预期的值,检查你的描述符中是否有合适的值和你配置的正确的 TDBAL 和 TDBAH。如果你收到的是 “e1000: TDH wraparound @0, TDT x, TDLEN y” 的信息,意味着 E1000 的发送队列持续不断地运行(如果 QEMU 不去检查它,它将是一个无限循环),这意味着你没有正确地维护 TDT。如果你收到了许多 “e1000: tx disabled” 的信息,那么意味着你没有正确设置发送控制寄存器。 -一旦 QEMU 运行,你就可以运行 `tcpdump -XXnr qemu.pcap` 去查看你发送的包数据。如果从 QEMU 中看到预期的 "e1000: index” 信息,但你捕获的包是空的,再次检查你发送的描述符,是否填充了每个必需的字段和位。(E1000 或许已经遍历了你的发送描述符,但它认为不需要去发送) +一旦 QEMU 运行,你就可以运行 `tcpdump -XXnr qemu.pcap` 去查看你发送的包数据。如果从 QEMU 中看到预期的 “e1000: index” 信息,但你捕获的包是空的,再次检查你发送的描述符,是否填充了每个必需的字段和位。(E1000 或许已经遍历了你的发送描述符,但它认为不需要去发送) -``` -练习 7、添加一个系统调用,让你从用户空间中发送数据包。详细的接口由你来决定。但是不要忘了检查从用户空间传递给内核的所有指针。 -``` +> **练习 7**、添加一个系统调用,让你从用户空间中发送数据包。详细的接口由你来决定。但是不要忘了检查从用户空间传递给内核的所有指针。 #### 发送包:网络服务器 现在,你已经有一个系统调用接口可以发送包到你的设备驱动程序端了。输出辅助环境的目标是在一个循环中做下面的事情:从核心网络服务器中接收 `NSREQ_OUTPUT` IPC 消息,并使用你在上面增加的系统调用去发送伴随这些 IPC 消息的数据包。这个 `NSREQ_OUTPUT` IPC 是通过 `net/lwip/jos/jif/jif.c` 中的 `low_level_output` 函数来发送的。它集成 lwIP 栈到 JOS 的网络系统。每个 IPC 将包含一个页,这个页由一个 `union Nsipc` 和在 `struct jif_pkt pkt` 字段中的一个包组成(查看 `inc/ns.h`)。`struct jif_pkt` 看起来像下面这样: ```c - struct jif_pkt { - int jp_len; - char jp_data[0]; - }; +struct jif_pkt { + int jp_len; + char jp_data[0]; +}; ``` `jp_len` 表示包的长度。在 IPC 页上的所有后续字节都是为了包内容。在结构的结尾处使用一个长度为 0 的数组来表示缓存没有一个预先确定的长度(像 `jp_data` 一样),这是一个常见的 C 技巧(也有人说这是一个令人讨厌的做法)。因为 C 并不做数组边界的检查,只要你确保结构后面有足够的未使用内存即可,你可以把 `jp_data` 作为一个任意大小的数组来使用。 当设备驱动程序的发送队列中没有足够的空间时,一定要注意在设备驱动程序、输出环境和核心网络服务器之间的交互。核心网络服务器使用 IPC 发送包到输出环境。如果输出环境在由于一个发送包的系统调用而挂起,导致驱动程序没有足够的缓存去容纳新数据包,这时核心网络服务器将阻塞以等待输出服务器去接收 IPC 调用。 -```markdown -练习 8、实现 `net/output.c`。 -``` +> **练习 8**、实现 `net/output.c`。 你可以使用 `net/testoutput.c` 去测试你的输出代码而无需整个网络服务器参与。尝试运行 `make E1000_DEBUG=TXERR,TX run-net_testoutput`。你将看到如下的输出: ```c - Transmitting packet 0 - e1000: index 0: 0x271f00 : 9000009 0 - Transmitting packet 1 - e1000: index 1: 0x2724ee : 9000009 0 - ... +Transmitting packet 0 +e1000: index 0: 0x271f00 : 9000009 0 +Transmitting packet 1 +e1000: index 1: 0x2724ee : 9000009 0 +... ``` 运行 `tcpdump -XXnr qemu.pcap` 将输出: - ```c - reading from file qemu.pcap, link-type EN10MB (Ethernet) - -5:00:00.600186 [|ether] - 0x0000: 5061 636b 6574 2030 30 Packet.00 - -5:00:00.610080 [|ether] - 0x0000: 5061 636b 6574 2030 31 Packet.01 - ... +reading from file qemu.pcap, link-type EN10MB (Ethernet) +-5:00:00.600186 [|ether] + 0x0000: 5061 636b 6574 2030 30 Packet.00 +-5:00:00.610080 [|ether] + 0x0000: 5061 636b 6574 2030 31 Packet.01 +... ``` 使用更多的数据包去测试,可以运行 `make E1000_DEBUG=TXERR,TX NET_CFLAGS=-DTESTOUTPUT_COUNT=100 run-net_testoutput`。如果它导致你的发送队列溢出,再次检查你的 DD 状态位是否正确,以及是否告诉硬件去设置 DD 状态位(使用 RS 命令位)。 你的代码应该会通过 `make grade` 的 `testoutput` 测试。 -``` -问题 - - 1、你是如何构造你的发送实现的?在实践中,如果发送缓存区满了,你该如何处理? -``` - +> **问题 1**、你是如何构造你的发送实现的?在实践中,如果发送缓存区满了,你该如何处理? ### Part B:接收包和 web 服务器 @@ -355,9 +330,7 @@ E1000 中的发送和接收功能本质上是独立的,因此我们可以同 就像你在发送包中做的那样,你将去配置 E1000 去接收数据包,并提供一个接收描述符队列和接收描述符。在 3.2 节中描述了接收包的操作,包括接收队列结构和接收描述符、以及在 14.4 节中描述的详细的初始化过程。 -``` -练习 9、阅读 3.2 节。你可以忽略关于中断和 offload 校验和方面的内容(如果在后面你想去使用这些特性,可以再返回去阅读),你现在不需要去考虑阈值的细节和网卡内部缓存是如何工作的。 -``` +> **练习 9**、阅读 3.2 节。你可以忽略关于中断和 offload 校验和方面的内容(如果在后面你想去使用这些特性,可以再返回去阅读),你现在不需要去考虑阈值的细节和网卡内部缓存是如何工作的。 除了接收队列是由一系列的等待入站数据包去填充的空缓存包以外,接收队列的其它部分与发送队列非常相似。所以,当网络空闲时,发送队列是空的(因为所有的包已经被发送出去了),而接收队列是满的(全部都是空缓存包)。 @@ -365,123 +338,108 @@ E1000 中的发送和接收功能本质上是独立的,因此我们可以同 如果 E1000 在一个接收描述符中接收到了一个比包缓存还要大的数据包,它将按需从接收队列中检索尽可能多的描述符以保存数据包的全部内容。为表示发生了这种情况,它将在所有的这些描述符上设置 DD 状态位,但仅在这些描述符的最后一个上设置 EOP 状态位。在你的驱动程序上,你可以去处理这种情况,也可以简单地配置网卡拒绝接收这种”长包“(这种包也被称为”巨帧“),你要确保接收缓存有足够的空间尽可能地去存储最大的标准以太网数据包(1518 字节)。 -```markdown -练习 10、设置接收队列并按 14.4 节中的流程去配置 E1000。你可以不用支持 ”长包“ 或多播。到目前为止,我们不用去配置网卡使用中断;如果你在后面决定去使用接收中断时可以再去改。另外,配置 E1000 去除以太网的 CRC 校验,因为我们的评级脚本要求必须去掉校验。 +> **练习 10**、设置接收队列并按 14.4 节中的流程去配置 E1000。你可以不用支持 ”长包“ 或多播。到目前为止,我们不用去配置网卡使用中断;如果你在后面决定去使用接收中断时可以再去改。另外,配置 E1000 去除以太网的 CRC 校验,因为我们的评级脚本要求必须去掉校验。 -默认情况下,网卡将过滤掉所有的数据包。你必须使用网卡的 MAC 地址去配置接收地址寄存器(RAL 和 RAH)以接收发送到这个网卡的数据包。你可以简单地硬编码 QEMU 的默认 MAC 地址 52:54:00:12:34:56(我们已经在 lwIP 中硬编码了这个地址,因此这样做不会有问题)。使用字节顺序时要注意;MAC 地址是从低位字节到高位字节的方式来写的,因此 52:54:00:12 是 MAC 地址的低 32 位,而 34:56 是它的高 16 位。 +> 默认情况下,网卡将过滤掉所有的数据包。你必须使用网卡的 MAC 地址去配置接收地址寄存器(RAL 和 RAH)以接收发送到这个网卡的数据包。你可以简单地硬编码 QEMU 的默认 MAC 地址 52:54:00:12:34:56(我们已经在 lwIP 中硬编码了这个地址,因此这样做不会有问题)。使用字节顺序时要注意;MAC 地址是从低位字节到高位字节的方式来写的,因此 52:54:00:12 是 MAC 地址的低 32 位,而 34:56 是它的高 16 位。 -E1000 的接收缓存区大小仅支持几个指定的设置值(在 13.4.22 节中描述的 RCTL.BSIZE 值)。如果你的接收包缓存够大,并且拒绝长包,那你就不用担心跨越多个缓存区的包。另外,要记住的是,和发送一样,接收队列和包缓存必须是连接的物理内存。 +> E1000 的接收缓存区大小仅支持几个指定的设置值(在 13.4.22 节中描述的 RCTL.BSIZE 值)。如果你的接收包缓存够大,并且拒绝长包,那你就不用担心跨越多个缓存区的包。另外,要记住的是,和发送一样,接收队列和包缓存必须是连接的物理内存。 -你应该使用至少 128 个接收描述符。 -``` +> 你应该使用至少 128 个接收描述符。 -现在,你可以做接收功能的基本测试了,甚至都无需写代码去接收包了。运行 `make E1000_DEBUG=TX,TXERR,RX,RXERR,RXFILTER run-net_testinput`。`testinput` 将发送一个 ARP(地址解析协议)通告包(使用你的包发送的系统调用),而 QEMU 将自动回复它,即便是你的驱动尚不能接收这个回复,你也应该会看到一个 "e1000: unicast match[0]: 52:54:00:12:34:56" 的消息,表示 E1000 接收到一个包,并且匹配了配置的接收过滤器。如果你看到的是一个 "e1000: unicast mismatch: 52:54:00:12:34:56” 消息,表示 E1000 过滤掉了这个包,意味着你的 RAL 和 RAH 的配置不正确。确保你按正确的顺序收到了字节,并不要忘记设置 RAH 中的 "Address Valid” 位。如果你没有收到任何 "e1000” 消息,或许是你没有正确地启用接收功能。 +现在,你可以做接收功能的基本测试了,甚至都无需写代码去接收包了。运行 `make E1000_DEBUG=TX,TXERR,RX,RXERR,RXFILTER run-net_testinput`。`testinput` 将发送一个 ARP(地址解析协议)通告包(使用你的包发送的系统调用),而 QEMU 将自动回复它,即便是你的驱动尚不能接收这个回复,你也应该会看到一个 “e1000: unicast match[0]: 52:54:00:12:34:56” 的消息,表示 E1000 接收到一个包,并且匹配了配置的接收过滤器。如果你看到的是一个 “e1000: unicast mismatch: 52:54:00:12:34:56” 消息,表示 E1000 过滤掉了这个包,意味着你的 RAL 和 RAH 的配置不正确。确保你按正确的顺序收到了字节,并不要忘记设置 RAH 中的 “Address Valid” 位。如果你没有收到任何 “e1000” 消息,或许是你没有正确地启用接收功能。 现在,你准备去实现接收数据包。为了接收数据包,你的驱动程序必须持续跟踪希望去保存下一下接收到的包的描述符(提示:按你的设计,这个功能或许已经在 E1000 中的一个寄存器来实现了)。与发送类似,官方文档上表示,RDH 寄存器状态并不能从软件中可靠地读取,因为确定一个包是否被发送到描述符的包缓存中,你需要去读取描述符中的 DD 状态位。如果 DD 位被设置,你就可以从那个描述符的缓存中复制出这个数据包,然后通过更新队列的尾索引 RDT 来告诉网卡那个描述符是空闲的。 如果 DD 位没有被设置,表明没有接收到包。这就与发送队列满的情况一样,这时你可以有几种做法。你可以简单地返回一个 ”重传“ 错误来要求对端重发一次。对于满的发送队列,由于那是个临时状况,这种做法还是很好的,但对于空的接收队列来说就不太合理了,因为接收队列可能会保持好长一段时间的空的状态。第二个方法是挂起调用环境,直到在接收队列中处理了这个包为止。这个策略非常类似于 `sys_ipc_recv`。就像在 IPC 的案例中,因为我们每个 CPU 仅有一个内核栈,一旦我们离开内核,栈上的状态就会被丢弃。我们需要设置一个标志去表示那个环境由于接收队列下溢被挂起并记录系统调用参数。这种方法的缺点是过于复杂:E1000 必须被指示去产生接收中断,并且驱动程序为了恢复被阻塞等待一个包的环境,必须处理这个中断。 -``` -练习 11、写一个函数从 E1000 中接收一个包,然后通过一个系统调用将它发布到用户空间。确保你将接收队列处理成空的。 -``` +> **练习 11**、写一个函数从 E1000 中接收一个包,然后通过一个系统调用将它发布到用户空间。确保你将接收队列处理成空的。 -```markdown -小挑战!如果发送队列是满的或接收队列是空的,环境和你的驱动程序可能会花费大量的 CPU 周期是轮询、等待一个描述符。一旦完成发送或接收描述符,E1000 能够产生一个中断,以避免轮询。修改你的驱动程序,处理发送和接收队列是以中断而不是轮询的方式进行。 +. -注意,一旦确定为中断,它将一直处于中断状态,直到你的驱动程序明确处理完中断为止。在你的中断服务程序中,一旦处理完成要确保清除掉中断状态。如果你不那样做,从你的中断服务程序中返回后,CPU 将再次跳转到你的中断服务程序中。除了在 E1000 网卡上清除中断外,也需要使用 `lapic_eoi` 在 LAPIC 上清除中断。 -``` +> 小挑战!如果发送队列是满的或接收队列是空的,环境和你的驱动程序可能会花费大量的 CPU 周期是轮询、等待一个描述符。一旦完成发送或接收描述符,E1000 能够产生一个中断,以避免轮询。修改你的驱动程序,处理发送和接收队列是以中断而不是轮询的方式进行。 + +> 注意,一旦确定为中断,它将一直处于中断状态,直到你的驱动程序明确处理完中断为止。在你的中断服务程序中,一旦处理完成要确保清除掉中断状态。如果你不那样做,从你的中断服务程序中返回后,CPU 将再次跳转到你的中断服务程序中。除了在 E1000 网卡上清除中断外,也需要使用 `lapic_eoi` 在 LAPIC 上清除中断。 #### 接收包:网络服务器 在网络服务器输入环境中,你需要去使用你的新的接收系统调用以接收数据包,并使用 `NSREQ_INPUT` IPC 消息将它传递到核心网络服务器环境。这些 IPC 输入消息应该会有一个页,这个页上绑定了一个 `union Nsipc`,它的 `struct jif_pkt pkt` 字段中有从网络上接收到的包。 -```markdown -练习 12、实现 `net/input.c`。 -``` +> **练习 12**、实现 `net/input.c`。 使用 `make E1000_DEBUG=TX,TXERR,RX,RXERR,RXFILTER run-net_testinput` 再次运行 `testinput`,你应该会看到: ```c - Sending ARP announcement... - Waiting for packets... - e1000: index 0: 0x26dea0 : 900002a 0 - e1000: unicast match[0]: 52:54:00:12:34:56 - input: 0000 5254 0012 3456 5255 0a00 0202 0806 0001 - input: 0010 0800 0604 0002 5255 0a00 0202 0a00 0202 - input: 0020 5254 0012 3456 0a00 020f 0000 0000 0000 - input: 0030 0000 0000 0000 0000 0000 0000 0000 0000 +Sending ARP announcement... +Waiting for packets... +e1000: index 0: 0x26dea0 : 900002a 0 +e1000: unicast match[0]: 52:54:00:12:34:56 +input: 0000 5254 0012 3456 5255 0a00 0202 0806 0001 +input: 0010 0800 0604 0002 5255 0a00 0202 0a00 0202 +input: 0020 5254 0012 3456 0a00 020f 0000 0000 0000 +input: 0030 0000 0000 0000 0000 0000 0000 0000 0000 ``` -"input:” 打头的行是一个 QEMU 的 ARP 回复的十六进制转储。 +“input:” 打头的行是一个 QEMU 的 ARP 回复的十六进制转储。 你的代码应该会通过 `make grade` 的 `testinput` 测试。注意,在没有发送至少一个包去通知 QEMU 中的 JOS 的 IP 地址上时,是没法去测试包接收的,因此在你的发送代码中的 bug 可能会导致测试失败。 为彻底地测试你的网络代码,我们提供了一个称为 `echosrv` 的守护程序,它在端口 7 上设置运行 `echo` 的服务器,它将回显通过 TCP 连接发送给它的任何内容。使用 `make E1000_DEBUG=TX,TXERR,RX,RXERR,RXFILTER run-echosrv` 在一个终端中启动 `echo` 服务器,然后在另一个终端中通过 `make nc-7` 去连接它。你输入的每一行都被这个服务器回显出来。每次在仿真的 E1000 上接收到一个包,QEMU 将在控制台上输出像下面这样的内容: ```c - e1000: unicast match[0]: 52:54:00:12:34:56 - e1000: index 2: 0x26ea7c : 9000036 0 - e1000: index 3: 0x26f06a : 9000039 0 - e1000: unicast match[0]: 52:54:00:12:34:56 +e1000: unicast match[0]: 52:54:00:12:34:56 +e1000: index 2: 0x26ea7c : 9000036 0 +e1000: index 3: 0x26f06a : 9000039 0 +e1000: unicast match[0]: 52:54:00:12:34:56 ``` 做到这一点后,你应该也就能通过 `echosrv` 的测试了。 -``` -问题 +> **问题 2**、你如何构造你的接收实现?在实践中,如果接收队列是空的并且一个用户环境要求下一个入站包,你怎么办? - 2、你如何构造你的接收实现?在实践中,如果接收队列是空的并且一个用户环境要求下一个入站包,你怎么办? -``` +. +> 小挑战!在开发者手册中阅读关于 EEPROM 的内容,并写出从 EEPROM 中加载 E1000 的 MAC 地址的代码。目前,QEMU 的默认 MAC 地址是硬编码到你的接收初始化代码和 lwIP 中的。修复你的初始化代码,让它能够从 EEPROM 中读取 MAC 地址,和增加一个系统调用去传递 MAC 地址到 lwIP 中,并修改 lwIP 去从网卡上读取 MAC 地址。通过配置 QEMU 使用一个不同的 MAC 地址去测试你的变更。 -``` -小挑战!在开发者手册中阅读关于 EEPROM 的内容,并写出从 EEPROM 中加载 E1000 的 MAC 地址的代码。目前,QEMU 的默认 MAC 地址是硬编码到你的接收初始化代码和 lwIP 中的。修复你的初始化代码,让它能够从 EEPROM 中读取 MAC 地址,和增加一个系统调用去传递 MAC 地址到 lwIP 中,并修改 lwIP 去从网卡上读取 MAC 地址。通过配置 QEMU 使用一个不同的 MAC 地址去测试你的变更。 -``` +. -``` -小挑战!修改你的 E1000 驱动程序去使用 "零复制" 技术。目前,数据包是从用户空间缓存中复制到发送包缓存中,和从接收包缓存中复制回到用户空间缓存中。一个使用 ”零复制“ 技术的驱动程序可以通过直接让用户空间和 E1000 共享包缓存内存来实现。还有许多不同的方法去实现 ”零复制“,包括映射内容分配的结构到用户空间或直接传递用户提供的缓存到 E1000。不论你选择哪种方法,都要注意你如何利用缓存的问题,因为你不能在用户空间代码和 E1000 之间产生争用。 -``` +> 小挑战!修改你的 E1000 驱动程序去使用 "零复制" 技术。目前,数据包是从用户空间缓存中复制到发送包缓存中,和从接收包缓存中复制回到用户空间缓存中。一个使用 ”零复制“ 技术的驱动程序可以通过直接让用户空间和 E1000 共享包缓存内存来实现。还有许多不同的方法去实现 ”零复制“,包括映射内容分配的结构到用户空间或直接传递用户提供的缓存到 E1000。不论你选择哪种方法,都要注意你如何利用缓存的问题,因为你不能在用户空间代码和 E1000 之间产生争用。 -``` -小挑战!把 ”零复制“ 的概念用到 lwIP 中。 +. -一个典型的包是由许多头构成的。用户发送的数据被发送到 lwIP 中的一个缓存中。TCP 层要添加一个 TCP 包头,IP 层要添加一个 IP 包头,而 MAC 层有一个以太网头。甚至还有更多的部分增加到包上,这些部分要正确地连接到一起,以便于设备驱动程序能够发送最终的包。 +> 小挑战!把 “零复制” 的概念用到 lwIP 中。 -E1000 的发送描述符设计是非常适合收集分散在内存中的包片段的,像在 IwIP 中创建的包的帧。如果你排队多个发送描述符,但仅设置最后一个描述符的 EOP 命令位,那么 E1000 将在内部把这些描述符串成包缓存,并在它们标记完 EOP 后仅发送串起来的缓存。因此,独立的包片段不需要在内存中把它们连接到一起。 +> 一个典型的包是由许多头构成的。用户发送的数据被发送到 lwIP 中的一个缓存中。TCP 层要添加一个 TCP 包头,IP 层要添加一个 IP 包头,而 MAC 层有一个以太网头。甚至还有更多的部分增加到包上,这些部分要正确地连接到一起,以便于设备驱动程序能够发送最终的包。 -修改你的驱动程序,以使它能够发送由多个缓存且无需复制的片段组成的包,并且修改 lwIP 去避免它合并包片段,因为它现在能够正确处理了。 -``` +> E1000 的发送描述符设计是非常适合收集分散在内存中的包片段的,像在 lwIP 中创建的包的帧。如果你排队多个发送描述符,但仅设置最后一个描述符的 EOP 命令位,那么 E1000 将在内部把这些描述符串成包缓存,并在它们标记完 EOP 后仅发送串起来的缓存。因此,独立的包片段不需要在内存中把它们连接到一起。 -```markdown -小挑战!增加你的系统调用接口,以便于它能够为多于一个的用户环境提供服务。如果有多个网络栈(和多个网络服务器)并且它们各自都有自己的 IP 地址运行在用户模式中,这将是非常有用的。接收系统调用将决定它需要哪个环境来转发每个入站的包。 +> 修改你的驱动程序,以使它能够发送由多个缓存且无需复制的片段组成的包,并且修改 lwIP 去避免它合并包片段,因为它现在能够正确处理了。 -注意,当前的接口并不知道两个包之间有何不同,并且如果多个环境去调用包接收的系统调用,各个环境将得到一个入站包的子集,而那个子集可能并不包含调用环境指定的那个包。 +. -在 [这篇][7] 外内核论文的 2.2 节和 3 节中对这个问题做了深度解释,并解释了在内核中(如 JOS)处理它的一个方法。用这个论文中的方法去解决这个问题,你不需要一个像论文中那么复杂的方案。 -``` +> 小挑战!增加你的系统调用接口,以便于它能够为多于一个的用户环境提供服务。如果有多个网络栈(和多个网络服务器)并且它们各自都有自己的 IP 地址运行在用户模式中,这将是非常有用的。接收系统调用将决定它需要哪个环境来转发每个入站的包。 + +> 注意,当前的接口并不知道两个包之间有何不同,并且如果多个环境去调用包接收的系统调用,各个环境将得到一个入站包的子集,而那个子集可能并不包含调用环境指定的那个包。 + +> 在 [这篇][7] 外内核论文的 2.2 节和 3 节中对这个问题做了深度解释,并解释了在内核中(如 JOS)处理它的一个方法。用这个论文中的方法去解决这个问题,你不需要一个像论文中那么复杂的方案。 #### Web 服务器 一个最简单的 web 服务器类型是发送一个文件的内容到请求的客户端。我们在 `user/httpd.c` 中提供了一个非常简单的 web 服务器的框架代码。这个框架内码处理入站连接并解析请求头。 -```markdown -练习 13、这个 web 服务器中缺失了发送一个文件的内容到客户端的处理代码。通过实现 `send_file` 和 `send_data` 完成这个 web 服务器。 -``` +> **练习 13**、这个 web 服务器中缺失了发送一个文件的内容到客户端的处理代码。通过实现 `send_file` 和 `send_data` 完成这个 web 服务器。 -在你完成了这个 web 服务器后,启动这个 web 服务器(`make run-httpd-nox`),使用你喜欢的浏览器去浏览 http:// _host_ : _port_ /index.html 地址。其中 _host_ 是运行 QEMU 的计算机的名字(如果你在 athena 上运行 QEMU,使用 `hostname.mit.edu`(其中 hostname 是在 athena 上运行 `hostname` 命令的输出,或者如果你在运行 QEMU 的机器上运行 web 浏览器的话,直接使用 `localhost`),而 _port_ 是 web 服务器运行 `make which-ports` 命令报告的端口号。你应该会看到一个由运行在 JOS 中的 HTTP 服务器提供的一个 web 页面。 +在你完成了这个 web 服务器后,启动这个 web 服务器(`make run-httpd-nox`),使用你喜欢的浏览器去浏览 `http://host:port/index.html` 地址。其中 _host_ 是运行 QEMU 的计算机的名字(如果你在 athena 上运行 QEMU,使用 `hostname.mit.edu`(其中 hostname 是在 athena 上运行 `hostname` 命令的输出,或者如果你在运行 QEMU 的机器上运行 web 浏览器的话,直接使用 `localhost`),而 _port_ 是 web 服务器运行 `make which-ports` 命令报告的端口号。你应该会看到一个由运行在 JOS 中的 HTTP 服务器提供的一个 web 页面。 -到目前为止,你的评级测试得分应该是 105 分(满分为105)。 +到目前为止,你的评级测试得分应该是 105 分(满分为 105)。 -```markdown -小挑战!在 JOS 中添加一个简单的聊天服务器,多个人可以连接到这个服务器上,并且任何用户输入的内容都被发送到其它用户。为实现它,你需要找到一个一次与多个套接字通讯的方法,并且在同一时间能够在同一个套接字上同时实现发送和接收。有多个方法可以达到这个目的。lwIP 为 `recv`(查看 `net/lwip/api/sockets.c` 中的 `lwip_recvfrom`)提供了一个 MSG_DONTWAIT 标志,以便于你不断地轮询所有打开的套接字。注意,虽然网络服务器的 IPC 支持 `recv` 标志,但是通过普通的 `read` 函数并不能访问它们,因此你需要一个方法来传递这个标志。一个更高效的方法是为每个连接去启动一个或多个环境,并且使用 IPC 去协调它们。而且碰巧的是,对于一个套接字,在结构 Fd 中找到的 lwIP 套接字 ID 是全局的(不是每个环境私有的),因此,比如一个 `fork` 的子环境继承了它的父环境的套接字。或者,一个环境通过构建一个包含了正确套接字 ID 的 Fd 就能够发送到另一个环境的套接字上。 -``` +> 小挑战!在 JOS 中添加一个简单的聊天服务器,多个人可以连接到这个服务器上,并且任何用户输入的内容都被发送到其它用户。为实现它,你需要找到一个一次与多个套接字通讯的方法,并且在同一时间能够在同一个套接字上同时实现发送和接收。有多个方法可以达到这个目的。lwIP 为 `recv`(查看 `net/lwip/api/sockets.c` 中的 `lwip_recvfrom`)提供了一个 MSG_DONTWAIT 标志,以便于你不断地轮询所有打开的套接字。注意,虽然网络服务器的 IPC 支持 `recv` 标志,但是通过普通的 `read` 函数并不能访问它们,因此你需要一个方法来传递这个标志。一个更高效的方法是为每个连接去启动一个或多个环境,并且使用 IPC 去协调它们。而且碰巧的是,对于一个套接字,在结构 Fd 中找到的 lwIP 套接字 ID 是全局的(不是每个环境私有的),因此,比如一个 `fork` 的子环境继承了它的父环境的套接字。或者,一个环境通过构建一个包含了正确套接字 ID 的 Fd 就能够发送到另一个环境的套接字上。 -``` -问题 +> **问题 3**、由 JOS 的 web 服务器提供的 web 页面显示了什么? + +. + +> **问题 4**、你做这个实验大约花了多长的时间? - 3、由 JOS 的 web 服务器提供的 web 页面显示了什么? - 4. 你做这个实验大约花了多长的时间? -``` **本实验到此结束了。**一如既往,不要忘了运行 `make grade` 并去写下你的答案和挑战问题的解决方案的描述。在你动手之前,使用 `git status` 和 `git diff` 去检查你的变更,并不要忘了去 `git add answers-lab6.txt`。当你完成之后,使用 `git commit -am 'my solutions to lab 6’` 去提交你的变更,然后 `make handin` 并关注它的动向。 @@ -492,7 +450,7 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab6/ 作者:[csail.mit][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 ae6e002611e07c6083f95ba9c7999ede5a956702 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 17 Jan 2019 20:51:22 +0800 Subject: [PATCH 0634/4278] PUB:20181016 Lab 6- Network Driver.md @qhwdw https://linux.cn/article-10452-1.html --- {translated/tech => published}/20181016 Lab 6- Network Driver.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181016 Lab 6- Network Driver.md (100%) diff --git a/translated/tech/20181016 Lab 6- Network Driver.md b/published/20181016 Lab 6- Network Driver.md similarity index 100% rename from translated/tech/20181016 Lab 6- Network Driver.md rename to published/20181016 Lab 6- Network Driver.md From 41ee98d28e16746cea87f8acc8fb9b023080b899 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 17 Jan 2019 21:58:20 +0800 Subject: [PATCH 0635/4278] PRF:20181220 How To Install Microsoft .NET Core SDK On Linux.md @runningwater --- ...nstall Microsoft .NET Core SDK On Linux.md | 74 ++++++++++--------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md index 08b518e442..1b38d9d3a3 100644 --- a/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md +++ b/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Install Microsoft .NET Core SDK On Linux) @@ -38,7 +38,7 @@ $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**Debian 8 系统上安装:** +**Debian 8 系统上安装:** 增加微软密钥,添加 .NET 仓库源: @@ -51,14 +51,14 @@ $ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg $ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list ``` -安装 .NET SDK: +安装 .NET SDK: ``` $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**Fedora 28 系统上安装:** +**Fedora 28 系统上安装:** 增加微软密钥,添加 .NET 仓库源: @@ -69,7 +69,7 @@ $ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo $ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo ``` -现在, 可以安装 .NET SDK 了: +现在, 可以安装 .NET SDK 了: ``` $ sudo dnf update @@ -87,29 +87,29 @@ $ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo $ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo ``` -接着安装 .NET SDK ,命令如下: +接着安装 .NET SDK ,命令如下: ``` $ sudo dnf update $ sudo dnf install dotnet-sdk-2.2 ``` -**CentOS/Oracle 版本的 Linux 系统上:** +**CentOS/Oracle 版本的 Linux 系统上:** -增加微软密钥,添加 .NET 仓库源,使其可用 +增加微软密钥,添加 .NET 仓库源,使其可用: ``` $ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm ``` -更新源仓库,安装 .NET SDK: +更新源仓库,安装 .NET SDK: ``` $ sudo yum update $ sudo yum install dotnet-sdk-2.2 ``` -**openSUSE Leap 版本的系统上:** +**openSUSE Leap 版本的系统上:** 添加密钥,使仓库源可用,安装必需的依赖包,其命令如下: @@ -128,7 +128,7 @@ $ sudo zypper update $ sudo zypper install dotnet-sdk-2.2 ``` -**Ubuntu 18.04 LTS 版本的系统上:** +**Ubuntu 18.04 LTS 版本的系统上:** 注册微软的密钥和 .NET Core 仓库源,命令如下: @@ -137,13 +137,13 @@ $ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft- $ sudo dpkg -i packages-microsoft-prod.deb ``` -使 ‘Universe’ 仓库可用: +使 Universe 仓库可用: ``` $ sudo add-apt-repository universe ``` -然后,安装 .NET Core SDK ,命令如下: +然后,安装 .NET Core SDK ,命令如下: ``` $ sudo apt-get install apt-transport-https @@ -151,7 +151,7 @@ $sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**Ubuntu 16.04 LTS 版本的系统上:** +**Ubuntu 16.04 LTS 版本的系统上:** 注册微软的密钥和 .NET Core 仓库源,命令如下: @@ -160,7 +160,7 @@ $ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft- $ sudo dpkg -i packages-microsoft-prod.deb ``` -然后安装 .NET core SDK: +然后安装 .NET core SDK: ``` $ sudo apt-get install apt-transport-https @@ -172,13 +172,13 @@ $ sudo apt-get install dotnet-sdk-2.2 我们已经成功的在 Linux 机器中安装了 .NET Core SDK。是时候使用 dotnet 创建第一个应用程序了。 -接下来的目的,我们会创建一个名为 **“ostechnixApp”** 的应用程序。为此,可以简单的运行如下命令: +接下来的目的,我们会创建一个名为 ostechnixApp 的应用程序。为此,可以简单的运行如下命令: ``` $ dotnet new console -o ostechnixApp ``` -**简单的输出:** +**示例输出:** ``` Welcome to .NET Core! @@ -220,21 +220,21 @@ $ ls obj ostechnixApp.csproj Program.cs ``` -可以看到有两个名为 **ostechnixApp.csproj** 和 **Program.cs** 的文件,以及一个名为 **ojb** 的目录。默认情况下, `Program.cs` 文件包含有可以在控制台中运行的 'Hello World' 程序代码。可以看看此代码: +可以看到有两个名为 `ostechnixApp.csproj` 和 `Program.cs` 的文件,以及一个名为 `ojb` 的目录。默认情况下, `Program.cs` 文件包含有可以在控制台中运行的 “Hello World” 程序代码。可以看看此代码: ``` -$ cat Program.cs +$ cat Program.cs using System; namespace ostechnixApp { - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } } ``` @@ -247,13 +247,12 @@ Hello World! ![](https://www.ostechnix.com/wp-content/uploads/2018/12/run-dotnet.png) -很简单,对吧?是的,就是如此简单。现在你可以在 **Program.cs** 这文件中写上自己的代码,然后像上面所示的执行。 +很简单,对吧?是的,就是如此简单。现在你可以在 `Program.cs` 这文件中写上自己的代码,然后像上面所示的执行。 或者,你可以创建一个新的目录,如例子所示的 `mycode` 目录,命令如下: ``` $ mkdir ~/.mycode - $ cd mycode/ ``` @@ -263,7 +262,7 @@ $ cd mycode/ $ dotnet new console ``` -简单的输出: +示例输出: ``` The template "Console Application" was created successfully. @@ -278,9 +277,9 @@ Restore completed in 331.87 ms for /home/sk/mycode/mycode.csproj. Restore succeeded. ``` -上的命令会创建两个名叫 **mycode.csproj** 和 **Program.cs** 的文件及一个名为 **obj** 的目录。用你喜欢的编辑器打开 `Program.cs` 文件, 删除或修改原来的 'hello world' 代码段,然后编写自己的代码。 +上的命令会创建两个名叫 `mycode.csproj` 和 `Program.cs` 的文件及一个名为 `obj` 的目录。用你喜欢的编辑器打开 `Program.cs` 文件, 删除或修改原来的 “hello world” 代码段,然后编写自己的代码。 -写完代码,保存,关闭 Program.cs 文件,然后运行此应用程序,命令如下: +写完代码,保存,关闭 `Program.cs` 文件,然后运行此应用程序,命令如下: ``` $ dotnet run @@ -301,17 +300,17 @@ $ dotnet --help ### 使用微软的 Visual Studio Code 编辑器 -要编写代码,你可以任选自己喜欢的编辑器。同时微软自己也有一款支持 .NET 的编辑器,其名为 “ **Microsoft Visual Studio Code** ”。它是一款开源、轻量级、功能强大的源代码编辑器。其内置了对 JavaScript、TypeScript 和 Node.js 的支持,并为其它语言(如 C++、C#、Python、PHP、Go)和运行时态(如 .NET 和 Unity)提供了丰富的扩展,已经形成一个完整的生态系统。它是一款跨平台的代码编辑器,所以在微软的 Windows 系统、GNU/Linux 系统和 Mac OS X 系统都可以使用。如果对其感兴趣,就可以使用。 +要编写代码,你可以任选自己喜欢的编辑器。同时微软自己也有一款支持 .NET 的编辑器,其名为 “Microsoft Visual Studio Code”。它是一款开源、轻量级、功能强大的源代码编辑器。其内置了对 JavaScript、TypeScript 和 Node.js 的支持,并为其它语言(如 C++、C#、Python、PHP、Go)和运行时态(如 .NET 和 Unity)提供了丰富的扩展,已经形成一个完整的生态系统。它是一款跨平台的代码编辑器,所以在微软的 Windows 系统、GNU/Linux 系统和 Mac OS X 系统都可以使用。如果对其感兴趣,就可以使用。 -To know how to install and use it on Linux, please refer the following guide.想了解如何在 Linux 上安装和使用,请参阅以下指南。 +想了解如何在 Linux 上安装和使用,请参阅以下指南。 [Linux 中安装 Microsoft Visual Studio Code][3] -关于 Visual Studio Code editor 中 .NET Core 和 .NET Core SDK 工具的使用,[**此网页**][1]有一些基础的教程。想了解更多就去看看吧。 +关于 Visual Studio Code editor 中 .NET Core 和 .NET Core SDK 工具的使用,[此网页][1]有一些基础的教程。想了解更多就去看看吧。 ### Telemetry -默认情况下,.NET core SDK 会采集用户使用情况数据,此功能被称为 **‘Telemetry’**。采集数据是匿名的,并根据[知识共享署名许可][2]分享给其开发团队和社区。因此 .NET 团队会知道这些工具的使用状况,然后根据统计做出决策,改进产品。如果你不想分享自己的使用信息的话,可以使用顺手的 shell 工具把名为 **DOTNET_CLI_TELEMETRY_OPTOUT** 的环境变量参数设置为 **‘1’** 或 **‘true’**,这样就简单的关闭此功能了。 +默认情况下,.NET core SDK 会采集用户使用情况数据,此功能被称为 Telemetry。采集数据是匿名的,并根据[知识共享署名许可][2]分享给其开发团队和社区。因此 .NET 团队会知道这些工具的使用状况,然后根据统计做出决策,改进产品。如果你不想分享自己的使用信息的话,可以使用顺手的 shell 工具把名为 `DOTNET_CLI_TELEMETRY_OPTOUT` 的环境变量参数设置为 `1` 或 `true`,这样就简单的关闭此功能了。 就这样。你已经知道如何在各 Linux 平台上安装 .NET Core SDK 以及知道如何创建基本的应用程序了。想了解更多 .NET 使用知识的话,请参阅此文章末尾给出的链接。 @@ -319,6 +318,9 @@ To know how to install and use it on Linux, please refer the following guide.想 祝贺下! +### 资源 + +- [.NET Core](https://dotnet.microsoft.com/) -------------------------------------------------------------------------------- @@ -328,7 +330,7 @@ via: https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/ 作者:[SK][a] 选题:[lujun9972][b] 译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From da48b965f34c21ae74f5cfe985b60d1a6ce72893 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 17 Jan 2019 21:59:47 +0800 Subject: [PATCH 0636/4278] PUB:20181220 How To Install Microsoft .NET Core SDK On Linux.md @runningwater https://linux.cn/article-10453-1.html --- ...0181220 How To Install Microsoft .NET Core SDK On Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181220 How To Install Microsoft .NET Core SDK On Linux.md (99%) diff --git a/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/published/20181220 How To Install Microsoft .NET Core SDK On Linux.md similarity index 99% rename from translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md rename to published/20181220 How To Install Microsoft .NET Core SDK On Linux.md index 1b38d9d3a3..94e24b1fbc 100644 --- a/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md +++ b/published/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10453-1.html) [#]: subject: (How To Install Microsoft .NET Core SDK On Linux) [#]: via: (https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From e226a130fa32e2afc51afac716e0bfd89c7821df Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Thu, 17 Jan 2019 17:00:21 +0000 Subject: [PATCH 0637/4278] Revert "translating by cycoe" This reverts commit 4bbdcb279b3ff9982f636f351cfd140f9bf87f61. --- .../20180822 9 flowchart and diagramming tools for Linux.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md b/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md index 5729f765d1..853cd1b7c3 100644 --- a/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md +++ b/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md @@ -1,5 +1,3 @@ -translating by cycoe -cycoe 翻译中 9 flowchart and diagramming tools for Linux ====== From 2d36a4b30fc5ce023151d2731c191027621ff6b9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 18 Jan 2019 09:06:38 +0800 Subject: [PATCH 0638/4278] translated --- ... an open source alternative to Evernote.md | 97 ------------------- ... an open source alternative to Evernote.md | 88 +++++++++++++++++ 2 files changed, 88 insertions(+), 97 deletions(-) delete mode 100644 sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md create mode 100644 translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md diff --git a/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md deleted file mode 100644 index 968f3c546a..0000000000 --- a/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md +++ /dev/null @@ -1,97 +0,0 @@ -translating---geekpi - -Getting started with Turtl, an open source alternative to Evernote -====== -![Using Turtl as an open source alternative to Evernote](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_brainstorm_island_520px.png?itok=6IUPyxkY) - -Just about everyone I know takes notes, and many people use an online note-taking application like Evernote, Simplenote, or Google Keep. Those are all good tools, but you have to wonder about the security and privacy of your information—especially in light of [Evernote's privacy flip-flop of 2016][1]. If you want more control over your notes and your data, you really need to turn to an open source tool. - -Whatever your reasons for moving away from Evernote, there are open source alternatives out there. Let's look at one of those alternatives: Turtl. - -### Getting started - -The developers behind [Turtl][2] want you to think of it as "Evernote with ultimate privacy." To be honest, I can't vouch for the level of privacy that Turtl offers, but it is a quite a good note-taking tool. - -To get started with Turtl, [download][3] a desktop client for Linux, Mac OS, or Windows, or grab the [Android app][4]. Install it, then fire up the client or app. You'll be asked for a username and passphrase. Turtl uses the passphrase to generate a cryptographic key that, according to the developers, encrypts your notes before storing them anywhere on your device or on their servers. - -### Using Turtl - -You can create the following types of notes with Turtl: - -* Password - -* File - -* Image - -* Bookmark - -* Text note - -No matter what type of note you choose, you create it in a window that's similar for all types of notes: - -### [turtl-new-note-520.png][5] - -![Create new text note with Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-new-note-520.png) - -Creating a new text note in Turtl - -Add information like the title of the note, some text, and (if you're creating a File or Image note) attach a file or an image. Then click Save. - -You can add formatting to your notes via [Markdown][6]. You need to add the formatting by hand—there are no toolbar shortcuts. - -If you need to organize your notes, you can add them to Boards. Boards are just like notebooks in Evernote. To create a new board, click on the Boards tab, then click the Create a board button. Type a title for the board, then click Create. - -### [turtl-boards-520.png][7] - -![Create new board in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-boards-520.png) - -Creating a new board in Turtl - -To add a note to a board, create or edit the note, then click the This note is not in any boards link at the bottom of the note. Select one or more boards, then click Done. - -To add tags to a note, click the Tags icon at the bottom of a note, enter one or more keywords separated by commas, and click Done. - -### Syncing your notes across your devices - -If you use Turtl across several computers and an Android device, for example, Turtl will sync your notes whenever you're online. However, I've encountered a small problem with syncing: Every so often, a note I've created on my phone doesn't sync to my laptop. I tried to sync manually by clicking the icon in the top left of the window and then clicking Sync Now, but that doesn't always work. I found that I occasionally need to click that icon, click Your settings, and then click Clear local data. I then need to log back into Turtl, but all the data syncs properly. - -### A question, and a couple of problems - -When I started using Turtl, I was dogged by one question: Where are my notes kept online? It turns out that the developers behind Turtl are based in the U.S., and that's also where their servers are. Although the encryption that Turtl uses is [quite strong][8] and your notes are encrypted on the server, the paranoid part of me says that you shouldn't save anything sensitive in Turtl (or any online note-taking tool, for that matter). - -Turtl displays notes in a tiled view, reminiscent of Google Keep: - -### [turtl-notes-520.png][9] - -![Notes in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-notes-520.png) - -A collection of notes in Turtl - -There's no way to change that to a list view, either on the desktop or on the Android app. This isn't a problem for me, but I've heard some people pan Turtl because it lacks a list view. - -Speaking of the Android app, it's not bad; however, it doesn't integrate with the Android Share menu. If you want to add a note to Turtl based on something you've seen or read in another app, you need to copy and paste it manually. - -I've been using a Turtl for several months on a Linux-powered laptop, my [Chromebook running GalliumOS][10], and an Android-powered phone. It's been a pretty seamless experience across all those devices. Although it's not my favorite open source note-taking tool, Turtl does a pretty good job. Give it a try; it might be the simple note-taking tool you're looking for. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/12/using-turtl-open-source-alternative-evernote - -作者:[Scott Nesbitt][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/scottnesbitt -[1]:https://blog.evernote.com/blog/2016/12/15/evernote-revisits-privacy-policy/ -[2]:https://turtlapp.com/ -[3]:https://turtlapp.com/download/ -[4]:https://turtlapp.com/download/ -[5]:https://opensource.com/file/378346 -[6]:https://en.wikipedia.org/wiki/Markdown -[7]:https://opensource.com/file/378351 -[8]:https://turtlapp.com/docs/security/encryption-specifics/ -[9]:https://opensource.com/file/378356 -[10]:https://opensource.com/article/17/4/linux-chromebook-gallium-os diff --git a/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md new file mode 100644 index 0000000000..26b41ac1ac --- /dev/null +++ b/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md @@ -0,0 +1,88 @@ +开始使用 Turtl 这个 Evernote 的开源替代品 +====== +![Using Turtl as an open source alternative to Evernote](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_brainstorm_island_520px.png?itok=6IUPyxkY) + +我认识的每个人都会记笔记,许多人使用在线笔记应用,如 Evernote、Simplenote 或 Google Keep。这些都是很好的工具,但你不得不担忧信息的安全性和隐私性 - 特别是考虑到 [Evernote 2016 年的隐私策略变更][1]。如果你想要更好地控制笔记和数据,你需要转向开源工具。 + +无论你离开 Evernote 的原因是什么,都有开源替代品。让我们来看看其中一个选择:Turtl。 + +### 入门 + +[Turtl][2] 背后的开发人员希望你将其视为“具有绝对隐私的 Evernote”。说实话,我不能保证 Turtl 提供的隐私级别,但它是一个非常好的笔记工具。 + +要开始使用 Turtl,[下载][3]适用于 Linux、Mac OS 或 Windows 的桌面客户端,或者获取 [Android 应用][4]。安装它,然后启动客户端或应用。系统会要求你输入用户名和密码。Turtl 使用密码来生成加密密钥,根据开发人员的说法,加密密钥会在将笔记存储在设备或服务器上之前对其进行加密。 + +### 使用 Turtl + +你可以使用 Turtl 创建以下类型的笔记: + +* 密码 + +* 档案 + +* 图片 + +* 书签 + +* 文字笔记 + +无论你选择何种类型的笔记,你都可以在类似的窗口中创建: + + +![Create new text note with Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-new-note-520.png) + +在 Turtl 中创建新笔记 + +添加笔记标题,文字并(如果你正在创建文件或图像笔记)附加文件或图像等信息。然后单击“保存”。 + +你可以通过 [Markdown][6] 为你的笔记添加格式。因为没有工具栏快捷方式,所以你需要手动添加格式。 + +如果你需要整理笔记,可以将它们添加到“白板”中。白板就像 Evernote 中的笔记本。要创建新的白板,请单击 “Board” 选项卡,然后单击“创建”按钮。输入白板的标题,然后单击“创建”。 + +![Create new board in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-boards-520.png) + +在 Turtl 中创建新的白板 + +要向白板添加笔记,请创建或编辑笔记,然后单击笔记底部的“此笔记不在任何白板”的链接。选择一个或多个白板,然后单击“完成”。 + +要为笔记添加标记,请单击记事本底部的“标记”图标,输入一个或多个以逗号分隔的关键字,然后单击“完成”。 + +### 跨设备同步你的笔记 + +例如,如果你在多台计算机和 Android 设备上使用 Turtl,Turtl 会在你上线时同步你的笔记。但是,我在同步时遇到了一个小问题:我手机上创建的笔记经常不会同步到我的笔记本电脑上。我尝试通过单击窗口左上角的图标手动同步,然后单击立即同步,但这并不总是有效。我发现偶尔需要单击“设置”图标,然后单击“清除本地数据”。然后我需要重新登录 Turtl,但所有数据都能正确同步了。 + +### 一个疑问和一些问题 + +当我开始使用 Turtl 时,我被一个疑问所困扰:我的笔记保存在哪里?事实证明,Turtl 背后的开发人员位于美国,这也是他们服务器的所在地。虽然 Turtl 使用的加密[非常强大][8]并且你的笔记在服务器上加密,但我偏执地认为你不应该在 Turtl 中保存任何敏感内容(或在任何类似的在线笔记中)。 + +Turtl 以平铺视图显示笔记,让人想起 Google Keep: + + +![Notes in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-notes-520.png) + +Turtl 中的一系列笔记 + +无法在桌面或 Android 应用上将其更改为列表视图。这对我来说不是问题,但我听说有些人因为它没有列表视图而不喜欢 Turtl。 + +说到 Android 应用,它并不坏。但是,它没有与 Android 共享菜单集成。如果你想把在其他应用中看到或阅读的内容添加到 Turtl 笔记中,则需要手动复制并粘贴。 + +我已经在我的 Linux 笔记本,[运行 GalliumOS 的 Chromebook][10],还有一台 Android 手机上使用 Turtl 几个月了。对所有这些设备来说这都是一种非常无缝的体验。虽然它不是我最喜欢的开源笔记工具,但 Turtl 做得非常好。试试看它,它可能是你正在寻找的简单的笔记工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/using-turtl-open-source-alternative-evernote + +作者:[Scott Nesbitt][a] +译者:[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 +[1]:https://blog.evernote.com/blog/2016/12/15/evernote-revisits-privacy-policy/ +[2]:https://turtlapp.com/ +[3]:https://turtlapp.com/download/ +[4]:https://turtlapp.com/download/ +[6]:https://en.wikipedia.org/wiki/Markdown +[8]:https://turtlapp.com/docs/security/encryption-specifics/ +[10]:https://opensource.com/article/17/4/linux-chromebook-gallium-os From 5cd69c517e2a6a4e87dbe62d869c48f48ecac3d8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 18 Jan 2019 09:09:07 +0800 Subject: [PATCH 0639/4278] translating --- .../tech/20190113 Get started with Joplin, a note-taking app.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190113 Get started with Joplin, a note-taking app.md b/sources/tech/20190113 Get started with Joplin, a note-taking app.md index 2498435040..55b639ae7b 100644 --- a/sources/tech/20190113 Get started with Joplin, a note-taking app.md +++ b/sources/tech/20190113 Get started with Joplin, a note-taking app.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4d63625f947cb1b77d2359a8a7ec19062e60dedb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 18 Jan 2019 10:41:23 +0800 Subject: [PATCH 0640/4278] PRF:20190114 Get started with Wekan, an open source kanban board.md @wwhio --- ... started with Wekan, an open source kanban board.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md index e774987979..560aaccbad 100644 --- a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md +++ b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wwhio) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Wekan, an open source kanban board) @@ -9,7 +9,9 @@ 开始使用 Wekan 吧,一款开源看板软件 ====== -这是开源工具类软件推荐的第二期,本文将让你在 2019 年更具生产力。来,让我们一起看看 Wekan 吧。 + +> 这是开源工具类软件推荐的第二期,本文将让你在 2019 年更具生产力。来,让我们一起看看 Wekan 吧。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban-board.png?itok=tXC0dkKV) 每年年初,人们似乎都在想方设法地让自己更具生产力。对新年目标、期待,当然还有“新年新气象”这样的口号等等都促人上进。可大部分生产力软件的推荐都严重偏向闭源的专有软件,但事实上并不用这样。 @@ -22,7 +24,7 @@ ![](https://opensource.com/sites/default/files/uploads/wekan-1.png) -但这些 APP 通常需要连接到一个工作账户或者商业服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让他完全在本地运行,或者使用你自己选择的服务运行它。其他的看板 APP 提供的功能在 Wekan 里几乎都有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,基本上你对一款现代看板软件的功能需求它都能提供。 +但这些 APP 通常需要连接到一个工作账户或者商业服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让它完全在本地运行,或者使用你自己选择的服务运行它。其他的看板 APP 提供的功能在 Wekan 里几乎都有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,基本上你对一款现代看板软件的功能需求它都能提供。 ![](https://opensource.com/sites/default/files/uploads/wekan-2.png) @@ -52,7 +54,7 @@ via: https://opensource.com/article/19/1/productivity-tool-wekan 作者:[Kevin Sonney][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 c55526d47b0eab91c2e09f5dca216066445ea60c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 18 Jan 2019 10:41:58 +0800 Subject: [PATCH 0641/4278] PUB:20190114 Get started with Wekan, an open source kanban board.md @wwhio https://linux.cn/article-10454-1.html --- ...114 Get started with Wekan, an open source kanban board.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 Get started with Wekan, an open source kanban board.md (97%) diff --git a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md b/published/20190114 Get started with Wekan, an open source kanban board.md similarity index 97% rename from translated/tech/20190114 Get started with Wekan, an open source kanban board.md rename to published/20190114 Get started with Wekan, an open source kanban board.md index 560aaccbad..955e88d4d3 100644 --- a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md +++ b/published/20190114 Get started with Wekan, an open source kanban board.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wwhio) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10454-1.html) [#]: subject: (Get started with Wekan, an open source kanban board) [#]: via: (https://opensource.com/article/19/1/productivity-tool-wekan) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From dfb115f295579f79742dcc67c92b5422b1b87d8f Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 16:43:03 +0800 Subject: [PATCH 0642/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md | 2 ++ 1 file changed, 2 insertions(+) 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 298d5f58bc..292afeb895 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,3 +1,5 @@ +Translating by wwhio + Pi Day: 12 fun facts and ways to celebrate ====== From 9ae8d4c893d52ba0f6ae9a1e5e42103faa77d069 Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 16:43:07 +0800 Subject: [PATCH 0643/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20150513 XML vs JSON.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md index d3928daa83..4bd15ea2fa 100644 --- a/sources/talk/20150513 XML vs JSON.md +++ b/sources/talk/20150513 XML vs JSON.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wwhio) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a1c8a4ea48ddd119c8000d50b4107e55f1aae7b6 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Fri, 18 Jan 2019 17:38:10 +0800 Subject: [PATCH 0644/4278] Translating Translating: Dawn of the Microcomputer- The Altair 8800 --- .../talk/20180722 Dawn of the Microcomputer- The Altair 8800.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md index 98a42236de..9974ac6352 100644 --- a/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md +++ b/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md @@ -1,3 +1,5 @@ +zhs852 is translating. + Dawn of the Microcomputer: The Altair 8800 ====== Subscribers to Popular Electronics were a sophisticated group. The magazine’s editor, Arthur Salsberg, felt compelled to point out as much in the editorial section of the [December 1974 issue][1]. The magazine had received letters complaining that a recent article, titled “How to Set Up a Home TV Service Shop,” would inspire a horde of amateur TV technicians to go out and undercut professional repairmen, doing great damage to everyone’s TVs in the process. Salsberg thought this concern was based on a misunderstanding about who read Popular Electronics. He explained that, according to the magazine’s own surveys, 52% of Popular Electronics subscribers were electronics professionals of some kind and 150,000 of them had repaired a TV in the last 60 days. Moreover, the average Popular Electronics subscriber had spent $470 on electronics equipment ($3578 in 2018) and possessed such necessities as VOMs, VTVMs, tube testers, transistor testers, r-f signal generators, and scopes. “Popular Electronics readers are not largely neophytes,” Salsberg concluded. From 6b79840ff0bb1e9dded3359a9784f85c2d471ee1 Mon Sep 17 00:00:00 2001 From: jlztan Date: Fri, 18 Jan 2019 17:42:55 +0800 Subject: [PATCH 0645/4278] Update and rename sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md to translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md --- ...ing You Need to Know About PPA in Linux.md | 315 ------------------ ...ing You Need to Know About PPA in Linux.md | 314 +++++++++++++++++ 2 files changed, 314 insertions(+), 315 deletions(-) delete mode 100644 sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md create mode 100644 translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md diff --git a/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md deleted file mode 100644 index d0132aebf8..0000000000 --- a/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md +++ /dev/null @@ -1,315 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (jlztan) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is PPA? Everything You Need to Know About PPA in Linux) -[#]: via: (https://itsfoss.com/ppa-guide/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -What is PPA? Everything You Need to Know About PPA in Linux -====== - -**Brief: An in-depth article that covers almost all the questions around using PPA in Ubuntu and other Linux distributions.** - -If you have been using Ubuntu or some other Linux distribution based on Ubuntu such as Linux Mint, Linux Lite, Zorin OS etc, you may have come across three magical lines of this sort: - -``` -sudo add-apt-repository ppa:dr-akulavich/lighttable -sudo apt-get update -sudo apt-get install lighttable-installer -``` - -A number of websites suggest these kind of lines to [install applications in Ubuntu][1]. This is what is called installing an application using PPA. - -But what is PPA? Why is it used? Is it safe to use PPA? How to properly use PPA? How to delete a PPA? - -I’ll answer all of the above questions in this detailed guide. Even if you already know a few things about PPAs, I am sure this article will still add to your knowledge. - -Do note that I am writing this article using Ubuntu. Therefore I’ll use the term Ubuntu almost everywhere but the explanations and steps are also applicable to other Debian/Ubuntu based distributions. - -### What is PPA? Why is it used? - -![Everything you need to know about PPA in Ubuntu Linux][2] - -PPA stands for Personal Package Archive. - -Does that make sense? Probably not. - -Before you understand PPA, you should know the concept of repositories in Linux. I won’t go into details here though. - -#### Concept of repositories and package management - -A repository is a collection of files that has information about various software, their versions and some other details like the checksum. Each Ubuntu version has its own official set of four repositories: - - * **Main** – Canonical-supported free and open-source software. - - * **Universe** – Community-maintained free and open-source software. - - * **Restricted** – Proprietary drivers for devices. - - * **Multiverse** – Software restricted by copyright or legal issues. - - - - -You can see such repositories for all Ubuntu versions [here][3]. You can browse through them and also go to the individual repositories. For example, Ubuntu 16.04 main repository can be found [here][4]. - -So basically it’s a web URL that has information about the software. How does your system know where are these repositories? - -This information is stored in the sources.list file in the directory /etc/apt. If you look at its content, you’ll see that it has the URL of the repositories. The lines with # at the beginning are ignored. - -Now when you run the command sudo apt update, your system uses [APT tool][5] to check against the repo and stores the information about the software and their version in a cache. When you use the command sudo apt install package_name, it uses the information to get that package from the URL where the actual software is stored. - -If the repository doesn’t have the information about a certain package, you’ll see an error like: - -``` -E: Unable to locate package -``` - -At this point, I recommend reading my [guide to using apt commands][6]. This will give you a much better understanding of apt commands, update etc. - -So this was about repositories. But what is PPA? How does it enter into the picture? - -#### Why is PPA used? - -As you can see, Ubuntu controls what software and more importantly which version of a software you get on your system. But imagine if a software developer releases a new version of the software. - -Ubuntu won’t make it available immediately. There is a procedure to check if the new version of the software is compatible with the system or not. This ensures the stability of the system. - -But this also means that it will be some weeks or in some cases, some months before it is made available by Ubuntu. Not everyone would want to wait that long to get their hands on the new version of their favorite software. - -Similarly, suppose someone develops a software and wants Ubuntu to include that software in the official repositories. It again will take months before Ubuntu makes a decision and includes it in the official repositories. - -Another case would be during beta testing. Even if a stable version of the software is available in the official repositories, a software developer may want some end users to test their upcoming release. How do they enable the end user to beta test the upcoming release? - -Enter PPA! - -### How to use PPA? How does PPA work? - -[PPA][7], as I already told you, means Personal Package Archive. Mind the word ‘Personal’ here. That gives the hint that this is something exclusive to a developer and is not officially endorsed by the distribution. - -Ubuntu provides a platform called Launchpad that enables software developers to create their own repositories. An end user i.e. you can add the PPA repository to your sources.list and when you update your system, your system would know about the availability of this new software and you can install it using the standard sudo apt install command like this. - -`sudo add-apt-repository ppa:dr-akulavich/lighttable` -`sudo apt-get update` -`sudo apt-get install lighttable-installer` - -To summarize: - - * sudo add-apt-repository <– This command adds the PPA repository to the list. - * sudo apt-get update <– This command updates the list of the packages that can be installed on the system. - * sudo apt-get install <– This command installs the package. - - - -You see that it is important to use the command sudo apt update or else your system will not know when a new package is available. - -Now let’s take a look at the first command in a bit more detail. - -``` -sudo add-apt-repository ppa:dr-akulavich/lighttable -``` - -You would notice that this command doesn’t have a URL to the repository. This is because the tool has been designed to abstract the information about URL from you. - -Just a small note. If you add ppa:dr-akulavich/lighttable, you get Light Table. But if you add ppa:dr-akulavich, you’ll get all the repository or packages mentioned in the ‘upper repository’. It’s hierarchical. - -Basically, when you add a PPA using add-apt-repository, it will do the same action as if you manually run these commands: - -``` -deb http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main -deb-src http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main -``` - -The above two lines are the traditional way to add any repositories to your sources.list. But PPA does it automatically for you, without wondering about the exact repository URL and operating system version. - -One important thing to not here is that when you use PPA, it doesn’t change your original sources.list. Instead, it creates two files in /etc/apt/sources.d directory, a list and a back up file with suffix ‘save’. - -![Using a PPA in Ubuntu][8]PPA create separate sources.list - -The files with suffix ‘list’ has the command that adds the information about the repository. - -![PPA add repository information][9]Content of source.list of a PPA - -This is a safety measure to ensure that adding PPAs don’t mess with the original sources.list. It also helps in removing the PPA. - -#### Why PPA? Why not DEB packages? - -You may ask why should you use PPA when it involves using command line which might not be preferred by everyone. Why not just distribute a DEB package that can be installed graphically? - -The answer lies in the update procedure. If you install a software using a DEB package, there is no guarantee that the installed software will be updated to a newer version when you run sudo apt update && sudo apt upgrade. - -It’s because the apt upgrade procedure relies on the sources.list. If there is no entry for a software, it doesn’t get the update via the standard software updater. - -So does it mean software installed using DEB never gets an update? No, not really. It depends on how the package was created. - -Some developers automatically add an entry to the sources.list and then it is updated like a regular software. Google Chrome is one such example. - -Some software would notify you of availability of a new version when you try to run it. You’ll have to download the new DEB package and run it again to update the current software to a newer version. Oracle Virtual Box is an example in this case. - -For the rest of the DEB packages, you’ll have to manually look for an update and this is not convenient, especially if your software is meant for beta testers. You need to add more updates frequently. This is where PPA come to the rescue. - -#### Offical PPA vs unofficial PPA - -You may also hear the term official PPA or unofficial PPA. What’s the difference? - -When developers create PPA for their software, it is called the official PPA. Quite obviously because it is coming from none other than the project developers. - -But at times, individuals create PPA of projects that were created by other developers. - -Why would someone do that? Because many developers just provide the source code of the software and you know that [installing software from source code in Linux][10] is a pain and not everyone could or would do that. - -This is why volunteers take it upon themselves to create a PPA from those source code so that other users can install the software easily. After all, using those 3 lines is a lot easier than battling the source code installation. - -#### Make sure that a PPA is available for your distribution version - -When it comes to using PPA in Ubuntu or any other Debian based distribution, there are a few things you should keep in mind. - -Not every PPA is available for your particular version. You should know [which Ubuntu version][11] you are using. The codename of the release is important because when you go to the webpage of a certain PPA, you can see which Ubuntu versions are supported by the PPA. - -For other Ubuntu-based distributions, you can check the content of /etc/os-release to [find out the Ubuntu version][11] information. - -![Verify PPA availability for Ubuntu version][12]Check if PPA is available for your Ubuntu version - -How to know the PPA url? Simply search on the internet with the PPA name like ppa:dr-akulavich/lighttable and you’ll get the first result from [Launchpad][13], the official platform for hosting PPA. You can also go to Launchpad and search for the required PPA directly there. - -If you don’t verify and add the PPA, you may see an error like this when you try to install a software not available for your version. - -``` -E: Unable to locate package -``` - -What’s worse is that since it has been added to your source.list, each time you run software updater, you’ll see an error “[Failed to download repository information][14]“. - -![Failed to download repository information Ubuntu 13.04][15] - -If you run sudo apt update in the terminal, the error will have more details about which repository is causing the trouble. You can see something like this in the end of the output of sudo apt update: - -``` -W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main/binary-i386/Packages  404  Not Found -E: Some index files failed to download. They have been ignored, or old ones used instead. -``` - -Which is self-explanatory because the system cannot find the repository for your version. Remember what we saw earlier about repository structure? APT will try to look for software information in the place /ubuntu/dists/Ubuntu_Version - -And if the PPA for the specific version is not available, it will never be able to open the URL and you get the famous 404 error. - -#### Why are PPAs not available for all the Ubuntu release versions? - -It is because someone has to compile the software and create a PPA out of it on the specific versions. Considering that a new Ubuntu version is released every six months, it’s a tiresome task to update the PPA for every Ubuntu release. Not all developers have time to do that. - -#### How to install the application if PPA is not available for your version? - -It is possible that though the PPA is not available for your Ubuntu version, you could still download the DEB file and install the application - -Let’s say that you go to the Light Table PPA. Using the knowledge about PPA you just learned, you realize that the PPA is not available for your specific Ubuntu release. - -What you can do is to click on the ‘View package details’. - -![Get DEB file from PPA][16] - -And in here, you can click on a package to reveal more details. You’ll also find the source code and the DEB file of the package here. - -![Download DEB file from PPA][17] - -I advise [using Gdebi to install these DEB files][18] instead of the Software Center because Gdebi is a lot better at handling dependencies. - -Do note that the package installed this way might not get any future updates. - -I think you have read enough about adding PPAs. How about removing a PPA and the software installed by it? - -### How to delete PPA? - -I have written about [deleting PPA][19] in the past. I am going to describe the same methods here as well. - -I advise deleting the software that you installed from a PPA before removing the PPA. If you just remove the PPA, the installed software remains in the system but it won’t get any updates. You wouldn’t want that, would you? - -So, the question comes, how to know which application was installed by which PPA? - -#### Find packages installed by a PPA and remove them - -Ubuntu Software Center doesn’t help here. You’ll have to use Synaptic package manager here which has more advanced features. - -You can install Synaptic from Software Center or use the command below: - -``` -sudo apt install synaptic -``` - -Once installed, start Synaptic package manager and select Origin. You’ll see various repositories added to the system. PPA entries will be labeled with prefix PPA. Click on them to see the packages that are available by the PPA. Installed software will have appropriate symbol before it. - -![Managing PPA with Synaptic package manager][20]Find packages installed via a PPA - -Once you have found the packages, you can delete them from Synaptic itself. Otherwise, you always have the option to use the command line: - -``` -sudo apt remove package_name -``` - -Once you have removed the packages installed by a PPA, you can continue to remove the PPA from your sources.list. - -#### Remove a PPA graphically - -Go to Software & Updates and then go to tab Other Software. Look for the PPA that you want to remove: - -![Delete a PPA from Software Source][21] - -You have two options here. Either you deselect the PPA or you choose the Remove option. - -The difference is that when you deselect a PPA entry, your system will comment out the repository entry in its ppa_name.list file in /etc/apt/sources.list.d but if you choose the Remove option, it will delete the repository entry from its ppa_name.list file in /etc/apt/sources.list.d directory. - -In both the cases, the files ppa_name.list remains in the said directory, even if it is empty. - -### Is it safe to use PPA? - -It is a subjective question. Purists abhor PPA because most of the time PPAs are from third-party developers. But at the same time, PPAs are popular in the Debian/Ubuntu world as they provide an easier installation option. - -As far as the security is concerned, it’s less likely that you use a PPA and your Linux system is hacked or injected with malware. I don’t recall such an incident ever happened so far. - -Official PPAs can be used without thinking twice. Using unofficial PPA is entirely your decision. - -As a rule of thumb, you should avoid installing a program via a third party PPA if it the program requires sudo access to run. - -### What do you think about using PPA? - -I know it’s a long read but I wanted to give you a better understanding of PPA. I hope this detailed guide answered most of your questions about using PPA. - -If you have more questions about PPA, please feel free to ask in the comment section. - -If you notice any technical or grammatical error or if you have suggestions for improving this article, please let me know. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ppa-guide/ - -作者:[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://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/what-is-ppa.png?resize=800%2C450&ssl=1 -[3]: http://archive.ubuntu.com/ubuntu/dists/ -[4]: http://archive.ubuntu.com/ubuntu/dists/xenial/main/ -[5]: https://wiki.debian.org/Apt -[6]: https://itsfoss.com/apt-command-guide/ -[7]: https://launchpad.net/ubuntu/+ppas -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-sources-list-files.png?resize=800%2C259&ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/content-of-ppa-list.png?ssl=1 -[10]: https://itsfoss.com/install-software-from-source-code/ -[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/12/verify-ppa-availibility-version.jpg?resize=800%2C481&ssl=1 -[13]: https://launchpad.net/ -[14]: https://itsfoss.com/failed-to-download-repository-information-ubuntu-13-04/ -[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/04/Failed-to-download-repository-information-Ubuntu-13.04.png?ssl=1 -[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa.jpg?resize=800%2C483&ssl=1 -[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa-2.jpg?resize=800%2C477&ssl=1 -[18]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ -[19]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ -[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-synaptic-manager.jpeg?resize=800%2C394&ssl=1 -[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2012/08/Delete-a-PPA.jpeg?ssl=1 diff --git a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md new file mode 100644 index 0000000000..b83c9f5720 --- /dev/null +++ b/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @@ -0,0 +1,314 @@ +[#]: collector: "lujun9972" +[#]: translator: "jlztan" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "What is PPA? Everything You Need to Know About PPA in Linux" +[#]: via: "https://itsfoss.com/ppa-guide/" +[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" + +# 什么是 PPA?你需要知道的关于 Linux 中 PPA 的一切 + +**简介:一篇涵盖了在 Ubuntu 和其他 Linux 发行版中使用 PPA 的几乎所有问题的深入的文章。** + +如果你一直在使用 Ubuntu 或基于 Ubuntu 的其他 Linux 发行版,例如 Linux Mint、Linux Lite、Zorin OS 等,你可能会遇到以下三行神奇的命令: + +``` +sudo add-apt-repository ppa:dr-akulavich/lighttable +sudo apt-get update +sudo apt-get install lighttable-installer +``` + +许多网站推荐使用类似于以上几行的形式 [在 Ubuntu 中安装应用程序][1]。这就是所谓的使用 PPA 安装应用程序。 + +但什么是 PPA?为什么用它?使用 PPA 安全吗?如何正确使用 PPA?如何删除 PPA? + +我将在这个详细的指南中回答上述所有问题。即使你已经了解了一些关于 PPA 的事情,我相信这篇文章仍然会让你了解这方面的更多知识。 + +请注意我正在使用 Ubuntu 撰写本文。因此,我几乎可以在任何地方使用 Ubuntu 这个术语,但文中的说明和步骤也适用于其他基于 Debian/Ubuntu 的发行版。 + +### 什么是 PPA?为什么要使用 PPA? + +![Everything you need to know about PPA in Ubuntu Linux][2] + +PPA 表示 个人软件包存档Personal Package Archive个人软件包存档Personal Package Archive。 + +这样说容易理解吗?可能不是很容易。 + +在了解 PPA 之前,你应该了解 Linux 中软件仓库的概念。关于软件仓库,在这里我不会详述。 + +#### 软件仓库和包管理的概念 + +软件仓库是一组文件,其中包含各种软件及其版本的信息,以及校验和等其他一些详细信息。每个版本的 Ubuntu 都有自己的四个官方软件仓库: + +- Main - Canonical 支持的免费和开源软件。 +- Universe - 社区维护的免费和开源软件。 +- Restricted - 设备的专有驱动程序。 +- Multiverse - 受版权或法律问题限制的软件。 + +你可以在 [这里][3] 看到所有版本的 Ubuntu 的软件仓库。你可以浏览并转到各个仓库。例如,可以在 [这里][4] 找到 Ubuntu 16.04 的主存储库。 + +所以,PPA 基本上是一个包含软件信息的网址。那你的系统又是如何知道这些仓库的位置的呢? + +这些信息存储在 `/etc/apt` 目录中的 `sources.list` 文件中。如果查看此文件的内容,你就会看到里面有软件仓库的网址。`#` 开头的行将被忽略。 + +这样的话,当你运行 `sudo apt update` 命令时,你的系统将使用 [APT 工具][5] 来检查软件仓库并将软件及其版本信息存储在缓存中。当你使用 `sudo apt install package_name` 命令时,它通过该信息从实际存储软件的网址获取该软件包。 + +如果软件仓库中没有关于某个包的信息,你将看到如下错误: + +``` +E: Unable to locate package +``` + +此时,建议阅读我的 [apt 命令使用指南][6] 一文,这将帮你更好地理解 `apt`、`update` 等命令。 + +以上是关于软件仓库的内容。但什么是 PPA?PPA 和软件仓库又有什么关联呢? + +#### 为什么要用 PPA? + +如你所见,Ubuntu 对系统中的软件进行管理,更重要的是控制你在系统上获得哪个版本的软件。但想象一下开发人员发布了软件的新版本的情况。 + +Ubuntu 不会立即提供该新版本的软件。需要一个步骤来检查此新版本的软件是否与系统兼容,从而可以确保系统的稳定性。 + +但这也意味着它需要经过几周才能在 Ubuntu 上可用,在某些情况下,这可能需要几个月的时间。不是每个人都想等待那么长时间才能获得他们最喜欢的软件的新版本。 + +类似地,假设有人开发了一款软件,并希望 Ubuntu 将该软件包含在官方软件仓库中。在 Ubuntu 做出决定并将其包含在官方存软件仓库之前,还需要几个月的时间。 + +另一种情况是在 beta 测试阶段。即使官方软件仓库中提供了稳定版本的软件,软件开发人员也可能希望某些终端用户测试他们即将发布的版本。他们是如何使终端用户对即将发布的版本进行 beta 测试的呢? + +通过 PPA! + +### 如何使用 PPA?PPA 是怎样工作的? + +正如我已经告诉过你的那样,[PPA][7] 代表个人软件包存档Personal Package Archive个人软件包存档Personal Package Archive。在这里注意 “个人” 这个词,它暗示了这是开发人员独有的东西,并没有得到分发的正式许可。 + +Ubuntu 提供了一个名为 Launchpad 的平台,使软件开发人员能够创建自己的软件仓库。 终端用户,也就是你,可以将 PPA 仓库添加到 `sources.list` 文件中,当你更新系统时,你的系统会知道这个新软件的可用性,然后你可以使用标准的 `sudo apt install` 命令安装它。 + +`sudo add-apt-repository ppa:dr-akulavich/lighttable` +`sudo apt-get update` +`sudo apt-get install lighttable-installer` + +概括一下上面三个命令: + +- `sudo add-apt-repository ` < - 此命令将 PPA 仓库添加到列表中。 +- `sudo apt-get update` < - 此命令更新可以在当前系统上安装的软件包列表。 +- `sudo apt-get install ` < - 此命令安装软件包。 + +你会发现使用 `sudo apt update` 命令非常重要,否则你的系统将无法知道新软件包何时可用。 + +现在让我们更详细地看一下第一个命令。 + +``` +sudo add-apt-repository ppa:dr-akulavich/lighttable +``` + +你会注意到此命令没有软件仓库的 URL。这是因为该工具被设计成将 URL 信息抽象之后再展示给你。 + +小小注意一下:如果你添加的是 `ppa:dr-akulavich/lighttable`,你会得到 Light Table。但是如果你添加 `ppa:dr-akulavich`,你将得到 “上层软件仓库” 中的所有仓库或软件包。它是按层级划分的。 + +基本上,当您使用 `add-apt-repository` 添加 PPA 时,它将执行与手动运行这些命令相同的操作: + +``` +deb http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main +deb-src http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main +``` + +以上两行是将任何软件仓库添加到你系统的 `sources.list` 文件的传统方法。但 PPA 会自动为你完成这些工作,无需考虑确切的软件仓库 URL 和操作系统版本。 + +此处不那么重要的一点是,当你使用 PPA 时,它不会更改原始的 `sources.list` 文件。相反,它在 `/etc/apt/sources.d` 目录中创建了两个文件,一个 “list” 文件和一个带有 “save” 后缀的备份文件。 + +![Using a PPA in Ubuntu][8] + +PPA 创建了单独的 `sources.list` 文件 + +带有后缀 “list” 的文件含有添加软件仓库的信息的命令。 + +![PPA add repository information][9] + +一个 PPA 的 `source.list` 文件的内容 + +这是一种安全措施,可以确保添加的 PPA 不会和原始的 `sources.list` 文件弄混,它还有助于移除 PPA。 + +#### 为什么使用 PPA?为何不用 DEB 包 + +你可能会问为什么要使用 PPA,PPA 需要通过命令行使用,而不是每个人都喜欢用命令行。为什么不直接分发可以图形方式安装的 DEB 包呢? + +答案在于更新的过程。如果使用 DEB 包安装软件,将无法保证在运行 `sudo apt update` 和 `sudo apt upgrade` 命令时,已安装的软件会被更新为较新的版本。 + +这是因为 apt 的升级过程依赖于 `sources.list` 文件。如果文件中没有相应的软件条目,则不会通过标准软件更新程序获得更新。 + +那么这是否意味着使用 DEB 安装的软件永远不会得到更新?不是的。这取决于 DEB 包的创建方式。 + +一些开发人员会自动在 `sources.list ` 中添加一个条目,这样软件就可以像普通软件一样更新。谷歌 Chrome 浏览器就是这样一个例子。 + +某些软件会在运行时通知你有新版本可用。你必须下载新的 DEB 包并再次运行,来将当前软件更新为较新版本。Oracle Virtual Box 就是这样一个例子。 + +对于其余的 DEB 软件包,你必须手动查找更新,这很不方便,尤其是在你的软件面向 Beta 测试者时,你需要频繁的添加很多更新。这正是 PPA 要解决的问题。 + +#### 官方 PPA vs 非官方 PPA + +你或许听过官方 PPA 或非官方 PPA 这个词,二者有什么不同呢? + +开发人员为他们的软件创建的 PPA 称为官方 PPA。很明显,这是因为它来自项目开发者。 + +但有时,个人会创建由其他开发人员所创建的项目的 PPA。 + +为什么会有人这样做? 因为许多开发人员只提供软件的源代码,而且你也知道 [在 Linux 中从源代码安装软件][10] 是一件痛苦的事情,并不是每个人都可以或者会这样做。 + +这就是志愿者自己从这些源代码创建 PPA 以便其他用户可以轻松安装软件的原因。毕竟,使用这 3 行命令比从源代码安装要容易得多。 + +#### 确保你的 Linux 发行版本可以使用 PPA + +当在 Ubuntu 或任何其他基于 Debian 的发行版中使用 PPA 时,你应该记住一些事情。 + +并非每个 PPA 都适用于你的特定版本。你应该知道正在使用 [哪个版本的 Ubuntu][11]。版本的开发代号很重要,因为当你访问某个 PPA 的页面时,你可以看到该 PPA 都支持哪些版本的 Ubuntu。 + +对于其他基于 Ubuntu 的发行版,你可以查看 `/etc/os-release` 的内容来 [找出 Ubuntu 版本][11] 的信息。 + +![Verify PPA availability for Ubuntu version][12] + +检查 PPA 是否适用于你的 Ubuntu 版本 + +如何知道 PPA 的网址呢?只需在网上搜索 PPA 的名称,如 `ppa:dr-akulavich/lighttable`,第一个搜索结果来自 [Launchpad][13],这是托管 PPA 的官方平台。你也可以转到 Launchpad 并直接在那里搜索所需的 PPA。 + +如果不验证是否适用当前的版本就添加 PPA,当尝试安装不适用于你的系统版本的软件时,可能会看到类似下面的错误。 + +``` +E: Unable to locate package +``` + +更糟糕的是,因为它已经添加到你的 `source.list` 中,每次运行软件更新程序时,你都会看到 “[无法下载软件仓库信息][14]” 的错误。 + +![Failed to download repository information Ubuntu 13.04][15] + +如果你在终端中运行 `sudo apt update`,错误提示将包含导致此问题的仓库的更多详细信息。你可以在 `sudo apt update` 的输出内容结尾看到类似的内容: + +``` +W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main/binary-i386/Packages 404 Not Found +E: Some index files failed to download. They have been ignored, or old ones used instead. +``` + +上面的错误提示说的很明白,是因为系统找不到当前版本对应的仓库。还记得我们之前看到的仓库结构吗?APT 将尝试在 /ubuntu/dists/Ubuntu_Version 中寻找软件信息。 + +如果特定版本的 PPA 不可用,它将永远无法打开 URL,你会看到著名的404错误。 + +#### 为什么 PPA 不适用于所有 Ubuntu 发行版? + +这是因为 PPA 的作者必须编译软件并在特定版本上创建 PPA。考虑到每六个月发布一个新的 Ubuntu 版本,为每个版本的 Ubuntu 更新 PPA 是一项繁琐的任务,并非所有开发人员都有时间这样做。 + +#### 如果 PPA 不适用于你的系统版本,该如何安装应用程序? + +尽管 PPA 不适用于你的 Ubuntu 版本,你仍然可以下载 DEB 文件并安装应用程序。 + +比如说,你访问 Light Table 的 PPA 页面,使用刚刚学到的有关 PPA 的知识,你会发现 PPA 不适用于你的特定 Ubuntu 版本。 + +你可以点击 `查看软件包详细信息`。 + +![Get DEB file from PPA][16] + +在这里,你可以单击软件包以显示更多详细信息,还可以在此处找到包的源代码和 DEB 文件。 + +![Download DEB file from PPA][17] + +我建议 [使用 Gdebi 安装这些 DEB 文件][18] 而不是通过软件中心,因为 Gdebi 在处理依赖项方面要好得多。 + +请注意,以这种方式安装的软件包可能无法获得任何将来的更新。 + +我认为你已经阅读了足够多的关于添加 PPA 的内容,那么如何删除 PPA 及其安装的软件呢? + +### 如何删除 PPA? + +我过去曾写过 [删除 PPA][19] 的教程,这里写的也是同样的方法。 + +我建议在删除 PPA 之前删除从 PPA 安装的软件。如果只是删除 PPA,则已安装的软件仍保留在系统中,但不会获得任何更新。这不是你想要的,不是吗? + +那么,问题来了,如何知道是哪个 PPA 安装了哪个应用程序? + +#### 查找 PPA 安装的软件包并将其移除 + +Ubuntu 软件中心无法移除 PPA 安装的软件包,你必须使用具有更多高级功能的 Synaptic 包管理器。 + +可以从软件中心安装 Synaptic 或使用以下命令进行安装: + +``` +sudo apt install synaptic +``` + +安装后,启动 Synaptic 包管理器并选择 Origin。你会看到添加到系统的各种软件仓库。 PPA 条目将以前缀 PPA 进行标识,单击以查看 PPA 可用的包。已安装的软件前面会有恰当的符号进行标识。 + +![Managing PPA with Synaptic package manager][20] + +查找通过 PPA 安装的软件包 + +找到包后,你可以从 Synaptic 删除它们。此外,也始终可以选择使用命令行进行移除: + +``` +sudo apt remove package_name +``` + +删除 PPA 安装的软件包后,你可以继续从 `sources.list` 中删除PPA。 + +#### 以图形界面的方式删除 PPA + +在设置中打开 “软件和更新”,然后点击 “其他软件” 选项卡。查找要删除的 PPA: + +![Delete a PPA from Software Source][21] + +此处你可以进项两项操作,可以取消选择 PPA 或选择 “删除” 选项。 + +区别在于,当你取消选择 PPA 条目时,系统将在 `/etc/apt/sources.list.d` 中的`ppa_name.list` 文件中注释掉仓库条目;但如果选择 “删除” 选项,将会删除 `/etc/apt/sources.list.d`目录中 `ppa_name.list` 文件里的仓库条目。 + +在这两种情况下,文件 `ppa_name.list` 都保留在所在的目录中,即使它是空的。 + +### 使用 PPA 安全吗? + +这是一个主观问题。纯粹主义者厌恶 PPA,因为大多数时候 PPA 来自第三方开发者。但与此同时,PPA 在 Debian/Ubuntu 世界中很受欢迎,因为它们提供了更简单的安装选项。 + +就安全性而言,使用 PPA 之后,你的 Linux 系统被黑客攻击或注入恶意软件的可能性较小。到目前为止,我不记得发生过这样的事件。 + +官方 PPA 可以不加考虑的使用,使用非官方 PPA 完全是你自己的决定。 + +根据经验,如果程序需要 sudo 权限,则应避免通过第三方 PPA 进行安装。 + +### 你如何看待使用 PPA? + +我知道这篇文章需要挺长时间来阅读,但我想让你更好地了解 PPA。我希望这份详细指南能够回答你关于使用 PPA 的大部分问题。 + +如果你对 PPA 有更多疑问,请随时在评论区提问。 + +如果你发现任何技术或语法错误,或者有改进的建议,请告诉我。 + +------ + +via: https://itsfoss.com/ppa-guide/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[jlztan](https://github.com/jlztan) +校对:[校对者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://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/what-is-ppa.png?resize=800%2C450&ssl=1 +[3]: http://archive.ubuntu.com/ubuntu/dists/ +[4]: http://archive.ubuntu.com/ubuntu/dists/xenial/main/ +[5]: https://wiki.debian.org/Apt +[6]: https://itsfoss.com/apt-command-guide/ +[7]: https://launchpad.net/ubuntu/+ppas +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-sources-list-files.png?resize=800%2C259&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/content-of-ppa-list.png?ssl=1 +[10]: https://itsfoss.com/install-software-from-source-code/ +[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/12/verify-ppa-availibility-version.jpg?resize=800%2C481&ssl=1 +[13]: https://launchpad.net/ +[14]: https://itsfoss.com/failed-to-download-repository-information-ubuntu-13-04/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/04/Failed-to-download-repository-information-Ubuntu-13.04.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa.jpg?resize=800%2C483&ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa-2.jpg?resize=800%2C477&ssl=1 +[18]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ +[19]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-synaptic-manager.jpeg?resize=800%2C394&ssl=1 +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2012/08/Delete-a-PPA.jpeg?ssl=1 From 49eb0b4876d48a09fcebe843c285cdb25523ae5d Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 20:55:29 +0800 Subject: [PATCH 0646/4278] Update 20180428 A Beginners Guide To Flatpak.md --- sources/tech/20180428 A Beginners Guide To Flatpak.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/sources/tech/20180428 A Beginners Guide To Flatpak.md index db1dfa8181..9cafa47bcb 100644 --- a/sources/tech/20180428 A Beginners Guide To Flatpak.md +++ b/sources/tech/20180428 A Beginners Guide To Flatpak.md @@ -1,3 +1,5 @@ +Translating by wwhio + A Beginners Guide To Flatpak ====== From 8b160d85d6ae029b0480722abb2b9b951dda6b5f Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 20:56:19 +0800 Subject: [PATCH 0647/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180428 A Beginners Guide To Flatpak.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/sources/tech/20180428 A Beginners Guide To Flatpak.md index 9cafa47bcb..8b3460c2dd 100644 --- a/sources/tech/20180428 A Beginners Guide To Flatpak.md +++ b/sources/tech/20180428 A Beginners Guide To Flatpak.md @@ -1,5 +1,6 @@ Translating by wwhio + A Beginners Guide To Flatpak ====== From 76b337e907a5a86a92833365526680f0654d2a68 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 18 Jan 2019 22:37:21 +0800 Subject: [PATCH 0648/4278] PRF:20180606 Working with modules in Fedora 28.md @geekpi --- ...80606 Working with modules in Fedora 28.md | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/translated/tech/20180606 Working with modules in Fedora 28.md b/translated/tech/20180606 Working with modules in Fedora 28.md index c4cfcfe1d6..bf5c4237f2 100644 --- a/translated/tech/20180606 Working with modules in Fedora 28.md +++ b/translated/tech/20180606 Working with modules in Fedora 28.md @@ -1,6 +1,8 @@ 使用 Fedora 28 中的模块 ====== + ![](https://fedoramagazine.org/wp-content/uploads/2018/05/modules-workingwith-816x345.jpg) + 最近 Fedora Magazine 中题为 [Fedora 28 服务器版的模块化][1]在解释 Fedora 28 中的模块化方面做得很好。它还给出了一些示例模块并解释了它们解决的问题。本文将其中一个模块用于实际应用,包括使用模块安装设置 Review Board 3.0。 ### 入门 @@ -21,9 +23,9 @@ sudo dnf -y update dnf module list ``` -输出列出了一组模块,这些模块显示了每个模块的关联流,版本和可用安装配置文件。模块流旁边的 [d] 表示安装命名模块时使用的默认流。 +输出列出了一组模块,这些模块显示了每个模块的关联流、版本和可用安装配置文件。模块流旁边的 `[d]` 表示安装命名模块时使用的默认流。 -输出还显示大多数模块都有名为 default 的配置文件。这不是巧合,因为 default 是默认配置文件使用的名称。 +输出还显示大多数模块都有名为 `default` 的配置文件。这不是巧合,因为 `default` 是默认配置文件使用的名称。 要查看所有这些模块的来源,请运行: @@ -31,7 +33,7 @@ dnf module list dnf repolist ``` -与通常的 [fedora 和更新包仓库][5]一起,输出还显示了fedora-modular 和 updates-modular 仓库。 +与通常的 [fedora 和更新包仓库][5]一起,输出还显示了 fedora-modular 和 updates-modular 仓库。 介绍声明你将设置 Review Board 3.0。也许名为 reviewboard 的模块在之前的输出中引起了你的注意。接下来,要获取有关该模块的一些详细信息,请运行以下命令: @@ -45,7 +47,7 @@ dnf module info reviewboard dnf module list reviewboard ``` -2.5 旁边的 [d] 表示它被配置为 reviewboard 的默认流。因此,请明确你想要的流: +2.5 旁边的 `[d]` 表示它被配置为 reviewboard 的默认流。因此,请明确你想要的流: ``` dnf module info reviewboard:3.0 @@ -65,7 +67,7 @@ dnf module info reviewboard:3.0 -v sudo dnf -y module install reviewboard:3.0 ``` -输出显示已安装 ReviewBoard 以及其他几个依赖软件包,其中包括 django:1.6 模块中的几个软件包。安装还启用了reviewboard:3.0 模块和相关的 django:1.6 模块。 +输出显示已安装 ReviewBoard 以及其他几个依赖软件包,其中包括 django:1.6 模块中的几个软件包。安装还启用了 reviewboard:3.0 模块和相关的 django:1.6 模块。 接下来,要查看已启用的模块,请使用以下命令: @@ -73,13 +75,13 @@ sudo dnf -y module install reviewboard:3.0 dnf module list --enabled ``` -输出中,[e] 表示已启用的流,[i] 表示已安装的配置。对于 reviewboard:3.0 模块,已安装默认配置。你可以在安装模块时指定其他配置。实际上,你仍然可以安装它,而且这次你不需要指定 3.0,因为它已经启用: +输出中,`[e]` 表示已启用的流,`[i]` 表示已安装的配置。对于 reviewboard:3.0 模块,已安装默认配置。你可以在安装模块时指定其他配置。实际上,你仍然可以安装它,而且这次你不需要指定 3.0,因为它已经启用: ``` sudo dnf -y module install reviewboard/server ``` -但是,安装 reviewboard:3.0/服务配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 - 因此无需安装。 +但是,安装 reviewboard:3.0/server 配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 —— 因此无需安装。 ### 启动 Review Board 网站 @@ -100,7 +102,7 @@ sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \ sudo systemctl enable --now httpd ``` -现在启动系统中的 Web 浏览器,打开 ,然后享受全新的 Review Board 网站!要以 Review Board 管理员身份登录,请使用上面 rb-site 命令中的用户 ID 和密码。 +现在启动系统中的 Web 浏览器,打开 ,然后享受全新的 Review Board 网站!要以 Review Board 管理员身份登录,请使用上面 `rb-site` 命令中的用户 ID 和密码。 ### 模块清理 @@ -118,12 +120,16 @@ sudo rm -rf /var/www/rev.local 在 [Fedora 模块化][7]网站上了解有关在 Fedora 28 中使用模块的更多信息。dnf 手册页中的 module 命令部分也包含了有用的信息。 -------------------------------------------------------------------------------- + via: https://fedoramagazine.org/working-modules-fedora-28/ + 作者:[Merlin Mathesius][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/) 荣誉推出 + [a]:https://fedoramagazine.org/author/merlinm/ [1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/ [2]:https://getfedora.org/server/ From 76afd18660be073d61b87c7d88c7e36062104ee7 Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Fri, 18 Jan 2019 23:04:06 +0800 Subject: [PATCH 0649/4278] 20180604 --- ...4 Firefox extensions worth checking out.md | 110 ------------------ ...4 Firefox extensions worth checking out.md | 109 +++++++++++++++++ 2 files changed, 109 insertions(+), 110 deletions(-) delete mode 100644 sources/tech/20180604 4 Firefox extensions worth checking out.md create mode 100644 translated/tech/20180604 4 Firefox extensions worth checking out.md diff --git a/sources/tech/20180604 4 Firefox extensions worth checking out.md b/sources/tech/20180604 4 Firefox extensions worth checking out.md deleted file mode 100644 index 2e6a22274b..0000000000 --- a/sources/tech/20180604 4 Firefox extensions worth checking out.md +++ /dev/null @@ -1,110 +0,0 @@ -translated by lixinyuxx -4 Firefox extensions worth checking out -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/firefox_blue_lead.jpg?itok=gYaubJUv) - -I've been a Firefox user since v2.0 came out about 12 years ago. There were times when it wasn't the best web browser out there, but still, I kept going back to it for one reason: My favorite extensions wouldn't work with anything else. - -Today, I like the current state of Firefox itself for being fast, customizable, and open source, but I also appreciate extensions for manifesting ideas the original developers never thought of: What if you want to browse without a mouse? What if you don't like staring at bright light coming out of the monitor at night? What about using a dedicated media player for YouTube and other video hosting websites for better performance and extended playback controls? And what if you need a more sophisticated way to disable trackers and speed up loading pages? - -Fortunately, there's an answer for each of these questions, and I'm going to give them to you in the form of my favorite extensions—all of which are free software or open source (i.e., distributed under the [GNU GPL][1], [MPL][2], or [Apache][3] license) and make an excellent browser even better. - -Although the terms add-on and extension have slightly different meanings, I'll use them interchangeably in this article. - -### Tridactyl - -![Tridactyl screenshot][5] - -Tridactyl's new tab page, showcasing link hinting. - -[Tridactyl][6] enables you to use your keyboard for most of your browsing activities. It's inspired by the now-defunct [Vimperator][7] and [Pentadactyl][8], which were inspired by the default keybindings of [Vim][9]. Since I'm already used to Vim and other command-line applications, I find features like being able to navigate with the keys `h/j/k/l`, interact with hyperlinks with `f/F`, and create custom keybindings and commands very convenient. - -Tridactyl's optional native messenger (for now, available only for GNU/Linux and Mac OSX), which was implemented recently, offers even more cool features to boot. With it, for example, you can hide some elements of the GUI of Firefox (à la Vimperator and Pentadactyl), open a link or the current page in an external program (I often use [mpv][10] and [youtube-dl][11] for videos) and edit the content of text areas with your favorite text editor by pressing `Ctrl-I` (or any key combination of your choice). - -Having said that, keep in mind that it's a relatively young project and may still be rough around the edges. On the other hand, its development is very active, and when you look past its childhood illnesses, it can be a pleasure to use. - -### Open With - -![Open With Screenshot][13] - -A context menu provided by Open With. I can open the current page with one of the external programs listed here. - -Speaking of interaction with external programs, sometimes it's nice to have the ability to do that with the mouse. That's where [Open With][14] comes in. - -Apart from the added context menu (shown in the screenshot), you can find your own defined commands by clicking on the extension's icon on the add-on bar. As its icon and the description on [its page on Mozilla Add-ons][14] suggest, it was primarily intended to work with other web browsers, but I can use it with mpv and youtube-dl with ease as well. - -Keyboard shortcuts are available here, too, but they're severely limited. There are no more than three different combinations that can be selected in a drop-down list in the extension's settings. In contrast, Tridactyl lets me assign commands to virtually anything that isn't blocked by Firefox. Open With is currently for the mouse, really. - -### Stylus - -![Stylus Screenshot][16] - -In this screenshot, I've just searched for and installed a dark theme for the site I'm currently on with Stylus. Even the popup has custom style (called Deepdark Stylus)! - -[Stylus][17] is a userstyle manager, which means that by writing custom CSS rules and loading them with Stylus, you can change the appearance of any webpage. If you don't know CSS, there are a plethora of userstyles made by others on websites such as [userstyles.org][18]. - -Now, you may be asking, "Isn't that exactly what [Stylish][19] does?" You would be correct! You see, Stylus is based on Stylish and provides additional improvements: It respects your privacy by not containing any telemetry, all development is done in the open (although Stylish is still actively developed, I haven't been able to find the source code for recent versions), and it supports [UserCSS][20], among other things. - -UserCSS is an interesting format, especially for developers. I've written several userstyles for various websites (mainly dark themes and tweaks for better readability), and while the internal editor of Stylus is excellent, I still prefer editing code with Neovim. For that, all I need to do is load a local file with its name ending with ".user.css" in Stylus, enable the option "Live Reload", and any changes will be applied as soon as I modify and save that file in Neovim. Remote UserCSS files are also supported, so whenever I push changes to GitHub or any git-based development platforms, they'll automatically become available for users. (I provide a link to the raw version of the file so that they can access it easily.) - -### uMatrix - -![uMatrix Screenshot][22] - -The user interface of uMatrix, showing the current rules for the currently visited webpage. - -Jeremy Garcia mentioned uBlock Origin in [his article][23] here on Opensource.com as an excellent blocker. I'd like to draw attention to another extension made by [gorhill][24]: uMatrix. - -[uMatrix][25] allows you to set blocking rules for certain requests on a webpage, which can be toggled by clicking on the add-on's popup (seen in the screenshot above). These requests are distinguished by the categories of scripts, requests made by scripts, cookies, CSS rules, images, media content, frames, and anything else labeled as "other" by uMatrix. You can set up global rules to, for instance, allow all requests by default and add only particular ones to the blacklist (the more convenient approach), or block everything by default and whitelist certain requests manually (the safer approach). If you've been using NoScript or RequestPolicy, you can [import][26] your whitelist rules from them, too. - -In addition, uMatrix supports [hosts files][27], which can be used to block requests from certain domains. These are not to be confused with the filter lists used by uBlock Origin, which use the same syntax as the filters set by Adblock Plus. By default, uMatrix blocks domains of servers known to distribute ads, trackers, and malware with the help of a few hosts files, and you can add more external sources if you want to. - -So which one shall you choose—uBlock Origin or uMatrix? Personally, I use both on my desktop PC and only uMatrix on my Android phone. There's some overlap between the two, [according to gorhill][28], but they have a different target userbase and goals. If all you want is an easy way to block trackers and ads, uBlock Origin is a better choice. On the other hand, if you want granular control over what a webpage can or can't do inside your browser, even if it takes some time to configure and it can prevent sites from functioning as intended, uMatrix is the way to go. - -### Conclusion - -Currently, these are my favorite extensions for Firefox. Tridactyl is for speeding up browsing navigation by relying on the keyboard and interacting with external programs; Open With is there if I need to open something in another program with the mouse; Stylus is the definitive userstyle manager, appealing to both users and developers alike; and uMatrix is essentially a firewall within Firefox for filtering out requests on unknown territories. - -Even though I almost exclusively discussed the benefits of these add-ons, no software is ever perfect. If you like any of them and think they can be improved in any way, I recommend that you go to their GitHub page and look for their contribution guides. Usually, developers of free and open source software welcome bug reports and pull requests. Telling your friends about them or saying thanks are also excellent ways to help the developers, especially if they work on their projects in their spare time. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/firefox-open-source-extensions - -作者:[Zsolt Szakács][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/zsolt -[1]:https://www.gnu.org/licenses/gpl-3.0.en.html -[2]:https://www.mozilla.org/en-US/MPL/ -[3]:https://www.apache.org/licenses/LICENSE-2.0 -[4]:/file/398411 -[5]:https://opensource.com/sites/default/files/uploads/tridactyl.png (Tridactyl's new tab page, showcasing link hinting) -[6]:https://addons.mozilla.org/en-US/firefox/addon/tridactyl-vim/ -[7]:https://github.com/vimperator/vimperator-labs -[8]:https://addons.mozilla.org/en-US/firefox/addon/pentadactyl/ -[9]:https://www.vim.org/ -[10]:https://mpv.io/ -[11]:https://rg3.github.io/youtube-dl/index.html -[12]:/file/398416 -[13]:https://opensource.com/sites/default/files/uploads/openwith.png (A context menu provided by Open With. I can open the current page with one of the external programs listed here.) -[14]:https://addons.mozilla.org/en-US/firefox/addon/open-with/ -[15]:/file/398421 -[16]:https://opensource.com/sites/default/files/uploads/stylus.png (In this screenshot, I've just searched for and installed a dark theme for the site I'm currently on with Stylus. Even the popup has custom style (called Deepdark Stylus)!) -[17]:https://addons.mozilla.org/en-US/firefox/addon/styl-us/ -[18]:https://userstyles.org/ -[19]:https://addons.mozilla.org/en-US/firefox/addon/stylish/ -[20]:https://github.com/openstyles/stylus/wiki/Usercss -[21]:/file/398426 -[22]:https://opensource.com/sites/default/files/uploads/umatrix.png (The user interface of uMatrix, showing the current rules for the currently visited webpage.) -[23]:https://opensource.com/article/18/5/firefox-extensions -[24]:https://addons.mozilla.org/en-US/firefox/user/gorhill/ -[25]:https://addons.mozilla.org/en-US/firefox/addon/umatrix -[26]:https://github.com/gorhill/uMatrix/wiki/FAQ -[27]:https://en.wikipedia.org/wiki/Hosts_(file) -[28]:https://github.com/gorhill/uMatrix/issues/32#issuecomment-61372436 diff --git a/translated/tech/20180604 4 Firefox extensions worth checking out.md b/translated/tech/20180604 4 Firefox extensions worth checking out.md new file mode 100644 index 0000000000..d434a01af7 --- /dev/null +++ b/translated/tech/20180604 4 Firefox extensions worth checking out.md @@ -0,0 +1,109 @@ +4个值得一提的 Firefox 拓展插件 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/firefox_blue_lead.jpg?itok=gYaubJUv) + +自从大约12年前 V2.0 推出以来, 我一直是 Firefox (火狐浏览器)的用户。那时它不是最好的网络浏览器,但我仍旧因为一个理由使用它:我最喜爱的无可比拟的浏览器拓展插件 + +如今, 我喜欢 Firefox 的当前状态,因为它快速、可定制和开源,但我也很欣赏扩展插件来体现原开发人员从未想到的特点: 如果您想在没有鼠标的情况下浏览呢?如果您不喜欢盯着晚上从显示器里出来的强光呢?对于 YouTube 和其他视频托管网站为了更好的性能和扩展使用一个更专业的播放器又如何呢?如果您需要更复杂的方法来禁用跟踪器和加快加载页面, 该怎么办? + +幸运的是, 这些问题都有答案, 我将展现给你我最喜爱的拓展--所有这些都是免费软件或开源的 (即, 在 [GNU GPL][1], [MPL][2],或 [Apache][3] 许可下) 并使一个优秀的浏览器更好。 + +尽管术语加载项和扩展具有微微不同的含义,,但我将在本文中交替使用它们。 + +### Tridactyl + +![Tridactyl screenshot][5] + +Tridactyl 的新选项卡页面,展示隐藏连接。 + +[Tridactyl][6] 使您能够在大多数浏览活动中使用键盘。它的灵感来自于现已解散的 [Vimperator][7] 和 [Pentadactyl][8] ,这是由 [Vim][9] 默认绑定值启发的。由于我已经习惯了 Vim 和其他命令行应用程序,我发现了一些功能,比如能够使用键值 `h/j/k/l` 进行导航,用 `f/F` 与超链接进行交互,并创建非常方便的自定义键绑定和命令。 + +Tridactyl 的可选本地信代理(目前,仅适用于GNU/Linux 和 Mac OSX), 最近才实现的,提供了更酷的功能来启动。例如, 有了它, 您可以隐藏 Firefox GUI 的一些元素(à la Vimperator 和 Pentadactyl),在外部程序中打开链接或当前页 (我经常用 [mpv][10] 和 [youtube-dl][11] 在视频上)通过按 `Ctrl-I` 用您喜爱的编辑器编辑文本内容(或者任意您选择的组合键)。 + +话虽如此, 但要记住,这是一个相对早期的项目,细节可能还是很粗糙。 另一方面,它的发展非常活跃, 当你回顾它早期的缺陷时, 使用它可能是一种乐趣。 + +### Open With + +![Open With Screenshot][13] + +Open With 提供的菜单。我可以在当前页面打开一个额外的列表。 + +说到与外部程序的互动,有时很高兴有能力用鼠标来做到这一点。这是 [Open With][14] 想法的来源. + +除了添加的上下文菜单 (如屏幕截图所示) 外,您还可以通过单击加载项栏上的扩展图标来找到自己定义的命令。 [its page on Mozilla Add-ons][14] 建议作为它的图标和描述,它主要是为了与其他 web 浏览器一起工作, 但我也可以轻松地使用它与 mpv 和 youtube-dl 。 + +这里也提供键盘快捷方式,但它们受到严重限制。可以在扩展设置的下拉列表中选择的组合不超过三种。相反, Tridactyl 允许我将命令分配给几乎任何没有被 Firefox 阻止的东西。打开与是目前为鼠标,真的。 + +### Stylus + +![Stylus Screenshot][16] + +在这个屏幕截图中, 我刚刚搜索并安装了一个黑暗的主题, 我正在上 Stylus 的网站。即使是弹出窗口也可以定制风格 (称为 Deepdark Stylus)! + +[Stylus][17] 是一个用户样式管理器,这意味着通过编写自定义 CSS 规则并将其加载到 Stylus 中,您可以更改任何网页的外观。如果你不知道 CSS ,有大量的风格在其他网站上,如 [userstyles.org][18] 。 + +现在,你可能会问,“这不正是什么 [Stylish][19] 么?” 你是对的!你看 Stylus 是基于 Stylish 并提供了更多的改进:它不包含任何遥测数据, 尊重您的隐私,所有开发都是公开的(尽管 Stylish 仍在积极开发, 我一直未能找到最新版本的源代码), 而且它还支持 [UserCSS][20]。 + +UserCSS 是一种有趣的格式,尤其是对于开发人员。我已经为不同的网站写了几种用户样式(主要是黑暗的主题和调整,以提高可读性),虽然 Stylus 的内部编辑器很好,我还是喜欢用 Neovim 编辑代码。为了做到这样我所需要做的就是用 ".user.css" 作为本地加载文件的后缀名,在 Stylus 里启动 "Live Reload" 选项,所有更改都会被应用只要我在 Neovim 中启保存和更改文件。远程 UserCSS 文件也支持,因此,每当我将更改推送到 Github 或任何基于 git 的开发平台时,它们将自动对用户可用。(我提供了指向该文件的原始版本的链接, 以便他们可以轻松地访问它。) + +### uMatrix + +![uMatrix Screenshot][22] + +uMatrix 的用户使用界面,显示当前访问过的网页的当前规则。 + +Jeremy Garcia 提到了 uBlock Origin 在 [his article][23] 在 Opensource.com 作为一个优秀的 blocker 。我想推荐另一个拓展插件作者是 [gorhill][24]: uMatrix 。 + +[uMatrix][25] 允许您为网页上的某些请求设置阻止规则,可以通过点击加载项的弹出窗口来切换(在上面的屏幕截图中可以看到)。 这些请求的区别在于脚本的类别、 scripts, cookies, CSS rules, images, media content, frames,和其他被 uMatrix 标记为 "other" 的 。 例如,您可以设置全局规则, 以便在默认情况下允许所有请求, 并将特定请求添加到黑名单中(更方便的方法),或在默认情况下阻止所有内容, 并手动将某些请求列入白名单 (更安全的方法)。如果您一直在使用NoScript 或 RequestPolicy,你可以 [import][26] 你的白名单规则。 + +另外 uMatrix 支持 [hosts files ][27],可用于阻止来自某些网站的请求。 不能与原始 uBlock 的筛选列表相比, 其使用的语法是 Adblock Plus 。默认情况下, uMatrix 会在几个文件的帮助下阻止已知分发广告、跟踪器和恶意软件的服务器, 如果需要, 您可以添加更多外部源。 + +那么你将选择哪一个-- uBlock Origin 或 uMatrix ?就个人而言,我在电脑上两个都用,只在安卓手机上用 uMatrix 。两者之间会有重叠的部分 [according to gorhill][28] ,但他们有不同的用户和目标群,如果你想要的只是阻止跟踪器和广告的简单方法, uBlock Origine 是更好的选择, 另一方面,如果您希望对网页在浏览器中可以执行或不能执行的操作进行精细的控制, 即使需要一些时间来进行配置, 并且可能会阻止网站按预期运行, uMatrix 是更好的选择。 + +### 结论 + +目前, 这些是 Firefox 里我最喜欢的扩展。Tridactyl 是依靠键盘和与外部程序交互, 加快浏览导航速度;Open With 能让我用鼠标点击程序操作, Stylus 是明确的用户风格的管理器, 对用户和开发人员都有吸引力; uMatrix 本质上是 Firefox 的防火墙用于过滤未知的请求。 + +尽管我几乎完全讨论了这些加载项的好处,但没有一个软件是完美的。如果你喜欢他们中的任何一个,并认为他们可以以任何方式改进, 我建议你去他们的 Github 页面,并寻找他们的贡献指南。通常情况下,免费和开源软件的开发人员欢迎错误报告和提交请求。告诉你的朋友或道谢也是帮助开发者的好方法, 特别是如果他们在业余时间从事他们的项目。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/6/firefox-open-source-extensions + +作者:[Zsolt Szakács][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[lixinyuxx](https://github.com/lixinyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/zsolt +[1]:https://www.gnu.org/licenses/gpl-3.0.en.html +[2]:https://www.mozilla.org/en-US/MPL/ +[3]:https://www.apache.org/licenses/LICENSE-2.0 +[4]:/file/398411 +[5]:https://opensource.com/sites/default/files/uploads/tridactyl.png "Tridactyl's new tab page, showcasing link hinting" +[6]:https://addons.mozilla.org/en-US/firefox/addon/tridactyl-vim/ +[7]:https://github.com/vimperator/vimperator-labs +[8]:https://addons.mozilla.org/en-US/firefox/addon/pentadactyl/ +[9]:https://www.vim.org/ +[10]:https://mpv.io/ +[11]:https://rg3.github.io/youtube-dl/index.html +[12]:/file/398416 +[13]:https://opensource.com/sites/default/files/uploads/openwith.png "A context menu provided by Open With. I can open the current page with one of the external programs listed here." +[14]:https://addons.mozilla.org/en-US/firefox/addon/open-with/ +[15]:/file/398421 +[16]:https://opensource.com/sites/default/files/uploads/stylus.png "In this screenshot, I've just searched for and installed a dark theme for the site I'm currently on with Stylus. Even the popup has custom style (called Deepdark Stylus)!" +[17]:https://addons.mozilla.org/en-US/firefox/addon/styl-us/ +[18]:https://userstyles.org/ +[19]:https://addons.mozilla.org/en-US/firefox/addon/stylish/ +[20]:https://github.com/openstyles/stylus/wiki/Usercss +[21]:/file/398426 +[22]:https://opensource.com/sites/default/files/uploads/umatrix.png "The user interface of uMatrix, showing the current rules for the currently visited webpage." +[23]:https://opensource.com/article/18/5/firefox-extensions +[24]:https://addons.mozilla.org/en-US/firefox/user/gorhill/ +[25]:https://addons.mozilla.org/en-US/firefox/addon/umatrix +[26]:https://github.com/gorhill/uMatrix/wiki/FAQ +[27]:https://en.wikipedia.org/wiki/Hosts_(file) +[28]:https://github.com/gorhill/uMatrix/issues/32#issuecomment-61372436 From 35831e35a82dbe783caf83e8fd7688d14bcd61bd Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 23:57:09 +0800 Subject: [PATCH 0650/4278] =?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=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180428 A Beginners Guide To Flatpak.md | 144 +++++++++--------- 1 file changed, 69 insertions(+), 75 deletions(-) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/sources/tech/20180428 A Beginners Guide To Flatpak.md index 8b3460c2dd..614f54cdf1 100644 --- a/sources/tech/20180428 A Beginners Guide To Flatpak.md +++ b/sources/tech/20180428 A Beginners Guide To Flatpak.md @@ -1,56 +1,53 @@ -Translating by wwhio - - -A Beginners Guide To Flatpak +Flatpak 新手指南 ====== ![](https://www.ostechnix.com/wp-content/uploads/2016/06/flatpak-720x340.jpg) -A while, we have written about [**Ubuntu’s Snaps**][1]. Snaps are introduced by Canonical for Ubuntu operating system, and later it was adopted by other Linux distributions such as Arch, Gentoo, and Fedora etc. A snap is a single binary package bundled with all required libraries and dependencies, and you can install it on any Linux distribution, regardless of its version and architecture. Similar to Snaps, there is also another tool called **Flatpak**. As you may already know, packaging distributed applications for different Linux distributions are quite time consuming and difficult process. Each distributed application has different set of libraries and dependencies for various Linux distributions. But, Flatpak, the new framework for desktop applications that completely reduces this burden. Now, you can build a single Flatpak app and install it on various operating systems. How cool, isn’t it? +不久前,我们介绍 Ubuntu 推出的 [**Snaps**][1]。Snaps 是由 Canonical 公司为 Ubuntu 开发的,并随后移植到其他的 Linux 发行版,如 Arch、Gentoo、Fedora 等等。由于一个 snap 包中含有软件的二进制文件和其所需的所有依赖和库,所以可以在无视软件版本、在任意 Linux 发行版上安装软件。和 Snaps 类似,还有一个名为 **Flatpak** 的工具。也许你已经知道,为不同的 Linux 发行版打包并分发应用时已经多么费时又复杂的工作,因为不同的 Linux 发行版的库不同,库的版本也不同。现在,Flatpak 作为分发桌面应用的新框架可以让开发者完全摆脱这些负担。开发者只需构建一个 Flatpak app 就可以在多种发行版上安装使用。这真是又酷又棒! -Also, the users don’t have to worry about the libraries and dependencies, everything is bundled within the app itself. Most importantly, Flaptpak apps are sandboxed and isolated from the rest of the host operating system, and other applications. Another notable feature is we can install multiple versions of the same application at the same time in the same system. For example, you can install VLC player version 2.1, 2.2, and 2.3 on the same system. So, the developers can test different versions of same application at a time. +用户也完全不用担心库和依赖的问题了,所有的东西都和 app 打包在了一起。更重要的是 Flatpak app 们都自带沙箱,而且与宿主操作系统的其他部分隔离。对了,Flatpak 还有一个很棒的特性,它允许用户在同一个系统中安装同一应用的多个版本,例如 VLC 播放器的 2.1 版、2.2 版、2.3 版。这使开发者测试同一个软件的多个版本变得更加方便。 -In this tutorial, we will see how to install Flatpak in GNU/Linux. +在本文中,我们将指导你如何在 GNU/Linux 中安装 Flatpak。 -### Install Flatpak +### 安装 Flatpak -Flatpak is available for many popular Linux distributions such as Arch Linux, Debian, Fedora, Gentoo, Red Hat, Linux Mint, openSUSE, Solus, Mageia and Ubuntu distributions. +Flatpak 可以在大多数的主流 Linux 发行版上安装使用,如 Arch Linux、Debian、Fedora、Gentoo、Red Hat、Linux Mint、openSUSE、Solus、Mageia 还有 Ubuntu。 -To install Flatpak on Arch Linux, run: +在 Arch Linux 上,使用这一条命令来安装 Flatpak: ``` $ sudo pacman -S flatpak ``` -Flatpak is available in the default repositories of Debian Stretch and newer. To install it, run: +对于 Debian 用户,Flatpak 被收录进 Stretch 或更新版本的默认软件源中。要安装 Flatpak,直接执行: ``` $ sudo apt install flatpak ``` -On Fedora, Flatpak is installed by default. All you have to do is enable enable Flathub as described in the next section. +对于 Fedora 用户,Flatpak 是发行版默认安装的软件。你可以直接跳过这一步。 -Just in case, it is not installed for any reason, run: +如果因为任何原因没有安装的话,可以执行: ``` $ sudo dnf install flatpak ``` -On RHEL 7, run: +对于 RHEL 7 用户,安装 Flatpak 的命令为: ``` $ sudo yum install flatpak ``` -On Linux Mint 18.3, flatpak is installed by default. So, no setup required. +如果你在使用 Linux Mint 18.3,那么 Flatpat 也随系统默认安装,所以跳过这一步。 -On openSUSE Tumbleweed, Flatpak can also be installed using Zypper: +在 openSUSE Tumbleweed 中,使用 Zypper 包管理来安装 Flatpak: ``` $ sudo zypper install flatpak ``` -On Ubuntu, add the following repository and install Flatpak as shown below. +而 Ubuntu 需要添加下面的软件源再安装 Flatpak,命令如下: ``` $ sudo add-apt-repository ppa:alexlarsson/flatpak @@ -60,39 +57,39 @@ $ sudo apt install flatpak ``` -The Flatpak plugin for the Software app makes it possible to install apps without needing the command line. To install this plugin, run: +Gnome 提供了一个 Flatpak 插件,安装它就可以使用图形界面来安装 Flatpak app 了。插件的安装命令为: ``` $ sudo apt install gnome-software-plugin-flatpak ``` -For other Linux distributions, refer the official installation [**link**][2]. +如果你是用发行版没有在上述的说明里,请你参考官方[**安装指南**][2]。 -### Getting Started With Flatpak +### 开始使用 Flatpak -There are many popular applications such as Gimp, Kdenlive, Steam, Spotify, Visual studio code etc., available as flatpaks. +有不少流行应用都支持 Flatpak 安装,如 Gimp、Kdenlive、Steam、Spotify、Visual Sudio Code 等。 -Let us now see the basic usage of flatpak command. +下面让我来一起学习 flatpak 的基本操作命令。 -First of all, we need to add remote repositories. +首先,我们需要添加远程仓库。 -#### Adding Remote Repositories** +#### 添加软件仓库 -**Enable Flathub Repository:** +**添加 Flathub 仓库:** -**Flathub** is nothing but a central repository where all flatpak applications available to users. To enable it, just run: +**Flathub** 是一个包含了几乎所有 flatpak 应用的仓库。运行这条命令来启用它: ``` $ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo ``` -Flathub is enough to install most popular apps. Just in case you wanted to try some GNOME apps, add the GNOME repository. +对于流行应用来说,Flathub 已经可以满足需求。如果你想试试 GNOME 应用的话,可以添加 GNOME 的仓库。 -**Enable GNOME Repository:** +**添加 GNOME 仓库:** -The GNOME repository contains all GNOME core applications. GNOME flatpak repository itself is available as two versions, **stable** and **nightly**. +GNOME 仓库包括了所有的 GNOME 核心应用,它提供了两种版本:**稳定版**stable**每日构建版**nightly。 -To add GNOME stable repository, run the following commands: +使用下面的命令来添加 GNOME 稳定版仓库: ``` $ wget https://sdk.gnome.org/keys/gnome-sdk.gpg @@ -100,15 +97,15 @@ $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg --if-not-exists gnome-apps ``` -Applications in this repository require the **3.20 version of the org.gnome.Platform runtime**. +需要注意的是,GNOME 稳定版仓库中的应用需要 **3.20 版本的 org.gnome.Platform 运行时环境**。 -To install the stable runtimes, run: +安装稳定版运行时环境,请执行: ``` $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/ ``` -To add the GNOME nightly apps repository, run: +如果想使用每日构建版的 GNOME 仓库,使用如下的命令: ``` $ wget https://sdk.gnome.org/nightly/keys/nightly.gpg @@ -116,17 +113,17 @@ $ sudo flatpak remote-add --gpg-import=nightly.gpg --if-not-exists gnome-nightly ``` -Applications in this repository require the **nightly version of the org.gnome.Platform runtime**. +同样,每日构建版的 GNOME 仓库也需要 **org.gnome.Platform 运行时环境的每日构建版本**。 -To install the nightly runtimes, run: +执行下面的命令安装每日构建版的运行时环境: ``` $ sudo flatpak remote-add --gpg-import=nightly.gpg gnome-nightly https://sdk.gnome.org/nightly/repo/ ``` -#### Listing Remotes +#### 查看软件仓库 -To list all configured remote repositories, run: +要查看已经添加的软件仓库,执行下面的命令: ``` $ flatpak remotes Name Options @@ -138,126 +135,126 @@ gnome-nightly-apps system ``` -As you can see, the above command lists the remotes that you have added in your system. It also lists whether the remote has been added per-user or system-wide. +如你所见,上述命令会列出你添加到系统中的软件仓库。此外,执行结果还表明了软件仓库的配置是用户级per-user还是系统级system-wide。 -#### Removing Remotes +#### 删除软件仓库 -To remove a remote, for example flathub, simply do; +要删除软件仓库,例如 flathub,用这条命令: ``` $ sudo flatpak remote-delete flathub ``` -Here **flathub** is remote name. +这里的 **flathub** 是软件仓库的名字。 -#### Installing Flatpak Applications +#### 安装 Flatpak 应用 -In this section, we will see how to install flatpak apps. To install a flatpak application +这一节,我们将学习如何安装 flatpak 应用。 -To install an application, simply do: +要安装一个应用,只要一条命令就能完成: ``` $ sudo flatpak install flathub com.spotify.Client ``` -All the apps in the GNOME stable repository uses the version name of “stable”. +所有的稳定版 GNOME 软件仓库中的应用,都使用“stable”作为版本名。 -To install any Stable GNOME applications, for example **Evince** , run: +例如,想从稳定版 GNOME 软件仓库中安装稳定版 **Evince**,就执行: ``` $ sudo flatpak install gnome-apps org.gnome.Evince stable ``` -All the apps in the GNOME nightly repository uses the version name of “master”. +所有的每日构建版 GNOME 仓库中的应用,都使用“master”作为版本名。 -For example, to install gedit, run: +例如,要从每日构建版 GNOME 软件仓库中安装 gedit 的每次构建版本,就执行: ``` $ sudo flatpak install gnome-nightly-apps org.gnome.gedit master ``` -If you don’t want to install apps system-wide, you also can install flatpak apps per-user like below. +如果不希望应用安装在系统级system-wide,而只安装在用户级per-user,那么你可以这样安装软件: ``` $ flatpak install --user ``` -All installed apps will be stored in **$HOME/.var/app/** location. +所有的应用都会被存储在 **$HOME/.var/app/** 目录下. ``` $ ls $HOME/.var/app/ com.spotify.Client ``` -#### Running Flatpak Applications +#### 执行 Flatpak 应用 -You can launch the installed applications at any time from the application launcher. From command line, you can run it, for example Spotify, using command: +你可以直接使用应用启动器application launcher来运行已安装的 Flatpak 应用。如果你想从命令行启动的话,以 Spotify 为例,执行下面的命令: ``` $ flatpak run com.spotify.Client ``` -#### Listing Applications +#### 列出已安装的 Flatpak 应用 -To view the installed applications and runtimes, run: +要查看已安装的应用程序和运行时环境,执行: ``` $ flatpak list ``` -To view only the applications, not run times, use this command instead. +想只查看已安装的应用,那就用这条命令: ``` $ flatpak list --app ``` -You can also view the list of available applications and runtimes from all remotes using command: +如果想查询已添加的软件仓库中的可安装程序和可安装的运行时环境,使用命令: ``` $ flatpak remote-ls ``` -To list only applications not runtimes, run: +只列出可安装的应用程序的命令是: ``` $ flatpak remote-ls --app ``` -To list applications and runtimes from a specific repository, for example **gnome-apps** , run: +查询指定远程仓库中的所有可安装的应用程序和运行时环境,这里以 **gnome-apps** 为例,执行命令: ``` $ flatpak remote-ls gnome-apps ``` -To list only the applications from a remote repository, run: +只列出可安装的应用程序,这里以 **flathub** 为例: ``` $ flatpak remote-ls flathub --app ``` -#### Updating Applications +#### 更新应用程序 -To update all your flatpak applications, run: +更新所有的 Flatpak 应用程序,执行: ``` $ flatpak update ``` -To update a specific application, we do: +更新指定的 Flatpak 应用程序,执行: ``` $ flatpak update com.spotify.Client ``` -#### Getting Details Of Applications +#### 获取应用详情 -To display the details of a installed application, run: +执行下面的命令来查看已安装应用程序的详细信息: ``` $ flatpak info io.github.mmstick.FontFinder ``` -Sample output: +输出样例: ``` Ref: app/io.github.mmstick.FontFinder/x86_64/stable ID: io.github.mmstick.FontFinder @@ -274,28 +271,25 @@ Runtime: org.gnome.Platform/x86_64/3.28 ``` -#### Removing Applications +#### 删除应用程序 -To remove a flatpak application, run: +要删除一个 Flatpak 应用程序,这里以 spotify 为例,执行: ``` $ sudo flatpak uninstall com.spotify.Client ``` -For details, refer flatpak help section. +如果你需要更多信息,可以参考 Flatpak 的帮助。 ``` $ flatpak --help ``` -And, that’s all for now. Hope you had basic idea about Flatpak. +到此,希望你对 Flatpak 有了一些基础了解。 -If you find this guide useful, please share it on your social, professional networks and support OSTechNix. - -More good stuffs to come. Stay tuned! - -Cheers! +如果你觉得这篇指南有些帮助,请在你的社交媒体上分享它来支持 OSTechNix。 +稍后还有更多精彩内容,尽情期待~ -------------------------------------------------------------------------------- @@ -304,7 +298,7 @@ via: https://www.ostechnix.com/flatpak-new-framework-desktop-applications-linux/ 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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 5e65cad61509045647caffde9971e431b470735b Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 23:59:34 +0800 Subject: [PATCH 0651/4278] =?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 --- .../tech/20180428 A Beginners Guide To Flatpak.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180428 A Beginners Guide To Flatpak.md (100%) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/translated/tech/20180428 A Beginners Guide To Flatpak.md similarity index 100% rename from sources/tech/20180428 A Beginners Guide To Flatpak.md rename to translated/tech/20180428 A Beginners Guide To Flatpak.md From f037e389ab723ecb3f589b4ed0bb523c1ba24c34 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 00:26:25 +0800 Subject: [PATCH 0652/4278] PRF:20180419 5 guiding principles you should know before you design a microservice.md @lixinyuxx --- ...d know before you design a microservice.md | 114 +++++++++--------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md b/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md index 6eee610d0b..2a8dd86f9f 100644 --- a/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md +++ b/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md @@ -1,130 +1,132 @@ -设计微服务架构前,您应该了解的5项指导原则 +设计微服务架构前应该了解的 5 项指导原则 ====== +> 顶级 CTO 基于五个简单的原则为精心设计的微服务提供建议。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_OpenInnovation.png?itok=l29msbql) -对于从微服务开始的团队来说,最大的挑战之一就是坚持金发姑娘原则(The *Goldilocks principle*):不要太大, 不要太小,不能太紧密耦合。之所以是挑战的原因是会对究竟什么是设计良好的微服务感到疑惑。 + +对于从微服务开始的团队来说,最大的挑战之一就是坚持金发女孩原则The Goldilocks principle(该典故来自于童话《金发姑娘和三只熊》):不要太大,不要太小,不能太紧密耦合。之所以是挑战的部分原因是会对究竟什么是设计良好的微服务感到疑惑。 -数十家 CTOs 通过采访分享了他们的经验, 这些对话说明了设计良好的微服务的五个特点。本文将帮助指导团队设计微服务。(有关详细信息, 请查看即将出版的书籍 [Microservices for Startups][1])。本文将简要介绍微服务的边界和主观的 ”规则“,以避免在深入了解五个特征之前就开始指导您的微服务设计。 +数十位 CTO 通过采访分享了他们的经验,这些对话说明了设计良好的微服务的五个特点。本文将帮助指导团队设计微服务。(有关详细信息,请查看即将出版的书籍 [Microservices for Startups][1],LCTT 译注:已可免费下载完整的电子版)。本文将简要介绍微服务的边界和主观的 “规则”,以避免在深入了解五个特征之前就开始指导您的微服务设计。 ### 微服务边界 - [core benefits of developing new systems with microservices][2] (开发具有微服务的新系统的核心优势)其中之一是该体系结构允许开发人员独立构建和修改单个组件, 但在最大限度地减少每个 API 之间的回调数量方面可能会出现问题。 根据 Chris McFadden 的解决方法,[SparkPost ][3] 的工程副总裁,应用适当的服务边界去解决问题。 +[使用微服务开发新系统的核心优势][2]之一是该体系结构允许开发人员独立构建和修改各个组件,但在最大限度地减少每个 API 之间的回调数量方面可能会出现问题。根据 [SparkPost][3] 工程副总裁 Chris McFadden 所说,解决方案是应用适当的服务边界。 -关于边界, 与 domain-driven design (DDD)—a framework for microservices (域驱动设计--微服务框架)有时难以理解和抽象的概念形成鲜明对比,本文重点介绍了与我们行业的一些顶级 CTOs 建立明确定义的微服务边界的实用原则。 +关于边界,与有时难以理解和抽象的领域驱动设计(DDD,一种微服务框架)形成鲜明对比,本文重点介绍了和我们行业的一些顶级 CTO 一同建立的明确定义的微服务边界的实用原则。 -### 避免主观的 ”规则“ +### 避免主观的 “规则” -如果您阅读了足够多的关于设计和创建微服务的建议,您一定会遇到下面的一些 ”规则“。 尽管将它们用作创建微服务的指南很有吸引力, 但加入这些主观规则并不是思考确定微服务的边界的原则性方式。 +如果您阅读了足够多的关于设计和创建微服务的建议,您一定会遇到下面的一些 “规则”。 尽管将它们用作创建微服务的指南很有吸引力,但加入这些主观规则并不是思考确定微服务的边界的原则性方式。 -#### ”微服务应该有 X 行代码“ +#### “微服务应该有 X 行代码” -让我们直说:微服务中有多少行代码没有限制。微服务不会因为您写了几行额外的代码而突然变成一个巨无霸。关键是要确保服务中的代码具有很高的内聚性 (稍后将对此进行更多介绍)。 +让我们直说:微服务中有多少行代码没有限制。微服务不会因为您写了几行额外的代码而突然变成一个独石应用。关键是要确保服务中的代码具有很高的内聚性(稍后将对此进行更多介绍)。 #### “将每个功能转换为微服务” -如果函数基于三个输入值计算某些内容并返回结果,它是否是微服务的理想候选项?它是否应该是单独可部署应用程序?这确实取决于函数是什么以及它是如何服务于整个系统。将每个函数转换为微服务在您的内容中可能根本没有意义。 +如果函数基于三个输入值计算某些内容并返回结果,它是否是微服务的理想候选项?它是否应该是单独可部署应用程序?这确实取决于该函数是什么以及它是如何服务于整个系统。将每个函数转换为微服务在您的情景中可能根本没有意义。 -其他主观规则包括不考虑整个内容的规则, 例如团队的经验、 DevOps (Development和Operations的组合词)容量、服务正在执行的操作以及数据的可用性需求。 +其他主观规则包括不考虑整个情景的规则,例如团队的经验、DevOps 能力、服务正在执行的操作以及数据的可用性需求。 -### 精心设计的服务的5个特点 +### 精心设计的服务的 5 个特点 -如果您读过关于微服务的文章, 您无疑会遇到关于什么是设计良好的服务的建议。简单地说, 高内聚和低耦合。如果您不熟悉这些概念, 有许多文章需要查看 [many][4] [articles][5] 。虽然他们提供了合理的建议,但这些概念是相当抽象的。下面, 基于与经验丰富的 CTOs 的对话, 在创建设计良好的微服务时需要牢记的关键特征。 +如果您读过关于微服务的文章,您无疑会遇到有关设计良好的服务的建议。简单地说,高内聚和低耦合。如果您不熟悉这些概念,有[许多][4][文章][4]关于这些概念的文章。虽然它们提供了合理的建议,但这些概念是相当抽象的。基于与经验丰富的 CTO 们的对话,下面是在创建设计良好的微服务时需要牢记的关键特征。 -#### #1: 不与其他服务共享数据库表 +#### #1:不与其他服务共享数据库表 -在 SparkPost 的早期, Chris McFadden 和他的团队必须解决一个问题,,每个 SaaS 生意(Software-as-a-Service,软件即服务)都要面对的:他们需要提供基本服务,如身份验证、帐户管理和计费。 +在 SparkPost 的早期,Chris McFadden 和他的团队必须解决每个 SaaS 业务需要面对的问题:它们需要提供基本服务,如身份验证、帐户管理和计费。 -为了解决这个问题,他们创建了两个微服务:用户 API 和帐户 API。用户 API 将处理用户帐户、API 密钥和身份验证,而帐户 API 将处理所有与计费相关的逻辑。一个非常符合逻辑的分离--但没过多久,他们发现了一个问题。 +为了解决这个问题,他们创建了两个微服务:用户 API 和帐户 API。用户 API 将处理用户帐户、API 密钥和身份验证,而帐户 API 将处理所有与计费相关的逻辑。这是一个非常合乎逻辑的分离 —— 但没过多久,他们发现了一个问题。 -McFadden 解释说,“我们有一个名为 ”用户 API “的服务,还有一个名为”帐户 API “的服务。问题是,他们之间实际上有几个来回的电话。因此, 您会在帐户中执行一些操作,并在用户中具有调用和终结点,反之亦然” +McFadden 解释说,“我们有一个名为‘用户 API’的服务,还有一个名为‘帐户 API’的服务。问题是,他们之间实际上有几个来回的调用。因此,您会在帐户服务中执行一些操作,然后调用并终止于用户服务,反之亦然” 这两个服务的耦合太紧密了。 -在设计微服务时, 如果您有多个服务引用同一个表, 则它是一个危险的信号,因为这可能意味着您的数据库是耦合的源头。 +在设计微服务时,如果您有多个服务引用同一个表,则它是一个危险的信号,因为这可能意味着您的数据库是耦合的源头。 -这确实是关于服务与数据的关系, 这正是Oleksiy Kovrin,[Swiftype SRE, Elastic][6] 的领导者, 告诉我。“我们在开发新服务时使用的主要基本原则之一是, 它们不应跨越数据库边界。每个服务都应依赖于自己的一组基础数据存储。这使我们能够集中访问控制、审计日志记录、缓存逻辑等。” +这确实是关于服务与数据的关系,这正是 [Swiftype SRE,Elastic][6] 的负责人 Oleksiy Kovrin 告诉我。他说,“我们在开发新服务时使用的主要基本原则之一是,它们不应跨越数据库边界。每个服务都应依赖于自己的一组底层数据存储。这使我们能够集中访问控制、审计日志记录、缓存逻辑等。” -Kovrin 接着解释说,如果数据库表的子集 “与数据集的其余部分没有或很少连接,则这是一个强烈的信号, 表明组件可以被隔离到单独的 API 或单独的服务中”。 +Kovrin 接着解释说,如果数据库表的某个子集“与数据集的其余部分没有或很少连接,则这是一个强烈的信号,表明该组件可以被隔离到单独的 API 或单独的服务中”。 -Darby Frey , [Lead Honestly][7] 的联合创始人,与此的观点相呼应:”每个服务都应该有自己的表 [并且] 永远不应该共享数据库表。“ +[Lead Honestly][7] 的联合创始人 Darby Frey 与此的观点相呼应:“每个服务都应该有自己的表并且永远不应该共享数据库表。” -#### #2: 数据库表数量最小化 +#### #2:数据库表数量最小化 -微服务的理想尺寸足够小,但不会更小。每个服务的数据库表的数量也是如此。 +微服务的理想尺寸应该足够小,但不能太小。每个服务的数据库表的数量也是如此。 -Steven Czerwinski,[Scaylr][8] 的工程主管, 在接受采访时解释说 Scaylr 的最佳选择是 ”一个或两个服务的数据库表“。 +[Scaylr][8] 的工程主管 Steven Czerwinski 在接受采访时解释说 Scaylr 的最佳选择是“一个或两个服务的数据库表。” -SparkPost's Chris McFadden 同意:”我们有一个(suppression)限制微服务,它处理, 跟踪, 数以百万计和数十亿的条目周围的限制,但它都非常集中只是围绕限制,所以实际上只有一个或两个表。其他服务也是如此,比如 *webhooks* 。 +SparkPost 的 Chris McFadden 表示同意:“我们有一个 suppression 微服务,它处理、跟踪数以百万计和数十亿围绕 suppression 的条目,但它们都非常专注于围绕 suppression,所以实际上只有一个或两个表。其他服务也是如此,比如 webhooks。 -#### #3: 考虑有状态和无状态 +#### #3:考虑有状态和无状态 -在设计微服务时,您需要问问自己它是否需要访问数据库,或者它是否会是处理 TB 级数据 (如电子邮件或日志) 的无状态服务。 +在设计微服务时,您需要问问自己它是否需要访问数据库,或者它是否是处理 TB 级数据 (如电子邮件或日志) 的无状态服务。 -Julien Lemoine, [Algolia][9] 的 CTO,解释说::“我们通过定义服务的输入和输出来定义服务的边界。有时服务是网络 API ,但它也可能是在数据库中使用文件和生成记录的进程 (这就是我们的日志处理服务)。 +[Algolia][9] 的 CTO Julien Lemoine 解释说:“我们通过定义服务的输入和输出来定义服务的边界。有时服务是网络 API,但它也可能是使用文件并在数据库中生成记录的进程 (这就是我们的日志处理服务)。” -事先要清楚状态,这将引导一个更好的服务设计。 +事先要明确是否有状态,这将引导一个更好的服务设计。 -#### #4: 考虑数据可用性需求 +#### #4:考虑数据可用性需求 -在设计微服务时,请记住哪些服务将依赖于此新服务, 以及在该数据不可用时的全系统影响。考虑到这一点,您可以正确地设计此服务的数据备份和恢复系统。 +在设计微服务时,请记住哪些服务将依赖于此新服务,以及在该数据不可用时的整个系统的影响。考虑到这一点,您可以正确地设计此服务的数据备份和恢复系统。 -Steven Czerwinski 在 Scaylr 提到,由于关键客户行空间映射数据的重要性,它将以不同的方式复制和分离。 +Steven Czerwinski 提到,在 Scaylr 由于关键客户行空间映射数据的重要性,它将以不同的方式复制和分离。 -他补充说,”每个分片信息,在自己的小分区里。如果因为这部分客户群体不会有他们的可用日志而下降,那很糟糕,但它只影响5% 的客户,而不是100% 的客户。 +相比之下,他补充说,“每个分片信息,都在自己的小分区里。如果部分客户群体因为没有可用日志而停止服务那很糟糕,但它只影响 5% 的客户,而不是100% 的客户。” -#### #5: 真理的唯一来源 +#### #5:单一的真实来源 -设计服务,使其成为系统中某些内容的唯一实际来源 +设计服务,使其成为系统中某些内容的唯一真实来源。 -例如,当您从电子商务网站订购内容时, 则会生成订单 ID ,其他服务可以使用此订单 ID 来查询订单服务,以获取有关订单的完整信息。使用 [publish/subscribe pattern][10] ,在服务之间传递的数据应该是订单 ID , 而不是订单本身的属性信息。只有订单服务具有完整的信息,并且是给定订单的唯一实际来源。 +例如,当您从电子商务网站订购内容时,则会生成订单 ID,其他服务可以使用此订单 ID 来查询订单服务,以获取有关订单的完整信息。使用 [发布/订阅模式][10],在服务之间传递的数据应该是订单 ID ,而不是订单本身的属性信息。只有订单服务具有订单的完整信息,并且是给定订单信息的唯一真实来源。 ### 大型团队的注意事项 考虑到上面列出的五个注意事项,较大的团队应了解其组织结构对微服务边界的影响。 -对于大型组织,整个团队可以专门拥有服务,在确定服务边界时, 有组织性的考虑因素就会发挥作用。还有两个需要考虑的因素: **独立的发布计划**和**不同的正常运行时间**的重要性。 +对于较大的组织,整个团队可以专门拥有服务,在确定服务边界时,组织性就会发挥作用。还有两个需要考虑的因素:**独立的发布计划**和**不同的正常运行时间**的重要性。 -Khash Sajadi , [Cloud66.][11] 的 CEO 说:”我们所看到的微服务最成功的实现要么基于软件设计原则 (例如域驱动设计和面向服务的体系结构), 要么基于反映组织方法的设计原则“ +[Cloud66.][11] 的 CEO Khash Sajadi 说:“我们所看到的微服务最成功的实现要么基于类似领域驱动设计这样的软件设计原则 (如面向服务的体系结构),要么基于反映组织方法的设计原则。” -”所以 (对于) 支付团队“ Sajadi 继续说,,”他们有支付服务或信用卡验证服务, 这就是他们向外界提供的服务。所以这不一定是关于软件的。这主要是关于为外界提供更多服务的业务单位 “ +“所以 (对于) 支付团队” Sajadi 说,“他们有支付服务或信用卡验证服务,这就是他们向外界提供的服务。所以这不一定是关于软件的。这主要是关于为外界提供更多服务的业务单位。” ### 双披萨原理 -Amazon 是一个拥有多个团队的大型组织的完美示例。正如在一篇文章中所提到的, [API Evangelist][12] ,Jeff Bezos向所有员工发出授权,告知他们公司内的每个团队都必须通过 API 进行沟通。任何没有被解雇的人都会被解雇。 +Amazon 是一个拥有多个团队的大型组织的完美示例。正如在一篇发表于 [API Evangelist][12] 的文章中所提到的,Jeff Bezos 向所有员工发布一项要求,告知他们公司内的每个团队都必须通过 API 进行沟通。任何不这样做的人都会被解雇。 -这样,所有数据和功能都通过接口公开。Bezos 还设法让每个团队分离,定义他们的资源是什么, 并通过 API 使它们可用。亚马逊正在从地面上建立一个系统。这使得公司内的每一支团队都能成为彼此的合作伙伴。 +这样,所有数据和功能都通过该接口公开。Bezos 还设法让每个团队解耦,定义他们的资源,并通过 API 提供。Amazon 正在从头建立一个系统。这使得公司内的每一支团队都能成为彼此的合作伙伴。 -Travis Reeder , [Iron.io][13] 的CTO,谈论关于 Bezos 的内部提议。 +我与 [Iron.io][13] 的 CTO Travis Reeder 谈到了 Bezos 的内部倡议。 -”Jeff Bezos 规定所有团队都必须构建 API 才能与其他团队进行沟通,“ Reeder 说。”他也是提出‘双披萨’规则的人:一支球队不应该比两个比萨饼能养活的大。 +“Jeff Bezos 规定所有团队都必须构建 API 才能与其他团队进行沟通,” Reeder 说。“他也是提出‘双披萨’规则的人:一支团队不应该比两个比萨饼能养活的大。” -“我认为这里也可以适用同样的方法:无论一个小型团队是否能够开发、管理和富有成效。如果它开始变得笨重或开始后退。可能会变得太大” Reeder 告诉我。 +“我认为这里也可以适用同样的方法:无论一个小型团队是否能够开发、管理和富有成效。如果它开始变得笨重或开始变慢,它可能变得太大了。” Reeder 告诉我。 -### 最后注意事项: 您的服务是否具有正确的大小和正确定义? +### 最后注意事项: 您的服务是否具有合适的大小和正确的定义? 在微服务系统的测试和实施阶段,有一些指标需要记住。 #### 指标 #1: 服务之间是否存在过度依赖? -如果两个服务不断地相互回调,那么这就是耦合的强烈信号,也是它们可能更好地合并为一个服务的信号。 +如果两个服务不断地相互回调,那么这就是强烈的耦合信号,也是它们可能更好地合并为一个服务的信号。 -回到 Chris McFadden 的例子, 他有两个 API 服务、帐户和用户不断地相互通信, McFadden 提出了一个合并服务的想法, 并决定将其称为 “原告 API”。事实证明, 这是一项富有成效的战略。”我们开始做的是消除这些链接 [这是] 内部 API 调用投注他们之间“ McFadden 告诉我。这有助于简化代码。 +回到 Chris McFadden 的例子, 他有两个 API 服务,帐户服务和用户服务不断地相互通信, McFadden 提出了一个合并服务的想法,并决定将其称为 “账户用户 API”。事实证明,这是一项富有成效的战略。 + +“我们开始做的是消除这些内部 API 之间调用的链接,” McFadden 告诉我。“这有助于简化代码。” #### 指标 #2: 设置服务的开销是否超过了服务独立的好处? -Darby Frey 解释说,“每个应用都需要将其日志聚合到某个位置,并需要进行监视。你需要设置它的警报。你需要有标准的作业程序,并在事情发生时运行书籍。您必须管理 SSH 对该事物的访问。为了让一个应用单纯运行, 必须存在一个巨大的基础。 +Darby Frey 解释说,“每个应用都需要将其日志聚合到某个位置,并需要进行监视。你需要设置它的警报。你需要有标准的操作程序,和在出现问题时的操作手册。您必须管理 SSH 对它的访问。只是为了让一个应用运行起来,就有大量的基础性工作必须存在。” + +### 关键要点 -### 主要外包 - -设计微服务往往会让人感觉更像是一门艺术, 而不是一门科学。对工程师来说, 这可能不是很好。外面有很多一般性的建议, 但有时可能有点太抽象了。让我们回顾一下在设计下一组微服务时要注意的五个具体特征: +设计微服务往往会让人感觉更像是一门艺术,而不是一门科学。对工程师来说,这可能并不顺利。有很多一般性的建议,但有时可能有点太抽象了。让我们回顾一下在设计下一组微服务时要注意的五个具体特征: 1. 不与其他服务共享数据库表 - 2. 数据库表数量最小化 + 2. 数据库表数量最小化 3. 考虑有状态和无状态 4. 考虑数据可用性需求 - 5. 真理的唯一来源 - - + 5. 单一的真实来源 下次设计一组微服务并确定服务边界时,回顾这些原则应该会使任务变得更容易。 @@ -135,7 +137,7 @@ via: https://opensource.com/article/18/4/guide-design-microservices 作者:[Jake Lumetta][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 52c786553a88c1876f0efe6361d2959acd450a0c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 00:26:58 +0800 Subject: [PATCH 0653/4278] PUB:20180419 5 guiding principles you should know before you design a microservice.md @lixinyuxx https://linux.cn/article-10455-1.html --- ...principles you should know before you design a microservice.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180419 5 guiding principles you should know before you design a microservice.md (100%) diff --git a/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md b/published/20180419 5 guiding principles you should know before you design a microservice.md similarity index 100% rename from translated/talk/20180419 5 guiding principles you should know before you design a microservice.md rename to published/20180419 5 guiding principles you should know before you design a microservice.md From b17802748ca0a2cd829847a66950e4af33b1e914 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 11:02:11 +0800 Subject: [PATCH 0654/4278] PRF:20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @jlztan --- ...ing You Need to Know About PPA in Linux.md | 85 ++++++++++--------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md index b83c9f5720..6dc7b7c296 100644 --- a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md +++ b/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @@ -1,17 +1,18 @@ -[#]: collector: "lujun9972" -[#]: translator: "jlztan" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "What is PPA? Everything You Need to Know About PPA in Linux" -[#]: via: "https://itsfoss.com/ppa-guide/" -[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" +[#]: collector: (lujun9972) +[#]: translator: (jlztan) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is PPA? Everything You Need to Know About PPA in Linux) +[#]: via: (https://itsfoss.com/ppa-guide/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -# 什么是 PPA?你需要知道的关于 Linux 中 PPA 的一切 +Ubuntu PPA 使用指南 +====== -**简介:一篇涵盖了在 Ubuntu 和其他 Linux 发行版中使用 PPA 的几乎所有问题的深入的文章。** +> 一篇涵盖了在 Ubuntu 和其他 Linux 发行版中使用 PPA 的几乎所有问题的深入的文章。 -如果你一直在使用 Ubuntu 或基于 Ubuntu 的其他 Linux 发行版,例如 Linux Mint、Linux Lite、Zorin OS 等,你可能会遇到以下三行神奇的命令: +如果你一直在使用 Ubuntu 或基于 Ubuntu 的其他 Linux 发行版,例如 Linux Mint、Linux Lite、Zorin OS 等,你可能会遇到以下三种神奇的命令: ``` sudo add-apt-repository ppa:dr-akulavich/lighttable @@ -21,17 +22,17 @@ sudo apt-get install lighttable-installer 许多网站推荐使用类似于以上几行的形式 [在 Ubuntu 中安装应用程序][1]。这就是所谓的使用 PPA 安装应用程序。 -但什么是 PPA?为什么用它?使用 PPA 安全吗?如何正确使用 PPA?如何删除 PPA? +但什么是 PPA?为什么要用它?使用 PPA 安全吗?如何正确使用 PPA?如何删除 PPA? 我将在这个详细的指南中回答上述所有问题。即使你已经了解了一些关于 PPA 的事情,我相信这篇文章仍然会让你了解这方面的更多知识。 -请注意我正在使用 Ubuntu 撰写本文。因此,我几乎可以在任何地方使用 Ubuntu 这个术语,但文中的说明和步骤也适用于其他基于 Debian/Ubuntu 的发行版。 +请注意我正在使用 Ubuntu 撰写本文。因此,我几乎在各个地方都使用了 Ubuntu 这个术语,但文中的说明和步骤也适用于其他基于 Debian/Ubuntu 的发行版。 ### 什么是 PPA?为什么要使用 PPA? ![Everything you need to know about PPA in Ubuntu Linux][2] -PPA 表示 个人软件包存档Personal Package Archive个人软件包存档Personal Package Archive。 +PPA 表示个人软件包存档Personal Package Archive。 这样说容易理解吗?可能不是很容易。 @@ -41,12 +42,12 @@ PPA 表示 个人软件包存档Personal Package Archive个人软件包存 软件仓库是一组文件,其中包含各种软件及其版本的信息,以及校验和等其他一些详细信息。每个版本的 Ubuntu 都有自己的四个官方软件仓库: -- Main - Canonical 支持的免费和开源软件。 -- Universe - 社区维护的免费和开源软件。 +- Main - Canonical 支持的自由开源软件。 +- Universe - 社区维护的自由开源软件。 - Restricted - 设备的专有驱动程序。 - Multiverse - 受版权或法律问题限制的软件。 -你可以在 [这里][3] 看到所有版本的 Ubuntu 的软件仓库。你可以浏览并转到各个仓库。例如,可以在 [这里][4] 找到 Ubuntu 16.04 的主存储库。 +你可以在 [这里][3] 看到所有版本的 Ubuntu 的软件仓库。你可以浏览并转到各个仓库。例如,可以在 [这里][4] 找到 Ubuntu 16.04 的主存储库(Main)。 所以,PPA 基本上是一个包含软件信息的网址。那你的系统又是如何知道这些仓库的位置的呢? @@ -80,19 +81,21 @@ Ubuntu 不会立即提供该新版本的软件。需要一个步骤来检查此 ### 如何使用 PPA?PPA 是怎样工作的? -正如我已经告诉过你的那样,[PPA][7] 代表个人软件包存档Personal Package Archive个人软件包存档Personal Package Archive。在这里注意 “个人” 这个词,它暗示了这是开发人员独有的东西,并没有得到分发的正式许可。 +正如我已经告诉过你的那样,[PPA][7] 代表个人软件包存档Personal Package Archive。在这里注意 “个人” 这个词,它暗示了这是开发人员独有的东西,并没有得到分发的正式许可。 -Ubuntu 提供了一个名为 Launchpad 的平台,使软件开发人员能够创建自己的软件仓库。 终端用户,也就是你,可以将 PPA 仓库添加到 `sources.list` 文件中,当你更新系统时,你的系统会知道这个新软件的可用性,然后你可以使用标准的 `sudo apt install` 命令安装它。 +Ubuntu 提供了一个名为 Launchpad 的平台,使软件开发人员能够创建自己的软件仓库。终端用户,也就是你,可以将 PPA 仓库添加到 `sources.list` 文件中,当你更新系统时,你的系统会知道这个新软件的可用性,然后你可以使用标准的 `sudo apt install` 命令安装它。 -`sudo add-apt-repository ppa:dr-akulavich/lighttable` -`sudo apt-get update` -`sudo apt-get install lighttable-installer` +``` +sudo add-apt-repository ppa:dr-akulavich/lighttable +sudo apt-get update +sudo apt-get install lighttable-installer +``` 概括一下上面三个命令: -- `sudo add-apt-repository ` < - 此命令将 PPA 仓库添加到列表中。 -- `sudo apt-get update` < - 此命令更新可以在当前系统上安装的软件包列表。 -- `sudo apt-get install ` < - 此命令安装软件包。 +- `sudo add-apt-repository ` <- 此命令将 PPA 仓库添加到列表中。 +- `sudo apt-get update` <- 此命令更新可以在当前系统上安装的软件包列表。 +- `sudo apt-get install ` <- 此命令安装软件包。 你会发现使用 `sudo apt update` 命令非常重要,否则你的系统将无法知道新软件包何时可用。 @@ -115,17 +118,17 @@ deb-src http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERS 以上两行是将任何软件仓库添加到你系统的 `sources.list` 文件的传统方法。但 PPA 会自动为你完成这些工作,无需考虑确切的软件仓库 URL 和操作系统版本。 -此处不那么重要的一点是,当你使用 PPA 时,它不会更改原始的 `sources.list` 文件。相反,它在 `/etc/apt/sources.d` 目录中创建了两个文件,一个 “list” 文件和一个带有 “save” 后缀的备份文件。 +此处不那么重要的一点是,当你使用 PPA 时,它不会更改原始的 `sources.list` 文件。相反,它在 `/etc/apt/sources.d` 目录中创建了两个文件,一个 `.list` 文件和一个带有 `.save` 后缀的备份文件。 ![Using a PPA in Ubuntu][8] -PPA 创建了单独的 `sources.list` 文件 +*PPA 创建了单独的 `sources.list` 文件* -带有后缀 “list” 的文件含有添加软件仓库的信息的命令。 +带有后缀 `.list` 的文件含有添加软件仓库的信息的命令。 ![PPA add repository information][9] -一个 PPA 的 `source.list` 文件的内容 +*一个 PPA 的 `source.list` 文件的内容* 这是一种安全措施,可以确保添加的 PPA 不会和原始的 `sources.list` 文件弄混,它还有助于移除 PPA。 @@ -135,11 +138,11 @@ PPA 创建了单独的 `sources.list` 文件 答案在于更新的过程。如果使用 DEB 包安装软件,将无法保证在运行 `sudo apt update` 和 `sudo apt upgrade` 命令时,已安装的软件会被更新为较新的版本。 -这是因为 apt 的升级过程依赖于 `sources.list` 文件。如果文件中没有相应的软件条目,则不会通过标准软件更新程序获得更新。 +这是因为 `apt` 的升级过程依赖于 `sources.list` 文件。如果文件中没有相应的软件条目,则不会通过标准软件更新程序获得更新。 那么这是否意味着使用 DEB 安装的软件永远不会得到更新?不是的。这取决于 DEB 包的创建方式。 -一些开发人员会自动在 `sources.list ` 中添加一个条目,这样软件就可以像普通软件一样更新。谷歌 Chrome 浏览器就是这样一个例子。 +一些开发人员会自动在 `sources.list` 中添加一个条目,这样软件就可以像普通软件一样更新。谷歌 Chrome 浏览器就是这样一个例子。 某些软件会在运行时通知你有新版本可用。你必须下载新的 DEB 包并再次运行,来将当前软件更新为较新版本。Oracle Virtual Box 就是这样一个例子。 @@ -163,11 +166,11 @@ PPA 创建了单独的 `sources.list` 文件 并非每个 PPA 都适用于你的特定版本。你应该知道正在使用 [哪个版本的 Ubuntu][11]。版本的开发代号很重要,因为当你访问某个 PPA 的页面时,你可以看到该 PPA 都支持哪些版本的 Ubuntu。 -对于其他基于 Ubuntu 的发行版,你可以查看 `/etc/os-release` 的内容来 [找出 Ubuntu 版本][11] 的信息。 +对于其他基于 Ubuntu 的发行版,你可以查看 `/etc/os-release` 的内容来 [找出 Ubuntu 版本][11] 的信息。 ![Verify PPA availability for Ubuntu version][12] -检查 PPA 是否适用于你的 Ubuntu 版本 +*检查 PPA 是否适用于你的 Ubuntu 版本* 如何知道 PPA 的网址呢?只需在网上搜索 PPA 的名称,如 `ppa:dr-akulavich/lighttable`,第一个搜索结果来自 [Launchpad][13],这是托管 PPA 的官方平台。你也可以转到 Launchpad 并直接在那里搜索所需的 PPA。 @@ -188,9 +191,9 @@ W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main E: Some index files failed to download. They have been ignored, or old ones used instead. ``` -上面的错误提示说的很明白,是因为系统找不到当前版本对应的仓库。还记得我们之前看到的仓库结构吗?APT 将尝试在 /ubuntu/dists/Ubuntu_Version 中寻找软件信息。 +上面的错误提示说的很明白,是因为系统找不到当前版本对应的仓库。还记得我们之前看到的仓库结构吗?APT 将尝试在 `http://ppa.launchpad.net//ubuntu/dists/` 中寻找软件信息。 -如果特定版本的 PPA 不可用,它将永远无法打开 URL,你会看到著名的404错误。 +如果特定版本的 PPA 不可用,它将永远无法打开 URL,你会看到著名的 404 错误。 #### 为什么 PPA 不适用于所有 Ubuntu 发行版? @@ -202,7 +205,7 @@ E: Some index files failed to download. They have been ignored, or old ones used 比如说,你访问 Light Table 的 PPA 页面,使用刚刚学到的有关 PPA 的知识,你会发现 PPA 不适用于你的特定 Ubuntu 版本。 -你可以点击 `查看软件包详细信息`。 +你可以点击 “查看软件包详细信息”。 ![Get DEB file from PPA][16] @@ -234,11 +237,11 @@ Ubuntu 软件中心无法移除 PPA 安装的软件包,你必须使用具有 sudo apt install synaptic ``` -安装后,启动 Synaptic 包管理器并选择 Origin。你会看到添加到系统的各种软件仓库。 PPA 条目将以前缀 PPA 进行标识,单击以查看 PPA 可用的包。已安装的软件前面会有恰当的符号进行标识。 +安装后,启动 Synaptic 包管理器并选择 “Origin”。你会看到添加到系统的各种软件仓库。PPA 条目将以前缀 PPA 进行标识,单击以查看 PPA 可用的包。已安装的软件前面会有恰当的符号进行标识。 ![Managing PPA with Synaptic package manager][20] -查找通过 PPA 安装的软件包 +*查找通过 PPA 安装的软件包* 找到包后,你可以从 Synaptic 删除它们。此外,也始终可以选择使用命令行进行移除: @@ -264,7 +267,7 @@ sudo apt remove package_name 这是一个主观问题。纯粹主义者厌恶 PPA,因为大多数时候 PPA 来自第三方开发者。但与此同时,PPA 在 Debian/Ubuntu 世界中很受欢迎,因为它们提供了更简单的安装选项。 -就安全性而言,使用 PPA 之后,你的 Linux 系统被黑客攻击或注入恶意软件的可能性较小。到目前为止,我不记得发生过这样的事件。 +就安全性而言,很少见到因为使用 PPA 之后你的 Linux 系统被黑客攻击或注入恶意软件。到目前为止,我不记得发生过这样的事件。 官方 PPA 可以不加考虑的使用,使用非官方 PPA 完全是你自己的决定。 @@ -285,7 +288,7 @@ via: https://itsfoss.com/ppa-guide/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[jlztan](https://github.com/jlztan) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -300,7 +303,7 @@ via: https://itsfoss.com/ppa-guide/ [7]: https://launchpad.net/ubuntu/+ppas [8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-sources-list-files.png?resize=800%2C259&ssl=1 [9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/content-of-ppa-list.png?ssl=1 -[10]: https://itsfoss.com/install-software-from-source-code/ +[10]: https://linux.cn/article-9172-1.html [11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ [12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/12/verify-ppa-availibility-version.jpg?resize=800%2C481&ssl=1 [13]: https://launchpad.net/ From e6a02035fa2c07f404fd59db75a198205dbf4d76 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 11:04:19 +0800 Subject: [PATCH 0655/4278] PUB:20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @jlztan https://linux.cn/article-10456-1.html --- ...- Everything You Need to Know About PPA in Linux.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename {translated/tech => published}/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md (99%) diff --git a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md similarity index 99% rename from translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md rename to published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md index 6dc7b7c296..576444b9fb 100644 --- a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md +++ b/published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @@ -1,10 +1,10 @@ -[#]: collector: (lujun9972) -[#]: translator: (jlztan) +[#]: collector: (lujun9972) +[#]: translator: (jlztan) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10456-1.html) [#]: subject: (What is PPA? Everything You Need to Know About PPA in Linux) -[#]: via: (https://itsfoss.com/ppa-guide/) +[#]: via: (https://itsfoss.com/ppa-guide/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) Ubuntu PPA 使用指南 From 392a4a0c135f4413c512843c306e4ecbbc61c052 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Sat, 19 Jan 2019 12:33:52 +0800 Subject: [PATCH 0656/4278] translated over translated over --- ...80919 5 ways DevSecOps changes security.md | 78 ------------------- ...80919 5 ways DevSecOps changes security.md | 77 ++++++++++++++++++ 2 files changed, 77 insertions(+), 78 deletions(-) delete mode 100644 sources/talk/20180919 5 ways DevSecOps changes security.md create mode 100644 translated/talk/20180919 5 ways DevSecOps changes security.md diff --git a/sources/talk/20180919 5 ways DevSecOps changes security.md b/sources/talk/20180919 5 ways DevSecOps changes security.md deleted file mode 100644 index aef3780fdb..0000000000 --- a/sources/talk/20180919 5 ways DevSecOps changes security.md +++ /dev/null @@ -1,78 +0,0 @@ - translating by hopefully2333 - -5 ways DevSecOps changes security -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum) - -There’s been an ongoing kerfuffle over whether we need to expand [DevOps][1] to explicitly bring in security. After all, the thinking goes, [DevOps][2] has always been something of a shorthand for a broad set of new practices, using new tools (often open source) and built on more collaborative cultures. Why not [DevBizOps][3] for better aligning with business needs? Or DevChatOps to emphasize better and faster communications? - -However, [as John Willis wrote earlier this year][4] on his coming around to the [DevSecOps][5] terminology, “Hopefully, someday we will have a world where we no longer have to use the word DevSecOps and security will be an inherent part of all service delivery discussions. Until that day, and at this point, my general conclusion is that it’s just three new characters. More importantly, the name really differentiates the problem statement in a world where we as an industry are not doing a great job on information security.” - -So why aren’t we doing a great job on [information security][6], and what does it mean to do a great job in a DevSecOps context? - -We’ve arguably never done a great job of information security in spite of (or maybe because of) the vast industry of complex point products addressing narrow problems. But we also arguably did a good enough job during the era when defending against threats focused on securing the perimeter, network connections were limited, and most users were employees using company-provided devices. - -Those circumstances haven’t accurately described most organizations’ reality for a number of years now. But the current era, which brings in not only DevSecOps but new application architectural patterns, development practices, and an increasing number of threats, defines a stark new normal that requires a faster pace of change. It’s not so much that DevSecOps in isolation changes security, but that infosec circa 2018 requires new approaches. - -Consider these five areas. - -### Automation - -Lots of automation is a hallmark of DevOps generally. It’s partly about speed. If you’re going to move fast (and not break things), you need to have repeatable processes that execute without a lot of human intervention. Indeed, automation is one of the best entry points for DevOps, even in organizations that are still mostly working on monolithic legacy apps. Automating routine processes associated with configurations or testing with easy-to-use tools such as [Ansible][7] is a common quick hit for starting down the path to DevOps. - -DevSecOps is no different. Security today is a continuous process rather than a discrete checkpoint in the application lifecycle, or even a weekly or monthly check. When vulnerabilities are found and fixes issued by a vendor, it’s important they be applied quickly given that exploits taking advantage of those vulnerabilities will be out soon. - -### "Shift left" - -Traditional security is often viewed as a gatekeeper at the end of the development process. Check all the boxes and your app goes into production. Otherwise, try again. Security teams have a reputation for saying no a lot. - -Therefore, the thinking goes, why not move security earlier (left in a typical left-to-right drawing of a development pipeline)? Security may still say no, but the consequences of rework in early-stage development are a lot less than they are when the app is complete and ready to ship. - -I don’t like the “shift left” term, though. It implies that security is still a one-time event that’s just been moved earlier. Security needs to be a largely automated process everywhere in the application lifecycle, from the supply chain to the development and test process all the way through deployment. - -### Manage dependencies - -One of the big changes we see with modern app development is that you often don’t write most of the code. Using open source libraries and frameworks is one obvious case in point. But you may also just use external services from public cloud providers or other sources. In many cases, this external code and services will dwarf what you write yourself. - -As a result, DevSecOps needs to include a serious focus on your [software supply chain][8]. Are you getting your software from trusted sources? Is it up to date? Is it integrated into the security processes that you use for your own code? What policies do you have in place for which code and APIs you can use? Is commercial support available for the components that you are using for your own production code? - -No set of answers are going to be appropriate in all cases. They may be different for a proof-of-concept versus an at-scale production workload. But, as has been the case in manufacturing for a long time (and DevSecOps has many analogs in how manufacturing has evolved), the integrity of the supply chain is critical. - -### Visibility - -I’ve talked a lot about the need for automation throughout all the stages of the application lifecycle. That makes the assumption that we can see what’s going on in each of those stages. - -Effective DevSecOps requires effective instrumentation so that automation knows what to do. This instrumentation falls into a number of categories. There are long-term and high-level metrics that help tell us if the overall DevSecOps process is working well. There are critical alerts that require immediate human intervention (the security scanning system is down!). There are alerts, such as for a failed scan, that require remediation. And there are logs of the many parameters we capture for later analysis (what’s changing over time? What caused that failure?). - -### Services vs. monoliths - -While DevSecOps practices can be applied across many types of application architectures, they’re most effective with small and loosely coupled components that can be updated and reused without potentially forcing changes elsewhere in the app. In their purest form, these components can be [microservices][9] or functions, but the general principles apply wherever you have loosely coupled services communicating over a network. - -This pattern does introduce some new security challenges. The interactions between components can be complex and the total attack surface can be larger because there are now more entry points to the application across the network. - -On the other hand, this type of architecture also means that automated security and monitoring also has more granular visibility into the application components because they’re no longer buried deep within a monolithic application. - -Don’t get too wrapped up in the DevSecOps term, but take it as a reminder that security is evolving because the way that we write and deploy applications is evolving. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/9/devsecops-changes-security - -作者:[Gordon Haff][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/ghaff -[1]: https://opensource.com/resources/devops -[2]: https://opensource.com/tags/devops -[3]: https://opensource.com/article/18/5/steps-apply-devops-culture-beyond-it -[4]: https://www.devsecopsdays.com/articles/its-just-a-name -[5]: https://opensource.com/article/18/4/devsecops -[6]: https://opensource.com/article/18/6/where-cycle-security-devops -[7]: https://opensource.com/tags/ansible -[8]: https://opensource.com/article/17/1/be-open-source-supply-chain -[9]: https://opensource.com/tags/microservices diff --git a/translated/talk/20180919 5 ways DevSecOps changes security.md b/translated/talk/20180919 5 ways DevSecOps changes security.md new file mode 100644 index 0000000000..92f295ed04 --- /dev/null +++ b/translated/talk/20180919 5 ways DevSecOps changes security.md @@ -0,0 +1,77 @@ + +五种 DevSecOps 提升安全性 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum) + +对于我们是否需要扩展 DevOps 以确实提升安全性,我们一直都有争议。毕竟,我们的想法是,DevOps 一直是一系列的新实践的简写,使用新工具(通常是开源的)并且在这之上构建更多的协作文化。为什么 DevBizOps 不能更好地满足商业的需求?或者说 DevChatOps 强调的是更快更好的沟通? + +在今年(译者注:此处是2018年)的早些时候写的关于他理解的 DevSecOps 术语,“我希望,有一天在世界范围内,我们能不再使用 DevSecOps 这个词,安全会是所有的服务交付讨论中理所应当的部分。直到那一天到来为止,在这一点上,我的一般性结论是,这个词只有三个新的特性。更重要的是,我们作为一个产业,在信息安全方面并没有做的很好,而这个名称切实地区分出了问题的状况” + +所以,为什么我们在信息安全方面做的不好,在 DevSecOps 的语境下安全做的好又是什么意思呢? + +我们大概从未做好过信息安全,尽管(也可能是因为)复杂的工业点产品地址拥挤问题。我们仍然可以在这个时代把工作做得足够好,以此来防范威胁,这些威胁主要集中在一个范围内,网络的连接是有限的,而且大多数的用户都是公司的员工,使用的是公司提供的设备。 + +这些年来,这些情况并没有能准确地描述出大多数组织的真实现状。但在现在这个时代,不止引入了 DevSecOps,也同时引入了新的应用架构模型,开发实践,和越来越多的安全威胁,这些一起定义了一个需要更快迭代的新常态。还没有应用得很多的 DevSecOps 在独立改变安全,但是 2018 年的信息安全需要新的方法。 + +请仔细思考下面这五个领域。 + +### 自动化 + +大量的自动化通常是 DevOps 的标志,这部分是关于速度的,如果你要快速移动(并且不会打坏东西),你需要有可重复的过程,而且这个过程不需要太多的人工干预。实际上,自动化是 DevOps 最好的切入点之一,甚至是在仍然主要工作在单片机电路程序的组织里也是如此。使用像 Ansible 这样易于使用的工具来自动化地处理相关的配置或者是测试,这是快速开始 DevOps 之路的常用方法。 + +DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过程,而不是在应用的生命周期里进行不定期的检查,甚至是每周、每月的检查。当漏洞被厂商发现并修复的时候,这些漏洞能被快速地应用是很重要的,因为利用这些漏洞的利用程序很快就会被淘汰。 + +### "左转" + +在开发流程结束时,传统安全通常被视作一个守门人。检查所有的部分确保没有问题,然后这个应用程序就可以投入生产了。否则,就要再来一次。所以安全团队的声誉并不高。 + +因此,我们想的是,没什么不把安全这个部分提到前面呢(左边是一个典型的从左到右的开发流程图)?安全性可能仍然不行,但在开发的早期进行重构的影响要远远小于开发已经完成并且准备上线时进行重构的影响。 + +不过,我不喜欢“左移”这个词,这意味着安全仍然是一个只不过提前进行的一次性工作。在应用程序的整个生命周期里,从供应链到开发,再到测试,直到上线部署,安全都需要进行大量的自动化处理。 + +### 管理依赖 + +我们在现代应用程序开发过程中看到的一个最大的改变,就是你通常不需要去编写这个程序的大部分代码。使用开源的函数库和框架就是一个明显的例子。但是你也可以从公共的云服务商或其他来源那里获得额外的服务。在许多情况下,这些额外的代码和服务比你给自己写的要好得多。 + +因此,DevSecOps 需要你把重点放在你的软件供应链上,你是从可信的来源那里获取你的软件的吗?这些软件是最新的吗?它们已经集成到了你为自己的代码使用的安全流程中了吗?对于这些你能使用的代码和 API 你有哪些策略?你为自己的产品代码使用的组件是否有可用的商业支持? + +没有一套标准答案可以应对所有的情况。对于概念验证和大规模的生产,它们可能会有所不同。但是,正如制造业长期存在的情况(DevSecOps 和制造业的发展方面有许多相似之处),供应链的可信是至关重要的。 + +### 可见性 + +关于贯穿应用程序整个生命周期里所有阶段的自动化的需求,我已经谈过很多了。这里假设我们能看见每个阶段里发生的情况。 + +有效的 DevSecOps 需要有效的检测,以便于自动化程序知道要做什么。这个检测分了很多类别。一些长期的和高级别的指标能帮助我们了解整个 DevSecOps 流程是否工作良好。严重威胁级别的警报需要立刻有人进行处理(安全扫描系统已经关闭!)。有一些警报,比如扫描失败,需要进行修复。我们记录了大量的参数来生成日志,以便事后进行分析(随着时间的推移,哪些发生了改变?导致失败的原因是什么?)。 + +### 分散服务 vs 一体化解决方案 + +虽然 DevSecOps 实践可以应用于多种类型的应用架构,但它们对小型且松散耦合的组件最有效,这些组件可以进行更新和复用,而且不会在应用程序的其他地方进行强制更改。在纯净版的形式里,这些组件可以是微服务或者函数,但是这个一般性原则适用于通过网络进行通信的松散耦合服务的任何地方。 + +这种方法确实带来了一些新的安全挑战,组件之间的交互可能会很复杂,总的攻击面会更大,因为现在应用程序通过网络有了更多的切入点。 + +另一方面,这种类型的架构还意味着自动化的安全和监视可以更加精细地查看应用程序的组件,因为它们不再深埋在一整个应用程序之中。 + +不要过多地关注 DevSecOps 这个术语,但要提醒一下,安全正在不断地演变,因为我们编写和部署程序的方式也在不断地演变。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/devsecops-changes-security + +作者:[Gordon Haff][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[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/ghaff +[1]: https://opensource.com/resources/devops +[2]: https://opensource.com/tags/devops +[3]: https://opensource.com/article/18/5/steps-apply-devops-culture-beyond-it +[4]: https://www.devsecopsdays.com/articles/its-just-a-name +[5]: https://opensource.com/article/18/4/devsecops +[6]: https://opensource.com/article/18/6/where-cycle-security-devops +[7]: https://opensource.com/tags/ansible +[8]: https://opensource.com/article/17/1/be-open-source-supply-chain +[9]: https://opensource.com/tags/microservices From 758638de2f47f94fb4c513955f9a07a0306ade83 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 19 Jan 2019 12:35:46 +0800 Subject: [PATCH 0657/4278] translated by qhwdw --- ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index 43c76fa0c5..7285df6160 100644 --- a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: () +[#]: url: () [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) @@ -196,15 +196,15 @@ b loop$ 将这个 SD 卡插入到树莓派,并打开它的电源。这个 OK 的 LED 灯将亮起来。如果不是这样,请查看故障排除页面。如果一切如愿,恭喜你,你已经写出了你的第一个操作系统。[课程 2 OK02][12] 将指导你让 LED 灯闪烁和关闭闪烁。 -[^1]: OK, I'm lying it tells the linker, which is another program used to link several assembled files together. It doesn't really matter. -[^2]: Clearly they're important to you. Since the GNU toolchain is mainly used for creating programs, it expects there to be an entry point labelled `_start`. As we're making an operating system, the `_start` is always whatever comes first, which we set up with the `.section .init` command. However, if we don't say where the entry point is, the toolchain gets upset. Thus, the first line says that we are going to define a symbol called `_start` for all to see (globally), and the second line says to make the symbol `_start` the address of the next line. We will come onto addresses shortly. -[^3]: This tutorial is designed to spare you the pain of reading it, but, if you must, it can be found here [SoC-Peripherals.pdf](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf). For added confusion, the manual uses a different addressing system. An address listed as 0x7E200000 would be 0x20200000 in our OS. -[^4]: Only values which have a binary representation which only has 1s in the first 8 bits of the representation. In other words, 8 1s or 0s followed by only 0s. -[^5]: A hardware engineer was kind enough to explain this to me as follows: +[^1]: 是的,我说错了,它告诉的是链接器,它是另一个程序,用于将汇编器转换过的几个代码文件链接到一起。直接说是汇编器也没有大问题。 +[^2]: 其实它们对你很重要。由于 GNU 工具链主要用于开发操作系统,它要求入口点必须是名为 `_start` 的地方。由于我们是开发一个操作系统,无论什么时候,它总是从 `_start` 开时的,而我们可以使用 `.section .init` 命令去设置它。因此,如果我们没有告诉它入口点在哪里,就会使工具链困惑而产生警告消息。所以,我们先定义一个名为 `_start` 的符号,它是所有人可见的(全局的),紧接着在下一行生成符号 `_start` 的地址。我们很快就讲到这个地址了。 +[^3]: 本教程的设计减少了你阅读树莓派开发手册的难度,但是,如果你必须要阅读它,你可以在这里 [SoC-Peripherals.pdf](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf) 找到它。由于添加了混淆,手册中 GPIO 使用了不同的地址系统。我们的操作系统中的地址 0x20200000 对应到手册中是 0x7E200000。 +[^4]: mov 能够加载的值只有前 8 位是 1s 的二进制表示的值。换句话说就是一个 0s 后面紧跟着 8 个 1s 或 0s。 +[^5]: 一个很友好的硬件工程师是这样向我解释这个问题的: + + 原因是现在的芯片都是用一种称为 CMOS 的技术来制成的,它是互补金属氧化物半导体的简称。互补的意思是每个信号都连接到两个晶体管上,一个是使用 N 型半导体的材料制成,它用于将电压拉低,而另一个使用 P 型半导体材料制成,它用于将电压升高。在任何时刻,仅有一个半导体是打开的,否则将会短路。P 型材料的导电性能不如 N 型材料。这意味着三倍大的 P 型半导体材料才能提供与 N 型半导体材料相同的电流。这就是为什么 LED 总是通过降低为低电压来打开它,因为 N 型半导体拉低电压比 P 型半导体拉高电压的性能更强。 - The reason is that modern chips are made of a technology called CMOS, which stands for Complementary Metal Oxide Semiconductor. The Complementary part means each signal is connected to two transistors, one made of material called N-type semiconductor which is used to pull it to a low voltage and another made of P-type material to pull it to a high voltage. Only one transistor of the pair turns on at any time, otherwise we'd get a short circuit. P-type isn't as conductive as N-type, which means the P-type transistor has to be about 3 times as big to provide the same current. This is why LEDs are often wired to turn on by pulling them low, because the N-type is stronger at pulling low than the P-type is in pulling high. - - There's another reason. Back in the 1970s chips were made out of entirely out of N-type material ('NMOS'), with the P-type replaced by a resistor. That means that when a signal is pulled low the chip is consuming power (and getting hot) even while it isn't doing anything. Your phone getting hot and flattening the battery when it's in your pocket doing nothing wouldn't be good. So signals were designed to be 'active low' so that they're high when inactive and so don't take any power. Even though we don't use NMOS any more, it's still often quicker to pull a signal low with the N-type than to pull it high with the P-type. Often a signal that's 'active low' is marked with a bar over the top of the name, or written as SIGNAL_n or /SIGNAL. But it can still be confusing, even for hardware engineers! + 还有一个原因。早在上世纪七十年代,芯片完全是由 N 型材料制成的(NMOS),P 型材料部分使用了一个电阻来代替。这意味着当信号为低电压时,即便它什么事都没有做,芯片仍然在消耗能量(并发热)。你的电话装在口袋里什么事都不做,它仍然会发热并消耗你的电池电量,这不是好的设计。因此,信号设计成 'active low',而不活动时为高电压,这样就不会消耗能源了。虽然我们现在已经不使用 NMOS 了,但由于 N 型材料的低电压信号比 P 型材料的高电压信号要快,所以仍然使用了这种设计。通常在一个 'active low' 信号名字上方会有一个条型标记,或者写作 SIGNAL_n 或 /SIGNAL。但是即便这样,仍然很让人困惑,那怕是硬件工程师,也不可避免这种困惑! -------------------------------------------------------------------------------- From 99f1c3c7c8b706ca560c9feedf24cb98f8517efb Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 19 Jan 2019 12:26:44 +0800 Subject: [PATCH 0658/4278] =?UTF-8?q?20180614=20An=20introduction=20to=20t?= =?UTF-8?q?he=20Tornado=20Python=20web=20app=20framework.md=20=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...to the Tornado Python web app framework.md | 590 ------------------ ...to the Tornado Python web app framework.md | 580 +++++++++++++++++ 2 files changed, 580 insertions(+), 590 deletions(-) delete mode 100644 sources/tech/20180614 An introduction to the Tornado Python web app framework.md create mode 100644 translated/tech/20180614 An introduction to the Tornado Python web app framework.md diff --git a/sources/tech/20180614 An introduction to the Tornado Python web app framework.md b/sources/tech/20180614 An introduction to the Tornado Python web app framework.md deleted file mode 100644 index 74fdecb56c..0000000000 --- a/sources/tech/20180614 An introduction to the Tornado Python web app framework.md +++ /dev/null @@ -1,590 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: 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: ( ) - -An introduction to the Tornado Python web app framework -====== -In the third part in a series comparing Python frameworks, learn about Tornado, built to handle asynchronous processes. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tornado.png?itok=kAa3eXIU) - -In the first two articles in this four-part series comparing different Python web frameworks, we've covered the [Pyramid][1] and [Flask][2] web frameworks. We've built the same app twice and seen the similarities and differences between a complete DIY framework and a framework with a few more batteries included. - -Now let's look at a somewhat different option: [the Tornado framework][3]. Tornado is, for the most part, as bare-bones as Flask, but with a major difference: Tornado is built specifically to handle asynchronous processes. That special sauce isn't terribly useful in the app we're building in this series, but we'll see where we can use it and how it works in a more general situation. - -Let's continue the pattern we set in the first two articles and start by tackling the setup and config. - -### Tornado startup and configuration - -If you've been following along with this series, what we do first shouldn't come as much of a surprise. - -``` -$ mkdir tornado_todo -$ cd tornado_todo -$ pipenv install --python 3.6 -$ pipenv shell -(tornado-someHash) $ pipenv install tornado -``` - -Create a `setup.py` for installing our application: - -``` -(tornado-someHash) $ touch setup.py -# setup.py -from setuptools import setup, find_packages - -requires = [ -    'tornado', -    'tornado-sqlalchemy', -    'psycopg2', -] - -setup( -    name='tornado_todo', -    version='0.0', -    description='A To-Do List built with Tornado', -    author='', -    author_email='', -    keywords='web tornado', -    packages=find_packages(), -    install_requires=requires, -    entry_points={ -        'console_scripts': [ -            'serve_app = todo:main', -        ], -    }, -) -``` - -Because Tornado doesn't require any external configuration, we can dive right into writing the Python code that'll run our application. Let's make our inner `todo` directory and fill it with the first few files we'll need. - -``` -todo/ -    __init__.py -    models.py -    views.py -``` - -Like Flask and Pyramid, Tornado has some central configuration that will go in `__init__.py`. From `tornado.web`, we'll import the `Application` object. This will handle the hookups for routing and views, including our database (when we get there) and any extra settings needed to run our Tornado app. - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.options import define, options -from tornado.web import Application - -define('port', default=8888, help='port to listen on') - -def main(): -    """Construct and serve the tornado application.""" -    app = Application() -    http_server = HTTPServer(app) -    http_server.listen(options.port) -``` - -When we use the `define` function, we end up creating attributes on the `options` object. Anything that goes in the position of the first argument will be the attribute's name, and what's assigned to the `default` keyword argument will be the value of that attribute. - -As an example, if we name the attribute `potato` instead of `port`, we can access its value via `options.potato`. - -Calling `listen` on the `HTTPServer` doesn't start the server yet. We must do one more step to have a working application that can listen for requests and return responses. We need an input-output loop. Thankfully, Tornado comes with that out of the box in the form of `tornado.ioloop.IOLoop`. - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.ioloop import IOLoop -from tornado.options import define, options -from tornado.web import Application - -define('port', default=8888, help='port to listen on') - -def main(): -    """Construct and serve the tornado application.""" -    app = Application() -    http_server = HTTPServer(app) -    http_server.listen(options.port) -    print('Listening on http://localhost:%i' % options.port) -    IOLoop.current().start() -``` - -I like some kind of a `print` statement somewhere that tells me when I'm serving my application, but that's me. You could do without the `print` line if you so chose. - -We begin our I/O loop with `IOLoop.current().start()`. Let's talk a little more about input, output, and asynchronicity. - -### The basics of async in Python and the I/O loop - -Allow me to preface by saying that I am absolutely, positively, surely, and securely not an expert in asynchronous programming. As with all things I write, what follows stems from the limits of my understanding of the concept. As I am human, it may be deeply, deeply flawed. - -The main concerns of an asynchronous program are: - - * How is data coming in? - * How is data going out? - * When can some procedure be left to run without consuming my full attention? - - - -Due to the [global interpreter lock][4] (GIL), Python is—by design—a [single-threaded][5] language. For every task a Python program must execute, the full attention of its thread of execution is on that task for the duration of that task. Our HTTP server is written in Python. Thus, when data (e.g., an HTTP request) is received, the server's sole focus is that incoming data. This means that, in most cases, whatever procedures need to run in handling and processing that data will completely consume your server's thread of execution, blocking other potential data from being received until your server finishes whatever it needed to do. - -In many cases this isn't too problematic; a typical web request-response cycle will take only fractions of a second. Along with that, the sockets that HTTP servers are built from can maintain a backlog of incoming requests to be handled. So, if a request comes in while that socket is handling something else, chances are it'll just wait in line a bit before being addressed. For a low to intermediate traffic site, a fraction of a second isn't that big of a deal, and you can use multiple deployed instances along with a load-balancer like [NGINX][6] to distribute traffic for the larger request loads. - -What if, however, your average response time takes more than a fraction of a second? What if you use data from the incoming request to start some long-running process like a machine-learning algorithm or some massive database query? Now, your single-threaded web server starts to accumulate an unaddressable backlog of requests, some of which will get dropped due to simply timing out. This is not an option, especially if you want your service to be seen as reliable on a regular basis. - -In comes the asynchronous Python program. It's important to keep in mind that because it's written in Python, the program is still a single-threaded process. Anything that would block execution in a synchronous program, unless specifically flagged, will still block execution in an asynchronous one. - -When it's structured correctly, however, your asynchronous Python program can "shelve" long-running tasks whenever you designate that a certain function should have the ability to do so. Your async controller can then be alerted when the shelved tasks are complete and ready to resume, managing their execution only when needed without completely blocking the handling of new input. - -That was somewhat jargony, so let's demonstrate with a human example. - -#### Bringing it home - -I often find myself trying to get multiple chores done at home with little time to do them. On a given day, that backlog of chores may look like: - - * Cook a meal (20 min. prep, 40 min. cook) - * Wash dishes (60 min.) - * Wash and dry laundry (30 min. wash, 90 min. dry per load) - * Vacuum floors (30 min.) - - - -If I were acting as a traditional, synchronous program, I'd be doing each task myself, by hand. Each task would require my full attention to complete before I could consider handling anything else, as nothing would get done without my active attention. So my sequence of execution might look like: - - 1. Focus fully on preparing and cooking the meal, including waiting around for food to just… cook (60 min.). - 2. Transfer dirty dishes to sink (65 min. elapsed). - 3. Wash all the dishes (125 min. elapsed). - 4. Start laundry with my full focus on that, including waiting around for the washing machine to finish, then transferring laundry to the dryer, and waiting for the dryer to finish (250 min. elapsed). - 5. Vacuum the floors (280 min. elapsed). - - - -That's 4 hours and 40 minutes to complete my chores from end-to-end. - -Instead of working hard, I should work smart like an asynchronous program. My home is full of machines that can do my work for me without my continuous effort. Meanwhile, I can switch my attention to what may actively need it right now. - -My execution sequence might instead look like: - - 1. Load clothes into and start the washing machine (5 min.). - 2. While the washing machine is running, prep food (25 min. elapsed). - 3. After prepping food, start cooking food (30 min. elapsed). - 4. While the food is cooking, move clothes from the washing machine into the dryer and start dryer (35 min. elapsed). - 5. While dryer is running and food is still cooking, vacuum the floors (65 min. elapsed). - 6. After vacuuming the floors, take food off the stove and load the dishwasher (70 min. elapsed). - 7. Run the dishwasher (130 min. when done). - - - -Now I'm down to 2 hours and 10 minutes. Even if I allow more time for switching between jobs (10-20 more minutes total), I'm still down to about half the time I would've spent if I'd waited to perform each task in sequential order. This is the power of structuring your program to be asynchronous. - -#### So where does the I/O loop come in? - -An asynchronous Python program works by taking in data from some external source (input) and, should the process require it, offloading that data to some external worker (output) for processing. When that external process finishes, the main Python program is alerted. The program then picks up the result of that external processing (input) and continues on its merry way. - -Whenever that data isn't actively in the hands of the main Python program, that main program is freed to work on just about anything else. This includes awaiting completely new inputs (e.g., HTTP requests) and handling the results of long-running processes (e.g., results of machine-learning algorithms, long-running database queries). The main program, while still single-threaded, becomes event-driven, triggered into action for specific occurrences handled by the program. The main worker that listens for those events and dictates how they should be handled is the I/O loop. - -We traveled a long road to get to this nugget of an explanation, I know, but what I'm hoping to communicate here is that it's not magic, nor is it some type of complex parallel processing or multi-threaded work. The global interpreter lock is still in place; any long-running process within the main program will still block anything else from happening. The program is also still single-threaded; however, by externalizing tedious work, we conserve the attention of that thread to only what it needs to be attentive to. - -This is kind of like my asynchronous chores above. When my attention is fully necessary for prepping food, that's all I'm doing. However, when I can get the stove to do work for me by cooking my food, and the dishwasher to wash my dishes, and the washing machine and dryer to handle my laundry, my attention is freed to work on other things. When I am alerted that one of my long-running tasks is finished and ready to be handled once again, if my attention is free, I can pick up the results of that task and do whatever needs to be done with it next. - -### Tornado routes and views - -Despite having gone through all the trouble of talking about async in Python, we're going to hold off on using it for a bit and first write a basic Tornado view. - -Unlike the function-based views we've seen in the Flask and Pyramid implementations, Tornado's views are all class-based. This means we'll no longer use individual, standalone functions to dictate how requests are handled. Instead, the incoming HTTP request will be caught and assigned to be an attribute of our defined class. Its methods will then handle the corresponding request types. - -Let's start with a basic view that prints "Hello, World" to the screen. Every class-based view we construct for our Tornado app must inherit from the `RequestHandler` object found in `tornado.web`. This will set up all the ground-level logic that we'll need (but don't want to write) to take in a request and construct a properly formatted HTTP response. - -``` -from tornado.web import RequestHandler - -class HelloWorld(RequestHandler): -    """Print 'Hello, world!' as the response body.""" - -    def get(self): -        """Handle a GET request for saying Hello World!.""" -        self.write("Hello, world!") -``` - -Because we're looking to handle a `GET` request, we declare (really override) the `get` method. Instead of returning anything, we provide text or a JSON-serializable object to be written to the response body with `self.write`. After that, we let the `RequestHandler` take on the rest of the work that must be done before a response can be sent. - -As it stands, this view has no actual connection to the Tornado application itself. We have to go back into `__init__.py` and update the `main` function a bit. Here's the new hotness: - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.ioloop import IOLoop -from tornado.options import define, options -from tornado.web import Application -from todo.views import HelloWorld - -define('port', default=8888, help='port to listen on') - -def main(): -    """Construct and serve the tornado application.""" -    app = Application([ -        ('/', HelloWorld) -    ]) -    http_server = HTTPServer(app) -    http_server.listen(options.port) -    print('Listening on http://localhost:%i' % options.port) -    IOLoop.current().start() -``` - -#### What'd we do? - -We imported the `HelloWorld` view from the `views.py` file into `__init__.py` at the top of the script. Then we added a list of route-view pairs as the first argument to the instantiation to `Application`. Whenever we want to declare a route in our application, it must be tied to a view. You can use the same view for multiple routes if you want, but there must always be a view for every route. - -We can make sure this all works by running our app with the `serve_app` command we enabled in the `setup.py`. Check `http://localhost:8888/` and see that it says "Hello, world!" - -Of course, there's more we can and will do in this space, but let's move on to models. - -### Connecting the database - -If we want to hold onto data, we need to connect a database. Like with Flask, we'll be using a framework-specific variant of SQLAlchemy called [tornado-sqlalchemy][7]. - -Why use this instead of just the bare [SQLAlchemy][8]? Well, `tornado-sqlalchemy` has all the goodness of straightforward SQLAlchemy, so we can still declare models with a common `Base` as well as use all the column data types and relationships to which we've grown accustomed. Alongside what we already know from habit, `tornado-sqlalchemy` provides an accessible async pattern for its database-querying functionality specifically to work with Tornado's existing I/O loop. - -We set the stage by adding `tornado-sqlalchemy` and `psycopg2` to `setup.py` to the list of required packages and reinstall the package. In `models.py`, we declare our models. This step looks pretty much exactly like what we've already seen in Flask and Pyramid, so I'll skip the full-class declarations and just put up the necessaries of the `Task` model. - -``` -# this is not the complete models.py, but enough to see the differences -from tornado_sqlalchemy import declarative_base - -Base = declarative_base - -class Task(Base): -    # and so on, because literally everything's the same... -``` - -We still have to connect `tornado-sqlalchemy` to the actual application. In `__init__.py`, we'll be defining the database and integrating it into the application. - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.ioloop import IOLoop -from tornado.options import define, options -from tornado.web import Application -from todo.views import HelloWorld - -# add these -import os -from tornado_sqlalchemy import make_session_factory - -define('port', default=8888, help='port to listen on') -factory = make_session_factory(os.environ.get('DATABASE_URL', '')) - -def main(): -    """Construct and serve the tornado application.""" -    app = Application([ -        ('/', HelloWorld) -    ], -        session_factory=factory -    ) -    http_server = HTTPServer(app) -    http_server.listen(options.port) -    print('Listening on http://localhost:%i' % options.port) -    IOLoop.current().start() -``` - -Much like the session factory we passed around in Pyramid, we can use `make_session_factory` to take in a database URL and produce an object whose sole purpose is to provide connections to the database for our views. We then tie it into our application by passing the newly created `factory` into the `Application` object with the `session_factory` keyword argument. - -Finally, initializing and managing the database will look the same as it did for Flask and Pyramid (i.e., separate DB management script, working with respect to the `Base` object, etc.). It'll look so similar that I'm not going to reproduce it here. - -### Revisiting views - -Hello, World is always nice for learning the basics, but we need some real, application-specific views. - -Let's start with the info view. - -``` -# views.py -import json -from tornado.web import RequestHandler - -class InfoView(RequestHandler): -    """Only allow GET requests.""" -    SUPPORTED_METHODS = ["GET"] - -    def set_default_headers(self): -        """Set the default response header to be JSON.""" -        self.set_header("Content-Type", 'application/json; charset="utf-8"') - -    def get(self): -        """List of routes for this API.""" -        routes = { -            'info': 'GET /api/v1', -            'register': 'POST /api/v1/accounts', -            'single profile detail': 'GET /api/v1/accounts/', -            'edit profile': 'PUT /api/v1/accounts/', -            'delete profile': 'DELETE /api/v1/accounts/', -            'login': 'POST /api/v1/accounts/login', -            'logout': 'GET /api/v1/accounts/logout', -            "user's tasks": 'GET /api/v1/accounts//tasks', -            "create task": 'POST /api/v1/accounts//tasks', -            "task detail": 'GET /api/v1/accounts//tasks/', -            "task update": 'PUT /api/v1/accounts//tasks/', -            "delete task": 'DELETE /api/v1/accounts//tasks/' -        } -        self.write(json.dumps(routes)) -``` - -So what changed? Let's go from the top down. - -The `SUPPORTED_METHODS` class attribute was added. This will be an iterable of only the request methods that are accepted by this view. Any other method will return a [405][9] status code. When we made the `HelloWorld` view, we didn't specify this, mostly out of laziness. Without this class attribute, this view would respond to any request trying to access the route tied to the view. - -The `set_default_headers` method is declared, which sets the default headers of the outgoing HTTP response. We declare this here to ensure that any response we send back has a `"Content-Type"` of `"application/json"`. - -We added `json.dumps(some_object)` to the argument of `self.write` because it makes it easy to construct the content for the body of the outgoing response. - -Now that's done, and we can go ahead and connect it to the home route in `__init__.py`. - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.ioloop import IOLoop -from tornado.options import define, options -from tornado.web import Application -from todo.views import InfoView - -# add these -import os -from tornado_sqlalchemy import make_session_factory - -define('port', default=8888, help='port to listen on') -factory = make_session_factory(os.environ.get('DATABASE_URL', '')) - -def main(): -    """Construct and serve the tornado application.""" -    app = Application([ -        ('/', InfoView) -    ], -        session_factory=factory -    ) -    http_server = HTTPServer(app) -    http_server.listen(options.port) -    print('Listening on http://localhost:%i' % options.port) -    IOLoop.current().start() -``` - -As we know, more views and routes will need to be written. Each one will get dropped into the `Application` route listing as needed. Each will also need a `set_default_headers` method. On top of that, we'll create our `send_response`method, whose job it will be to package our response along with any custom status codes we want to set for a given response. Since each one will need both methods, we can create a base class containing them that each of our views can inherit from. That way, we have to write them only once. - -``` -# views.py -import json -from tornado.web import RequestHandler - -class BaseView(RequestHandler): -    """Base view for this application.""" - -    def set_default_headers(self): -        """Set the default response header to be JSON.""" -        self.set_header("Content-Type", 'application/json; charset="utf-8"') - -    def send_response(self, data, status=200): -        """Construct and send a JSON response with appropriate status code.""" -        self.set_status(status) -        self.write(json.dumps(data)) -``` - -For a view like the `TaskListView` we'll soon write, we'll also need a connection to the database. We'll need `tornado_sqlalchemy`'s `SessionMixin` to add a database session within every view class. We can fold that into the `BaseView` so that, by default, every view inheriting from it has access to a database session. - -``` -# views.py -import json -from tornado_sqlalchemy import SessionMixin -from tornado.web import RequestHandler - -class BaseView(RequestHandler, SessionMixin): -    """Base view for this application.""" - -    def set_default_headers(self): -        """Set the default response header to be JSON.""" -        self.set_header("Content-Type", 'application/json; charset="utf-8"') - -    def send_response(self, data, status=200): -        """Construct and send a JSON response with appropriate status code.""" -        self.set_status(status) -        self.write(json.dumps(data)) -``` - -As long as we're modifying this `BaseView` object, we should address a quirk that will come up when we consider data being posted to this API. - -When Tornado (as of v.4.5) consumes data from a client and organizes it for use in the application, it keeps all the incoming data as bytestrings. However, all the code here assumes Python 3, so the only strings that we want to work with are Unicode strings. We can add another method to this `BaseView` class whose job it will be to convert the incoming data to Unicode before using it anywhere else in the view. - -If we want to convert this data before we use it in a proper view method, we can override the view class's native `prepare` method. Its job is to run before the view method runs. If we override the `prepare` method, we can set some logic to run that'll do the bytestring-to-Unicode conversion whenever a request is received. - -``` -# views.py -import json -from tornado_sqlalchemy import SessionMixin -from tornado.web import RequestHandler - -class BaseView(RequestHandler, SessionMixin): -    """Base view for this application.""" - -    def prepare(self): -        self.form_data = { -            key: [val.decode('utf8') for val in val_list] -            for key, val_list in self.request.arguments.items() -        } - -    def set_default_headers(self): -        """Set the default response header to be JSON.""" -        self.set_header("Content-Type", 'application/json; charset="utf-8"') - -    def send_response(self, data, status=200): -        """Construct and send a JSON response with appropriate status code.""" -        self.set_status(status) -        self.write(json.dumps(data)) -``` - -If there's any data coming in, it'll be found within the `self.request.arguments` dictionary. We can access that data by key and convert its contents (always a list) to Unicode. Because this is a class-based view instead of a function-based view, we can store the modified data as an instance attribute to be used later. I called it `form_data` here, but it can just as easily be called `potato`. The point is that we can store data that has been submitted to the application. - -### Asynchronous view methods - -Now that we've built our `BaseView`, we can build the `TaskListView` that will inherit from it. - -As you can probably tell from the section heading, this is where all that talk about asynchronicity comes in. The `TaskListView` will handle `GET` requests for returning a list of tasks and `POST` requests for creating new tasks given some form data. Let's first look at the code to handle the `GET` request. - -``` -# all the previous imports -import datetime -from tornado.gen import coroutine -from tornado_sqlalchemy import as_future -from todo.models import Profile, Task - -# the BaseView is above here -class TaskListView(BaseView): -    """View for reading and adding new tasks.""" -    SUPPORTED_METHODS = ("GET", "POST",) - -    @coroutine -    def get(self, username): -        """Get all tasks for an existing user.""" -        with self.make_session() as session: -            profile = yield as_future(session.query(Profile).filter(Profile.username == username).first) -            if profile: -                tasks = [task.to_dict() for task in profile.tasks] -                self.send_response({ -                    'username': profile.username, -                    'tasks': tasks -                }) -``` - -The first major piece here is the `@coroutine` decorator, imported from `tornado.gen`. Any Python callable that has a portion that acts out of sync with the normal flow of the call stack is effectively a "co-routine"; a routine that can run alongside other routines. In the example of my household chores, pretty much every chore was a co-routine. Some were blocking routines (e.g., vacuuming the floor), but that routine simply blocked my ability to start or attend to anything else. It didn't block any of the other routines that were already set in motion from continuing. - -Tornado offers a number of ways to build an app that take advantage of co-routines, including allowing us to set locks on function calls, conditions for synchronizing asynchronous routines, and a system for manually modifying the events that control the I/O loop. - -The only way the `@coroutine` decorator is used here is to allow the `get` method to farm out the SQL query as a background process and resume once the query is complete, while not blocking the Tornado I/O loop from handling other sources of incoming data. That is all that's "asynchronous" about this implementation: out-of-band database queries. Clearly if we wanted to showcase the magic and wonder of an async web app, a To-Do List isn't the way. - -But hey, that's what we're building, so let's see how our method takes advantage of that `@coroutine` decorator. The `SessionMixin` that was, well, mixed into the `BaseView` declaration added two handy, database-aware attributes to our view class: `session` and `make_session`. They're similarly named and accomplish fairly similar goals. - -The `self.session` attribute is a session with an eye on the database. At the end of the request-response cycle, just before the view sends a response back to the client, any changes that have been made to the database are committed, and the session is closed. - -`self.make_session` is a context manager and generator, building and returning a brand new session object on the fly. That first `self.session` object still exists; `make_session` creates a new one anyway. The `make_session` generator also has baked into itself the logic for committing and closing the session it creates as soon as its context (i.e., indentation level) ends. - -If you inspect the source code, there is no difference between the type of object assigned to `self.session` and the type of object generated by `self.make_session`. The difference is in how they're managed. - -With the `make_session` context manager, the generated session belongs only to the context, beginning and ending within that context. You can open, modify, commit, and close multiple database sessions within the same view with the `make_session` context manager. - -`self.session` is much simpler, with the session already opened by the time you get to your view method and committing before the response is sent back to the client. - -Although the [read the docs snippet][10] and the [the PyPI example][11] both specify the use of the context manager, there's nothing about either the `self.session` object or the `session` generated by `self.make_session` that is inherently asynchronous. The point where we start thinking about the async behavior built into `tornado-sqlalchemy` comes when we initiate a query. - -The `tornado-sqlalchemy` package provides us with the `as_future` function. The job of `as_future` is to wrap the query constructed by the `tornado-sqlalchemy` session and yield its return value. If the view method is decorated with `@coroutine`, then using this `yield as_future(query)` pattern will now make your wrapped query an asynchronous background process. The I/O loop takes over, awaiting the return value of the query and the resolution of the `future` object created by `as_future`. - -To have access to the result from `as_future(query)`, you must `yield` from it. Otherwise, you get only an unresolved generator object and can do nothing with the query. - -Everything else in this view method is pretty much par for the course, mirroring what we've already seen in Flask and Pyramid. - -The `post` method will look fairly similar. For the sake of consistency, let's see how the `post` method looks and how it handles the `self.form_data` that was constructed with the `BaseView`. - -``` -@coroutine -def post(self, username): -    """Create a new task.""" -    with self.make_session() as session: -        profile = yield as_future(session.query(Profile).filter(Profile.username == username).first) -        if profile: -            due_date = self.form_data['due_date'][0] -            task = Task( -                name=self.form_data['name'][0], -                note=self.form_data['note'][0], -                creation_date=datetime.now(), -                due_date=datetime.strptime(due_date, '%d/%m/%Y %H:%M:%S') if due_date else None, -                completed=self.form_data['completed'][0], -                profile_id=profile.id, -                profile=profile -            ) -            session.add(task) -            self.send_response({'msg': 'posted'}, status=201) -``` - -As I said, it's about what we'd expect: - - * The same query pattern as we saw with the `get` method - * The construction of an instance of a new `Task` object, populated with data from `form_data` - * The adding (but not committing because it's handled by the context manager!) of the new `Task` object to the database session - * The sending of a response back to the client - - - -And thus we have the basis for our Tornado web app. Everything else (e.g., database management and more views for a more complete app) is effectively the same as what we've already seen in the Flask and Pyramid apps. - -### Thoughts about using the right tool for the right job - -What we're starting to see as we continue to move through these web frameworks is that they can all effectively handle the same problems. For something like this To-Do List, any framework can do the job. However, some web frameworks are more appropriate for certain jobs than other ones, depending on what "more appropriate" means for you and your needs. - -While Tornado is clearly capable of handling the same job that Pyramid or Flask can handle, to use it for an app like this is effectively a waste. It's like using a car to travel one block from home. Yes it can do the job of "travel," but short trips aren't why you choose to use a car over a bike or just your feet. - -Per the documentation, Tornado is billed as "a Python web framework and asynchronous networking library." There are few like it in the Python web framework ecosystem. If the job you're trying to accomplish requires (or would benefit significantly from) asynchronicity in any way, shape, or form, use Tornado. If your application needs to handle multiple, long-lived connections while not sacrificing much in performance, choose Tornado. If your application is many applications in one and needs to be thread-aware for the accurate handling of data, reach for Tornado. That's where it works best. - -Use your car to do "car things." Use other modes of transportation to do everything else. - -### Going forward and a little perspective check - -Speaking of using the right tool for the right job, keep in mind the scope and scale, both present and future, of your application when choosing your framework. Up to this point we've only looked at frameworks meant for small to midsized web applications. The next and final installment of this series will cover one of the most popular Python frameworks, Django, meant for big applications that might grow bigger. Again, while it technically can and will handle the To-Do List problem, keep in mind that it's not really what the framework is for. We'll still put it through its paces to show how an application can be built with it, but we have to keep in mind the intent of the framework and how that's reflected in its architecture: - - * **Flask:** Meant for small, simple projects; makes it easy for us to construct views and connect them to routes quickly; can be encapsulated in a single file without much fuss - * **Pyramid:** Meant for projects that may grow; contains a fair bit of configuration to get up and running; separate realms of application components can easily be divided and built out to arbitrary depth without losing sight of the central application - * **Tornado:** Meant for projects benefiting from precise and deliberate I/O control; allows for co-routines and easily exposes methods that can control how requests are received/responses are sent and when those operations occur - * **Django:** (As we'll see) meant for big things that may get bigger; large ecosystem of add-ons and mods; very opinionated in its configuration and management in order to keep all the disparate parts in line - - - -Whether you've been reading since the first post in this series or joined a little later, thanks for reading! Please feel free to leave questions or comments. I'll see you next time with hands full of Django. - -### Huge shout-out to the Python BDFL - -I must give credit where credit is due. Massive thanks are owed to [Guido van Rossum][12] for more than just creating my favorite programming language. - -During [PyCascades 2018][13], I was fortunate not only to give the talk this article series is based on, but also to be invited to the speakers' dinner. I got to sit next to Guido the whole night and pepper him with questions. One of those questions was how in the world async worked in Python, and he, without a bit of fuss, spent time explaining it to me in a way that I could start to grasp the concept. He later [tweeted to me][14] a spectacular resource for learning async with Python that I subsequently read three times over three months, then wrote this post. You're an awesome guy, Guido! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/tornado-framework - -作者:[Nicholas Hunt-Walker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/nhuntwalker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/18/5/pyramid-framework -[2]: https://opensource.com/article/18/4/flask -[3]: https://tornado.readthedocs.io/en/stable/ -[4]: https://realpython.com/python-gil/ -[5]: https://en.wikipedia.org/wiki/Thread_(computing) -[6]: https://www.nginx.com/ -[7]: https://tornado-sqlalchemy.readthedocs.io/en/latest/ -[8]: https://www.sqlalchemy.org/ -[9]: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_errors -[10]: https://tornado-sqlalchemy.readthedocs.io/en/latest/#usage -[11]: https://pypi.org/project/tornado-sqlalchemy/#description -[12]: https://www.twitter.com/gvanrossum -[13]: https://www.pycascades.com -[14]: https://twitter.com/gvanrossum/status/956186585493458944 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 new file mode 100644 index 0000000000..3816f5138b --- /dev/null +++ b/translated/tech/20180614 An introduction to the Tornado Python web app framework.md @@ -0,0 +1,580 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: 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 框架的系列文章的第三部分中,我们来了解 Tornado,它是为处理异步进程而构建的。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tornado.png?itok=kAa3eXIU) + +在这个由四部分组成的系列文章的前两篇中,我们介绍了 [Pyramid][1] 和 [Flask][2] Web 框架。我们已经构建了两次相同的应用程序,看到了一个完全的 DIY 框架和包含更多电池的框架之间的异同。 + +现在让我们来看看另一个稍微不同的选项:[Tornado 框架][3]。Tornado 在很大程度上与 Flask 一样简单,但有一个主要区别:Tornado 是专门为处理异步进程而构建的。在我们本系列所构建的应用程序中,这种特殊的酱料(译者注:这里意思是 Tornado 的异步功能)并不是非常有用,但我们将看到在哪里可以使用它,以及它在更一般的情况下是如何工作的。 + +让我们继续前两篇文章中设置的流程,首先从处理设置和配置。 + +### Tornado 启动和配置 + +如果你一直关注这个系列,那么第一步应该对你来说习以为常。 +``` +$ mkdir tornado_todo +$ cd tornado_todo +$ pipenv install --python 3.6 +$ pipenv shell +(tornado-someHash) $ pipenv install tornado +``` + +创建一个 `setup.py` 文件来安装我们的应用程序相关的东西: +``` +(tornado-someHash) $ touch setup.py +# setup.py +from setuptools import setup, find_packages + +requires = [ +    'tornado', +    'tornado-sqlalchemy', +    'psycopg2', +] + +setup( +    name='tornado_todo', +    version='0.0', +    description='A To-Do List built with Tornado', +    author='', +    author_email='', +    keywords='web tornado', +    packages=find_packages(), +    install_requires=requires, +    entry_points={ +        'console_scripts': [ +            'serve_app = todo:main', +        ], +    }, +) +``` + +因为 Tornado 不需要任何外部配置,所以我们可以直接编写 Python 代码来让程序运行。让我们创建 `todo` 目录,并用需要的前几个文件填充它。 +``` +todo/ +    __init__.py +    models.py +    views.py +``` + +就像 Flask 和 Pyramid 一样,Tornado 也有一些基本配置,将放在 `__init__.py` 中。从 `tornado.web` 中,我们将导入 `Application` 对象,它将处理路由和视图的连接,包括数据库(当我们谈到那里时再说)以及运行 Tornado 应用程序所需的其它额外设置。 + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.options import define, options +from tornado.web import Application + +define('port', default=8888, help='port to listen on') + +def main(): +    """Construct and serve the tornado application.""" +    app = Application() +    http_server = HTTPServer(app) +    http_server.listen(options.port) +``` + +当我们使用 `define` 函数时,我们最终会在 `options` 对象上创建属性。第一个参数位置的任何内容都将是属性的名称,分配给 `default` 关键字参数的内容将是该属性的值。 + +例如,如果我们将属性命名为 `potato` 而不是 `port`,我们可以通过 `options.potato` 访问它的值。 + +在 `HTTPServer` 上调用 `listen` 并不会启动服务器。我们必须再做一步,找一个可以监听请求并返回响应的工作应用程序,我们需要一个输入输出循环。幸运的是,Tornado 以 `tornado.ioloop.IOLoop` 的形式提供了开箱即用的功能。 + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop +from tornado.options import define, options +from tornado.web import Application + +define('port', default=8888, help='port to listen on') + +def main(): +    """Construct and serve the tornado application.""" +    app = Application() +    http_server = HTTPServer(app) +    http_server.listen(options.port) +    print('Listening on http://localhost:%i' % options.port) +    IOLoop.current().start() +``` + +我喜欢某种形式的 `print` 声明,告诉我什么时候应用程序正在提供服务,我就是这样子。如果你愿意,可以不使用 `print`。 + +我们以 `IOLoop.current().start()` 开始我们的 I/O 循环。让我们进一步讨论输入,输出和异步性。 + +### Python 中的异步和 I/O 循环的基础知识 + +请允许我提前说明,我绝对,肯定,肯定并且安心地说不是异步编程方面的专家。就像我写的所有内容一样,接下来的内容源于我对这个概念的理解的局限性。因为我是人,可能有很深很深的缺陷。 + +异步程序的主要问题是: + + * 数据如何进来? + * 数据如何出去? + * 什么时候可以在不占用我全部注意力情况下运行某个过程? + +由于[全局解释器锁][4](GIL),Python 被设计为一种单线程语言。对于 Python 程序必须执行的每个任务,其线程执行的全部注意力都集中在该任务的持续时间内。我们的 HTTP 服务器是用 Python 编写的,因此,当接收到数据(如 HTTP 请求)时,服务器的唯一关心的是传入的数据。这意味着,在大多数情况下,无论是程序需要运行还是处理数据,程序都将完全消耗服务器的执行线程,阻止接收其它可能的数据,直到服务器完成它需要做的事情。 + +在许多情况下,这不是太成问题。典型的 Web 请求,响应周期只需要几分之一秒。除此之外,构建 HTTP 服务器的套接字可以维护待处理的传入请求的积压。因此,如果请求在该套接字处理其它内容时进入,则它很可能只是在处理之前稍微排队等待一会。对于低到中等流量的站点,几分之一秒的时间并不是什么大问题,你可以使用多个部署的实例以及 [NGINX][6] 等负载均衡器来为更大的请求负载分配流量。 + +但是,如果你的平均响应时间超过一秒钟,该怎么办?如果你使用来自传入请求的数据来启动一些长时间的过程(如机器学习算法或某些海量数据库查询),该怎么办?现在,你的单线程 Web 服务器开始累积一个无法寻址的积压请求,其中一些请求会因为超时而被丢弃。这不是一种选择,特别是如果你希望你的服务在一段时间内是可靠的。 + +异步 Python 程序登场。重要的是要记住因为它是用 Python 编写的,所以程序仍然是一个单线程进程。除非特别标记,否则在异步程序中仍然会阻塞执行。 + +但是,当异步程序结构正确时,只要你指定某个函数应该具有这样的能力,你的异步 Python 程序就可以“搁置”长时间运行的任务。然后,当搁置的任务完成并准备好恢复时,异步控制器会收到报告,只要在需要时管理它们的执行,而不会完全阻塞对新输入的处理。 + +这有点夸张,所以让我们用一个人类的例子来证明。 + +### 带回家吧 + +我经常发现自己在家里试图完成很多家务,但没有多少时间来做它们。在某一天,积压的家务可能看起来像: + + * 做饭(20 分钟准备,40 分钟烹饪) + * 洗碗(60 分钟) + * 洗涤并擦干衣物(30 分钟洗涤,每次干燥 90 分钟) + * 真空清洗地板(30 分钟) + +如果我是一个传统的同步程序,我会亲自完成每项任务。在我考虑处理任何其他事情之前,每项任务都需要我全神贯注地完成。因为如果没有我的全力关注,什么事情都完成不了。所以我的执行顺序可能如下: + + 1. 完全专注于准备和烹饪食物,包括等待食物烹饪(60 分钟) + 2. 将脏盘子移到水槽中(65 分钟过去了) + 3. 清洗所有盘子(125 分钟过去了) + 4. 开始完全专注于洗衣服,包括等待洗衣机洗完,然后将衣物转移到烘干机,再等烘干机完成( 250 分钟过去了) + 5. 对地板进行真空吸尘(280 分钟了) + +从头到尾完成所有事情花费了 4 小时 40 分钟。 + +我应该像异步程序一样聪明地工作,而不是努力工作。我的家里到处都是可以为我工作的机器,而不用我一直努力工作。同时,现在我可以将注意力转移真正需要的东西上。 + +我的执行顺序可能看起来像: + + 1. 将衣物放入洗衣机并启动它(5 分钟) + 2. 在洗衣机运行时,准备食物(25 分钟过去了) + 3. 准备好食物后,开始烹饪食物(30 分钟过去了) + 4. 在烹饪食物时,将衣物从洗衣机移到烘干机机中开始烘干(35 分钟过去了) + 5. 当烘干机运行中,且食物仍在烹饪时,对地板进行真空吸尘(65 分钟过去了) + 6. 吸尘后,将食物从炉子中取出并装盘子入洗碗机(70 分钟过去了) + 7. 运行洗碗机(130 分钟完成) + +现在花费的时间下降到 2 小时 10 分钟。即使我允许在作业之间切换花费更多时间(总共 10-20 分钟)。如果我等待着按顺序执行每项任务,我花费的时间仍然只有一半左右。这就是将程序构造为异步的强大功能。 + +#### 那么 I/O 循环在哪里? + +一个异步 Python 程序的工作方式是从某个外部源(输入)获取数据,如果某个进程需要,则将该数据转移到某个外部工作者(输出)进行处理。当外部进程完成时,Python 主程序会收到提醒,然后程序获取外部处理(输入)的结果,并继续这样其乐融融的方式。 + +当数据不在 Python 主程序手中时,主程序就会被释放来处理其它任何事情。包括等待全新的输入(如 HTTP 请求)和处理长时间运行的进程的结果(如机器学习算法的结果,长时间运行的数据库查询)。主程序虽仍然是单线程的,但成了事件驱动的,它对程序处理的特定事件会触发动作。监听这些事件并指示应如何处理它们的主要是 I/O 循环在工作。 + +我知道,我们走了很长的路才得到这个重要的解释,但我希望在这里传达的是,它不是魔术,也不是某种复杂的并行处理或多线程工作。全局解释器锁仍然存在,主程序中任何长时间运行的进程仍然会阻塞其它任何事情的进行,该程序仍然是单线程的。然而,通过将繁琐的工作外部化,我们可以将线程的注意力集中在它需要注意的地方。 + +这有点像我上面的异步任务。当我的注意力完全集中在准备食物上时,它就是我所能做的一切。然而,当我能让炉子帮我做饭,洗碗机帮我洗碗,洗衣机和烘干机帮我洗衣服时,我的注意力就会被释放出来,去做其它事情。当我被提醒,我的一个长时间运行的任务已经完成并准备再次处理时,如果我的注意力是空闲的,我可以获取该任务的结果,并对其做下一步需要做的任何事情。 + +### Tornado 路由和视图 + +尽管经历了在 Python 中讨论异步的所有麻烦,我们还是决定暂不使用它。先来编写一个基本的 Tornado 视图。 + +与我们在 Flask 和 Pyramid 实现中看到的基于函数的视图不同,Tornado 的视图都是基于类的。这意味着我们将不在使用单独的,独立的函数来规定如何处理请求。相反,传入的 HTTP 请求将被捕获并将其分配为我们定义的类的一个属性。然后,它的方法将处理相应的请求类型。 + +让我们从一个基本的视图开始,即在屏幕上打印 "Hello, World"。我们为 Tornado 应用程序构造的每个基于类的视图都必须继承 `tornado.web` 中的 `RequestHandler` 对象。这将设置我们需要(但不想写)的所有底层逻辑来接收请求,同时构造正确格式的 HTTP 响应。 + +``` +from tornado.web import RequestHandler + +class HelloWorld(RequestHandler): +    """Print 'Hello, world!' as the response body.""" + +    def get(self): +        """Handle a GET request for saying Hello World!.""" +        self.write("Hello, world!") +``` + +因为我们要处理 `GET` 请求,所以我们声明(实际上是重写) `get` 方法。我们提供文本或 JSON 可序列化对象,用 `self.write` 写入响应体。之后,我们让 `RequestHandler` 来做在发送响应之前必须完成的其它工作。 + +就目前而言,此视图与 Tornado 应用程序本身并没有实际连接。我们必须回到 `__init__.py`,并稍微更新 `main` 函数。以下是新的内容: + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop +from tornado.options import define, options +from tornado.web import Application +from todo.views import HelloWorld + +define('port', default=8888, help='port to listen on') + +def main(): +    """Construct and serve the tornado application.""" +    app = Application([ +        ('/', HelloWorld) +    ]) +    http_server = HTTPServer(app) +    http_server.listen(options.port) +    print('Listening on http://localhost:%i' % options.port) +    IOLoop.current().start() +``` + +#### 我们做了什么 + +我们将 `views.py` 文件中的 `HelloWorld` 视图导入到脚本 `__init__.py` 的顶部。然后我们添加了一个路由-视图对应的列表,作为 `Application` 实例化的第一个参数。每当我们想要在应用程序中声明一个路由时,它必须绑定到一个视图。如果需要,可以对多个路由使用相同的视图,但每个路由必须有一个视图。 + +我们可以通过在 `setup.py` 中启用的 `serve_app` 命令来运行应用程序,从而确保这一切都能正常工作。查看 `http://localhost:8888/` 并看到它显示 "Hello, world!"。 + +当然,在这个领域中我们还能做更多,也将做更多,但现在让我们来讨论模型吧。 + +### 连接数据库 + +如果我们想要保留数据,我们需要连接数据库。与 Flask 一样,我们将使用一个特定于框架的 SQLAchemy 变体,名为 [tornado-sqlalchemy][7]。 + +为什么要使用它而不是 [SQLAlchemy][8] 呢?好吧,其实 `tornado-sqlalchemy` 具有简单 SQLAlchemy 的所有优点,因此我们仍然可以使用通用的 `Base` 声明模型,并使用我们习以为常的所有列数据类型和关系。除了我们已经从习惯中了解到的,`tornado-sqlalchemy` 还为其数据库查询功能提供了一种可访问的异步模式,专门用于与 Tornado 现有的 I/O 循环一起工作。 + +我们通过将 `tornado-sqlalchemy` 和 `psycopg2` 添加到 `setup.py` 到所需包的列表并重新安装包来创建环境。在 `models.py` 中,我们声明了模型。这一步看起来与我们在 Flask 和 Pyramid 中已经看到的完全一样,所以我将跳过全部声明,只列出了 `Task` 模型的必要部分。 + +``` +# 这不是完整的 models.py, 但是足够看到不同点 +from tornado_sqlalchemy import declarative_base + +Base = declarative_base + +class Task(Base): +    # 等等,因为剩下的几乎所有的东西都一样 ... +``` + +我们仍然需要将 `tornado-sqlalchemy` 连接到实际应用程序。在 `__init__.py` 中,我们将定义数据库并将其集成到应用程序中。 + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop +from tornado.options import define, options +from tornado.web import Application +from todo.views import HelloWorld + +# add these +import os +from tornado_sqlalchemy import make_session_factory + +define('port', default=8888, help='port to listen on') +factory = make_session_factory(os.environ.get('DATABASE_URL', '')) + +def main(): +    """Construct and serve the tornado application.""" +    app = Application([ +        ('/', HelloWorld) +    ], +        session_factory=factory +    ) +    http_server = HTTPServer(app) +    http_server.listen(options.port) +    print('Listening on http://localhost:%i' % options.port) +    IOLoop.current().start() +``` + +就像我们在 Pyramid 中传递的会话工厂一样,我们可以使用 `make_session_factory` 来接收数据库 URL 并生成一个对象,这个对象的唯一目的是为视图提供到数据库的连接。然后我们将新创建的 `factory` 传递给 `Application` 对象,并使用 `session_factory` 关键字参数将它绑定到应用程序中。 + +最后,初始化和管理数据库与 Flask 和 Pyramid 相同(即,单独的 DB 管理脚本,与 `Base` 对象一起工作等)。它看起来很相似,所以在这里我就不介绍了。 + +### 回顾视图 + +Hello,World 总是适合学习基础知识,但我们需要一些真实的,特定应用程序的视图。 + +让我们从 info 视图开始。 + +``` +# views.py +import json +from tornado.web import RequestHandler + +class InfoView(RequestHandler): +    """只允许 GET 请求""" +    SUPPORTED_METHODS = ["GET"] + +    def set_default_headers(self): +        """设置默认响应头为 json 格式的""" +        self.set_header("Content-Type", 'application/json; charset="utf-8"') + +    def get(self): +        """列出这个 API 的路由""" +        routes = { +            'info': 'GET /api/v1', +            'register': 'POST /api/v1/accounts', +            'single profile detail': 'GET /api/v1/accounts/', +            'edit profile': 'PUT /api/v1/accounts/', +            'delete profile': 'DELETE /api/v1/accounts/', +            'login': 'POST /api/v1/accounts/login', +            'logout': 'GET /api/v1/accounts/logout', +            "user's tasks": 'GET /api/v1/accounts//tasks', +            "create task": 'POST /api/v1/accounts//tasks', +            "task detail": 'GET /api/v1/accounts//tasks/', +            "task update": 'PUT /api/v1/accounts//tasks/', +            "delete task": 'DELETE /api/v1/accounts//tasks/' +        } +        self.write(json.dumps(routes)) +``` + +有什么改变吗?让我们从上往下看。 + +我们添加了 `SUPPORTED_METHODS` 类属性,它是一个可迭代对象,代表这个视图所接受的请求方法,其他任何方法都将返回一个 [405][9] 状态码。当我们创建 `HelloWorld` 视图时,我们没有指定它,主要是当时有点懒。如果没有这个类属性,此视图将响应任何试图绑定到该视图的路由的请求。 + +我们声明了 `set_default_headers` 方法,它设置 HTTP 响应的默认头。我们在这里声明它,以确保我们返回的任何响应都有一个 `"Content-Type"` 是 `"application/json"` 类型。 + +我们将 `json.dumps(some_object)` 添加到 `self.write` 的参数中,因为它可以很容易地构建响应主体的内容。 + +现在已经完成了,我们可以继续将它连接到 `__init__.py` 中的主路由。 + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop +from tornado.options import define, options +from tornado.web import Application +from todo.views import InfoView + +# 添加这些 +import os +from tornado_sqlalchemy import make_session_factory + +define('port', default=8888, help='port to listen on') +factory = make_session_factory(os.environ.get('DATABASE_URL', '')) + +def main(): +    """Construct and serve the tornado application.""" +    app = Application([ +        ('/', InfoView) +    ], +        session_factory=factory +    ) +    http_server = HTTPServer(app) +    http_server.listen(options.port) +    print('Listening on http://localhost:%i' % options.port) +    IOLoop.current().start() +``` + +我们知道,还需要编写更多的视图和路由。每个都会根据需要放入 `Application` 路由列表中,每个视图还需要一个 `set_default_headers` 方法。在此基础上,我们还将创建 `send_response` 方法,它的作用是将响应与我们想要给响应设置的任何自定义状态码打包在一起。由于每个视图都需要这两个方法,因此我们可以创建一个包含它们的基类,这样每个视图都可以继承基类。这样,我们只需要编写一次。 + +``` +# views.py +import json +from tornado.web import RequestHandler + +class BaseView(RequestHandler): +    """Base view for this application.""" + +    def set_default_headers(self): +        """Set the default response header to be JSON.""" +        self.set_header("Content-Type", 'application/json; charset="utf-8"') + +    def send_response(self, data, status=200): +        """Construct and send a JSON response with appropriate status code.""" +        self.set_status(status) +        self.write(json.dumps(data)) +``` + +对于我们即将编写的 `TaskListView` 这样的视图,我们还需要一个到数据库的连接。我们需要 `tornado_sqlalchemy` 中的 `SessionMixin` 在每个视图类中添加一个数据库会话。我们可以将它放在 `BaseView` 中,这样,默认情况下,从它继承的每个视图都可以访问数据库会话。 + +``` +# views.py +import json +from tornado_sqlalchemy import SessionMixin +from tornado.web import RequestHandler + +class BaseView(RequestHandler, SessionMixin): +    """Base view for this application.""" + +    def set_default_headers(self): +        """Set the default response header to be JSON.""" +        self.set_header("Content-Type", 'application/json; charset="utf-8"') + +    def send_response(self, data, status=200): +        """Construct and send a JSON response with appropriate status code.""" +        self.set_status(status) +        self.write(json.dumps(data)) +``` + +只要我们修改 `BaseView` 对象,在将数据发布到这个 API 时,我们就应该定位到这里。 + +当 Tornado(从 v.4.5 开始)使用来自客户端的数据并将其组织起来到应用程序中使用时,它会将所有传入数据视为字节串。但是,这里的所有代码都假设使用 Python 3,因此我们希望使用的唯一字符串是 Unicode 字符串。我们可以为这个 `BaseView` 类添加另一个方法,它的工作是将输入数据转换为 Unicode,然后再在视图的其他地方使用。 + +如果我们想要在正确的视图方法中使用它之前转换这些数据,我们可以重写视图类的原生 `prepare` 方法。它的工作是在视图方法运行前运行。如果我们重写 `prepare` 方法,我们可以设置一些逻辑来运行,每当收到请求时,这些逻辑就会执行字节串到 Unicode 的转换。 + +``` +# views.py +import json +from tornado_sqlalchemy import SessionMixin +from tornado.web import RequestHandler + +class BaseView(RequestHandler, SessionMixin): +    """Base view for this application.""" + +    def prepare(self): +        self.form_data = { +            key: [val.decode('utf8') for val in val_list] +            for key, val_list in self.request.arguments.items() +        } + +    def set_default_headers(self): +        """Set the default response header to be JSON.""" +        self.set_header("Content-Type", 'application/json; charset="utf-8"') + +    def send_response(self, data, status=200): +        """Construct and send a JSON response with appropriate status code.""" +        self.set_status(status) +        self.write(json.dumps(data)) +``` + +如果有任何数据进入,它将在 `self.request.arguments` 字典中找到。我们可以通过键访问该数据库,并将其内容(始终是列表)转换为 Unicode。因为这是基于类的视图而不是基于函数的,所以我们可以将修改后的数据存储为一个实例属性,以便以后使用。我在这里称它为 `form_data`,但它也可以被称为 `potato`。关键是我们可以存储提交给应用程序的数据。 + +### 异步视图方法 + +现在我们已经构建了 `BaseaView`,我们可以构建 `TaskListView` 了,它会继承 `BaseaView`。 + +正如你可以从章节标题中看到的那样,以下是所有关于异步性的讨论。`TaskListView` 将处理返回任务列表的 `GET` 请求和用户给定一些表单数据来创建新任务的 `POST` 请求。让我们首先来看看处理 `GET` 请求的代码。 + +``` +# all the previous imports +import datetime +from tornado.gen import coroutine +from tornado_sqlalchemy import as_future +from todo.models import Profile, Task + +# the BaseView is above here +class TaskListView(BaseView): +    """View for reading and adding new tasks.""" +    SUPPORTED_METHODS = ("GET", "POST",) + +    @coroutine +    def get(self, username): +        """Get all tasks for an existing user.""" +        with self.make_session() as session: +            profile = yield as_future(session.query(Profile).filter(Profile.username == username).first) +            if profile: +                tasks = [task.to_dict() for task in profile.tasks] +                self.send_response({ +                    'username': profile.username, +                    'tasks': tasks +                }) +``` + +这里的第一个主要部分是 `@coroutine` 装饰器,它从 `tornado.gen` 导入。任何具有与调用堆栈的正常流程不同步的部分的 Python 可调用实际上是“协程”。一个可以与其它协程一起运行的协程。在我的家务劳动的例子中,几乎所有的家务活都是一个共同的例行协程。有些人阻止了例行协程(例如,给地板吸尘),但这种例行协程只会阻碍我开始或关心其它任何事情的能力。它没有阻止已经启动的任何其他协程继续进行。 + +Tornado 提供了许多方法来构建一个利用协程的应用程序,包括允许我们设置函数调用锁,同步异步协程的条件,以及手动修改控制 I/O 循环的事件系统。 + +这里使用 `@coroutine` 装饰器的唯一条件是允许 `get` 方法将 SQL 查询作为后台进程,并在查询完成后恢复,同时不阻止 Tornado I/O 循环去处理其他传入的数据源。这就是关于此实现的所有“异步”:带外数据库查询。显然,如果我们想要展示异步 Web 应用程序的魔力和神奇,那么一个任务列表就不是好的展示方式。 + +但是,这就是我们正在构建的,所以让我们来看看方法如何利用 `@coroutine` 装饰器。`SessionMixin` 混合到 `BaseView` 声明中,为我们的视图类添加了两个方便的,支持数据库的属性:`session` 和 `make_session`。它们的名字相似,实现的目标也相当相似。 + +`self.session` 属性是一个关注数据库的会话。在请求-响应周期结束时,在视图将响应发送回客户端之前,任何对数据库的更改都被提交,并关闭会话。 + +`self.make_session` 是一个上下文管理器和生成器,可以动态构建和返回一个全新的会话对象。第一个 `self.session` 对象仍然存在。无论如何,反正 `make_session` 会创建一个新的。`make_session` 生成器还为其自身提供了一个功能,用于在其上下文(即缩进级别)结束时提交和关闭它创建的会话。 + +如果你查看源代码,则赋值给 `self.session` 的对象类型与 `self.make_session` 生成的对象类型之间没有区别,不同之处在于它们是如何被管理的。 + +使用 `make_session` 上下文管理器,生成的会话仅属于上下文,在该上下文中开始和结束。你可以使用 `make_session` 上下文管理器在同一个视图中打开,修改,提交以及关闭多个数据库会话。 + +`self.session` 要简单得多,当你进入视图方法时会话已经打开,在响应被发送回客户端之前会话就已提交。 + +虽然[读取文档片段][10]和 [PyPI 示例][11]都说明了上下文管理器的使用,但是没有说明 `self.session` 对象或由 `self.make_session` 生成的 `session` 本质上是不是异步的。当我们启动查询时,我们开始考虑内置于 `tornado-sqlalchemy` 中的异步行为。 + +`tornado-sqlalchemy` 包为我们提供了 `as_future` 函数。它的工作是装饰 `tornado-sqlalchemy` 会话构造的查询并 yield 其返回值。如果视图方法用 `@coroutine` 装饰,那么使用 `yield as_future(query)` 模式将使封装的查询成为一个异步后台进程。I/O 循环会接管等待查询的返回值和 `as_future` 创建的 `future` 对象的解析。 + +要访问 `as_future(query)` 的结果,你必须从它 `yield`。否则,你只能获得一个未解析的生成器对象,并且无法对查询执行任何操作。 + +这个视图方法中的其他所有内容都与之前课堂上的类似,与我们在 Flask 和 Pyramid 中看到的内容类似。 + +`post` 方法看起来非常相似。为了保持一致性,让我们看一下 `post` 方法以及它如何处理用 `BaseView` 构造的 `self.form_data`。 + +``` +@coroutine +def post(self, username): +    """Create a new task.""" +    with self.make_session() as session: +        profile = yield as_future(session.query(Profile).filter(Profile.username == username).first) +        if profile: +            due_date = self.form_data['due_date'][0] +            task = Task( +                name=self.form_data['name'][0], +                note=self.form_data['note'][0], +                creation_date=datetime.now(), +                due_date=datetime.strptime(due_date, '%d/%m/%Y %H:%M:%S') if due_date else None, +                completed=self.form_data['completed'][0], +                profile_id=profile.id, +                profile=profile +            ) +            session.add(task) +            self.send_response({'msg': 'posted'}, status=201) +``` + +正如我所说,这是我们所期望的: + +  * 与我们在 `get` 方法中看到的查询模式相同 +  * 构造一个新的 `Task` 对象的实例,用 `form_data` 的数据填充 +  * 添加新的 `Task` 对象(但不提交,因为它由上下文管理器处理!)到数据库会话 +  * 将响应发送给客户端 + +这样我们就有了 Tornado web 应用程序的基础。其他内容(例如,数据库管理和更多完整应用程序的视图)实际上与我们在 Flask 和 Pyramid 应用程序中看到的相同。 + +### 关于使用合适的工具完成合适的工作的一点想法 + +在我们继续浏览这些 Web 框架时,我们开始看到它们都可以有效地处理相同的问题。对于像这样的待办事项列表,任何框架都可以完成这项任务。但是,有些 Web 框架比其它框架更适合某些工作,这具体取决于对你来说什么“更合适”和你的需求。 + +虽然 Tornado 显然能够处理 Pyramid 或 Flask 可以处理的相同工作,但将它用于这样的应用程序实际上是一种浪费,这就像开车从家走一个街区(to 校正:这里意思应该是从家开始走一个街区只需步行即可)。是的,它可以完成“旅行”的工作,但短途旅行不是你选择汽车而不是自行车或者使用双脚的原因。 + +根据文档,Tornado 被称为 “Python Web 框架和异步网络库”。在 Python Web 框架生态系统中很少有人喜欢它。如果你尝试完成的工作需要(或将从中获益)以任何方式,形状或形式的异步性,使用 Tornado。如果你的应用程序需要处理多个长期连接,同时又不想牺牲太多性能,选择 Tornado。如果你的应用程序是多个应用程序,并且需要线程感知以准确处理数据,使用 Tornado。这是它最有效的地方。 + +用你的汽车做“汽车的事情”,使用其他交通工具做其他事情。 + +### 向前看,进行一些深度检查 + +谈到使用合适的工具来完成合适的工作,在选择框架时,请记住应用程序的范围和规模,包括现在和未来。到目前为止,我们只研究了适用于中小型 Web 应用程序的框架。本系列的下一篇也是最后一篇将介绍最受欢迎的 Python 框架之一 Django,它适用于可能会变得更大的大型应用程序。同样,尽管它在技术上能够并且将会处理待办事项列表问题,但请记住,这不是它的真正用途。我们仍然会通过它来展示如何使用它来构建应用程序,但我们必须牢记框架的意图以及它是如何反映在架构中的: + +  * **Flask:** 适用于小型,简单的项目。它可以使我们轻松地构建视图并将它们快速连接到路由,它可以简单地封装在一个文件中。 + +  * **Pyramid:** 适用于可能增长的项目。它包含一些配置来启动和运行。应用程序组件的独立领域可以很容易地划分并构建到任意深度,而不会忽略中央应用程序。 + +  * **Tornado:** 适用于受益于精确和有意识的 I/O 控制的项目。它允许协程,并轻松公开可以控制如何接收请求或发送响应以及何时发生这些操作的方法。 + +  * **Django:**(我们将会看到)意味着可能会变得更大的东西。它有着非常庞大的生态系统,包括大量插件和模块。它非常有主见的配置和管理,以保持所有不同部分在同一条线上。 + +无论你是从本系列的第一篇文章开始阅读,还是稍后才加入的,都要感谢阅读!请随意留下问题或意见。下次再见时,我手里会拿着 Django。 + +### 感谢 Python BDFL + +我必须把功劳归于它应得的地方,非常感谢 [Guido van Rossum][12],不仅仅是因为他创造了我最喜欢的编程语言。 + +在 [PyCascades 2018][13] 期间,我很幸运的不仅给了基于这个文章系列的演讲,而且还被邀请参加了演讲者的晚宴。整个晚上我都坐在 Guido 旁边,不停地问他问题。其中一个问题是,在 Python 中异步到底是如何工作的,但他没有一点大惊小怪,而是花时间向我解释,让我开始理解这个概念。他后来[推特给我][14]发了一条消息:是用于学习异步 Python 的广阔资源。我随后在三个月内阅读了三次,然后写了这篇文章。你真是一个非常棒的人,Guido! + +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/nhuntwalker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/5/pyramid-framework +[2]: https://opensource.com/article/18/4/flask +[3]: https://tornado.readthedocs.io/en/stable/ +[4]: https://realpython.com/python-gil/ +[5]: https://en.wikipedia.org/wiki/Thread_(computing) +[6]: https://www.nginx.com/ +[7]: https://tornado-sqlalchemy.readthedocs.io/en/latest/ +[8]: https://www.sqlalchemy.org/ +[9]: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_errors +[10]: https://tornado-sqlalchemy.readthedocs.io/en/latest/#usage +[11]: https://pypi.org/project/tornado-sqlalchemy/#description +[12]: https://www.twitter.com/gvanrossum +[13]: https://www.pycascades.com +[14]: https://twitter.com/gvanrossum/status/956186585493458944 From b0ace68b4ced1c7fe6121af67f3924cc6a605f4a Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 19 Jan 2019 13:34:14 +0800 Subject: [PATCH 0659/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=B8=AD20190109?= =?UTF-8?q?=20Understaing...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190109 Understanding -etc-services file in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190109 Understanding -etc-services file in Linux.md b/sources/tech/20190109 Understanding -etc-services file in Linux.md index 1b1028ca6d..071c4f7859 100644 --- a/sources/tech/20190109 Understanding -etc-services file in Linux.md +++ b/sources/tech/20190109 Understanding -etc-services file in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4b54b1f5bc9fc3cc54f1f390d98f32cb67fa856b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 13:38:23 +0800 Subject: [PATCH 0660/4278] PRF:20171206 Getting started with Turtl, an open source alternative to Evernote.md @geekpi --- ... an open source alternative to Evernote.md | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md index 26b41ac1ac..c5603d219b 100644 --- a/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md +++ b/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md @@ -1,8 +1,10 @@ -开始使用 Turtl 这个 Evernote 的开源替代品 +Turtl:Evernote 的开源替代品 ====== +> 如果你正在寻找一个 Evernote 和 Google Keep 的替代品,那么 Turtl 是一个可靠的记笔记工具。 + ![Using Turtl as an open source alternative to Evernote](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_brainstorm_island_520px.png?itok=6IUPyxkY) -我认识的每个人都会记笔记,许多人使用在线笔记应用,如 Evernote、Simplenote 或 Google Keep。这些都是很好的工具,但你不得不担忧信息的安全性和隐私性 - 特别是考虑到 [Evernote 2016 年的隐私策略变更][1]。如果你想要更好地控制笔记和数据,你需要转向开源工具。 +我认识的每个人都会记笔记,许多人使用在线笔记应用,如 Evernote、Simplenote 或 Google Keep。这些都是很好的工具,但你不得不担忧信息的安全性和隐私性 —— 特别是考虑到 [Evernote 2016 年的隐私策略变更][1]。如果你想要更好地控制笔记和数据,你需要转向开源工具。 无论你离开 Evernote 的原因是什么,都有开源替代品。让我们来看看其中一个选择:Turtl。 @@ -10,30 +12,25 @@ [Turtl][2] 背后的开发人员希望你将其视为“具有绝对隐私的 Evernote”。说实话,我不能保证 Turtl 提供的隐私级别,但它是一个非常好的笔记工具。 -要开始使用 Turtl,[下载][3]适用于 Linux、Mac OS 或 Windows 的桌面客户端,或者获取 [Android 应用][4]。安装它,然后启动客户端或应用。系统会要求你输入用户名和密码。Turtl 使用密码来生成加密密钥,根据开发人员的说法,加密密钥会在将笔记存储在设备或服务器上之前对其进行加密。 +要开始使用 Turtl,[下载][3]适用于 Linux、Mac OS 或 Windows 的桌面客户端,或者获取它的 [Android 应用][4]。安装它,然后启动客户端或应用。系统会要求你输入用户名和密码。Turtl 使用密码来生成加密密钥,根据开发人员的说法,加密密钥会在将笔记存储在设备或服务器上之前对其进行加密。 ### 使用 Turtl 你可以使用 Turtl 创建以下类型的笔记: * 密码 - * 档案 - * 图片 - * 书签 - * 文字笔记 无论你选择何种类型的笔记,你都可以在类似的窗口中创建: - ![Create new text note with Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-new-note-520.png) -在 Turtl 中创建新笔记 +*在 Turtl 中创建新笔记* -添加笔记标题,文字并(如果你正在创建文件或图像笔记)附加文件或图像等信息。然后单击“保存”。 +添加笔记标题、文字并(如果你正在创建文件或图像笔记)附加文件或图像等信息。然后单击“保存”。 你可以通过 [Markdown][6] 为你的笔记添加格式。因为没有工具栏快捷方式,所以你需要手动添加格式。 @@ -41,9 +38,9 @@ ![Create new board in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-boards-520.png) -在 Turtl 中创建新的白板 +*在 Turtl 中创建新的白板* -要向白板添加笔记,请创建或编辑笔记,然后单击笔记底部的“此笔记不在任何白板”的链接。选择一个或多个白板,然后单击“完成”。 +要向白板中添加笔记,请创建或编辑笔记,然后单击笔记底部的“此笔记不在任何白板”的链接。选择一个或多个白板,然后单击“完成”。 要为笔记添加标记,请单击记事本底部的“标记”图标,输入一个或多个以逗号分隔的关键字,然后单击“完成”。 @@ -57,14 +54,13 @@ Turtl 以平铺视图显示笔记,让人想起 Google Keep: - ![Notes in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-notes-520.png) -Turtl 中的一系列笔记 +*Turtl 中的一系列笔记* 无法在桌面或 Android 应用上将其更改为列表视图。这对我来说不是问题,但我听说有些人因为它没有列表视图而不喜欢 Turtl。 -说到 Android 应用,它并不坏。但是,它没有与 Android 共享菜单集成。如果你想把在其他应用中看到或阅读的内容添加到 Turtl 笔记中,则需要手动复制并粘贴。 +说到 Android 应用,它并不差。但是,它没有与 Android 共享菜单集成。如果你想把在其他应用中看到或阅读的内容添加到 Turtl 笔记中,则需要手动复制并粘贴。 我已经在我的 Linux 笔记本,[运行 GalliumOS 的 Chromebook][10],还有一台 Android 手机上使用 Turtl 几个月了。对所有这些设备来说这都是一种非常无缝的体验。虽然它不是我最喜欢的开源笔记工具,但 Turtl 做得非常好。试试看它,它可能是你正在寻找的简单的笔记工具。 @@ -74,7 +70,7 @@ via: https://opensource.com/article/17/12/using-turtl-open-source-alternative-ev 作者:[Scott Nesbitt][a] 译者:[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 3a9d848586896c5daec7c450fe9968c79ce8c9ad Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 13:38:44 +0800 Subject: [PATCH 0661/4278] PUB:20171206 Getting started with Turtl, an open source alternative to Evernote.md @geekpi https://linux.cn/article-10457-1.html --- ... started with Turtl, an open source alternative to Evernote.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171206 Getting started with Turtl, an open source alternative to Evernote.md (100%) diff --git a/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/published/20171206 Getting started with Turtl, an open source alternative to Evernote.md similarity index 100% rename from translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md rename to published/20171206 Getting started with Turtl, an open source alternative to Evernote.md From b49587c21cd57584a91af7ea9387e421a35e7933 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 19 Jan 2019 14:57:57 +0800 Subject: [PATCH 0662/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=2020190109=20Understanding...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...derstanding -etc-services file in Linux.md | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) rename {sources => translated}/tech/20190109 Understanding -etc-services file in Linux.md (50%) diff --git a/sources/tech/20190109 Understanding -etc-services file in Linux.md b/translated/tech/20190109 Understanding -etc-services file in Linux.md similarity index 50% rename from sources/tech/20190109 Understanding -etc-services file in Linux.md rename to translated/tech/20190109 Understanding -etc-services file in Linux.md index 071c4f7859..dedbca16e2 100644 --- a/sources/tech/20190109 Understanding -etc-services file in Linux.md +++ b/translated/tech/20190109 Understanding -etc-services file in Linux.md @@ -7,46 +7,44 @@ [#]: via: (https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/) [#]: author: (kerneltalks https://kerneltalks.com) -Understanding /etc/services file in Linux +理解 Linux 中的 /etc/services 文件 ====== -Article which helps you to understand /etc/services file in Linux. Learn about content, format & importance of this file. +这篇文章将帮助你了解 Linux 中 /etc/services 文件,包括它的内容,格式以及重要性。 ![/etc/services file in Linux][1] -/etc/services file in Linux +Linux 中的 /etc/services 文件 -Internet daemon is important service in Linux world. It takes care of all network services with the help of `/etc/services` file. In this article we will walk you through content, format of this file and what it means to a Linux system. +网络守护程序是 Linux 世界中的重要服务。它借助 `/etc/services` 文件来处理所有网络服务。在本文中,我们将向你介绍这个文件的内容,格式以及它对于 Linux 系统的意义。 -`/etc/services` file contains list of network services and ports mapped to them. `inetd` or `xinetd` looks at these details so that it can call particular program when packet hits respective port and demand for service. +`/etc/services` 文件包含网络服务和它们映射端口的列表。`inetd` 或 `xinetd` 会查看这些细节,以便在数据包到达各自的端口或服务有需求时,它会调用特定的程序。 -As a normal user you can view this file since file is world readable. To edit this file you need to have root privileges. +作为普通用户,你可以查看此文件,因为文件一般都是可读的。要编辑此文件,你需要有 root 权限。 ``` $ ll /etc/services -rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services ``` -### `/etc/services` file format +### `/etc/services` 文件格式 ``` service-name port/protocol [aliases..] [#comment] ``` -Last two fields are optional hence denoted in `[` `]` +最后两个字段是可选的,因此用 `[` `]` 表示。 -where – +其中: - * service-name is name of the network service. e.g. [telnet][2], [ftp][3] etc. - * port/protocol is port being used by that network service (numerical value) and protocol (TCP/UDP) used for communication by service. - * alias is alternate name for service. - * comment is note or description you can add to service. Starts with `#` mark + * service-name 是网络服务的名称。例如 [telnet][2], [ftp][3] 等。 + * port/protocol 是网络服务使用的端口(一个数值)和服务通信使用的协议(TCP/UDP)。 + * alias 是服务的别名。 + * comment 是你可以添加到服务的注释或说明。以 `#` 标记开头。 - - -### Sample` /etc/services` file +### `/etc/services` 文件示例 ``` -# Each line describes one service, and is of the form: +# 每行描述一个服务,形式如下: # # service-name port/protocol [aliases ...] [# comment] @@ -56,7 +54,7 @@ echo 7/udp discard 9/udp sink null ``` -Here, you can see use of optional last two fields as well. `discard` service has alternate name as `sink` or `null`. +在这里,你可以看到可选的最后两个字段的用处。`discard` 服务的别名为 `sink` 或 `null`。 -------------------------------------------------------------------------------- @@ -64,7 +62,7 @@ via: https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/ 作者:[kerneltalks][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[MjSeven](https://github.com/MjSeven) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7fbd105b536db2b73aa65fbaeebdf5c5e716a908 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 16:36:50 +0800 Subject: [PATCH 0663/4278] PRF:20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @qhwdw --- ...1 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index 7285df6160..db6bfda5ac 100644 --- a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: () -[#]: url: () +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) @@ -199,12 +199,12 @@ b loop$ [^1]: 是的,我说错了,它告诉的是链接器,它是另一个程序,用于将汇编器转换过的几个代码文件链接到一起。直接说是汇编器也没有大问题。 [^2]: 其实它们对你很重要。由于 GNU 工具链主要用于开发操作系统,它要求入口点必须是名为 `_start` 的地方。由于我们是开发一个操作系统,无论什么时候,它总是从 `_start` 开时的,而我们可以使用 `.section .init` 命令去设置它。因此,如果我们没有告诉它入口点在哪里,就会使工具链困惑而产生警告消息。所以,我们先定义一个名为 `_start` 的符号,它是所有人可见的(全局的),紧接着在下一行生成符号 `_start` 的地址。我们很快就讲到这个地址了。 [^3]: 本教程的设计减少了你阅读树莓派开发手册的难度,但是,如果你必须要阅读它,你可以在这里 [SoC-Peripherals.pdf](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf) 找到它。由于添加了混淆,手册中 GPIO 使用了不同的地址系统。我们的操作系统中的地址 0x20200000 对应到手册中是 0x7E200000。 -[^4]: mov 能够加载的值只有前 8 位是 1s 的二进制表示的值。换句话说就是一个 0s 后面紧跟着 8 个 1s 或 0s。 +[^4]: `mov` 能够加载的值只有前 8 位是 `1` 的二进制表示的值。换句话说就是一个 0 后面紧跟着 8 个 `1` 或 `0`。 [^5]: 一个很友好的硬件工程师是这样向我解释这个问题的: 原因是现在的芯片都是用一种称为 CMOS 的技术来制成的,它是互补金属氧化物半导体的简称。互补的意思是每个信号都连接到两个晶体管上,一个是使用 N 型半导体的材料制成,它用于将电压拉低,而另一个使用 P 型半导体材料制成,它用于将电压升高。在任何时刻,仅有一个半导体是打开的,否则将会短路。P 型材料的导电性能不如 N 型材料。这意味着三倍大的 P 型半导体材料才能提供与 N 型半导体材料相同的电流。这就是为什么 LED 总是通过降低为低电压来打开它,因为 N 型半导体拉低电压比 P 型半导体拉高电压的性能更强。 - 还有一个原因。早在上世纪七十年代,芯片完全是由 N 型材料制成的(NMOS),P 型材料部分使用了一个电阻来代替。这意味着当信号为低电压时,即便它什么事都没有做,芯片仍然在消耗能量(并发热)。你的电话装在口袋里什么事都不做,它仍然会发热并消耗你的电池电量,这不是好的设计。因此,信号设计成 'active low',而不活动时为高电压,这样就不会消耗能源了。虽然我们现在已经不使用 NMOS 了,但由于 N 型材料的低电压信号比 P 型材料的高电压信号要快,所以仍然使用了这种设计。通常在一个 'active low' 信号名字上方会有一个条型标记,或者写作 SIGNAL_n 或 /SIGNAL。但是即便这样,仍然很让人困惑,那怕是硬件工程师,也不可避免这种困惑! + 还有一个原因。早在上世纪七十年代,芯片完全是由 N 型材料制成的(NMOS),P 型材料部分使用了一个电阻来代替。这意味着当信号为低电压时,即便它什么事都没有做,芯片仍然在消耗能量(并发热)。你的电话装在口袋里什么事都不做,它仍然会发热并消耗你的电池电量,这不是好的设计。因此,信号设计成 “活动时低”,而不活动时为高电压,这样就不会消耗能源了。虽然我们现在已经不使用 NMOS 了,但由于 N 型材料的低电压信号比 P 型材料的高电压信号要快,所以仍然使用了这种设计。通常在一个 “活动时低” 信号名字上方会有一个条型标记,或者写作 `SIGNAL_n` 或 `/SIGNAL`。但是即便这样,仍然很让人困惑,那怕是硬件工程师,也不可避免这种困惑! -------------------------------------------------------------------------------- From bfbe4767eff8913aa0d3561e6d9f8f8776a039d7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 16:37:24 +0800 Subject: [PATCH 0664/4278] PUB:20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @qhwdw https://linux.cn/article-10458-1.html --- ...20201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md (99%) diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md similarity index 99% rename from translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md rename to published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index db6bfda5ac..3daab0f235 100644 --- a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10458-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From a444639afa7e9e9139006897accb82f388e1291f Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 19 Jan 2019 15:55:23 +0800 Subject: [PATCH 0665/4278] MjSeven is translating 20190114 How To Move Mul... --- ... Move Multiple File Types Simultaneously From Commandline.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md index 1b342b12ef..dd135f20e0 100644 --- a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md +++ b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9e6c89cb1cf0954850d060ab69050fe307b3151d Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 19 Jan 2019 17:11:46 +0800 Subject: [PATCH 0666/4278] Translated by qhwdw --- ...aboratory - Raspberry Pi- Lesson 2 OK02.md | 68 ------------------ ...aboratory - Raspberry Pi- Lesson 2 OK02.md | 70 +++++++++++++++++++ 2 files changed, 70 insertions(+), 68 deletions(-) delete mode 100644 sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md create mode 100644 translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md diff --git a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md deleted file mode 100644 index fbdba984c3..0000000000 --- a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) -[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) - -Computer Laboratory – Raspberry Pi: Lesson 2 OK02 -====== - -The OK02 lesson builds on OK01, by causing the 'OK' or 'ACT' LED to turn on and off repeatedly. It is assumed you have the code for the [Lesson 1: OK01][1] operating system as a basis. - -### 1 Waiting - -Waiting is a surprisingly useful part of Operating System development. Often Operating Systems find themselves with nothing to do, and must delay. In this example, we wish to do so in order to allow the LED flashing off and on to be visible. If you just turned it off and on, it would not be visible, as the computer would be able to turn it off and on many thousands of times per second. In later lessons we will look at accurate waiting, but for now it is sufficient to simply waste time. - -``` -mov r2,#0x3F0000 -wait1$: -sub r2,#1 -cmp r2,#0 -bne wait1$ -``` - -``` -sub reg,#val subtracts the number val from the value in reg. - -cmp reg,#val compares the value in reg with the number val. - -Suffix ne causes the command to be executed only if the last comparison determined that the numbers were not equal. -``` - -The code above is a generic piece of code that creates a delay, which thanks to every Raspberry Pi being basically the same, is roughly the same time. How it does this is using a mov command to put the value 3F000016 into r2, and then subtracting 1 from this value until it is 0. The new commands here are sub, cmp, and bne. - -sub is the subtract command, and simply subtracts the second argument from the first. - -cmp is a more interesting command. It compares the first argument with the second, and remembers the result of the comparison in a special register called the current processor status register. You don't really need to worry about this, suffice to say it remembers, among other things, which of the two numbers was bigger or smaller, or if they were equal.[1] - -bne is actually just a branch command in disguise. In the ARM assembly language family, any instruction can be executed conditionally. This means that the instruction is only run if the last comparison had a certain result. We will use this extensively later for interesting tricks, but in this case we use the ne suffix on the b command to mean 'only branch if the last comparison's result was that the values were not equal'. The ne suffix can be used on any command, as can several other (16 in all) conditions such as eq for equal and lt for less than. - -### 2 The All Together - -I mentioned briefly last time that the status LED can be turned off again by writing to an offset of 28 from the GPIO controller instead of 40 (i.e. str r1,[r0,#28]). Thus, you need to modify the code from OK01 to turn the LED on, run the wait code, turn it off, run the wait code again, and then include a branch back to the beginning. Note, it is not necessary to re-enable the output to GPIO 16, we need only do that once. If you're being efficient, which I strongly encourage, you should be able to reuse the value of r1. As with all lessons, a full solution to this can be found on the [download page][2]. Be careful to make sure all of your labels are unique. When you write wait1$: you cannot label another line wait1$. - -On my Raspberry Pi it flashes about twice a second. this could easily be altered by changing the value we set r2 to. However, unfortunately we can't precisely predict the speed this runs at. If you didn't manage to get this working see our trouble shooting page, otherwise, congratulations. - -In this lesson we've learnt two more assembly commands, sub and cmp, as well as learning about conditional execution in ARM. - -In the next lesson, [Lesson 3: OK03][3] we will evaluate how we're coding, and establish some standards so that we can reuse code, and if necessary, work with C or C++ code. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html - -作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html -[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html diff --git a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md new file mode 100644 index 0000000000..29fa885a4f --- /dev/null +++ b/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +计算机实验室 – 树莓派:课程 2 OK02 +====== + +OK02 课程是在 OK01 课程的基础上构建,通过不停地打开和关闭 `OK` 或 `ACT` LED 指示灯来实现闪烁。假设你已经有了 [课程 1:OK01][1] 操作系统的代码,它将是这一节课的基础。 + +### 1、等待 + +等待是操作系统开发中非常有用的部分。操作系统经常发现自己无事可做,以及必须要延迟。在这个例子中,我们想去做等待,为了能够让这种等待可以看得见,让 LED 灯打开关闭闪烁起来。如果你只是打开和关闭它,你什么都看不到,因为计算机每秒种可以打开和关闭它好几千次。在后面的课程中,我们将看到精确的等待,但是现在,我们只要简单地去消耗时间就足够了。 + +``` +mov r2,#0x3F0000 +wait1$: +sub r2,#1 +cmp r2,#0 +bne wait1$ +``` + +``` +sub reg,#val 从寄存器 reg 中的值上减去数字 val + +cmp reg,#val 将寄存器中的值与数字 val 进行比较。 + +如果最后的比较结果是不相等,那么执行后面的 ne 命令。 +``` + +上面是一个很常见的产生延迟的代码片段,由于每个树莓派基本上是相同的,所以产生的延迟大致也是相同的。它的工作原理是,使用一个 `mov` 命令将值 3F000016 推入到寄存器 r2 中,然后将这个值减 1,直到这个值减到 0 为止。在这里使用了三个新命令 `sub`、 `cmp` 和 `bne`。 + +`sub` 是减法命令,它只是简单地从第一个参数中的值减去第二个参数中的值。 + +`cmp` 是个很有趣的命令。它将第一个参数与第二个参数进行比较,然后将比较结果记录到一个称为当前处理器状态寄存器的专用寄存器中。你其实不用担心它,它记住的只是两个数谁大或谁小,或是相等而已。[^1] + +`bne` 其实是一个伪装的分支命令。在 ARM 汇编语言家族中,任何指令都可以有条件运行。这意味着如果上一个比较结果是某个确定的结果,那个指令才会运行。这是个非常有意思的技巧,我们在后面将大量使用到它,但在本案例中,我们在 `b` 命令后面的 ne 后缀意思是 “只有在上一个比较的结果是值不相等,才去运行分支”。`ne` 后缀可以使用在任何命令上,其它几个(总共 16 个)条件也是如此,比如 `eq` 表示等于,而 `lt` 表示小于。 + +### 2、组合到一起 + +上一节讲我提到过,通过将 GPIO 地址偏移量设置为 28(即:str r1,[r0,#28])而不是 40 即可实现 LED 的关闭。因此,你需要去修改课程 OK01 的代码,在打开 LED 后,运行等待代码,然后再关闭 LED,再次运行等待代码,并包含一个回到开始位置的分支。注意,不需要重新启用 GPIO 的 16 号针脚的输出功能,这个操作只需要做一次就可以了。如果你想更高效,我建议你复用 r1 寄存器的值。所有课程都一样,你可以在 [下载页面][2] 找到所有的解决方案。需要注意的是,必须保证你的所有标签都是唯一的。当你写了 wait1\$: 你其它行上的标签就不能再使用 wait1\$ 了。 + +在我的树莓派上,它大约是每秒闪两次。通过改变我们所设置的 r2 寄存器中的值,可以很轻松地修改它。但是,不幸的是,我不能够精确地预测它的运行速度。如果你的树莓派未按预期正常工作,请查看我们的故障排除页面,如果它正常工作,恭喜你。 + +在这个课程中,我们学习了另外两个汇编命令:`sub` 和 `cmp`,同时学习了 ARM 中如何实现有条件运行。 + +在下一个课程,[课程 3:OK03][3] 中我们将学习如何编写代码,以及建立一些代码复用的标准,并且如果需要的话,可能会使用 C 或 C++ 来写代码。 + +[^1]:如果你点了这个链接,说明你一定想知道它的具体内容。CPSR 是一个由许多独立的比特位组成的 32 比特寄存器。它有一个位用于表示正数、零和负数。当一个 cmp 指令运行后,它从第一个参数上减去第二个参数,然后用这个位记下它的结果是正数、零还是负数。如果是零意味着它们相等(a-b=0 暗示着 a=b)如果为正数意味着 a 大于 b(a-b>0 暗示着 a>b),如果为负数意味着小于。还有其它比较指令,但 cmp 指令最直观。 + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/ok01.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html From af89eac88312eb054a9641718b223a21b07edda3 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 19 Jan 2019 17:44:49 +0800 Subject: [PATCH 0667/4278] Translating by qhwdw --- sources/tech/20190114 How to Build a Netboot Server, Part 4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md b/sources/tech/20190114 How to Build a Netboot Server, Part 4.md index aadd3c0b01..3b5286df03 100644 --- a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md +++ b/sources/tech/20190114 How to Build a Netboot Server, Part 4.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fe05ce92b863bfae22ea6f3148fdb8df66063c98 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 21:52:56 +0800 Subject: [PATCH 0668/4278] PRF:20171119 The Ruby Story.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @wwhio 我做了一个初校,请复审看看是否有问题。 --- translated/talk/20171119 The Ruby Story.md | 63 +++++++++++----------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md index bf370f00e6..b0eb05d447 100644 --- a/translated/talk/20171119 The Ruby Story.md +++ b/translated/talk/20171119 The Ruby Story.md @@ -1,19 +1,19 @@ -The Ruby Story +红宝石(Ruby)史话 ====== -尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,赋予了程序员灵活的表达freedom to express,虽然这可能会让代码变复杂、程序不直观。 -Ruby 社区一直将灵活表达freedom of expression视为其核心价值。可我不认同这对于 Ruby 的开发和普及是最重要的。一个人创建一门编程语言也许是为了更高的性能,也许是为了在抽象上节省更多的时间,可 Ruby 就有趣在它并不关心这些,从它诞生之初,它的目标就是让程序员更快乐。 +尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,赋予了程序员表达自我的根本自由,虽然这可能会让代码变复杂,编写出来的程序对其他人来说不直观。 -### 松本 行弘 +Ruby 社区一直将灵活表达freedom of expression视为其核心价值。可我不认同这对于 Ruby 的开发和普及是最重要的。创建一门编程语言也许是为了更高的性能,也许是为了在抽象上节省更多的时间,可 Ruby 就有趣在它并不关心这些,从它诞生之初,它的目标就是让程序员更快乐。 -松本行弘Yukihiro Matsumoto,也叫 “Matz”,于 1990 年毕业于筑波大学。筑波是东京东北方向上的一个小城市,是科学研究与技术开发的中心之一。那里的筑波大学以其 STEM 计划广为流传。松本行弘就在筑波大学的信息科学专业学习过,且专攻编程语言。他也在 Ikuo Nakata 的编程语言实验室工作过。 -(LCTT译注:STEM是科学(Science),技术(Technology),工程(Engineering),数学(Mathematics)四门学科英文首字母的缩写。) +### 松本·行弘 + +松本·行弘Yukihiro Matsumoto,亦称为 “Matz”,于 1990 年毕业于筑波大学。筑波是东京东北方向上的一个小城市,是科学研究与技术开发的中心之一。筑波大学以其 STEM 计划广为流传。松本·行弘在筑波大学的信息科学专业学习过,且专攻编程语言。他也在 Ikuo Nakata 的编程语言实验室工作过。(LCTT 译注:STEM 是科学Science技术Technology工程Engineering数学Mathematics四门学科英文首字母的缩写。) 松本从 1993 年开始制作 Ruby,那时他才刚毕业几年。他制作 Ruby 的起因是觉得那时的脚本语言缺乏一些特性。他在使用 Perl 的时候觉得这门语言过于“玩具”,此外 Python 也有点弱,用他自己的话说: -> 我那时就知道 Python 了,但我不喜欢它,因为我认为这不是一门真正的面向对象的语言。面向对象就像是 Python 的一个附件。作为一个编程语言狂热者,我在 15 年里一直是面向对象的忠实粉丝。我真的想要一门生来就面向对象而且易用的脚本语言。我为此特地寻找过,可事实并不如愿。 +> 我那时就知道 Python 了,但我不喜欢它,因为我认为它不是一门真正的面向对象的语言。面向对象就像是 Python 的一个附件。作为一个编程语言狂热者,我在 15 年里一直是面向对象的忠实粉丝。我真的想要一门生来就面向对象而且易用的脚本语言。我为此特地寻找过,可事实并不如愿。[^1] -所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好的,而且面向对象的 Perl 版本。 +所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好的,而且面向对象版的 Perl。 但在其他场合,松本说他创造 Ruby 主要是为了让他自己和别人更快乐。2008 年,松本在谷歌技术讲座结束时放映了这张幻灯片: @@ -21,50 +21,53 @@ Ruby 社区一直将灵活表达freedom of expression视 他对听众说到, -> 我希望 Ruby 能帮助世界上的每一个程序员更有效率地工作,享受编程并感到快乐。这也是制作 Ruby 语言的主要意图。 +> 我希望 Ruby 能帮助世界上的每一个程序员更有效率地工作,享受编程并感到快乐。这也是制作 Ruby 语言的主要意图。[^2] -松本开玩笑的说他制作 Ruby 的原因很自私,因为他觉得其他的语言乏味,所以需要创造一点让自己开心的东西。 +松本开玩笑的说他制作 Ruby 的原因很自私,因为他觉得其它的语言乏味,所以需要创造一点让自己开心的东西。 -这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教徒,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 +这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教徒践行者,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 -Ruby 主要受到 Perl 的印象。Perl 则是由 Larry Wall 与 20 世纪 80 年代晚期创造的语言,主要用于处理和转换基于文本的数据。Perl 因其文本处理和正则表达式而闻名于世。对于 Ruby 程序员,Perl 程序中的很多语法元素都不陌生,例如符号`$`、符号`@`、`elsif`等等。虽然我觉得,这些不是 Ruby 应该具有的特征。除了这些符号外,Ruby 还借鉴了 Perl 中的正则表达式和标准库。 +Ruby 主要受到 Perl 的影响。Perl 则是由 Larry Wall 于 20 世纪 80 年代晚期创造的语言,主要用于处理和转换基于文本的数据。Perl 因其文本处理和正则表达式而闻名于世。对于 Ruby 程序员,Perl 程序中的很多语法元素都不陌生,例如符号 `$`、符号 `@`、`elsif` 等等。虽然我觉得,这些不是 Ruby 应该具有的特征。除了这些符号外,Ruby 还借鉴了 Perl 中的正则表达式的处理和标准库。 -但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本使用过运行在 Emacs Lisp 上的邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本说 Ada 和 Eiffel 也影响了 Ruby 的设计。 +但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本就完全用 Emacs Lisp 写过一个邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 底层的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本也表示过 Ada 和 Eiffel 也影响了 Ruby 的设计。 -当时间来到了给这门新语言命名的时候,松本和它的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段聊天记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby ,因为他就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的诞生石,而 Peral珍珠 则是 6 月的诞生石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。 -(LCTT译注:Perl 和 Pearl 发音相同;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关诞生石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) +当时间来到了给这门新语言命名的时候,松本和他的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段非常值得一读的即时消息记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby,因为它就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的生辰石,而 Pearl珍珠 则是 6 月的生辰石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。(LCTT 译注:Perl 和 Pearl 发音相同,所以也常以“珍珠”来借喻 Perl;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关生辰石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) -### Ruby 走向西方 +### Ruby 西渐 -Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询基团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,仅仅在 Ruby 发布 5 年后,Ruby 在日本的流行度就超过了 Python。可这是的 Ruby 从刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在日语邮件的列表,但是英语邮件的列表直到 1998 年才建立起来。而且起初在英语邮件的列表里交流的大多是日本的 Ruby 狂热者,但这一问题随着 Ruby 在西方国家的普及而逐渐得以改善。 +Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询财团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,在 Ruby 发布仅仅 5 年后,Ruby 在日本的流行度就超过了 Python。可这时的 Ruby 才刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在讨论它的日语邮件列表,但是英语的邮件列表直到 1998 年才建立起来。而且起初英语的邮件列表是用于日本的 Ruby 狂热者用英语交流的,但这一情况随着 Ruby 的普及而逐渐得以改变。 -在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。是它第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语邮件列表的流量超过了日语邮件列表。 +在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。这是第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语的 Ruby 邮件列表的通信超过了原来的日语邮件列表。 -时间来到了 2005 年,Ruby 更流行了,但它任然不是主流的编程语言。然而,Ruby on Rails 的发布让一切都不一样了。Ruby on Rails 是 Ruby 的“杀手应用”,没有别的什么项目比它更能推动 Ruby 的普及了。在 Ruby on Rails 发布后,人们对 Ruby 的兴趣爆发式的增长,看看 TIOBE 监测的语言排行: +时间来到了 2005 年,Ruby 更流行了,但它仍然不是主流的编程语言。然而,Ruby on Rails 的发布让一切都不一样了。Ruby on Rails 是 Ruby 的“杀手级应用”,没有别的什么项目能比它更推动 Ruby 的普及了。在 Ruby on Rails 发布后,人们对 Ruby 的兴趣爆发式的增长,看看 TIOBE 监测的语言排行: ![][3] -有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为 Rails 开发需要 Ruby,Ruby 在西方是随着 Rails 的发布才普及开的。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 +有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为 Ruby 被人所熟知是因为它是人们写 Rails 应用时用的语言。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 -Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之父 David Heinemeier Hansson 常常提起他第一次与 Ruby 的接触的情形,那简直就是一次传教。他说,那经历简直太有感召力了,让他感到要为松本的杰作(指 Ruby)“传教”的使命。对于 Hansson 来说,Ruby 的灵活性简直就是对 Python 或 Java 语言中自上而下的设计哲学的反抗。他很欣赏 Ruby 这门能够信任自己的语言,Ruby 赋予了他自由选择程序表达方式express his programs的权力。 +Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之父 David Heinemeier Hansson 常常提起他第一次与 Ruby 的接触的情形,那简直就是一次传教。他说,那种经历简直太有感召力了,让他感受到要为松本的杰作(指 Ruby)“传教”的使命。[^3] 对于 Hansson 来说,Ruby 的灵活性简直就是对 Python 或 Java 语言中自上而下的设计哲学的反抗。他很欣赏 Ruby 这门能够信任自己的语言,Ruby 赋予了他自由选择程序表达方式express his programs的权力。 -就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非传统的功能,例如“Inflector”类和 `Time` 扩展("Inflector"类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 +就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非正统的功能,例如 “Inflector” 类和 `Time` 扩展(“Inflector”类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 -因此,Rails 不但是 Ruby 的一个普及度很高的应用,而且体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails 的替代品,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法macro-like class method来实现模型关联的功能这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 +因此,虽然 Rails 看起来是一个偶然使 Ruby 更流行的应用,但事实上它体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法调用macro-like class method calls来实现模型关联这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 -### Ruby 的未来 +### Ruby 之未来 -人们似乎对 Ruby 是否正在灭亡有着异常的兴趣。早在 2011 年,Stack Overflow 和 Quora 上就有程序员在咨询“如果几年后不在使用 Ruby 那么现在是否有必要学它”。这些担忧对 Ruby 并不合理,虽然在 TIOBE 指数和 Stack Overflow 趋势上,Ruby 和 Ruby on Rails 的人气在萎缩,可它也曾是新兴的、热门的技术,但在更新更热的框架面前,排名自然会有所下降。 +人们似乎对 Ruby(及 Ruby on Rails)是否正在消亡有着异常的兴趣。早在 2011 年,Stack Overflow 和 Quora 上就充斥着程序员在咨询“如果几年后不再使用 Ruby 那么现在是否有必要学它”的话题。这些担忧对 Ruby 并非没有道理,根据 TIOBE 指数和 Stack Overflow 趋势,Ruby 和 Ruby on Rails 的人气一直在萎缩,虽然它也曾是热门新事物,但在更新更热的框架面前它已经黯然失色。 -一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这使出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而它创造的目的正是为了保证客户端运行的代码能收益于编译所提供的安全保障。 +一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类型的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这使得出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而创造它的目的正是为了保证客户端运行的代码能受益于编译所提供的安全保障。 -我认为另一个原因可能是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以用 Go、Javascript 或者 Python 上的各种优秀的框架,而这还仅仅是主流的选择。 Web 的世界似乎正走向更加分布式的结构,与其使用一个代码仓库来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组建,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻与 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 +我认为另一个更可能的原因是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以使用为 Go、Javascript 或者 Python 开发的各种优秀的框架,而这还仅仅是主流的选择。Web 的世界似乎正走向更加分布式的结构,与其使用一块代码来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组件,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻于 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 总而言之,我们有理由对 Ruby 的未来持乐观态度。因为不管是 Ruby 还是 Rails 的开发都还很活跃。松本和其他的贡献者们都在努力开发 Ruby 的第三个主要版本。新的版本将比现在的版本快上 3 倍,以减轻制约着 Ruby 发展的性能问题。虽然从 2005 年起,越来越多的 Web 框架被开发出来,但这并不意味着 Ruby on Rails 就失去了其生存空间。Rails 是一个富有大量功能的成熟的工具,对于一些特定类型的应用开发一直是非常好的选择。 -但就算 Ruby 和 Rails 走上了灭亡的道路,Ruby 让程序员更快乐的信条一定会存活下来。Ruby 已经深远的影响了许多新的编程语言的设计,这些语言的设计中能够看到来自 Ruby 的很多理念。而其他的新生语言则试着变成 Ruby 更现代的实现,例如 Elixir 是一个强调函数式编程的语言,仍在开发中的 Crystal 目标是成为使用静态类型的 Ruby 。世界上许多程序员都喜欢上了 Ruby,因此它的影响必将会在未来持续很长一段时间。 +但就算 Ruby 和 Rails 走上了消亡的道路,Ruby 让程序员更快乐的信条一定会存活下来。Ruby 已经深远的影响了许多新的编程语言的设计,这些语言的设计中能够看到来自 Ruby 的很多理念。而其他的新生语言则试着变成 Ruby 更现代的实现,例如 Elixir 是一个强调函数式编程范例的语言,仍在开发中的 Crystal 目标是成为使用静态类型的 Ruby 。世界上许多程序员都喜欢上了 Ruby 及其语法,因此它的影响必将会在未来持续很长一段时间。 -喜欢吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][4] 或者订阅我们的 [RSS][5],这样新文章发布的第一时间你就能得到通知。 +喜欢这篇文章吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][4] 或者订阅我们的 [RSS][5],这样新文章发布的第一时间你就能得到通知。 + +[^1]: http://ruby-doc.org/docs/ruby-doc-bundle/FAQ/FAQ.html +[^2]: https://www.youtube.com/watch?v=oEkJvvGEtB4?t=30m55s +[^3]: http://rubyonrails.org/doctrine/ -------------------------------------------------------------------------------- @@ -73,7 +76,7 @@ via: https://twobithistory.org/2017/11/19/the-ruby-story.html 作者:[Two-Bit History][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 305094e9e180d0b79b490aa872a4f564e52dfa33 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 19 Jan 2019 22:21:34 +0800 Subject: [PATCH 0669/4278] Translated Translated: Dawn of the Microcomputer- The Altair 8800 --- ...n of the Microcomputer- The Altair 8800.md | 128 ---------------- ...n of the Microcomputer- The Altair 8800.md | 141 ++++++++++++++++++ 2 files changed, 141 insertions(+), 128 deletions(-) delete mode 100644 sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md create mode 100644 translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md diff --git a/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md deleted file mode 100644 index 9974ac6352..0000000000 --- a/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md +++ /dev/null @@ -1,128 +0,0 @@ -zhs852 is translating. - -Dawn of the Microcomputer: The Altair 8800 -====== -Subscribers to Popular Electronics were a sophisticated group. The magazine’s editor, Arthur Salsberg, felt compelled to point out as much in the editorial section of the [December 1974 issue][1]. The magazine had received letters complaining that a recent article, titled “How to Set Up a Home TV Service Shop,” would inspire a horde of amateur TV technicians to go out and undercut professional repairmen, doing great damage to everyone’s TVs in the process. Salsberg thought this concern was based on a misunderstanding about who read Popular Electronics. He explained that, according to the magazine’s own surveys, 52% of Popular Electronics subscribers were electronics professionals of some kind and 150,000 of them had repaired a TV in the last 60 days. Moreover, the average Popular Electronics subscriber had spent $470 on electronics equipment ($3578 in 2018) and possessed such necessities as VOMs, VTVMs, tube testers, transistor testers, r-f signal generators, and scopes. “Popular Electronics readers are not largely neophytes,” Salsberg concluded. - -I am surprised that anyone familiar with Popular Electronics could ever have doubted its subscribers. I certainly haven’t repaired a TV in the last 60 days. My computer is a block of aluminum that I have never seen the inside of. Yet the December 1974 issue of Popular Electronics features articles such as “Standing Wave Ratio: What It Is and How to Deal with It” and “Test Scene: Uses for Your Multimeter.” Even the ads are intimidating. One of them, which seems to be for some kind of stereo system, boldly proclaims that “no piece of audio equipment is as eagerly awaited as the ‘one four-channel unit that does everything—i.e. the receiver with built-in circuitry for SQ, RM and CD-4 record decoding.’” The mere hobbyists subscribed to Popular Electronics, let alone the professionals, must have been very knowledgeable indeed. - -But Popular Electronics readers were introduced to something in the [January 1975 issue][2] that they had never encountered before. Below a heading that read “PROJECT BREAKTHROUGH,” the magazine’s cover showed a large gray and black box whose front panel bore a complicated array of lights and toggles. This was the Altair 8800, the “world’s first minicomputer kit to rival commercial models,” available for under $400. Though advertised as a “minicomputer,” the Altair would actually be the first commercially successful member of a new class of computers, first known as “microcomputers” and then eventually as PCs. The Altair was small enough and cheap enough that the average family could have one at home. Its appearance in Popular Electronics magazine meant that, as Salsberg wrote in that issue, “the home computer age is here—finally.” - -![January 1975 cover of Popular Electronics][3] - -I have written briefly about [the Altair before][4], but I think the Altair is worth revisiting. It was not an especially powerful computer compared to others available at the time (though it cost significantly less money). Nor was it the first general-purpose computer to incorporate a microprocessor chip—at least three microprocessor-based computers preceded it. But the Altair was and is a kind of Ur-Computer for all of us. It was the first popular computer in a lineage that includes our own devices, whereas the mainframes and bulky minicomputers that predated the Altair were an entirely different kind of machine, programmed by punched card or else rarely interacted with directly. The Altair was also a radically simple computer, without any kind of operating system or even a bootloader. Unless you bought peripherals for it, the Altair was practically a bank of RAM with switches and lights on the front. The Altair’s simplicity makes learning about it a great way to reacquaint yourself with the basic concepts of computing, exactly as they were encountered by the denizens of the old analog world as they first ventured into our digital one. - -### Roberts and Co. - -The Altair was designed and manufactured by a company called Micro Instrumentation and Telemetry Systems (MITS), based in Albuquerque, New Mexico. MITS was run by a man named H. Edward Roberts. The company had started off making telemetry systems for model rocket kits before moving into the calculator market, which in the early 1970s was booming. Integrated circuits were bringing the cost of a calculator down dramatically and suddenly every working American professional had to have one. But the calculator market was ruthlessly competitive and, by the beginning of 1974, MITS was deeply in debt. - -The year 1974 would prove to be an “annus mirabilis” in computing. In January, Hewlett-Packard introduced the HP-65, the world’s first programmable handheld calculator. In April, Intel released the Intel 8080, its second 8-bit microprocessor and the first microprocessor to become widely popular. Then, in July, Radio Electronics magazine advertised a build-it-yourself minicomputer called the Mark-8, which employed the Intel 8008 microprocessor that Intel had released in 1972. The Mark-8 was only the third computer ever built using a microprocessor and it was the first to be appear on the cover of a magazine. The Mark-8’s appearance in Radio Electronics pushed Popular Electronics to look for a minicomputer project of their own to feature. - -Popular Electronics subscribers actually received their copies of the January 1975 issue in the mail in December of 1974. So the announcement of the Altair closed out the “annus mirabilis” that was that year. The Altair’s introduction was so momentous because never before had such a fully capable computer been offered to the public at an affordable price. The PDP-8, one the most popular minicomputers at the time, could only be bought for several thousand dollars. Yet the Intel 8080 chip at the heart of the Altair made it almost as capable as the PDP-8, if not more so; the 8080 supported a wider instruction set and the Altair could be expanded to have up to 64kb of memory, while the stock PDP-8 typically only had 4kb. The Altair was also more powerful than the Mark-8, which, because it was based on the Intel 8008, could only address 16kb of memory. And whereas the Mark-8 had to be built from scratch by customers with only a booklet and printed circuit boards to guide them, the Altair could be purchased fully assembled, though MITS soon became so inundated with orders that the only real way to get an Altair was to order the construction kit. - -For many Popular Electronics readers, the Altair was their first window into the world of digital computing. The article introducing the Altair in the January 1975 issue was written by Roberts and the Altair’s co-designer, William Yates. Roberts and Yates took pains to explain, in terms familiar to the electricians and radio enthusiasts in their audience, the basic concepts underlying digital hardware and computer programming. “A computer,” they wrote, “is basically a piece of variable hardware. By changing the bit pattern stored in the memory, the hardware can be altered from one type of device to another.” Of programming, meanwhile, Roberts and Yates wrote that the basic concepts are “simple enough to master in a relatively short time,” but that becoming “an efficient programmer requires a lot of experience and a large amount of creativity,” which sounds about right to me. The article included a detailed diagram explaining all the constituent circuits of the Intel 8080 CPU, even though readers would receive at least that part fully assembled. It explained the difference between a CPU and a computer’s memory unit, the uses of a stack pointer, and the enormous advantages offered by assembly languages and higher-level languages like FORTRAN and BASIC over manual entry of machine code. - -Popular Electronics had in fact been running a series written by Roberts for several issues before January 1975. The series was billed as a short course in “digital logic.” In the December 1974 issue, Roberts walked readers through building a “very low cost computer terminal,” which was basically an octal keypad that could input values into an 8-bit computer. In the course of describing the keypad, Roberts explained how transistor-to-transistor logic works and also how to construct a flip-flop, a kind of circuit capable of “remembering” digital values. The keypad, Roberts promised, could be used with the Altair computer, to be announced the following month. - -It’s unclear how many Popular Electronics readers actually built the keypad, but it would have been a very useful thing to have. Without a keypad or some other input mechanism, the only way to input values into the Altair was through the switches on the front panel. The front panel had a row of 16 switches that could be used to set an address and a lower row of eight switches that could be used to control the operation of the computer. The eight right-most switches in the row of 16 could also be used to specify a value to be stored in memory. This made sense because the Intel 8080 used 16-bit values to address 8-bit words. The 16 switches on the front panel each represented a bit—the up position represented a one, while the down position represented a zero. Interacting with a computer this way is a revelation (more on that in a minute), because the Altair’s front panel is a true binary interface. It’s as close as you can get to the bare metal. - -As alien as the Altair’s interface is to us today, it was not unusual for its time. The PDP-8, for example, had a similar binary input mechanism on its front panel, though the PDP-8’s switches were nicer and colored in that attractive orange and yellow color scheme that really ought to make a comeback. The PDP-8, however, was often paired with a paper-tape reader or a teletype machine, which made program entry much easier. These I/O devices were expensive, meaning that most Altair users in the early days were stuck with the front panel. As you might imagine, entering long programs via the switches was a chore. Eventually the Altair could be hooked up to a cassette recorder and programs could be loaded that way. Bill Gates and Paul Allen, in what would become Microsoft’s first ever commercial venture, also wrote a version of BASIC for the Altair that MITS licensed and released in the middle of 1975. Users that could afford a teletype could then [load BASIC into the Altair via paper tape][5] and interact with their Altair through text. BASIC, which had become everyone’s favorite introductory programming language in schools, would go on to become the standard interface to the machines produced in the early microcomputer era. - -### z80pack - -Thanks to the efforts of several internet people, in particular a person named Udo Munk, you can run a simulation of the Altair on your computer. The simulation is built on top of some software that emulates the Zilog Z80 CPU, a CPU designed to be software-compatible with the Intel 8080. The Altair simulation allows you to input programs entirely via the front panel switches like early users of the Altair had to do. Though clicking on switches does not offer the same tactile satisfaction as flipping real switches, playing with the Altair simulation is a great way to appreciate how a binary human/computer interface was both horribly inefficient and, at least in my opinion, charmingly straightforward. - -z80pack, Udo Munk’s Z80 emulation package, can be downloaded from the z80pack website. There are instructions in [my last Altair post][4] explaining how to get it set up on Mac OS. If you are able to compile both the FrontPanel library and the `altairsim` executable, you should be able to run `altairsim` and see the following window: - -![Simulated Altair Front Panel][6] - -By default, at least with the version of z80pack that I am using (1.36), the Altair is configured with something called Tarbell boot ROM, which I think is used to load disk images. In practice, what this means is that you can’t write values into the first several words in RAM. If you edit the file `/altairsim/conf/system.conf`, you can instead set up a simple Altair that has 16 pages of RAM and no ROM or bootloader software at all. You can also use this configuration file to increase the size of the window the simulation runs in, which is handy. - -The front panel of the Altair is intimidating, but in reality there isn’t that much going on. The [Altair manual][7] does a good job of explaining the many switches and status lights, as does this [YouTube video][8]. To enter and run a simple program, you only really need to know a few things. The lights labeled D0 through D7 near the top right of the Altair indicate the contents of the currently addressed word. The lights labeled A0 through A15 indicate the current address. The 16 switches below the address lights can be used to set a new address; when the “EXAMINE” switch is pressed upward, the data lights update to show the contents of the newly addressed word. In this way, you can “peek” at all the words in memory. You can also press the “EXAMINE” switch down to the “EXAMINE NEXT” position, which automatically examines the next memory address, which makes peeking at sequential words significantly easier. - -To save a bit pattern to a word, you have to set the bit pattern using the right-most eight switches labeled 0 through 7. You then press the “DEPOSIT” switch upward. - -In the [February 1975 issue][9] of Popular Electronics, Roberts and Yates walked Altair owners through inputting a small sample program to ensure that their Altair was functioning. The program loads two integers from memory, adds them, and saves the sum back into memory. The program consists of only six instructions, but those six instructions involve 14 words of memory altogether, which takes some time to input correctly. The sample program also appears in the Altair manual in table form, which I’ve reproduced here: - -Address Mnemonic Bit Pattern Octal Equivalent 0 LDA 00 111 010 0 7 2 1 (address) 10 000 000 2 0 0 2 (address) 00 000 000 0 0 0 3 MOV B, A 01 000 111 1 0 7 4 LDA 00 111 010 0 7 2 5 (address) 10 000 001 2 0 1 6 (address) 00 000 000 0 0 0 7 ADD B 10 000 000 2 0 0 8 STA 00 110 010 0 6 2 9 (address) 10 000 010 2 0 2 10 (address) 00 000 000 0 0 0 11 JMP 11 000 011 3 0 3 12 (address) 00 000 000 0 0 0 13 (address) 00 000 000 0 0 0 - -If you input each word in the above table into the Altair via the switches, you end up with a program that loads the value in word 128, adds it to the value in the word 129, and finally saves it into word 130. The addresses that accompany each instruction taking an address are given with the least-significant bits first, which is why the second byte is always zeroed out (no addresses are higher than 255). Once you’ve input the program and entered some values into words 128 and 129, you can press the “RUN” switch into the down position briefly before pushing it into the “STOP” position. Since the program loops, it repeatedly adds those values and saves the sum thousands of times a second. The sum is always the same though, so if you peek at word 130 after stopping the program, you should find the correct answer. - -I don’t know whether any regular users of the Altair ever had access to an assembler, but z80pack includes one. The z80pack assembler, `z80asm`, is meant for Z80 assembly, so it uses a different set of mnemonics altogether. But since the Z80 was designed to be compatible with software written for the Intel 8080, the opcodes are all the same, even if the mnemonics are different. So just to illustrate what it might have been like to write the same program in assembly, here is a version that can be assembled by `z80asm` and loaded into the Altair: - -``` - ORG 0000H -START: LD A,(80H) ;Load from address 128. - LD B,A ;Move loaded value from accumulator (A) to reg B. - LD A,(81H) ;Load from address 129. - ADD A,B ;Add A and B. - LD (82H),A ;Store A at address 130. - JP START ;Jump to start. -``` - -You can turn this into something called an Intel HEX file by invoking the assembler like so (after you have compiled it): - -``` -$ ./z80asm -fh -oadd.hex add.asm -``` - -The `-f` flag, here taking `h` as an argument, specifies that a HEX file should be output. You can then load the program into the Altair by passing the HEX file in using the `-x` flag: - -``` -$ ./altairsim -x add.hex -``` - -This sets up the first 14 words in memory as if you had input the values manually via the switches. Instead of doing all that again, you can just run the program by using the “RUN” switch as before. Much easier! - -As I said, I don’t think many Altair users wrote software this way. Once Altair BASIC became available, writing BASIC programs was probably the easiest way to program the Altair. z80pack also includes several HEX files containing different versions of Altair BASIC; the one I’ve been able to get working is version 4.0 of 4K BASIC, which you can load into the simulator like so: - -``` -$ ./altairsim -x basic4k40.hex -``` - -If you turn the simulated machine on and hit the “RUN” switch, you should see that BASIC has started talking to you in your terminal window. It first prompts you to enter the amount of memory you have available, which should be 4000 bytes. It then asks you a few more questions before presenting you with the “OK” prompt, which Gates and Allen used instead of the standard “READY” to save memory. From there, you can just use BASIC: - -``` -OK -PRINT 3 + 4 - 7 -``` - -Though running BASIC with only 4kb of memory didn’t give you a lot of room, you can see how it would have been a significant step up from using the front panel. - -The Altair, of course, was nowhere near as capable as the home desktops and laptops we have available to us today. Even something like the Macintosh, released less than a decade later, seems like a quantum leap forward over the spartan Altair. But to those first Popular Electronics readers that bought the kit and assembled it, the Altair was a real, fully capable computer that they could own for themselves, all for the low cost of $400 and half the surface space of the credenza. This would have been an amazing thing for people that had thus far only been able to interact with computers by handing [a stack of cards][10] or a roll of tape to another human being entrusted with the actual operation of the computer. Subsequent microcomputers would improve upon what the Altair offered and quickly become much easier to use, but they were all, in some sense, just more complicated Altairs. The Altair—almost Brutalist in its minimalism—was the bare-essentials blueprint for all that would follow. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][11] on Twitter or subscribe to the [RSS feed][12] to make sure you know when a new post is out. - -Previously on TwoBitHistory… - -> "I invite you to come along with me on an exciting journey and spend the next ten minutes of your life learning about a piece of software nobody has used in the last decade." -> -> — TwoBitHistory (@TwoBitHistory) [July 7, 2018][13] - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1974/Poptronics-1974-12.pdf -[2]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-01.pdf -[3]: https://twobithistory.org/images/jan1975-altair.jpg -[4]: https://twobithistory.org/2017/12/02/simulating-the-altair.html -[5]: https://www.youtube.com/watch?v=qv5b1Xowxdk -[6]: https://www.autometer.de/unix4fun/z80pack/altair.png -[7]: http://www.classiccmp.org/dunfield/altair/d/88opman.pdf -[8]: https://www.youtube.com/watch?v=suyiMfzmZKs -[9]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-02.pdf -[10]: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html -[11]: https://twitter.com/TwoBitHistory -[12]: https://twobithistory.org/feed.xml -[13]: https://twitter.com/TwoBitHistory/status/1015647820353867776?ref_src=twsrc%5Etfw diff --git a/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md new file mode 100644 index 0000000000..d6ae8689bf --- /dev/null +++ b/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md @@ -0,0 +1,141 @@ +微型计算机的始祖:Altair 8800 +====== +《大众电子》的订阅者是个复杂的群体,杂志编辑 Arthur Salsberg 不得不在 [1974 年 12 月刊][1] 中的前言部分指出这点。此前,杂志编辑组曾收到了对《如何搭建家庭媒体中心》文章的抱怨,称这篇文章激励了许多业余电视爱好者走出去,削弱了专业修理人员存在的必要性,这对许多人的电视造成了极大伤害。Salsberg 认为,这个担忧的产生可能是因为大家不清楚《大众电子》读者们的真实水平。他解释道,杂志内部调查的数据显示,52 % 的订阅者都是某方面的电子专家,并且其中的 150,000 人在最近 60 天之内都修过电视。此外,订阅者们平均在电子产品上花费了 470 美金(2018 年则是 3578 美金),并且他们有对万用表、真空管伏特计、电子管测试仪、晶体管测试仪、射频讯号产生器和示波器的需求。“《大众电子》的读者们并不全都是新手。”Salsberg 总结道。 + +熟悉《大众电子》的人居然会质疑它的订阅者,这令我十分吃惊。不过最近 60 天我的确没修过电视。我的电脑对我来说就是一块铝,我甚至没把它拆开看过。1974 年 12 月的《大众电子》刊登的像《驻波比是什么以及如何处理它》和《对万用表的测试》之类的特色文章,甚至连广告都令人生畏。它们中有个看起来像某种立体声系统的东西大胆地写道“除了‘四通道单元(即内建的 SQ、RM 和 CD-4 解码接收器)’,没有任何音频设备是被期待的”。这也表明了《大众电子》的订阅者一定对电子有很多深入的了解。 + +不过在 [1975 年 1 月刊][2] 中,杂志为读者们带来了一些他们从没见过的东西。在标题“发现项目”下面,杂志的封面是一个黑灰色的盒子,它的前面板上有一组开关和灯。这便是 Altair 8800,“世界上首个有商业竞争力的迷你计算机”,它的售价低于 400 美元。尽管 Altair 作为“迷你计算机”被宣传,但其实大家都将它称为“微机”和PC,它是首个商业上成功的新型电脑。Altair 十分小巧而且很便宜,以至于它成为了当时家家户户都能用起的电脑。正如 Salsberg 所写道,它在《大众电子》上的出现意味着:“家用电脑的时代终于到来了。” + +![《大众电子》1975 年 1 月刊的封面][3] + +此前,我曾写过 [关于 Altair 的文章][4],但我觉得 Altair 有让我再次介绍的价值。它在当时性能并不强(虽然它便宜很多),也不是首个装载微处理器(由至少三个微处理器组成)的通用计算机。但是 Altair 是一种可供我们所有人使用的计算机。它是历史上包括我们所拥有的设备中首台流行的计算机,早于 Altair 计算机都是完全不同的机器,它们由穿孔卡编程并且很少与用户交互。不过 Altair 也是台极其简单的计算机,它不附带任何操作系统甚至引导加载器。除非你购买其它外设,否则 Altair 就是一台装配 RAM 并且只有一组开关和灯泡的机器。由于 Altair 操作简单,学习计算的基本理论都成了十分简单的事情,就好像他们在数字世界冒险时遇上了旧世界的居民一样。 + +### Roberts 和他的公司 + +Altair 被一家名为 MITS 的公司设计和制造,这家公司位于美国新墨西哥州的阿尔布开克。MITS 由一个叫 H. Edward Roberts 运营。他们起初借 19 世纪 70 年代的热潮制造模型火箭的遥测系统。集成电路将计算器的成本降低到十分可观的数字,突然之间它就成了美国教授们的必需品。不幸的是,由于计算器市场竞争过于激烈,到了 1974 年,MITS 便负债累累。 + +1974 年在计算机界是奇迹迭出的一年annus mirabilis。一月的时候,惠普公司推出了世界首个可编程的手持计算器 HP-65。四月的时候,Intel 发布了 Intel 8080,他们的第二款 8 位微处理器,它也是首款受欢迎的微处理器。接着,六月的时候,《Radio Electronics》杂志介绍了 Mark-8 这个自制迷你计算机,它使用了 Intel 在 1972 年推出的 Intel 8008 微处理器。Mark-8 是使用微处理器搭建的第三台电脑,它的首次登场是在杂志的封面上。Mark-8 在《Radio Electronics》上的出现促使了《大众电子》寻找微机项目的出现。 + +《大众电子》的订阅者们其实早在 1974 年 12 月就通过电邮获得了 1975 年 1 月刊的副本。他们公布的 Altair 为这个奇迹迭出的一年annus mirabilis画上了圆满的句号。Altair 的出现是十分重要的,因为此前从未有过向公众提供的价格公道而又功能齐全的电脑。当时,作为最受欢迎的迷你计算机之一的 PDP-8 要几千美金才能买到。不过 Altair 搭载的 Intel 8080 芯片几乎能与 PDP-8 匹敌;8080 支持更广泛的指令集,而且 Altair 可以扩展到 64 kb 内存,显然强于仅有 4 kb 内存的 PDP-8。并且,Mark-8 也不是他的对手,因为它搭载的是只能处理 16 kb 内存的 Intel 8008。在 Mark-8 必须由用户按照说明书手动拼装的情况下,Altair 在购买时就已经被组装好了(不过由于后来 MITS 被大量订单淹没,最后真正能获得 Altair 的方式也只有买零件拼装了)。 + +对许多《大众电子》的读者来说,Altair 是他们了解数字计算的起点。1975 年 1 月刊上那篇介绍 Altair 的文章由 Roberts 和 Altair 的联合设计师 William Yates 所写。Roberts 和 Yates 煞费苦心地用电工和无线电狂热者们所熟悉的词汇来介绍了数字硬件和计算机编程的基本概念。他们写道:“一台计算机其实由一堆可变的硬件构成。仅需修改储存于内存之中的为组合形式,便可改变硬件设备的种类。”同时,Roberts 和 Yates 认为编程的基本概念是“足够简单并能在较短时间内掌握,但是想要成为一个高效的程序员必须经验丰富且富有创造力。”对此我十分认同。尽管已经组装好了,文章仍包含了用来讲解 Intel 8080 的组成的详细图表。文章解释了 CPU 和计算机内存单元的区别,堆栈指针的概念和汇编语言以及更高级的语言(例如 FORTRAN 和 BASIC)比起手动输入机器码所带来的巨大优势。 + +其实,《大众电子》在 1975 年 1 月刊之前就出版过 Roberts 撰写的系列文章。这一系列作为短期课程被收录在“数字逻辑”专栏中。在 1974 年 12 月刊中,Roberts 为读者们带来了关于构建“超低成本计算机终端”的文章,文章中介绍了可以用于 8 位电脑中输入值的八进制键盘。在介绍这个键盘时,Roberts 解释了晶体管到晶体管的逻辑工作原理,以及关于构建一种可以“记住”数字值的触发器的方法。Roberts 承诺说,这个键盘可以在下个月即将公布的 Altair 电脑中使用。 + +有多少《大众电子》的读者制作了这个键盘我们无从得知,但是那个键盘的确是个很有用的东西。如果没有键盘和其它输入设备,我们只能通过拨动 Altair 面板上的开关来输入值。Altair 的面板上有 16 行开关被用来设置地址,而下方的 8 个则是用来操作计算机的。16 行中最右边的开关是用来指定要储存在内存中的值的。这么做不无道理,因为 Intel 8080 使用 16 位的值来处理 8 位的信息。而这 16 个开关每一个都代表了一个位,当开关向上时代表 1,向下则代表 0。用这样的方式交互是个启示(一会儿我们就会讲到),因为 Altair 的面板是真正的二进制界面。这使得你可以触摸到裸露的金属。 + +尽管在当下 Altair 的界面对我们来说完全不像是人用的,不过在那个时候这可是不平凡的。比如 PDP-8 的面板上有个类似的但更漂亮的二进制输入装置,而且它被涂上了吸引人的黄色和橙色,不过讲真,它应该重新来过。然而 PDP-8 经常与纸带阅读器或电传打字机配合使用,这使得程序输入更加容易。这些 I/O 设备价格高昂,这意味着 Altair 的用户们大都会被面板卡住。正如你所想,通过这一堆开关进入一个大型程序是个繁重的工作。不过幸运的是,Altair 可以与盒式记录器连接,这样一来载入程序就不是什么难事了。Bill Gates 和 Paul Allen 进行了微软的首次商业合作,为 Altair 编写了 BASIC 语言,并在 1975 年以 MITS 许可证发行。此后,那些买得起电传打字机的用户就能 [通过纸带来将 BASIC 载入 Altair][5] 了,并能使得用户能够通过字符界面与 Altair 交互。之后,BASIC 便成为了学生们最爱的入门编程语言,并成了早期微机时代的标准接口。 + +### z80pack + +多亏了网络上一些人,特别是 Udo Munk 的努力,你可以在你的电脑上运行 Altair 的模拟器。这个模拟器是在 Zilog Z80 CPU 的虚拟套件上构建的,这个 CPU 可以运行 Intel 8080 的软件。Altair 模拟器允许你像 Altair 的用户们一样调整面板上的开关。尽管点击这些开关的感觉不如拨动真实开关,但是使用 Altair 模拟器仍是一个能让你知道二进制人机交互效率有多低的途径,不过我觉得这同时也很简明直观。 + +z80pack 是 Udo Munk 开发的 Z80 模拟器套件,你可以在 z80pack 的官网上找到它的下载链接。我在 [上一篇介绍 Altair 的文章中][4] 写到过在 macOS 上使用它的详细过程。如果你能编译 FrontPanel 库和 `altairsim` 可执行程序,你应该能直接运行 `altairsim` 并看到这个窗口: + +![模拟器中的 Altair 面板][6] + +在新版的 z80pack 中(比如我正在使用的 1.36 版本),你可以使用一个叫 Tarbell boot ROM 的功能,我觉得这是用来加载磁盘镜像的。经我测试,它的意思是你不能写入 RAM 中的前几个信息。在编辑 `/altairsim/conf/system.conf` 之后,你可以构建带有一个 16 页 RAM 且没有 ROM 或引导加载器的 Altair。除此之外,你还可以用这个配置文件来扩大运行模拟器的窗口,不得不说这还是挺方便的。 + +Altair 的面板看起来就很吓人,不过事实上并没有我们想象中的这么可怕。[Altair 说明书][7] 对解释开关和指示灯起到了很大的作用,这个 [YouTube 视频][8] 也是。若想运行一个简易的程序,你只需要了解一点点东西。Altair 右上方标签为 D0 到 D7 的指示灯代表当前处理地址的信息。标签为 A0 到 A15 的指示灯标识当前的地址。地址指示灯下的 16 个开关可以用来设置新地址;当 “EXAMINE” 开关被向上推动时,数据指示灯将会更新,并显示新地址上的内容。用这个功能,你便能观察到内存中所有的信息了。你也可以将 “EXAMINE” 推下来自动检查下一个位置上的信息,这使得检索信息更容易了。 + +要将模式保存到信息中,请使用最左边的 8 个标签为 0 到 7 的开关。然后,请向上推动 “DEPOSIT” 按钮。 + +在《大众电子》 的 [1975 年 2 月刊][9] 中,Roberts 和 Yates 制作了一小段程序来确保用户们的 Altair 正常工作。这个程序从内存中读取两个整型数据并添加之后将它们存回内存中。这个小程序仅由 6 条指令组成,但是这 6 条指令包含了 14 条在一起的内存信息,所以要正确地输入它们需要一点时间。这个程序也被写入了 Altair 的说明书,原文如下: + +| Address | Mnemonic | Bit Pattern | Octal Equivalent | +| :------: | :------: | :------: | :------: | +| 0 | LDA | 00 111 010 | 0 7 2 | +| 1 | (address) | 10 000 000 | 2 0 0 | +| 2 | (address) | 00 000 000 | 0 0 0 | +| 3 | MOV B, A | 01 000 111 | 1 0 7 | +| 4 | LDA | 00 111 010 | 0 7 2 | +| 5 | (address) | 10 000 001 | 2 0 1 | +| 6 | (address) | 00 000 000 | 0 0 0 | +| 7 | ADD B | 10 000 000 | 2 0 0 | +| 8 | STA | 00 110 010 | 0 6 2 | +| 9 | (address) | 10 000 010 | 2 0 2 | +| 10 | (address) | 00 000 000 | 0 0 0 | +| 11 | JMP | 11 000 011 | 3 0 3 | +| 12 | (address) | 00 000 000 | 0 0 0 | +| 13 | (address) | 00 000 000 | 0 0 0 | + +如果你通过开关来输入上面这些值,最终会得到一个程序,它会读取内存 128 中的值,并将其添加至 129 中,最终将其保存至 130 中。每条指令都会占用一个地址,它们最开始会被给予最低有效位,这便是第二个字节总会被清零(没有高于 255 的地址)的原因了。在输入这个程序并在 128 和 129 中输入了一些值之后,你可以向下推动 “RUN” ,之后再将它推到 “STOP” 位置。因为程序循环执行,以一秒内执行上千次的速度反复地添加并保存那些值。并且最后得到的值总是相同的,如果你暂停程序并检查 130,你应该能找到正确答案。 + +我不知道普通的 Altair 用户是否使用过,不过 z80pack 包括了一个汇编程序 —— `z80asm`,意思是适用于 Z80 的汇编程序Z80 assembly,所以它使用了不同的助记符。不过因为 Z80 是被设计来适配为 Intel 8080 写的软件的,所以即使助记符不一样,它们的操作码也是相同的。你可以直接将 `z80asm` 装载进 Altair: + +``` + ORG 0000H +START: LD A,(80H) ;Load from address 128. + LD B,A ;Move loaded value from accumulator (A) to reg B. + LD A,(81H) ;Load from address 129. + ADD A,B ;Add A and B. + LD (82H),A ;Store A at address 130. + JP START ;Jump to start. +``` + +编译之后,你可以调用汇编程序来将其转换为 Intel HEX 文件: + +```shell +$ ./z80asm -fh -oadd.hex add.asm +``` + +我们用带有 `h` 参数的 `-f` 标识来定义输出的 HEX 文件。你可以用 `-x` 标识来传递 HEX 文件,从而使得 Altair 能够加载程序: + +```shell +$ ./altairsim -x add.hex +``` + +这会在内存中自动设置前 14 个信息,就和你通过开关手动输入这些值一样。你可以直接使用 “RUN” 按钮来替代以前那些繁琐的步骤,这是如此的简单! + +我不觉得有很多 Altair 用户以这种方式来编写软件。Altair BASIC 发布后,使得 BASIC 成为了 Altair 编程最简单的方法。z80pack 同时也包括了一些包含不同版本 Altair BASIC 的 HEX 文件;在模拟器中,你可以用这个方式加载 4.0 版本的 4K BASIC: + +```shell +$ ./altairsim -x basic4k40.hex +``` + +当你开启模拟器并按下 “RUN” 按钮之后,你就会看到 BASIC 开始执行了,同时它会在终端中与你交互。它首先会提示你输入你内存的可用量,我们输入 4000 字节。随后,在显示 “OK” 提示符之前,它会问你几个问题,Gates 和 Allen 用这个来代替标准的 “READY” 并以此节省内存。在这之后,你便可以使用 BASIC 了: + +``` +OK +PRINT 3 + 4 + 7 +``` + +尽管只有极小的 4 kb 空间来运行 BASIC,不过你仍迈出了使用面板操控电脑的重要一步。 + +很显然,Altair 远不及如今的家用电脑,并且比它晚十多年发布的 Mac 电脑看上去也是对 Altair 电脑的巨大飞跃。但是对亲手组装了 Altair 的《大众电子》的读者们来说,只用了低于 400 美金和一半的书柜空间的 Altair 才是第一个它们真正能拥有的全功能电脑。对那时只能用 [一叠卡片][10] 或一卷磁带来与计算机交互的人们来说,Altair 是个令人眼前一亮的玩意。这之后的微机基本都是在对 Altair 改进,使得它更易用。从某种意义上来说,我们甚至可以把它们看成更复杂的 Altair。Altair,一个野兽派的极简作品,却为之后的许多微机打下了铺垫。 + +如果你觉得这篇文章写的不错,你可以在推特上关注 [@TwoBitHistory][11] 或订阅 [RSS feed][12] 来获得我们文章的更新提醒。文章每两周就会更新一次! + +TwoBitHistory 的上一篇文章是………… + +> “跟我一起来进行这振奋人心的冒险吧!只需要十分钟,你就能了解到 10 年都没人用过的软件。” +> +> — TwoBitHistory (@TwoBitHistory) [写于 2018 年 7 月 7 日][13] + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html + +作者:[Two-Bit History][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://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1974/Poptronics-1974-12.pdf +[2]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-01.pdf +[3]: https://twobithistory.org/images/jan1975-altair.jpg +[4]: https://twobithistory.org/2017/12/02/simulating-the-altair.html +[5]: https://www.youtube.com/watch?v=qv5b1Xowxdk +[6]: https://www.autometer.de/unix4fun/z80pack/altair.png +[7]: http://www.classiccmp.org/dunfield/altair/d/88opman.pdf +[8]: https://www.youtube.com/watch?v=suyiMfzmZKs +[9]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-02.pdf +[10]: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html +[11]: https://twitter.com/TwoBitHistory +[12]: https://twobithistory.org/feed.xml +[13]: https://twitter.com/TwoBitHistory/status/1015647820353867776?ref_src=twsrc%5Etfw From b36f5ac455190ad338d1267cba9664553e64739d Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Sat, 19 Jan 2019 22:39:59 +0800 Subject: [PATCH 0670/4278] Update 20190114 You (probably) don-t need Kubernetes.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译文章 --- sources/talk/20190114 You (probably) don-t need Kubernetes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190114 You (probably) don-t need Kubernetes.md b/sources/talk/20190114 You (probably) don-t need Kubernetes.md index 5526f48f48..a57f47959e 100644 --- a/sources/talk/20190114 You (probably) don-t need Kubernetes.md +++ b/sources/talk/20190114 You (probably) don-t need Kubernetes.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (beamrolling) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c0fbfa836491940a12572181f7488c8b3c15d7ac Mon Sep 17 00:00:00 2001 From: wwhio Date: Sat, 19 Jan 2019 23:35:16 +0800 Subject: [PATCH 0671/4278] =?UTF-8?q?=E5=B0=8F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translated/talk/20171119 The Ruby Story.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md index b0eb05d447..3cacc1ff4f 100644 --- a/translated/talk/20171119 The Ruby Story.md +++ b/translated/talk/20171119 The Ruby Story.md @@ -1,7 +1,7 @@ 红宝石(Ruby)史话 ====== -尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,赋予了程序员表达自我的根本自由,虽然这可能会让代码变复杂,编写出来的程序对其他人来说不直观。 +尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,从根本上赋予了程序员表达自我的自由,虽然这可能会让代码变复杂,编写出来的程序对其他人来说不直观。 Ruby 社区一直将灵活表达freedom of expression视为其核心价值。可我不认同这对于 Ruby 的开发和普及是最重要的。创建一门编程语言也许是为了更高的性能,也许是为了在抽象上节省更多的时间,可 Ruby 就有趣在它并不关心这些,从它诞生之初,它的目标就是让程序员更快乐。 @@ -13,7 +13,7 @@ Ruby 社区一直将灵活表达freedom of expression视 > 我那时就知道 Python 了,但我不喜欢它,因为我认为它不是一门真正的面向对象的语言。面向对象就像是 Python 的一个附件。作为一个编程语言狂热者,我在 15 年里一直是面向对象的忠实粉丝。我真的想要一门生来就面向对象而且易用的脚本语言。我为此特地寻找过,可事实并不如愿。[^1] -所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好的,而且面向对象版的 Perl。 +所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好,且面向对象的 Perl。 但在其他场合,松本说他创造 Ruby 主要是为了让他自己和别人更快乐。2008 年,松本在谷歌技术讲座结束时放映了这张幻灯片: @@ -25,39 +25,39 @@ Ruby 社区一直将灵活表达freedom of expression视 松本开玩笑的说他制作 Ruby 的原因很自私,因为他觉得其它的语言乏味,所以需要创造一点让自己开心的东西。 -这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教徒践行者,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 +这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教践行者,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 Ruby 主要受到 Perl 的影响。Perl 则是由 Larry Wall 于 20 世纪 80 年代晚期创造的语言,主要用于处理和转换基于文本的数据。Perl 因其文本处理和正则表达式而闻名于世。对于 Ruby 程序员,Perl 程序中的很多语法元素都不陌生,例如符号 `$`、符号 `@`、`elsif` 等等。虽然我觉得,这些不是 Ruby 应该具有的特征。除了这些符号外,Ruby 还借鉴了 Perl 中的正则表达式的处理和标准库。 -但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本就完全用 Emacs Lisp 写过一个邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 底层的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本也表示过 Ada 和 Eiffel 也影响了 Ruby 的设计。 +但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前,松本制作过一个仅用 Emacs Lisp 编写的邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 底层的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本也表示过 Ada 和 Eiffel 也影响了 Ruby 的设计。 当时间来到了给这门新语言命名的时候,松本和他的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段非常值得一读的即时消息记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby,因为它就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的生辰石,而 Pearl珍珠 则是 6 月的生辰石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。(LCTT 译注:Perl 和 Pearl 发音相同,所以也常以“珍珠”来借喻 Perl;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关生辰石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) ### Ruby 西渐 -Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询财团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,在 Ruby 发布仅仅 5 年后,Ruby 在日本的流行度就超过了 Python。可这时的 Ruby 才刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在讨论它的日语邮件列表,但是英语的邮件列表直到 1998 年才建立起来。而且起初英语的邮件列表是用于日本的 Ruby 狂热者用英语交流的,但这一情况随着 Ruby 的普及而逐渐得以改变。 +Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询财团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,在 Ruby 发布仅仅 5 年后,Ruby 在日本的流行度就超过了 Python。可这时的 Ruby 才刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在讨论它的日语邮件列表,但是英语的邮件列表直到 1998 年才建立起来。起初,在英语的邮件列表中交流的大多是日本的 Ruby 狂热者,可随着 Ruby 在西方的逐渐普及而得以改变。 -在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。这是第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语的 Ruby 邮件列表的通信超过了原来的日语邮件列表。 +在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。这是第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语的 Ruby 邮件列表的通信量就超过了日语邮件列表。 时间来到了 2005 年,Ruby 更流行了,但它仍然不是主流的编程语言。然而,Ruby on Rails 的发布让一切都不一样了。Ruby on Rails 是 Ruby 的“杀手级应用”,没有别的什么项目能比它更推动 Ruby 的普及了。在 Ruby on Rails 发布后,人们对 Ruby 的兴趣爆发式的增长,看看 TIOBE 监测的语言排行: ![][3] -有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为 Ruby 被人所熟知是因为它是人们写 Rails 应用时用的语言。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 +有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为编写 Rails 应用时使用的语言正是 Ruby。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之父 David Heinemeier Hansson 常常提起他第一次与 Ruby 的接触的情形,那简直就是一次传教。他说,那种经历简直太有感召力了,让他感受到要为松本的杰作(指 Ruby)“传教”的使命。[^3] 对于 Hansson 来说,Ruby 的灵活性简直就是对 Python 或 Java 语言中自上而下的设计哲学的反抗。他很欣赏 Ruby 这门能够信任自己的语言,Ruby 赋予了他自由选择程序表达方式express his programs的权力。 就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非正统的功能,例如 “Inflector” 类和 `Time` 扩展(“Inflector”类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 -因此,虽然 Rails 看起来是一个偶然使 Ruby 更流行的应用,但事实上它体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法调用macro-like class method calls来实现模型关联这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 +因此,虽然 Rails 的火热带动了 Ruby 的普及看起来是一个偶然,但事实上 Rails 体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails,正是因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法调用macro-like class method calls来实现模型关联这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 ### Ruby 之未来 人们似乎对 Ruby(及 Ruby on Rails)是否正在消亡有着异常的兴趣。早在 2011 年,Stack Overflow 和 Quora 上就充斥着程序员在咨询“如果几年后不再使用 Ruby 那么现在是否有必要学它”的话题。这些担忧对 Ruby 并非没有道理,根据 TIOBE 指数和 Stack Overflow 趋势,Ruby 和 Ruby on Rails 的人气一直在萎缩,虽然它也曾是热门新事物,但在更新更热的框架面前它已经黯然失色。 -一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类型的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这使得出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而创造它的目的正是为了保证客户端运行的代码能受益于编译所提供的安全保障。 +一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类型的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这意味着出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而创造它的目的正是为了保证客户端运行的代码能受益于编译所提供的安全保障。 -我认为另一个更可能的原因是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以使用为 Go、Javascript 或者 Python 开发的各种优秀的框架,而这还仅仅是主流的选择。Web 的世界似乎正走向更加分布式的结构,与其使用一块代码来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组件,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻于 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 +我认为另一个更可能的原因是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以使用为 Go、Javascript 或者 Python 开发的各种优秀的框架,而这还仅仅是主流的选择。Web 的世界似乎正走向更加分布式的结构,与其使用一块代码来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组件,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻于 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 总而言之,我们有理由对 Ruby 的未来持乐观态度。因为不管是 Ruby 还是 Rails 的开发都还很活跃。松本和其他的贡献者们都在努力开发 Ruby 的第三个主要版本。新的版本将比现在的版本快上 3 倍,以减轻制约着 Ruby 发展的性能问题。虽然从 2005 年起,越来越多的 Web 框架被开发出来,但这并不意味着 Ruby on Rails 就失去了其生存空间。Rails 是一个富有大量功能的成熟的工具,对于一些特定类型的应用开发一直是非常好的选择。 From aa299d28a13226e6277dd3feaea5336d184af716 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 11:30:35 +0800 Subject: [PATCH 0672/4278] PRF:20180428 A Beginners Guide To Flatpak.md @wwhio --- .../20180428 A Beginners Guide To Flatpak.md | 100 +++++++++--------- 1 file changed, 48 insertions(+), 52 deletions(-) diff --git a/translated/tech/20180428 A Beginners Guide To Flatpak.md b/translated/tech/20180428 A Beginners Guide To Flatpak.md index 614f54cdf1..c5d758555d 100644 --- a/translated/tech/20180428 A Beginners Guide To Flatpak.md +++ b/translated/tech/20180428 A Beginners Guide To Flatpak.md @@ -3,7 +3,7 @@ Flatpak 新手指南 ![](https://www.ostechnix.com/wp-content/uploads/2016/06/flatpak-720x340.jpg) -不久前,我们介绍 Ubuntu 推出的 [**Snaps**][1]。Snaps 是由 Canonical 公司为 Ubuntu 开发的,并随后移植到其他的 Linux 发行版,如 Arch、Gentoo、Fedora 等等。由于一个 snap 包中含有软件的二进制文件和其所需的所有依赖和库,所以可以在无视软件版本、在任意 Linux 发行版上安装软件。和 Snaps 类似,还有一个名为 **Flatpak** 的工具。也许你已经知道,为不同的 Linux 发行版打包并分发应用时已经多么费时又复杂的工作,因为不同的 Linux 发行版的库不同,库的版本也不同。现在,Flatpak 作为分发桌面应用的新框架可以让开发者完全摆脱这些负担。开发者只需构建一个 Flatpak app 就可以在多种发行版上安装使用。这真是又酷又棒! +以前,我们介绍 Ubuntu 推出的 [Snaps][1]。Snaps 是由 Canonical 公司为 Ubuntu 开发的,并随后移植到其他的 Linux 发行版,如 Arch、Gentoo、Fedora 等等。由于一个 snap 包中含有软件的二进制文件和其所需的所有依赖和库,所以可以在无视软件版本、在任意 Linux 发行版上安装软件。和 Snaps 类似,还有一个名为 Flatpak 的工具。也许你已经知道,为不同的 Linux 发行版打包并分发应用是一件多么费时又复杂的工作,因为不同的 Linux 发行版的库不同,库的版本也不同。现在,Flatpak 作为分发桌面应用的新框架可以让开发者完全摆脱这些负担。开发者只需构建一个 Flatpak app 就可以在多种发行版上安装使用。这真是又酷又棒! 用户也完全不用担心库和依赖的问题了,所有的东西都和 app 打包在了一起。更重要的是 Flatpak app 们都自带沙箱,而且与宿主操作系统的其他部分隔离。对了,Flatpak 还有一个很棒的特性,它允许用户在同一个系统中安装同一应用的多个版本,例如 VLC 播放器的 2.1 版、2.2 版、2.3 版。这使开发者测试同一个软件的多个版本变得更加方便。 @@ -14,56 +14,54 @@ Flatpak 新手指南 Flatpak 可以在大多数的主流 Linux 发行版上安装使用,如 Arch Linux、Debian、Fedora、Gentoo、Red Hat、Linux Mint、openSUSE、Solus、Mageia 还有 Ubuntu。 在 Arch Linux 上,使用这一条命令来安装 Flatpak: + ``` $ sudo pacman -S flatpak - ``` -对于 Debian 用户,Flatpak 被收录进 Stretch 或更新版本的默认软件源中。要安装 Flatpak,直接执行: +对于 Debian 用户,Flatpak 被收录进 Stretch 或之后版本的默认软件源中。要安装 Flatpak,直接执行: + ``` $ sudo apt install flatpak - ``` 对于 Fedora 用户,Flatpak 是发行版默认安装的软件。你可以直接跳过这一步。 -如果因为任何原因没有安装的话,可以执行: +如果因为某种原因没有安装的话,可以执行: + ``` $ sudo dnf install flatpak - ``` 对于 RHEL 7 用户,安装 Flatpak 的命令为: + ``` $ sudo yum install flatpak - ``` 如果你在使用 Linux Mint 18.3,那么 Flatpat 也随系统默认安装,所以跳过这一步。 在 openSUSE Tumbleweed 中,使用 Zypper 包管理来安装 Flatpak: + ``` $ sudo zypper install flatpak - ``` 而 Ubuntu 需要添加下面的软件源再安装 Flatpak,命令如下: + ``` $ sudo add-apt-repository ppa:alexlarsson/flatpak - $ sudo apt update - $ sudo apt install flatpak - ``` Gnome 提供了一个 Flatpak 插件,安装它就可以使用图形界面来安装 Flatpak app 了。插件的安装命令为: + ``` $ sudo apt install gnome-software-plugin-flatpak - ``` -如果你是用发行版没有在上述的说明里,请你参考官方[**安装指南**][2]。 +如果你是用发行版没有在上述的说明里,请你参考官方[安装指南][2]。 ### 开始使用 Flatpak @@ -75,55 +73,54 @@ $ sudo apt install gnome-software-plugin-flatpak #### 添加软件仓库 -**添加 Flathub 仓库:** +**添加 Flathub 仓库:** + +Flathub 是一个包含了几乎所有 flatpak 应用的仓库。运行这条命令来启用它: -**Flathub** 是一个包含了几乎所有 flatpak 应用的仓库。运行这条命令来启用它: ``` $ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - ``` 对于流行应用来说,Flathub 已经可以满足需求。如果你想试试 GNOME 应用的话,可以添加 GNOME 的仓库。 -**添加 GNOME 仓库:** +**添加 GNOME 仓库:** -GNOME 仓库包括了所有的 GNOME 核心应用,它提供了两种版本:**稳定版**stable**每日构建版**nightly。 +GNOME 仓库包括了所有的 GNOME 核心应用,它提供了两种版本:稳定版stable每日构建版nightly。 使用下面的命令来添加 GNOME 稳定版仓库: + ``` $ wget https://sdk.gnome.org/keys/gnome-sdk.gpg - $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg --if-not-exists gnome-apps https://sdk.gnome.org/repo-apps/ - ``` 需要注意的是,GNOME 稳定版仓库中的应用需要 **3.20 版本的 org.gnome.Platform 运行时环境**。 安装稳定版运行时环境,请执行: + ``` $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/ - ``` 如果想使用每日构建版的 GNOME 仓库,使用如下的命令: + ``` $ wget https://sdk.gnome.org/nightly/keys/nightly.gpg - $ sudo flatpak remote-add --gpg-import=nightly.gpg --if-not-exists gnome-nightly-apps https://sdk.gnome.org/nightly/repo-apps/ - ``` 同样,每日构建版的 GNOME 仓库也需要 **org.gnome.Platform 运行时环境的每日构建版本**。 执行下面的命令安装每日构建版的运行时环境: + ``` $ sudo flatpak remote-add --gpg-import=nightly.gpg gnome-nightly https://sdk.gnome.org/nightly/repo/ - ``` #### 查看软件仓库 要查看已经添加的软件仓库,执行下面的命令: + ``` $ flatpak remotes Name Options @@ -132,7 +129,6 @@ gnome system gnome-apps system gnome-nightly system gnome-nightly-apps system - ``` 如你所见,上述命令会列出你添加到系统中的软件仓库。此外,执行结果还表明了软件仓库的配置是用户级per-user还是系统级system-wide。 @@ -140,121 +136,122 @@ gnome-nightly-apps system #### 删除软件仓库 要删除软件仓库,例如 flathub,用这条命令: + ``` $ sudo flatpak remote-delete flathub - ``` -这里的 **flathub** 是软件仓库的名字。 +这里的 flathub 是软件仓库的名字。 #### 安装 Flatpak 应用 这一节,我们将学习如何安装 flatpak 应用。 要安装一个应用,只要一条命令就能完成: + ``` $ sudo flatpak install flathub com.spotify.Client - ``` 所有的稳定版 GNOME 软件仓库中的应用,都使用“stable”作为版本名。 -例如,想从稳定版 GNOME 软件仓库中安装稳定版 **Evince**,就执行: +例如,想从稳定版 GNOME 软件仓库中安装稳定版 Evince,就执行: + ``` $ sudo flatpak install gnome-apps org.gnome.Evince stable - ``` 所有的每日构建版 GNOME 仓库中的应用,都使用“master”作为版本名。 例如,要从每日构建版 GNOME 软件仓库中安装 gedit 的每次构建版本,就执行: + ``` $ sudo flatpak install gnome-nightly-apps org.gnome.gedit master - ``` 如果不希望应用安装在系统级system-wide,而只安装在用户级per-user,那么你可以这样安装软件: + ``` $ flatpak install --user - ``` -所有的应用都会被存储在 **$HOME/.var/app/** 目录下. +所有的应用都会被存储在 `$HOME/.var/app/` 目录下. + ``` $ ls $HOME/.var/app/ com.spotify.Client - ``` #### 执行 Flatpak 应用 你可以直接使用应用启动器application launcher来运行已安装的 Flatpak 应用。如果你想从命令行启动的话,以 Spotify 为例,执行下面的命令: + ``` $ flatpak run com.spotify.Client - ``` #### 列出已安装的 Flatpak 应用 要查看已安装的应用程序和运行时环境,执行: + ``` $ flatpak list - ``` 想只查看已安装的应用,那就用这条命令: + ``` $ flatpak list --app - ``` 如果想查询已添加的软件仓库中的可安装程序和可安装的运行时环境,使用命令: + ``` $ flatpak remote-ls - ``` 只列出可安装的应用程序的命令是: + ``` $ flatpak remote-ls --app - ``` -查询指定远程仓库中的所有可安装的应用程序和运行时环境,这里以 **gnome-apps** 为例,执行命令: +查询指定远程仓库中的所有可安装的应用程序和运行时环境,这里以 gnome-apps 为例,执行命令: + ``` $ flatpak remote-ls gnome-apps - ``` -只列出可安装的应用程序,这里以 **flathub** 为例: +只列出可安装的应用程序,这里以 flathub 为例: + ``` $ flatpak remote-ls flathub --app - ``` #### 更新应用程序 更新所有的 Flatpak 应用程序,执行: + ``` $ flatpak update - ``` 更新指定的 Flatpak 应用程序,执行: + ``` $ flatpak update com.spotify.Client - ``` #### 获取应用详情 执行下面的命令来查看已安装应用程序的详细信息: + ``` $ flatpak info io.github.mmstick.FontFinder - ``` 输出样例: + ``` Ref: app/io.github.mmstick.FontFinder/x86_64/stable ID: io.github.mmstick.FontFinder @@ -268,28 +265,27 @@ Parent: dbff9150fce9fdfbc53d27e82965010805f16491ec7aa1aa76bf24ec1882d683 Location: /var/lib/flatpak/app/io.github.mmstick.FontFinder/x86_64/stable/07164e84148c9fc8b0a2a263c8a468a5355b89061b43e32d95008fc5dc4988f4 Installed size: 2.5 MB Runtime: org.gnome.Platform/x86_64/3.28 - ``` #### 删除应用程序 要删除一个 Flatpak 应用程序,这里以 spotify 为例,执行: + ``` $ sudo flatpak uninstall com.spotify.Client - ``` 如果你需要更多信息,可以参考 Flatpak 的帮助。 + ``` $ flatpak --help - ``` 到此,希望你对 Flatpak 有了一些基础了解。 -如果你觉得这篇指南有些帮助,请在你的社交媒体上分享它来支持 OSTechNix。 +如果你觉得这篇指南有些帮助,请在你的社交媒体上分享它来支持我们。 -稍后还有更多精彩内容,尽情期待~ +稍后还有更多精彩内容,敬请期待~ -------------------------------------------------------------------------------- @@ -299,7 +295,7 @@ via: https://www.ostechnix.com/flatpak-new-framework-desktop-applications-linux/ 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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 0df52c9e3ee3caa4ece5ff1558f0424a8c1160d7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 11:30:58 +0800 Subject: [PATCH 0673/4278] PUB:20180428 A Beginners Guide To Flatpak.md @wwhio https://linux.cn/article-10459-1.html --- .../tech => published}/20180428 A Beginners Guide To Flatpak.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180428 A Beginners Guide To Flatpak.md (100%) diff --git a/translated/tech/20180428 A Beginners Guide To Flatpak.md b/published/20180428 A Beginners Guide To Flatpak.md similarity index 100% rename from translated/tech/20180428 A Beginners Guide To Flatpak.md rename to published/20180428 A Beginners Guide To Flatpak.md From 420e68c3b6d61e8cc51919385b08db43b3e8c1b0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 12:15:21 +0800 Subject: [PATCH 0674/4278] PRF:20190109 Understanding -etc-services file in Linux.md @MjSeven --- ...derstanding -etc-services file in Linux.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/translated/tech/20190109 Understanding -etc-services file in Linux.md b/translated/tech/20190109 Understanding -etc-services file in Linux.md index dedbca16e2..fd7a2f3911 100644 --- a/translated/tech/20190109 Understanding -etc-services file in Linux.md +++ b/translated/tech/20190109 Understanding -etc-services file in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Understanding /etc/services file in Linux) @@ -10,12 +10,13 @@ 理解 Linux 中的 /etc/services 文件 ====== -这篇文章将帮助你了解 Linux 中 /etc/services 文件,包括它的内容,格式以及重要性。 +这篇文章将帮助你了解 Linux 中 `/etc/services` 文件,包括它的内容,格式以及重要性。 ![/etc/services file in Linux][1] -Linux 中的 /etc/services 文件 -网络守护程序是 Linux 世界中的重要服务。它借助 `/etc/services` 文件来处理所有网络服务。在本文中,我们将向你介绍这个文件的内容,格式以及它对于 Linux 系统的意义。 +*Linux 中的 /etc/services 文件* + +Internet 守护程序(`ineted`)是 Linux 世界中的重要服务。它借助 `/etc/services` 文件来处理所有网络服务。在本文中,我们将向你介绍这个文件的内容,格式以及它对于 Linux 系统的意义。 `/etc/services` 文件包含网络服务和它们映射端口的列表。`inetd` 或 `xinetd` 会查看这些细节,以便在数据包到达各自的端口或服务有需求时,它会调用特定的程序。 @@ -26,7 +27,7 @@ $ ll /etc/services -rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services ``` -### `/etc/services` 文件格式 +### /etc/services 文件格式 ``` service-name port/protocol [aliases..] [#comment] @@ -36,12 +37,12 @@ service-name port/protocol [aliases..] [#comment] 其中: - * service-name 是网络服务的名称。例如 [telnet][2], [ftp][3] 等。 - * port/protocol 是网络服务使用的端口(一个数值)和服务通信使用的协议(TCP/UDP)。 - * alias 是服务的别名。 - * comment 是你可以添加到服务的注释或说明。以 `#` 标记开头。 + * `service-name` 是网络服务的名称。例如 [telnet][2]、[ftp][3] 等。 + * `port/protocol` 是网络服务使用的端口(一个数值)和服务通信使用的协议(TCP/UDP)。 + * `alias` 是服务的别名。 + * `comment` 是你可以添加到服务的注释或说明。以 `#` 标记开头。 -### `/etc/services` 文件示例 +### /etc/services 文件示例 ``` # 每行描述一个服务,形式如下: @@ -63,7 +64,7 @@ via: https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/ 作者:[kerneltalks][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 899b9e4b1effca33ff1f59c6a38eda4e260b59aa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 12:15:52 +0800 Subject: [PATCH 0675/4278] PUB:20190109 Understanding -etc-services file in Linux.md @MjSeven https://linux.cn/article-10460-1.html --- .../20190109 Understanding -etc-services file in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190109 Understanding -etc-services file in Linux.md (97%) diff --git a/translated/tech/20190109 Understanding -etc-services file in Linux.md b/published/20190109 Understanding -etc-services file in Linux.md similarity index 97% rename from translated/tech/20190109 Understanding -etc-services file in Linux.md rename to published/20190109 Understanding -etc-services file in Linux.md index fd7a2f3911..d00d7337c9 100644 --- a/translated/tech/20190109 Understanding -etc-services file in Linux.md +++ b/published/20190109 Understanding -etc-services file in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10460-1.html) [#]: subject: (Understanding /etc/services file in Linux) [#]: via: (https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/) [#]: author: (kerneltalks https://kerneltalks.com) From 8d45bbab8c4cc299597d2686402cbdef75602ef9 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 20 Jan 2019 15:30:56 +0800 Subject: [PATCH 0676/4278] Translated by qhwdw --- ...4 How to Build a Netboot Server, Part 4.md | 139 +++++++++--------- 1 file changed, 69 insertions(+), 70 deletions(-) rename {sources => translated}/tech/20190114 How to Build a Netboot Server, Part 4.md (59%) diff --git a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md b/translated/tech/20190114 How to Build a Netboot Server, Part 4.md similarity index 59% rename from sources/tech/20190114 How to Build a Netboot Server, Part 4.md rename to translated/tech/20190114 How to Build a Netboot Server, Part 4.md index 3b5286df03..84065b2b40 100644 --- a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md +++ b/translated/tech/20190114 How to Build a Netboot Server, Part 4.md @@ -1,23 +1,23 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Build a Netboot Server, Part 4) -[#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/) -[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) +[#]: collector: "lujun9972" +[#]: translator: "qhwdw" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How to Build a Netboot Server, Part 4" +[#]: via: "https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/" +[#]: author: "Gregory Bartholomew https://fedoramagazine.org/author/glb/" -How to Build a Netboot Server, Part 4 +如何构建一台网络引导服务器(四) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/11/netboot4-816x345.jpg) -One significant limitation of the netboot server built in this series is the operating system image being served is read-only. Some use cases may require the end user to modify the image. For example, an instructor may want to have the students install and configure software packages like MariaDB and Node.js as part of their course walk-through. +在本系列教程中所构建的网络引导服务器有一个很重要的限制,那就是所提供的操作系统镜像是只读的。一些使用场景或许要求终端用户能够修改操作系统镜像。例如,一些教师或许希望学生能够安装和配置一些像 MariaDB 和 Node.js 这样的包来做为他们课程练习的一部分。 -An added benefit of writable netboot images is the end user’s “personalized” operating system can follow them to different workstations they may use at later times. +可写镜像的另外的好处是,终端用户“私人定制”的操作系统,在下次不同的工作站上使用时能够“跟着”他们。 -### Change the Bootmenu Application to use HTTPS +### 修改 Bootmenu 应用程序去使用 HTTPS -Create a self-signed certificate for the bootmenu application: +为 bootmenu 应用程序创建一个自签名的证书: ``` $ sudo -i @@ -27,21 +27,21 @@ $ sudo -i # openssl req -newkey rsa:2048 -nodes -keyout $MY_TLSD/$MY_NAME.key -x509 -days 3650 -out $MY_TLSD/$MY_NAME.pem ``` -Verify your certificate’s values. Make sure the “CN” value in the “Subject” line matches the DNS name that your iPXE clients use to connect to your bootmenu server: +验证你的证书的值。确保 “Subject” 行中 “CN” 的值与你的 iPXE 客户端连接你的网络引导服务器所使用的 DNS 名字是相匹配的: ``` # openssl x509 -text -noout -in $MY_TLSD/$MY_NAME.pem ``` -Next, update the bootmenu application’s listen directive to use the HTTPS port and the newly created certificate and key: +接下来,更新 bootmenu 应用程序去监听 HTTPS 端口和新创建的证书及密钥: ``` # sed -i "s#listen => .*#listen => ['https://$MY_NAME:443?cert=$MY_TLSD/$MY_NAME.pem\&key=$MY_TLSD/$MY_NAME.key\&ciphers=AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA'],#" /opt/bootmenu/bootmenu.conf ``` -Note the ciphers have been restricted to [those currently supported by iPXE][1]. +注意 [iPXE 当前支持的][1] 加密算法是有限制的。 -GnuTLS requires the “CAP_DAC_READ_SEARCH” capability, so add it to the bootmenu application’s systemd service: +GnuTLS 要求 “CAP_DAC_READ_SEARCH” 能力,因此将它添加到 bootmenu 应用程序的 systemd 服务: ``` # sed -i '/^AmbientCapabilities=/ s/$/ CAP_DAC_READ_SEARCH/' /etc/systemd/system/bootmenu.service @@ -49,7 +49,7 @@ GnuTLS requires the “CAP_DAC_READ_SEARCH” capability, so add it to the bootm # systemctl daemon-reload ``` -Now, add an exception for the bootmenu service to the firewall and restart the service: +现在,在防火墙中为 bootmenu 服务添加一个例外规则并重启动服务: ``` # MY_SUBNET=192.0.2.0 @@ -59,7 +59,7 @@ Now, add an exception for the bootmenu service to the firewall and restart the s # systemctl restart bootmenu.service ``` -Use wget to verify it’s working: +使用 wget 去验证是否工作正常: ``` $ MY_NAME=server-01.example.edu @@ -67,9 +67,9 @@ $ MY_TLSD=/opt/bootmenu/tls $ wget -q --ca-certificate=$MY_TLSD/$MY_NAME.pem -O - https://$MY_NAME/menu ``` -### Add HTTPS to iPXE +### 添加 HTTPS 到 iPXE -Update init.ipxe to use HTTPS. Then recompile the ipxe bootloader with options to embed and trust the self-signed certificate you created for the bootmenu application: +更新 init.ipxe 去使用 HTTPS。接着使用选项重新编译 ipxe 引导加载器,以便它包含和信任你为 bootmenu 应用程序创建的自签名证书: ``` $ echo '#define DOWNLOAD_PROTO_HTTPS' >> $HOME/ipxe/src/config/local/general.h @@ -80,22 +80,22 @@ $ make clean $ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe CERT="../$MY_NAME.pem" TRUST="../$MY_NAME.pem" ``` -You can now copy the HTTPS-enabled iPXE bootloader out to your clients and test that everything is working correctly: +你现在可以将启用了 HTTPS 的 iPXE 引导加载器复制到你的客户端上,并测试它能否正常工作: ``` $ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi ``` -### Add User Authentication to Mojolicious +### 添加用户验证到 Mojolicious 中 -Create a PAM service definition for the bootmenu application: +为 bootmenu 应用程序创建一个 PAM 服务定义: ``` # dnf install -y pam_krb5 # echo 'auth required pam_krb5.so' > /etc/pam.d/bootmenu ``` -Add a library to the bootmenu application that uses the Authen-PAM perl module to perform user authentication: +添加一个库到 bootmenu 应用程序中,它使用 Authen-PAM 的 perl 模块去执行用户验证: ``` # dnf install -y perl-Authen-PAM; @@ -144,9 +144,9 @@ return 1; END ``` -The above code is taken almost verbatim from the Authen::PAM::FAQ man page. +以上的代码是一字不差是从 Authen::PAM::FAQ 的 man 页面中复制来的。 -Redefine the bootmenu application so it returns a netboot template only if a valid username and password are supplied: +重定义 bootmenu 应用程序,以使它仅当提供了有效的用户名和密码之后返回一个网络引导模板: ``` # cat << 'END' > $MY_MOJO/bootmenu.pl @@ -185,14 +185,14 @@ app->start; END ``` -The bootmenu application now looks for the lib directory relative to its WorkingDirectory. However, by default the working directory is set to the root directory of the server for systemd units. Therefore, you must update the systemd unit to set WorkingDirectory to the root of the bootmenu application instead: +bootmenu 应用程序现在查找 lib 去找到相应的 WorkingDirectory。但是,默认情况下,对于 systemd 单元它的工作目录设置为服务器的 root 目录。因此,你必须更新 systemd 单元去设置 WorkingDirectory 为 bootmenu 应用程序的根目录: ``` # sed -i "/^RuntimeDirectory=/ a WorkingDirectory=$MY_MOJO" /etc/systemd/system/bootmenu.service # systemctl daemon-reload ``` -Update the templates to work with the redefined bootmenu application: +更新模块去使用重定义后的 bootmenu 应用程序: ``` # cd $MY_MOJO/templates @@ -201,7 +201,7 @@ Update the templates to work with the redefined bootmenu application: # for i in $MY_FEDORA_RELEASES; do echo '#!ipxe' > fc$i.html.ep; grep "^kernel\|initrd" menu.html.ep | grep "fc$i" >> fc$i.html.ep; echo "boot || chain https://$MY_BOOTMENU_SERVER/menu" >> fc$i.html.ep; sed -i "/^:f$i$/,/^boot /c :f$i\nlogin\nchain https://$MY_BOOTMENU_SERVER/boot?instance=fc$i\&username=\${username}\&password=\${password:uristring} || goto failed" menu.html.ep; done ``` -The result of the last command above should be three files similar to the following: +上面的最后的命令将生成类似下面的三个文件: **menu.html.ep** : @@ -259,41 +259,41 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.3-200.fc28.x86_64.img boot || chain https://server-01.example.edu/menu ``` -Now, restart the bootmenu application and verify authentication is working: +现在,重启动 bootmenu 应用程序,并验证用户认证是否正常工作: ``` # systemctl restart bootmenu.service ``` -### Make the iSCSI Target Writeable +### 使得 iSCSI Target 可写 -Now that user authentication works through iPXE, you can create per-user, writeable overlays on top of the read-only image on demand when users connect. Using a [copy-on-write][2] overlay has three advantages over simply copying the original image file for each user: +现在,用户验证通过 iPXE 可以正常工作,在用户连接时,你可以按需在只读镜像的上面创建每用户的可写覆盖。使用一个 [写时复制][2] 覆盖与简单地为每个用户复制原始镜像相比有三个好处: - 1. The copy can be created very quickly. This allows creation on-demand. - 2. The copy does not increase the disk usage on the server. Only what the user writes to their personal copy of the image is stored in addition to the original image. - 3. Since most sectors for each copy are the same sectors on the server’s storage, they’ll likely already be loaded in RAM when subsequent users access their copies of the operating system. This improves the server’s performance because RAM is faster than disk I/O. + 1. 复制创建非常快。这样就可以按需创建。 + 2. 复制并不增加服务器上的磁盘使用。除了原始镜像之外,仅存储用户写入个人镜像的内容。 + 3. 由于每个用户复制的扇区大多都是服务器的存储上的相同的扇区,在随后的用户访问这些操作系统的副本时,它们可能已经加载到内存中,这样就提升了服务器的性能,因为对内存的访问速度要比磁盘 I/O 快得多。 -One potential pitfall of using copy-on-write is that once overlays are created, the images on which they are overlayed must not be changed. If they are changed, all the overlays will be corrupted. Then the overlays must be deleted and replaced with new, blank overlays. Even simply mounting the image file in read-write mode can cause sufficient filesystem updates to corrupt the overlays. +使用写时复制的一个潜在隐患是,一旦覆盖创建后,覆盖之下的镜像就不能再改变。如果它们改变,所有它们之上的覆盖将出错。因此,覆盖必须被删除并用新的、空白的替换。即便只是简单地以读写模式加载的镜像,也可能因为某些文件系统更新导致覆盖出错。 -Due to the potential for the overlays to be corrupted if the original image is modified, mark the original image as immutable by running: +由于这个隐患,如果原始镜像被修改将导致覆盖出错,因此运行下列的命令,将原始镜像标记为不可改变: ``` # chattr +i ``` -You can use lsattr to view the status of the immutable flag and use to chattr -i unset the immutable flag. While the immutable flag is set, even the root user or a system process running as root cannot modify or delete the file. +你可以使用 `lsattr ` 去查看不可改变标志,并可以使用 `chattr -i ` 取消设置不可改变标志。在设置了不可改变标志之后,即便是 root 用户或以 root 运行的系统进程也不修改或删除这个文件。 -Begin by stopping the tgtd.service so you can change the image files: +停止 tgtd.service 之后,你就可以改变镜像文件: ``` # systemctl stop tgtd.service ``` -It’s normal for this command to take a minute or so to stop when there are connections still open. +当仍有连接打开的时候,运行这个命令一般需要一分钟或更长的时间。 -Now, remove the read-only iSCSI export. Then update the readonly-root configuration file in the template so the image is no longer read-only: +现在,移除只读的 iSCSI 出口。然后更新模板中的配置文件为 readonly-root,以使镜像不再是只读的: ``` # MY_FC=fc29 @@ -305,16 +305,16 @@ Now, remove the read-only iSCSI export. Then update the readonly-root configurat # umount $TEMP_MNT ``` -Journald was changed from logging to volatile memory back to its default (log to disk if /var/log/journal exists) because a user reported his clients would freeze with an out-of-memory error due to an application generating excessive system logs. The downside to setting logging to disk is that extra write traffic is generated by the clients, and might burden your netboot server with unnecessary I/O. You should decide which option — log to memory or log to disk — is preferable depending on your environment. +将 Journald 日志从发送到内存修改回缺省值(记录到磁盘,如果 /var/log/journal 存在的话),因为一个用户报告说,他的客户端由于应用程序生成了大量的系统日志而产生内存溢出错误,导致它的客户端被卡住。而将日志记录到磁盘的负面影响是客户端产生了额外的写入流量,这将在你的网络引导服务器上可能增加一些没有必要的 I/O。你应该去决定到底使用哪个选择 — 记录到内存还是记录到硬盘 — 哪个更合适取决于你的环境。 -Since you won’t make any further changes to the template image, set the immutable flag on it and restart the tgtd.service: +因为你的模板镜像在以后不能做任何的更改,因此在它上面设置不可更改标志,然后重启动 tgtd.service: ``` # chattr +i /$MY_FC.img # systemctl start tgtd.service ``` -Now, update the bootmenu application: +现在,更新 bootmenu 应用程序: ``` # cat << 'END' > $MY_MOJO/bootmenu.pl @@ -355,13 +355,13 @@ app->start; END ``` -This new version of the bootmenu application calls a custom mktgt script which, on success, returns a random [CHAP][3] password for each new iSCSI target that it creates. The CHAP password prevents one user from mounting another user’s iSCSI target by indirect means. The app only returns the correct iSCSI target password to a user who has successfully authenticated. +新版本的 bootmenu 应用程序调用一个定制的 mktgt 脚本,如果成功,它将为每个它自己创建的新的 iSCSI 目标返回一个随机的 [CHAP][3] 密码。这个 CHAP 密码可以防止其它用户的 iSCSI 目标以间接方式挂载这个用户的目标。这个应用程序只有在用户密码认证成功之后才返回一个正确的 iSCSI 目标密码。 -The mktgt script is prefixed with sudo because it needs root privileges to create the target. +mktgt 脚本要加 sudo 前缀来运行,因为它需要 root 权限去创建目标。 -The $username and $chapscrt variables also pass to the render command so they can be incorporated into the templates returned to the user when necessary. +\$username 和 \$chapscrt 变量也传递 render 命令,因此在需要的时候,它们也能够被纳入到模板中返回给用户。 -Next, update our boot templates so they can read the username and chapscrt variables and pass them along to the end user. Also update the templates to mount the root filesystem in rw (read-write) mode: +接下来,更新我们的引导模板,以便于它们能够读取用户名和 chapscrt 变量,并传递它们到所属的终端用户。也要更新模板以 rw(读写)模式加载根文件系统: ``` # cd $MY_MOJO/templates @@ -370,7 +370,7 @@ Next, update our boot templates so they can read the username and chapscrt varia # sed -i "s/ ro / rw /" $MY_FC.html.ep ``` -After running the above commands, you should have boot templates like the following: +运行上面的命令后,你应该会看到如下的引导模板: ``` #!ipxe @@ -379,17 +379,17 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img boot || chain https://server-01.example.edu/menu ``` -NOTE: If you need to view the boot template after the variables have been [interpolated][4], you can insert the “shell” command on its own line just before the “boot” command. Then, when you netboot your client, iPXE gives you an interactive shell where you can enter “imgstat” to view the parameters being passed to the kernel. If everything looks correct, you can type “exit” to leave the shell and continue the boot process. +注意:如果在 [插入][4] 变量后需要查看引导模板,你可以在 “boot” 命令之前,在它自己的行中插入 “shell” 命令。然后在你网络引导你的客户端时,iPXE 将在那里给你提供一个用于交互的 shell,你可以在 shell 中输入 “imgstat” 去查看传递到内核的参数。如果一切正确,你可以输入 “exit” 去退出 shell 并继续引导过程。 -Now allow the bootmenu user to run the mktgt script (and only that script) as root via sudo: +现在,通过 sudo 允许 bootmenu 用户以 root 权限去运行 mktgt 脚本(仅那个脚本): ``` # echo "bootmenu ALL = NOPASSWD: $MY_MOJO/scripts/mktgt *" > /etc/sudoers.d/bootmenu ``` -The bootmenu user should not have write access to the mktgt script or any other files under its home directory. All the files under /opt/bootmenu should be owned by root, and should not be writable by any user other than root. +bootmenu 用户不应该写访问 mktgt 脚本或在它的 home 目录下的任何其它文件。在 /opt/bootmenu 目录下的所有文件的属主应该是 root,并且不应该被其它任何 root 以外的用户可写。 -Sudo does not work well with systemd’s DynamicUser option, so create a normal user account and set the systemd service to run as that user: +Sudo 在使用 systemd 的 DynamicUser 选项下不能正常工作,因此创建一个普通用户帐户,并设置 systemd 服务以那个用户运行: ``` # useradd -r -c 'iPXE Boot Menu Service' -d /opt/bootmenu -s /sbin/nologin bootmenu @@ -397,7 +397,7 @@ Sudo does not work well with systemd’s DynamicUser option, so create a normal # systemctl daemon-reload ``` -Finally, create a directory for the copy-on-write overlays and create the mktgt script that manages the iSCSI targets and their overlayed backing stores: +最后,为写时复制覆盖创建一个目录,并创建管理 iSCSI 目标的 mktgt 脚本和它们的覆盖支持存储: ``` # mkdir /$MY_FC.cow @@ -508,27 +508,27 @@ END # chmod +x $MY_MOJO/scripts/mktgt ``` -The above script does five things: +上面的脚本将做以下五件事情: - 1. It creates the /.cow/ sparse file if it does not already exist. - 2. It creates the /dev/mapper/- device node that serves as the copy-on-write backing store for the iSCSI target if it does not already exist. - 3. It creates the iqn.:- iSCSI target if it does not exist. Or, if the target does exist, it closes any existing connections to it because the image can only be opened in read-write mode from one place at a time. - 4. It (re)sets the chap password on the iqn.:- iSCSI target to a new random value. - 5. It prints the new chap password on [standard output][5] if all of the previous tasks compeleted successfully. + 1. 创建 /.cow/ 稀疏文件(如果不存在的话)。 + 2. 创建 /dev/mapper/- 设备节点作为 iSCSI 目标的写时复制支持存储(如果不存在的话)。 + 3. 创建 iqn.:- iSCSI 目标(如果不存在的话)。或者,如果已存在了,它将关闭任何已存在的连接,因为在任何时刻,镜像只能以只读模式从一个地方打开。 + 4. 它在 iqn.:- iSCSI 目标上(重新)设置 chap 密码为一个新的随机值。 + 5. (如果前面的所有任务都成功的话)它在 [标准输出][5] 上显示新的 chap 密码。 -You should be able to test the mktgt script from the command line by running it with valid test parameters. For example: +你应该可以在命令行上通过使用有效的测试参数来运行它,以测试 mktgt 脚本能否正常工作。例如: ``` # echo `$MY_MOJO/scripts/mktgt fc29 jsmith` ``` -When run from the command line, the mktgt script should print out either the eight-character random password for the iSCSI target if it succeeded or the line number on which something went wrong if it failed. +当你从命令行上运行时,mktgt 脚本应该会输出 iSCSI 目标的一个随意的八字符随机密码(如果成功的话)或者是出错位置的行号(如果失败的话)。 -On occasion, you may want to delete an iSCSI target without having to stop the entire service. For example, a user might inadvertently corrupt their personal image, in which case you would need to systematically undo everything that the above mktgt script does so that the next time they log in they will get a copy of the original image. +有时候,你可能需要在不停止整个服务的情况下删除一个 iSCSI 目标。例如,一个用户可能无意中损坏了他的个人镜像,在那种情况下,你可能需要按步骤撤销上面的 mktgt 脚本所做的事情,以便于他下次登入时他将得到一个原始镜像。 -Below is an rmtgt script that undoes, in reverse order, what the above mktgt script did: +下面是用于撤销的 rmtgt 脚本,它以相反的顺序做了上面 mktgt 脚本所做的事情: ``` # mkdir $HOME/bin @@ -594,30 +594,29 @@ END # chmod +x $HOME/bin/rmtgt ``` -For example, to use the above script to completely remove the fc29-jsmith target including its backing store device node and its sparse file, run the following: +例如,使用上面的脚本去完全删除 fc29-jsmith 目标,包含它的支持存储设备节点和稀疏文件,可以按下列方式运行命令: ``` # rmtgt fc29 jsmith +f ``` -Once you’ve verified that the mktgt script is working properly, you can restart the bootmenu service. The next time someone netboots, they should receive a personal copy of the the netboot image they can write to: +一旦你验证 mktgt 脚本工作正常,你可以重启动 bootmenu 服务。下次有人从网络引导时,他们应该能够接收到一个他们可以写入的、可”私人定制“的网络引导镜像的副本: ``` # systemctl restart bootmenu.service ``` -Users should now be able to modify the root filesystem as demonstrated in the below screenshot: +现在,就像下面的截屏示范的那样,用户应该可以修改根文件系统了: ![][6] - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qhwdw](https://github.com/qhwdw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8ed6a66ecaefd394430914619c36d59c94bcb555 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 20:56:23 +0800 Subject: [PATCH 0677/4278] PRF:20181016 Final JOS project.md @qhwdw --- translated/tech/20181016 Final JOS project.md | 56 ++++++------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/translated/tech/20181016 Final JOS project.md b/translated/tech/20181016 Final JOS project.md index eda24d1d5a..92b14d8f97 100644 --- a/translated/tech/20181016 Final JOS project.md +++ b/translated/tech/20181016 Final JOS project.md @@ -1,12 +1,12 @@ -最终的 JOS 项目 +Caffeinated 6.828:实验 6:最终的 JOS 项目 ====== + ### 简介 对于最后的项目,你有两个选择: * 继续使用你自己的 JOS 内核并做 [实验 6][1],包括实验 6 中的一个挑战问题。(你可以随意地、以任何有趣的方式去扩展实验 6 或者 JOS 的任何部分,当然了,这不是课程规定的。) - -* 在一个、二个或三个人组成的团队中,你选择去做一个涉及了你的 JOS 的项目。这个项目必须是涉及到与实验 6 相同或更大的(如果你是团队中的一员)领域。 +* 在一个、二个或三个人组成的团队中,你选择去做一个涉及了你的 JOS 的项目。这个项目必须是涉及到与实验 6 相同或更大的领域(如果你是团队中的一员)。 目标是为了获得乐趣或探索更高级的 O/S 的话题;你不需要做最新的研究。 @@ -16,70 +16,48 @@ ### 交付期限 -``` -11 月 3 日:Piazza 讨论和 1、2、或 3 年级组选择(根据你的最终选择来定)。使用在 Piazza 上的 lab7 标记/目录。在 Piazza 上的文章评论区与其它人计论想法。使用这些文章帮你去找到有类似想法的其它学生一起组建一个小组。课程的教学人员将在 Piazza 上为你的项目想法给出反馈;如果你想得到更详细的反馈,可以与我们单独讨论。 -``` +> 11 月 3 日:Piazza 讨论和 1、2、或 3 年级组选择(根据你的最终选择来定)。使用在 Piazza 上的 lab7 标记/目录。在 Piazza 上的文章评论区与其它人计论想法。使用这些文章帮你去找到有类似想法的其它学生一起组建一个小组。课程的教学人员将在 Piazza 上为你的项目想法给出反馈;如果你想得到更详细的反馈,可以与我们单独讨论。 -```markdown -11 月 9 日:在 [提交网站][19] 上提交一个提议,只需要一到两个段落就可以。提议要包括你的小组成员列表、你的计划、以及明确的设计和实现打算。(如果你做实验 6,就不用做这个了) -``` +. -```markdown -12 月 7 日:和你的简短报告一起提交源代码。将你的报告放在与名为 "README.pdf" 的文件相同的目录下。由于你只是这个实验任务小组中的一员,你可能需要去使用 git 在小组成员之间共享你的项目代码。因此你需要去决定哪些源代码将作为你的小组项目的共享起始点。一定要为你的最终项目去创建一个分支,并且命名为 `lab7`。(如果你做了实验 6,就按实验 6 的提交要求做即可。) -``` +> 11 月 9 日:在 [提交网站][19] 上提交一个提议,只需要一到两个段落就可以。提议要包括你的小组成员列表、你的计划、以及明确的设计和实现打算。(如果你做实验 6,就不用做这个了) -``` -12 月 11 日这一周:简短的课堂演示。为你的 JOS 项目准备一个简短的课堂演示。为了你的项目演示,我们将提供一个投影仪。根据小组数量和每个小组选择的项目类型,我们可能会限制总的演讲数,并且有些小组可能最终没有机会上台演示。 -``` +. -``` -12 月 11 日这一周:助教们验收。向助教演示你的项目,因此我们可能会提问一些问题,去了解你所做的一些细节。 -``` +> 12 月 7 日:和你的简短报告一起提交源代码。将你的报告放在与名为 “README.pdf” 的文件相同的目录下。由于你只是这个实验任务小组中的一员,你可能需要去使用 git 在小组成员之间共享你的项目代码。因此你需要去决定哪些源代码将作为你的小组项目的共享起始点。一定要为你的最终项目去创建一个分支,并且命名为 `lab7`。(如果你做了实验 6,就按实验 6 的提交要求做即可。) + +. + +> 12 月 11 日这一周:简短的课堂演示。为你的 JOS 项目准备一个简短的课堂演示。为了你的项目演示,我们将提供一个投影仪。根据小组数量和每个小组选择的项目类型,我们可能会限制总的演讲数,并且有些小组可能最终没有机会上台演示。 + +. + +> 12 月 11 日这一周:助教们验收。向助教演示你的项目,因此我们可能会提问一些问题,去了解你所做的一些细节。 ### 项目想法 如果你不做实验 6,下面是一个启迪你的想法列表。但是,你应该大胆地去实现你自己的想法。其中一些想法只是一个开端,并且本身不在实验 6 的领域内,并且其它的可能是在更大的领域中。 * 使用 [x86 虚拟机支持][2] 去构建一个能够运行多个访客系统(比如,多个 JOS 实例)的虚拟机监视器。 - * 使用 Intel SGX 硬件保护机制做一些有用的事情。[这是使用 Intel SGX 的最新的论文][3]。 - * 让 JOS 文件系统支持写入、文件创建、为持久性使用日志、等等。或许你可以从 Linux EXT3 上找到一些启示。 - * 从 [软更新][4]、[WAFL][5]、ZFS、或其它较高级的文件系统上找到一些使用文件系统的想法。 - * 给一个文件系统添加快照功能,以便于用户能够查看过去的多个时间点上的文件系统。为了降低空间使用量,你或许要使用一些写时复制技术。 - * 使用分页去提供实时共享的内存,来构建一个 [分布式的共享内存][6](DSM)系统,以便于你在一个机器集群上运行多线程的共享内存的并行程序。当一个线程尝试去访问位于另外一个机器上的页时,页故障将给 DSM 系统提供一个机会,让它基于网络去从当前存储这个页的任意一台机器上获取这个页。 - * 允许进程在机器之间基于网络进行迁移。你将需要做一些关于一个进程状态的多个片段方面的事情,但是由于在 JOS 中许多状态是在用户空间中,它或许从 Linux 上的进程迁移要容易一些。 - * 在 JOS 中实现 [分页][7] 到磁盘,这样那个进程使用的内存就可以大于真实的内存。使用交换空间去扩展你的内存。 - * 为 JOS 实现文件的 [mmap()][8]。 - * 使用 [xfi][9] 将一个进程的代码沙箱化。 - * 支持 x86 的 [2MB 或 4MB 的页大小][10]。 - * 修改 JOS 让内核支持进程内的线程。从查看 [课堂上的 uthread 任务][11] 去开始。实现调度器触发将是实现这个项目的一种方式。 - * 在 JOS 的内核中或文件系统中(实现多线程之后),使用细粒度锁或无锁并发。Linux 内核使用 [读复制更新][12] 去执行无需上锁的读取操作。通过在 JOS 中实现它来探索 RCU,并使用它去支持无锁读取的名称缓存。 - * 实现 [外内核论文][13] 中的想法。例如包过滤器。 - * 使 JOS 拥有软实时行为。用它来辨识一些应用程序时非常有用。 - * 使 JOS 运行在 64 位 CPU 上。这包括重设计虚拟内存让它使用 4 级页表。有关这方面的文档,请查看 [参考页][14]。 - * 移植 JOS 到一个不同的微处理器。这个 [osdev wiki][15] 或许对你有帮助。 - * 为 JOS 系统增加一个“窗口”系统,包括图形驱动和鼠标。有关这方面的文档,请查看 [参考页][16]。[sqrt(x)][17] 就是一个 JOS “窗口” 系统的示例。 - * 在 JOS 中实现 [dune][18],以提供特权硬件指令给用户空间应用程序。 - * 写一个用户级调试器,添加类似跟踪的功能;硬件寄存器概要(即:Oprofile);调用跟踪等等。 - * 为(静态的)Linux 可运行程序做一个二进制仿真。 -------------------------------------------------------------------------------- @@ -89,7 +67,7 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab7/ 作者:[csail.mit][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 dbb0e748a4c949836e552fb01d4861fede72d2f7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 20:56:41 +0800 Subject: [PATCH 0678/4278] PUB:20181016 Final JOS project.md @qhwdw https://linux.cn/article-10461-1.html --- {translated/tech => published}/20181016 Final JOS project.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181016 Final JOS project.md (100%) diff --git a/translated/tech/20181016 Final JOS project.md b/published/20181016 Final JOS project.md similarity index 100% rename from translated/tech/20181016 Final JOS project.md rename to published/20181016 Final JOS project.md From f4527c0ac6fd7aa25e88736ff454adbb941cc902 Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Sun, 20 Jan 2019 22:24:36 +0800 Subject: [PATCH 0679/4278] 20180625 --- ...180625 The life cycle of a software bug.md | 68 ------------------- ...180625 The life cycle of a software bug.md | 67 ++++++++++++++++++ 2 files changed, 67 insertions(+), 68 deletions(-) delete mode 100644 sources/tech/20180625 The life cycle of a software bug.md create mode 100644 translated/tech/20180625 The life cycle of a software bug.md diff --git a/sources/tech/20180625 The life cycle of a software bug.md b/sources/tech/20180625 The life cycle of a software bug.md deleted file mode 100644 index 0f45d7a355..0000000000 --- a/sources/tech/20180625 The life cycle of a software bug.md +++ /dev/null @@ -1,68 +0,0 @@ -translated by lixinyuxx -The life cycle of a software bug -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y) - -In 1947, the first computer bug was found—a moth trapped in a computer relay. - -If only all bugs were as simple to uncover. As software has become more complex, so too has the process of testing and debugging. Today, the life cycle of a software bug can be lengthy—though the right technology and business processes can help. For open source software, developers use rigorous ticketing services and collaboration to find and mitigate bugs. - -### Confirming a computer bug - -During the process of testing, bugs are reported to the development team. Quality assurance testers describe the bug in as much detail as possible, reporting on their system state, the processes they were undertaking, and how the bug manifested itself. - -Despite this, some bugs are never confirmed; they may be reported in testing but can never be reproduced in a controlled environment. In such cases they may not be resolved but are instead closed. - -It can be difficult to confirm a computer bug due to the wide array of platforms in use and the many different types of user behavior. Some bugs only occur intermittently or under very specific situations, and others may occur seemingly at random. - -Many people use and interact with open source software, and many bugs and issues may be non-repeatable or may not be adequately described. Still, because every user and developer also plays the role of quality assurance tester, at least in part, there is a good chance that bugs will be revealed. - -When a bug is confirmed, work begins. - -### Assigning a bug to be fixed - -A confirmed bug is assigned to a developer or a development team to be addressed. At this stage, the bug needs to be reproduced, the issue uncovered, and the associated code fixed. Developers may categorize this bug as an issue to be fixed later if the bug is low-priority, or they may assign someone directly if it is high-priority. Either way, a ticket is opened during the process of development, and the bug becomes a known issue. - -In open source solutions, developers may select from the bugs that they want to tackle, either choosing the areas of the program with which they are most familiar or working from the top priorities. Consolidated solutions such as [GitHub][1] make it easy for multiple developers to work on solutions without interfering with each other's work. - -When assigning bugs to be fixed, reporters may also select a priority level for the bug. Major bugs may have a high priority level, whereas bugs related to appearance only, for example, may have a lower level. This priority level determines how and when the development team is assigned to resolve these issues. Either way, all bugs need to be resolved before a product can be considered complete. Using proper traceability back to prioritized requirements can also be helpful in this regard. - -### Resolving the bug - -Once a bug has been fixed, it is usually be sent back to Quality Assurance as a resolved bug. Quality Assurance then puts the product through its paces again to reproduce the bug. If the bug cannot be reproduced, Quality Assurance will assume that it has been properly resolved. - -In open source situations, any changes are distributed—often as a tentative release that is being tested. This test release is distributed to users, who again fulfill the role of Quality Assurance and test the product. - -If the bug occurs again, the issue is sent back to the development team. At this stage, the bug is reopened, and it is up to the development team to repeat the cycle of resolving the bug. This may occur multiple times, especially if the bug is unpredictable or intermittent. Intermittent bugs are notoriously difficult to resolve. - -If the bug does not occur again, the issue will be marked as resolved. In some cases, the initial bug is resolved, but other bugs emerge as a result of the changes made. When this happens, new bug reports may need to be initiated, starting the process over again. - -### Closing the bug - -After a bug has been addressed, identified, and resolved, the bug is closed and developers can move on to other areas of software development and testing. A bug will also be closed if it was never found or if developers were never able to reproduce it—either way, the next stage of development and testing will begin. - -Any changes made to the solution in the testing version will be rolled into the next release of the product. If the bug was a serious one, a patch or a hotfix may be provided for current users until the release of the next version. This is common for security issues. - -Software bugs can be difficult to find, but by following set processes and procedures, developers can make the process faster, easier, and more consistent. Quality Assurance is an important part of this process, as QA testers must find and identify bugs and help developers reproduce them. Bugs cannot be closed and resolved until the error no longer occurs. - -Open source solutions distribute the burden of quality assurance testing, development, and mitigation, which often leads to bugs being discovered and mitigated more quickly and comprehensively. However, because of the nature of open source technology, the speed and accuracy of this process often depends upon the popularity of the solution and the dedication of its maintenance and development team. - -_Rich Butkevic is a PMP certified project manager, certified scum master, and runs[Project Zendo][2] , a website for project management professionals to discover strategies to simplify and improve their project results. Connect with Rich at [Richbutkevic.com][3] or on [LinkedIn][4]._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/life-cycle-software-bug - -作者:[Rich Butkevic][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/rich-butkevic -[1]:https://github.com/ -[2]:https://projectzendo.com -[3]:https://richbutkevic.com -[4]:https://www.linkedin.com/in/richbutkevic diff --git a/translated/tech/20180625 The life cycle of a software bug.md b/translated/tech/20180625 The life cycle of a software bug.md new file mode 100644 index 0000000000..c25b4ce086 --- /dev/null +++ b/translated/tech/20180625 The life cycle of a software bug.md @@ -0,0 +1,67 @@ +软件 bug 的生命周期 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y) + +1947年,发现了第一个计算机 bug --被困在计算机继电器中的飞蛾。 + +要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长, 尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的票务服务和协作来查找和缓解 bugs 。 + +### 确认计算机 bug + +在测试过程中,会向开发团队报告 bug 。质量保证人员尽可能详细地描述 bug , 报告他们的系统状态、他们正在进行的进程以及 bug 是如何表现出来的。 + +尽管如此, 一些 bug 从未得到证实;它们可能会在测试中报告, 但永远无法在受控环境中重现。在这种情况下,它们可能得不到解决, 而是被关闭。 + +由于使用的平台种类繁多, 用户行为也非常多, 因此很难确认计算机 bug ,有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 + +许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的, 或者可能没有得到充分的描述。不过, 由于每个用户和开发人员也都扮演质量保证测试员的角色,至少在一定程度上, 很有可能会发现 bug 。 + +确认 bug 后,工作就开始了。 + +### 分配要修复的 bug + +已确认的 bug 被分配给解决的开发人员或开发团队。在此阶段, 需要重现 bug ,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人。无论哪种方式,都会在开发过程中打开票证,并且 bug 将成为已知的问题。 + +在开源解决方案中,开发人员可以从他们想要解决的 bug 中进行选择, 要么选择他们最熟悉的程序区域,要么从最优先的开始。综合解决方案, 如 [GitHub][1] 使多个开发人员能够轻松地处理解决方案, 而不会干扰彼此的工作。 + +在分配要修复的 bug 时,记录者还可以为 bug 选择优先级。主要 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式, 所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,使用适当的回溯性到优先级高的的需求也会很有帮助。 + +### 解决 bug + +一旦修复了 bug ,通常会将其作为已解决的 bug 发送回质量保证。然后,质量保证再次将产品置于其步伐中,以重现 bug。如果无法重现 bug ,质量保证将假定它已得到适当解决。 + +在开源情况下,任何更改都是分布式的,通常是作为正在测试的暂定版本。此测试版本分发给用户,用户再次履行质量保证的职责并测试产品。 + +如果 bug 再次出现, 问题将被发送回开发团队。在此阶段, 该 bug 将重新触发,开发团队有责任重复循环解决该 bug 。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性的情况下。众所周知, 间歇性的 bug 很难解决。 + +如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,初始 bug 已得到解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要启动新的 bug 报告,然后重新开始该过程。 + +### 关闭 bug + +在处理、识别和解决 bug 后,该 bug 将被关闭, 开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug, 或者开发人员无法重现 bug ,则该 bug 也将被关闭-无论哪种方式,都将开始开发和测试的下一阶段。 + +在测试版本中对解决方案所做的任何更改都将滚动到产品的下一个版本中。如果 bug 是严重的, 则在下一个版本发布之前, 可能会为当前用户提供修补程序或修补程序。这在安全问题中很常见。 + +软件 bug 可能很难找到, 但通过遵循集过程和过程, 开发人员可以使过程更快、更容易、更一致。质量保证是这一过程的重要组成部分, 因为 QA 测试人员必须发现和识别 bug , 并帮助开发人员重现这些 bug 。在 bug 不再发生之前, 无法关闭和解决 bug。 + +开源解决方案分散了质量保证测试、开发和缓解的负担, 这往往导致 bug 被更快、更全面地发现和缓解。但是, 由于开源技术的性质, 此过程的速度和准确性通常取决于解决方案的受欢迎程度及其维护和开发团队的敬业精神。 + +_Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(*certified scrum master*) 和 [Project Zendo][2] ,供项目管理专业人员发现简化和改进其项目成果策略的网站。与 Rich 联系 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/6/life-cycle-software-bug + +作者:[Rich Butkevic][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[lixinyuxx](https://github.com/lixinyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/rich-butkevic +[1]:https://github.com/ +[2]:https://projectzendo.com +[3]:https://richbutkevic.com +[4]:https://www.linkedin.com/in/richbutkevic From b02610b6554b75cd145f77c99ac255185097c1c7 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 20 Jan 2019 22:43:51 +0800 Subject: [PATCH 0680/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=2020190114=20How=20to=20move=20multiple...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e Types Simultaneously From Commandline.md | 96 ------------------- ...e Types Simultaneously From Commandline.md | 93 ++++++++++++++++++ 2 files changed, 93 insertions(+), 96 deletions(-) delete mode 100644 sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md create mode 100644 translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md diff --git a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md deleted file mode 100644 index dd135f20e0..0000000000 --- a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) -[#]: via: (https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Move Multiple File Types Simultaneously From Commandline -====== - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/Move-Multiple-File-Types-720x340.png) - -The other day I was wondering how can I move (not copy) multiple file types from directory to another. I already knew how to [**find and copy certain type of files from one directory to another**][1]. But, I don’t know how to move multiple file types simultaneously. If you’re ever in a situation like this, I know a easy way to do it from commandline in Unix-like systems. - -### Move Multiple File Types Simultaneously - -Picture this scenario.You have multiple type of files, for example .pdf, .doc, .mp3, .mp4, .txt etc., on a directory named **‘dir1’**. Let us take a look at the dir1 contents: - -``` -$ ls dir1 -file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 -``` - -You want to move some of the file types (not all of them) to different location. For example, let us say you want to move doc, pdf and txt files only to another directory named **‘dir2’** in one go. - -To copy .doc, .pdf and .txt files from dir1 to dir2 simultaneously, the command would be: - -``` -$ mv dir1/*.{doc,pdf,txt} dir2/ -``` - -It’s easy, isn’t it? - -Now, let us check the contents of dir2: - -``` -$ ls dir2/ -file.txt mydoc.doc personal.pdf -``` - -See? Only the file types .doc, .pdf and .txt from dir1 have been moved to dir2. - -![][3] - -You can add as many file types as you want to inside curly braces in the above command to move them across different directories. The above command just works fine for me on Bash. - -Another way to move multiple file types is go to the source directory i.e dir1 in our case: - -``` -$ cd ~/dir1 -``` - -And, move file types of your choice to the destination (E.g dir2) as shown below. - -``` -$ mv *.doc *.txt *.pdf /home/sk/dir2/ -``` - -To move all files having a particular extension, for example **.doc** only, run: - -``` -$ mv dir1/*.doc dir2/ -``` - -For more details, refer man pages. - -``` -$ man mv -``` - -Moving a few number of same or different file types is easy! You could do this with couple mouse clicks in GUI mode or use a one-liner command in CLI mode. However, If you have thousands of different file types in a directory and wanted to move multiple file types to different directory in one go, it would be a cumbersome task. To me, the above method did the job easily! If you know any other one-liner commands to move multiple file types at a time, please share it in the comment section below. I will check and update the guide accordingly. - -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-move-multiple-file-types-simultaneously-from-commandline/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/find-copy-certain-type-files-one-directory-another-linux/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/mv-command.gif diff --git a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md new file mode 100644 index 0000000000..691dc85d26 --- /dev/null +++ b/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) +[#]: via: (https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何从命令行同时移动多种文件类型 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/Move-Multiple-File-Types-720x340.png) + +前几天,我想知道如何将多个文件类型从一个目录移动(不复制)到另一个目录。我已经知道如何[**查找并将某些类型的文件从一个目录复制到另一个目录**][1]。但是,我不知道如何同时移动多种文件类型。如果你曾遇到这样的情况,我知道在类 Unix 系统中从命令行执行该操作的一个简单方法。 + +### 同时移动多种文件类型 + +想象一下这种场景,你在名为 **‘dir1’** 的目录中有多种类型的文件,例如 .pdf, .doc, .mp3, .mp4, .txt 等等。我们来看看 dir1 的内容: + +``` +$ ls dir1 +file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 +``` + +你希望将某些文件类型(不是所有文件类型)移动到另一个位置。例如,假设你想将 doc, pdf 和 txt 文件一次性移动到名为 **‘dir2’** 的另一个目录中。 + +要同时将 .doc, .pdf 和 .txt 文件从 dir1 移动到 dir2,命令是: + +``` +$ mv dir1/*.{doc,pdf,txt} dir2/ +``` + +很容易,不是吗? + +现在让我们来查看一下 dir2 的内容: +``` +$ ls dir2/ +file.txt mydoc.doc personal.pdf +``` + +看到了吗?只有 .doc, .pdf 和 .txt 从 dir1 移到了 dir2。 + +![][3] + +在上面的命令中,你可以在花括号内添加任意数量的文件类型,以将它们移动到不同的目录中。它在 Bash 上非常适合我。 + +另一种移动多种文件类型的方法是转到源目录,在我们的例子中即为 dir1: + +``` +$ cd ~/dir1 +``` + +将你选择的文件类型移动到目的地(即 dir2),如下所示: + +``` +$ mv *.doc *.txt *.pdf /home/sk/dir2/ +``` + +要移动具有特定扩展名的所有文件,例如 **.doc**,运行: + +``` +$ mv dir1/*.doc dir2/ +``` + +更多细节,参考 man 页: + +``` +$ man mv +``` + +移动一些相同或不同的文件类型很容易!你可以在 GUI 模式下单击几下鼠标,或在 CLI 模式下使用一行命令来完成。但是,如果目录中有数千种不同的文件类型,并且希望一次将多种文件类型移动到不同的目录,这将是一项繁琐的任务。对我来说,上面的方法很容易完成工作!如果你知道任何其它一行命令可以一次移动多种文件类型,请在下面的评论部分与我们分享。我会核对并更新指南。 + +这些就是全部了,希望这很有用。更多好东西将要来了,敬请关注! + +共勉! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/ + +作者:[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 +[1]: https://www.ostechnix.com/find-copy-certain-type-files-one-directory-another-linux/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/mv-command.gif From d6f196effc91fc00b69d5edd095b25c05cee7e84 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 20 Jan 2019 23:11:13 +0800 Subject: [PATCH 0681/4278] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=2020190107=20Getting=20started=20with...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tarted with Pelican- A Python-based static site generator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md index 29772d473c..ed5c7f0dc0 100644 --- a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md +++ b/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From aad11909b764686856188d6b5bda26078b7516a6 Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Sun, 20 Jan 2019 23:16:50 +0800 Subject: [PATCH 0682/4278] Update 20180625 The life cycle of a software bug.md --- ...180625 The life cycle of a software bug.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/translated/tech/20180625 The life cycle of a software bug.md b/translated/tech/20180625 The life cycle of a software bug.md index c25b4ce086..4f487fa182 100644 --- a/translated/tech/20180625 The life cycle of a software bug.md +++ b/translated/tech/20180625 The life cycle of a software bug.md @@ -5,27 +5,27 @@ 1947年,发现了第一个计算机 bug --被困在计算机继电器中的飞蛾。 -要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长, 尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的票务服务和协作来查找和缓解 bugs 。 +要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长,尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的票务服务和协作来查找和解决 bugs 。 ### 确认计算机 bug -在测试过程中,会向开发团队报告 bug 。质量保证人员尽可能详细地描述 bug , 报告他们的系统状态、他们正在进行的进程以及 bug 是如何表现出来的。 +在测试过程中,会向开发团队报告 bug 。质量保证人员尽可能详细地描述 bug ,报告他们的系统状态、他们正在进行的进程以及 bug 是如何表现出来的。 -尽管如此, 一些 bug 从未得到证实;它们可能会在测试中报告, 但永远无法在受控环境中重现。在这种情况下,它们可能得不到解决, 而是被关闭。 +尽管如此,一些 bug 从未得到证实;它们可能会在测试中报告,但永远无法在可控环境中重现。在这种情况下,它们可能得不到解决,而是被关闭。 -由于使用的平台种类繁多, 用户行为也非常多, 因此很难确认计算机 bug ,有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 +由于使用的平台种类繁多,用户行为也非常多,因此很难确认计算机 bug ,有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 -许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的, 或者可能没有得到充分的描述。不过, 由于每个用户和开发人员也都扮演质量保证测试员的角色,至少在一定程度上, 很有可能会发现 bug 。 +许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的,或者可能没有得到充分的描述。不过,由于每个用户和开发人员也都扮演质量保证测试员的角色,至少在一定程度上,很有可能会发现 bug 。 -确认 bug 后,工作就开始了。 +确认 bug 后,修复工作就开始了。 ### 分配要修复的 bug -已确认的 bug 被分配给解决的开发人员或开发团队。在此阶段, 需要重现 bug ,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人。无论哪种方式,都会在开发过程中打开票证,并且 bug 将成为已知的问题。 +已确认的 bug 被分配给负责解决的开发人员或开发团队。在此阶段,需要重现 bug ,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人修复。无论哪种方式,都会在开发过程中打开票证,并且 bug 将成为已知的问题。 -在开源解决方案中,开发人员可以从他们想要解决的 bug 中进行选择, 要么选择他们最熟悉的程序区域,要么从最优先的开始。综合解决方案, 如 [GitHub][1] 使多个开发人员能够轻松地处理解决方案, 而不会干扰彼此的工作。 +在开源解决方案中,开发人员可以从他们想要解决的 bug 中进行选择,要么选择他们最熟悉的程序区域,要么从优先级最高的的开始。综合解决方案,如 [GitHub][1] 使得多个开发人员能够轻松地处理解决方案,而不会干扰彼此的工作。 -在分配要修复的 bug 时,记录者还可以为 bug 选择优先级。主要 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式, 所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,使用适当的回溯性到优先级高的的需求也会很有帮助。 +在分配要修复的 bug 时,记录者还可以为 bug 选择优先级。主要得 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式,所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,适当的回溯到优先级高的的需求也会很有帮助。 ### 解决 bug @@ -33,21 +33,21 @@ 在开源情况下,任何更改都是分布式的,通常是作为正在测试的暂定版本。此测试版本分发给用户,用户再次履行质量保证的职责并测试产品。 -如果 bug 再次出现, 问题将被发送回开发团队。在此阶段, 该 bug 将重新触发,开发团队有责任重复循环解决该 bug 。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性的情况下。众所周知, 间歇性的 bug 很难解决。 +如果 bug 再次出现,问题将被发送回开发团队。在此阶段,该 bug 将重新触发,开发团队有责任重复循环解决该 bug 。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性发生的情况下。众所周知,间歇性的 bug 很难解决。 -如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,初始 bug 已得到解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要启动新的 bug 报告,然后重新开始该过程。 +如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,初始 bug 已得到解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要新的 bug 报告,然后重新开始该过程。 ### 关闭 bug -在处理、识别和解决 bug 后,该 bug 将被关闭, 开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug, 或者开发人员无法重现 bug ,则该 bug 也将被关闭-无论哪种方式,都将开始开发和测试的下一阶段。 +在处理、识别和解决 bug 后,该 bug 将被关闭,开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug ,或者开发人员无法重现 bug ,则该 bug 也将被关闭-无论哪种方式,都将开始开发和测试的下一阶段。 -在测试版本中对解决方案所做的任何更改都将滚动到产品的下一个版本中。如果 bug 是严重的, 则在下一个版本发布之前, 可能会为当前用户提供修补程序或修补程序。这在安全问题中很常见。 +在测试版本中对解决方案所做的任何更改都将滚动到产品的下一个版本中。如果 bug 是严重的,则在下一个版本发布之前,可能会为当前用户提供修补程序或修补程序。这在安全问题中很常见。 -软件 bug 可能很难找到, 但通过遵循集过程和过程, 开发人员可以使过程更快、更容易、更一致。质量保证是这一过程的重要组成部分, 因为 QA 测试人员必须发现和识别 bug , 并帮助开发人员重现这些 bug 。在 bug 不再发生之前, 无法关闭和解决 bug。 +软件 bug 可能很难找到,但通过遵循过程,开发人员可以使开发更快、更容易、更一致。质量保证是这一过程的重要组成部分,因为 QA 测试人员必须发现和识别 bug ,并帮助开发人员重现这些 bug 。在 bug 不再发生之前,无法关闭和解决 bug。 -开源解决方案分散了质量保证测试、开发和缓解的负担, 这往往导致 bug 被更快、更全面地发现和缓解。但是, 由于开源技术的性质, 此过程的速度和准确性通常取决于解决方案的受欢迎程度及其维护和开发团队的敬业精神。 +开源的解决方案分散了质量保证测试、开发和缓解的负担,这往往导致 bug 被更快、更全面地发现和缓解。但是,由于开源技术的性质,此过程的速度和准确性通常取决于解决方案的受欢迎程度及其维护和开发团队的敬业精神。 -_Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(*certified scrum master*) 和 [Project Zendo][2] ,供项目管理专业人员发现简化和改进其项目成果策略的网站。与 Rich 联系 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 。_ +_Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(*certified scrum master*) 并且 使用 [Project Zendo][2] ,供项目管理专业人员去发现、简化和改进其项目成果策略的网站。与 Rich 联系在 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 。_ -------------------------------------------------------------------------------- From 5dfa1a0feb5bee4a6e8b028b6a7aacc64ce50529 Mon Sep 17 00:00:00 2001 From: wwhio Date: Sun, 20 Jan 2019 23:33:47 +0800 Subject: [PATCH 0683/4278] 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 5006ac4cd5125dc80315e5d6620bc56de8db4fb3 Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Mon, 21 Jan 2019 00:06:52 +0800 Subject: [PATCH 0684/4278] =?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 --- ...14 You (probably) don-t need Kubernetes.md | 76 ------------------- ...14 You (probably) don-t need Kubernetes.md | 76 +++++++++++++++++++ 2 files changed, 76 insertions(+), 76 deletions(-) delete mode 100644 sources/talk/20190114 You (probably) don-t need Kubernetes.md create mode 100644 translated/talk/20190114 You (probably) don-t need Kubernetes.md diff --git a/sources/talk/20190114 You (probably) don-t need Kubernetes.md b/sources/talk/20190114 You (probably) don-t need Kubernetes.md deleted file mode 100644 index a57f47959e..0000000000 --- a/sources/talk/20190114 You (probably) don-t need Kubernetes.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (beamrolling) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (You (probably) don't need Kubernetes) -[#]: via: (https://arp242.net/weblog/dont-need-k8s.html) -[#]: author: (Martin Tournoij https://arp242.net/) - -You (probably) don't need Kubernetes -====== - -This may perhaps be an unpopular opinion, but the overwhelming majority of companies are probably better off not using k8s. - -You know those old “Hello world according to programmer skill” jokes that start with `printf("hello, world\n")` for a junior programmer and end with some convoluted Java OOP design pattern solution for senior software architect engineer? This is kind of like that. - -* Junior sysops - `./binary` -* Experienced sysops - `./binary` on EC2. -* devops - Self-deployed CI pipeline to run `./binary` on EC2. -* Senior cloud orchestration engineer - k8s orchestrated self-deployed CI pipeline to run `./binary` on E2C platform. - - - -¯\\_(ツ)_/¯ - -That doesn’t mean that Kubernetes or any of these things are bad per se, just as Java or OOP aren’t bad per se, but rather that they’re horribly misapplied in many cases, just as using several Java OOP design patterns are horribly misapplied to a hello world program. For most companies the sysops requirements are fundamentally not very complex, and applying k8s to them makes litle sense. - -Complexity creates work by its very nature, and I’m skeptical that using k8s is a time-saver for most users. It’s like spending a day on a script to automate some 10-minute task that you do once a month. That’s not a good time investment (especially since the chances are you’ll have to invest further time in the future by expanding or debugging that script at some point). - -Your deployments probably should be automated – lest you [end up like Knightmare][1] – but k8s can often be replaced by a simple shell script. - -In our own company the sysops team spent a lot of time setting up k8s. They also had to spend a lot of time on updating to a newer version a while ago (1.6 ➙ 1.8). And the result is something no one really understands without really diving in to k8s, and even then it’s hard (those YAML files, yikes!) - -Before I could debug and fix deploy issues myself. Now that’s a lot harder. I understand the basic concepts, but that’s not all that useful when actually debugging practical issues. I don’t deal with k8s often enough to justify learning this. - -That k8s is really hard is not a novel insight, which is why there are a host of “k8s made easy” solutions out there. The idea of adding another layer on top of k8s to “make it easier” strikes me as, ehh, unwise. It’s not like that complexity disappears; you’ve just hidden it. - -I have said this many times before: when determining if something is “easy” then my prime concern is not how easy something is to write, but how easy something is to debug when things fail. Wrapping k8s will not make things easier to debug, quite the opposite: it will make it even harder. - -There is a famous Blaise Pascal quote: - -> All human evil comes from a single cause, man’s inability to sit still in a room. - -k8s – and to lesser extent, Docker – seem to be an example of that. A lot of people seem lost in the excitement of the moment and are “k8s al the things!”, just as some people were lost in the excitement when Java OOP was new, so everything has to be converted from the “old” way to the “new” ones, even though the “old” ways still worked fine. - -Sometimes the IT industry is pretty silly. - -Or to summarize this post [with a Tweet][2]: - -> 2014 - We must adopt #microservices to solve all problems with monoliths -> 2016 - We must adopt #docker to solve all problems with microservices -> 2018 - We must adopt #kubernetes to solve all problems with docker - -You can mail me at [martin@arp242.net][3] or [create a GitHub issue][4] for feedback, questions, etc. - --------------------------------------------------------------------------------- - -via: https://arp242.net/weblog/dont-need-k8s.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://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ -[2]: https://twitter.com/sahrizv/status/1018184792611827712 -[3]: mailto:martin@arp242.net -[4]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/translated/talk/20190114 You (probably) don-t need Kubernetes.md b/translated/talk/20190114 You (probably) don-t need Kubernetes.md new file mode 100644 index 0000000000..d573ebe680 --- /dev/null +++ b/translated/talk/20190114 You (probably) don-t need Kubernetes.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (beamrolling) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (You (probably) don't need Kubernetes) +[#]: via: (https://arp242.net/weblog/dont-need-k8s.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +你(大概)不需要 Kubernetes +====== + +这也许是一个不太受欢迎的观点,但大多数主流公司最好不要再使用 k8s 了。 + +你知道那个古老的“根据程序员技能写 Hello world ”笑话吗?它从一个新手程序员的 printf("hello, world\n") 语句开始,最后结束于高级软件架构工程师令人费解的 Java OOP 模式设计。使用 k8s 就有点像这样。 + +* 新手 SysOp: + `./binary` +* 有经验的 SysOp: + 在 EC2 上的 `./binary` +* DevOp: + 在 EC2 上自部署的 CI 管道运行 `./binary` +* 高级云编排工程师: + 在 EC2 上通过 k8s 编排的自部署 CI 管道运行 `./binary` + + + +¯\\_(ツ)_/¯ + +这不意味着 Kubernetes 或者任何这样的东西本身都是坏的,就像 Java 或者 OOP 设计本身并不是坏的一样,但是,在很多情况下,它们被严重地误用,就像在一个 hello world 的程序中可怕地误用 Java 面向对象设计模式一样。对大多数公司而言,系统运维从根本上来说并不十分复杂,此时在这上面应用 k8s 起效甚微。 + +复杂性本质上来说创造了工作,我十分怀疑使用 k8s 对大多数使用者来说是省时的这一说法。这就好像花一天时间来写一个脚本,用来自动完成一些你一个月一次,每次只花 10 分钟完成的工作。这不是一个好的时间投资(特别是你可能会在未来由于扩展或调试这个脚本来进一步投入更多的时间)。 + +你的部署大概应该需要自动化 – 以免你 [最终像 Knightmare][1] 那样 – 但 k8s 通常可以被一个简单的 shell 脚本所替代。 + +在我们公司,sysops 团队用了很多时间来设置 k8s 。他们还不得不用了很大一部分时间来更新到新一点的版本(1.6 – 1.8)。结果是如果没有真正深入理解 k8s ,没人会真正明白一些东西,甚至连深入理解 k8s 这一点也很难(那些 YAML 文件,哦呦!) + +在我能自己调试和修复问题之前——现在这更难了,我理解基本概念,但在真正调试实际问题的时候,它们并不是那么有用。我不经常用 k8s 足以证明这点。 + +k8s 真的很难这点并不是什么新看法,这也是为什么现在会有这么多“ k8s 简单学”的解决方案。在 k8s 上再添一层来“让它更简单”的方法让我觉得,呃,不明智。复杂性并没有消失,你只是把它藏起来了。 + +以前我说过很多次:在确定一样东西是否“简单”时,我最关心的不是写东西的时候有多简单,而是当失败的时候调试起来有多容易。包装 k8s 并不会让调试更加简单,恰恰相反,它让事情更加困难了。 + +Blaise Pascal 有一句名言: + +> 几乎所有的痛苦都来自于我们不善于在房间里独处。 + +k8s —— 略微拓展一下,Docker ——似乎就是这样的例子。许多人似乎迷失在当下的兴奋中,觉得“ k8s 就是这么回事!”,就像有些人迷失在 Java OOP 刚出来时的兴奋中一样,所以一切都必须从“旧”方法转为“新”方法,即使“旧”方法依然可行。 + +有时候 IT 产业挺蠢的。 + +或者用 [一条推特][2] 来总结: + +> 2014 - 我们必须采用 #微服务 来解决 monolith 的所有问题 +> 2016 - 我们必须采用 #docker 来解决微服务的所有问题 +> 2018 - 我们必须采用 #kubernetes 来解决 docker 的所有问题 + +你可以通过 [martin@arp242.net][3] 给我发邮件或者 [创建 GitHub issue][4] 来给我反馈或提出问题等。 + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/dont-need-k8s.html + +作者:[Martin Tournoij][a] +选题:[lujun9972][b] +译者:[beamrolling](https://github.com/beamrolling) +校对:[校对者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://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ +[2]: https://twitter.com/sahrizv/status/1018184792611827712 +[3]: mailto:martin@arp242.net +[4]: https://github.com/Carpetsmoker/arp242.net/issues/new From e7928703e6ba080275efd1240010771aeeb80c18 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Sun, 20 Jan 2019 17:01:07 +0000 Subject: [PATCH 0685/4278] Revert "hankchow translating" This reverts commit 46bad7ca22b757d16f411b8ccbc03d19cc813977. --- sources/tech/20181219 How to open source your Python library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181219 How to open source your Python library.md b/sources/tech/20181219 How to open source your Python library.md index e4d6adf3c6..cf59688484 100644 --- a/sources/tech/20181219 How to open source your Python library.md +++ b/sources/tech/20181219 How to open source your Python library.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (HankChow) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8da29bbe68b9b67f7071ab5c18c9d850c4a6dbd3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 21 Jan 2019 08:46:44 +0800 Subject: [PATCH 0686/4278] translated --- ...equency, Power And Utilization In Linux.md | 131 ----------------- ...equency, Power And Utilization In Linux.md | 132 ++++++++++++++++++ 2 files changed, 132 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md create mode 100644 translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md diff --git a/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md deleted file mode 100644 index 8861e90cac..0000000000 --- a/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md +++ /dev/null @@ -1,131 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) -[#]: via: (https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/) -[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) - -s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux -====== - -By default every Linux administrator would go with **[lm_sensors to monitor CPU temperature][1]**. - -lm_sensors (Linux monitoring sensors) is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans. - -It’s a CLI utility and if you are looking for alternative tools. - -I would suggest you to go for s-tui. - -It’s a Stress Terminal UI which helps administrator to view CPU temperature with colors. - -### What is s-tui - -s-tui is a terminal UI for monitoring your computer. s-tui allows to monitor CPU temperature, frequency, power and utilization in a graphical way from the terminal. - -Also, shows performance dips caused by thermal throttling, it requires minimal resources and doesn’t requires X-server. It was written in Python and requires root privilege to use this. - -s-tui is a self-contained application which can run out-of-the-box and doesn’t need config files to drive its core features. - -s-tui uses psutil to probe some of your hardware information. If your hardware is not supported, you might not see all the information. - -Running s-tui as root gives access to the maximum Turbo Boost frequency available to your CPU when stressing all cores. - -It uses Stress utility in the background to check the temperature of its components do not exceed their acceptable range by imposes certain types of compute stress on your system. - -Running an overclocked PC is fine as long as it is stable and that the temperature of its components do not exceed their acceptable range. - -There are several programs available to assess system stability through stress testing the system and thereby the overclock level. - -### How to Install s-tui In Linux - -It was written in Python and pip installation is a recommended method to install s-tui on Linux. Make sure you should have installed python-pip package on your system. If no, use the following command to install it. - -For Debian/Ubuntu users, use **[Apt Command][2]** or **[Apt-Get Command][3]** to install pip package. - -``` -$ sudo apt install python-pip stress -``` - -For Archlinux users, use **[Pacman Command][4]** to install pip package. - -``` -$ sudo pacman -S python-pip stress -``` - -For Fedora users, use **[DNF Command][5]** to install pip package. - -``` -$ sudo dnf install python-pip stress -``` - -For CentOS/RHEL users, use **[YUM Command][6]** to install pip package. - -``` -$ sudo yum install python-pip stress -``` - -For openSUSE users, use **[Zypper Command][7]** to install pip package. - -``` -$ sudo zypper install python-pip stress -``` - -Finally run the following **[pip command][8]** to install s-tui tool in Linux. - -For Python 2.x: - -``` -$ sudo pip install s-tui -``` - -For Python 3.x: - -``` -$ sudo pip3 install s-tui -``` - -### How to Access s-tui - -As i told in the beginning of the article. It requires root privilege to get all the information from your system. Just run the following command to launch s-tui. - -``` -$ sudo s-tui -``` - -![][10] - -By default it enable hardware monitoring and select the “Stress” option to do the stress test on your system. -![][11] - -To check other options, navigate to help page. - -``` -$ s-tui --help -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ - -作者:[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/view-check-cpu-hard-disk-temperature-linux/ -[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[3]: https://www.2daygeek.com/apt-get-apt-cache-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/dnf-command-examples-manage-packages-fedora-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/ -[8]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ -[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-1.jpg -[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-2.jpg diff --git a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md new file mode 100644 index 0000000000..525b264200 --- /dev/null +++ b/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) +[#]: via: (https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +s-tui:在 Linux 中监控 CPU 温度、频率、功率和使用率的终端工具 +====== + +默认情况下,每个 Linux 管理员都会使用 **[lm_sensors 监控 CPU 温度][1]**。 + +lm_sensors (Linux 监控传感器)是一个免费开源程序,它提供监控温度、电压和风扇的工具和驱动。 + +如果你正在找替代工具,这有一个 CLI 工具。 + +我会建议你尝试 s-tui。 + +它有一个压力终端 UI,可以帮助管理员通过颜色查看 CPU 温度。 + +### s-tui 是什么 + +s-tui 是一个用于监控计算机的终端 UI。s-tui 可以在终端以图形方式监控 CPU 温度、频率、功率和使用率。 + +此外,它还显示由热量限制引起的性能下降,它需要很少的资源并且不需要 X 服务器。它是用 Python 编写的,需要 root 权限才能使用它。 + +s-tui 是一个独立的程序,可以开箱即用,并且不需要配置文件来使用其核心功能。 + +s-tui 使用 psutil 来探测你的一些硬件信息。如果你的硬件不受支持,你可能看不到所有信息。 + +以root身份运行 s-tui 时,当压测所有核心时,可以访问到 CPU 的最大睿频频率。 + +它在后台使用 Stress 工具,通过对系统施加某些类型的计算压力来检查其组件的温度是否超过其可接受的范围。 + +只要计算机稳定并且其组件的温度不超过其可接受的范围,超频 PC 就没问题。 + +有几个程序可以通过压力测试得到系统的稳定性,从而评估超频水平。 + +### 如何在 Linux 中安装 s-tui + +它是用 Python 写的,pip 是在 Linux 上安装 s-tui 的推荐方法。确保你在系统上安装了 python-pip 软件包。如果还没有,请使用以下命令进行安装。 + +对于 Debian/Ubuntu 用户,使用 **[apt 命令][2]**或 **[apt-get 命令][3]** 来安装 pip。 + +``` +$ sudo apt install python-pip stress +``` + +对于 Archlinux 用户,使用 **[pacman 命令][4]**来安装 pip。 + +``` +$ sudo pacman -S python-pip stress +``` + +对于 Fedora 用户,使用 **[dnf 命令][5]**来安装 pip。 + +``` +$ sudo dnf install python-pip stress +``` + +对于 CentOS/RHEL 用户,使用 **[yum 命令][5]**来安装 pip。 + +``` +$ sudo yum install python-pip stress +``` + +对于 openSUSE 用户,使用 **[zypper 命令][5]**来安装 pip。 + +``` +$ sudo zypper install python-pip stress +``` + +最后运行下面的 **[pip 命令][8]**在 Linux 中安装 s-tui 工具。 + +对于 Python 2.x: + +``` +$ sudo pip install s-tui +``` + +对于Python 3.x: + +``` +$ sudo pip3 install s-tui +``` + +### 如何使用 s-tui + +正如我在文章开头所说的那样。它需要 root 权限才能从系统获取所有信息。只需运行以下命令即可启动 s-tui。 + +``` +$ sudo s-tui +``` + +![][10] + +默认情况下,它启用硬件监控并选择 “Stress” 选项以对系统执行压力测试。 + +![][11] + +要查看其他选项,请到帮助页面查看。 + +``` +$ s-tui --help +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ + +作者:[Prakash Subramanian][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/prakash/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ +[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-get-apt-cache-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/dnf-command-examples-manage-packages-fedora-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/ +[8]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-1.jpg +[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-2.jpg From 21c5439bf3bb50f9cbfba89b5811d0dc790f62ca Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 21 Jan 2019 08:51:18 +0800 Subject: [PATCH 0687/4278] translating --- ...the arcade in your Linux terminal with this Pac-man clone.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md index 3bd36352a4..0207f906df 100644 --- a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fce8f876af3751563aee06171888690badd8e53b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 11:09:00 +0800 Subject: [PATCH 0688/4278] PRF:20180604 4 Firefox extensions worth checking out.md @lixinyuxx --- ...4 Firefox extensions worth checking out.md | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/translated/tech/20180604 4 Firefox extensions worth checking out.md b/translated/tech/20180604 4 Firefox extensions worth checking out.md index d434a01af7..2f71b390b7 100644 --- a/translated/tech/20180604 4 Firefox extensions worth checking out.md +++ b/translated/tech/20180604 4 Firefox extensions worth checking out.md @@ -1,71 +1,73 @@ -4个值得一提的 Firefox 拓展插件 +4 个值得一提的 Firefox 扩展插件 ====== +> 这些扩展可以使火狐更具生产力和使用乐趣。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/firefox_blue_lead.jpg?itok=gYaubJUv) -自从大约12年前 V2.0 推出以来, 我一直是 Firefox (火狐浏览器)的用户。那时它不是最好的网络浏览器,但我仍旧因为一个理由使用它:我最喜爱的无可比拟的浏览器拓展插件 +自从大约 12 年前 Firefox(火狐浏览器)v2.0 推出以来, 我一直是它的用户。它不是那时最好的网络浏览器,但是总会有一个理由让我回到它:我最喜爱的浏览器扩展插件不能工作在其它浏览器上。 -如今, 我喜欢 Firefox 的当前状态,因为它快速、可定制和开源,但我也很欣赏扩展插件来体现原开发人员从未想到的特点: 如果您想在没有鼠标的情况下浏览呢?如果您不喜欢盯着晚上从显示器里出来的强光呢?对于 YouTube 和其他视频托管网站为了更好的性能和扩展使用一个更专业的播放器又如何呢?如果您需要更复杂的方法来禁用跟踪器和加快加载页面, 该怎么办? +如今,我喜欢现下的 Firefox,因为它快速、可定制和开源,我也很欣赏那些体现了原开发人员从未想到过的想法的扩展插件:如果你想在没有鼠标的情况下浏览网页呢?如果你不喜欢盯着晚上从显示器里发出来的强光呢?如何在 YouTube 和其他视频托管网站上使用一个更专业的播放器来获得更好的性能和更多播放控制呢?如果你需要更复杂的方法来禁用跟踪器和加快加载页面,该怎么办? -幸运的是, 这些问题都有答案, 我将展现给你我最喜爱的拓展--所有这些都是免费软件或开源的 (即, 在 [GNU GPL][1], [MPL][2],或 [Apache][3] 许可下) 并使一个优秀的浏览器更好。 +幸运的是,这些问题都有答案,我将展现给你我最喜爱的扩展 —— 所有这些都是免费软件或开源的 (即,在 [GNU GPL][1]、[MPL][2] 或 [Apache][3] 许可帧下) ,它们可以使一个优秀的浏览器更优秀。 -尽管术语加载项和扩展具有微微不同的含义,,但我将在本文中交替使用它们。 +尽管术语加载项add-on扩展extension的含义稍微不同,但我在本文中的使用不会区分它们。 ### Tridactyl ![Tridactyl screenshot][5] -Tridactyl 的新选项卡页面,展示隐藏连接。 +*Tridactyl 的新选项卡页面,展示了链接的指引。* -[Tridactyl][6] 使您能够在大多数浏览活动中使用键盘。它的灵感来自于现已解散的 [Vimperator][7] 和 [Pentadactyl][8] ,这是由 [Vim][9] 默认绑定值启发的。由于我已经习惯了 Vim 和其他命令行应用程序,我发现了一些功能,比如能够使用键值 `h/j/k/l` 进行导航,用 `f/F` 与超链接进行交互,并创建非常方便的自定义键绑定和命令。 +[Tridactyl][6] 使你能够在大多数浏览活动中使用键盘。它的灵感来自于现已不复存在的 [Vimperator][7] 和 [Pentadactyl][8],而它们受到了 [Vim][9] 的默认键绑定的启发。由于我已经习惯了 Vim 和其他命令行应用程序,我发现了它的功能类似于使用键值 `h/j/k/l` 进行导航,用 `f/F` 可以与超链接进行交互,而且创建自定义的键绑定和命令非常方便。 -Tridactyl 的可选本地信代理(目前,仅适用于GNU/Linux 和 Mac OSX), 最近才实现的,提供了更酷的功能来启动。例如, 有了它, 您可以隐藏 Firefox GUI 的一些元素(à la Vimperator 和 Pentadactyl),在外部程序中打开链接或当前页 (我经常用 [mpv][10] 和 [youtube-dl][11] 在视频上)通过按 `Ctrl-I` 用您喜爱的编辑器编辑文本内容(或者任意您选择的组合键)。 +Tridactyl 最近刚刚实现了一个可选的本地信使(目前,仅适用于 GNU/Linux 和 Mac OSX),提供了更酷的功能。例如,有了它,你可以隐藏 Firefox 用户界面上的一些元素(以 Vimperator 和 Pentadactyl 的方式)、在外部程序中打开链接或当前页(我经常用 [mpv][10] 和 [youtube-dl][11] 播放视频)、通过按 `Ctrl-I`(或者任意你选择的组合键)用你喜爱的编辑器来编辑文本框的内容。 -话虽如此, 但要记住,这是一个相对早期的项目,细节可能还是很粗糙。 另一方面,它的发展非常活跃, 当你回顾它早期的缺陷时, 使用它可能是一种乐趣。 +话虽如此,但要记住,这是一个相对早期的项目,细节可能还是很粗糙。另一方面,它的开发非常活跃,当你回顾它早期的缺陷时,未尝不是一种乐趣。 ### Open With ![Open With Screenshot][13] -Open With 提供的菜单。我可以在当前页面打开一个额外的列表。 +*Open With 提供的菜单。我可以用这里列出的一个外部程序打开当前页面。* -说到与外部程序的互动,有时很高兴有能力用鼠标来做到这一点。这是 [Open With][14] 想法的来源. +说到与外部程序的互动,有时能够用鼠标来做到这一点还是让人很高兴的。这是 [Open With][14] 的用武之地。 -除了添加的上下文菜单 (如屏幕截图所示) 外,您还可以通过单击加载项栏上的扩展图标来找到自己定义的命令。 [its page on Mozilla Add-ons][14] 建议作为它的图标和描述,它主要是为了与其他 web 浏览器一起工作, 但我也可以轻松地使用它与 mpv 和 youtube-dl 。 +除了添加的上下文菜单(如屏幕截图所示)之外,你还可以通过单击加载项栏上的扩展图标来找到自己定义的命令。如[它在 Mozilla Add-ons 页面上][14] 的图标和描述所示,它主要是为了切换到其它的 web 浏览器,但我也可以轻松地将它与 mpv 和 youtube-dl 相配合。 -这里也提供键盘快捷方式,但它们受到严重限制。可以在扩展设置的下拉列表中选择的组合不超过三种。相反, Tridactyl 允许我将命令分配给几乎任何没有被 Firefox 阻止的东西。打开与是目前为鼠标,真的。 +它也提供了键盘快捷方式,但它们受到了严重限制。可以在扩展设置的下拉列表中选择的组合不超过三种。相反,Tridactyl 允许我将命令分配给几乎任何没有被 Firefox 所阻止的东西。没错,Open With 目前为鼠标而准备的。 ### Stylus ![Stylus Screenshot][16] -在这个屏幕截图中, 我刚刚搜索并安装了一个黑暗的主题, 我正在上 Stylus 的网站。即使是弹出窗口也可以定制风格 (称为 Deepdark Stylus)! +*在这个屏幕截图中,我刚刚搜索并为当前正在浏览的 Stylus 的网站安装了一个黑暗主题。即使是弹出窗口也可以定制风格(称为 Deepdark Stylus)!* -[Stylus][17] 是一个用户样式管理器,这意味着通过编写自定义 CSS 规则并将其加载到 Stylus 中,您可以更改任何网页的外观。如果你不知道 CSS ,有大量的风格在其他网站上,如 [userstyles.org][18] 。 +[Stylus][17] 是一个用户样式管理器,这意味着可以通过编写自定义 CSS 规则并将其加载到 Stylus 中来更改任何网页的外观。如果你不懂 CSS,在如 [userstyles.org][18] 这样网站上有大量的其他人制作的样式。 -现在,你可能会问,“这不正是什么 [Stylish][19] 么?” 你是对的!你看 Stylus 是基于 Stylish 并提供了更多的改进:它不包含任何遥测数据, 尊重您的隐私,所有开发都是公开的(尽管 Stylish 仍在积极开发, 我一直未能找到最新版本的源代码), 而且它还支持 [UserCSS][20]。 +现在,你可能会问,“这不就是 [Stylish][19] 么?” 你是对的!Stylus 是基于 Stylish 的,并提供了更多的改进:它不包含任何远程记录、尊重你的隐私,所有开发都是公开的(尽管 Stylish 仍在积极开发,我一直未能找到最新版本的源代码),而且它还支持 [UserCSS][20]。 -UserCSS 是一种有趣的格式,尤其是对于开发人员。我已经为不同的网站写了几种用户样式(主要是黑暗的主题和调整,以提高可读性),虽然 Stylus 的内部编辑器很好,我还是喜欢用 Neovim 编辑代码。为了做到这样我所需要做的就是用 ".user.css" 作为本地加载文件的后缀名,在 Stylus 里启动 "Live Reload" 选项,所有更改都会被应用只要我在 Neovim 中启保存和更改文件。远程 UserCSS 文件也支持,因此,每当我将更改推送到 Github 或任何基于 git 的开发平台时,它们将自动对用户可用。(我提供了指向该文件的原始版本的链接, 以便他们可以轻松地访问它。) +UserCSS 是一种有趣的格式,尤其是对于开发人员来说。我已经为不同的网站写了几种用户样式(主要是黑暗主题,和为了提高可读性的调整),虽然 Stylus 的内部编辑器很好,我还是喜欢用 Neovim 编辑代码。为了做到这样我所需要做的就是用 “.user.css” 作为本地加载文件的后缀名,在 Stylus 里启动 “Live Reload” 选项,只要我在 Neovim 中保存文件就会应用所有的更改。它也支持远程 UserCSS 文件,因此,每当我将更改推送到 GitHub 或任何基于 git 的开发平台时,它们将自动对用户可用。(我提供了指向该文件的原始版本的链接,以便他们可以轻松地访问它。) ### uMatrix ![uMatrix Screenshot][22] -uMatrix 的用户使用界面,显示当前访问过的网页的当前规则。 +*uMatrix 的用户界面,显示当前访问过的网页的当前规则。* -Jeremy Garcia 提到了 uBlock Origin 在 [his article][23] 在 Opensource.com 作为一个优秀的 blocker 。我想推荐另一个拓展插件作者是 [gorhill][24]: uMatrix 。 +Jeremy Garcia 在他发表在 Opensource.com 的[文章][23]中提到了一个优秀的拦截器 uBlock Origin。我想提请大家关注另一个由 [gorhill][24] 开发的扩展插件: uMatrix 。 -[uMatrix][25] 允许您为网页上的某些请求设置阻止规则,可以通过点击加载项的弹出窗口来切换(在上面的屏幕截图中可以看到)。 这些请求的区别在于脚本的类别、 scripts, cookies, CSS rules, images, media content, frames,和其他被 uMatrix 标记为 "other" 的 。 例如,您可以设置全局规则, 以便在默认情况下允许所有请求, 并将特定请求添加到黑名单中(更方便的方法),或在默认情况下阻止所有内容, 并手动将某些请求列入白名单 (更安全的方法)。如果您一直在使用NoScript 或 RequestPolicy,你可以 [import][26] 你的白名单规则。 +[uMatrix][25] 允许你为网页上的某些请求设置拦截规则,可以通过点击该加载项的弹出窗口来切换(在上面的屏幕截图中可以看到)。这些请求的区别在于脚本的类别、脚本发起的请求、cookies、CSS 规则、图像、媒体、帧,和被 uMatrix 标记为“other” 的其它内容。例如,你可以设置全局规则,以便在默认情况下允许所有请求,并将特定的请求添加到黑名单中(更方便的方法),或在默认情况下阻止所有内容,并手动将某些请求列入白名单(更安全的方法)。如果你一直在使用 NoScript 或 RequestPolicy,你可以从它们 [导入][26] 你的白名单规则。 -另外 uMatrix 支持 [hosts files ][27],可用于阻止来自某些网站的请求。 不能与原始 uBlock 的筛选列表相比, 其使用的语法是 Adblock Plus 。默认情况下, uMatrix 会在几个文件的帮助下阻止已知分发广告、跟踪器和恶意软件的服务器, 如果需要, 您可以添加更多外部源。 +另外 uMatrix 支持 [hosts 文件][27],可用于阻止来自某些域的请求。不要与 uBlock Origin 所使用的筛选列表混淆,它使用的语法同 Adblock Plus 一样。默认情况下,uMatrix 会通过几个 hosts 文件阻止已知的分发广告、跟踪器和恶意软件的服务器,如果需要,你可以添加更多外部数据源。 -那么你将选择哪一个-- uBlock Origin 或 uMatrix ?就个人而言,我在电脑上两个都用,只在安卓手机上用 uMatrix 。两者之间会有重叠的部分 [according to gorhill][28] ,但他们有不同的用户和目标群,如果你想要的只是阻止跟踪器和广告的简单方法, uBlock Origine 是更好的选择, 另一方面,如果您希望对网页在浏览器中可以执行或不能执行的操作进行精细的控制, 即使需要一些时间来进行配置, 并且可能会阻止网站按预期运行, uMatrix 是更好的选择。 +那么你将选择哪一个:uBlock Origin 或 uMatrix ?就个人而言,我在电脑上两个都用,而只在安卓手机上用 uMatrix 。[据 gorhill 所说][28],两者之间存在某种重叠,但它们有不同的目标用户和目地。如果你想要的只是阻止跟踪器和广告的简单方法,uBlock Origine 是更好的选择;另一方面,如果你希望对网页在浏览器中可以执行或不能执行的操作进行精细的控制,即使需要一些时间来进行配置,并且可能会阻止某些网站如预期的工作,uMatrix 也是更好的选择。 ### 结论 -目前, 这些是 Firefox 里我最喜欢的扩展。Tridactyl 是依靠键盘和与外部程序交互, 加快浏览导航速度;Open With 能让我用鼠标点击程序操作, Stylus 是明确的用户风格的管理器, 对用户和开发人员都有吸引力; uMatrix 本质上是 Firefox 的防火墙用于过滤未知的请求。 +目前,这些是 Firefox 里我最喜欢的扩展。Tridactyl 通过依靠键盘和与外部程序交互,加快了浏览导航速度;Open With 能让我用鼠标在另外一个程序中打开页面;Stylus 是全面的用户样式管理器,对用户和开发人员都很有吸引力;uMatrix 本质上是 Firefox 的防火墙,可以用于过滤未知的请求。 -尽管我几乎完全讨论了这些加载项的好处,但没有一个软件是完美的。如果你喜欢他们中的任何一个,并认为他们可以以任何方式改进, 我建议你去他们的 Github 页面,并寻找他们的贡献指南。通常情况下,免费和开源软件的开发人员欢迎错误报告和提交请求。告诉你的朋友或道谢也是帮助开发者的好方法, 特别是如果他们在业余时间从事他们的项目。 +尽管我基本上只是讨论了这些加载项的好处,但没有一个软件是完美的。如果你喜欢它们中的任何一个,并认为它们的某些方面可以改进,我建议你去它们的 Github 页面,并查看它们的贡献指南。通常情况下,自由开源软件的开发人员是欢迎错误报告和提交请求的。告诉你的朋友或道谢也是帮助开发者的好方法,特别是如果这些开发者是在业余时间从事他们的项目的话。 -------------------------------------------------------------------------------- @@ -74,7 +76,7 @@ via: https://opensource.com/article/18/6/firefox-open-source-extensions 作者:[Zsolt Szakács][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From dbb3e6d6f6e5ecc5388e2df21e7474a552051a17 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 11:09:26 +0800 Subject: [PATCH 0689/4278] PUB:20180604 4 Firefox extensions worth checking out.md @lixinyuxx https://linux.cn/article-10462-1.html --- .../20180604 4 Firefox extensions worth checking out.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180604 4 Firefox extensions worth checking out.md (100%) diff --git a/translated/tech/20180604 4 Firefox extensions worth checking out.md b/published/20180604 4 Firefox extensions worth checking out.md similarity index 100% rename from translated/tech/20180604 4 Firefox extensions worth checking out.md rename to published/20180604 4 Firefox extensions worth checking out.md From 4b4d3b1bfba3e4cb18067737541b1abeffde5dd8 Mon Sep 17 00:00:00 2001 From: Asche Date: Mon, 21 Jan 2019 11:19:26 +0800 Subject: [PATCH 0690/4278] Translating by asche910 --- sources/tech/20190115 Linux Tools- The Meaning of Dot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md index 5e18c7603d..6f03c7f549 100644 --- a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md +++ b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (asche910) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5b19b7df4ccf58d9cc21af8b659f7d1133a222da Mon Sep 17 00:00:00 2001 From: Asche Date: Mon, 21 Jan 2019 13:54:54 +0800 Subject: [PATCH 0691/4278] =?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 --- ...0190115 Linux Tools- The Meaning of Dot.md | 105 ++++++++++-------- 1 file changed, 59 insertions(+), 46 deletions(-) diff --git a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md index 6f03c7f549..8898fcf180 100644 --- a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md +++ b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md @@ -7,44 +7,47 @@ [#]: via: (https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot) [#]: author: (Paul Brown https://www.linux.com/users/bro66) -Linux Tools: The Meaning of Dot +Linux 工具: 点的含义 ====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/psychedelic-dot.jpg?itok=giKEHvwQ) -Let's face it: writing one-liners and scripts using shell commands can be confusing. Many of the names of the tools at your disposal are far from obvious in terms of what they do ( _grep_ , _tee_ and _awk_ , anyone?) and, when you combine two or more, the resulting "sentence" looks like some kind of alien gobbledygook. +我们会面对这样的现实:使用shell命令编写简短的脚本可能会令人很困惑。很多任你使用的工具的名称与它们的实际功能相差甚远(_grep_ , _tee_ 和 _awk_ ,还有吗?), 并且当你将两个或更多个组合起来时,产生的“句子”看起来像某种外星人官样文章。 -None of the above is helped by the fact that many of the symbols you use to build a chain of instructions can mean different things depending on their context. -### Location, location, location +由于这样一个现实: 你用来编写一连串的指令所使用的符号标志根据你使用的场景有着不同的意义。所以它对我们上面的事并没有给予到帮助。 -Take the humble dot (`.`) for example. Used with instructions that are expecting the name of a directory, it means "this directory" so this: +### 位置,位置,位置 + + +就拿这个谦卑的点 (`.`) 为例。 它与接收一个目录名称的指令一起使用,表示“当前目录”: ``` find . -name "*.jpg" ``` -translates to " _find in this directory (and all its subdirectories) files that have names that end in`.jpg`_ ". +意思就是“_在当前目录(包括子目录)中寻找以`.jpg`结尾的文件_” -Both `ls .` and `cd .` act as expected, so they list and "change" to the current directory, respectively, although including the dot in these two cases is not necessary. +`ls .` and `cd .`结果也同期望的那样,他们分别列举和“进入”到当前目录,虽然在这两种情况下点都是多余的。 -Two dots, one after the other, in the same context (i.e., when your instruction is expecting a directory path) means " _the directory immediately above the current one_ ". If you are in _/home/your_directory_ and run +两个点,一个紧接着另一个,同样的场景下(即当你的命令期望一个文件目录的时候)表示“_当前目录的父目录_”。如果你当前在 _/home/your_directory_ 下并且运行 ``` cd .. ``` -you will be taken to _/home_. So, you may think this still kind of fits into the “dots represent nearby directories” narrative and is not complicated at all, right? +你就会进入到 _/home_。所以,你可能认为这仍然适合“点代表附近目录”的叙述,并且毫不复杂,对吧? -How about this, then? If you use a dot at the beginning of a directory or file, it means the directory or file will be hidden: + +那这样会怎样呢?如果你在一个文件或目录的开头加上点,它表示这个文件或目录会被隐藏: ``` $ touch somedir/file01.txt somedir/file02.txt somedir/.secretfile.txt $ ls -l somedir/ total 0 -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file01.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file02.txt -$ # Note how there is no .secretfile.txt in the listing above +$ # 注意上面列举的文件中没有 .secretfile.txt $ ls -la somedir/ total 8 drwxr-xr-x 2 paul paul 4096 Jan 13 19:57 . @@ -52,128 +55,138 @@ drwx------ 48 paul paul 4096 Jan 13 19:57 .. -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file01.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file02.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 .secretfile.txt -$ # The -a option tells ls to show "all" files, including the hidden ones +$ # 这个 -a 选项告诉 ls 去展示"all" 文件, 包括那些隐藏的 ``` -And then there's when you use `.` as a command. Yep! You heard me: `.` is a full-fledged command. It is a synonym of `source` and you use that to execute a file in the current shell, as opposed to running a script some other way (which usually mean Bash will spawn a new shell in which to run it). +然后就是你将`.`当作命令。是的,你听我说过:`.`是个羽翼丰满的命令。它是`source` 的代名词 所以在当前shell中你可以用它来执行一个文件,而不是以某些方法去运行一个脚本文件(这样通常指的是Bash会产生一个新的shell去运行它) -Confused? Don't worry -- try this: Create a script called _myscript_ that contains the line + +很困惑?别担心 -- 试试这个:创建一个名为 _myscript_ 的脚本,内容包含下面一行 ``` myvar="Hello" ``` -and execute it the regular way, that is, with `sh myscript` (or by making the script executable with `chmod a+x myscript` and then running `./myscript`). Now try and see the contents of `myvar` with `echo $myvar` (spoiler: You will get nothing). This is because, when your script plunks " _Hello_ " into `myvar`, it does so in a separate bash shell instance. When the script ends, the spawned instance disappears and control returns to the original shell, where `myvar` never even existed. -However, if you run _myscript_ like this: +然后通过常规的方法执行它,也就是用 `sh myscript`(或者通过 `chmod a+x myscript` 命令让它可执行,然后运行`./myscript`)。现在尝试并且观察`myvar` 的内容 ,通过`echo $myvar` (理所当然的你什么也得不到)。那是因为,当你的脚本赋值“_Hello_”给`myvar`时,它是在一个隔离的bash shell实例中进行的。当脚本运行结束时,这个新产生的实例会消失并且控制权转交给原来的shell,而原来的shell甚至都不存在`myvar` 变量。 + +然而,如果你这样运行 _myscript_ : ``` . myscript ``` -`echo $myvar` will print _Hello_ to the command line. -You will often use the `.` (or `source`) command after making changes to your _.bashrc_ file, [like when you need to expand your `PATH` variable][1]. You use `.` to make the changes available immediately in your current shell instance. +`echo $myvar` 就会打印 _Hello_ 到命令行上。 -### Double Trouble +当你的 _.bashrc_ 文件发生变化后,你经常会用到`.` (或 `source`) 命令, [就像当你要扩展 `PATH` 变量那样][1] ,在你的当前shell实例中,你使用`.`来让变化立即生效。 -Just like the seemingly insignificant single dot has more than one meaning, so has the double dot. Apart from pointing to the parent of the current directory, the double dot (`..`) is also used to build sequences. +### 双重麻烦 -Try this: +就像看似无关紧要的一个点有多个含义一样,两个点也是如此。除了指向当前目录的父级之外,两个点(`..`)也用于构建序列。 + +尝试下这个: ``` echo {1..10} ``` -It will print out the list of numbers from 1 to 10. In this context, `..` means " _starting with the value on my left, count up to the value on my right_ ". - -Now try this: +它会打印出从1到10的序列。这种场景下,`..` 表示 “_从左边的值开始,计数到右边的值_”. +现在试下这个: ``` echo {1..10..2} ``` -You'll get _1 3 5 7 9_. The `..2` part of the command tells Bash to print the sequence, but not one by one, but two by two. In other words, you'll get all the odd numbers from 1 to 10. - -It works backwards, too: +你会得到 _1 3 5 7 9_ 。`..2`这部分命令告诉Bash输出这个序列,不过不是每个相差1,而是相差2。换句话说,就是你会得到从1到10之间的奇数。 +反着它也仍然有效: ``` echo {10..1..2} ``` -You can also pad your numbers with 0s. Doing: + +你也可以用多个0填充你的数字。这样: ``` echo {000..121..2} ``` -will print out every even number from 0 to 121 like this: +会这样打印出从0到121之间的偶数: ``` 000 002 004 006 ... 050 052 054 ... 116 118 120 ``` -But how is this sequence-generating construct useful? Well, suppose one of your New Year's resolutions is to be more careful with your accounts. As part of that, you want to create directories in which to classify your digital invoices of the last 10 years: + +不过这样的序列发生器怎样才有作用呢?当然,假设您的新年决心之一是对您的帐户更加谨慎。 作为其中一部分,您需要创建目录,以便对过去10年的数字发票进行分类: ``` mkdir {2009..2019}_Invoices ``` -Job done. +工作完成。 -Or maybe you have a hundreds of numbered files, say, frames extracted from a video clip, and, for whatever reason, you want to remove only every third frame between the frames 43 and 61: +或者你可能有数百个带编号的文件,比如从视频剪辑中提取的帧,无论出于什么原因,你只想删除第43帧和第61帧之间的每隔三帧: ``` rm frame_{043..61..3} ``` -It is likely that, if you have more than 100 frames, they will be named with padded 0s and look like this: + +很可能,如果你有超过100帧,它们将以填充0命名,如下所示: ``` frame_000 frame_001 frame_002 ... ``` -That’s why you will use `043` in your command instead of just `43`. +那就是为什么你要用 `043` 在你的命令中,而不是`43` 的原因。 ### Curly~Wurly -Truth be told, the magic of sequences lies not so much in the double dot as in the sorcery of the curly braces (`{}`). Look how it works for letters, too. Doing: + + +说实话,序列的神奇之处不在于双点,就像花括号(`{}`)的巫术一样。 看看它对于字母是如何工作的。这样做: ``` touch file_{a..z}.txt ``` -creates the files _file_a.txt_ through _file_z.txt_. -You must be careful, however. Using a sequence like `{Z..a}` will run through a bunch of non-alphanumeric characters (glyphs that are neither numbers or letters) that live between the uppercase alphabet and the lowercase one. Some of these glyphs are unprintable or have a special meaning of their own. Using them to generate names of files could lead to a whole bevy of unexpected and potentially unpleasant effects. +创建了从 _file_a.txt_ 到 _file_z.txt_ 的文件。 -One final thing worth pointing out about sequences encased between `{...}` is that they can also contain lists of strings: + +但是,你必须小心。 使用像`{Z..a}`这样的序列将运行大量字母和小写字母之间的一堆非字母数字字符(既不是数字或字母的字形)。 其中一些字形是不可打印的或具有自己的特殊含义。 使用它们来生成文件名称可能会导致一系列意外和可能令人不快的影响。 + +最后一件值得指出的事:包围在`{...}`的序列,它们也可以包含字符串的列举: ``` touch {blahg, splurg, mmmf}_file.txt ``` -Creates _blahg_file.txt_ , _splurg_file.txt_ and _mmmf_file.txt_. +创建了 _blahg_file.txt_ , _splurg_file.txt_ and _mmmf_file.txt_. -Of course, in other contexts, the curly braces have different meanings (surprise!). But that is the stuff of another article. -### Conclusion +当然,在别的场景中,大括号也有不同的含义(惊喜!)。不过那是别的文章的内容了。 -Bash and the utilities you can run within it have been shaped over decades by system administrators looking for ways to solve very particular problems. To say that sysadmins and their ways are their own breed of special would be an understatement. Consequently, as opposed to other languages, Bash was not designed to be user-friendly, easy or even logical. +### 总结 -That doesn't mean it is not powerful -- quite the contrary. Bash's grammar and shell tools may be inconsistent and sprawling, but they also provide a dizzying range of ways to do everything you can possibly imagine. It is like having a toolbox where you can find everything from a power drill to a spoon, as well as a rubber duck, a roll of duct tape, and some nail clippers. -Apart from fascinating, it is also fun to discover all you can achieve directly from within the shell, so next time we will delve ever deeper into how you can build bigger and better Bash command lines. +系统管理员开发Bash和你可以在上面使用的工具集已有数十载,他们仍在寻找着解决各种特殊问题的方法。要说系统管理员和他们的方式是他们自己的特殊品味将是轻描淡写。总而言之,与其他语言相反,Bash的设计并不是用户友好,简单甚至合乎逻辑的。 -Until then, have fun! +这并不意味着它不强大 -- 恰恰相反。 Bash的语法和shell工具可能不一致且庞大,但它们也提供了一系列令人眼花缭乱的方法来完成您可能想象到的一切。 就像有一个工具箱,你可以找到从电钻到勺子的所有东西,以及橡皮鸭,一卷胶带和一些指甲钳。 + +除了引人入胜之外,发现你可以直接在shell中实现的所有内容也很有趣,所以下次我们将深入探讨如何构建更大更好的Bash命令行。 + +在那之前,玩得开心! -------------------------------------------------------------------------------- via: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot 作者:[Paul Brown][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[asche910](https://github.com/asche910) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ecce20e01b2fe6fc19ebd8f20fd14f6e139bf786 Mon Sep 17 00:00:00 2001 From: Asche Date: Mon, 21 Jan 2019 13:58:53 +0800 Subject: [PATCH 0692/4278] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190115 Linux Tools- The Meaning of Dot.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190115 Linux Tools- The Meaning of Dot.md (100%) diff --git a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md b/translated/tech/20190115 Linux Tools- The Meaning of Dot.md similarity index 100% rename from sources/tech/20190115 Linux Tools- The Meaning of Dot.md rename to translated/tech/20190115 Linux Tools- The Meaning of Dot.md From ec894eaa883dae86295fd828d9b498f257df824f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 21:24:24 +0800 Subject: [PATCH 0693/4278] PUB:20171119 The Ruby Story.md @wwhio https://linux.cn/article-10463-1.html --- {translated/talk => published}/20171119 The Ruby Story.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20171119 The Ruby Story.md (100%) diff --git a/translated/talk/20171119 The Ruby Story.md b/published/20171119 The Ruby Story.md similarity index 100% rename from translated/talk/20171119 The Ruby Story.md rename to published/20171119 The Ruby Story.md From 41b7db830f8db9f401280f70e62a4a0c22b6f2e1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 22:45:50 +0800 Subject: [PATCH 0694/4278] PRF:20190114 How To Move Multiple File Types Simultaneously From Commandline.md @MjSeven --- ...e Types Simultaneously From Commandline.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md index 691dc85d26..9cf54e8196 100644 --- a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md +++ b/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) @@ -12,20 +12,20 @@ ![](https://www.ostechnix.com/wp-content/uploads/2019/01/Move-Multiple-File-Types-720x340.png) -前几天,我想知道如何将多个文件类型从一个目录移动(不复制)到另一个目录。我已经知道如何[**查找并将某些类型的文件从一个目录复制到另一个目录**][1]。但是,我不知道如何同时移动多种文件类型。如果你曾遇到这样的情况,我知道在类 Unix 系统中从命令行执行该操作的一个简单方法。 +前几天,我想知道如何将多个文件类型从一个目录移动(不复制)到另一个目录。我已经知道如何[查找并将某些类型的文件从一个目录复制到另一个目录][1]。但是,我不知道如何同时移动多种文件类型。如果你曾遇到这样的情况,我知道在类 Unix 系统中从命令行执行该操作的一个简单方法。 ### 同时移动多种文件类型 -想象一下这种场景,你在名为 **‘dir1’** 的目录中有多种类型的文件,例如 .pdf, .doc, .mp3, .mp4, .txt 等等。我们来看看 dir1 的内容: +想象一下这种场景,你在名为 `dir1` 的目录中有多种类型的文件,例如 .pdf、 .doc、 .mp3、 .mp4、 .txt 等等。我们来看看 `dir1` 的内容: ``` $ ls dir1 file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 ``` -你希望将某些文件类型(不是所有文件类型)移动到另一个位置。例如,假设你想将 doc, pdf 和 txt 文件一次性移动到名为 **‘dir2’** 的另一个目录中。 +你希望将某些文件类型(不是所有文件类型)移动到另一个位置。例如,假设你想将 .doc、 .pdf 和 .txt 文件一次性移动到名为 `dir2` 的另一个目录中。 -要同时将 .doc, .pdf 和 .txt 文件从 dir1 移动到 dir2,命令是: +要同时将 .doc、 .pdf 和 .txt 文件从 `dir1` 移动到 `dir2`,命令是: ``` $ mv dir1/*.{doc,pdf,txt} dir2/ @@ -33,31 +33,32 @@ $ mv dir1/*.{doc,pdf,txt} dir2/ 很容易,不是吗? -现在让我们来查看一下 dir2 的内容: +现在让我们来查看一下 `dir2` 的内容: + ``` $ ls dir2/ file.txt mydoc.doc personal.pdf ``` -看到了吗?只有 .doc, .pdf 和 .txt 从 dir1 移到了 dir2。 +看到了吗?只有 .doc、 .pdf 和 .txt 从 `dir1` 移到了 `dir2`。 ![][3] 在上面的命令中,你可以在花括号内添加任意数量的文件类型,以将它们移动到不同的目录中。它在 Bash 上非常适合我。 -另一种移动多种文件类型的方法是转到源目录,在我们的例子中即为 dir1: +另一种移动多种文件类型的方法是转到源目录,在我们的例子中即为 `dir1`: ``` $ cd ~/dir1 ``` -将你选择的文件类型移动到目的地(即 dir2),如下所示: +将你选择的文件类型移动到目的地(即 `dir2`),如下所示: ``` $ mv *.doc *.txt *.pdf /home/sk/dir2/ ``` -要移动具有特定扩展名的所有文件,例如 **.doc**,运行: +要移动具有特定扩展名的所有文件,例如 .doc,运行: ``` $ mv dir1/*.doc dir2/ @@ -82,7 +83,7 @@ via: https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-fr 作者:[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 ac0237db73413c1afa3b6a33187cbae6692a49fe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 22:46:28 +0800 Subject: [PATCH 0695/4278] PUB:20190114 How To Move Multiple File Types Simultaneously From Commandline.md @MjSeven https://linux.cn/article-10464-1.html --- ...ove Multiple File Types Simultaneously From Commandline.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 How To Move Multiple File Types Simultaneously From Commandline.md (98%) diff --git a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md similarity index 98% rename from translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md rename to published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md index 9cf54e8196..738306b94c 100644 --- a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md +++ b/published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10464-1.html) [#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) [#]: via: (https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 5d005466e8e272ad68ad7bdb8161e9df33595282 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 00:02:13 +0800 Subject: [PATCH 0696/4278] PRF:20190115 Linux Tools- The Meaning of Dot.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @asche910 恭喜你,完成了第一篇翻译贡献! --- ...0190115 Linux Tools- The Meaning of Dot.md | 99 +++++++++---------- 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/translated/tech/20190115 Linux Tools- The Meaning of Dot.md b/translated/tech/20190115 Linux Tools- The Meaning of Dot.md index 8898fcf180..cb373ecd51 100644 --- a/translated/tech/20190115 Linux Tools- The Meaning of Dot.md +++ b/translated/tech/20190115 Linux Tools- The Meaning of Dot.md @@ -1,46 +1,45 @@ [#]: collector: (lujun9972) [#]: translator: (asche910) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Linux Tools: The Meaning of Dot) [#]: via: (https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot) [#]: author: (Paul Brown https://www.linux.com/users/bro66) -Linux 工具: 点的含义 +Linux 工具:点的含义 ====== +> Paul Brown 解释了 Linux shell 命令中那个不起眼的“点”的各种意思和用法。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/psychedelic-dot.jpg?itok=giKEHvwQ) -我们会面对这样的现实:使用shell命令编写简短的脚本可能会令人很困惑。很多任你使用的工具的名称与它们的实际功能相差甚远(_grep_ , _tee_ 和 _awk_ ,还有吗?), 并且当你将两个或更多个组合起来时,产生的“句子”看起来像某种外星人官样文章。 +在现实情况中,使用 shell 命令编写的单行命令或脚本可能会令人很困惑。你使用的很多工具的名称与它们的实际功能相差甚远(`grep`、`tee` 和 `awk`,还有吗?),而当你将两个或更多个组合起来时,所组成的 “句子” 看起来更像某种外星人的天书。 +因此,上面说的这些对于你并无帮助,因为你用来编写一连串的指令所使用的符号根据你使用的场景有着不同的意义。 -由于这样一个现实: 你用来编写一连串的指令所使用的符号标志根据你使用的场景有着不同的意义。所以它对我们上面的事并没有给予到帮助。 +### 位置、位置、位置 -### 位置,位置,位置 - - -就拿这个谦卑的点 (`.`) 为例。 它与接收一个目录名称的指令一起使用,表示“当前目录”: +就拿这个不起眼的点(`.`)来说吧。当它放在一个需要一个目录名称的命令的参数处时,表示“当前目录”: ``` find . -name "*.jpg" ``` -意思就是“_在当前目录(包括子目录)中寻找以`.jpg`结尾的文件_” +意思就是“在当前目录(包括子目录)中寻找以 `.jpg` 结尾的文件”。 -`ls .` and `cd .`结果也同期望的那样,他们分别列举和“进入”到当前目录,虽然在这两种情况下点都是多余的。 +`ls .` 和 `cd .` 结果也如你想的那样,它们分别列举和“进入”到当前目录,虽然在这两种情况下这个点都是多余的。 +而一个紧接着另一个的两个点呢,在同样的场景下(即当你的命令期望一个文件目录的时候)表示“当前目录的父目录”。如果你当前在 `/home/your_directory` 下并且运行: -两个点,一个紧接着另一个,同样的场景下(即当你的命令期望一个文件目录的时候)表示“_当前目录的父目录_”。如果你当前在 _/home/your_directory_ 下并且运行 ``` cd .. ``` -你就会进入到 _/home_。所以,你可能认为这仍然适合“点代表附近目录”的叙述,并且毫不复杂,对吧? +你就会进入到 `/home`。所以,你可能认为这仍然适合“点代表附近目录”的叙述,并且毫不复杂,对吧? +那下面这样会怎样呢?如果你在一个文件或目录的开头加上点,它表示这个文件或目录会被隐藏: - -那这样会怎样呢?如果你在一个文件或目录的开头加上点,它表示这个文件或目录会被隐藏: ``` $ touch somedir/file01.txt somedir/file02.txt somedir/.secretfile.txt $ ls -l somedir/ @@ -55,71 +54,68 @@ drwx------ 48 paul paul 4096 Jan 13 19:57 .. -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file01.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file02.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 .secretfile.txt -$ # 这个 -a 选项告诉 ls 去展示"all" 文件, 包括那些隐藏的 +$ # 这个 -a 选项告诉 ls 去展示“all”文件,包括那些隐藏的 ``` -然后就是你将`.`当作命令。是的,你听我说过:`.`是个羽翼丰满的命令。它是`source` 的代名词 所以在当前shell中你可以用它来执行一个文件,而不是以某些方法去运行一个脚本文件(这样通常指的是Bash会产生一个新的shell去运行它) +然后就是你可以将 `.` 当作命令。是的,你听我说:`.` 是个真真正正的命令。它是 `source` 命令的代名词,所以你可以用它在当前 shell 中执行一个文件,而不是以某种其它的方式去运行一个脚本文件(这通常指的是 Bash 会产生一个新的 shell 去运行它) - -很困惑?别担心 -- 试试这个:创建一个名为 _myscript_ 的脚本,内容包含下面一行 +很困惑?别担心 —— 试试这个:创建一个名为 `myscript` 的脚本,内容包含下面一行: ``` myvar="Hello" ``` +然后通过常规的方法执行它,也就是用 `sh myscript`(或者通过 `chmod a+x myscript` 命令让它可执行,然后运行 `./myscript`)。现在尝试并且观察 `myvar` 的内容,通过 `echo $myvar`(理所当然你什么也得不到)。那是因为,当你的脚本赋值 `"Hello"` 给 `myvar` 时,它是在一个隔离的bash shell 实例中进行的。当脚本运行结束时,这个新产生的实例会消失并且将控制权转交给原来的shell,而原来的 shell 里甚至都不存在 `myvar` 变量。 -然后通过常规的方法执行它,也就是用 `sh myscript`(或者通过 `chmod a+x myscript` 命令让它可执行,然后运行`./myscript`)。现在尝试并且观察`myvar` 的内容 ,通过`echo $myvar` (理所当然的你什么也得不到)。那是因为,当你的脚本赋值“_Hello_”给`myvar`时,它是在一个隔离的bash shell实例中进行的。当脚本运行结束时,这个新产生的实例会消失并且控制权转交给原来的shell,而原来的shell甚至都不存在`myvar` 变量。 +然而,如果你这样运行 `myscript`: - -然而,如果你这样运行 _myscript_ : ``` . myscript ``` +`echo $myvar` 就会打印 `Hello` 到命令行上。 -`echo $myvar` 就会打印 _Hello_ 到命令行上。 - -当你的 _.bashrc_ 文件发生变化后,你经常会用到`.` (或 `source`) 命令, [就像当你要扩展 `PATH` 变量那样][1] ,在你的当前shell实例中,你使用`.`来让变化立即生效。 +当你的 `.bashrc` 文件发生变化后,你经常会用到 `.`(或 `source`)命令,[就像当你要扩展 `PATH` 变量那样][1]。在你的当前 shell 实例中,你可以使用 `.` 来让变化立即生效。 ### 双重麻烦 就像看似无关紧要的一个点有多个含义一样,两个点也是如此。除了指向当前目录的父级之外,两个点(`..`)也用于构建序列。 - 尝试下这个: + ``` echo {1..10} ``` -它会打印出从1到10的序列。这种场景下,`..` 表示 “_从左边的值开始,计数到右边的值_”. +它会打印出从 1 到 10 的序列。在这种场景下,`..` 表示 “从左边的值开始,计数到右边的值”。 现在试下这个: + ``` echo {1..10..2} ``` -你会得到 _1 3 5 7 9_ 。`..2`这部分命令告诉Bash输出这个序列,不过不是每个相差1,而是相差2。换句话说,就是你会得到从1到10之间的奇数。 +你会得到 `1 3 5 7 9`。`..2` 这部分命令告诉 Bash 输出这个序列,不过不是每个相差 1,而是相差 2。换句话说,就是你会得到从 1 到 10 之间的奇数。 + +它反着也仍然有效: -反着它也仍然有效: ``` echo {10..1..2} ``` - -你也可以用多个0填充你的数字。这样: +你也可以用多个 0 填充你的数字。这样: ``` echo {000..121..2} ``` -会这样打印出从0到121之间的偶数: +会这样打印出从 0 到 121 之间的偶数(填充了前置 0): ``` 000 002 004 006 ... 050 052 054 ... 116 118 120 ``` - -不过这样的序列发生器怎样才有作用呢?当然,假设您的新年决心之一是对您的帐户更加谨慎。 作为其中一部分,您需要创建目录,以便对过去10年的数字发票进行分类: +不过这样的序列发生器有啥用呢?当然,假设您的新年决心之一是更加谨慎控制您的帐户花销。作为决心的一部分,您需要创建目录,以便对过去 10 年的数字发票进行分类: ``` mkdir {2009..2019}_Invoices @@ -127,59 +123,52 @@ mkdir {2009..2019}_Invoices 工作完成。 +或者你可能有数百个带编号的文件,比如从视频剪辑中提取的帧,或许因为某种原因,你只想从第 43 帧到第 61 帧每隔三帧删除一帧: -或者你可能有数百个带编号的文件,比如从视频剪辑中提取的帧,无论出于什么原因,你只想删除第43帧和第61帧之间的每隔三帧: ``` rm frame_{043..61..3} ``` - -很可能,如果你有超过100帧,它们将以填充0命名,如下所示: +很可能,如果你有超过 100 个帧,它们将以填充 0 命名,如下所示: ``` frame_000 frame_001 frame_002 ... ``` -那就是为什么你要用 `043` 在你的命令中,而不是`43` 的原因。 +那就是为什么你在命令中要用 `043`,而不是`43` 的原因。 -### Curly~Wurly +### 花括号花招 - - -说实话,序列的神奇之处不在于双点,就像花括号(`{}`)的巫术一样。 看看它对于字母是如何工作的。这样做: +说实话,序列的神奇之处不在于双点,而是花括号(`{}`)的巫术。看看它对于字母是如何工作的。这样做: ``` touch file_{a..z}.txt ``` +它创建了从 `file_a.txt` 到 `file_z.txt` 的文件。 -创建了从 _file_a.txt_ 到 _file_z.txt_ 的文件。 +但是,你必须小心。使用像 `{Z..a}` 这样的序列将产生一大堆大写字母和小写字母之间的非字母、数字的字符(既不是数字或字母的字形)。其中一些字形是不可打印的或具有自己的特殊含义。使用它们来生成文件名称可能会导致一系列意外和可能令人不快的影响。 - -但是,你必须小心。 使用像`{Z..a}`这样的序列将运行大量字母和小写字母之间的一堆非字母数字字符(既不是数字或字母的字形)。 其中一些字形是不可打印的或具有自己的特殊含义。 使用它们来生成文件名称可能会导致一系列意外和可能令人不快的影响。 - -最后一件值得指出的事:包围在`{...}`的序列,它们也可以包含字符串的列举: +最后一件值得指出的事:包围在 `{...}` 的序列,它们也可以包含字符串列表: ``` touch {blahg, splurg, mmmf}_file.txt ``` -创建了 _blahg_file.txt_ , _splurg_file.txt_ and _mmmf_file.txt_. +将创建了 `blahg_file.txt`、`splurg_file.txt` 和 `mmmf_file.txt`。 - -当然,在别的场景中,大括号也有不同的含义(惊喜!)。不过那是别的文章的内容了。 +当然,在别的场景中,大括号也有不同的含义(惊喜吗!)。不过那是别的文章的内容了。 ### 总结 +Bash 以及运行于其中的各种工具已经被寻求解决各种特定问题的系统管理员们把玩了数十年。要说这种有自己之道的系统管理员是一种特殊物种的话,那是有点轻描淡写。总而言之,与其他语言相反,Bash 的设计目标并不是为了用户友好、简单、甚至合乎逻辑。 -系统管理员开发Bash和你可以在上面使用的工具集已有数十载,他们仍在寻找着解决各种特殊问题的方法。要说系统管理员和他们的方式是他们自己的特殊品味将是轻描淡写。总而言之,与其他语言相反,Bash的设计并不是用户友好,简单甚至合乎逻辑的。 +但这并不意味着它不强大 —— 恰恰相反。Bash 的语法和 shell 工具可能不一致且很庞大,但它们也提供了一系列令人眼花缭乱的方法来完成您可能想象到的一切。就像有一个工具箱,你可以从中找到从电钻到勺子的所有东西,以及橡皮鸭、一卷胶带和一些指甲钳。 -这并不意味着它不强大 -- 恰恰相反。 Bash的语法和shell工具可能不一致且庞大,但它们也提供了一系列令人眼花缭乱的方法来完成您可能想象到的一切。 就像有一个工具箱,你可以找到从电钻到勺子的所有东西,以及橡皮鸭,一卷胶带和一些指甲钳。 - - -除了引人入胜之外,发现你可以直接在shell中实现的所有内容也很有趣,所以下次我们将深入探讨如何构建更大更好的Bash命令行。 +除了引人入胜之外,探明你可以直接在 shell 中达成的所有能力也很有趣,所以下次我们将深入探讨如何构建更大更好的 Bash 命令行。 在那之前,玩得开心! + -------------------------------------------------------------------------------- via: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot @@ -187,7 +176,7 @@ via: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot 作者:[Paul Brown][a] 选题:[lujun9972][b] 译者:[asche910](https://github.com/asche910) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fdcfd346c048504834a8319bf152e524583175b7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 00:03:51 +0800 Subject: [PATCH 0697/4278] PUB:20190115 Linux Tools- The Meaning of Dot.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @asche910 本文首发地址: https://linux.cn/article-10465-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/asche910 请注册领取 LCCN: https://lctt.linux.cn/ --- .../20190115 Linux Tools- The Meaning of Dot.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190115 Linux Tools- The Meaning of Dot.md (99%) diff --git a/translated/tech/20190115 Linux Tools- The Meaning of Dot.md b/published/20190115 Linux Tools- The Meaning of Dot.md similarity index 99% rename from translated/tech/20190115 Linux Tools- The Meaning of Dot.md rename to published/20190115 Linux Tools- The Meaning of Dot.md index cb373ecd51..6c5cfe5032 100644 --- a/translated/tech/20190115 Linux Tools- The Meaning of Dot.md +++ b/published/20190115 Linux Tools- The Meaning of Dot.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (asche910) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10465-1.html) [#]: subject: (Linux Tools: The Meaning of Dot) [#]: via: (https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot) [#]: author: (Paul Brown https://www.linux.com/users/bro66) From 3d9a5add0e2346b0f41b260d7a7cfba303452666 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 22 Jan 2019 08:55:35 +0800 Subject: [PATCH 0698/4278] translated --- .../20190104 Managing dotfiles with rcm.md | 116 ------------------ .../20190104 Managing dotfiles with rcm.md | 116 ++++++++++++++++++ 2 files changed, 116 insertions(+), 116 deletions(-) delete mode 100644 sources/tech/20190104 Managing dotfiles with rcm.md create mode 100644 translated/tech/20190104 Managing dotfiles with rcm.md diff --git a/sources/tech/20190104 Managing dotfiles with rcm.md b/sources/tech/20190104 Managing dotfiles with rcm.md deleted file mode 100644 index f046c70538..0000000000 --- a/sources/tech/20190104 Managing dotfiles with rcm.md +++ /dev/null @@ -1,116 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Managing dotfiles with rcm) -[#]: via: (https://fedoramagazine.org/managing-dotfiles-rcm/) -[#]: author: (Link Dupont https://fedoramagazine.org/author/linkdupont/) - -Managing dotfiles with rcm -====== - -![](https://fedoramagazine.org/wp-content/uploads/2018/12/dotfiles-816x345.jpg) - -A hallmark feature of many GNU/Linux programs is the easy-to-edit configuration file. Nearly all common free software programs store configuration settings inside a plain text file, often in a structured format like JSON, YAML or [“INI-like”][1]. These configuration files are frequently found hidden inside a user’s home directory. However, a basic ls won’t reveal them. UNIX standards require that any file or directory name that begins with a period (or “dot”) is considered “hidden” and will not be listed in directory listings unless requested by the user. For example, to list all files using the ls program, pass the -a command-line option. - -Over time, these configuration files become highly customized, and managing them becomes increasingly more challenging as time goes on. Not only that, but keeping them synchronized between multiple computers is a common challenge in large organizations. Finally, many users find a sense of pride in their unique configuration settings and want an easy way to share them with friends. That’s where **rcm** steps in. - -**rcm** is a “rc” file management suite (“rc” is another convention for naming configuration files that has been adopted by some GNU/Linux programs like screen or bash). **rcm** provides a suite of commands to manage and list files it tracks. Install **rcm** using **dnf**. - -### Getting started - -By default, **rcm** uses ~/.dotfiles for storing all the dotfiles it manages. A managed dotfile is actually stored inside ~/.dotfiles, and a symlink is placed in the expected file’s location. For example, if ~/.bashrc is tracked by **rcm** , a long listing would look like this. - -``` -[link@localhost ~]$ ls -l ~/.bashrc -lrwxrwxrwx. 1 link link 27 Dec 16 05:19 .bashrc -> /home/link/.dotfiles/bashrc -[link@localhost ~]$ -``` - -**rcm** consists of 4 commands: - - * mkrc – convert a file into a dotfile managed by rcm - * lsrc – list files managed by rcm - * rcup – synchronize dotfiles managed by rcm - * rcdn – remove all the symlinks managed by rcm - - - -### Share bashrc across two computers - -It is not uncommon today for a user to have shell accounts on more than one computer. Keeping dotfiles synchronized between those computers can be a challenge. This scenario will present one possible solution, using only **rcm** and **git**. - -First, convert (or “bless”) a file into a dotfile managed by **rcm** with mkrc. - -``` -[link@localhost ~]$ mkrc -v ~/.bashrc -Moving... -'/home/link/.bashrc' -> '/home/link/.dotfiles/bashrc' -Linking... -'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' -[link@localhost ~]$ -``` - -Next, verify the listings are correct with lsrc. - -``` -[link@localhost ~]$ lsrc -/home/link/.bashrc:/home/link/.dotfiles/bashrc -[link@localhost ~]$ -``` - -Now create a git repository inside ~/.dotfiles and set up an accessible remote repository using your choice of hosted git repositories. Commit the bashrc file and push a new branch. - -``` -[link@localhost ~]$ cd ~/.dotfiles -[link@localhost .dotfiles]$ git init -Initialized empty Git repository in /home/link/.dotfiles/.git/ -[link@localhost .dotfiles]$ git remote add origin git@github.com:linkdupont/dotfiles.git -[link@localhost .dotfiles]$ git add bashrc -[link@localhost .dotfiles]$ git commit -m "initial commit" -[master (root-commit) b54406b] initial commit -1 file changed, 15 insertions(+) -create mode 100644 bashrc -[link@localhost .dotfiles]$ git push -u origin master -... -[link@localhost .dotfiles]$ -``` - -On the second machine, clone this repository into ~/.dotfiles. - -``` -[link@remotehost ~]$ git clone git@github.com:linkdupont/dotfiles.git ~/.dotfiles -... -[link@remotehost ~]$ -``` - -Now update the symlinks managed by **rcm** with rcup. - -``` -[link@remotehost ~]$ rcup -v -replacing identical but unlinked /home/link/.bashrc -removed '/home/link/.bashrc' -'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' -[link@remotehost ~]$ -``` - -Overwrite the existing ~/.bashrc (if it exists) and restart the shell. - -That’s it! The host-specific option (-o) is a useful addition to the scenario above. And as always, be sure to read the manpages; they contain a wealth of example commands. - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/managing-dotfiles-rcm/ - -作者:[Link Dupont][a] -选题:[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/linkdupont/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/INI_file diff --git a/translated/tech/20190104 Managing dotfiles with rcm.md b/translated/tech/20190104 Managing dotfiles with rcm.md new file mode 100644 index 0000000000..fa4ea324d2 --- /dev/null +++ b/translated/tech/20190104 Managing dotfiles with rcm.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing dotfiles with rcm) +[#]: via: (https://fedoramagazine.org/managing-dotfiles-rcm/) +[#]: author: (Link Dupont https://fedoramagazine.org/author/linkdupont/) + +用 rcm 管理隐藏文件 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/12/dotfiles-816x345.jpg) + +许多 GNU/Linux 程序的一个特点是易于编辑的配置文件。几乎所有常见的自由软件都将配置设置保存在纯文本文件中,通常采用结构化格式,如 JSON、YAML或[“类 ini”][1]。这些配置文件经常隐藏在用户的主目录中。但是,基本的 ls 不会显示它们。UNIX 标准要求以点开头的任何文件或目录名称都被视为“隐藏”,除非用户请求,否则不会列在目录列表中。例如,要使用 ls 列出所有文件,要传递 -a 选项。 + +随着时间的推移,这些配置文件变得高度自定义,管理它们变得越来越具有挑战性。不仅如此,在多台计算机之间保持同步是大型组织的共同挑战。最后,许多用户对其独特的配置感到自豪,并希望以简单的方式与朋友分享。这就是用到 **rcm** 介入的地方。 + +**rcm** 是一个 “rc” 文件管理套件(“rc” 是命名配置文件的另一种约定,它已被某些 GNU/Linux 程序采用,如 screen 或 bash)。 **rcm** 提供了一套命令来管理和列出它跟踪的文件。使用 **dnf** 安装 **rcm**。 + +### 开始使用 + +默认情况下,**rcm** 使用 ~/.dotfiles 保存它管理的所有隐藏文件。托管的隐藏文件实际保存在 ~/.dotfiles 中,并保存符号链接在文件原本的位置。例如,如果 ~/.bashrc 由 **rcm** 跟踪,那么详细列表将如下所示。 + +``` +[link@localhost ~]$ ls -l ~/.bashrc +lrwxrwxrwx. 1 link link 27 Dec 16 05:19 .bashrc -> /home/link/.dotfiles/bashrc +[link@localhost ~]$ +``` + +**rcm** 包含 4 个命令: + + * mkrc – 将文件转换为由 rcm 管理的隐藏文件 + * lsrc – 列出由 rcm 管理的文件 + * rcup – 同步由 rcm 管理的隐藏文件 + * rcdn – 删除 rcm 管理的所有符号链接 + + + +### 在两台计算机上共享 bashrc + +如今用户在多台计算机上拥有 shell 帐户并不罕见。在这些计算机之间同步隐藏文件可能是一个挑战。这里将提供一种可能的解决方案,仅使用 **rcm** 和 **git**。 + +首先使用 mkrc 将文件转换成由 **rcm** 管理的文件。 + +``` +[link@localhost ~]$ mkrc -v ~/.bashrc +Moving... +'/home/link/.bashrc' -> '/home/link/.dotfiles/bashrc' +Linking... +'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' +[link@localhost ~]$ +``` + +接下来使用 lsrc 验证列表。 + +``` +[link@localhost ~]$ lsrc +/home/link/.bashrc:/home/link/.dotfiles/bashrc +[link@localhost ~]$ +``` + +现在在 ~/.dotfiles 中创建一个 git 仓库,并使用你选择的 git 仓库托管设置一个远程仓库。提交 bashrc 文件并推送一个新分支。 + +``` +[link@localhost ~]$ cd ~/.dotfiles +[link@localhost .dotfiles]$ git init +Initialized empty Git repository in /home/link/.dotfiles/.git/ +[link@localhost .dotfiles]$ git remote add origin git@github.com:linkdupont/dotfiles.git +[link@localhost .dotfiles]$ git add bashrc +[link@localhost .dotfiles]$ git commit -m "initial commit" +[master (root-commit) b54406b] initial commit +1 file changed, 15 insertions(+) +create mode 100644 bashrc +[link@localhost .dotfiles]$ git push -u origin master +... +[link@localhost .dotfiles]$ +``` + +在第二台机器上,克隆这个仓库到 ~/.dotfiles 中。 + +``` +[link@remotehost ~]$ git clone git@github.com:linkdupont/dotfiles.git ~/.dotfiles +... +[link@remotehost ~]$ +``` + +现在使用 rcup 更新受 **rcm** 管理的符号链接。 + +``` +[link@remotehost ~]$ rcup -v +replacing identical but unlinked /home/link/.bashrc +removed '/home/link/.bashrc' +'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' +[link@remotehost ~]$ +``` + +覆盖现有的 ~/.bashrc(如果存在)并重启 shell。 + +就是这些了!指定主机选项 (-o) 是对上面这种情况的有用补充。如往常一样,请阅读手册页。它们包含了很多示例命令。 + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/managing-dotfiles-rcm/ + +作者:[Link Dupont][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/linkdupont/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/INI_file From a478f1f8f9eac68e727a949a9ee4ad1dff21d9e9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 22 Jan 2019 08:58:30 +0800 Subject: [PATCH 0699/4278] translating --- sources/tech/20190109 Bash 5.0 Released with New Features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md index 46d9aeae59..17b0c5758a 100644 --- a/sources/tech/20190109 Bash 5.0 Released with New Features.md +++ b/sources/tech/20190109 Bash 5.0 Released with New Features.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From edea7b23d6d4ed838c8be4b2864cc46a02e15d49 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 10:46:39 +0800 Subject: [PATCH 0700/4278] PRF:20190104 Managing dotfiles with rcm.md @geekpi --- .../20190104 Managing dotfiles with rcm.md | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/translated/tech/20190104 Managing dotfiles with rcm.md b/translated/tech/20190104 Managing dotfiles with rcm.md index fa4ea324d2..b01e0ced33 100644 --- a/translated/tech/20190104 Managing dotfiles with rcm.md +++ b/translated/tech/20190104 Managing dotfiles with rcm.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Managing dotfiles with rcm) @@ -12,15 +12,15 @@ ![](https://fedoramagazine.org/wp-content/uploads/2018/12/dotfiles-816x345.jpg) -许多 GNU/Linux 程序的一个特点是易于编辑的配置文件。几乎所有常见的自由软件都将配置设置保存在纯文本文件中,通常采用结构化格式,如 JSON、YAML或[“类 ini”][1]。这些配置文件经常隐藏在用户的主目录中。但是,基本的 ls 不会显示它们。UNIX 标准要求以点开头的任何文件或目录名称都被视为“隐藏”,除非用户请求,否则不会列在目录列表中。例如,要使用 ls 列出所有文件,要传递 -a 选项。 +许多 GNU/Linux 程序的一个特点是有个易于编辑的配置文件。几乎所有常见的自由软件都将配置设置保存在纯文本文件中,通常采用结构化格式,如 JSON、YAML 或[“类似 ini”][1] 的文件中。这些配置文件经常隐藏在用户的主目录中。但是,基本的 `ls` 不会显示它们。UNIX 标准要求以点开头的任何文件或目录名称都被视为“隐藏”,除非用户特意要求,否则不会列在目录列表中。例如,要使用 `ls` 列出所有文件,要传递 `-a` 选项。 -随着时间的推移,这些配置文件变得高度自定义,管理它们变得越来越具有挑战性。不仅如此,在多台计算机之间保持同步是大型组织的共同挑战。最后,许多用户对其独特的配置感到自豪,并希望以简单的方式与朋友分享。这就是用到 **rcm** 介入的地方。 +随着时间的推移,这些配置文件会有很多定制配置,管理它们变得越来越具有挑战性。不仅如此,在多台计算机之间保持同步是大型组织所面临的共同挑战。最后,许多用户也对其独特的配置感到自豪,并希望以简单的方式与朋友分享。这就是用到 rcm 介入的地方。 -**rcm** 是一个 “rc” 文件管理套件(“rc” 是命名配置文件的另一种约定,它已被某些 GNU/Linux 程序采用,如 screen 或 bash)。 **rcm** 提供了一套命令来管理和列出它跟踪的文件。使用 **dnf** 安装 **rcm**。 +rcm 是一个 “rc” 文件管理套件(“rc” 是命名配置文件的另一种约定,它已被某些 GNU/Linux 程序采用,如 `screen` 或 `bash`)。 rcm 提供了一套命令来管理和列出它跟踪的文件。使用 `dnf` 安装 rcm。 ### 开始使用 -默认情况下,**rcm** 使用 ~/.dotfiles 保存它管理的所有隐藏文件。托管的隐藏文件实际保存在 ~/.dotfiles 中,并保存符号链接在文件原本的位置。例如,如果 ~/.bashrc 由 **rcm** 跟踪,那么详细列表将如下所示。 +默认情况下,rcm 使用 `~/.dotfiles` 来存储它管理的所有隐藏文件。一个被管理的隐藏文件实际保存在 `~/.dotfiles` 目录中,而它的符号链接会放在文件原本的位置。例如,如果 `~/.bashrc` 由 rcm 所管理,那么详细列表将如下所示。 ``` [link@localhost ~]$ ls -l ~/.bashrc @@ -28,20 +28,18 @@ lrwxrwxrwx. 1 link link 27 Dec 16 05:19 .bashrc -> /home/link/.dotfiles/bashrc [link@localhost ~]$ ``` -**rcm** 包含 4 个命令: - - * mkrc – 将文件转换为由 rcm 管理的隐藏文件 - * lsrc – 列出由 rcm 管理的文件 - * rcup – 同步由 rcm 管理的隐藏文件 - * rcdn – 删除 rcm 管理的所有符号链接 - +rcm 包含 4 个命令: + * `mkrc` – 将文件转换为由 rcm 管理的隐藏文件 + * `lsrc` – 列出由 rcm 管理的文件 + * `rcup` – 同步由 rcm 管理的隐藏文件 + * `rcdn` – 删除 rcm 管理的所有符号链接 ### 在两台计算机上共享 bashrc -如今用户在多台计算机上拥有 shell 帐户并不罕见。在这些计算机之间同步隐藏文件可能是一个挑战。这里将提供一种可能的解决方案,仅使用 **rcm** 和 **git**。 +如今用户在多台计算机上拥有 shell 帐户并不罕见。在这些计算机之间同步隐藏文件可能是一个挑战。这里将提供一种可能的解决方案,仅使用 rcm 和 git。 -首先使用 mkrc 将文件转换成由 **rcm** 管理的文件。 +首先使用 `mkrc` 将文件转换成由 rcm 管理的文件。 ``` [link@localhost ~]$ mkrc -v ~/.bashrc @@ -52,7 +50,7 @@ Linking... [link@localhost ~]$ ``` -接下来使用 lsrc 验证列表。 +接下来使用 `lsrc` 验证列表是否正确。 ``` [link@localhost ~]$ lsrc @@ -60,7 +58,7 @@ Linking... [link@localhost ~]$ ``` -现在在 ~/.dotfiles 中创建一个 git 仓库,并使用你选择的 git 仓库托管设置一个远程仓库。提交 bashrc 文件并推送一个新分支。 +现在在 `~/.dotfiles` 中创建一个 git 仓库,并使用你选择的 git 仓库托管设置一个远程仓库。提交 `bashrc` 文件并推送一个新分支。 ``` [link@localhost ~]$ cd ~/.dotfiles @@ -77,7 +75,7 @@ create mode 100644 bashrc [link@localhost .dotfiles]$ ``` -在第二台机器上,克隆这个仓库到 ~/.dotfiles 中。 +在第二台机器上,克隆这个仓库到 `~/.dotfiles` 中。 ``` [link@remotehost ~]$ git clone git@github.com:linkdupont/dotfiles.git ~/.dotfiles @@ -85,7 +83,7 @@ create mode 100644 bashrc [link@remotehost ~]$ ``` -现在使用 rcup 更新受 **rcm** 管理的符号链接。 +现在使用 `rcup` 更新受 rcm 管理的符号链接。 ``` [link@remotehost ~]$ rcup -v @@ -95,10 +93,9 @@ removed '/home/link/.bashrc' [link@remotehost ~]$ ``` -覆盖现有的 ~/.bashrc(如果存在)并重启 shell。 - -就是这些了!指定主机选项 (-o) 是对上面这种情况的有用补充。如往常一样,请阅读手册页。它们包含了很多示例命令。 +覆盖现有的 `~/.bashrc`(如果存在)并重启 shell。 +就是这些了!指定主机选项 (`-o`) 是对上面这种情况的有用补充。如往常一样,请阅读手册页。它们包含了很多示例命令。 -------------------------------------------------------------------------------- @@ -107,7 +104,7 @@ via: https://fedoramagazine.org/managing-dotfiles-rcm/ 作者:[Link Dupont][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 21525b59c8444f934fe532d59c73c69f988bb3e8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 10:47:22 +0800 Subject: [PATCH 0701/4278] PUB:20190104 Managing dotfiles with rcm.md @geekpi https://linux.cn/article-10466-1.html --- .../tech => published}/20190104 Managing dotfiles with rcm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190104 Managing dotfiles with rcm.md (98%) diff --git a/translated/tech/20190104 Managing dotfiles with rcm.md b/published/20190104 Managing dotfiles with rcm.md similarity index 98% rename from translated/tech/20190104 Managing dotfiles with rcm.md rename to published/20190104 Managing dotfiles with rcm.md index b01e0ced33..ae1169f84e 100644 --- a/translated/tech/20190104 Managing dotfiles with rcm.md +++ b/published/20190104 Managing dotfiles with rcm.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10466-1.html) [#]: subject: (Managing dotfiles with rcm) [#]: via: (https://fedoramagazine.org/managing-dotfiles-rcm/) [#]: author: (Link Dupont https://fedoramagazine.org/author/linkdupont/) From 835c314ae0433ee0d5c1f40c3563ad891963aefa Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 22 Jan 2019 13:52:56 +0800 Subject: [PATCH 0702/4278] Translating An Introduction to Go. --- translated/tech/20181224 An Introduction to Go.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 0f68678f14..78766d9de6 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -137,7 +137,7 @@ Go 提供了三个主要的控制了语句:`if`、`switch` 和 `for`。这些 ### Goroutines -The keyword `go` spawns a new goroutine, a concurrently executed function. It can be used with any function call, even a function literal: +关键词 `go` 会产生一个新的 goroutine,一个可以并行执行的函数。它可以用于任何函数调用,甚至一个匿名函数: ``` func main() { @@ -150,7 +150,7 @@ func main() { } ``` -### Channels +### 信道 Goroutines are often combined with channels to provide an extended form of Communicating Sequential Processes . A channel is a concurrent-safe queue, and can be buffered or unbuffered: From 10f164d39f694de6f86c37bc8a242f889be51a7e Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Tue, 22 Jan 2019 14:12:46 +0800 Subject: [PATCH 0703/4278] 20180319 --- ...t agile development practices for teams.md | 60 ------------------- ...t agile development practices for teams.md | 59 ++++++++++++++++++ 2 files changed, 59 insertions(+), 60 deletions(-) delete mode 100644 sources/talk/20180319 6 common questions about agile development practices for teams.md create mode 100644 translated/talk/20180319 6 common questions about agile development practices for teams.md diff --git a/sources/talk/20180319 6 common questions about agile development practices for teams.md b/sources/talk/20180319 6 common questions about agile development practices for teams.md deleted file mode 100644 index ef472374b4..0000000000 --- a/sources/talk/20180319 6 common questions about agile development practices for teams.md +++ /dev/null @@ -1,60 +0,0 @@ -translated by lixinyuxx -6 common questions about agile development practices for teams -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1) -"Any questions?" - -You’ve probably heard a speaker ask this question at the end of their presentation. This is the most important part of the presentation—after all, you didn't attend just to hear a lecture but to participate in a conversation and a community. - -Recently I had the opportunity to hear my fellow Red Hatters present a session called "[Agile in Practice][1]" to a group of technical students at a local university. During the session, software engineer Tomas Tomecek and agile practitioners Fernando Colleone and Pavel Najman collaborated to explain the foundations of agile methodology and showcase best practices for day-to-day activities. - -### 1\. What is the perfect team size? - -Knowing that students attended this session to learn what agile practice is and how to apply it to projects, I wondered how the students' questions would compare to those I hear every day as an agile practitioner at Red Hat. It turns out that the students asked the same questions as my colleagues. These questions drive straight into the core of agile in practice. - -Students wanted to know the size of a small team versus a large team. This issue is relevant to anyone who has ever teamed up to work on a project. Based on Tomas's experience as a tech leader, 12 people working on a project would be considered a large team. In the real world, team size is not often directly correlated to productivity. In some cases, a smaller team located in a single location or time zone might be more productive than a larger team that's spread around the world. Ultimately, the presenters suggested that the ideal team size is probably five people (which aligns with scrum 7, +-2). - -### 2\. What operational challenges do teams face? - -The presenters compared projects supported by local teams (teams with all members in one office or within close proximity to each other) with distributed teams (teams located in different time zones). Engineers prefer local teams when the project requires close cooperation among team members because delays caused by time differences can destroy the "flow" of writing software. At the same time, distributed teams can bring together skill sets that may not be available locally and are great for certain development use cases. Also, there are various best practices to improve cooperation in distributed teams. - -### 3\. How much time is needed to groom the backlog? - -Because this was an introductory talk targeting students who were new to agile, the speakers focused on [Scrum][2] and [Kanban][3] as ways to make agile specific for them. They used the Scrum framework to illustrate a method of writing software and Kanban for a communication and work planning system. On the question of time needed to groom a project's backlog, the speakers explained that there is no fixed rule. Rather, practice makes perfect: During the early stages of development, when a project is new—and especially if some members of the team are new to agile—grooming can consume several hours per week. Over time and with practice, it becomes more efficient. - -### 4\. Is a product owner necessary? What is their role? - -Product owners help facilitate scaling; however, what matters is not the job title, but that you have someone on your team who represents the customer's voice and goals. In many teams, especially those that are part of a larger group of engineering teams working on a single output, a lead engineer can serve as the product owner. - -### 5\. What agile tools do you suggest using? Is specific software necessary to implement Scrum or Kanban in practice? - -Although using proprietary software such as Jira or Trello can be helpful, especially when working with large numbers of contributors working on big enterprise projects, they are not required. Scrum and Kanban can be done with tools as simple as paper cards. The key is to have a clear source of information and strong communication across the entire team. That said, two excellent open source kanban tools are [Taiga][4] and [Wekan][5]. For more information, see [5 open source alternatives to Trello][6] and [Top 7 open source project management tools for agile teams][7]. - -### 6\. How can students use agile techniques for school projects? - -The presenters encouraged students to use kanban to visualize and outline tasks to be completed before the end of the project. The key is to create a common board so the entire team can see the status of the project. By using kanban or a similar high-visibility strategy, students won’t get to the end of the project and discover that any particular team member has not been keeping up. - -Scrum practices such as sprints and daily standups are also excellent ways to ensure that everyone is making progress and that the various parts of the project will work together at the end. Regular check-ins and information-sharing are also essential. To learn more about Scrum, see [What is scrum?][8]. - -Remember that Kanban and Scrum are just two of many tools and frameworks that make up agile. They may not be the best approach for every situation. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/agile-mindset - -作者:[Dominika Bula][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/dominika -[1]:http://zijemeit.cz/sessions/agile-in-practice/ -[2]:https://www.scrum.org/resources/what-is-scrum -[3]:https://en.wikipedia.org/wiki/Kanban -[4]:https://taiga.io/ -[5]:https://wekan.github.io/ -[6]:https://opensource.com/alternatives/trello -[7]:https://opensource.com/article/18/2/agile-project-management-tools -[8]:https://opensource.com/resources/scrum diff --git a/translated/talk/20180319 6 common questions about agile development practices for teams.md b/translated/talk/20180319 6 common questions about agile development practices for teams.md new file mode 100644 index 0000000000..288e5c7753 --- /dev/null +++ b/translated/talk/20180319 6 common questions about agile development practices for teams.md @@ -0,0 +1,59 @@ +关于团队敏捷开发实践的6个常见问题 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1) +”有问题么?“ + +你可能听过演讲者在演讲结束的时候提出这个问题。这是演讲中最重要的部分--毕竟,你不仅仅是听讲座, 而是参加讨论和社群交流。 + +最近,我有机会听到我的同伴 Red Hatters 给当地一所大学的一群技术型学生做一个名为 “[Agile in Practice][1]” 的讲座。讲座中有软件工程师 Tomas Tomecek 和敏捷开发的从业者 Fernando Colleone 与 Pavel Najman 合作解释敏捷开发方法的基础,并展示最佳实践在日常活动中的应用。 + +### 1.完美的团队规模是多大? + +知道了学生们参加这个课程是为了了解什么是敏捷实践以及如何将其应用于项目,我想知道学生们的问题会与我作为敏捷从业者在 Red Hat 每天听到的问题相比有什么不同。结果学生的疑问和我的同事们如出一辙。这些问题都直指敏捷实践的核心。 + +学生们想知道一个小团队和一个大团队的规模是多少。这个问题与任何曾经合作过做项目的人都是相关的。根据 Tomas 作为技术领导的经验 12 个人从事的项目被认为是一个大型团队。现实中,团队规模通常与生产力没有关系。在有些时候,一个小地区或同一个时区的小团队也许会比一个成员分布在满世界的大团队更具有生产力。最终,讲座建议理想的团队大小大概是5个人(正如 scrum 开发方法的7,+-2)。 + +### 2\. 团队会面临哪些实际挑战? + +演讲者比较了由本地团队组成的项目(团队成员都是一个办公室,或者相邻近的人)与分散型的团队(位于不同时区)。 当项目需要团队成员之间密切合作时,工程师更喜欢本地的团队,因为时间差异造成的延迟可能会破坏软件开发的“流”。同时,分散型团队可以将可能不适用与当地项目但适用于某些开发用例的技能集合在一起。此外,还有各种最佳方法可用于改进分散型团队中的合作方式。 + +### 3\. 整理堆积的工作需要多少时间? + +因为这是一个对于新学习学生的介绍性质的演讲,演讲者关注于用 [Scrum][2] 和 [Kanban][3] 作为介绍敏捷开发的方法。他们使用 Scrum 来作为说明软件编写的方法并且用 Kanban 作为工作规划和沟通的系统。关于需要多少时间来整理项目堆积的工作,演讲者解释说并没有固定的准则,相对的,实践出真知:在开发的早期阶段,当一个崭新的项目—特别如果团队里有新人—每周可能会花费数个小时在整理工作上。随着时间推移和不断地练习,会越来越高效。 + +### 4\. 产品负责人是否是必要的? 他们扮演什么样的角色? + +负责人会帮助团队更方便的拓展,然而,职位并不重要,重要的是你的团队中有人能够传递用户的意愿。在许多团队中,特别是在大型 团队中从事单个任务的团队,首席工程师就可以担任负责人。 + +### 5\.建议使用哪些敏捷开发的工具?使用 Scrum 或 Kanban 做敏捷开发的时候必须用特定的软件么? + +尽管使用一些专业软件例如 Jira 或 Trello 会很有帮助,特别是在与大量从事大型企业项目的工作者合作时,但它们不是必需的。Scrum 和 Kanban 可以使用像纸卡这样简单的工具完成。关键是在团队中要有一个清晰的信息来源和紧密的交流。也就是说,优秀的两个 kanban 开源工具 [Taiga][4] 和 [Wekan][5] 。更多信息请查看 [5 open source alternatives to Trello][6] 和 [Top 7 open source project management tools for agile teams][7] 。 + +### 6\. 学生如何在学校项目中使用敏捷开发技术? + +演讲者鼓励学生使用 kanban 在项目结束前使用可视化和大纲来完成。关键是要创建一个公共板块,这样整个团队就可以看到项目的状态。通过使用 kanban 或者类似的高可视化策略,学生不会在项目后期才发现个别成员没有跟上进度。 + +Scrum 实践比如 sprints 和 daily standups 也是确认每个人都在进步的绝佳方法项目的各个部分最终会一起发挥作用。定期检查和信息共享也至关重要。更多关于 Scrum 的信息,访问 [What is scrum?][8] 。 + +牢记 Kanban 和 Scrum 只是敏捷开发中众多框架和工具中的两个。它们可能不是应对每一种情况的最佳方法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/3/agile-mindset + +作者:[Dominika Bula][a] +译者:[lixinyuxx](https://github.com/lixinxyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/dominika +[1]:http://zijemeit.cz/sessions/agile-in-practice/ +[2]:https://www.scrum.org/resources/what-is-scrum +[3]:https://en.wikipedia.org/wiki/Kanban +[4]:https://taiga.io/ +[5]:https://wekan.github.io/ +[6]:https://opensource.com/alternatives/trello +[7]:https://opensource.com/article/18/2/agile-project-management-tools +[8]:https://opensource.com/resources/scrum From 026072ab642fb654b416b9ead7305611a211d1d0 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Tue, 22 Jan 2019 21:58:00 +0800 Subject: [PATCH 0704/4278] =?UTF-8?q?20190107=20Get=20started=20with=20Pel?= =?UTF-8?q?ican...=20=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 --- ...n- A Python-based static site generator.md | 223 ------------------ ...n- A Python-based static site generator.md | 221 +++++++++++++++++ 2 files changed, 221 insertions(+), 223 deletions(-) delete mode 100644 sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md create mode 100644 translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md diff --git a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md deleted file mode 100644 index ed5c7f0dc0..0000000000 --- a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md +++ /dev/null @@ -1,223 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Pelican: A Python-based static site generator) -[#]: via: (https://opensource.com/article/19/1/getting-started-pelican) -[#]: author: (Craig Sebenik https://opensource.com/users/craig5) - -Getting started with Pelican: A Python-based static site generator -====== -Pelican is a great choice for Python users who want to self-host a simple website or blog. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0) - -If you want to create a custom website or blog, you have a lot of options. Many providers will host your website and do much of the work for you. (WordPress is an extremely popular option.) But you lose some flexibility by using a hosted solution. As a software developer, I prefer to manage my own server and keep more freedom in how my website operates. - -However, it is a fair amount of work to manage a web server. Installing it and getting a simple application up to serve content is easy enough. But keeping on top of security patches and updates is very time-consuming. If you just want to serve static web pages, having a web server and a host of applications may be more effort than it's worth. Creating HTML pages by hand is also not a good option. - -This is where a static site generator can come in. These applications use templates to create all the static pages you want and cross-link them with associated metadata. (e.g., showing all the pages with a common tag or keyword.) Static site generators help you create a site with a common look and feel using elements like navigation areas and a header and footer. - -I have been using [Python][1] for years now. So, when I first started looking for something to generate static HTML pages, I wanted something written in Python. The main reason is that I often want to peek into the internals of how an application works, and using a language that I already know makes that easier. (If that isn't important to you or you don't use Python, there are some other great [static site generators][2] that use Ruby, JavaScript, and other languages.) - -I decided to give [Pelican][3] a try. It is a commonly used static site generator written in Python. It directly supports [reStructuredText][4] and can support [Markdown][5] when the required package is installed. All the tasks are performed via command-line interface (CLI) tools, which makes it simple for anyone familiar with the command line. And its simple quickstart CLI tool makes creating a website extremely easy. - -In this article, I'll explain how to install Pelican 4, add an article, and change the default theme. (Note: This was all developed on MacOS; it should work the same using any flavor of Unix/Linux, but I don't have a Windows host to test on.) - -### Installation and configuration - -The first step is to create a [virtualenv][6] and install Pelican. - -``` -$ mkdir test-site -$ cd test-site -$ python3 -m venv venv -$ ./venv/bin/pip install --upgrade pip -... -Successfully installed pip-18.1 -$ ./venv/bin/pip install pelican -Collecting pelican -... -Successfully installed MarkupSafe-1.1.0 blinker-1.4 docutils-0.14 feedgenerator-1.9 jinja2-2.10 pelican-4.0.1 pygments-2.3.1 python-dateutil-2.7.5 pytz-2018.7 six-1.12.0 unidecode-1.0.23 -``` - -To keep things simple, I entered values for the title and author and replied N to URL prefix and article pagination. (For the rest of the questions, I used the default given.) - -Pelican's quickstart CLI tool will create the basic layout and a few files to get you started. Run the **pelican-quickstart** command. To keep things simple, I entered values for the **title** and **author** and replied **N** to URL prefix and article pagination. It is very easy to change these settings in the configuration file later. - -``` -$ ./venv/bin/pelicanquickstart -Welcome to pelicanquickstart v4.0.1. - -This script will help you create a new Pelican-based website. - -Please answer the following questions so this script can generate the files needed by Pelican. - -> Where do you want to create your new web site? [.] -> What will be the title of this web site? My Test Blog -> Who will be the author of this web site? Craig -> What will be the default language of this web site? [en] -> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n -> Do you want to enable article pagination? (Y/n) n -> What is your time zone? [Europe/Paris] -> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) -> Do you want to upload your website using FTP? (y/N) -> Do you want to upload your website using SSH? (y/N) -> Do you want to upload your website using Dropbox? (y/N) -> Do you want to upload your website using S3? (y/N) -> Do you want to upload your website using Rackspace Cloud Files? (y/N) -> Do you want to upload your website using GitHub Pages? (y/N) -Done. Your new project is available at /Users/craig/tmp/pelican/test-site -``` - -All the files you need to get started are ready to go. - -The quickstart defaults to the Europe/Paris time zone, so change that before proceeding. Open the **pelicanconf.py** file in your favorite text editor. Look for the **TIMEZONE** variable. - -``` -TIMEZONE = 'Europe/Paris' -``` - -Change it to **UTC**. - -``` -TIMEZONE = 'UTC' -``` - -To update the social settings, look for the **SOCIAL** variable in **pelicanconf.py**. - -``` -SOCIAL = (('You can add links in your config file', '#'), -          ('Another social link', '#'),) -``` - -I'll add a link to my Twitter account. - -``` -SOCIAL = (('Twitter (#craigs55)', 'https://twitter.com/craigs55'),) -``` - -Notice that trailing comma—it's important. That comma helps Python recognize the variable is actually a set. Make sure you don't delete that comma. - -Now you have the basics of a site. The quickstart created a Makefile with a number of targets. Giving the **devserver** target to **make** will start a development server on your machine so you can preview everything. The CLI commands used in the Makefile are assumed to be part of your **PATH** , so you need to **activate** the **virtualenv** first. - -``` -$ source ./venv/bin/activate -$ make devserver -pelican -lr /Users/craig/tmp/pelican/test-site/content o -/Users/craig/tmp/pelican/test-site/output -s /Users/craig/tmp/pelican/test-site/pelicanconf.py - --> Modified: theme, settings. regenerating... -WARNING: No valid files found in content for the active readers: -   | BaseReader (static) -   | HTMLReader (htm, html) -   | RstReader (rst) -Done: Processed 0 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.18 seconds. -``` - -Point your favorite browser to to see your simple test blog. - -![](https://opensource.com/sites/default/files/uploads/pelican_test-site1.png) - -You can see the Twitter link on the right side and some links to Pelican, Python, and Jinja to the left of it. (Jinja is a great templating language that Pelican can use. You can learn more about it in [Jinja's documentation][7].) - -### Adding content - -Now that you have a basic site, add some content. First, add a file called **welcome.rst** to the site's **content** directory. In your favorite text editor, create a file with the following text: - -``` -$ pwd -/Users/craig/tmp/pelican/test-site -$ cat content/welcome.rst - -Welcome to my blog! -################### - -:date: 20181216 08:30 -:tags: welcome -:category: Intro -:slug: welcome -:author: Craig -:summary: Welcome document - -Welcome to my blog. -This is a short page just to show how to put up a static page. -``` - -The metadata lines—date, tags, etc.—are automatically parsed by Pelican. - -After you write the file, the **devserver** should output something like this: - -``` --> Modified: content. regenerating... -Done: Processed 1 article, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.10 seconds. -``` - -Reload your test site in your browser to view the changes. - -![](https://opensource.com/sites/default/files/uploads/pelican_test-site2.png) - -The metadata (e.g., date and tags) were automatically added to the page. Also, Pelican automatically detected the **intro** category and added the section to the top navigation. - -### Change the theme - -One of the nicest parts of working with popular, open source software like Pelican is that many users will make changes and contribute them back to the project. Many of the contributions are in the form of themes. - -A site's theme sets colors, layout options, etc. It's really easy to try out new themes. You can preview many of them at [Pelican Themes][8]. - -First, clone the GitHub repo: - -``` -$ cd .. -$ git clone --recursive https://github.com/getpelican/pelicanthemes -Cloning into 'pelicanthemes'... -``` - -Since I like the color blue, I'll try [blueidea][9]. - -Edit **pelicanconf.py** and add the following line: - -``` -THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' -``` - -The **devserver** will regenerate your output. Reload the webpage in your browser to see the new theme. - -![](https://opensource.com/sites/default/files/uploads/pelican_test-site3.png) - -The theme controls many aspects of the layout. For example, in the default theme, you can see the category (Intro) with the meta tags next to the article. But that category is not displayed in the blueidea theme. - -### Other considerations - -This was a pretty quick introduction to Pelican. There are a couple of important topics that I did not cover. - -First, one reason I was hesitant to move to a static site was that it wouldn't allow discussions on the articles. Fortunately, there are some third-party providers that will host discussions for you. The one I am currently looking at is [Disqus][10]. - -Next, everything above was done on my local machine. If I want others to view my site, I'll have to upload the pre-generated HTML files somewhere. If you look at the **pelican-quickstart** output, you will see options for using FTP, SSH, S3, and even GitHub Pages. Each option has its pros and cons. But, if I had to choose one, I would likely publish to GitHub Pages. - -Pelican has many other features—I am still learning more about it every day. If you want to self-host a website or a blog with simple, static content and you want to use Python, Pelican is a great choice. It has an active user community that is fixing bugs, adding features, and creating new and interesting themes. Give it a try! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/getting-started-pelican - -作者:[Craig Sebenik][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/craig5 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/resources/python -[2]: https://opensource.com/sitewide-search?search_api_views_fulltext=static%20site%20generator -[3]: http://docs.getpelican.com/en/stable/ -[4]: http://docutils.sourceforge.net/rst.html -[5]: https://daringfireball.net/projects/markdown/ -[6]: https://virtualenv.pypa.io/en/latest/ -[7]: http://jinja.pocoo.org/docs/2.10/ -[8]: http://www.pelicanthemes.com/ -[9]: https://github.com/nasskach/pelican-blueidea/tree/58fb13112a2707baa7d65075517c40439ab95c0a -[10]: https://disqus.com/ diff --git a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md new file mode 100644 index 0000000000..bc82a69c54 --- /dev/null +++ b/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Pelican: A Python-based static site generator) +[#]: via: (https://opensource.com/article/19/1/getting-started-pelican) +[#]: author: (Craig Sebenik https://opensource.com/users/craig5) + +Pelican 简介:一个 Python 静态网站生成器 +====== +Pelican 是那些想要自我托管简单网站或博客的 Python 用户的绝佳选择。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0) + +如果你想创建一个自定义网站或博客,有很多选择。许多提供商将托管你的网站并为你完成大部分工作。(WordPress 是一个非常受欢迎的选项。)但是使用托管方案,你会失去一些灵活性。作为一名软件开发人员,我更喜欢管理我自己的服务器,并在我的网站如何运行方面保持更多的自由。 + +然而,管理 Web 服务器需要大量的工作。安装它并获得一个简单的应用程序来提供内容是非常容易的。但是,维护安全补丁和更新是非常耗时得。如果你只想提供静态网页,那么拥有一个 Web 服务器和一系列应用程序可能会得不偿失。手动创建 HTML 页面也不是一个好选择。 + +这是静态网站生成器的用武之地。这些应用程序使用模板来创建所需的静态页面,并将它们与关联的元数据交叉链接。(例如,所有显示的页面都带有公共标签或关键词。)静态网站生成器可以帮助你使用导航区域,页眉和页脚等元素创建一个具有公共外观的网站。 + +我使用 [Pyhton][1] 已经很多年了,所以,当我第一次开始寻找生成静态 HTML 页面的东西时,我想要用 Python 编写的东西。主要原因是我经常想要了解应用程序如何工作的内部细节,而使用一种我已经了解的语言使这一点更容易。(如果这对你不重要或者你不使用 Python,那么还有一些其他很棒的[静态网站生成器][2],它们使用 Ruby, JavaScript 和其它语言。) + +我决定试试 [Pelican][3]。它是一个用 Python 编写的常用静态网站生成器。它支持 [reStructuredText][4](译注:这是一种用于文本数据的文件格式,主要用于 Python 社区的技术文档),并且支持 [Markdown][5],这需要通过安装必需的包来完成。所有任务都是通过命令行界面(CLI)工具执行的,这使得熟悉命令行的任何人都可以轻松完成。它简单的 quickstart CLI 工具使得创建一个网站非常容易。 + +在本文中,我将介绍如何安装 Pelican 4,添加一篇文章以及更改默认主题。(注意:我是在 MacOS 上开发的,使用其它 Unix/Linux 实验结果都将相同,但我没有 Windows 主机可以测试。) + +### 安装和配置 + +第一步是创建一个[虚拟环境][6],在虚拟环境中安装 Pelican。 + +``` +$ mkdir test-site +$ cd test-site +$ python3 -m venv venv +$ ./venv/bin/pip install --upgrade pip +... +Successfully installed pip-18.1 +$ ./venv/bin/pip install pelican +Collecting pelican +... +Successfully installed MarkupSafe-1.1.0 blinker-1.4 docutils-0.14 feedgenerator-1.9 jinja2-2.10 pelican-4.0.1 pygments-2.3.1 python-dateutil-2.7.5 pytz-2018.7 six-1.12.0 unidecode-1.0.23 +``` + +为了简单起见,我输入了标题和作者的名字,并对 URL 前缀和文章分页选择了 N。(对于其它选项,我使用了默认值。) + +Pelican 的 quickstart CLI 工具将创建基本布局和一些文件来帮助你开始,运行 **pelican-quickstart** 命令。为了简单起见,我输入了**标题**和**作者**的名字,并对 URL 前缀和文章分页选择了 N。稍后在配置文件中更改这些设置非常容易。 + +``` +$ ./venv/bin/pelicanquickstart +Welcome to pelicanquickstart v4.0.1. + +This script will help you create a new Pelican-based website. + +Please answer the following questions so this script can generate the files needed by Pelican. + +> Where do you want to create your new web site? [.] +> What will be the title of this web site? My Test Blog +> Who will be the author of this web site? Craig +> What will be the default language of this web site? [en] +> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n +> Do you want to enable article pagination? (Y/n) n +> What is your time zone? [Europe/Paris] +> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) +> Do you want to upload your website using FTP? (y/N) +> Do you want to upload your website using SSH? (y/N) +> Do you want to upload your website using Dropbox? (y/N) +> Do you want to upload your website using S3? (y/N) +> Do you want to upload your website using Rackspace Cloud Files? (y/N) +> Do you want to upload your website using GitHub Pages? (y/N) +Done. Your new project is available at /Users/craig/tmp/pelican/test-site +``` + +你需要启动的所有文件都准备好了。 + +quickstart 默认为欧洲/巴黎时区,所以在继续之前更改一下。在你喜欢的文本编辑器中打开 **pelicanconf.py** 文件,寻找 **TIMEZONE** 变量。 + +``` +TIMEZONE = 'Europe/Paris' +``` + +将其改为 **UTC**。 +``` +TIMEZONE = 'UTC' +``` + +要更新公共设置,在 **pelicanconf.py** 中查找 **SOCIAL** 变量。 + +``` +SOCIAL = (('You can add links in your config file', '#'), +          ('Another social link', '#'),) +``` + +我将添加一个我的 Twitter 账户链接。 + +``` +SOCIAL = (('Twitter (#craigs55)', 'https://twitter.com/craigs55'),) +``` + +注意后面的逗号,它很重要。这个逗号将帮助 Python 识别变量实际上是一个集合。确保你没有删除这个逗号。 + +现在你已经有了网站的基本知识。quickstart 创建了一个包含许多目标的 Makefile。将 **devserver** 传给 **make** 命令将在你的计算机上启动一个开发服务器,以便你可以预览所有内容。Makefile 中使用的 CLI 命令是 **PATH** 的一部分,因此你需要首先激活 **virtualenv**。 + +``` +$ source ./venv/bin/activate +$ make devserver +pelican -lr /Users/craig/tmp/pelican/test-site/content o +/Users/craig/tmp/pelican/test-site/output -s /Users/craig/tmp/pelican/test-site/pelicanconf.py + +-> Modified: theme, settings. regenerating... +WARNING: No valid files found in content for the active readers: +   | BaseReader (static) +   | HTMLReader (htm, html) +   | RstReader (rst) +Done: Processed 0 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.18 seconds. +``` + +在你最喜欢的浏览器中打开 来查看你的简单测试博客。 + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site1.png) + +你可以在右侧看到 Twitter 链接,左侧有 Pelican, Python 和 Jinja 的一些链接。(Jinja 是 Pelican 可以使用的一种很棒的模板语言。你可以在 [Jinja 的文档][7]中了解更多相关信息。) + +### 添加内容 + +现在你又了一个基本的网站,试着添加一些内容。首先,将名为 **welcome.rst** 的文件添加到网站的 **content** 目录中。在你喜欢的文本编辑器中,使用以下文本创建一个文件: + +``` +$ pwd +/Users/craig/tmp/pelican/test-site +$ cat content/welcome.rst + +Welcome to my blog! +################### + +:date: 20181216 08:30 +:tags: welcome +:category: Intro +:slug: welcome +:author: Craig +:summary: Welcome document + +Welcome to my blog. +This is a short page just to show how to put up a static page. +``` + +Pelican 会自动解析元数据行,包括日期,标签等。 + +编写完文件后,**devserver** 应该输出以下内容: + +``` +-> Modified: content. regenerating... +Done: Processed 1 article, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.10 seconds. +``` + +在浏览器中刷新你的测试网站来查看更改。 + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site2.png) + +元数据(例如日期和标签)会自动添加到页面中。此外,Pelican 会自动检测到 **intro** 类别,并将该部分添加到顶部导航中。 + +### 更改主题 + +使用像 Pelican 这样流行的开源软件的好处之一是,非常多的用户将进行更改并将其贡献给项目。许多都是以主题形式贡献的。 + +网站的主题会设置颜色,布局选项等。尝试一个新主题非常容易,你可以在 [Pelican 主题][8]中预览其中的许多内容。 + +首先,克隆 GitHub 仓库: + +``` +$ cd .. +$ git clone --recursive https://github.com/getpelican/pelicanthemes +Cloning into 'pelicanthemes'... +``` + +我喜欢蓝色,那么试试 [blueidea][9]。 + +编辑 **pelicanconf.py** ,添加以下行: +``` +THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' +``` + +**devserver** 将重新生成你的输出。在浏览器中刷新网页来查看新主题。 + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site3.png) + +主题控制布局的方方面面。例如,在默认主题中,你可以看到文章旁边带有元标记的类别(Intro),但这个类别并未显示在 blueidea 主题中。 + +### 其他考虑因素 + +本文是对 Pelican 的快速介绍,所以我并没有涉及一些重要的主题。 + +首先,我对迁移到静态站点犹豫不决的一个原因是它无法对文章评论。幸运的是,有一些第三方服务商将为你提供评论功能。我目前正在关注的是 [Disqus][10]。 + +接下来,上面的所有内容都是在我的本地机器上完成的。如果我希望其他人查看我的网站,我将不得不将预先生成的 HTML 文件上传到某个地方。如果你查看 **pelican-quickstart** 输出,你将看到使用 FTP, SSH, S3 甚至 GitHub 页面的选项,每个选项都有其优点和缺点。但是,如果我必须选择一个,那么我可能会选择发布到 GitHub 页面。 + +Pelican 还有许多其他功能,以至于我每天都在学习它。如果你想自托管一个网站或博客,内容简单并且是静态内容,同时你想使用 Python,那么 Pelican 是一个很好的选择。它有一个活跃的用户社区,可以修复 bug,添加特性,而且还会创建新的和有趣的主题。试试看吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/getting-started-pelican + +作者:[Craig Sebenik][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/craig5 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/resources/python +[2]: https://opensource.com/sitewide-search?search_api_views_fulltext=static%20site%20generator +[3]: http://docs.getpelican.com/en/stable/ +[4]: http://docutils.sourceforge.net/rst.html +[5]: https://daringfireball.net/projects/markdown/ +[6]: https://virtualenv.pypa.io/en/latest/ +[7]: http://jinja.pocoo.org/docs/2.10/ +[8]: http://www.pelicanthemes.com/ +[9]: https://github.com/nasskach/pelican-blueidea/tree/58fb13112a2707baa7d65075517c40439ab95c0a +[10]: https://disqus.com/ From 7b3bafc018782e1da84098ccb1918cffca86b4dc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 23:44:39 +0800 Subject: [PATCH 0705/4278] PRF:20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @geekpi --- ...equency, Power And Utilization In Linux.md | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md index 525b264200..a9d94b0011 100644 --- a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md +++ b/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) @@ -10,69 +10,57 @@ s-tui:在 Linux 中监控 CPU 温度、频率、功率和使用率的终端工具 ====== -默认情况下,每个 Linux 管理员都会使用 **[lm_sensors 监控 CPU 温度][1]**。 +一般每个 Linux 管理员都会使用 [lm_sensors 监控 CPU 温度][1]。lm_sensors (Linux 监控传感器)是一个自由开源程序,它提供了监控温度、电压和风扇的驱动和工具。 -lm_sensors (Linux 监控传感器)是一个免费开源程序,它提供监控温度、电压和风扇的工具和驱动。 +如果你正在找替代的 CLI 工具,我会建议你尝试 s-tui。 -如果你正在找替代工具,这有一个 CLI 工具。 - -我会建议你尝试 s-tui。 - -它有一个压力终端 UI,可以帮助管理员通过颜色查看 CPU 温度。 +它其实是一个压力测试的终端 UI,可以帮助管理员通过颜色查看 CPU 温度。 ### s-tui 是什么 -s-tui 是一个用于监控计算机的终端 UI。s-tui 可以在终端以图形方式监控 CPU 温度、频率、功率和使用率。 +s-tui 是一个用于监控计算机的终端 UI。s-tui 可以在终端以图形方式监控 CPU 温度、频率、功率和使用率。此外,它还显示由发热量限制引起的性能下降,它需要很少的资源并且不需要 X 服务器。它是用 Python 编写的,需要 root 权限才能使用它。 -此外,它还显示由热量限制引起的性能下降,它需要很少的资源并且不需要 X 服务器。它是用 Python 编写的,需要 root 权限才能使用它。 +s-tui 是一个独立的程序,可以开箱即用,并且不需要配置文件就可以使用其基本功能。 -s-tui 是一个独立的程序,可以开箱即用,并且不需要配置文件来使用其核心功能。 +s-tui 使用 psutil 来探测你的一些硬件信息。如果不支持你的一些硬件,你可能看不到所有信息。 -s-tui 使用 psutil 来探测你的一些硬件信息。如果你的硬件不受支持,你可能看不到所有信息。 - -以root身份运行 s-tui 时,当压测所有核心时,可以访问到 CPU 的最大睿频频率。 - -它在后台使用 Stress 工具,通过对系统施加某些类型的计算压力来检查其组件的温度是否超过其可接受的范围。 - -只要计算机稳定并且其组件的温度不超过其可接受的范围,超频 PC 就没问题。 - -有几个程序可以通过压力测试得到系统的稳定性,从而评估超频水平。 +以 root 身份运行 s-tui 时,当压测所有 CPU 核心时,可以将 CPU 发挥到最大睿频频率。它在后台使用 Stress 压力测试工具,通过对系统施加某些类型的计算压力来检查其组件的温度是否超过其可接受的范围。只要计算机稳定并且其组件的温度不超过其可接受的范围,PC 超频就没问题。有几个程序可以通过压力测试得到系统的稳定性,从而评估超频水平。 ### 如何在 Linux 中安装 s-tui -它是用 Python 写的,pip 是在 Linux 上安装 s-tui 的推荐方法。确保你在系统上安装了 python-pip 软件包。如果还没有,请使用以下命令进行安装。 +它是用 Python 写的,`pip` 是在 Linux 上安装 s-tui 的推荐方法。确保你在系统上安装了 python-pip 软件包。如果还没有,请使用以下命令进行安装。 -对于 Debian/Ubuntu 用户,使用 **[apt 命令][2]**或 **[apt-get 命令][3]** 来安装 pip。 +对于 Debian/Ubuntu 用户,使用 [apt 命令][2] 或 [apt-get 命令][3] 来安装 `pip`。 ``` $ sudo apt install python-pip stress ``` -对于 Archlinux 用户,使用 **[pacman 命令][4]**来安装 pip。 +对于 Archlinux 用户,使用 [pacman 命令][4] 来安装 `pip`。 ``` $ sudo pacman -S python-pip stress ``` -对于 Fedora 用户,使用 **[dnf 命令][5]**来安装 pip。 +对于 Fedora 用户,使用 [dnf 命令][5] 来安装 `pip`。 ``` $ sudo dnf install python-pip stress ``` -对于 CentOS/RHEL 用户,使用 **[yum 命令][5]**来安装 pip。 +对于 CentOS/RHEL 用户,使用 [yum 命令][5] 来安装 `pip`。 ``` $ sudo yum install python-pip stress ``` -对于 openSUSE 用户,使用 **[zypper 命令][5]**来安装 pip。 +对于 openSUSE 用户,使用 [zypper 命令][5] 来安装 `pip`。 ``` $ sudo zypper install python-pip stress ``` -最后运行下面的 **[pip 命令][8]**在 Linux 中安装 s-tui 工具。 +最后运行下面的 [pip 命令][8] 在 Linux 中安装 s-tui 工具。 对于 Python 2.x: @@ -113,7 +101,7 @@ via: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-tempera 作者:[Prakash Subramanian][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 c075b420028ca7588a6b69c75f03d93e5e507227 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 23:45:26 +0800 Subject: [PATCH 0706/4278] PUB:20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @geekpi https://linux.cn/article-10467-1.html --- ... Temperature, Frequency, Power And Utilization In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md (98%) diff --git a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md similarity index 98% rename from translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md rename to published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md index a9d94b0011..e1effb5acc 100644 --- a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md +++ b/published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (https://linux.cn/article-10467-1.html) +[#]: url: (wxy) [#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) [#]: via: (https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) From 29cc1a1cea6050fd230bc34eceacc5ccfddff250 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 00:24:13 +0800 Subject: [PATCH 0707/4278] PRF:20180625 The life cycle of a software bug.md @lixinyuxx --- ...180625 The life cycle of a software bug.md | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/translated/tech/20180625 The life cycle of a software bug.md b/translated/tech/20180625 The life cycle of a software bug.md index 4f487fa182..672a797015 100644 --- a/translated/tech/20180625 The life cycle of a software bug.md +++ b/translated/tech/20180625 The life cycle of a software bug.md @@ -1,53 +1,55 @@ 软件 bug 的生命周期 ====== +> 从发现软件故障到解决它们,这里讲述是开发团队如何压制软件 bug。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y) -1947年,发现了第一个计算机 bug --被困在计算机继电器中的飞蛾。 +1947 年,发现了第一个计算机 bug —— 被困在计算机继电器中的飞蛾。 -要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长,尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的票务服务和协作来查找和解决 bugs 。 +要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长,尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的工单服务和协作来查找和解决 bug。 ### 确认计算机 bug -在测试过程中,会向开发团队报告 bug 。质量保证人员尽可能详细地描述 bug ,报告他们的系统状态、他们正在进行的进程以及 bug 是如何表现出来的。 +在测试过程中,发现的 bug 会报告给开发团队。质量保证测试人员尽可能详细地描述 bug ,报告他们的系统状态、他们正在进行的过程以及 bug 是如何表现出来的。 -尽管如此,一些 bug 从未得到证实;它们可能会在测试中报告,但永远无法在可控环境中重现。在这种情况下,它们可能得不到解决,而是被关闭。 +尽管如此,一些 bug 从未得到确认;它们可能会在测试中报告,但永远无法在可控环境中重现。在这种情况下,它们可能得不到解决,而是被关闭。 -由于使用的平台种类繁多,用户行为也非常多,因此很难确认计算机 bug ,有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 +有些计算机 bug 可能很难确认,因为使用的平台种类繁多,用户行为也非常多。有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 -许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的,或者可能没有得到充分的描述。不过,由于每个用户和开发人员也都扮演质量保证测试员的角色,至少在一定程度上,很有可能会发现 bug 。 +许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的,或者可能没有得到充分的描述。不过,由于每个用户和开发人员也都扮演质量保证测试人员的角色,至少在一定程度上,bug 还是很有可能会发现的。 确认 bug 后,修复工作就开始了。 ### 分配要修复的 bug -已确认的 bug 被分配给负责解决的开发人员或开发团队。在此阶段,需要重现 bug ,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人修复。无论哪种方式,都会在开发过程中打开票证,并且 bug 将成为已知的问题。 +已确认的 bug 被分配给负责解决的开发人员或开发团队。在此阶段,需要重现 bug,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人修复。无论哪种方式,都会在开发过程中打开一个工单,并且 bug 将成为已知的问题。 -在开源解决方案中,开发人员可以从他们想要解决的 bug 中进行选择,要么选择他们最熟悉的程序区域,要么从优先级最高的的开始。综合解决方案,如 [GitHub][1] 使得多个开发人员能够轻松地处理解决方案,而不会干扰彼此的工作。 +在开源解决方案中,开发人员可以进行选择他们想要解决的 bug,要么选择他们最熟悉的程序区域,要么从优先级最高的的开始。综合解决方案,如 [GitHub][1] 使得多个开发人员能够轻松地着手解决,而不会干扰彼此的工作。 -在分配要修复的 bug 时,记录者还可以为 bug 选择优先级。主要得 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式,所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,适当的回溯到优先级高的的需求也会很有帮助。 +当将 bug 设置为需要修复时,bug 报告者还可以为该 bug 选择优先级。主要的 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式,所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,适当的回溯到优先级高的需求也会很有帮助。 ### 解决 bug -一旦修复了 bug ,通常会将其作为已解决的 bug 发送回质量保证。然后,质量保证再次将产品置于其步伐中,以重现 bug。如果无法重现 bug ,质量保证将假定它已得到适当解决。 +一旦修复了 bug ,通常会将其作为已解决的 bug 发送回质量保证测试人员。然后,质量保证测试人员再次将产品置于其工作中,以重现 bug。如果无法重现 bug ,质量保证测验人员将假定它已得到适当解决。 -在开源情况下,任何更改都是分布式的,通常是作为正在测试的暂定版本。此测试版本分发给用户,用户再次履行质量保证的职责并测试产品。 +在开源情况下,任何更改都会被分发,通常是作为正在测试的暂定版本。此测试版本分发给用户,用户再次履行质量保证测试人员的职责并测试产品。 -如果 bug 再次出现,问题将被发送回开发团队。在此阶段,该 bug 将重新触发,开发团队有责任重复循环解决该 bug 。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性发生的情况下。众所周知,间歇性的 bug 很难解决。 +如果 bug 再次出现,问题将被发送回开发团队。在此阶段,该 bug 将重新触发,开发团队有责任重复解决该 bug 的循环。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性发生的情况下。众所周知,间歇性的 bug 很难解决。 -如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,初始 bug 已得到解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要新的 bug 报告,然后重新开始该过程。 +如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,最初的 bug 得到了解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要新的 bug 报告,然后重新开始该过程。 ### 关闭 bug -在处理、识别和解决 bug 后,该 bug 将被关闭,开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug ,或者开发人员无法重现 bug ,则该 bug 也将被关闭-无论哪种方式,都将开始开发和测试的下一阶段。 +在处理、识别和解决 bug 后,该 bug 将被关闭,开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug ,或者开发人员无法重现 bug ,则该 bug 也将被关闭 —— 无论哪种方式,都将开始开发和测试的下一阶段。 在测试版本中对解决方案所做的任何更改都将滚动到产品的下一个版本中。如果 bug 是严重的,则在下一个版本发布之前,可能会为当前用户提供修补程序或修补程序。这在安全问题中很常见。 -软件 bug 可能很难找到,但通过遵循过程,开发人员可以使开发更快、更容易、更一致。质量保证是这一过程的重要组成部分,因为 QA 测试人员必须发现和识别 bug ,并帮助开发人员重现这些 bug 。在 bug 不再发生之前,无法关闭和解决 bug。 +软件 bug 可能很难找到,但通过遵循过程,开发人员可以使开发更快、更容易、更一致。质量保证是这一过程的重要组成部分,因为质量保证测试人员必须发现和识别 bug ,并帮助开发人员重现这些 bug 。在 bug 不再发生之前,无法关闭和解决 bug。 开源的解决方案分散了质量保证测试、开发和缓解的负担,这往往导致 bug 被更快、更全面地发现和缓解。但是,由于开源技术的性质,此过程的速度和准确性通常取决于解决方案的受欢迎程度及其维护和开发团队的敬业精神。 -_Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(*certified scrum master*) 并且 使用 [Project Zendo][2] ,供项目管理专业人员去发现、简化和改进其项目成果策略的网站。与 Rich 联系在 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 。_ +Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(certified scrum master) 并且 维护 [Project Zendo][2],这是供项目管理专业人员去发现、简化和改进其项目成果策略的网站。可以在 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 与 Rich 联系。 -------------------------------------------------------------------------------- @@ -56,7 +58,7 @@ via: https://opensource.com/article/18/6/life-cycle-software-bug 作者:[Rich Butkevic][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2b2acff5f55cbb0bcc5622ad18620bdbef7eb8c7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 00:24:38 +0800 Subject: [PATCH 0708/4278] PUB:20180625 The life cycle of a software bug.md @lixinyuxx https://linux.cn/article-10468-1.html --- .../20180625 The life cycle of a software bug.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180625 The life cycle of a software bug.md (100%) diff --git a/translated/tech/20180625 The life cycle of a software bug.md b/published/20180625 The life cycle of a software bug.md similarity index 100% rename from translated/tech/20180625 The life cycle of a software bug.md rename to published/20180625 The life cycle of a software bug.md From a284bbb4a96a454018504bf5ef59d4010b4c76fe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 01:10:09 +0800 Subject: [PATCH 0709/4278] PRF:20190114 You (probably) don-t need Kubernetes.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @beamrolling 恭喜您完成了第一篇翻译贡献! --- ...14 You (probably) don-t need Kubernetes.md | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/translated/talk/20190114 You (probably) don-t need Kubernetes.md b/translated/talk/20190114 You (probably) don-t need Kubernetes.md index d573ebe680..3261b3185e 100644 --- a/translated/talk/20190114 You (probably) don-t need Kubernetes.md +++ b/translated/talk/20190114 You (probably) don-t need Kubernetes.md @@ -1,59 +1,65 @@ [#]: collector: (lujun9972) [#]: translator: (beamrolling) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (You (probably) don't need Kubernetes) [#]: via: (https://arp242.net/weblog/dont-need-k8s.html) [#]: author: (Martin Tournoij https://arp242.net/) -你(大概)不需要 Kubernetes +你(多半)不需要 Kubernetes ====== 这也许是一个不太受欢迎的观点,但大多数主流公司最好不要再使用 k8s 了。 -你知道那个古老的“根据程序员技能写 Hello world ”笑话吗?它从一个新手程序员的 printf("hello, world\n") 语句开始,最后结束于高级软件架构工程师令人费解的 Java OOP 模式设计。使用 k8s 就有点像这样。 +你知道那个古老的“以程序员技能写 Hello world ”笑话吗?—— 从一个新手程序员的 `printf("hello, world\n")` 语句开始,最后结束于高级软件架构工程师令人费解的 Java OOP 模式设计。使用 k8s 就有点像这样。 -* 新手 SysOp: - `./binary` -* 有经验的 SysOp: - 在 EC2 上的 `./binary` +* 新手系统管理员: + + `./binary` +* 有经验的系统管理员: + + 在 EC2 上的 `./binary` * DevOp: - 在 EC2 上自部署的 CI 管道运行 `./binary` + + 在 EC2 上自部署的 CI 管道运行 `./binary` * 高级云编排工程师: - 在 EC2 上通过 k8s 编排的自部署 CI 管道运行 `./binary` + + 在 EC2 上通过 k8s 编排的自部署 CI 管道运行 `./binary` +`¯\\_(ツ)_/¯` +这不意味着 Kubernetes 或者任何这样的东西本身都是*坏的*,就像 Java 或者 OOP 设计本身并不是坏的一样,但是,在很多情况下,它们被严重地误用,就像在一个 hello world 的程序中可怕地误用 Java 面向对象设计模式一样。对大多数公司而言,系统运维从根本上来说并不十分复杂,此时在这上面应用 k8s 起效甚微。 -¯\\_(ツ)_/¯ +复杂性本质上来说创造了工作,我十分怀疑使用 k8s 对大多数使用者来说是省时的这一说法。这就好像花一天时间来写一个脚本,用来自动完成一些你一个月进行一次,每次只花 10 分钟完成的工作。这不是一个好的时间投资(特别是你可能会在未来由于扩展或调试这个脚本而进一步投入的更多时间)。 -这不意味着 Kubernetes 或者任何这样的东西本身都是坏的,就像 Java 或者 OOP 设计本身并不是坏的一样,但是,在很多情况下,它们被严重地误用,就像在一个 hello world 的程序中可怕地误用 Java 面向对象设计模式一样。对大多数公司而言,系统运维从根本上来说并不十分复杂,此时在这上面应用 k8s 起效甚微。 +你的部署大概应该*需要*自动化 – 以免你 [最终像 Knightmare][1] 那样 —— 但 k8s 通常可以被一个简单的 shell 脚本所替代。 -复杂性本质上来说创造了工作,我十分怀疑使用 k8s 对大多数使用者来说是省时的这一说法。这就好像花一天时间来写一个脚本,用来自动完成一些你一个月一次,每次只花 10 分钟完成的工作。这不是一个好的时间投资(特别是你可能会在未来由于扩展或调试这个脚本来进一步投入更多的时间)。 +在我们公司,系统运维团队用了很多时间来设置 k8s 。他们还不得不用了很大一部分时间来更新到新一点的版本(1.6 ➙ 1.8)。结果是如果没有真正深入理解 k8s ,有些东西就没人会真的明白,甚至连深入理解 k8s 这一点也很难(那些 YAML 文件,哦呦!) -你的部署大概应该需要自动化 – 以免你 [最终像 Knightmare][1] 那样 – 但 k8s 通常可以被一个简单的 shell 脚本所替代。 +在我能自己调试和修复部署问题之前 —— 现在这更难了,我理解基本概念,但在真正调试实际问题的时候,它们并不是那么有用。我不经常用 k8s 足以证明这点。 -在我们公司,sysops 团队用了很多时间来设置 k8s 。他们还不得不用了很大一部分时间来更新到新一点的版本(1.6 – 1.8)。结果是如果没有真正深入理解 k8s ,没人会真正明白一些东西,甚至连深入理解 k8s 这一点也很难(那些 YAML 文件,哦呦!) +--- -在我能自己调试和修复问题之前——现在这更难了,我理解基本概念,但在真正调试实际问题的时候,它们并不是那么有用。我不经常用 k8s 足以证明这点。 - -k8s 真的很难这点并不是什么新看法,这也是为什么现在会有这么多“ k8s 简单学”的解决方案。在 k8s 上再添一层来“让它更简单”的方法让我觉得,呃,不明智。复杂性并没有消失,你只是把它藏起来了。 +k8s 真的很难这点并不是什么新看法,这也是为什么现在会有这么多 “k8s 简单用”的解决方案。在 k8s 上再添一层来“让它更简单”的方法让我觉得,呃,不明智。复杂性并没有消失,你只是把它藏起来了。 以前我说过很多次:在确定一样东西是否“简单”时,我最关心的不是写东西的时候有多简单,而是当失败的时候调试起来有多容易。包装 k8s 并不会让调试更加简单,恰恰相反,它让事情更加困难了。 +--- + Blaise Pascal 有一句名言: > 几乎所有的痛苦都来自于我们不善于在房间里独处。 -k8s —— 略微拓展一下,Docker ——似乎就是这样的例子。许多人似乎迷失在当下的兴奋中,觉得“ k8s 就是这么回事!”,就像有些人迷失在 Java OOP 刚出来时的兴奋中一样,所以一切都必须从“旧”方法转为“新”方法,即使“旧”方法依然可行。 +k8s —— 略微拓展一下,Docker —— 似乎就是这样的例子。许多人似乎迷失在当下的兴奋中,觉得 “k8s 就是这么回事!”,就像有些人迷失在 Java OOP 刚出来时的兴奋中一样,所以一切都必须从“旧”方法转为“新”方法,即使“旧”方法依然可行。 有时候 IT 产业挺蠢的。 或者用 [一条推特][2] 来总结: -> 2014 - 我们必须采用 #微服务 来解决 monolith 的所有问题 -> 2016 - 我们必须采用 #docker 来解决微服务的所有问题 -> 2018 - 我们必须采用 #kubernetes 来解决 docker 的所有问题 +> - 2014 - 我们必须采用 #微服务 来解决独石应用的所有问题 +> - 2016 - 我们必须采用 #docker 来解决微服务的所有问题 +> - 2018 - 我们必须采用 #kubernetes 来解决 docker 的所有问题 你可以通过 [martin@arp242.net][3] 给我发邮件或者 [创建 GitHub issue][4] 来给我反馈或提出问题等。 @@ -64,7 +70,7 @@ via: https://arp242.net/weblog/dont-need-k8s.html 作者:[Martin Tournoij][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 b3e6f48dc9237d52ab923697a7eac41acee447c5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 01:11:53 +0800 Subject: [PATCH 0710/4278] PUB:20190114 You (probably) don-t need Kubernetes.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @beamrolling 本文首发地址: https://linux.cn/article-10469-1.html 您的 LCTT 专页地址: https://linux.cn/beamrolling 请注册领取 LCCN:https://lctt.linux.cn/ --- .../20190114 You (probably) don-t need Kubernetes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190114 You (probably) don-t need Kubernetes.md (98%) diff --git a/translated/talk/20190114 You (probably) don-t need Kubernetes.md b/published/20190114 You (probably) don-t need Kubernetes.md similarity index 98% rename from translated/talk/20190114 You (probably) don-t need Kubernetes.md rename to published/20190114 You (probably) don-t need Kubernetes.md index 3261b3185e..458bfe51f1 100644 --- a/translated/talk/20190114 You (probably) don-t need Kubernetes.md +++ b/published/20190114 You (probably) don-t need Kubernetes.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (beamrolling) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10469-1.html) [#]: subject: (You (probably) don't need Kubernetes) [#]: via: (https://arp242.net/weblog/dont-need-k8s.html) [#]: author: (Martin Tournoij https://arp242.net/) From fa43a723249519df9d15cf3d498053aaac9cbcdf Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 23 Jan 2019 08:56:09 +0800 Subject: [PATCH 0711/4278] translated --- ... started with Joplin, a note-taking app.md | 61 ------------------- ... started with Joplin, a note-taking app.md | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 sources/tech/20190113 Get started with Joplin, a note-taking app.md create mode 100644 translated/tech/20190113 Get started with Joplin, a note-taking app.md diff --git a/sources/tech/20190113 Get started with Joplin, a note-taking app.md b/sources/tech/20190113 Get started with Joplin, a note-taking app.md deleted file mode 100644 index 55b639ae7b..0000000000 --- a/sources/tech/20190113 Get started with Joplin, a note-taking app.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with Joplin, a note-taking app) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with Joplin, a note-taking app -====== -Learn how open source tools can help you be more productive in 2019. First up, Joplin. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S) - -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 first of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Joplin - -In the realm of productivity tools, note-taking apps are VERY handy. Yes, you can use the open source [NixNote][1] to access [Evernote][2] notes, but it's still linked to the Evernote servers and still relies on a third party for security. And while you CAN export your Evernote notes from NixNote, the only format options are NixNote XML or PDF files. - -![](https://opensource.com/sites/default/files/uploads/joplin-1.png) - -Enter [Joplin][3]. Joplin is a NodeJS application that runs and stores notes locally, allows you to encrypt your notes and supports multiple sync methods. Joplin can run as a console or graphical application on Windows, Mac, and Linux. Joplin also has mobile apps for Android and iOS, meaning you can take your notes with you without a major hassle. Joplin even allows you to format notes with Markdown, HTML, or plain text. - -![](https://opensource.com/sites/default/files/uploads/joplin-3.png) - -One really nice thing about Joplin is it supports two kinds of notes: plain notes and to-do notes. Plain notes are what you expect—documents containing text. To-do notes, on the other hand, have a checkbox in the notes list that allows you to mark them "done." And since the to-do note is still a note, you can include lists, documentation, and additional to-do items in a to-do note. - -When using the GUI, you can toggle editor views between plain text, WYSIWYG, and a split screen showing both the source text and the rendered view. You can also specify an external editor in the GUI, making it easy to update notes with Vim, Emacs, or any other editor capable of handling text documents. - -![Joplin console version][5] - -Joplin in the console. - -The console interface is absolutely fantastic. While it lacks a WYSIWYG editor, it defaults to the text editor for your login. It also has a powerful command mode that allows you to do almost everything you can do in the GUI version. And it renders Markdown correctly in the viewer. - -You can group notes in notebooks and tag notes for easy grouping across your notebooks. And it even has built-in search, so you can find things if you forget where you put them. - -Overall, Joplin is a first-class note-taking app ([and a great alternative to Evernote][6]) that will help you be organized and more productive over the next year. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-joplin - -作者:[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://nixnote.org/NixNote-Home/ -[2]: https://evernote.com/ -[3]: https://joplin.cozic.net/ -[4]: https://opensource.com/article/19/1/file/419776 -[5]: https://opensource.com/sites/default/files/uploads/joplin-2_0.png (Joplin console version) -[6]: https://opensource.com/article/17/12/joplin-open-source-evernote-alternative diff --git a/translated/tech/20190113 Get started with Joplin, a note-taking app.md b/translated/tech/20190113 Get started with Joplin, a note-taking app.md new file mode 100644 index 0000000000..495dd4c9d1 --- /dev/null +++ b/translated/tech/20190113 Get started with Joplin, a note-taking app.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Joplin, a note-taking app) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用一款笔记应用 Joplin +====== +了解开源工具如何帮助你在 2019 年提高工作效率。先从 Joplin 开始。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件。这不一定要这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。 + +### Joplin + +在生产力工具领域,笔记应用非常方便。是的,你可以使用开源 [NixNote][1] 访问 [Evernote][2 ] 笔记,但它仍然与 Evernote 服务器相关联,并且仍然依赖于第三方的安全性。虽然你可以从 NixNote 导出 Evernote 笔记,但可选格式只有 NixNote XML 或 PDF。 + +![](https://opensource.com/sites/default/files/uploads/joplin-1.png) + +看看 [Joplin][3]。Joplin 是一个 NodeJS 应用,它在本地运行和存储笔记,它允许你加密笔记并支持多种同步方法。Joplin 可在 Windows、Mac 和 Linux 上作为控制台或图形应用运行。Joplin 还有适用于 Android 和 iOS 的移动应用,这意味着你可以随身携带笔记而不会有任何麻烦。Joplin 甚至允许你使用 Markdown、HTML 或纯文本格式笔记。 + +![](https://opensource.com/sites/default/files/uploads/joplin-3.png) + +关于 Joplin 很棒的一件事是它支持两种类型笔记:普通笔记和待办事项笔记。普通笔记是你所想的包含文本的文档。另一个,待办事项笔记在笔记列表中有一个复选框,允许你将其标记为“已完成”。由于待办事项仍然是一个笔记,因此你可以在待办事项中添加列表、文档和其他待办事项。 + +当使用 GUI 时,你可以在纯文本、WYSIWYG 和同时显示源文本和渲染视图的分屏之间切换编辑器视图。你还可以在 GUI 中指定外部编辑器,以便使用 Vim、Emacs 或任何其他能够处理文本文档的编辑器轻松更新笔记。 + +![Joplin console version][5] + +控制台中的 Joplin + +控制台界面非常棒。虽然它缺少 WYSIWYG 编辑器,但默认登录使用文本编辑器。它还有强大的命令模式,它允许执行在 GUI 版本中几乎所有的操作。并且能够在视图中正确渲染 Markdown。 + +你可以将笔记本中的笔记分组,还能为笔记打上标记,以便于在笔记本中进行分组。它甚至还有内置的搜索功能,因此如果你忘了笔记在哪,你可以通过它找到它们。 + +总的来说,Joplin 是一款一流的笔记应用([还是 Evernote 的一个很好的替代品][6]),它能帮助你在明年组织化并提高工作效率。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-joplin + +作者:[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://nixnote.org/NixNote-Home/ +[2]: https://evernote.com/ +[3]: https://joplin.cozic.net/ +[4]: https://opensource.com/article/19/1/file/419776 +[5]: https://opensource.com/sites/default/files/uploads/joplin-2_0.png (Joplin console version) +[6]: https://opensource.com/article/17/12/joplin-open-source-evernote-alternative From bd925e4a56b18c060846764fab68e57094866021 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 23 Jan 2019 09:00:48 +0800 Subject: [PATCH 0712/4278] translating --- .../tech/20181214 The Linux terminal is no one-trick pony.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181214 The Linux terminal is no one-trick pony.md b/sources/tech/20181214 The Linux terminal is no one-trick pony.md index 28964b249c..56b7711659 100644 --- a/sources/tech/20181214 The Linux terminal is no one-trick pony.md +++ b/sources/tech/20181214 The Linux terminal is no one-trick pony.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d43cc1f54e330e8eaeb494dad6e04aca50e611d9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 10:29:53 +0800 Subject: [PATCH 0713/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comp?= =?UTF-8?q?uter=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=206=20?= =?UTF-8?q?Screen01=20sources/tech/20150616=20Computer=20Laboratory=20-=20?= =?UTF-8?q?Raspberry=20Pi-=20Lesson=206=20Screen01.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 6 Screen01.md | 503 ++++++++++++++++++ 1 file changed, 503 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..0b3cc3940c --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md @@ -0,0 +1,503 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 2f1ff5ba667c1b32599d06fc983ff9282b3082a9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 10:42:16 +0800 Subject: [PATCH 0714/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comp?= =?UTF-8?q?uter=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=207=20?= =?UTF-8?q?Screen02=20sources/tech/20150616=20Computer=20Laboratory=20-=20?= =?UTF-8?q?Raspberry=20Pi-=20Lesson=207=20Screen02.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 7 Screen02.md | 449 ++++++++++++++++++ 1 file changed, 449 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..3a8fe60f6f --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md @@ -0,0 +1,449 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 615a43e453c78e1cb2ed1c680eaa0fac980d5634 Mon Sep 17 00:00:00 2001 From: Auk7F7 <34982730+Auk7F7@users.noreply.github.com> Date: Wed, 23 Jan 2019 14:15:40 +0800 Subject: [PATCH 0715/4278] Create 20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md --- ...Check Vulnerable Packages In Arch Linux.md | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md diff --git a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md new file mode 100644 index 0000000000..2580b53a3d --- /dev/null +++ b/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -0,0 +1,128 @@ +[#]: collector: "lujun9972" +[#]: translator: " " +[#]: reviewer: " " +[#]: publisher: " " +[#]: subject: "Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux" +[#]: via: "https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/" +[#]: author: "Prakash Subramanian https://www.2daygeek.com/author/prakash/" +[#]: url: " " + +Arch-Audit : 一款在 Arch Linux 上检查易受攻击包的工具 +====== + +我们必须经常更新我们的系统以减少宕机时间和问题。 + +每月给系统打一次补丁,60天一次或者最多90天一次,这是 Linux 管理员的例行任务之一。 + +这将是忙碌的工作计划,我们不能在不到一个月内做到这一点,因为它涉及到多种活动和环境。 + +基本上,基础架构与测试、开发、 QA (即分段和产品开发环境)一起提供。 + +最初,我们会在测试环境中部署补丁,相应的团队将监视系统一周,然后他们将给出一份比如好的或坏的状态报告。 + +如果它是成功的话,我们将会在其他环境中继续测试,若正常运行,那么最后我们会给生产服务器打上补丁。 + +许多组织已经准备好给整个系统打上补丁。我的意思是全部系统的更新,这是一种对于基础设施的常规修补计划。 + +在一些基础结构中,他们可能只有生产环境,因此,我们不应该为完整的系统更新做好准备,而是可以使用安全修补程序来使系统更加稳定和安全。 + +由于 Arch Linux 及其衍发行版本属于滚动更新版本,因此可以认为他们始终是最新的,因为它使用上游软件包的最新版本。 + +在某些情况下,如果要单独更新安全修补程序 ,则必须使用 arch-audit 工具来标识和修复安全修补程序。 + +### 漏洞是什么? + +漏洞是软件程序或硬件组件(固件)中的安全漏洞。这是一个可以让它容易受到攻击的缺陷。 + +为了缓解这种情况,我们需要相应地修补,就像应用程序/硬件一样,它可能是代码更改或配置更改或参数更改。 + +### Arch-Audit 工具是什么? + +[Arch-audit][1] 是一个类似于 Arch Linux 的 pkg-audit 工具。它使用了令人称赞的 Arch 安全小组收集的数据。他不会扫描并发现系统中易受攻击的包,如 **yum –security check-update & yum updateinfo list available**,它只需解析 页面并在终端中显示结果,因此,它将显示准确的数据。 + +Arch 安全小组是一群以跟踪 Arch Linux 软件包的安全问题为目的的志愿者。所有问题都在 Arch 安全追踪者的监视下。. + +该小组以前被称为 Arch CVE 监测小组,Arch 安全小组的使命是为提高 Arch Linux 的安全性做出贡献。 + +### 如何在 Arch Linux 上安装 Arch-Audit 工具 + +arch-audit 工具已经存在社区源中,所以你可以使用 Pacman 包管理器来安装它。 + +``` +$ sudo pacman -S arch-audit +``` + +运行 `arch-audit` 工具以查找在基于 Arch 的发行版本上的开放且易受攻击的包。 + +``` +$ arch-audit +Package cairo is affected by CVE-2017-7475. Low risk! +Package exiv2 is affected by CVE-2017-11592, CVE-2017-11591, CVE-2017-11553, CVE-2017-17725, CVE-2017-17724, CVE-2017-17723, CVE-2017-17722. Medium risk! +Package libtiff is affected by CVE-2018-18661, CVE-2018-18557, CVE-2017-9935, CVE-2017-11613. High risk!. Update to 4.0.10-1! +Package openssl is affected by CVE-2018-0735, CVE-2018-0734. Low risk! +Package openssl-1.0 is affected by CVE-2018-5407, CVE-2018-0734. Low risk! +Package patch is affected by CVE-2018-6952, CVE-2018-1000156. High risk!. Update to 2.7.6-7! +Package pcre is affected by CVE-2017-11164. Low risk! +Package systemd is affected by CVE-2018-6954, CVE-2018-15688, CVE-2018-15687, CVE-2018-15686. Critical risk!. Update to 239.300-1! +Package unzip is affected by CVE-2018-1000035. Medium risk! +Package webkit2gtk is affected by CVE-2018-4372. Critical risk!. Update to 2.22.4-1! +``` + +上述结果显示了系统的脆弱性风险状况,比如:低、中和严重三种情况。 + +若要仅显示易受攻击的包及其版本,请执行以下操作。 + +``` +$ arch-audit -q +cairo +exiv2 +libtiff>=4.0.10-1 +openssl +openssl-1.0 +patch>=2.7.6-7 +pcre +systemd>=239.300-1 +unzip +webkit2gtk>=2.22.4-1 +``` + +仅显示已修复的包。 + +``` +$ arch-audit --upgradable --quiet +libtiff>=4.0.10-1 +patch>=2.7.6-7 +systemd>=239.300-1 +webkit2gtk>=2.22.4-1 +``` + +为了交叉检查上述结果,我将测试在 列出的一个包以确认漏洞是否仍处于开放状态或已修复。是的,它已经被修复了,并于昨天在社区源中发布了更新后的包。 + +![][3] + +仅打印包名称和其相关的 CVE。 + +``` +$ arch-audit -uf "%n|%c" +libtiff|CVE-2018-18661,CVE-2018-18557,CVE-2017-9935,CVE-2017-11613 +patch|CVE-2018-6952,CVE-2018-1000156 +systemd|CVE-2018-6954,CVE-2018-15688,CVE-2018-15687,CVE-2018-15686 +webkit2gtk|CVE-2018-4372 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/ + +作者:[Prakash Subramanian][a] +选题:[lujun9972][b] +译者:[Auk7F7](https://github.com/Auk7F7) +校对:[校对者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://github.com/ilpianista/arch-audit +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2018/11/A-Tool-To-Check-Vulnerable-Packages-In-Arch-Linux.png From 2d141244a46ce79e48cbcf43b43cc1a4d9309e2c Mon Sep 17 00:00:00 2001 From: Auk7F7 <34982730+Auk7F7@users.noreply.github.com> Date: Wed, 23 Jan 2019 14:16:15 +0800 Subject: [PATCH 0716/4278] Delete 20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md --- ...Check Vulnerable Packages In Arch Linux.md | 128 ------------------ 1 file changed, 128 deletions(-) delete mode 100644 sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md diff --git a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md deleted file mode 100644 index d359a4f57c..0000000000 --- a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md +++ /dev/null @@ -1,128 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( Auk7F7) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux) -[#]: via: (https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/) -[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) -[#]: url: ( ) - - -Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux -====== - -We have to make the system up-to date to minimize the downtime and issues. - -It’s one of the routine task for Linux administrator to patch the system once in a month or 60 days once or 90 days at maximum. - -It would be sufficient schedule and we can’t do it this less than a month as it’s involve multiple activities and environments. - -Basically infrastructure comes with Test, Development, QA a.k.a Staging & Prod environments. - -Initially we will deploy the patches in the Test environment and corresponding team will be monitoring the system a week then they will give a status report like good or bad. - -If it’s success then we will move forward to other environments. If everything is good then finally we will patch production servers. - -Many of the organization has prepare to patch entire system. i mean full system update. It is a general patching schedule for a typical infrastructure. - -In some of the infrastructure they may have only production environment so, we should not prepare for the full system update instead we can go with security patch to make the system more stable and secure. - -Since Arch Linux and its derivatives distributions are fall under rolling release can be considered to be always up-to-date, as it uses the latest versions of software packages from the upstream. - -In some cases if you want to update security patch alone then you have to use arch-audit tool to identify and fix the security patches. - -### What is a Vulnerability? - -A vulnerability is a security weakness in a software program or hardware components (firmware). It’s a flaw that can leave it open to attack. - -To mitigate this we need to patch accordingly like for application/hardware it could be a code changes or config changes or parameter changes. - -### What is Arch-Audit Tool? - -[Arch-audit][1] is a tool like pkg-audit for Arch Linux system. It Uses data collected by the awesome Arch Security Team. It wont scan and find the vulnerable packages on your system like **yum –security check-update & yum updateinfo list available** and it will simply parse the page and display the results in terminal. So, it would show the accurate data. - -The Arch Security Team is a group of volunteers whose goal is to track security issues with Arch Linux packages. All issues are tracked on the Arch Linux security tracker. - -The team was formerly known as the Arch CVE Monitoring Team. The mission of the Arch Security Team is to contribute to the improvement of the security of Arch Linux. - -### How to Install arch-audit tool in Arch Linux - -The arch-audit tool is available in community repository so you can use the Pacman Package Manager to install it. - -``` -$ sudo pacman -S arch-audit -``` - -Run the `arch-audit` tool to find the open vulnerable packages on Arch based distributions. - -``` -$ arch-audit -Package cairo is affected by CVE-2017-7475. Low risk! -Package exiv2 is affected by CVE-2017-11592, CVE-2017-11591, CVE-2017-11553, CVE-2017-17725, CVE-2017-17724, CVE-2017-17723, CVE-2017-17722. Medium risk! -Package libtiff is affected by CVE-2018-18661, CVE-2018-18557, CVE-2017-9935, CVE-2017-11613. High risk!. Update to 4.0.10-1! -Package openssl is affected by CVE-2018-0735, CVE-2018-0734. Low risk! -Package openssl-1.0 is affected by CVE-2018-5407, CVE-2018-0734. Low risk! -Package patch is affected by CVE-2018-6952, CVE-2018-1000156. High risk!. Update to 2.7.6-7! -Package pcre is affected by CVE-2017-11164. Low risk! -Package systemd is affected by CVE-2018-6954, CVE-2018-15688, CVE-2018-15687, CVE-2018-15686. Critical risk!. Update to 239.300-1! -Package unzip is affected by CVE-2018-1000035. Medium risk! -Package webkit2gtk is affected by CVE-2018-4372. Critical risk!. Update to 2.22.4-1! -``` - -The above result shows the vulnerability risk status as well such as Low, Medium and Critical. - -To Show only vulnerable package names and their versions. - -``` -$ arch-audit -q -cairo -exiv2 -libtiff>=4.0.10-1 -openssl -openssl-1.0 -patch>=2.7.6-7 -pcre -systemd>=239.300-1 -unzip -webkit2gtk>=2.22.4-1 -``` - -To show only packages that have already been fixed. - -``` -$ arch-audit --upgradable --quiet -libtiff>=4.0.10-1 -patch>=2.7.6-7 -systemd>=239.300-1 -webkit2gtk>=2.22.4-1 -``` - -To cross check the above results, i’m going to test one of the package which is listed above in to confirm whether the vulnerability is still open or fixed it. Yes, it’s fixed and published the updated package in repository on yesterday. -![][3] - -To print only package names and associated CVEs alone. - -``` -$ arch-audit -uf "%n|%c" -libtiff|CVE-2018-18661,CVE-2018-18557,CVE-2017-9935,CVE-2017-11613 -patch|CVE-2018-6952,CVE-2018-1000156 -systemd|CVE-2018-6954,CVE-2018-15688,CVE-2018-15687,CVE-2018-15686 -webkit2gtk|CVE-2018-4372 -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/ - -作者:[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://github.com/ilpianista/arch-audit -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: https://www.2daygeek.com/wp-content/uploads/2018/11/A-Tool-To-Check-Vulnerable-Packages-In-Arch-Linux.png From 2b20806b1d9f8eb22c07c418ca050ac37075af96 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 14:34:36 +0800 Subject: [PATCH 0717/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comp?= =?UTF-8?q?uter=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=208=20?= =?UTF-8?q?Screen03=20sources/tech/20150616=20Computer=20Laboratory=20-=20?= =?UTF-8?q?Raspberry=20Pi-=20Lesson=208=20Screen03.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 8 Screen03.md | 485 ++++++++++++++++++ 1 file changed, 485 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..08803fd50f --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @@ -0,0 +1,485 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 26c1ec55c15bde7f1a836041ae0b350ae5e72727 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 14:55:54 +0800 Subject: [PATCH 0718/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comp?= =?UTF-8?q?uter=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=209=20?= =?UTF-8?q?Screen04=20sources/tech/20150616=20Computer=20Laboratory=20-=20?= =?UTF-8?q?Raspberry=20Pi-=20Lesson=209=20Screen04.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 9 Screen04.md | 540 ++++++++++++++++++ 1 file changed, 540 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..1ca2a16609 --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md @@ -0,0 +1,540 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From b79dda11b91bcbe885583daf02906da3762cb96a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 15:08:41 +0800 Subject: [PATCH 0719/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comp?= =?UTF-8?q?uter=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=2010?= =?UTF-8?q?=20Input01=20sources/tech/20150616=20Computer=20Laboratory=20-?= =?UTF-8?q?=20Raspberry=20Pi-=20Lesson=2010=20Input01.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 10 Input01.md | 494 ++++++++++++++++++ 1 file changed, 494 insertions(+) create mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md 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 new file mode 100644 index 0000000000..beb7613b2f --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md @@ -0,0 +1,494 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 10 Input01) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +Computer Laboratory – Raspberry Pi: Lesson 10 Input01 +====== + +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 + +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. + +### 2 USB + +``` +The USB standard was designed to make simple hardware in exchange for complex software. +``` + +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. + +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. + +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. + +### 3 Linking + +``` +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. + +### 4 Keyboards + +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. + +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. + +Table 4.1 USB Keyboard Keys +| Number | Description | Number | Description | Number | Description | Number | Description | | +| ------ | ---------------- | ------- | ---------------------- | -------- | -------------- | --------------- | -------------------- | | +| 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 | | +| 16 | m and M | 17 | n and N | 18 | o and O | 19 | p and P | | +| 20 | q and Q | 21 | r and R | 22 | s and S | 23 | t and T | | +| 24 | u and U | 25 | v and V | 26 | w and W | 27 | x and X | | +| 28 | y and Y | 29 | z and Z | 30 | 1 and ! | 31 | 2 and @ | | +| 32 | 3 and # | 33 | 4 and $ | 34 | 5 and % | 35 | 6 and ^ | | +| 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 : | +| 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 | | +| 64 | F7 | 65 | F8 | 66 | F9 | 67 | F10 | | +| 68 | F11 | 69 | F12 | 70 | Print Screen | 71 | Scroll Lock | | +| 72 | Pause | 73 | Insert | 74 | Home | 75 | Page Up | | +| 76 | Delete forward | 77 | End | 78 | Page Down | 79 | Right Arrow | | +| 80 | Left Arrow | 81 | Down Arrow | 82 | Up Arrow | 83 | Num Lock | | +| 84 | Keypad / | 85 | Keypad * | 86 | Keypad - | 87 | Keypad + | | +| 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 = | +| 104 | F13 | 105 | F14 | 106 | F15 | 107 | F16 | | +| 108 | F17 | 109 | F18 | 110 | F19 | 111 | F20 | | +| 112 | F21 | 113 | F22 | 114 | F23 | 115 | F24 | | +| 116 | Execute | 117 | Help | 118 | Menu | 119 | Select | | +| 120 | Stop | 121 | Again | 122 | Undo | 123 | Cut | | +| 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]. + +### 5 The Nut Behind the Wheel + +``` +These summaries and the code they describe form an API - Application Product Interface. +``` + +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. + +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. | +| 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. | + +``` +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. + +Table 5.2 - CSUD Result Codes +| Code | Description | +| ---- | ----------------------------------------------------------------------- | +| 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. | + +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: + 1. Check whether or not key is released + 2. Remove key if released + 6. Perform actions based on keys pushed/released + 7. Go to 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 Updates Available + +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. + +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. 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. + +``` +.section .data +.align 2 +KeyboardAddress: +.int 0 +KeyboardOldDown: +.rept 6 +.hword 0 +.endr +``` + +``` +.hword num inserts the half word constant num into the file directly. +``` + +``` +.rept num [commands] .endr copies the commands commands to the output num times. +``` + +Try to implement the method yourself. My implementation for this is as follows: + +1. +``` +.section .text +.globl KeyboardUpdate +KeyboardUpdate: +push {r4,r5,lr} + +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. +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 +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$: + mov r0,kbd + mov r1,r5 + bl KeyboardGetKeyDown + + ldr r1,=KeyboardOldDown + add r1,r5,lsl #1 + strh r0,[r1] + add r5,#1 + cmp r5,#6 + blt saveKeys$ +``` +Loop through all the keys, storing them in KeyboardOldDown. If we ask for too many, this returns 0 which is fine. + +10. +``` +mov r0,kbd +bl KeyboardPoll +``` +Now we get the new keys. + +11. +``` +teq r0,#0 +bne getKeyboard$ + +return$: +pop {r4,r5,pc} +.unreq kbd +``` +Finally we check if KeyboardPoll worked. If not, we probably disconnected. + + +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. + +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 + +``` +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. + +After the .section .data command, copy the following tables: + +``` +.align 3 +KeysNormal: + .byte 0x0, 0x0, 0x0, 0x0, 'a', 'b', 'c', 'd' + .byte 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l' + .byte 'm', 'n', 'o', 'p', 'q', 'r', 's', 't' + .byte 'u', 'v', 'w', 'x', 'y', 'z', '1', '2' + .byte '3', '4', '5', '6', '7', '8', '9', '0' + .byte '\n', 0x0, '\b', '\t', ' ', '-', '=', '[' + .byte ']', '\\\', '#', ';', '\'', '`', ',', '.' + .byte '/', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, '/', '*', '-', '+' + .byte '\n', '1', '2', '3', '4', '5', '6', '7' + .byte '8', '9', '0', '.', '\\\', 0x0, 0x0, '=' + +.align 3 +KeysShift: + .byte 0x0, 0x0, 0x0, 0x0, 'A', 'B', 'C', 'D' + .byte 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L' + .byte 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T' + .byte 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '"' + .byte '£', '$', '%', '^', '&', '*', '(', ')' + .byte '\n', 0x0, '\b', '\t', ' ', '_', '+', '{' + .byte '}', '|', '~', ':', '@', '¬', '<', '>' + .byte '?', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, '/', '*', '-', '+' + .byte '\n', '1', '2', '3', '4', '5', '6', '7' + .byte '8', '9', '0', '.', '|', 0x0, 0x0, '=' +``` + +``` +.byte num inserts the byte constant num into the file directly. +``` + +``` +Most assemblers and compilers recognise escape sequences; character sequences such as \t which insert special characters instead. +``` + +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. + + + +Try to implement this yourself. My implementation is presented below: + +1. +``` +.globl KeyboardGetChar +KeyboardGetChar: +ldr r0,=KeyboardAddress +ldr r1,[r0] +teq r1,#0 +moveq r0,#0 +moveq pc,lr +``` +Simple check to see if we have a keyboard. + +2. +``` +push {r4,r5,r6,lr} +kbd .req r4 +key .req r6 +mov r4,r1 +mov r5,#0 +keyLoop$: + mov r0,kbd + mov r1,r5 + bl KeyboardGetKeyDown +``` +r5 will hold the index of the key, r4 holds the keyboard address. + + 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. + + 2. + ``` + mov key,r0 + bl KeyWasDown + 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. + + 4. + ``` + mov r0,kbd + bl KeyboardGetModifiers + ``` + We need to know about the modifier keys in order to deduce the character. + + 5. + ``` + tst r0,#0b00100010 + 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. + + 6. + ``` + ldrb r0,[r0,key] + ``` + Now we can load in the key from the look up table. + + 7. + ``` + teq r0,#0 + bne keyboardGetCharReturn$ + keyLoopContinue$: + add r5,#1 + 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. + +3. +``` +keyLoopBreak$: +mov r0,#0 +keyboardGetCharReturn$: +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. + + + + +### 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. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.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/downloads.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/hut1_12v2.pdf +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html From 5ca58d4c7d8991cb6898e69c13e872b1686679cd Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 15:28:23 +0800 Subject: [PATCH 0720/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comp?= =?UTF-8?q?uter=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=2011?= =?UTF-8?q?=20Input02=20sources/tech/20150616=20Computer=20Laboratory=20-?= =?UTF-8?q?=20Raspberry=20Pi-=20Lesson=2011=20Input02.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 11 Input02.md | 911 ++++++++++++++++++ 1 file changed, 911 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..9040162a97 --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md @@ -0,0 +1,911 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 183e32d0dcb25a9871bd865d50117f6cb765d73a Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 23 Jan 2019 18:16:22 +0800 Subject: [PATCH 0721/4278] Translating 20180130 Tmux... --- ...l Terminal Multiplexer For Heavy Command-Line Linux User.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md index 4adaa7a2bc..f519d76fc7 100644 --- a/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md +++ b/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md @@ -1,3 +1,6 @@ +Translating by MjSeven + + tmux – A Powerful Terminal Multiplexer For Heavy Command-Line Linux User ====== tmux stands for terminal multiplexer, it allows users to create/enable multiple terminals (vertical & horizontal) in single window, this can be accessed and controlled easily from single window when you are working with different issues. From 31e6fbe5d478a91561b73528f02925545e27dd44 Mon Sep 17 00:00:00 2001 From: Yuqi Liu Date: Wed, 23 Jan 2019 21:11:03 +0800 Subject: [PATCH 0722/4278] translating by oneforalone 20180809 Two Years With Emacs as a CEO (and now CTO).md translation is under progress, will come out by this weekend. Hopefully to publish by the Chinese New Year's Festival. @wxy Best Regards Liu Yuqi --- .../20180809 Two Years With Emacs as a CEO (and now CTO).md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md index 3e1f5d1eb2..b144fe4201 100644 --- a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md +++ b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (oneforalone) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -68,7 +68,7 @@ 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/译者ID) +译者:[译者ID](https://github.com/oneforalone) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 065d18943917b2df22369aba467fe3f1c4e4e5bc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 22:25:55 +0800 Subject: [PATCH 0723/4278] PRF:20190114 How to Build a Netboot Server, Part 4.md @qhwdw --- ...4 How to Build a Netboot Server, Part 4.md | 224 +++++++++--------- 1 file changed, 110 insertions(+), 114 deletions(-) diff --git a/translated/tech/20190114 How to Build a Netboot Server, Part 4.md b/translated/tech/20190114 How to Build a Netboot Server, Part 4.md index 84065b2b40..d3eae1aefe 100644 --- a/translated/tech/20190114 How to Build a Netboot Server, Part 4.md +++ b/translated/tech/20190114 How to Build a Netboot Server, Part 4.md @@ -1,6 +1,6 @@ [#]: collector: "lujun9972" [#]: translator: "qhwdw" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "How to Build a Netboot Server, Part 4" @@ -15,7 +15,7 @@ 可写镜像的另外的好处是,终端用户“私人定制”的操作系统,在下次不同的工作站上使用时能够“跟着”他们。 -### 修改 Bootmenu 应用程序去使用 HTTPS +### 修改 Bootmenu 应用程序以使用 HTTPS 为 bootmenu 应用程序创建一个自签名的证书: @@ -27,7 +27,7 @@ $ sudo -i # openssl req -newkey rsa:2048 -nodes -keyout $MY_TLSD/$MY_NAME.key -x509 -days 3650 -out $MY_TLSD/$MY_NAME.pem ``` -验证你的证书的值。确保 “Subject” 行中 “CN” 的值与你的 iPXE 客户端连接你的网络引导服务器所使用的 DNS 名字是相匹配的: +验证你的证书的值。确保 `Subject` 行中 `CN` 的值与你的 iPXE 客户端连接你的网络引导服务器所使用的 DNS 名字是相匹配的: ``` # openssl x509 -text -noout -in $MY_TLSD/$MY_NAME.pem @@ -49,7 +49,7 @@ GnuTLS 要求 “CAP_DAC_READ_SEARCH” 能力,因此将它添加到 bootmenu # systemctl daemon-reload ``` -现在,在防火墙中为 bootmenu 服务添加一个例外规则并重启动服务: +现在,在防火墙中为 bootmenu 服务添加一个例外规则并重启动该服务: ``` # MY_SUBNET=192.0.2.0 @@ -59,7 +59,7 @@ GnuTLS 要求 “CAP_DAC_READ_SEARCH” 能力,因此将它添加到 bootmenu # systemctl restart bootmenu.service ``` -使用 wget 去验证是否工作正常: +使用 `wget` 去验证是否工作正常: ``` $ MY_NAME=server-01.example.edu @@ -69,7 +69,7 @@ $ wget -q --ca-certificate=$MY_TLSD/$MY_NAME.pem -O - https://$MY_NAME/menu ### 添加 HTTPS 到 iPXE -更新 init.ipxe 去使用 HTTPS。接着使用选项重新编译 ipxe 引导加载器,以便它包含和信任你为 bootmenu 应用程序创建的自签名证书: +更新 `init.ipxe` 去使用 HTTPS。接着使用选项重新编译 ipxe 引导加载器,以便它包含和信任你为 bootmenu 应用程序创建的自签名证书: ``` $ echo '#define DOWNLOAD_PROTO_HTTPS' >> $HOME/ipxe/src/config/local/general.h @@ -95,7 +95,7 @@ $ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi # echo 'auth required pam_krb5.so' > /etc/pam.d/bootmenu ``` -添加一个库到 bootmenu 应用程序中,它使用 Authen-PAM 的 perl 模块去执行用户验证: +添加一个库到 bootmenu 应用程序中,它使用 Authen-PAM 的 Perl 模块去执行用户验证: ``` # dnf install -y perl-Authen-PAM; @@ -107,37 +107,37 @@ package PAM; use Authen::PAM; sub auth { - my $success = 0; + my $success = 0; - my $username = shift; - my $password = shift; + my $username = shift; + my $password = shift; - my $callback = sub { - my @res; - while (@_) { - my $code = shift; - my $msg = shift; - my $ans = ""; + my $callback = sub { + my @res; + while (@_) { + my $code = shift; + my $msg = shift; + my $ans = ""; + + $ans = $username if ($code == PAM_PROMPT_ECHO_ON()); + $ans = $password if ($code == PAM_PROMPT_ECHO_OFF()); + + push @res, (PAM_SUCCESS(), $ans); + } + push @res, PAM_SUCCESS(); - $ans = $username if ($code == PAM_PROMPT_ECHO_ON()); - $ans = $password if ($code == PAM_PROMPT_ECHO_OFF()); + return @res; + }; - push @res, (PAM_SUCCESS(), $ans); - } - push @res, PAM_SUCCESS(); + my $pamh = new Authen::PAM('bootmenu', $username, $callback); - return @res; - }; + { + last unless ref $pamh; + last unless $pamh->pam_authenticate() == PAM_SUCCESS; + $success = 1; + } - my $pamh = new Authen::PAM('bootmenu', $username, $callback); - - { - last unless ref $pamh; - last unless $pamh->pam_authenticate() == PAM_SUCCESS; - $success = 1; - } - - return $success; + return $success; } return 1; @@ -163,29 +163,29 @@ plugin 'Config'; get '/menu'; get '/boot' => sub { - my $c = shift; + my $c = shift; - my $instance = $c->param('instance'); - my $username = $c->param('username'); - my $password = $c->param('password'); + my $instance = $c->param('instance'); + my $username = $c->param('username'); + my $password = $c->param('password'); - my $template = 'menu'; + my $template = 'menu'; - { - last unless $instance =~ /^fc[[:digit:]]{2}$/; - last unless $username =~ /^[[:alnum:]]+$/; - last unless PAM::auth($username, url_unescape($password)); - $template = $instance; - } + { + last unless $instance =~ /^fc[[:digit:]]{2}$/; + last unless $username =~ /^[[:alnum:]]+$/; + last unless PAM::auth($username, url_unescape($password)); + $template = $instance; + } - return $c->render(template => $template); + return $c->render(template => $template); }; app->start; END ``` -bootmenu 应用程序现在查找 lib 去找到相应的 WorkingDirectory。但是,默认情况下,对于 systemd 单元它的工作目录设置为服务器的 root 目录。因此,你必须更新 systemd 单元去设置 WorkingDirectory 为 bootmenu 应用程序的根目录: +bootmenu 应用程序现在查找 `lib` 命令去找到相应的 `WorkingDirectory`。但是,默认情况下,对于 systemd 单元它的工作目录设置为服务器的 root 目录。因此,你必须更新 systemd 单元去设置 `WorkingDirectory` 为 bootmenu 应用程序的根目录: ``` # sed -i "/^RuntimeDirectory=/ a WorkingDirectory=$MY_MOJO" /etc/systemd/system/bootmenu.service @@ -203,7 +203,7 @@ bootmenu 应用程序现在查找 lib 去找到相应的 WorkingDirectory。但 上面的最后的命令将生成类似下面的三个文件: -**menu.html.ep** : +`menu.html.ep`: ``` #!ipxe @@ -241,7 +241,7 @@ login chain https://server-01.example.edu/boot?instance=fc28&username=${username}&password=${password:uristring} || goto failed ``` -**fc29.html.ep** : +`fc29.html.ep`: ``` #!ipxe @@ -250,7 +250,7 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img boot || chain https://server-01.example.edu/menu ``` -**fc28.html.ep** : +`fc28.html.ep`: ``` #!ipxe @@ -267,17 +267,15 @@ boot || chain https://server-01.example.edu/menu ### 使得 iSCSI Target 可写 -现在,用户验证通过 iPXE 可以正常工作,在用户连接时,你可以按需在只读镜像的上面创建每用户的可写覆盖。使用一个 [写时复制][2] 覆盖与简单地为每个用户复制原始镜像相比有三个好处: +现在,用户验证通过 iPXE 可以正常工作,在用户连接时,你可以按需在只读镜像的上面创建每用户可写的overlay叠加层。使用一个 [写时复制][2] 的叠加层与简单地为每个用户复制原始镜像相比有三个好处: - 1. 复制创建非常快。这样就可以按需创建。 - 2. 复制并不增加服务器上的磁盘使用。除了原始镜像之外,仅存储用户写入个人镜像的内容。 - 3. 由于每个用户复制的扇区大多都是服务器的存储上的相同的扇区,在随后的用户访问这些操作系统的副本时,它们可能已经加载到内存中,这样就提升了服务器的性能,因为对内存的访问速度要比磁盘 I/O 快得多。 + 1. 副本创建非常快。这样就可以按需创建。 + 2. 副本并不增加服务器上的磁盘使用。除了原始镜像之外,仅存储用户写入个人镜像的内容。 + 3. 由于每个副本的扇区大多都是服务器的存储器上的相同扇区,在随后的用户访问这些操作系统的副本时,它们可能已经加载到内存中,这样就提升了服务器的性能,因为对内存的访问速度要比磁盘 I/O 快得多。 +使用写时复制的一个潜在隐患是,一旦叠加层创建后,叠加层之下的镜像就不能再改变。如果它们改变,所有它们之上的叠加层将出错。因此,叠加层必须被删除并用新的、空白的进行替换。即便只是简单地以读写模式加载的镜像,也可能因为某些文件系统更新导致叠加层出错。 - -使用写时复制的一个潜在隐患是,一旦覆盖创建后,覆盖之下的镜像就不能再改变。如果它们改变,所有它们之上的覆盖将出错。因此,覆盖必须被删除并用新的、空白的替换。即便只是简单地以读写模式加载的镜像,也可能因为某些文件系统更新导致覆盖出错。 - -由于这个隐患,如果原始镜像被修改将导致覆盖出错,因此运行下列的命令,将原始镜像标记为不可改变: +由于这个隐患,如果原始镜像被修改将导致叠加层出错,因此运行下列的命令,将原始镜像标记为不可改变: ``` # chattr +i @@ -293,7 +291,7 @@ boot || chain https://server-01.example.edu/menu 当仍有连接打开的时候,运行这个命令一般需要一分钟或更长的时间。 -现在,移除只读的 iSCSI 出口。然后更新模板中的配置文件为 readonly-root,以使镜像不再是只读的: +现在,移除只读的 iSCSI 出口。然后更新模板中的 `readonly-root` 配置文件,以使镜像不再是只读的: ``` # MY_FC=fc29 @@ -305,7 +303,7 @@ boot || chain https://server-01.example.edu/menu # umount $TEMP_MNT ``` -将 Journald 日志从发送到内存修改回缺省值(记录到磁盘,如果 /var/log/journal 存在的话),因为一个用户报告说,他的客户端由于应用程序生成了大量的系统日志而产生内存溢出错误,导致它的客户端被卡住。而将日志记录到磁盘的负面影响是客户端产生了额外的写入流量,这将在你的网络引导服务器上可能增加一些没有必要的 I/O。你应该去决定到底使用哪个选择 — 记录到内存还是记录到硬盘 — 哪个更合适取决于你的环境。 +将 journald 日志从发送到内存修改回缺省值(如果 `/var/log/journal` 存在的话记录到磁盘),因为一个用户报告说,他的客户端由于应用程序生成了大量的系统日志而产生内存溢出错误,导致它的客户端被卡住。而将日志记录到磁盘的负面影响是客户端产生了额外的写入流量,这将在你的网络引导服务器上可能增加一些没有必要的 I/O。你应该去决定到底使用哪个选择 —— 记录到内存还是记录到硬盘 —— 哪个更合适取决于你的环境。 因为你的模板镜像在以后不能做任何的更改,因此在它上面设置不可更改标志,然后重启动 tgtd.service: @@ -331,37 +329,37 @@ plugin 'Config'; get '/menu'; get '/boot' => sub { - my $c = shift; + my $c = shift; - my $instance = $c->param('instance'); - my $username = $c->param('username'); - my $password = $c->param('password'); + my $instance = $c->param('instance'); + my $username = $c->param('username'); + my $password = $c->param('password'); - my $chapscrt; - my $template = 'menu'; + my $chapscrt; + my $template = 'menu'; - { - last unless $instance =~ /^fc[[:digit:]]{2}$/; - last unless $username =~ /^[[:alnum:]]+$/; - last unless PAM::auth($username, url_unescape($password)); - last unless $chapscrt = `sudo scripts/mktgt $instance $username`; - $template = $instance; - } + { + last unless $instance =~ /^fc[[:digit:]]{2}$/; + last unless $username =~ /^[[:alnum:]]+$/; + last unless PAM::auth($username, url_unescape($password)); + last unless $chapscrt = `sudo scripts/mktgt $instance $username`; + $template = $instance; + } - return $c->render(template => $template, username => $username, chapscrt => $chapscrt); + return $c->render(template => $template, username => $username, chapscrt => $chapscrt); }; app->start; END ``` -新版本的 bootmenu 应用程序调用一个定制的 mktgt 脚本,如果成功,它将为每个它自己创建的新的 iSCSI 目标返回一个随机的 [CHAP][3] 密码。这个 CHAP 密码可以防止其它用户的 iSCSI 目标以间接方式挂载这个用户的目标。这个应用程序只有在用户密码认证成功之后才返回一个正确的 iSCSI 目标密码。 +新版本的 bootmenu 应用程序调用一个定制的 `mktgt` 脚本,如果成功,它将为每个它自己创建的新的 iSCSI 目标返回一个随机的 [CHAP][3] 密码。这个 CHAP 密码可以防止其它用户的 iSCSI 目标以间接方式挂载这个用户的目标。这个应用程序只有在用户密码认证成功之后才返回一个正确的 iSCSI 目标密码。 -mktgt 脚本要加 sudo 前缀来运行,因为它需要 root 权限去创建目标。 +`mktgt` 脚本要加 `sudo` 前缀来运行,因为它需要 root 权限去创建目标。 -\$username 和 \$chapscrt 变量也传递 render 命令,因此在需要的时候,它们也能够被纳入到模板中返回给用户。 +`$username` 和 `$chapscrt` 变量也传递给 `render` 命令,因此在需要的时候,它们也能够被纳入到模板中返回给用户。 -接下来,更新我们的引导模板,以便于它们能够读取用户名和 chapscrt 变量,并传递它们到所属的终端用户。也要更新模板以 rw(读写)模式加载根文件系统: +接下来,更新我们的引导模板,以便于它们能够读取用户名和 `chapscrt` 变量,并传递它们到所属的终端用户。也要更新模板以 rw(读写)模式加载根文件系统: ``` # cd $MY_MOJO/templates @@ -379,17 +377,17 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img boot || chain https://server-01.example.edu/menu ``` -注意:如果在 [插入][4] 变量后需要查看引导模板,你可以在 “boot” 命令之前,在它自己的行中插入 “shell” 命令。然后在你网络引导你的客户端时,iPXE 将在那里给你提供一个用于交互的 shell,你可以在 shell 中输入 “imgstat” 去查看传递到内核的参数。如果一切正确,你可以输入 “exit” 去退出 shell 并继续引导过程。 +注意:如果在 [插入][4] 变量后需要查看引导模板,你可以在 `boot` 命令之前,在它自己的行中插入 `shell` 命令。然后在你网络引导你的客户端时,iPXE 将在那里给你提供一个用于交互的 shell,你可以在 shell 中输入 `imgstat` 去查看传递到内核的参数。如果一切正确,你可以输入 `exit` 去退出 shell 并继续引导过程。 -现在,通过 sudo 允许 bootmenu 用户以 root 权限去运行 mktgt 脚本(仅那个脚本): +现在,通过 `sudo` 允许 bootmenu 用户以 root 权限去运行 `mktgt` 脚本(仅这个脚本): ``` # echo "bootmenu ALL = NOPASSWD: $MY_MOJO/scripts/mktgt *" > /etc/sudoers.d/bootmenu ``` -bootmenu 用户不应该写访问 mktgt 脚本或在它的 home 目录下的任何其它文件。在 /opt/bootmenu 目录下的所有文件的属主应该是 root,并且不应该被其它任何 root 以外的用户可写。 +bootmenu 用户不应该写访问 `mktgt` 脚本或在它的家目录下的任何其它文件。在 `/opt/bootmenu` 目录下的所有文件的属主应该是 root,并且不应该被其它任何 root 以外的用户可写。 -Sudo 在使用 systemd 的 DynamicUser 选项下不能正常工作,因此创建一个普通用户帐户,并设置 systemd 服务以那个用户运行: +`sudo` 在使用 systemd 的 `DynamicUser` 选项下不能正常工作,因此创建一个普通用户帐户,并设置 systemd 服务以那个用户运行: ``` # useradd -r -c 'iPXE Boot Menu Service' -d /opt/bootmenu -s /sbin/nologin bootmenu @@ -397,7 +395,7 @@ Sudo 在使用 systemd 的 DynamicUser 选项下不能正常工作,因此创 # systemctl daemon-reload ``` -最后,为写时复制覆盖创建一个目录,并创建管理 iSCSI 目标的 mktgt 脚本和它们的覆盖支持存储: +最后,为写时复制覆盖创建一个目录,并创建管理 iSCSI 目标的 `mktgt` 脚本和它们的覆盖支持存储: ``` # mkdir /$MY_FC.cow @@ -510,25 +508,23 @@ END 上面的脚本将做以下五件事情: - 1. 创建 /.cow/ 稀疏文件(如果不存在的话)。 - 2. 创建 /dev/mapper/- 设备节点作为 iSCSI 目标的写时复制支持存储(如果不存在的话)。 - 3. 创建 iqn.:- iSCSI 目标(如果不存在的话)。或者,如果已存在了,它将关闭任何已存在的连接,因为在任何时刻,镜像只能以只读模式从一个地方打开。 - 4. 它在 iqn.:- iSCSI 目标上(重新)设置 chap 密码为一个新的随机值。 + 1. 创建 `/.cow/` 稀疏文件(如果不存在的话)。 + 2. 创建 `/dev/mapper/-` 设备节点作为 iSCSI 目标的写时复制支持存储(如果不存在的话)。 + 3. 创建 `iqn.:-` iSCSI 目标(如果不存在的话)。或者,如果已存在了,它将关闭任何已存在的连接,因为在任何时刻,镜像只能以只读模式从一个地方打开。 + 4. 它在 `iqn.:-` iSCSI 目标上(重新)设置 chap 密码为一个新的随机值。 5. (如果前面的所有任务都成功的话)它在 [标准输出][5] 上显示新的 chap 密码。 - - -你应该可以在命令行上通过使用有效的测试参数来运行它,以测试 mktgt 脚本能否正常工作。例如: +你应该可以在命令行上通过使用有效的测试参数来运行它,以测试 `mktgt` 脚本能否正常工作。例如: ``` # echo `$MY_MOJO/scripts/mktgt fc29 jsmith` ``` -当你从命令行上运行时,mktgt 脚本应该会输出 iSCSI 目标的一个随意的八字符随机密码(如果成功的话)或者是出错位置的行号(如果失败的话)。 +当你从命令行上运行时,`mktgt` 脚本应该会输出 iSCSI 目标的一个随意的八字符随机密码(如果成功的话)或者是出错位置的行号(如果失败的话)。 -有时候,你可能需要在不停止整个服务的情况下删除一个 iSCSI 目标。例如,一个用户可能无意中损坏了他的个人镜像,在那种情况下,你可能需要按步骤撤销上面的 mktgt 脚本所做的事情,以便于他下次登入时他将得到一个原始镜像。 +有时候,你可能需要在不停止整个服务的情况下删除一个 iSCSI 目标。例如,一个用户可能无意中损坏了他的个人镜像,在那种情况下,你可能需要按步骤撤销上面的 `mktgt` 脚本所做的事情,以便于他下次登入时他将得到一个原始镜像。 -下面是用于撤销的 rmtgt 脚本,它以相反的顺序做了上面 mktgt 脚本所做的事情: +下面是用于撤销的 `rmtgt` 脚本,它以相反的顺序做了上面 `mktgt` 脚本所做的事情: ``` # mkdir $HOME/bin @@ -556,39 +552,39 @@ my @targets = $text =~ /(?:^T.*\n)(?:^ .*\n)*/mg; my $targets = {}; foreach (@targets) { - my $tgt; - my $sid; + my $tgt; + my $sid; - foreach (split /\n/) { - /^Target (\d+)(?{ $tgt = $targets->{$^N} = [] })/; - /I_T nexus: (\d+)(?{ $sid = $^N })/; - /Connection: (\d+)(?{ push @{$tgt}, [ $sid, $^N ] })/; - } + foreach (split /\n/) { + /^Target (\d+)(?{ $tgt = $targets->{$^N} = [] })/; + /I_T nexus: (\d+)(?{ $sid = $^N })/; + /Connection: (\d+)(?{ push @{$tgt}, [ $sid, $^N ] })/; + } } my $tid = 0; foreach (@targets) { - next unless /^Target (\d+)(?{ $tid = $^N }): $target$/m; - foreach (@{$targets->{$tid}}) { - die unless system("$tgtadm --op delete --mode conn --tid $tid --sid $_->[0] --cid $_->[1]") == 0; - } - die unless system("$tgtadm --op delete --mode target --tid $tid") == 0; - print "target $tid deleted\n"; - sleep 1; + next unless /^Target (\d+)(?{ $tid = $^N }): $target$/m; + foreach (@{$targets->{$tid}}) { + die unless system("$tgtadm --op delete --mode conn --tid $tid --sid $_->[0] --cid $_->[1]") == 0; + } + die unless system("$tgtadm --op delete --mode target --tid $tid") == 0; + print "target $tid deleted\n"; + sleep 1; } my $dev = "/dev/mapper/$cow"; if ($rmd or ($rmf and -e $dev)) { - die unless system("dmsetup remove $cow") == 0; - print "device node $dev deleted\n"; + die unless system("dmsetup remove $cow") == 0; + print "device node $dev deleted\n"; } if ($rmf) { - my $sf = "/$instance.cow/$username"; - die "sparse file $sf not found" unless -e "$sf"; - die unless system("rm -f $sf") == 0; - die unless not -e "$sf"; - print "sparse file $sf deleted\n"; + my $sf = "/$instance.cow/$username"; + die "sparse file $sf not found" unless -e "$sf"; + die unless system("rm -f $sf") == 0; + die unless not -e "$sf"; + print "sparse file $sf deleted\n"; } END # chmod +x $HOME/bin/rmtgt @@ -600,7 +596,7 @@ END # rmtgt fc29 jsmith +f ``` -一旦你验证 mktgt 脚本工作正常,你可以重启动 bootmenu 服务。下次有人从网络引导时,他们应该能够接收到一个他们可以写入的、可”私人定制“的网络引导镜像的副本: +一旦你验证 `mktgt` 脚本工作正常,你可以重启动 bootmenu 服务。下次有人从网络引导时,他们应该能够接收到一个他们可以写入的、可”私人定制“的网络引导镜像的副本: ``` # systemctl restart bootmenu.service @@ -617,7 +613,7 @@ via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/ 作者:[Gregory Bartholomew][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 19a003c9b81c309a0cd027ab67bf2626a583466e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 22:26:35 +0800 Subject: [PATCH 0724/4278] PUB:20190114 How to Build a Netboot Server, Part 4.md @qhwdw https://linux.cn/article-10470-1.html --- .../20190114 How to Build a Netboot Server, Part 4.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 How to Build a Netboot Server, Part 4.md (99%) diff --git a/translated/tech/20190114 How to Build a Netboot Server, Part 4.md b/published/20190114 How to Build a Netboot Server, Part 4.md similarity index 99% rename from translated/tech/20190114 How to Build a Netboot Server, Part 4.md rename to published/20190114 How to Build a Netboot Server, Part 4.md index d3eae1aefe..87eb7a25cd 100644 --- a/translated/tech/20190114 How to Build a Netboot Server, Part 4.md +++ b/published/20190114 How to Build a Netboot Server, Part 4.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "qhwdw" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10470-1.html" [#]: subject: "How to Build a Netboot Server, Part 4" [#]: via: "https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/" [#]: author: "Gregory Bartholomew https://fedoramagazine.org/author/glb/" From 4e7ebb3b07945a41b94b9fda7eab629846ac0dff Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 23:23:27 +0800 Subject: [PATCH 0725/4278] PRF:20190107 Getting started with Pelican- A Python-based static site generator.md @MjSeven --- ...n- A Python-based static site generator.md | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md index bc82a69c54..7a4a9b475f 100644 --- a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md +++ b/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -1,27 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with Pelican: A Python-based static site generator) [#]: via: (https://opensource.com/article/19/1/getting-started-pelican) [#]: author: (Craig Sebenik https://opensource.com/users/craig5) -Pelican 简介:一个 Python 静态网站生成器 +Pelican 入门:一个 Python 静态网站生成器 ====== -Pelican 是那些想要自我托管简单网站或博客的 Python 用户的绝佳选择。 + +> Pelican 是那些想要自我托管简单网站或博客的 Python 用户的绝佳选择。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0) -如果你想创建一个自定义网站或博客,有很多选择。许多提供商将托管你的网站并为你完成大部分工作。(WordPress 是一个非常受欢迎的选项。)但是使用托管方案,你会失去一些灵活性。作为一名软件开发人员,我更喜欢管理我自己的服务器,并在我的网站如何运行方面保持更多的自由。 +如果你想创建一个自定义网站或博客,有很多选择。许多提供商可以托管你的网站并为你完成大部分工作。(WordPress 是一个非常受欢迎的选项。)但是使用托管方式,你会失去一些灵活性。作为一名软件开发人员,我更喜欢管理我自己的服务器,并在我的网站如何运行方面保持更多的自由。 然而,管理 Web 服务器需要大量的工作。安装它并获得一个简单的应用程序来提供内容是非常容易的。但是,维护安全补丁和更新是非常耗时得。如果你只想提供静态网页,那么拥有一个 Web 服务器和一系列应用程序可能会得不偿失。手动创建 HTML 页面也不是一个好选择。 -这是静态网站生成器的用武之地。这些应用程序使用模板来创建所需的静态页面,并将它们与关联的元数据交叉链接。(例如,所有显示的页面都带有公共标签或关键词。)静态网站生成器可以帮助你使用导航区域,页眉和页脚等元素创建一个具有公共外观的网站。 +这是静态网站生成器的用武之地。这些应用程序使用模板来创建所需的静态页面,并将它们与关联的元数据交叉链接。(例如,所有显示的页面都带有公共标签或关键词。)静态网站生成器可以帮助你使用导航区域、页眉和页脚等元素创建一个具有公共外观的网站。 -我使用 [Pyhton][1] 已经很多年了,所以,当我第一次开始寻找生成静态 HTML 页面的东西时,我想要用 Python 编写的东西。主要原因是我经常想要了解应用程序如何工作的内部细节,而使用一种我已经了解的语言使这一点更容易。(如果这对你不重要或者你不使用 Python,那么还有一些其他很棒的[静态网站生成器][2],它们使用 Ruby, JavaScript 和其它语言。) +我使用 [Pyhton][1] 已经很多年了,所以,当我第一次开始寻找生成静态 HTML 页面的东西时,我想要用 Python 编写的东西。主要原因是我经常想要了解应用程序如何工作的内部细节,而使用一种我已经了解的语言使这一点更容易。(如果这对你不重要或者你不使用 Python,那么还有一些其他很棒的[静态网站生成器][2],它们使用 Ruby、JavaScript 和其它语言。) -我决定试试 [Pelican][3]。它是一个用 Python 编写的常用静态网站生成器。它支持 [reStructuredText][4](译注:这是一种用于文本数据的文件格式,主要用于 Python 社区的技术文档),并且支持 [Markdown][5],这需要通过安装必需的包来完成。所有任务都是通过命令行界面(CLI)工具执行的,这使得熟悉命令行的任何人都可以轻松完成。它简单的 quickstart CLI 工具使得创建一个网站非常容易。 +我决定试试 [Pelican][3]。它是一个用 Python 编写的常用静态网站生成器。它支持 [reStructuredText][4](LCTT 译注:这是一种用于文本数据的文件格式,主要用于 Python 社区的技术文档),并且也支持 [Markdown][5],这需要通过安装必需的包来完成。所有任务都是通过命令行界面(CLI)工具执行的,这使得熟悉命令行的任何人都可以轻松完成。它简单的 quickstart CLI 工具使得创建一个网站非常容易。 在本文中,我将介绍如何安装 Pelican 4,添加一篇文章以及更改默认主题。(注意:我是在 MacOS 上开发的,使用其它 Unix/Linux 实验结果都将相同,但我没有 Windows 主机可以测试。) @@ -42,9 +43,7 @@ Collecting pelican Successfully installed MarkupSafe-1.1.0 blinker-1.4 docutils-0.14 feedgenerator-1.9 jinja2-2.10 pelican-4.0.1 pygments-2.3.1 python-dateutil-2.7.5 pytz-2018.7 six-1.12.0 unidecode-1.0.23 ``` -为了简单起见,我输入了标题和作者的名字,并对 URL 前缀和文章分页选择了 N。(对于其它选项,我使用了默认值。) - -Pelican 的 quickstart CLI 工具将创建基本布局和一些文件来帮助你开始,运行 **pelican-quickstart** 命令。为了简单起见,我输入了**标题**和**作者**的名字,并对 URL 前缀和文章分页选择了 N。稍后在配置文件中更改这些设置非常容易。 +Pelican 的 quickstart CLI 工具将创建基本布局和一些文件来帮助你开始,运行 `pelican-quickstart` 命令。为了简单起见,我输入了**网站标题**和**作者**的名字,并对 URL 前缀和文章分页选择了 “N”。(对于其它选项,我使用了默认值。)稍后在配置文件中更改这些设置非常容易。 ``` $ ./venv/bin/pelicanquickstart @@ -73,18 +72,19 @@ Done. Your new project is available at /Users/craig/tmp/pelican/test-site 你需要启动的所有文件都准备好了。 -quickstart 默认为欧洲/巴黎时区,所以在继续之前更改一下。在你喜欢的文本编辑器中打开 **pelicanconf.py** 文件,寻找 **TIMEZONE** 变量。 +quickstart 默认为欧洲/巴黎时区,所以在继续之前更改一下。在你喜欢的文本编辑器中打开 `pelicanconf.py` 文件,寻找 `TIMEZONE` 变量。 ``` TIMEZONE = 'Europe/Paris' ``` -将其改为 **UTC**。 +将其改为 `UTC`。 + ``` TIMEZONE = 'UTC' ``` -要更新公共设置,在 **pelicanconf.py** 中查找 **SOCIAL** 变量。 +要更新公共设置,在 `pelicanconf.py` 中查找 `SOCIAL` 变量。 ``` SOCIAL = (('You can add links in your config file', '#'), @@ -97,9 +97,9 @@ SOCIAL = (('You can add links in your config file', '#'), SOCIAL = (('Twitter (#craigs55)', 'https://twitter.com/craigs55'),) ``` -注意后面的逗号,它很重要。这个逗号将帮助 Python 识别变量实际上是一个集合。确保你没有删除这个逗号。 +注意末尾的逗号,它很重要。这个逗号将帮助 Python 识别变量实际上是一个集合。确保你没有删除这个逗号。 -现在你已经有了网站的基本知识。quickstart 创建了一个包含许多目标的 Makefile。将 **devserver** 传给 **make** 命令将在你的计算机上启动一个开发服务器,以便你可以预览所有内容。Makefile 中使用的 CLI 命令是 **PATH** 的一部分,因此你需要首先激活 **virtualenv**。 +现在你已经有了网站的基本知识。quickstart 创建了一个包含许多目标的 `Makefile`。将 `devserver` 传给 `make` 命令将在你的计算机上启动一个开发服务器,以便你可以预览所有内容。`Makefile` 中使用的 CLI 命令假定放在 `PATH` 搜索路径中,因此你需要首先激活该虚拟环境。 ``` $ source ./venv/bin/activate @@ -119,11 +119,11 @@ Done: Processed 0 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages ![](https://opensource.com/sites/default/files/uploads/pelican_test-site1.png) -你可以在右侧看到 Twitter 链接,左侧有 Pelican, Python 和 Jinja 的一些链接。(Jinja 是 Pelican 可以使用的一种很棒的模板语言。你可以在 [Jinja 的文档][7]中了解更多相关信息。) +你可以在右侧看到 Twitter 链接,左侧有 Pelican、Python 和 Jinja 的一些链接。(Jinja 是 Pelican 可以使用的一种很棒的模板语言。你可以在 [Jinja 的文档][7]中了解更多相关信息。) ### 添加内容 -现在你又了一个基本的网站,试着添加一些内容。首先,将名为 **welcome.rst** 的文件添加到网站的 **content** 目录中。在你喜欢的文本编辑器中,使用以下文本创建一个文件: +现在你又了一个基本的网站,试着添加一些内容。首先,将名为 `welcome.rst` 的文件添加到网站的 `content` 目录中。在你喜欢的文本编辑器中,使用以下文本创建一个文件: ``` $ pwd @@ -144,9 +144,9 @@ Welcome to my blog. This is a short page just to show how to put up a static page. ``` -Pelican 会自动解析元数据行,包括日期,标签等。 +Pelican 会自动解析元数据行,包括日期、标签等。 -编写完文件后,**devserver** 应该输出以下内容: +编写完文件后,开发服务器应该输出以下内容: ``` -> Modified: content. regenerating... @@ -157,13 +157,13 @@ Done: Processed 1 article, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages i ![](https://opensource.com/sites/default/files/uploads/pelican_test-site2.png) -元数据(例如日期和标签)会自动添加到页面中。此外,Pelican 会自动检测到 **intro** 类别,并将该部分添加到顶部导航中。 +元数据(例如日期和标签)会自动添加到页面中。此外,Pelican 会自动检测到 intro 栏目,并将该部分添加到顶部导航中。 ### 更改主题 -使用像 Pelican 这样流行的开源软件的好处之一是,非常多的用户将进行更改并将其贡献给项目。许多都是以主题形式贡献的。 +使用像 Pelican 这样流行的开源软件的好处之一是,非常多的用户会做出更改并将其贡献给项目。许多都是以主题形式贡献的。 -网站的主题会设置颜色,布局选项等。尝试一个新主题非常容易,你可以在 [Pelican 主题][8]中预览其中的许多内容。 +网站的主题会设置颜色、布局选项等。尝试一个新主题非常容易,你可以在 [Pelican 主题][8]中预览其中的许多内容。 首先,克隆 GitHub 仓库: @@ -175,16 +175,17 @@ Cloning into 'pelicanthemes'... 我喜欢蓝色,那么试试 [blueidea][9]。 -编辑 **pelicanconf.py** ,添加以下行: +编辑 `pelicanconf.py`,添加以下行: + ``` THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' ``` -**devserver** 将重新生成你的输出。在浏览器中刷新网页来查看新主题。 +开发服务器将重新生成你的输出。在浏览器中刷新网页来查看新主题。 ![](https://opensource.com/sites/default/files/uploads/pelican_test-site3.png) -主题控制布局的方方面面。例如,在默认主题中,你可以看到文章旁边带有元标记的类别(Intro),但这个类别并未显示在 blueidea 主题中。 +主题控制布局的方方面面。例如,在默认主题中,你可以看到文章旁边带有元标记的栏目(Intro),但这个栏目并未显示在 blueidea 主题中。 ### 其他考虑因素 @@ -192,9 +193,9 @@ THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' 首先,我对迁移到静态站点犹豫不决的一个原因是它无法对文章评论。幸运的是,有一些第三方服务商将为你提供评论功能。我目前正在关注的是 [Disqus][10]。 -接下来,上面的所有内容都是在我的本地机器上完成的。如果我希望其他人查看我的网站,我将不得不将预先生成的 HTML 文件上传到某个地方。如果你查看 **pelican-quickstart** 输出,你将看到使用 FTP, SSH, S3 甚至 GitHub 页面的选项,每个选项都有其优点和缺点。但是,如果我必须选择一个,那么我可能会选择发布到 GitHub 页面。 +接下来,上面的所有内容都是在我的本地机器上完成的。如果我希望其他人查看我的网站,我将不得不将预先生成的 HTML 文件上传到某个地方。如果你查看 `pelican-quickstart` 输出,你将看到使用 FTP、 SSH、S3 甚至 GitHub 页面的选项,每个选项都有其优点和缺点。但是,如果我必须选择一个,那么我可能会选择发布到 GitHub 页面。 -Pelican 还有许多其他功能,以至于我每天都在学习它。如果你想自托管一个网站或博客,内容简单并且是静态内容,同时你想使用 Python,那么 Pelican 是一个很好的选择。它有一个活跃的用户社区,可以修复 bug,添加特性,而且还会创建新的和有趣的主题。试试看吧! +Pelican 还有许多其他功能,我每天都在学习它。如果你想自托管一个网站或博客,内容简单并且是静态内容,同时你想使用 Python,那么 Pelican 是一个很好的选择。它有一个活跃的用户社区,可以修复 bug,添加特性,而且还会创建新的和有趣的主题。试试看吧! -------------------------------------------------------------------------------- @@ -203,7 +204,7 @@ via: https://opensource.com/article/19/1/getting-started-pelican 作者:[Craig Sebenik][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 3c8f5609c94bf9eb9b9c715dc43493daafed6d7c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 23:24:27 +0800 Subject: [PATCH 0726/4278] PUB:20190107 Getting started with Pelican- A Python-based static site generator.md @MjSeven https://linux.cn/article-10471-1.html --- ...rted with Pelican- A Python-based static site generator.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190107 Getting started with Pelican- A Python-based static site generator.md (99%) diff --git a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/published/20190107 Getting started with Pelican- A Python-based static site generator.md similarity index 99% rename from translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md rename to published/20190107 Getting started with Pelican- A Python-based static site generator.md index 7a4a9b475f..061effbde3 100644 --- a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md +++ b/published/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10471-1.html) [#]: subject: (Getting started with Pelican: A Python-based static site generator) [#]: via: (https://opensource.com/article/19/1/getting-started-pelican) [#]: author: (Craig Sebenik https://opensource.com/users/craig5) From 735567e96b108a1c9c96ec30634d68f923e412c1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 23:49:35 +0800 Subject: [PATCH 0727/4278] PRF:20180319 6 common questions about agile development practices for teams.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lixinyuxx 最近这几篇翻译的不错。值得赞扬,加油! --- ...t agile development practices for teams.md | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/translated/talk/20180319 6 common questions about agile development practices for teams.md b/translated/talk/20180319 6 common questions about agile development practices for teams.md index 288e5c7753..045db356ba 100644 --- a/translated/talk/20180319 6 common questions about agile development practices for teams.md +++ b/translated/talk/20180319 6 common questions about agile development practices for teams.md @@ -1,42 +1,45 @@ -关于团队敏捷开发实践的6个常见问题 +关于团队敏捷开发实践的 6 个常见问题 ====== +> 专家回答了敏捷实践如何帮助团队更有效的 6 个常见问题。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1) + ”有问题么?“ -你可能听过演讲者在演讲结束的时候提出这个问题。这是演讲中最重要的部分--毕竟,你不仅仅是听讲座, 而是参加讨论和社群交流。 +你可能听过演讲者在演讲结束的时候提出这个问题。这是演讲中最重要的部分 —— 毕竟,你不仅仅是听讲座, 而是参加讨论和社群交流。 -最近,我有机会听到我的同伴 Red Hatters 给当地一所大学的一群技术型学生做一个名为 “[Agile in Practice][1]” 的讲座。讲座中有软件工程师 Tomas Tomecek 和敏捷开发的从业者 Fernando Colleone 与 Pavel Najman 合作解释敏捷开发方法的基础,并展示最佳实践在日常活动中的应用。 - -### 1.完美的团队规模是多大? +最近,我有机会听到我的同伴 Red Hatters 给当地一所大学的一群技术型学生做一个名为 “[敏捷实践][1]” 的讲座。讲座中有软件工程师 Tomas Tomecek 和敏捷开发的从业者 Fernando Colleone 、Pavel Najman 合作解释了敏捷开发方法的基础,并展示最佳实践在日常活动中的应用。 知道了学生们参加这个课程是为了了解什么是敏捷实践以及如何将其应用于项目,我想知道学生们的问题会与我作为敏捷从业者在 Red Hat 每天听到的问题相比有什么不同。结果学生的疑问和我的同事们如出一辙。这些问题都直指敏捷实践的核心。 -学生们想知道一个小团队和一个大团队的规模是多少。这个问题与任何曾经合作过做项目的人都是相关的。根据 Tomas 作为技术领导的经验 12 个人从事的项目被认为是一个大型团队。现实中,团队规模通常与生产力没有关系。在有些时候,一个小地区或同一个时区的小团队也许会比一个成员分布在满世界的大团队更具有生产力。最终,讲座建议理想的团队大小大概是5个人(正如 scrum 开发方法的7,+-2)。 +### 1、完美的团队规模是多大? -### 2\. 团队会面临哪些实际挑战? +学生们想知道一个小团队和一个大团队的规模是多少。这个问题与任何曾经合作过做项目的人都是相关的。根据 Tomas 作为技术领导的经验,12 个人从事的项目被认为是一个大型团队。现实中,团队规模通常与生产力没有直接关系。在有些时候,在一个地方或同一个时区的小团队也许会比一个成员分布在满世界的大团队更具有生产力。最终,该讲座建议理想的团队大小大概是 5 个人(正如 scrum 开发方法的 7,+-2)。 -演讲者比较了由本地团队组成的项目(团队成员都是一个办公室,或者相邻近的人)与分散型的团队(位于不同时区)。 当项目需要团队成员之间密切合作时,工程师更喜欢本地的团队,因为时间差异造成的延迟可能会破坏软件开发的“流”。同时,分散型团队可以将可能不适用与当地项目但适用于某些开发用例的技能集合在一起。此外,还有各种最佳方法可用于改进分散型团队中的合作方式。 +### 2、团队会面临哪些实际挑战? -### 3\. 整理堆积的工作需要多少时间? +演讲者比较了由本地团队组成的项目(团队成员都是一个办公室的,或者相邻近的人)与分散型的团队(位于不同时区)。当项目需要团队成员之间密切合作时,工程师更喜欢本地的团队,因为时间差异造成的延迟可能会破坏软件开发的“流”。同时,分散型团队可以将可能不适用与当地项目但适用于某些开发用例的技能集合在一起。此外,还有各种最佳方法可用于改进分散型团队中的合作方式。 -因为这是一个对于新学习学生的介绍性质的演讲,演讲者关注于用 [Scrum][2] 和 [Kanban][3] 作为介绍敏捷开发的方法。他们使用 Scrum 来作为说明软件编写的方法并且用 Kanban 作为工作规划和沟通的系统。关于需要多少时间来整理项目堆积的工作,演讲者解释说并没有固定的准则,相对的,实践出真知:在开发的早期阶段,当一个崭新的项目—特别如果团队里有新人—每周可能会花费数个小时在整理工作上。随着时间推移和不断地练习,会越来越高效。 +### 3、整理堆积的工作需要多少时间? -### 4\. 产品负责人是否是必要的? 他们扮演什么样的角色? +因为这是一个对于新学习敏捷的学生的介绍性质的演讲,演讲者着重把 [Scrum][2] 和 [Kanban][3] 作为介绍敏捷开发的方法。他们使用 Scrum 框架来作为说明软件编写的方法,并且用 Kanban 作为工作规划和沟通的系统。关于需要多少时间来整理项目堆积的工作,演讲者解释说并没有固定的准则,相对的,实践出真知:在开发的早期阶段,当一个崭新的项目 —— 特别如果团队里有新人 —— 每周可能会花费数个小时在整理工作上。随着时间推移和不断地练习,会越来越高效。 -负责人会帮助团队更方便的拓展,然而,职位并不重要,重要的是你的团队中有人能够传递用户的意愿。在许多团队中,特别是在大型 团队中从事单个任务的团队,首席工程师就可以担任负责人。 +### 4、产品负责人是否是必要的? 他们扮演什么样的角色? -### 5\.建议使用哪些敏捷开发的工具?使用 Scrum 或 Kanban 做敏捷开发的时候必须用特定的软件么? +产品负责人会帮助团队更方便的拓展,然而,职位名称并不重要,重要的是你的团队中有人能够传递用户的意愿。在许多团队中,特别是在大型团队中从事单个任务的团队,首席工程师就可以担任产品负责人。 -尽管使用一些专业软件例如 Jira 或 Trello 会很有帮助,特别是在与大量从事大型企业项目的工作者合作时,但它们不是必需的。Scrum 和 Kanban 可以使用像纸卡这样简单的工具完成。关键是在团队中要有一个清晰的信息来源和紧密的交流。也就是说,优秀的两个 kanban 开源工具 [Taiga][4] 和 [Wekan][5] 。更多信息请查看 [5 open source alternatives to Trello][6] 和 [Top 7 open source project management tools for agile teams][7] 。 +### 5、建议使用哪些敏捷开发的工具?使用 Scrum 或 Kanban 做敏捷开发的时候必须用特定的软件么? -### 6\. 学生如何在学校项目中使用敏捷开发技术? +尽管使用一些专业软件例如 Jira 或 Trello 会很有帮助,特别是在与大量从事大型企业项目的工作者合作时,但它们不是必需的。Scrum 和 Kanban 可以使用像纸卡这样简单的工具完成。关键是在团队中要有一个清晰的信息来源和紧密的交流。推荐两个优秀的 kanban 开源工具 [Taiga][4] 和 [Wekan][5]。更多信息请查看 [Trello 的 5 个开源替代品][6] 和 [敏捷团队的最好的 7 个开源项目管理工具][7] 。 -演讲者鼓励学生使用 kanban 在项目结束前使用可视化和大纲来完成。关键是要创建一个公共板块,这样整个团队就可以看到项目的状态。通过使用 kanban 或者类似的高可视化策略,学生不会在项目后期才发现个别成员没有跟上进度。 +### 6、学生如何在学校项目中使用敏捷开发技术? -Scrum 实践比如 sprints 和 daily standups 也是确认每个人都在进步的绝佳方法项目的各个部分最终会一起发挥作用。定期检查和信息共享也至关重要。更多关于 Scrum 的信息,访问 [What is scrum?][8] 。 +演讲者鼓励学生使用 kanban 在项目结束前使用可视化和概述要完成的任务。关键是要创建一个公共板块,这样整个团队就可以看到项目的状态。通过使用 kanban 或者类似的高度可视化的策略,学生不会在项目后期才发现个别成员没有跟上进度。 -牢记 Kanban 和 Scrum 只是敏捷开发中众多框架和工具中的两个。它们可能不是应对每一种情况的最佳方法。 +Scrum 实践比如 sprints 和 daily standups 也是确认每个人都在进步以及项目的各个部分最终会一起发挥作用的绝佳方法。定期检查和信息共享也至关重要。更多关于 Scrum 的信息,访问 [什么是 scrum?][8] 。 + +牢记 Kanban 和 Scrum 只是敏捷开发中众多框架和工具中的两个而已。它们可能不是应对每一种情况的最佳方法。 -------------------------------------------------------------------------------- @@ -44,7 +47,7 @@ via: https://opensource.com/article/18/3/agile-mindset 作者:[Dominika Bula][a] 译者:[lixinyuxx](https://github.com/lixinxyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From aed80c703306d023a95dba4b2eee89f7595d8f9f Mon Sep 17 00:00:00 2001 From: wwhio Date: Wed, 23 Jan 2019 23:49:49 +0800 Subject: [PATCH 0728/4278] 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 a082ed70146eb63d5b49f7019be51ad01fa1b140 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 23:50:08 +0800 Subject: [PATCH 0729/4278] PUB:20180319 6 common questions about agile development practices for teams.md @lixinyuxx https://linux.cn/article-10472-1.html --- ...ommon questions about agile development practices for teams.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180319 6 common questions about agile development practices for teams.md (100%) diff --git a/translated/talk/20180319 6 common questions about agile development practices for teams.md b/published/20180319 6 common questions about agile development practices for teams.md similarity index 100% rename from translated/talk/20180319 6 common questions about agile development practices for teams.md rename to published/20180319 6 common questions about agile development practices for teams.md From 553cd209496af59a40f3592a8c0efee350c60ad5 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 23 Jan 2019 14:05:07 -0500 Subject: [PATCH 0730/4278] Translated by Scoutydren --- ...strategy and simulation games for Linux.md | 112 ------------------ ...strategy and simulation games for Linux.md | 109 +++++++++++++++++ 2 files changed, 109 insertions(+), 112 deletions(-) delete mode 100644 sources/tech/20180814 5 open source strategy and simulation games for Linux.md create mode 100644 translated/tech/20180814 5 open source strategy and simulation games for Linux.md diff --git a/sources/tech/20180814 5 open source strategy and simulation games for Linux.md b/sources/tech/20180814 5 open source strategy and simulation games for Linux.md deleted file mode 100644 index feb71a5b9a..0000000000 --- a/sources/tech/20180814 5 open source strategy and simulation games for Linux.md +++ /dev/null @@ -1,112 +0,0 @@ -Scoutydren is translating. -5 open source strategy and simulation games for Linux -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) - -Gaming has traditionally been one of Linux's weak points. That has changed somewhat in recent years thanks to Steam, GOG, and other efforts to bring commercial games to multiple operating systems, but those games are often not open source. Sure, the games can be played on an open source operating system, but that is not good enough for an open source purist. - -So, can someone who only uses free and open source software find games that are polished enough to present a solid gaming experience without compromising their open source ideals? Absolutely. While open source games are unlikely ever to rival some of the AAA commercial games developed with massive budgets, there are plenty of open source games, in many genres, that are fun to play and can be installed from the repositories of most major Linux distributions. Even if a particular game is not packaged for a particular distribution, it is usually easy to download the game from the project's website to install and play it. - -This article looks at strategy and simulation games. I have already written about [arcade-style games][1], [board & card games][2], [puzzle games][3], [racing & flying games][4], and [role-playing games][5]. - -### Freeciv - -![](https://opensource.com/sites/default/files/uploads/freeciv.png) - -[Freeciv][6] is an open source version of the [Civilization series][7] of computer games. Gameplay is most similar to the earlier games in the Civilization series, and Freeciv even has options to use Civilization 1 and Civilization 2 rule sets. Freeciv involves building cities, exploring the world map, developing technologies, and competing with other civilizations trying to do the same. Victory conditions include defeating all the other civilizations, developing a space colony, or hitting deadline if neither of the first two conditions are met. The game can be played against AI opponents or other human players. Different tile-sets are available to change the look of the game's map. - -To install Freeciv, run the following command: - - * On Fedora: `dnf install freeciv` - * On Debian/Ubuntu: `apt install freeciv` - - - -### MegaGlest - -![](https://opensource.com/sites/default/files/uploads/megaglest.png) - -[MegaGlest][8] is an open source real-time strategy game in the style of Blizzard Entertainment's [Warcraft][9] and [StarCraft][10] games. Players control one of several different factions, building structures and recruiting units to explore the map and battle their opponents. At the beginning of the match, a player can build only the most basic buildings and recruit the weakest units. To build and recruit better things, players must work their way up their factions technology tree by building structures and recruiting units that unlock more advanced options. Combat units will attack when enemy units come into range, but for optimal strategy, it is best to manage the battle directly by controlling the units. Simultaneously managing the construction of new structures, recruiting new units, and managing battles can be a challenge, but that is the point of a real-time strategy game. MegaGlest provides a nice variety of factions, so there are plenty of reasons to try new and different strategies. - -To install MegaGlest, run the following command: - - * On Fedora: `dnf install megaglest` - * On Debian/Ubuntu: `apt install megaglest` - - - -### OpenTTD - -![](https://opensource.com/sites/default/files/uploads/openttd.png) - -[OpenTTD][11] (see also [our review][12]) is an open source implementation of [Transport Tycoon Deluxe][13]. The object of the game is to create a transportation network and earn money, which allows the player to build an even bigger transportation network. The network can include boats, buses, trains, trucks, and planes. By default, gameplay takes place between 1950 and 2050, with players aiming to get the highest performance rating possible before time runs out. The performance rating is based on things like the amount of cargo delivered, the number of vehicles they have, and how much money they earned. - -To install OpenTTD, run the following command: - - * On Fedora: `dnf install openttd` - * On Debian/Ubuntu: `apt install openttd` - - - -### The Battle for Wesnoth - -![](https://opensource.com/sites/default/files/uploads/the_battle_for_wesnoth.png) - -[The Battle for Wesnoth][14] is one of the most polished open source games available. This turn-based strategy game has a fantasy setting. Play takes place on a hexagonal grid, where individual units battle each other for control. Each type of unit has unique strengths and weaknesses, which requires players to plan their attacks accordingly. There are many different campaigns available for The Battle for Wesnoth, each with different objectives and storylines. The Battle for Wesnoth also comes with a map editor for players interested in creating their own maps or campaigns. - -To install The Battle for Wesnoth, run the following command: - - * On Fedora: `dnf install wesnoth` - * On Debian/Ubuntu: `apt install wesnoth` - - - -### UFO: Alien Invasion - -![](https://opensource.com/sites/default/files/uploads/ufo_alien_invasion.png) - -[UFO: Alien Invasion][15] is an open source tactical strategy game inspired by the [X-COM series][20]. There are two distinct gameplay modes: geoscape and tactical. In geoscape mode, the player takes control of the big picture and deals with managing their bases, researching new technologies, and controlling overall strategy. In tactical mode, the player controls a squad of soldiers and directly confronts the alien invaders in a turn-based battle. Both modes provide different gameplay styles, but both require complex strategy and tactics. - -To install UFO: Alien Invasion, run the following command: - - * On Debian/Ubuntu: `apt install ufoai` - - - -Unfortunately, UFO: Alien Invasion is not packaged for Fedora. - -Did I miss one of your favorite open source strategy or simulation games? Share it in the comments below. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/8/strategy-simulation-games-linux - -作者:[Joshua Allen Holm][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/holmja -[1]:https://opensource.com/article/18/1/arcade-games-linux -[2]:https://opensource.com/article/18/3/card-board-games-linux -[3]:https://opensource.com/article/18/6/puzzle-games-linux -[4]:https://opensource.com/article/18/7/racing-flying-games-linux -[5]:https://opensource.com/article/18/8/role-playing-games-linux -[6]:http://www.freeciv.org/ -[7]:https://en.wikipedia.org/wiki/Civilization_(series) -[8]:https://megaglest.org/ -[9]:https://en.wikipedia.org/wiki/Warcraft -[10]:https://en.wikipedia.org/wiki/StarCraft -[11]:https://www.openttd.org/ -[12]:https://opensource.com/life/15/7/linux-game-review-openttd -[13]:https://en.wikipedia.org/wiki/Transport_Tycoon#Transport_Tycoon_Deluxe -[14]:https://www.wesnoth.org/ -[15]:https://ufoai.org/ -[16]:https://opensource.com/downloads/cheat-sheets?intcmp=7016000000127cYAAQ -[17]:https://opensource.com/alternatives?intcmp=7016000000127cYAAQ -[18]:https://opensource.com/tags/linux?intcmp=7016000000127cYAAQ -[19]:https://developers.redhat.com/cheat-sheets/advanced-linux-commands/?intcmp=7016000000127cYAAQ -[20]:https://en.wikipedia.org/wiki/X-COM diff --git a/translated/tech/20180814 5 open source strategy and simulation games for Linux.md b/translated/tech/20180814 5 open source strategy and simulation games for Linux.md new file mode 100644 index 0000000000..b7878dd1b6 --- /dev/null +++ b/translated/tech/20180814 5 open source strategy and simulation games for Linux.md @@ -0,0 +1,109 @@ +5款开源的Linux策略模拟游戏 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) + +长久以来,游戏都是 Linux 的软肋。近些年,Steam,GOG等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 + +那么,我们能找到既免费开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。就算某个游戏在不在某个发行版本的库中,我们也可以在这个游戏项目的网站上找到直接的安装方法。 + +本篇文章将会介绍策略和模拟类游戏。我已经写了街机游戏、桌面卡牌游戏、解谜游戏、竞速飞行游戏以及角色扮演游戏。 + +### Freeciv 开源“文明” + +![](https://opensource.com/sites/default/files/uploads/freeciv.png) + +[Freeciv][6] 可以被视为是文明系列游戏的开源版本。游戏玩法和文明系列最早期的游戏十分类似, Freeciv 可以让玩家选择选用文明 1 或者文明 2 中的游戏规则设置。Freeciv 中包含了很多元素,例如建造城市、探索世界地图、发展科技以及和其他扩张中的文明竞争。胜利条件包括打败所有其他的文明或建立一个外星殖民地,如果在前两者都没有达成的话,在游戏时间期限前存活下来也可以算作胜利。这个游戏可以和其他玩家联机也可以和 AI 对战,不同的地图集可以改变游戏的外观。 + +安装 Freeciv,你只需要在终端下运行以下指令。 + + * Fedora 用户: `dnf install freeciv` + + * Debian/Ubuntu 用户:`apt install freeciv` + + +### MegaGlest + +![](https://opensource.com/sites/default/files/uploads/megaglest.png) + +[MegaGlest][8] 是一个开源的实时战略游戏,类似暴雪公司制作的游戏魔兽世界和星际争霸。玩家控制不同派别的人员、建造新建筑、招募士兵、拓展领土并与敌人作战。在游戏比赛的最开始,玩家仅能建造最基础的建筑和招募最基础的士兵。为了建造更高级的建筑并招募级别更高的人员,玩家必须通过增加建筑和人员从而一路提高科技树、解锁更加高级的选项。当敌人进入国土领域之中,战斗单元必须迎战。但是最好的应对策略是,通过控制战斗单元直接操控每一场战斗。在管理新建筑的建立,新人员的招募的同时控制战斗局势听上去十分困难,但是这就是RTS(实时战略游戏)游戏的精华所在。MegaGlest 这个游戏提供了大量的人员派类,玩家可以不断尝试这些不同的技巧。 + +安装 MegaGlest,你只需要在终端下运行以下指令: + + * Fedora 用户: `dnf install megaglest` + * Debian/Ubuntu 用户:`apt install megaglest` + + + +### OpenTTD 开源版“运输大亨” + +![](https://opensource.com/sites/default/files/uploads/openttd.png) + +[OpenTTD][11] (见我们的 [评测][12] )是一个开源实现的 [运输大亨][13] 。该游戏的目的在于创建一个交通运输网络并获得金钱,从而建立更加复杂的运输网络。这个运输网络包括了船只、巴士、火车、货车和飞机。默认的游戏时间在1950和2050之间,玩家的目标就是在规定时间内拿到最高的游戏分数。游戏的最终分数基于很多因素,例如货物运输的数量、玩家所拥有的汽车数量以及他们赚到的钱。 + +安装 OpenTTD,你只需要在终端运行以下指令: + + * Fedora 用户: `dnf install openttd` + * Debian/Ubuntu 用户 `apt install openttd` + + + +### The Battle for Wesnoth 韦诺之战 + +![](https://opensource.com/sites/default/files/uploads/the_battle_for_wesnoth.png) + +[韦诺之战][14] 是目前最完善的开源游戏之一。这个回合制游戏在一个奇幻的故事设定下。游戏在一个六角形网格中进行,各个单元可以互相操作进行战斗。每个类型的单元都有它独特的能力和弱点,因此玩家需要根据这些特点来设计不同的行动。韦诺之战中有很多不同的行动分支,每个行动分支都有它特别的故事线和目标。The 韦诺之战同时也有一个地图编辑器,感兴趣的玩家可以创作自己的地图以及行动分支。 + +安装韦诺之战,你只需要在终端运行以下指令: + + * Fedora 用户: `dnf install wesnoth ` + * Debian/Ubuntu 用户: `apt install wesnoth` + + + +### UFO: Alien Invasion (UFO:外星入侵) + +![](https://opensource.com/sites/default/files/uploads/ufo_alien_invasion.png) + +[UFO: Alien Invasion][15] 是一个开源策略游戏,基于幽浮系列 [X-COM series][20]。 有两个不同的游戏模式: geoscape 和tactical。在 geoscape 模式下,玩家控制大局、管理基地、开发新技术以及掌控整体策略。 在tactical 游戏模式下,玩家控制一群士兵并且以回合制的形式直接迎战外星侵略者。两个游戏模式提供了不同的游戏玩法,两者都需要相当复杂的策略和战术。 + +安装 UFO:外星入侵,你只需要在终端下运行以下指令: + + * Debian/Ubuntu 用户: `apt install ufoai` + +遗憾的是,UFO: 外星入寝不支持 Fedora 发行版。 + +如果你知道除了这些以外的开源策略模拟游戏的话,欢迎在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/8/strategy-simulation-games-linux + +作者:[Joshua Allen Holm][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[Scoutydren](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/holmja +[1]:https://opensource.com/article/18/1/arcade-games-linux +[2]:https://opensource.com/article/18/3/card-board-games-linux +[3]:https://opensource.com/article/18/6/puzzle-games-linux +[4]:https://opensource.com/article/18/7/racing-flying-games-linux +[5]:https://opensource.com/article/18/8/role-playing-games-linux +[6]:http://www.freeciv.org/ +[7]:https://en.wikipedia.org/wiki/Civilization_(series) +[8]:https://megaglest.org/ +[9]:https://en.wikipedia.org/wiki/Warcraft +[10]:https://en.wikipedia.org/wiki/StarCraft +[11]:https://www.openttd.org/ +[12]:https://opensource.com/life/15/7/linux-game-review-openttd +[13]:https://en.wikipedia.org/wiki/Transport_Tycoon#Transport_Tycoon_Deluxe +[14]:https://www.wesnoth.org/ +[15]:https://ufoai.org/ +[16]:https://opensource.com/downloads/cheat-sheets?intcmp=7016000000127cYAAQ +[17]:https://opensource.com/alternatives?intcmp=7016000000127cYAAQ +[18]:https://opensource.com/tags/linux?intcmp=7016000000127cYAAQ +[19]:https://developers.redhat.com/cheat-sheets/advanced-linux-commands/?intcmp=7016000000127cYAAQ +[20]:https://en.wikipedia.org/wiki/X-COM From 4e684d4716003244a6d8d3e919a5083b6b7893ef Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 08:54:27 +0800 Subject: [PATCH 0731/4278] translated --- ... Linux terminal with this Pac-man clone.md | 52 ------------------- ...109 Bash 5.0 Released with New Features.md | 52 +++++++++---------- ... Linux terminal with this Pac-man clone.md | 52 +++++++++++++++++++ 3 files changed, 78 insertions(+), 78 deletions(-) delete mode 100644 sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md create mode 100644 translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md deleted file mode 100644 index 0207f906df..0000000000 --- a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) -[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Head to the arcade in your Linux terminal with this Pac-man clone -====== -Want to recreate the magic of your favorite arcade game? Today's command-line toy will transport you back in time. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) - -Welcome back to another day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what command-line toys are all about. Basically, they're games and simple diversions that help you have fun at the terminal. - -Some are new, and some are old classics. We hope you enjoy. - -Today's toy, MyMan, is a fun clone of the classic arcade game [Pac-Man][1]. (You didn't think this was going to be about the [similarly-named][2] Linux package manager, did you?) If you're anything like me, you spent more than your fair share of quarters trying to hit a high score Pac-Man back in the day, and still give it a go whenever you get a chance. - -MyMan isn't the only Pac-Man clone for the Linux terminal, but it's the one I chose to include because 1) I like its visual style, which rings true to the original and 2) it's conveniently packaged for my Linux distribution so it was an easy install. But you should check out your other options as well. Here's [another one][3] that looks like it may be promising, but I haven't tried it. - -Since MyMan was packaged for Fedora, installation was as simple as: - -``` -$ dnf install myman -``` - -MyMan is made available under an MIT license and you can check out the source code on [SourceForge][4]. -![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [The Linux terminal is no one-trick pony][5], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-myman - -作者:[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://en.wikipedia.org/wiki/Pac-Man -[2]: https://wiki.archlinux.org/index.php/pacman -[3]: https://github.com/YoctoForBeaglebone/pacman4console -[4]: https://myman.sourceforge.io/ -[5]: https://opensource.com/article/18/12/linux-toy-ponysay diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md index 17b0c5758a..34abd1661d 100644 --- a/sources/tech/20190109 Bash 5.0 Released with New Features.md +++ b/sources/tech/20190109 Bash 5.0 Released with New Features.md @@ -7,60 +7,60 @@ [#]: via: (https://itsfoss.com/bash-5-release) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Bash 5.0 Released with New Features +Bash 5.0 发布了新功能 ====== -The [mailing list][1] confirmed the release of Bash-5.0 recently. And, it is exciting to know that it comes baked with new features and variable. +[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新功能和新变量。 -Well, if you’ve been using Bash 4.4.XX, you will definitely love the fifth major release of [Bash][2]. +如果你一直在使用 Bash 4.4.XX,那么你一定会喜欢 [Bash][2] 的第五个主要版本。 -The fifth release focuses on new shell variables and a lot of major bug fixes with an overhaul. It also introduces a couple of new features along with some incompatible changes between bash-4.4 and bash-5.0. +第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能还有一些让 bash-4.4 和 bash-5.0 之间不兼容的更改。 ![Bash logo][3] -### What about the new features? +### 新功能怎么样? -The mailing list explains the bug fixed in this new release: +邮件列表解释了此版本中修复的 bug: -> This release fixes several outstanding bugs in bash-4.4 and introduces several new features. The most significant bug fixes are an overhaul of how nameref variables resolve and a number of potential out-of-bounds memory errors discovered via fuzzing. There are a number of changes to the expansion of $@ and $* in various contexts where word splitting is not performed to conform to a Posix standard interpretation, and additional changes to resolve corner cases for Posix conformance. +> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 $@ 和 $* 的展开做了许多变化,另外还有解决极端情况中 Posix 一致性的修改。 -It also introduces some new features. As per the release note, these are the most notable new features are several new shell variables: +它还引入了一些新功能。根据发布说明,最值得注意的新功能是几个新的 shell 变量: -> The BASH_ARGV0, EPOCHSECONDS, and EPOCHREALTIME. The ‘history’ builtin can remove ranges of history entries and understands negative arguments as offsets from the end of the history list. There is an option to allow local variables to inherit the value of a variable with the same name at a preceding scope. There is a new shell option that, when enabled, causes the shell to attempt to expand associative array subscripts only once (this is an issue when they are used in arithmetic expressions). The ‘globasciiranges‘ shell option is now enabled by default; it can be set to off by default at configuration time. +> BASH_ARGV0、EPOCHSECONDS 和 EPOCHREALTIME。内置的 “history” 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的shell选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。“globasciiranges” 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 -### What about the changes between Bash-4.4 and Bash-5.0? +### Bash-4.4 和 Bash-5.0 之间有哪些变化? -The update log mentioned about the incompatible changes and the supported readline version history. Here’s what it said: +更新日志提到了不兼容的更改和支持 readline 版本历史记录。它是这么说的: -> There are a few incompatible changes between bash-4.4 and bash-5.0. The changes to how nameref variables are resolved means that some uses of namerefs will behave differently, though I have tried to minimize the compatibility issues. By default, the shell only sets BASH_ARGC and BASH_ARGV at startup if extended debugging mode is enabled; it was an oversight that it was set unconditionally and caused performance issues when scripts were passed large numbers of arguments. +> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 nameref 变量解析的更改意味着对 namerefs 的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 BASH_ARGC 和 BASH_ARGV。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 > -> Bash can be linked against an already-installed Readline library rather than the private version in lib/readline if desired. Only readline-8.0 and later versions are able to provide all of the symbols that bash-5.0 requires; earlier versions of the Readline library will not work correctly. +>如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 lib/readline 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 -I believe some of the features/variables added are very useful. Some of my favorites are: +我相信一些添加的功能/变量非常有用。我最喜欢的一些是: - * There is a new (disabled by default, undocumented) shell option to enable and disable sending history to syslog at runtime. - * The shell doesn’t automatically set BASH_ARGC and BASH_ARGV at startup unless it’s in debugging mode, as the documentation has always said, but will dynamically create them if a script references them at the top level without having enabled debugging mode. - * The ‘history’ can now delete ranges of history entries using ‘-d start-end’. - * If a non-interactive shell with job control enabled detects that a foreground job died due to SIGINT, it acts as if it received the SIGINT. - * BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment. + * 有一个新的(默认情况下禁用,文档中没有说明)shell 选项,用于在运行时启用/禁用向 syslog 发送历史记录。 + * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 BASH_ARGC 和 BASH_ARGV,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 + * 现在可以使用 “-d start-end” 删除指定范围的 “history” 条目。 + * 如果启用了作业控制的非交互式 shell 检测到前台作业因 SIGINT 而死亡,则其行为就像接收到 SIGINT 一样。 + * BASH_ARGV0:一个新变量,扩展为 $0 并在赋值时设置 $0。 -To check the complete list of changes and features you should refer to the [Mailing list post][1]. +要查看完整的更改和功能列表,请参阅[邮件列表文章][1]。 -### Wrapping Up +### 总结 -You can check your current Bash version, using this command: +你可以使用下面的命令检查你当前的 Bash 版本: ``` bash --version ``` -It’s more likely that you’ll have Bash 4.4 installed. If you want to get the new version, I would advise waiting for your distribution to provide it. +你很可能安装了 Bash 4.4。如果你想获得新版本,我建议等待你的发行版提供它。 -With Bash-5.0 available, what do you think about it? Are you using any alternative to bash? If so, would this update change your mind? +你怎么看待 Bash-5.0 发布?你在使用其他 bash 的替代品么?如果有的话,这个更新会改变你的想法么? -Let us know your thoughts in the comments below. +请在下面的评论中告诉我们你的想法。 -------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ via: https://itsfoss.com/bash-5-release 作者:[Ankush Das][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/) 荣誉推出 diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md new file mode 100644 index 0000000000..52878c44f0 --- /dev/null +++ b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) +[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +用这个吃豆人克隆在你的终端中玩街机 +====== +想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) + +欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 + +有些是新的,有些是古老的经典。我们希望你喜欢。 + +今天的玩具,MyMan,是经典街机游戏[吃豆人][1](你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 + +MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版已打包,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 + +由于 MyMan 已为 Fedora 打包,因此安装非常简单: + +``` +$ dnf install myman +``` + +MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码。 +![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +了解一下昨天的玩具,[Linux 终端能做其他事][5],还有记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-myman + +作者:[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://en.wikipedia.org/wiki/Pac-Man +[2]: https://wiki.archlinux.org/index.php/pacman +[3]: https://github.com/YoctoForBeaglebone/pacman4console +[4]: https://myman.sourceforge.io/ +[5]: https://opensource.com/article/18/12/linux-toy-ponysay From 4c9f4bbb4b947b3b9d1ddeea09f08d7a17989f30 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 08:59:55 +0800 Subject: [PATCH 0732/4278] translated --- .../tech/20190109 Bash 5.0 Released with New Features.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190109 Bash 5.0 Released with New Features.md (100%) diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/translated/tech/20190109 Bash 5.0 Released with New Features.md similarity index 100% rename from sources/tech/20190109 Bash 5.0 Released with New Features.md rename to translated/tech/20190109 Bash 5.0 Released with New Features.md From 7da518624302bcafabb69ef4ebd9acc3ee16ea12 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 09:06:55 +0800 Subject: [PATCH 0733/4278] Revert "translated" This reverts commit 4e684d4716003244a6d8d3e919a5083b6b7893ef. --- ... Linux terminal with this Pac-man clone.md | 52 +++++++++++++++++++ ... Linux terminal with this Pac-man clone.md | 52 ------------------- ...109 Bash 5.0 Released with New Features.md | 52 +++++++++---------- 3 files changed, 78 insertions(+), 78 deletions(-) create mode 100644 sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md delete mode 100644 translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md new file mode 100644 index 0000000000..0207f906df --- /dev/null +++ b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) +[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Head to the arcade in your Linux terminal with this Pac-man clone +====== +Want to recreate the magic of your favorite arcade game? Today's command-line toy will transport you back in time. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) + +Welcome back to another day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what command-line toys are all about. Basically, they're games and simple diversions that help you have fun at the terminal. + +Some are new, and some are old classics. We hope you enjoy. + +Today's toy, MyMan, is a fun clone of the classic arcade game [Pac-Man][1]. (You didn't think this was going to be about the [similarly-named][2] Linux package manager, did you?) If you're anything like me, you spent more than your fair share of quarters trying to hit a high score Pac-Man back in the day, and still give it a go whenever you get a chance. + +MyMan isn't the only Pac-Man clone for the Linux terminal, but it's the one I chose to include because 1) I like its visual style, which rings true to the original and 2) it's conveniently packaged for my Linux distribution so it was an easy install. But you should check out your other options as well. Here's [another one][3] that looks like it may be promising, but I haven't tried it. + +Since MyMan was packaged for Fedora, installation was as simple as: + +``` +$ dnf install myman +``` + +MyMan is made available under an MIT license and you can check out the source code on [SourceForge][4]. +![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [The Linux terminal is no one-trick pony][5], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-myman + +作者:[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://en.wikipedia.org/wiki/Pac-Man +[2]: https://wiki.archlinux.org/index.php/pacman +[3]: https://github.com/YoctoForBeaglebone/pacman4console +[4]: https://myman.sourceforge.io/ +[5]: https://opensource.com/article/18/12/linux-toy-ponysay diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md deleted file mode 100644 index 52878c44f0..0000000000 --- a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) -[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -用这个吃豆人克隆在你的终端中玩街机 -====== -想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) - -欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 - -有些是新的,有些是古老的经典。我们希望你喜欢。 - -今天的玩具,MyMan,是经典街机游戏[吃豆人][1](你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 - -MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版已打包,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 - -由于 MyMan 已为 Fedora 打包,因此安装非常简单: - -``` -$ dnf install myman -``` - -MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码。 -![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) -你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 - -了解一下昨天的玩具,[Linux 终端能做其他事][5],还有记得明天再来! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-myman - -作者:[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://en.wikipedia.org/wiki/Pac-Man -[2]: https://wiki.archlinux.org/index.php/pacman -[3]: https://github.com/YoctoForBeaglebone/pacman4console -[4]: https://myman.sourceforge.io/ -[5]: https://opensource.com/article/18/12/linux-toy-ponysay diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/translated/tech/20190109 Bash 5.0 Released with New Features.md index 34abd1661d..17b0c5758a 100644 --- a/translated/tech/20190109 Bash 5.0 Released with New Features.md +++ b/translated/tech/20190109 Bash 5.0 Released with New Features.md @@ -7,60 +7,60 @@ [#]: via: (https://itsfoss.com/bash-5-release) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Bash 5.0 发布了新功能 +Bash 5.0 Released with New Features ====== -[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新功能和新变量。 +The [mailing list][1] confirmed the release of Bash-5.0 recently. And, it is exciting to know that it comes baked with new features and variable. -如果你一直在使用 Bash 4.4.XX,那么你一定会喜欢 [Bash][2] 的第五个主要版本。 +Well, if you’ve been using Bash 4.4.XX, you will definitely love the fifth major release of [Bash][2]. -第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能还有一些让 bash-4.4 和 bash-5.0 之间不兼容的更改。 +The fifth release focuses on new shell variables and a lot of major bug fixes with an overhaul. It also introduces a couple of new features along with some incompatible changes between bash-4.4 and bash-5.0. ![Bash logo][3] -### 新功能怎么样? +### What about the new features? -邮件列表解释了此版本中修复的 bug: +The mailing list explains the bug fixed in this new release: -> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 $@ 和 $* 的展开做了许多变化,另外还有解决极端情况中 Posix 一致性的修改。 +> This release fixes several outstanding bugs in bash-4.4 and introduces several new features. The most significant bug fixes are an overhaul of how nameref variables resolve and a number of potential out-of-bounds memory errors discovered via fuzzing. There are a number of changes to the expansion of $@ and $* in various contexts where word splitting is not performed to conform to a Posix standard interpretation, and additional changes to resolve corner cases for Posix conformance. -它还引入了一些新功能。根据发布说明,最值得注意的新功能是几个新的 shell 变量: +It also introduces some new features. As per the release note, these are the most notable new features are several new shell variables: -> BASH_ARGV0、EPOCHSECONDS 和 EPOCHREALTIME。内置的 “history” 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的shell选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。“globasciiranges” 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 +> The BASH_ARGV0, EPOCHSECONDS, and EPOCHREALTIME. The ‘history’ builtin can remove ranges of history entries and understands negative arguments as offsets from the end of the history list. There is an option to allow local variables to inherit the value of a variable with the same name at a preceding scope. There is a new shell option that, when enabled, causes the shell to attempt to expand associative array subscripts only once (this is an issue when they are used in arithmetic expressions). The ‘globasciiranges‘ shell option is now enabled by default; it can be set to off by default at configuration time. -### Bash-4.4 和 Bash-5.0 之间有哪些变化? +### What about the changes between Bash-4.4 and Bash-5.0? -更新日志提到了不兼容的更改和支持 readline 版本历史记录。它是这么说的: +The update log mentioned about the incompatible changes and the supported readline version history. Here’s what it said: -> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 nameref 变量解析的更改意味着对 namerefs 的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 BASH_ARGC 和 BASH_ARGV。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 +> There are a few incompatible changes between bash-4.4 and bash-5.0. The changes to how nameref variables are resolved means that some uses of namerefs will behave differently, though I have tried to minimize the compatibility issues. By default, the shell only sets BASH_ARGC and BASH_ARGV at startup if extended debugging mode is enabled; it was an oversight that it was set unconditionally and caused performance issues when scripts were passed large numbers of arguments. > ->如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 lib/readline 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 +> Bash can be linked against an already-installed Readline library rather than the private version in lib/readline if desired. Only readline-8.0 and later versions are able to provide all of the symbols that bash-5.0 requires; earlier versions of the Readline library will not work correctly. -我相信一些添加的功能/变量非常有用。我最喜欢的一些是: +I believe some of the features/variables added are very useful. Some of my favorites are: - * 有一个新的(默认情况下禁用,文档中没有说明)shell 选项,用于在运行时启用/禁用向 syslog 发送历史记录。 - * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 BASH_ARGC 和 BASH_ARGV,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 - * 现在可以使用 “-d start-end” 删除指定范围的 “history” 条目。 - * 如果启用了作业控制的非交互式 shell 检测到前台作业因 SIGINT 而死亡,则其行为就像接收到 SIGINT 一样。 - * BASH_ARGV0:一个新变量,扩展为 $0 并在赋值时设置 $0。 + * There is a new (disabled by default, undocumented) shell option to enable and disable sending history to syslog at runtime. + * The shell doesn’t automatically set BASH_ARGC and BASH_ARGV at startup unless it’s in debugging mode, as the documentation has always said, but will dynamically create them if a script references them at the top level without having enabled debugging mode. + * The ‘history’ can now delete ranges of history entries using ‘-d start-end’. + * If a non-interactive shell with job control enabled detects that a foreground job died due to SIGINT, it acts as if it received the SIGINT. + * BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment. -要查看完整的更改和功能列表,请参阅[邮件列表文章][1]。 +To check the complete list of changes and features you should refer to the [Mailing list post][1]. -### 总结 +### Wrapping Up -你可以使用下面的命令检查你当前的 Bash 版本: +You can check your current Bash version, using this command: ``` bash --version ``` -你很可能安装了 Bash 4.4。如果你想获得新版本,我建议等待你的发行版提供它。 +It’s more likely that you’ll have Bash 4.4 installed. If you want to get the new version, I would advise waiting for your distribution to provide it. -你怎么看待 Bash-5.0 发布?你在使用其他 bash 的替代品么?如果有的话,这个更新会改变你的想法么? +With Bash-5.0 available, what do you think about it? Are you using any alternative to bash? If so, would this update change your mind? -请在下面的评论中告诉我们你的想法。 +Let us know your thoughts in the comments below. -------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ via: https://itsfoss.com/bash-5-release 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[geekpi](https://github.com/geekpi) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e87fe30334f5433eb653a0493a4d41f55eefc979 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 09:07:10 +0800 Subject: [PATCH 0734/4278] Revert "translated" This reverts commit 4c9f4bbb4b947b3b9d1ddeea09f08d7a17989f30. --- .../tech/20190109 Bash 5.0 Released with New Features.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated => sources}/tech/20190109 Bash 5.0 Released with New Features.md (100%) diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md similarity index 100% rename from translated/tech/20190109 Bash 5.0 Released with New Features.md rename to sources/tech/20190109 Bash 5.0 Released with New Features.md From c40613ac2ec77a77d575711890d64cab08b7ca4a Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 09:19:01 +0800 Subject: [PATCH 0735/4278] translated --- ... Linux terminal with this Pac-man clone.md | 52 ------------------- ... Linux terminal with this Pac-man clone.md | 49 +++++++++++++++++ 2 files changed, 49 insertions(+), 52 deletions(-) delete mode 100644 sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md create mode 100644 translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md deleted file mode 100644 index 0207f906df..0000000000 --- a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) -[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Head to the arcade in your Linux terminal with this Pac-man clone -====== -Want to recreate the magic of your favorite arcade game? Today's command-line toy will transport you back in time. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) - -Welcome back to another day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what command-line toys are all about. Basically, they're games and simple diversions that help you have fun at the terminal. - -Some are new, and some are old classics. We hope you enjoy. - -Today's toy, MyMan, is a fun clone of the classic arcade game [Pac-Man][1]. (You didn't think this was going to be about the [similarly-named][2] Linux package manager, did you?) If you're anything like me, you spent more than your fair share of quarters trying to hit a high score Pac-Man back in the day, and still give it a go whenever you get a chance. - -MyMan isn't the only Pac-Man clone for the Linux terminal, but it's the one I chose to include because 1) I like its visual style, which rings true to the original and 2) it's conveniently packaged for my Linux distribution so it was an easy install. But you should check out your other options as well. Here's [another one][3] that looks like it may be promising, but I haven't tried it. - -Since MyMan was packaged for Fedora, installation was as simple as: - -``` -$ dnf install myman -``` - -MyMan is made available under an MIT license and you can check out the source code on [SourceForge][4]. -![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [The Linux terminal is no one-trick pony][5], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-myman - -作者:[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://en.wikipedia.org/wiki/Pac-Man -[2]: https://wiki.archlinux.org/index.php/pacman -[3]: https://github.com/YoctoForBeaglebone/pacman4console -[4]: https://myman.sourceforge.io/ -[5]: https://opensource.com/article/18/12/linux-toy-ponysay diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md new file mode 100644 index 0000000000..121f29e248 --- /dev/null +++ b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -0,0 +1,49 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) +[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +用这个吃豆人克隆在你的终端中玩街机 +====== +想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) + +欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 + +有些是新的,有些是古老的经典。我们希望你喜欢。 + +今天的玩具,MyMan,是经典街机游戏[吃豆人][1](你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 + +MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版已打包,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 + +由于 MyMan 已为 Fedora 打包,因此安装非常简单: + +``` +$ dnf install myman +``` + +MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码。 +![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +了解一下昨天的玩具,[Linux 终端能做其他事][5],还有记得明天再来! + +-------------------------------------------------------------------------------- +via: https://opensource.com/article/18/12/linux-toy-myman +作者:[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://en.wikipedia.org/wiki/Pac-Man +[2]: https://wiki.archlinux.org/index.php/pacman +[3]: https://github.com/YoctoForBeaglebone/pacman4console +[4]: https://myman.sourceforge.io/ +[5]: https://opensource.com/article/18/12/linux-toy-ponysay From 4c0a0b18d346c2f812f6b5bc14f2cf1a06e95752 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 09:21:33 +0800 Subject: [PATCH 0736/4278] translating --- sources/tech/20181219 How to open source your Python library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181219 How to open source your Python library.md b/sources/tech/20181219 How to open source your Python library.md index cf59688484..79c25c9a00 100644 --- a/sources/tech/20181219 How to open source your Python library.md +++ b/sources/tech/20181219 How to open source your Python library.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1ed8581086497e5ab482124ea633dd1f8f4bb4a1 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 24 Jan 2019 12:57:46 +0800 Subject: [PATCH 0737/4278] Translating An Introduction to Go. --- .../tech/20181224 An Introduction to Go.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 78766d9de6..a63bd98003 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -152,43 +152,43 @@ func main() { ### 信道 -Goroutines are often combined with channels to provide an extended form of Communicating Sequential Processes . A channel is a concurrent-safe queue, and can be buffered or unbuffered: +Goroutines 通常同信道结合以提供一种通信顺序进程的扩展。信道是一个并发安全的队列,而且可以缓冲或者不缓冲: ``` -var unbuffered = make(chan int) // sending blocks until value has been read -var buffered = make(chan int, 5) // may have up to 5 unread values queued +var unbuffered = make(chan int) // 直到数据被读取时完成数据块发送 +var buffered = make(chan int, 5) // 最多有 5 个未读取的数据块 ``` -The `<-` operator is used to communicate with a single channel. +运输符 `<-` 用于同单个信道通信。 ``` valueReadFromChannel := <- channel otherChannel <- valueToSend ``` -The `select` statement allows communication with multiple channels: +语句 `select` 允许多个信道进行通信: ``` select { case incoming := <- inboundChannel: - // A new message for me + // 一条新消息 case outgoingChannel <- outgoing: - // Could send a message, yay! + // 可以发送消息 } ``` ### `defer` 声明 -Go provides a `defer` statement that allows a function call to be scheduled for execution when the function exits. It can be used for resource clean-up, for example: +Go 提供语句 `defer` 允许函数退出时调用执行预定的函数。它可以用于资源释放,例如: ``` func myFunc(someFile io.ReadCloser) { defer someFile.close() - /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var Do stuff with file */ + /* 文件相关操作 */ } ``` -It is of course possible to use function literals as the function to call, and any variables can be used as usual when writing the call. +当然,它允许使用匿名函数作为被调函数,而且编写被调函数时可以像平常一样使用任何变量。 ### 错误处理 From d8a6131b85df1438763b5fdeae048e446d3b693c Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 24 Jan 2019 19:33:57 +0800 Subject: [PATCH 0738/4278] hankchow translating --- sources/tech/20181212 Top 5 configuration management tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181212 Top 5 configuration management tools.md b/sources/tech/20181212 Top 5 configuration management tools.md index 72aebb209a..f7e59bcf08 100644 --- a/sources/tech/20181212 Top 5 configuration management tools.md +++ b/sources/tech/20181212 Top 5 configuration management tools.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f25816fbac658831b6a6bd4b2eed807123184d38 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 Jan 2019 19:42:39 +0800 Subject: [PATCH 0739/4278] PRF:20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @Auk7F7 --- ...Check Vulnerable Packages In Arch Linux.md | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md index 2580b53a3d..325cadf36c 100644 --- a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md +++ b/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -1,58 +1,52 @@ [#]: collector: "lujun9972" -[#]: translator: " " -[#]: reviewer: " " +[#]: translator: "Auk7F7" +[#]: reviewer: "wxy" [#]: publisher: " " [#]: subject: "Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux" [#]: via: "https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/" [#]: author: "Prakash Subramanian https://www.2daygeek.com/author/prakash/" [#]: url: " " -Arch-Audit : 一款在 Arch Linux 上检查易受攻击包的工具 +Arch-Audit:一款在 Arch Linux 上检查易受攻击的软件包的工具 ====== -我们必须经常更新我们的系统以减少宕机时间和问题。 +我们必须经常更新我们的系统以减少宕机时间和问题。每月给系统打一次补丁,60 天一次或者最多 90 天一次,这是 Linux 管理员的例行任务之一。这是忙碌的工作计划,我们不能在不到一个月内做到这一点,因为它涉及到多种活动和环境。 -每月给系统打一次补丁,60天一次或者最多90天一次,这是 Linux 管理员的例行任务之一。 +基本上,基础设施会一同提供测试、开发、 QA 环境(即各个分段和产品)。 -这将是忙碌的工作计划,我们不能在不到一个月内做到这一点,因为它涉及到多种活动和环境。 +最初,我们会在测试环境中部署补丁,相应的团队将监视系统一周,然后他们将给出一份或好或坏的状态的报告。如果成功的话,我们将会在其他环境中继续测试,若正常运行,那么最后我们会给生产服务器打上补丁。 -基本上,基础架构与测试、开发、 QA (即分段和产品开发环境)一起提供。 +许多组织会对整个系统打上补丁,我的意思是全系统更新,对于典型基础设施这是一种常规修补计划。 -最初,我们会在测试环境中部署补丁,相应的团队将监视系统一周,然后他们将给出一份比如好的或坏的状态报告。 +某些基础设施中可能只有生产环境,因此,我们不应该做全系统更新,而是应该使用安全修补程序来使系统更加稳定和安全。 -如果它是成功的话,我们将会在其他环境中继续测试,若正常运行,那么最后我们会给生产服务器打上补丁。 +由于 Arch Linux 及其衍生的发行版属于滚动更新版本,因此可以认为它们始终是最新的,因为它使用上游软件包的最新版本。 -许多组织已经准备好给整个系统打上补丁。我的意思是全部系统的更新,这是一种对于基础设施的常规修补计划。 - -在一些基础结构中,他们可能只有生产环境,因此,我们不应该为完整的系统更新做好准备,而是可以使用安全修补程序来使系统更加稳定和安全。 - -由于 Arch Linux 及其衍发行版本属于滚动更新版本,因此可以认为他们始终是最新的,因为它使用上游软件包的最新版本。 - -在某些情况下,如果要单独更新安全修补程序 ,则必须使用 arch-audit 工具来标识和修复安全修补程序。 +在某些情况下,如果要单独更新安全修补程序,则必须使用 arch-audit 工具来标识和修复安全修补程序。 ### 漏洞是什么? 漏洞是软件程序或硬件组件(固件)中的安全漏洞。这是一个可以让它容易受到攻击的缺陷。 -为了缓解这种情况,我们需要相应地修补,就像应用程序/硬件一样,它可能是代码更改或配置更改或参数更改。 +为了缓解这种情况,我们需要相应地修补漏洞,就像应用程序/硬件一样,它可能是代码更改或配置更改或参数更改。 -### Arch-Audit 工具是什么? +### Arch-Audit 工具是什么? -[Arch-audit][1] 是一个类似于 Arch Linux 的 pkg-audit 工具。它使用了令人称赞的 Arch 安全小组收集的数据。他不会扫描并发现系统中易受攻击的包,如 **yum –security check-update & yum updateinfo list available**,它只需解析 页面并在终端中显示结果,因此,它将显示准确的数据。 +[Arch-audit][1] 是一个类似于 Arch Linux 的 pkg-audit 工具。它使用了令人称赞的 Arch 安全小组收集的数据。它不会扫描以发现系统中易受攻击的包(就像 `yum –security check-update & yum updateinfo` 一样列出可用的软件包),它只需解析 页面并在终端中显示结果,因此,它将显示准确的数据。(LCTT 译注:此处原作者叙述不清晰。该功能虽然不会像病毒扫描软件一样扫描系统上的文件,但是会读取已安装的软件列表,并据此查询上述网址列出风险报告。) -Arch 安全小组是一群以跟踪 Arch Linux 软件包的安全问题为目的的志愿者。所有问题都在 Arch 安全追踪者的监视下。. +Arch 安全小组是一群以跟踪 Arch Linux 软件包的安全问题为目的的志愿者。所有问题都在 Arch 安全追踪者的监视下。 该小组以前被称为 Arch CVE 监测小组,Arch 安全小组的使命是为提高 Arch Linux 的安全性做出贡献。 -### 如何在 Arch Linux 上安装 Arch-Audit 工具 +### 如何在 Arch Linux 上安装 Arch-Audit 工具 -arch-audit 工具已经存在社区源中,所以你可以使用 Pacman 包管理器来安装它。 +Arch-audit 工具已经存在社区的仓库中,所以你可以使用 Pacman 包管理器来安装它。 ``` $ sudo pacman -S arch-audit ``` -运行 `arch-audit` 工具以查找在基于 Arch 的发行版本上的开放且易受攻击的包。 +运行 `arch-audit` 工具以查找在基于 Arch 的发行版本上的存在缺陷的包。 ``` $ arch-audit @@ -96,7 +90,7 @@ systemd>=239.300-1 webkit2gtk>=2.22.4-1 ``` -为了交叉检查上述结果,我将测试在 列出的一个包以确认漏洞是否仍处于开放状态或已修复。是的,它已经被修复了,并于昨天在社区源中发布了更新后的包。 +为了交叉检查上述结果,我将测试在 列出的一个包以确认漏洞是否仍处于开放状态或已修复。是的,它已经被修复了,并于昨天在社区仓库中发布了更新后的包。 ![][3] @@ -117,7 +111,7 @@ via: https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in- 作者:[Prakash Subramanian][a] 选题:[lujun9972][b] 译者:[Auk7F7](https://github.com/Auk7F7) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0f1ac135c8b34bc523d091d1dd8c746c10fdd49c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 Jan 2019 19:43:28 +0800 Subject: [PATCH 0740/4278] PUB:20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @Auk7F7 https://linux.cn/article-10473-1.html --- ...dit - A Tool To Check Vulnerable Packages In Arch Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md (98%) diff --git a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md similarity index 98% rename from translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md rename to published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md index 325cadf36c..e31694679f 100644 --- a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md +++ b/published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -1,11 +1,11 @@ [#]: collector: "lujun9972" [#]: translator: "Auk7F7" [#]: reviewer: "wxy" -[#]: publisher: " " +[#]: publisher: "wxy" [#]: subject: "Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux" [#]: via: "https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/" [#]: author: "Prakash Subramanian https://www.2daygeek.com/author/prakash/" -[#]: url: " " +[#]: url: "https://linux.cn/article-10473-1.html" Arch-Audit:一款在 Arch Linux 上检查易受攻击的软件包的工具 ====== From 27cdebd9fdf3a92c74f54cef4c6a9358fbb97aca Mon Sep 17 00:00:00 2001 From: jrg Date: Thu, 24 Jan 2019 20:32:06 +0800 Subject: [PATCH 0741/4278] =?UTF-8?q?[=E7=BF=BB=E8=AF=91=E4=B8=AD]by=20jrg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [翻译中]by jrg --- .../tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md index b7e55e0efb..3d6d94cabf 100644 --- a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md +++ b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (jrglinux) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cececf2aae14e6253d837563b98aa0c90a982265 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 Jan 2019 20:43:28 +0800 Subject: [PATCH 0742/4278] PRF:20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @geekpi --- ... Linux terminal with this Pac-man clone.md | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md index 121f29e248..9401fcf095 100644 --- a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -1,24 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) [#]: via: (https://opensource.com/article/18/12/linux-toy-myman) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -用这个吃豆人克隆在你的终端中玩街机 +用这个吃豆人游戏在你的终端中玩街机 ====== -想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 + +> 想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) -欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 +欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你会问什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 有些是新的,有些是古老的经典。我们希望你喜欢。 -今天的玩具,MyMan,是经典街机游戏[吃豆人][1](你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 +今天的玩具,MyMan,是经典街机游戏[吃豆人][1]Pac-Man(你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 -MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版已打包,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 +MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版打包了,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 由于 MyMan 已为 Fedora 打包,因此安装非常简单: @@ -27,6 +29,7 @@ $ dnf install myman ``` MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码。 + ![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -35,11 +38,14 @@ MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码 -------------------------------------------------------------------------------- via: https://opensource.com/article/18/12/linux-toy-myman + 作者:[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/) 荣誉推出 + [a]: https://opensource.com/users/jason-baker [b]: https://github.com/lujun9972 [1]: https://en.wikipedia.org/wiki/Pac-Man From 39c38f72e4b72a6ff7beb1e1f925d7fd76067311 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 Jan 2019 20:44:16 +0800 Subject: [PATCH 0743/4278] PUB:20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @geekpi https://linux.cn/article-10474-1.html --- ...e arcade in your Linux terminal with this Pac-man clone.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md (97%) diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md similarity index 97% rename from translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md rename to published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md index 9401fcf095..f7e411d88a 100644 --- a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ b/published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10474-1.html) [#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) [#]: via: (https://opensource.com/article/18/12/linux-toy-myman) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 6d6576dca49d3b609d71be3a716687d727b04dda Mon Sep 17 00:00:00 2001 From: yuqi Date: Thu, 24 Jan 2019 20:58:44 +0800 Subject: [PATCH 0744/4278] translation completed --- ...Years With Emacs as a CEO (and now CTO).md | 86 ------------------ ...Years With Emacs as a CEO (and now CTO).md | 87 +++++++++++++++++++ 2 files changed, 87 insertions(+), 86 deletions(-) delete mode 100644 sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md create mode 100644 translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md diff --git a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md deleted file mode 100644 index b144fe4201..0000000000 --- a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (oneforalone) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: 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) - -Two Years With Emacs as a CEO (and now CTO) -====== - -Two years ago, I wrote [a blog post][1] that got some notice, which surprised me. It was a piece about going back to Emacs as my primary content creation tool, first as a CEO, and now as a CTO. A brief recap is that I spent most of my career as a programmer and a software architect, and preferred Emacs as my code editor for much of that time. Reconsidering Emacs was an experiment that I was excited about, but wasn't sure how it would work out. On the Internet, the post was met with roughly equal parts disdain and appreciation, but tens of thousands of people read it, so it seems that I touched on something interesting. Some of the more challenging and funny posts on [Reddit][2] and [HackerNews][3] predicted that I'd have hands shaped like claws or that I'd have lost my eyesight because I use white backgrounds. I'm pleased to report that no dire consequences resulted, and in fact my wrists are thanking me for the decision. Some folks worried that using Emacs would be a cognitive drain on a CEO. Having taken Fugue from an idea in my backyard to a powerful product with great and enthusiastic customers, I find Emacs to be a solace from things that are actually difficult. I still use white backgrounds. - -Recently, the post was rediscovered and posted to [HackerNews][4]. I got a number of requests to follow up with a post on how things have gone since, so this is that report. In this post, I will also focus on why Emacs and functional programming are highly relevant now; and how Emacs works with our product, Fugue, that uses functional programming to automate cloud computing. I received a lot of feedback that the level of detail and color commentary were useful, so this post is also fairly verbose and I do spend some effort on explaining my thinking. I've recently moved from the CEO to CTO role here at Fugue, but the content of this post reflects the work I have been doing as CEO. I expect to do more work in code with Emacs going forward, so I have some yak shaving ahead. As always, YMMV, caveat emptor, etc. - -### It worked out better than I suspected it would - -My time is filled with nearly constant communication outside of and within the company. Communication is how things get done in the world, and the enemy of reflection and real contemplation of difficult or complex problems. The rarest commodity for me as a startup CEO is time to focus without distraction. Emacs is particularly good for this, once you've invested the time to learn a handful of commands. Other applications call out to be noticed, but a well configured Emacs gets out of the way both visually and mentally. It doesn't change unless you want it to, and there is no cleaner interface than a blank screen and beautiful typography. In my world of constant interruption, this simplicity allows me to focus solely on what I am thinking rather than the computer. The best programs provide access to the computer without demanding attention. - -A few folks pointed out that the original post was as much a criticism of modern computer interfaces as a recommendation of Emacs. I agree and disagree. Modern interfaces, and particularly their application-centric approach (vs. content-centric), are not user focused or task oriented. Emacs avoids this fallacy, which is part of why I like it so much, but it brings other merits to the table as well. Emacs is a portal into the power of the computer itself, and that is a rabbit hole worth descending. Its idioms are paths to discovering and creating your own, and that for me is the definition of creativity. One of the sad things about modern computing is that it is largely made up of black boxes with shiny interfaces that provide momentary gratification rather than real satisfaction. This makes us into consumers rather than creators/makers of technology. I don't care who you are or what your background is; you can understand your computer, and you can make things with it. It's fun, satisfying, and not as hard as you think to get started! - -We often underappreciate the effects of our environments on our psychology. Emacs imparts a feeling of calm and freedom, rather than of urgency, annoyance, or excitement - the latter of which are enemies of thought and contemplation. I like things that last, get out of the way, and provide insight when I do take the time to pay attention to them. Emacs meets all these criteria for me. I use Emacs every day for content creation, and I'm very pleased with how little I think about it. Emacs does have a learning curve, but it's no steeper than a bicycle, and has a similar payoff in that once you are through it, you don't have to think about it anymore, and it imparts a feeling of freedom that other tools don't. It's an elegant tool, from a more civilized age. I'm happy that we seem to be entering another civilized age in computing, and so Emacs is gaining in popularity. - -### I gave up on using Org-mode for schedules and to-do lists - -I spent some words in the original post on using Org-mode for schedules. I gave up on using Org-mode for to dos and the like, as I have to coordinate many meetings and calls every day with dozens of people, and I cannot ask the rest of the world to adapt to my choice of tools, nor do I have the time to transcribe or automate moving things to Org. We are primarily a Mac shop, use Google Calendar etc., and the native Mac OS/iOS tools do a good job for collaboration. I also use a plain old pen for note-taking during meetings, as I find laptop/keyboard use in meetings to be rude and limiting to my ability to listen and think. Therefore I've largely abandoned the idea that Emacs/org can help me with my schedule or organizing my life. Org-mode is great for lots of other things too though, and is my go-to for writing documents, including this one. In other words, I use it largely in ways the author didn't intend, and it's great at them. I hope someone says the same of our work at Fugue someday. - -### Emacs use has spread at Fugue - -I started the original post with an admonition that you may love Emacs, but will probably hate it. I was therefore a little concerned when the documentation team at Fugue picked it as their standard tool, as I thought perhaps they were influenced by my appreciation for it. A couple years later, I'm pretty sure that it was a good call for them. The leader of the team at the time was a very bright programmer, but the two writers we hired to make the Fugue documentation had less technical backgrounds. I figured that if it was a case of a manager imposing the wrong tool, I'd hear about it and it would resolve itself, as Fugue has an anti-authoritarian culture where people are unafraid to call bullshit on anything or anyone, including me. The original manager left Fugue last year, but the docs team now has a slick, integrated CI/CD toolchain for [docs.fugue.co][5], and they've become enthusiastic Emacs users. There is a learning curve for Emacs, but it's not that tall even if it is steep, and climbing it has real benefits in productivity and general happiness. It was also a reminder that liberal arts focused people are every bit as smart and capable with technology as programmers, and perhaps less prone to technology religions and tribalism. - -### My wrists are thanking me - -I've been spending 12 hours a day or so at a computer since the mid-eighties, and it has taken a toll on my wrists (as well as my back, for which I unreservedly recommend the Tag Capisco chair). The combination of Emacs and an ergonomic keyboard has made the RSI wrist issues go away to the point that I haven't thought about it in over a year. Prior to that, I was having daily pain, particularly in my right wrist, and if you've had this issue, you know it can be very distracting and worrying. A few folks asked about keyboards and mice, so if you're interested I'm currently using a [keyboard.io][6] though I've mainly used a Truly Ergonomic keyboard over the last couple years. I'm a few weeks into using the keyboard.io, and I absolutely love it. The shaped key caps are amazing for knowing where you are without looking, and the thumb keys seem obvious in retrospect, particularly for Emacs, where Control and Meta are your constant companions. No more using the pinkie for highly repetitive tasks! - -The amount of mousing I do is much lower than when using Office and IDEs, and that has helped a lot, but I do still need a mouse. I've been using the rather dated looking but highly functional and ergonomic Clearly Superior trackball, which lives up to its name. - -Specific tools aside, the main point is that a great keyboard combined with mouse avoidance has proved very effective at reducing wear and tear on my body. Emacs is central to this because I don't have to mouse around menus to get things done, and the navigation keys are right under my fingers. I'm pretty convinced now that hand movement away from the standard typing position causes a lot of tendon stress for me. YMMV, I'm not a doctor, etc. - -### I haven't done much to my config... - -Some predicted that I'd spend a lot of time yak shaving my configuration. I wondered if they were right, so I paid attention. Not only have I left my config largely alone, paying attention to the issue has made me realize just how much the other tools I use demand my attention and time. Emacs is easily the lowest maintenance piece of software I use. Mac OS and Windows are constantly demanding that I update them, but that's far less intrusive than Adobe Suite and Office's update intrusions in my world. I do occasionally update my Emacs, but it still works the same way, so it's largely a near zero cost operation for me, and one I can choose to do when I please. - -I'm sorry to disappoint, as a number of folks wanted to know what I've done to keep up with a renewed Emacs community and its output, but I've only added a few things to my config over the last two years. I consider this a success, as Emacs is a tool, not a hobby for me. That said, I'd love to hear about new things if you want to share. - -### ...Except for controlling the cloud - -We have a lot of Emacs fans at Fugue, so we've had a [Ludwig-mode][7] for a while now. Ludwig is our declarative, functional DSL for automating cloud infrastructure and services. Recently, Alex Schoof took some flight and evening hours to build fugue-mode, which acts as an Emacs console over the Fugue CLI. If you aren't familiar with Fugue, we make a cloud automation and governance tool that leverages functional programming to give users a great experience of interacting with cloud APIs. Well, it does a lot more than that, but it does that too. Fugue-mode is cool for a number of reasons. It allows me to have a buffer that is constantly reporting on the status of my cloud infrastructure, and since I often modify that infrastructure, I can quickly see the effects of my coding. Fugue organizes cloud workloads into processes, and Fugue-mode is a lot like top for cloud workloads. It also allows me to perform operations like creating new infrastructure or deleting stuff that isn't needed anymore, without much typing. Fugue-mode is a prototype, but it's pretty handy and I now use it regularly. - -![fugue-mode-edited.gif][8] - -### Modes and monitors - -I have added a few modes and integrations, but not really for work/CEO functions. I've been hacking around in Haskell and Scheme on the weekends for fun, so I've added haskell-mode and geiser. Emacs is great for languages that have a REPL, as you can divide up your screen into different "windows" that are running different modes, including REPLs or shells. Geiser is great for Scheme, and if you've not done so, working through SICP is a joy and possibly a revelation in an age that has lots of examples of cargo cult programming. Install MIT Scheme and geiser and you've got something that feels a bit like the Symbolics environments of lore. - -This brings up another topic I didn't cover in the 2015 post: screen management. I like to use a single portrait mode monitor for writing, and I have this configuration at my home and at my primary office. For programming or mixed use, I like the new ultra-wide monitors that we provide to all Fuguers. For these, I prefer to divide my screen into three columns, with the center having my main editing buffer, the left side having a shell and a fugue-mode buffer divided horizontally, and the right having either a documentation buffer or another editing buffer or two. This is easily done by first using 'Ctl-x 3' twice, then 'Ctl-x =' to make the windows equal in width. This will give you three equal columns that you can further subdivide as you like with 'Ctl-x 2' for horizontal divisions. Here's a screenshot of what this looks like. - -![Emacs Screen Shot][9] - -### This will be my last CEO/Emacs post... - -The first reason for this is that I'm now the CTO of Fugue, but also because there are so many topics I'm looking forward to blogging about and now I should have time to do so. I'm planning on doing some deeper dive posts on topics like functional programming, type safety for infrastructure-as-code, and as we roll out some awesome new Fugue capabilities, some posts on what is achievable on the cloud using Fugue. - --------------------------------------------------------------------------------- - -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) - -本文由 [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 -[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 -[5]: https://docs.fugue.co/ -[6]: https://shop.keyboard.io/ -[7]: https://github.com/fugue/ludwig-mode -[8]: https://www.fugue.co/hubfs/Imported_Blog_Media/fugue-mode-edited-1.gif -[9]: https://www.fugue.co/hs-fs/hubfs/Emacs%20Screen%20Shot.png?width=929&name=Emacs%20Screen%20Shot.png 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 new file mode 100644 index 0000000000..b25721a59b --- /dev/null +++ b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (oneforalone) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) +====== + +两年前,我写了一篇[博客][1],并取得了一些反响。这让我有点受宠若惊。那篇博客写的是我准备将 Emacs 作为我的主办公软件,当时我还是 CEO,现在已经转为 CTO 了。现在回想起来,我发现我之前不是做程序员就是做软件架构师,而且那时我也喜欢用 Emacs 写代码。重新考虑 Emacs 是一次很不错的尝试,但我不太清楚具体该怎么实现。在网上,那篇博客也是褒贬不一,但是还是有数万的阅读量,所以总的来说,我写的还是不错的。在 [Reddit][2] 和 [HackerNews][3] 上有些令人哭笑不得的回复,说我的手会变形,或者说我会因白色的背景而近视。在这里我可以很肯定的回答 —— 完全没有这回事,相反,我的手腕还因此变得更灵活了。还有一些人担心,说使用 Emacs 会耗费一个 CEO 的精力。把 Fugue 从在家得到的想法变成强大的产品,并有一大批忠实的顾客,我觉得 Emacs 可以让你从复杂的事务中解脱出来。我现在还在用白色的背景。 + +近段时间那篇博客又被翻出来了,并发到了 [HackerNews][4] 上。我收到了大量的跟帖者问我现在怎么样了,所以我写这篇博客来回应他们。在本文中,我还将重点讨论为什么 Emacs 和函数式编程有很高的相关性,以及我们是怎样使用 Emacs 来开发我们的产品 —— Fugue,一个使用函数式编程的自动化的云计算平台。由于我收到了很多反馈,比较有用的是一些细节的详细程度和有关背景色的注解,因此这篇博客比较长,而我确实也需要费点精力来解释我的想法,但这篇文章的主要内容还是反映了我担任 CEO 时处理的事务。而我想在之后更频繁地用 Emacs 写代码,所以需要提前做一些准备。一如既往,本文因人而异,后果自负。 + +### 意外之喜 + +我大部分时间都在不断得处理公司内外沟通。交流是解决问题的唯一方法,但也是反思及思考困难或是复杂问题的敌人。对我来说,作为创业公司的 CEO,最需要的是有时间专注工作而不别打扰。一旦开始投入时间来学习一些命令,Emacs 就很适合这种情况。其他的应用弹出提示,但是配置好了的 Emacs 就可以完全的忽略掉,无论是视觉上还是精神上。除非你想修改,否则的话他不会变,而且没有比空白屏幕和漂亮的字体更干净的界面了。在我不断被打扰的情况下,这种简洁让我能够专注于我在想什么,而不是电脑。好的程序能够默默地对电脑的进行访问。 + +一些人指出,原来的帖子既是对现代图形界面的批判,也是对 Emacs 的赞许。我既不赞同,也不否认。现代的接口,特别是那些以应用程序为中心的方法(相对于以内容为中心的方法),既不是以用户为中心的,也不是面向进程的。Emacs 避免了这种错误,这也是我如此喜欢它的部分原因,而它也带来了其他优点。Emacs 是进入计算机本身的入口,这打开了一扇新世界的大门。它的核心是发现和创造属于自己的道路,对我来说这就是创造的定义。现代电脑的悲哀之处在于,它很大程度上是由带有闪亮界面的黑盒组成的,这些黑盒提供的是瞬间的满足感,而不是真正的满足感。这让我们变成了消费者,而不是技术的创造者。我不在乎你是谁或者你的背景是什么;你可以理解你的电脑,你可以用它做东西。它很有趣,令人满意,而且不是你想的那么难学! + +我们常常低估了环境对我们心理的影响。Emacs 给人一种平静和自由的感觉,而不是紧迫感、烦恼或兴奋——后者是思想和沉思的敌人。我喜欢那些持久的,不碍事的东西,当我花时间去关注它们的时候,它们会给我带来真知灼见。Emacs 满足我的所有这些标准。我每天都使用 Emacs 来创建内容,我也很高兴我很少考虑它。Emacs 确实有一个学习曲线,但不会比学自行车更陡,而且一旦你完成了它,你会得到相应的回报,你就不必再去想它了,它赋予你一种其他工具所没有的自由感。这是一个优雅的工具,来自一个更加文明的时代。我很高兴我们步入了另一个计算机时代,而 Emacs 也将越来越受欢迎。 + +### 放弃用 Emacs 规划日程及处理待办事项 + +在原来的文章中,我花了一些时间介绍如何使用 Org 模式来规划日程。我放弃了使用 Org 模式来处理待办事项之类的,因为我每天都有很多会要开,很多电话要打, 而我也不能让其他人来适应我选的工具,我也没有时间将事务转换或是自动移动到 Org 上 。我们主要是用 Mac shop,使用谷歌日历等,原生的 Mac OS/iOS 工具可以很好的进行协作。我还有支比较旧的笔用来在会议中做笔记,因为我发现在会议中使用笔记本电脑或者说键盘很不礼貌,而且这也限制了我的聆听和思考。因此,我基本上放弃了用 Org 帮我规划日程或安排生活的想法。当然,Org 模式对其他的方面也很有用,它是我编写文档的首选,包括本文。换句话说,我与其作者背道而驰,但它在这方面做得很好。我也希望有一天也有人这么说我们在 Fugue 的工作。 + +### Emacs 在 Fugue 已经扩散 + +我在上篇博客就有说,你可能会喜欢 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是你的固定伙伴。不要再用小指做高度重复的任务了! + +我使用鼠标的次数比使用 Office 和 IDE 时要少得多,这对我有很大帮助,但我还是会用鼠标。我一直在使用外观相当过时,但功能和人体工程学明显优越的轨迹球,这是名副其实的。 + +撇开具体的工具不谈,最重要的一点是,事实证明,一个很棒的键盘,再加上避免使用鼠标,在减少身体的磨损方面很有效。Emacs 是这方面的核心,因为我不需要在菜单上滑动鼠标来完成任务,而且导航键就在我的手指下面。我肯定,手离开标准打字姿势会给我的肌腱造成很大的压力。这因人而异,我也不是医生。 + +### 还没完成大部分配置…… + +有人说我会在界面配置上花很多的时间。我想验证下他们说的对不对,所以我留意了下。我不仅让配置基本上不受影响,关注这个问题还让我意识到我使用的其他工具是多么的耗费我的精力和时间。Emacs 是我用过的维护成本最低的软件。Mac OS 和 Windows 一直要求我更新它,但在我我看来,这远没有 Adobe 套件和 Office 的更新的困恼那么大。我只是偶尔更新 Emacs,但也没什么变化,所以对我来说,它基本上是一个接近于零成本的操作,我高兴什么时候跟新就什么时候更新。 + +有一点然你们失望了,因为许多人想知道我为跟上 Emacs 社区的更新及其输出所做的事情,但是在过去的两年中,我只在配置中添加了一些内容。我认为也是成功的,因为 Emacs 只是一个工具,而不是我的爱好。也就是说,如果你想和我分享,我很乐意听到新的东西。 + +### 期望实现控制云端 + +我们在 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 的符号环境。 + +这就引出了我在 15 年的文章中没有提到的另一个话题:屏幕管理。我喜欢使用用竖屏来写作,我在家里和我的主要办公室都有这个配置。对于编程或混合使用,我喜欢 fuguer 提供的新的超宽显示器。对于宽屏,我更喜欢将屏幕分成三列,中间是主编辑缓冲区,左边是水平分隔的 shell 和 fugue 模式缓冲区,右边是文档缓冲区或另一个或两个编辑缓冲区。这个很简单,首先按 'Ctl-x 3' 两次,然后使用 'Ctl-x =' 使窗口的宽度相等。这将提供三个相等的列,你也可以使用 'Ctl-x 2' 进行水平分割。以下是我的截图。 + +![Emacs Screen Shot][9] + +### 最后一篇 CEO/Emacs 文章…… + +首先,我现在是 Fugue 的 CTO,其次我也想要写一些其他方面的博客,而我现在刚好有时间。我还打算写些更深入的东西,比如说函数式编程、基础结构类型安全,以及我们即将推出一些的新功能,还有一些关于 Fugue 在云上可以做什么。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [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 +[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 +[5]: https://docs.fugue.co/ +[6]: https://shop.keyboard.io/ +[7]: https://github.com/fugue/ludwig-mode +[8]: https://www.fugue.co/hubfs/Imported_Blog_Media/fugue-mode-edited-1.gif +[9]: https://www.fugue.co/hs-fs/hubfs/Emacs%20Screen%20Shot.png?width=929&name=Emacs%20Screen%20Shot.png +[10]: https://baike.baidu.com/item/RSI/21509642 From bb1a9914fdb4169cb8ddd931a58bce1487179e97 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Thu, 24 Jan 2019 23:24:56 +0800 Subject: [PATCH 0745/4278] Translating Doe 20180130 tmux... --- ...lexer For Heavy Command-Line Linux User.md | 262 ----------------- ...lexer For Heavy Command-Line Linux User.md | 263 ++++++++++++++++++ 2 files changed, 263 insertions(+), 262 deletions(-) delete mode 100644 sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md create mode 100644 translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md diff --git a/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md deleted file mode 100644 index f519d76fc7..0000000000 --- a/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md +++ /dev/null @@ -1,262 +0,0 @@ -Translating by MjSeven - - -tmux – A Powerful Terminal Multiplexer For Heavy Command-Line Linux User -====== -tmux stands for terminal multiplexer, it allows users to create/enable multiple terminals (vertical & horizontal) in single window, this can be accessed and controlled easily from single window when you are working with different issues. - -It uses a client-server model, which allows you to share sessions between users, also you can attach terminals to a tmux session back. We can easily move or rearrange the virtual console as per the need. Terminal sessions can freely rebound from one virtual console to another. - -tmux depends on libevent and ncurses libraries. tmux offers status-line at the bottom of the screen which display information about your current tmux session suc[]h as current window number, window name, username, hostname, current time, and current date. - -When tmux is started it creates a new session with a single window and displays it on screen. It allows users to create Any number of windows in the same session. - -Many of us says it's similar to screen but i'm not since this offers wide range of configuration options. - -**Make a note:** `Ctrl+b` is the default prefix in tmux so, to perform any action in tumx, you have to type the prefix first then required options. - -**Suggested Read :** [List Of Terminal Emulator For Linux][1] - -### tmux Features - - * Create any number of windows - * Create any number of panes in the single window - * It allows vertical and horizontal splits - * Detach and Re-attach window - * Server-client architecture which allows users to share sessions between users - * tmux offers wide range of configuration hacks - - - -**Suggested Read :** -**(#)** [tmate - Instantly Share Your Terminal Session To Anyone In Seconds][2] -**(#)** [Teleconsole - A Tool To Share Your Terminal Session Instantly To Anyone In Seconds][3] - -### How to Install tmux Command - -tmux command is pre-installed by default in most of the Linux systems. If no, follow the below procedure to get installed. - -For **`Debian/Ubuntu`** , use [APT-GET Command][4] or [APT Command][5] to install tmux. -``` -$ sudo apt install tmux - -``` - -For **`RHEL/CentOS`** , use [YUM Command][6] to install tmux. -``` -$ sudo yum install tmux - -``` - -For **`Fedora`** , use [DNF Command][7] to install tmux. -``` -$ sudo dnf install tmux - -``` - -For **`Arch Linux`** , use [Pacman Command][8] to install tmux. -``` -$ sudo pacman -S tmux - -``` - -For **`openSUSE`** , use [Zypper Command][9] to install tmux. -``` -$ sudo zypper in tmux - -``` - -### How to Use tmux - -kick start the tmux session by running following command on terminal. When tmux is started it creates a new session with a single window and will automatically login to your default shell with your user account. -``` -$ tmux - -``` - -[![][10]![][10]][11] - -You will get similar to above screenshot like us. tmux comes with status bar which display an information's about current sessions details, date, time, etc.,. - -The status bar information's are below: - - * **`0 :`** It is indicating the session number which was created by the tmux server. By default it starts with 0. - * **`0:username@host: :`** 0 is indicating the session number. Username and Hostname which is holding the current window. - * **`~ :`** It is indicating the current directory (We are in the Home directory) - * **`* :`** This indicate that the window is active now. - * **`Hostname :`** This shows fully qualified hostname of the server - * **`Date& Time:`** It shows current date and time - - - -### How to Split Window - -tmux allows users to split window vertically and horizontally. Let 's see how to do that. - -Press `**(Ctrl+b), %**` to split the pane vertically. -[![][10]![][10]][13] - -Press `**(Ctrl+b), "**` to split the pane horizontally. -[![][10]![][10]][14] - -### How to Move Between Panes - -Lets say, we have created few panes and want to move between them. How to do that? If you don 't know how to do, then there is no purpose to use tmux. Use the following control keys to perform the actions. There are many ways to move between panes. - -Press `(Ctrl+b), Left arrow` - To Move Left - -Press `(Ctrl+b), Right arrow` - To Move Right - -Press `(Ctrl+b), Up arrow` - To Move Up - -Press `(Ctrl+b), Down arrow` - To Move Down - -Press `(Ctrl+b), {` - To Move Left - -Press `(Ctrl+b), }` - To Move Right - -Press `(Ctrl+b), o` - Switch to next pane (left-to-right, top-down) - -Press `(Ctrl+b), ;` - Move to the previously active pane. - -For testing purpose, we are going to move between panes. Now, we are in the `pane2` which shows `lsb_release -a` command output. -[![][10]![][10]][15] - -And we are going to move to `pane0` which shows `uname -a` command output. -[![][10]![][10]][16] - -### How to Open/Create New Window - -You can open any number of windows within one terminal. Terminal window can be split vertically & horizontally which is called `panes`. Each pane will contain its own, independently running terminal instance. - -Press `(Ctrl+b), c` to create a new window. - -Press `(Ctrl+b), n` move to the next window. - -Press `(Ctrl+b), p` to move to the previous window. - -Press `(Ctrl+b), (0-9)` to immediately move to a specific window. - -Press `(Ctrl+b), l` Move to the previously selected window. - -I have two windows, first window has three panes which contains operating system distribution information, top command output & kernal information. -[![][10]![][10]][17] - -And second window has two panes which contains Linux distributions logo information. Use the following commands perform the action. -[![][10]![][10]][18] - -Press `(Ctrl+b), w` Choose the current window interactively. -[![][10]![][10]][19] - -### How to Zoom Panes - -You are working in some pane which is very small and you want to zoom it out for further work. To do use the following key binds. - -Currently we have three panes and i'm working in `pane1` which shows system activity using **Top** command and am going to zoom that. -[![][10]![][10]][17] - -When you zoom a pane, it will hide all other panes and display only the zoomed pane in the window. -[![][10]![][10]][20] - -Press `(Ctrl+b), z` to zoom the pane and press it again, to bring the zoomed pane back. - -### Display Pane Information - -To know about pane number and it's size, run the following command. - -Press `(Ctrl+b), q` to briefly display pane indexes. -[![][10]![][10]][21] - -### Display Window Information - -To know about window number, layout size, number of panes associated with the window and it's size, etc., run the following command. - -Just run `tmux list-windows` to view window information. -[![][10]![][10]][22] - -### How to Resize Panes - -You may want to resize the panes to fit your requirement. You have to press `(Ctrl+b), :` then type the following details on the `yellow` color bar in the bottom of the page. -[![][10]![][10]][23] - -In the previous section we have print pane index which shows panes size as well. To test this we are going to increase `10 cells UPward`. See the following output that has increased the pane1 & pane2 size from `55x21` to `55x31`. -[![][10]![][10]][24] - -**Syntax:** `(Ctrl+b), :` then type `resize-pane [options] [cells size]` - -`(Ctrl+b), :` then type `resize-pane -D 10` to resize the current pane Down for 10 cells. - -`(Ctrl+b), :` then type `resize-pane -U 10` to resize the current pane UPward for 10 cells. - -`(Ctrl+b), :` then type `resize-pane -L 10` to resize the current pane Left for 10 cells. - -`(Ctrl+b), :` then type `resize-pane -R 10` to resize the current pane Right for 10 cells. - -### Detaching and Re-attaching tmux Session - -One of the most powerful features of tmux is the ability to detach and reattach session whenever you need. - -Run a long running process and press `Ctrl+b` followed by `d` to detach your tmux session safely by leaving the running process. - -**Suggested Read :** [How To Keep A Process/Command Running After Disconnecting SSH Session][25] - -Now, run a long running process. For demonstration purpose, we are going to move this server backup to another remote server for disaster recovery (DR) purpose. - -You will get similar output like below after detached tmux session. -``` -[detached (from session 0)] - -``` - -Run the following command to list the available tmux sessions. -``` -$ tmux ls -0: 3 windows (created Tue Jan 30 06:17:47 2018) [109x45] - -``` - -Now, re-attach the tmux session using an appropriate session ID as follow. -``` -$ tmux attach -t 0 - -``` - -### How to Close Panes & Window - -Just type `exit` or hit `Ctrl-d` in the corresponding pane to close it. It's similar to terminal close. To close window, press `(Ctrl+b), &`. - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for-linux/ - -作者:[Magesh Maruthamuthu][a] -译者:[译者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/ -[1]:https://www.2daygeek.com/category/terminal-emulator/ -[2]:https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds/ -[3]:https://www.2daygeek.com/teleconsole-share-terminal-session-instantly-to-anyone-in-seconds/ -[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/yum-command-examples-manage-packages-rhel-centos-systems/ -[7]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ -[8]:https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ -[9]:https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ -[10]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[11]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-1.png -[13]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-2.png -[14]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-3.png -[15]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-4.png -[16]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-5.png -[17]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-8.png -[18]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-6.png -[19]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-7.png -[20]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-9.png -[21]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-10.png -[22]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-14.png -[23]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-11.png -[24]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-13.png -[25]:https://www.2daygeek.com/how-to-keep-a-process-command-running-after-disconnecting-ssh-session/ diff --git a/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md new file mode 100644 index 0000000000..dab7489ba4 --- /dev/null +++ b/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md @@ -0,0 +1,263 @@ +tmux - 适用于重度命令行 Linux 用户的强大终端复用器 +====== + +tmux 是终端复用的缩写,它允许用户在单个窗口中创建或启用多个终端(垂直或水平),当你处理不同的问题时,可以在单个窗口中轻松访问和控制。 + +它使用客户端-服务器模型,允许用户之间共享会话,也可以将终端连接到 tmux 会话。我们可以根据需要轻松移动或重新排列虚拟控制台。终端会话可以从一个虚拟控制台自由切换到另一个。 + + +tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一个状态行,它显示当前 tmux 会话的有关信息,例如当前窗口编号,窗口名称,用户名,主机名,当前时间和日期。 + +启动 tmux 时,它会在一个单独窗口上创建一个新的会话,并将其显示在屏幕上。它允许用户在同一个会话中创建任意数量的窗口。 + +许多人说它相当于一块屏幕,但我不这么认为,因为它提供了许多配置选项。 + +**注意:** `Ctrl+b` 是 tmux 中的默认前缀,因此,要在 tmux 中执行任何操作,你必须先输入前缀然后输入所需的选项。 + +**建议阅读:** [适用于 Linux 的终端仿真器列表][1] + +### tmux 特性 + + * 创建任意数量的窗口 + * 在一个窗口中创建任意数量的窗格 + * 它允许垂直和水平分割 + * 分离并重新连接窗口 + * 客户端-服务器架构,这允许用户之间共享会话 + * tmux 提供许多配置技巧 + +**建议阅读:** +**(#)** [tmate - 马上与其他人分享你的终端会话][2] +**(#)** [Teleconsole - 一个与其他人分享终端会话的工具][3] + +### 如何安装 tmux 命令 + +大多数 Linux 系统默认预安装 tmux 命令。如果没有,按照以下步骤安装。 + +对于 **`Debian/Ubuntu`**,使用 [APT-GET 命令][4]或 [APT 命令][5]来安装: +``` +$ sudo apt install tmux +``` + +对于 **`RHEL/CentOS`**,使用 [YUM 命令][6]来安装: +``` +$ sudo yum install tmux +``` + +对于 **`Fedora`**,使用 [DNF 命令][7]来安装: +``` +$ sudo dnf install tmux +``` + +对于 **`Arch Linux`**,使用 [Pacman 命令][8]来安装: +``` +$ sudo pacman -S tmux +``` + +对于 **`openSUSE`**,使用 [Zypper 命令][9]来安装: +``` +$ sudo zypper in tmux +``` + +### 如何使用 tmux + +在终端上运行以下命令来启动 tmux 会话。启动 tmux 后,它会在一个新窗口中创建新会话,并将使用你的用户账户自动登录到你的默认 shell。 +``` +$ tmux +``` + +![][11] + +你会得到类似于我们上面的截图。tmux 附带状态栏,显示有关当前会话详细信息,日期,时间等。 + +状态栏信息如下: + + * **`0 :`** 它表示由 tmux 服务器创建的会话号。默认情况下,它从 0 开始。 + * **`0:username@host: :`** ) 0 表示会话号。用户名和主机名是当前的使用窗口的人。 + * **`~ :`** 它表示当前目录(我们在家目录中)。 + * **`* :`** 这表示窗口现在处于活动状态。 + * **`Hostname :`** 显示服务器的完全主机名。 + * **`Date& Time:`** 显示当前日期和时间。 + + + ### 如何拆分窗口 + + tmux 允许用户垂直或水平分割窗口。我们来看看如何做到这一点。 + +按下 `**(Ctrl+b), %**` 来垂直分割窗口。 +![][13] + +Press `**(Ctrl+b), "**` 来水平分割窗口。 +![][14] + +### 如何在窗格之间移动 + +假设,我们创建了一些窗格,希望在它们之间移动,这该怎么做?如果你不知道怎么做,那么使用 tmux 就没有意义了。使用以下控制键执行操作。在窗格之间移动有许多方法。 + + +按 `(Ctrl+b), 左箭头` - 来向左移动 + +按 `(Ctrl+b), 右箭头` - 来向右移动 + +按 `(Ctrl+b), 上箭头` - 来向上移动 + +按 `(Ctrl+b), 下箭头` - 来向下移动 + +按 `(Ctrl+b), {` - 来向左移动 + +按 `(Ctrl+b), }` - 来向右移动 + +按 `(Ctrl+b), o` - 切换到下一个窗格(从左到右,从上到下) + +按 `(Ctrl+b), ;` - 移动到先前活动的窗格 + +出于测试目的,我们将在窗格之间移动。现在我们在 `pane2` 中,它 `lsb_release -a` 命令的输出。 + +![][15] + +我们将移动到 `pane0`,它显示 `uname -a` 命令的输出。 + +![][16] + +### 如何打开/创建新窗口 + +你可以在一个终端内打开任意数量的窗口。终端窗口可以垂直和水平分割,称为 `panes`。每个窗格都包含自己独立运行的终端实例。 + +按 `(Ctrl+b), c` 来创建一个新窗口。 + +按 `(Ctrl+b), n` 移动到下一个窗口 + +按 `(Ctrl+b), p` 移动到上一个窗口。 + +按 `(Ctrl+b), (0-9)` 立即移动到特定窗口。 + +按 `(Ctrl+b), l` 移动到先前选择的窗口。 + +我有两个窗口,第一个窗口有三个窗格,其中包含操作系统版本信息,top 命令输出和内核信息。 +![][17] + +第二个窗口有两个窗格,其中包含 Linux 发行版 logo 信息。使用以下命令执行操作: +![][18] + +按 `(Ctrl+b), w` 以交互方式选择当前窗口。 + +![][19] + +### 如何缩放窗格 + +你正在一些非常小的窗格中工作,并且你希望将其缩小以进行进一步的工作。要做到这一点,使用以下键绑定。 + +目前我们有三个窗格,我在 `pane1` 工作,它使用 **Top** 命令显示系统活动信息,我将缩放它。 +![][17] + +缩放窗格时,它将隐藏所有其它窗格,并只显示窗口中的缩放窗格。 + +![][20] + +按 `(Ctrl+b), z` 缩放窗格并再次按下它,使缩放窗格恢复原状。 + +### 显示窗格信息 + +要了解窗格编号及其大小,运行以下命令。 + +按 `(Ctrl+b), q` 可简单显示窗格索引。 +![][21] + +### 显示窗口信息 + +要知道窗口编号,布局大小,与窗口关联的窗格数量及其大小等,运行以下命令。 + +只需运行 `tmux list-windows` 即可查看窗口信息。 +![][22] + +### 如何调整窗格大小 + +你可能需要调整窗格大小来满足你的要求。你必须按下 `(Ctrl+b), :`,然后在页面底部的 `黄色(yellow)` 颜色条上输入以下详细信息。 +![][23] + +在上一部分中,我们有打印了窗格索引,它同时也显示了窗格大小。为了测试,我们要向上增加 `10` 个单元。参考以下输出,该窗格将 pane1 和 pane2 的大小从 `55x21` 增加到 `55x31`。 +![][24] + +**语法:** `(Ctrl+b), :` 然后输入 `resize-pane [options] [cells size]` + +`(Ctrl+b), :` 然后输入 `resize-pane -D 10` 将当前窗格大小向下调整 10 个单元。 + +`(Ctrl+b), :` 然后输入 `resize-pane -U 10` 将当前窗格大小向上调整 10 个单元。 + +`(Ctrl+b), :` 然后输入 `resize-pane -L 10` 将当前窗格大小向左调整 10 个单元。 + +`(Ctrl+b), :` 然后输入 `resize-pane -R 10` 将当前窗格大小向右调整 10 个单元。 + +### 分离并重新连接 tmux 会话 + +tmux 最强大的功能之一是能够在需要时分离和重新连接会话。 + +运行一个长时间运行的进程,然后按下 `Ctrl+b`,接着按 `d`,通过离开正在运行的进程安全地分离你的 tmux 会话。 + +**建议阅读:** [如何在断开 SSH 会话后保持进程/命令继续运行][25] + +现在,运行一个长时间运行的进程。出于演示目的,我们将把此服务器备份移动到另一个远程服务器以进行灾难恢复(DR)。 + +``` +$ rsync -avzhe ssh /backup root@192.168.0.161:/backups/week-1/ +``` + +在分离 tmux 会话之后,你将获得类似下面的输出。 + +``` +[detached (from session 0)] +``` + +运行以下命令以列出可用的 tmux 会话。 +``` +$ tmux ls +0: 3 windows (created Tue Jan 30 06:17:47 2018) [109x45] +``` + +现在,使用适当的会话 ID 重新连接 tmux 会话,如下所示: +``` +$ tmux attach -t 0 +``` + +### 如何关闭窗格和窗口 + +只需在相应的窗格中输入 `exit` 或按下 `Ctrl-d` 即可关闭它,和终端关闭类似。要关闭窗口,按下 `(Ctrl+b), &`。 + +好了,就到这里了,希望你喜欢上它。 +(to 校正:这句话是加的,感觉它结尾很突然,可以删掉。) + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for-linux/ + +作者:[Magesh Maruthamuthu][a] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.2daygeek.com/author/magesh/ +[1]:https://www.2daygeek.com/category/terminal-emulator/ +[2]:https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds/ +[3]:https://www.2daygeek.com/teleconsole-share-terminal-session-instantly-to-anyone-in-seconds/ +[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/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[8]:https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[9]:https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[10]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[11]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-1.png +[13]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-2.png +[14]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-3.png +[15]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-4.png +[16]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-5.png +[17]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-8.png +[18]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-6.png +[19]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-7.png +[20]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-9.png +[21]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-10.png +[22]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-14.png +[23]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-11.png +[24]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-13.png +[25]:https://www.2daygeek.com/how-to-keep-a-process-command-running-after-disconnecting-ssh-session/ From 986c917cd768fd42daf2e6f6788745829a0013d2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 00:16:50 +0800 Subject: [PATCH 0746/4278] PRF:20180919 5 ways DevSecOps changes security.md @hopefully2333 --- ...80919 5 ways DevSecOps changes security.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/translated/talk/20180919 5 ways DevSecOps changes security.md b/translated/talk/20180919 5 ways DevSecOps changes security.md index 92f295ed04..cfa0bb07e4 100644 --- a/translated/talk/20180919 5 ways DevSecOps changes security.md +++ b/translated/talk/20180919 5 ways DevSecOps changes security.md @@ -1,40 +1,42 @@ -五种 DevSecOps 提升安全性 +DevSecOps 提升安全性的五种方式 ====== +> 安全必须进化以跟上当今的应用开发和部署方式。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum) -对于我们是否需要扩展 DevOps 以确实提升安全性,我们一直都有争议。毕竟,我们的想法是,DevOps 一直是一系列的新实践的简写,使用新工具(通常是开源的)并且在这之上构建更多的协作文化。为什么 DevBizOps 不能更好地满足商业的需求?或者说 DevChatOps 强调的是更快更好的沟通? +对于我们是否需要扩展 DevOps 以确实提升安全性,我们一直都有争议。毕竟,我们认为,DevOps 一直是一系列的新实践的简写,使用新工具(通常是开源的)并且在这之上构建更多的协作文化。为什么 [DevBizOps][3] 不能更好地满足商业的需求?或者说 DevChatOps 强调的是更快更好的沟通? -在今年(译者注:此处是2018年)的早些时候写的关于他理解的 DevSecOps 术语,“我希望,有一天在世界范围内,我们能不再使用 DevSecOps 这个词,安全会是所有的服务交付讨论中理所应当的部分。直到那一天到来为止,在这一点上,我的一般性结论是,这个词只有三个新的特性。更重要的是,我们作为一个产业,在信息安全方面并没有做的很好,而这个名称切实地区分出了问题的状况” +然而,如 [John Willis][4] 在今年(LCTT 译注:此处是 2018 年)的早些时候写的关于他对 [DevSecOps][5] 术语的理解,“我希望,有一天我们能在任何地方都不再使用 DevSecOps 这个词,安全会是所有关于服务交付的讨论中理所应当的部分。在那一天到来前,在这一点上,我的一般性结论是,这个词只是三个新的特性而已。更重要的是,我们作为一个产业,在信息安全方面并没有做的很好,而这个名称切实地区分出了问题的状况。” -所以,为什么我们在信息安全方面做的不好,在 DevSecOps 的语境下安全做的好又是什么意思呢? +所以,为什么我们在[信息安全][6]方面做的不好,在 DevSecOps 的语境下安全做的好又是什么意思呢? -我们大概从未做好过信息安全,尽管(也可能是因为)复杂的工业点产品地址拥挤问题。我们仍然可以在这个时代把工作做得足够好,以此来防范威胁,这些威胁主要集中在一个范围内,网络的连接是有限的,而且大多数的用户都是公司的员工,使用的是公司提供的设备。 +尽管(也可能是因为)庞大的复杂行业的单点产品解决了特定方面的问题,但我们可以说是从未做好过信息安全。我们仍然可以在这个时代把工作做得足够好,以此来防范威胁,这些威胁主要集中在一个范围内,网络的连接是受限的,而且大多数的用户都是公司的员工,使用的是公司提供的设备。 -这些年来,这些情况并没有能准确地描述出大多数组织的真实现状。但在现在这个时代,不止引入了 DevSecOps,也同时引入了新的应用架构模型,开发实践,和越来越多的安全威胁,这些一起定义了一个需要更快迭代的新常态。还没有应用得很多的 DevSecOps 在独立改变安全,但是 2018 年的信息安全需要新的方法。 +这些年来,这些情况并没有能准确地描述出大多数组织的真实现状。但在现在这个时代,不止引入了 DevSecOps,也同时引入了新的应用架构模型、开发实践,和越来越多的安全威胁,这些一起定义了一个需要更快迭代的新常态。与其说 DevSecOps 孤立地改变了安全,不如说信息安全公司在 2018 年需要新的方法。 请仔细思考下面这五个领域。 ### 自动化 -大量的自动化通常是 DevOps 的标志,这部分是关于速度的,如果你要快速移动(并且不会打坏东西),你需要有可重复的过程,而且这个过程不需要太多的人工干预。实际上,自动化是 DevOps 最好的切入点之一,甚至是在仍然主要工作在单片机电路程序的组织里也是如此。使用像 Ansible 这样易于使用的工具来自动化地处理相关的配置或者是测试,这是快速开始 DevOps 之路的常用方法。 +大量的自动化通常是 DevOps 的标志,这部分是关于速度的,如果你要快速变化(并且不会造成破坏),你需要有可重复的过程,而且这个过程不需要太多的人工干预。实际上,自动化是 DevOps 最好的切入点之一,甚至是在仍然主要使用老式的独石应用monolithic app的组织里也是如此。使用像 Ansible 这样易于使用的工具来自动化地处理相关的配置或者是测试,这是快速开始 DevOps 之路的常用方法。 -DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过程,而不是在应用的生命周期里进行不定期的检查,甚至是每周、每月的检查。当漏洞被厂商发现并修复的时候,这些漏洞能被快速地应用是很重要的,因为利用这些漏洞的利用程序很快就会被淘汰。 +DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过程,而不是在应用的生命周期里进行不定期的检查,甚至是每周、每月的检查。当漏洞被厂商发现并修复的时候,这些修复能被快速地应用是很重要的,这样对这些漏洞的利用程序很快就会被淘汰。 -### "左转" +### “左移” -在开发流程结束时,传统安全通常被视作一个守门人。检查所有的部分确保没有问题,然后这个应用程序就可以投入生产了。否则,就要再来一次。所以安全团队的声誉并不高。 +在开发流程结束时,传统的安全通常被视作一个守门人。检查所有的部分确保没有问题,然后这个应用程序就可以投入生产了。否则,就要再来一次。安全小组以说“不”而闻名。 -因此,我们想的是,没什么不把安全这个部分提到前面呢(左边是一个典型的从左到右的开发流程图)?安全性可能仍然不行,但在开发的早期进行重构的影响要远远小于开发已经完成并且准备上线时进行重构的影响。 +因此,我们想的是,为什么不把安全这个部分提到前面呢(在一个典型的从左到右的开发流程图的“左边”)?安全团队仍然可以说“不”,但在开发的早期进行重构的影响要远远小于开发已经完成并且准备上线时进行重构的影响。 不过,我不喜欢“左移”这个词,这意味着安全仍然是一个只不过提前进行的一次性工作。在应用程序的整个生命周期里,从供应链到开发,再到测试,直到上线部署,安全都需要进行大量的自动化处理。 ### 管理依赖 -我们在现代应用程序开发过程中看到的一个最大的改变,就是你通常不需要去编写这个程序的大部分代码。使用开源的函数库和框架就是一个明显的例子。但是你也可以从公共的云服务商或其他来源那里获得额外的服务。在许多情况下,这些额外的代码和服务比你给自己写的要好得多。 +我们在现代应用程序开发过程中看到的一个最大的改变,就是你通常不需要去编写这个程序的大部分代码。使用开源的函数库和框架就是一个明显的例子。而且你也可以从公共的云服务商或其他来源那里获得额外的服务。在许多情况下,这些额外的代码和服务比你给自己写的要好得多。 -因此,DevSecOps 需要你把重点放在你的软件供应链上,你是从可信的来源那里获取你的软件的吗?这些软件是最新的吗?它们已经集成到了你为自己的代码使用的安全流程中了吗?对于这些你能使用的代码和 API 你有哪些策略?你为自己的产品代码使用的组件是否有可用的商业支持? +因此,DevSecOps 需要你把重点放在你的[软件供应链][8]上,你是从可信的来源那里获取你的软件的吗?这些软件是最新的吗?它们已经集成到了你为自己的代码所使用的安全流程中了吗?对于这些你能使用的代码和 API 你有哪些策略?你为自己的产品代码使用的组件是否有可用的商业支持? 没有一套标准答案可以应对所有的情况。对于概念验证和大规模的生产,它们可能会有所不同。但是,正如制造业长期存在的情况(DevSecOps 和制造业的发展方面有许多相似之处),供应链的可信是至关重要的。 @@ -42,7 +44,7 @@ DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过 关于贯穿应用程序整个生命周期里所有阶段的自动化的需求,我已经谈过很多了。这里假设我们能看见每个阶段里发生的情况。 -有效的 DevSecOps 需要有效的检测,以便于自动化程序知道要做什么。这个检测分了很多类别。一些长期的和高级别的指标能帮助我们了解整个 DevSecOps 流程是否工作良好。严重威胁级别的警报需要立刻有人进行处理(安全扫描系统已经关闭!)。有一些警报,比如扫描失败,需要进行修复。我们记录了大量的参数来生成日志,以便事后进行分析(随着时间的推移,哪些发生了改变?导致失败的原因是什么?)。 +有效的 DevSecOps 需要有效的检测,以便于自动化程序知道要做什么。这个检测分了很多类别。一些长期的和高级别的指标能帮助我们了解整个 DevSecOps 流程是否工作良好。严重威胁级别的警报需要立刻有人进行处理(安全扫描系统已经关闭!)。有一些警报,比如扫描失败,需要进行修复。我们记录了许多参数的志以便事后进行分析(随着时间的推移,哪些发生了改变?导致失败的原因是什么?)。 ### 分散服务 vs 一体化解决方案 @@ -50,7 +52,7 @@ DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过 这种方法确实带来了一些新的安全挑战,组件之间的交互可能会很复杂,总的攻击面会更大,因为现在应用程序通过网络有了更多的切入点。 -另一方面,这种类型的架构还意味着自动化的安全和监视可以更加精细地查看应用程序的组件,因为它们不再深埋在一整个应用程序之中。 +另一方面,这种类型的架构还意味着自动化的安全和监视可以更加精细地查看应用程序的组件,因为它们不再深埋在一个独石应用程序之中。 不要过多地关注 DevSecOps 这个术语,但要提醒一下,安全正在不断地演变,因为我们编写和部署程序的方式也在不断地演变。 @@ -61,7 +63,7 @@ via: https://opensource.com/article/18/9/devsecops-changes-security 作者:[Gordon Haff][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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 fa86e4185d7bcf361cd66cce8e1fdbcc4d5a8d0e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 00:18:07 +0800 Subject: [PATCH 0747/4278] PUB:20180919 5 ways DevSecOps changes security.md @hopefully2333 https://linux.cn/article-10475-1.html --- .../20180919 5 ways DevSecOps changes security.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180919 5 ways DevSecOps changes security.md (100%) diff --git a/translated/talk/20180919 5 ways DevSecOps changes security.md b/published/20180919 5 ways DevSecOps changes security.md similarity index 100% rename from translated/talk/20180919 5 ways DevSecOps changes security.md rename to published/20180919 5 ways DevSecOps changes security.md From 1b6a04387763bbedeb12d26c2f2aa1943cc6b9ac Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 Jan 2019 08:58:31 +0800 Subject: [PATCH 0748/4278] translated --- ...109 Bash 5.0 Released with New Features.md | 80 ------------------- ...109 Bash 5.0 Released with New Features.md | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 sources/tech/20190109 Bash 5.0 Released with New Features.md create mode 100644 translated/tech/20190109 Bash 5.0 Released with New Features.md diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md deleted file mode 100644 index 17b0c5758a..0000000000 --- a/sources/tech/20190109 Bash 5.0 Released with New Features.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Bash 5.0 Released with New Features) -[#]: via: (https://itsfoss.com/bash-5-release) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Bash 5.0 Released with New Features -====== - -The [mailing list][1] confirmed the release of Bash-5.0 recently. And, it is exciting to know that it comes baked with new features and variable. - -Well, if you’ve been using Bash 4.4.XX, you will definitely love the fifth major release of [Bash][2]. - -The fifth release focuses on new shell variables and a lot of major bug fixes with an overhaul. It also introduces a couple of new features along with some incompatible changes between bash-4.4 and bash-5.0. - -![Bash logo][3] - -### What about the new features? - -The mailing list explains the bug fixed in this new release: - -> This release fixes several outstanding bugs in bash-4.4 and introduces several new features. The most significant bug fixes are an overhaul of how nameref variables resolve and a number of potential out-of-bounds memory errors discovered via fuzzing. There are a number of changes to the expansion of $@ and $* in various contexts where word splitting is not performed to conform to a Posix standard interpretation, and additional changes to resolve corner cases for Posix conformance. - -It also introduces some new features. As per the release note, these are the most notable new features are several new shell variables: - -> The BASH_ARGV0, EPOCHSECONDS, and EPOCHREALTIME. The ‘history’ builtin can remove ranges of history entries and understands negative arguments as offsets from the end of the history list. There is an option to allow local variables to inherit the value of a variable with the same name at a preceding scope. There is a new shell option that, when enabled, causes the shell to attempt to expand associative array subscripts only once (this is an issue when they are used in arithmetic expressions). The ‘globasciiranges‘ shell option is now enabled by default; it can be set to off by default at configuration time. - -### What about the changes between Bash-4.4 and Bash-5.0? - -The update log mentioned about the incompatible changes and the supported readline version history. Here’s what it said: - -> There are a few incompatible changes between bash-4.4 and bash-5.0. The changes to how nameref variables are resolved means that some uses of namerefs will behave differently, though I have tried to minimize the compatibility issues. By default, the shell only sets BASH_ARGC and BASH_ARGV at startup if extended debugging mode is enabled; it was an oversight that it was set unconditionally and caused performance issues when scripts were passed large numbers of arguments. -> -> Bash can be linked against an already-installed Readline library rather than the private version in lib/readline if desired. Only readline-8.0 and later versions are able to provide all of the symbols that bash-5.0 requires; earlier versions of the Readline library will not work correctly. - -I believe some of the features/variables added are very useful. Some of my favorites are: - - * There is a new (disabled by default, undocumented) shell option to enable and disable sending history to syslog at runtime. - * The shell doesn’t automatically set BASH_ARGC and BASH_ARGV at startup unless it’s in debugging mode, as the documentation has always said, but will dynamically create them if a script references them at the top level without having enabled debugging mode. - * The ‘history’ can now delete ranges of history entries using ‘-d start-end’. - * If a non-interactive shell with job control enabled detects that a foreground job died due to SIGINT, it acts as if it received the SIGINT. - * BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment. - - - -To check the complete list of changes and features you should refer to the [Mailing list post][1]. - -### Wrapping Up - -You can check your current Bash version, using this command: - -``` -bash --version -``` - -It’s more likely that you’ll have Bash 4.4 installed. If you want to get the new version, I would advise waiting for your distribution to provide it. - -With Bash-5.0 available, what do you think about it? Are you using any alternative to bash? If so, would this update change your mind? - -Let us know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/bash-5-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://lists.gnu.org/archive/html/bug-bash/2019-01/msg00063.html -[2]: https://www.gnu.org/software/bash/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/translated/tech/20190109 Bash 5.0 Released with New Features.md new file mode 100644 index 0000000000..25a1735e78 --- /dev/null +++ b/translated/tech/20190109 Bash 5.0 Released with New Features.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash 5.0 Released with New Features) +[#]: via: (https://itsfoss.com/bash-5-release) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Bash 5.0 发布了新功能 +====== + +[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新功能和新变量。 + +如果你一直在使用 Bash 4.4.XX,那么你一定会喜欢 [Bash][2] 的第五个主要版本。 + +第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能还有一些让 bash-4.4 和 bash-5.0 之间不兼容的更改。 + +![Bash logo][3] + +### 新功能怎么样? + +邮件列表解释了此版本中修复的 bug: + +> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 $@ 和 $* 的展开做了许多变化,另外还有解决极端情况中 Posix 一致性的修改。 + +它还引入了一些新功能。根据发布说明,最值得注意的新功能是几个新的 shell 变量: + +> BASH_ARGV0、EPOCHSECONDS 和 EPOCHREALTIME。内置的 “history” 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的shell选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。“globasciiranges” 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 + +### Bash-4.4 和 Bash-5.0 之间有哪些变化? + +更新日志提到了不兼容的更改和支持 readline 版本历史记录。它是这么说的: + +> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 nameref 变量解析的更改意味着对 namerefs 的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 BASH_ARGC 和 BASH_ARGV。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 +> +>如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 lib/readline 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 + +我相信一些添加的功能/变量非常有用。我最喜欢的一些是: + + * 有一个新的(默认情况下禁用,文档中没有说明)shell 选项,用于在运行时启用/禁用向 syslog 发送历史记录。 + * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 BASH_ARGC 和 BASH_ARGV,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 + * 现在可以使用 “-d start-end” 删除指定范围的 “history” 条目。 + * 如果启用了作业控制的非交互式 shell 检测到前台作业因 SIGINT 而死亡,则其行为就像接收到 SIGINT 一样。 + * BASH_ARGV0:一个新变量,扩展为 $0 并在赋值时设置 $0。 + + + +要查看完整的更改和功能列表,请参阅[邮件列表文章][1]。 + +### 总结 + +你可以使用下面的命令检查你当前的 Bash 版本: + +``` +bash --version +``` + +你很可能安装了 Bash 4.4。如果你想获得新版本,我建议等待你的发行版提供它。 + +你怎么看待 Bash-5.0 发布?你在使用其他 bash 的替代品么?如果有的话,这个更新会改变你的想法么? + +请在下面的评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bash-5-release + +作者:[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://lists.gnu.org/archive/html/bug-bash/2019-01/msg00063.html +[2]: https://www.gnu.org/software/bash/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 \ No newline at end of file From 6eb8ecfcd0030b34869145ef73d6447c8089ab9f Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 Jan 2019 09:03:24 +0800 Subject: [PATCH 0749/4278] translating --- ...- A Modular System And Hardware Monitoring Tool For Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md index 28b5d5cd27..24b5f93af7 100644 --- a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md +++ b/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 23e2abf7ca94c12a35bd986b1fd7de7a736103e8 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 25 Jan 2019 13:31:04 +0800 Subject: [PATCH 0750/4278] Translating An Introduction to Go. --- .../tech/20181224 An Introduction to Go.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index a63bd98003..0c2758fe2f 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -192,21 +192,21 @@ func myFunc(someFile io.ReadCloser) { ### 错误处理 -Go does not provide exceptions or structured error handling. Instead, it handles errors by returning them in a second or later return value: +Go 没有提供异常类或者结构化的错误处理。然而,它通过第二个及后续的返回值来返回错误从而处理错误: ``` func Read(p []byte) (n int, err error) -// Built-in type: +// 内建类型: type error interface { Error() string } ``` -Errors have to be checked in the code, or can be assigned to `_`: +必须在代码中检查错误或者赋值给 `_`: ``` -n0, _ := Read(Buffer) // ignore error +n0, _ := Read(Buffer) // 忽略错误 n, err := Read(buffer) if err != nil { return err @@ -217,15 +217,15 @@ There are two functions to quickly unwind and recover the call stack, though: `p ``` 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) + } + } } ``` From 2dace79a4bcbf61eee686a0c031b703a0a822218 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 16:57:43 +0800 Subject: [PATCH 0751/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190109=20GoAc?= =?UTF-8?q?cess=20=E2=80=93=20A=20Real-Time=20Web=20Server=20Log=20Analyze?= =?UTF-8?q?r=20And=20Interactive=20Viewer=20sources/tech/20190109=20GoAcce?= =?UTF-8?q?ss=20-=20A=20Real-Time=20Web=20Server=20Log=20Analyzer=20And=20?= =?UTF-8?q?Interactive=20Viewer.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ver Log Analyzer And Interactive Viewer.md | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sources/tech/20190109 GoAccess - A Real-Time Web Server Log Analyzer And Interactive Viewer.md diff --git a/sources/tech/20190109 GoAccess - A Real-Time Web Server Log Analyzer And Interactive Viewer.md b/sources/tech/20190109 GoAccess - A Real-Time Web Server Log Analyzer And Interactive Viewer.md new file mode 100644 index 0000000000..3bad5ba969 --- /dev/null +++ b/sources/tech/20190109 GoAccess - A Real-Time Web Server Log Analyzer And Interactive Viewer.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GoAccess – A Real-Time Web Server Log Analyzer And Interactive Viewer) +[#]: via: (https://www.2daygeek.com/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +GoAccess – A Real-Time Web Server Log Analyzer And Interactive Viewer +====== + +Analyzing a log file is a big headache for Linux administrators as it’s capturing a lot of things. + +Most of the newbies and L1 administrators doesn’t know how to analyze this. + +If you have good knowledge to analyze a logs then you will be a legend for NIX system. + +There are many tools available in Linux to analyze the logs easily. + +GoAccess is one of the tool which allow users to analyze web server logs easily. + +We will be going to discuss in details about GoAccess tool in this article. + +### What is GoAccess? + +GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser. + +GoAccess has minimal requirements, it’s written in C and requires only ncurses. + +It will support Apache, Nginx and Lighttpd logs. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly. + +GoAccess parses the specified web log file and outputs the data to the X terminal and browser. + +GoAccess was designed to be a fast, terminal-based log analyzer. Its core idea is to quickly analyze and view web server statistics in real time without needing to use your browser. + +Terminal output is the default output, it has the capability to generate a complete, self-contained, real-time HTML report, as well as a JSON, and CSV report. + +GoAccess allows any custom log format and the following (Combined Log Format (XLF/ELF) Apache | Nginx & Common Log Format (CLF) Apache) predefined log format options are included, but not limited to. + +### GoAccess Features + + * **`Completely Real Time:`** All the metrics are updated every 200 ms on the terminal and every second on the HTML output. + * **`Track Application Response Time:`** Track the time taken to serve the request. Extremely useful if you want to track pages that are slowing down your site. + * **`Visitors:`** Determine the amount of hits, visitors, bandwidth, and metrics for slowest running requests by the hour, or date. + * **`Metrics per Virtual Host:`** Have multiple Virtual Hosts (Server Blocks)? It features a panel that displays which virtual host is consuming most of the web server resources. + + + +### How to Install GoAccess? + +I would advise users to install GoAccess from distribution official repository with help of Package Manager. It is available in most of the distributions official repository. + +As we know, we will be getting bit outdated package for standard release distribution and rolling release distributions always include latest package. + +If you are running the OS with standard release distributions, i would suggest you to check the alternative options such as PPA or Official GoAccess maintainer repository, etc, to get a latest package. + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][1]** or **[APT Command][2]** to install GoAccess on your systems. + +``` +# apt install goaccess +``` + +To get a latest GoAccess package, use the below GoAccess official repository. + +``` +$ echo "deb https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list +$ wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add - +$ sudo apt-get update +$ sudo apt-get install goaccess +``` + +For **`RHEL/CentOS`** systems, use **[YUM Package Manager][3]** to install GoAccess on your systems. + +``` +# yum install goaccess +``` + +For **`Fedora`** system, use **[DNF Package Manager][4]** to install GoAccess on your system. + +``` +# dnf install goaccess +``` + +For **`ArchLinux/Manjaro`** based systems, use **[Pacman Package Manager][5]** to install GoAccess on your systems. + +``` +# pacman -S goaccess +``` + +For **`openSUSE Leap`** system, use **[Zypper Package Manager][6]** to install GoAccess on your system. + +``` +# zypper install goaccess + +# zypper ar -f obs://server:http + +# zypper ref && zypper in goaccess +``` + +### How to Use GoAccess? + +After successful installation of GoAccess. Just enter the goaccess command and followed by the web server log location to view it. + +``` +# goaccess [options] /path/to/Web Server/access.log + +# goaccess /var/log/apache/2daygeek_access.log +``` + +When you execute the above command, it will ask you to select the **Log Format Configuration**. +![][8] + +I had tested this with Apache access log. The Apache log is splitted in fifteen section. The details are below. The main section shows the summary about the fifteen section. + +The below screenshots included four sessions such as Unique Visitors, Requested files, Static Requests, Not found URLs. +![][9] + +The below screenshots included four sessions such as Visitor Hostnames and IPs, Operating Systems, Browsers, Time Distribution. +![][10] + +The below screenshots included four sessions such as Referrers URLs, Referring Sites, Google’s search engine results, HTTP status codes. +![][11] + +If you would like to generate a html report, use the following format. + +Initially i got an error when i was trying to generate the html report. + +``` +# goaccess 2daygeek_access.log -a > report.html + +GoAccess - version 1.3 - Nov 23 2018 11:28:19 +Config file: No config file used + +Fatal error has occurred +Error occurred at: src/parser.c - parse_log - 2764 +No time format was found on your conf file.Parsing... [0] [0/s] +``` + +It says “No time format was found on your conf file”. To overcome this issue, add the “COMBINED” log format option on it. + +``` +# goaccess -f 2daygeek_access.log --log-format=COMBINED -o 2daygeek.html +Parsing...[0,165] [50,165/s] +``` + +![][12] + +GoAccess allows you to access and analyze the real-time log filtering and parsing. + +``` +# tail -f /var/log/apache/2daygeek_access.log | goaccess - +``` + +For more details navigate to man or help page. + +``` +# man goaccess +or +# goaccess --help +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer/ + +作者:[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/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[5]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[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/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-1.png +[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-2.png +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-3.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-4.png +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-5.png From d18814607d3727ddb70322eac53dccd783c1f148 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:04:45 +0800 Subject: [PATCH 0752/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150717=20The?= =?UTF-8?q?=20History=20of=20Hello=20World=20sources/tech/20150717=20The?= =?UTF-8?q?=20History=20of=20Hello=20World.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20150717 The History of Hello World.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20150717 The History of Hello World.md diff --git a/sources/tech/20150717 The History of Hello World.md b/sources/tech/20150717 The History of Hello World.md new file mode 100644 index 0000000000..9211e9f40f --- /dev/null +++ b/sources/tech/20150717 The History of Hello World.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The History of Hello World) +[#]: via: (https://www.thesoftwareguild.com/blog/the-history-of-hello-world/) +[#]: author: (thussong https://www.thesoftwareguild.com/blog/author/thussong/) + +The History of Hello World +====== + + +Veteran software developers know the [Hello World][2] program as the first step in learning to code. The program, which outputs some variant of “Hello, World!” on a device’s display, can be created in most languages, making it some of the most basic syntax involved in the coding process. In fact, a recent project at the Association for Computing Machinery (ACM) at Louisiana Tech [found][3] that there are at least 204 versions of the program. + +Traditionally, Hello World programs are used to illustrate how the process of coding works, as well as to ensure that a language or system is operating correctly. They are usually the first programs that new coders learn, because even those with little or no experience can execute Hello World both easily and correctly. + +Above all, Hello World is simple. That’s why it is so often used as a barometer of program success. If Hello World does not work effectively within the framework, then it is likely that other, more complex programs will also fail. As one expert at [Win-Vector][4] puts it, Hello World is actually a confrontational program. “The author is saying ‘it isn’t obvious your computer system will work, so I am not going to invest a lot of time in it until I see it can at least print one line of text,’” Win-Vector blogger John Mount says. + +But this two-word phrase has big implications for the field of computer science. With Hello World as a foundation, novice programmers can easily understand computer science principles or elements. And professionals with years of coding experience can use it to learn how a given programming language works, especially in terms of structure and syntax. With applications at all skill levels and in almost every language, there is a long history behind such a short program. + +### Uses + +The main use for Hello World programs was outlined above: It is a way for rookie coders to become acquainted with a new language. However, the applications of these programs go beyond an introduction to the coding world. Hello World can, for example, be used as a sanity test to make sure that the components of a language (its compiler, development and run-time environment) have been correctly installed. Because the process involved in configuring a complete programming toolchain is lengthy and complex, a simple program like Hello World is often used as a first-run test on a new toolchain. + +Hackers also use Hello World “as proof of concept that arbitrary code can be executed through an exploit where the system designers did not intend code to be executed,” according to programming consultants at Cunningham & Cunningham (C2). In fact, it’s the first step in using homemade content, or “home brew” on a device. When [experienced coders][5] are configuring an environment or learning a previously unknown one, they verify that Hello World behaves correctly. + +It is also used as part of the debugging process, allowing programmers to check that they are editing the right aspect of a modifiable program at runtime and that it is being reloaded. + +One more popular use for Hello World is as a basis for comparison. Coders can “compare the size of the executable that the language generates, and how much supporting infrastructure must exist behind the program for it to execute,” according to C2’s wiki. + +### Beginnings + +Though the origins of Hello World remain somewhat unclear, its use as a test phrase is widely believed to have begun with Brian Kernigham’s 1972 book, A Tutorial Introduction to the Language B. In this text, the first known version of the program was used to illustrate external variables. Because the previous example in the tutorial printed “hi!” on the terminal, the more complex “hello, world!” required more character constants for expression and was the next step in the learning process. + +From there, it was used in a Bell Laboratories memo in 1974, as well as The C Programming Language in 1978. This popular text is what made Hello World famous. The example from that book (the first, and most pure, example) printed “hello, world,” with no capital letters or exclamation point. At this time, Hello World was used almost solely to illustrate a few functions of a language— not to test whether the system was running. + +Before Kernigham’s seminal texts on B and C, there was no standard first program. Even as late as 1972, it was not widely in use. The popular BASIC tutorial, “My Computer Likes Me, When I Speak in Basic,” starts with a simple program that writes a line of text. However, this message was “MY HUMAN UNDERSTANDS ME,” far from the two-word greeting programmers use today. But once Hello World was invented, it spread quickly, becoming well-known by the late 1970s. Its popularity continues to this day. + +### One Statement, Many Languages + +Here’s what the code for Hello World looks like in some of the most popular programming languages currently in use. + +#### Java + +``` +class HelloWorld { +public static void main(String[] args) { +System.out.println("Hello, world!"); +} +} +``` + +#### C# + +``` +using System; +class Program +{ +public static void Main(string[] args) +{ +Console.WriteLine("Hello, world!"); +} +} +``` + +#### Python + +``` +print("Hello, world!") +``` + +#### Ruby + +``` +puts "Hello, world!" +``` + +#### Scala + +``` +object HelloWorld extends App { +println("Hello, world!") +} +``` + +#### ASP.NET + +`Response.Write("Hello World!");` + +#### Lisp + +``` +(princ "Hello, world!") +``` + +#### Haskell + +``` +main = putStrLn "Hello, world!" +``` + +#### Malbolge + +``` +('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}= +``` + +#### Go + +``` +package main +import "fmt" +func main() { +fmt.Println("Hello, world!") +} +``` + +### Hello World Today: A Standard Practice in Varied Forms + +In modern coding languages, Hello World is deployed at different levels of sophistication. For example, the Go language introduced a multilingual Hello World program, and XL features a spinning, 3D version complete with graphics. Some languages, like Ruby and Python, need only a single statement to print “hello world,” but a low-level assembly language could require several commands to do so. Modern languages also introduce variations in punctuation and casing. These include the presence or absence of the comma and exclamation point, as well as the capitalization of both words. For example, when systems only support capital letters, the phrase appears as “HELLO WORLD.” The first nontrivial Malbolge program printed “HEllO WORld.” Variations go beyond the literal as well. In functional languages like Lisp and Haskell, factorial programs are substituted for Hello World to emphasize recursive techniques. This is different from the original examples, which emphasized I/O and produced side effects. + +With the increasing complexity of modern coding languages, Hello World is more important than ever. Both as a test and a teaching tool, it has become a standardized way of allowing programmers to configure their environment. No one can be sure why Hello World has stood the test of time in an industry known for rapid-fire innovation, but it is here to stay. + +-------------------------------------------------------------------------------- + +via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/ + +作者:[thussong][a] +选题:[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.thesoftwareguild.com/blog/author/thussong/ +[b]: https://github.com/lujun9972 +[1]: https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.thesoftwareguild.com%2Fblog%2Fthe-history-of-hello-world%2F&title=The%20History%20of%20Hello%20World +[2]: http://en.wikipedia.org/wiki/%22Hello,_World!%22_program +[3]: http://whatis.techtarget.com/definition/Hello-World +[4]: http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/ +[5]: http://c2.com/cgi/wiki?HelloWorld From 496daabf7afb972019f1ee7e02e7d9e4b32c818f Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:06:01 +0800 Subject: [PATCH 0753/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190121=20Akir?= =?UTF-8?q?a:=20The=20Linux=20Design=20Tool=20We=E2=80=99ve=20Always=20Wan?= =?UTF-8?q?ted=3F=20sources/tech/20190121=20Akira-=20The=20Linux=20Design?= =?UTF-8?q?=20Tool=20We-ve=20Always=20Wanted.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e Linux Design Tool We-ve Always Wanted.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..bd58eca5bf --- /dev/null +++ b/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 77b61cceda5431e625ec8c278b3731b6d3512600 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:07:54 +0800 Subject: [PATCH 0754/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190120=20Get?= =?UTF-8?q?=20started=20with=20HomeBank,=20an=20open=20source=20personal?= =?UTF-8?q?=20finance=20app=20sources/tech/20190120=20Get=20started=20with?= =?UTF-8?q?=20HomeBank,=20an=20open=20source=20personal=20finance=20app.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nk, an open source personal finance app.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md diff --git a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md new file mode 100644 index 0000000000..0c905c86f5 --- /dev/null +++ b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with HomeBank, an open source personal finance app) +[#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with HomeBank, an open source personal finance app +====== +Keep track of where your money is going with HomeBank, the eighth 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/math_money_financial_calculator_colors.jpg?itok=_yEVTST1) + +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 eighth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### HomeBank + +Managing my finances can be really stressful. I don't look at my bank balance every day and sometimes have trouble keeping track of where my money is going. I often spend more time managing my finances than I need to, digging into accounts and payment histories to figure out where my money went. Knowing my finances are OK helps keep me calm and allows me to focus on other things. + +![](https://opensource.com/sites/default/files/uploads/homebank-1.png) + +[HomeBank][1] is a personal finance desktop application that helps decrease this type of stress by making it fairly easy to keep track of your finances. It has some nice reports to help you figure out where you're spending your money, allows you to set up rules for importing transactions, and supports most modern formats. + +HomeBank is available on most distributions by default, so installation is very easy. When you start it up for the first time, it will walk you through setup and allow you to create an account. From there, you can either import one of the supported file formats or start entering transactions. The transaction register itself is just that—a list of transactions. [Unlike some other apps][2], you don't have to learn [double-entry bookkeeping][3] to use HomeBank. + +![](https://opensource.com/sites/default/files/uploads/homebank-2.png) + +Importing files from your bank is handled with another step-by-step wizard, with options to create a new account or populate an existing one. Importing into a new account saves a little time since you don't have to pre-create all the accounts before starting the import. You can also import multiple files into an account at once, so you don't need to repeat the same steps for every file in every account. + +![](https://opensource.com/sites/default/files/uploads/homebank-3.png) + +The one pain point I've had with importing and managing accounts is category assignment. Categories are what allow you to break down your spending and see what you are spending money on, in general terms. HomeBank, unlike commercial services (and some commercial programs), requires you to manually set up all the assignments. But this is generally a one-time thing, and then the categories can be auto-applied as transactions are added/imported. There is also a button to analyze the account and auto-apply things that already exist, which speeds up categorizing a large import (like I did the first time). HomeBank comes with a large number of categories you can start with, and you can add your own as well. + +HomeBank also has budgeting features, allowing you to plan for the months ahead. + +![](https://opensource.com/sites/default/files/uploads/homebank-4.png) + +The big win, for me, is HomeBank's reports feature. Not only is there a chart on the main screen showing where you are spending your money, but there are a whole host of other reports you can look at. If you use the budget feature, there is a report that tracks your spending against your budget. You can also view those reports as pie and bar charts. There is also a trend report and a balance report, so you can look back and see changes or patterns over time. + +Overall, HomeBank is a very friendly, useful application to help you keep your finances in order. It is simple to use and really helpful if keeping track of your money is a major stress point in your life. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tools-homebank + +作者:[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://homebank.free.fr/en/index.php +[2]: https://www.gnucash.org/ +[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system From a79461b1d9018c8dffabf264c819c3ad0b21b890 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:09:48 +0800 Subject: [PATCH 0755/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190116=20Zipp?= =?UTF-8?q?ing=20files=20on=20Linux:=20the=20many=20variations=20and=20how?= =?UTF-8?q?=20to=20use=20them=20sources/tech/20190116=20Zipping=20files=20?= =?UTF-8?q?on=20Linux-=20the=20many=20variations=20and=20how=20to=20use=20?= =?UTF-8?q?them.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...the many variations and how to use them.md | 324 ++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 sources/tech/20190116 Zipping files on Linux- the many variations and how to use them.md diff --git a/sources/tech/20190116 Zipping files on Linux- the many variations and how to use them.md b/sources/tech/20190116 Zipping files on Linux- the many variations and how to use them.md new file mode 100644 index 0000000000..fb98f78b06 --- /dev/null +++ b/sources/tech/20190116 Zipping files on Linux- the many variations and how to use them.md @@ -0,0 +1,324 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Zipping files on Linux: the many variations and how to use them) +[#]: via: (https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-the-many-variations-and-how-to-use-them.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Zipping files on Linux: the many variations and how to use them +====== +![](https://images.idgesg.net/images/article/2019/01/zipper-100785364-large.jpg) + +Some of us have been zipping files on Unix and Linux systems for many decades — to save some disk space and package files together for archiving. Even so, there are some interesting variations on zipping that not all of us have tried. So, in this post, we’re going to look at standard zipping and unzipping as well as some other interesting zipping options. + +### The basic zip command + +First, let’s look at the basic **zip** command. It uses what is essentially the same compression algorithm as **gzip** , but there are a couple important differences. For one thing, the gzip command is used only for compressing a single file where zip can both compress files and join them together into an archive. For another, the gzip command zips “in place”. In other words, it leaves a compressed file — not the original file alongside the compressed copy. Here's an example of gzip at work: + +``` +$ gzip onefile +$ ls -l +-rw-rw-r-- 1 shs shs 10514 Jan 15 13:13 onefile.gz +``` + +And here's zip. Notice how this command requires that a name be provided for the zipped archive where gzip simply uses the original file name and adds the .gz extension. + +``` +$ zip twofiles.zip file* + adding: file1 (deflated 82%) + adding: file2 (deflated 82%) +$ ls -l +-rw-rw-r-- 1 shs shs 58021 Jan 15 13:25 file1 +-rw-rw-r-- 1 shs shs 58933 Jan 15 13:34 file2 +-rw-rw-r-- 1 shs shs 21289 Jan 15 13:35 twofiles.zip +``` + +Notice also that the original files are still sitting there. + +The amount of disk space that is saved (i.e., the degree of compression obtained) will depend on the content of each file. The variation in the example below is considerable. + +``` +$ zip mybin.zip ~/bin/* + adding: bin/1 (deflated 26%) + adding: bin/append (deflated 64%) + adding: bin/BoD_meeting (deflated 18%) + adding: bin/cpuhog1 (deflated 14%) + adding: bin/cpuhog2 (stored 0%) + adding: bin/ff (deflated 32%) + adding: bin/file.0 (deflated 1%) + adding: bin/loop (deflated 14%) + adding: bin/notes (deflated 23%) + adding: bin/patterns (stored 0%) + adding: bin/runme (stored 0%) + adding: bin/tryme (deflated 13%) + adding: bin/tt (deflated 6%) +``` + +### The unzip command + +The **unzip** command will recover the contents from a zip file and, as you'd likely suspect, leave the zip file intact, whereas a similar gunzip command would leave only the uncompressed file. + +``` +$ unzip twofiles.zip +Archive: twofiles.zip + inflating: file1 + inflating: file2 +$ ls -l +-rw-rw-r-- 1 shs shs 58021 Jan 15 13:25 file1 +-rw-rw-r-- 1 shs shs 58933 Jan 15 13:34 file2 +-rw-rw-r-- 1 shs shs 21289 Jan 15 13:35 twofiles.zip +``` + +### The zipcloak command + +The **zipcloak** command encrypts a zip file, prompting you to enter a password twice (to help ensure you don't "fat finger" it) and leaves the file in place. You can expect the file size to vary a little from the original. + +``` +$ zipcloak twofiles.zip +Enter password: +Verify password: +encrypting: file1 +encrypting: file2 +$ ls -l +total 204 +-rw-rw-r-- 1 shs shs 58021 Jan 15 13:25 file1 +-rw-rw-r-- 1 shs shs 58933 Jan 15 13:34 file2 +-rw-rw-r-- 1 shs shs 21313 Jan 15 13:46 twofiles.zip <== slightly larger than + unencrypted version +``` + +Keep in mind that the original files are still sitting there unencrypted. + +### The zipdetails command + +The **zipdetails** command is going to show you details — a _lot_ of details about a zipped file, likely a lot more than you care to absorb. Even though we're looking at an encrypted file, zipdetails does display the file names along with file modification dates, user and group information, file length data, etc. Keep in mind that this is all "metadata." We don't see the contents of the files. + +``` +$ zipdetails twofiles.zip + +0000 LOCAL HEADER #1 04034B50 +0004 Extract Zip Spec 14 '2.0' +0005 Extract OS 00 'MS-DOS' +0006 General Purpose Flag 0001 + [Bit 0] 1 'Encryption' + [Bits 1-2] 1 'Maximum Compression' +0008 Compression Method 0008 'Deflated' +000A Last Mod Time 4E2F6B24 'Tue Jan 15 13:25:08 2019' +000E CRC F1B115BD +0012 Compressed Length 00002904 +0016 Uncompressed Length 0000E2A5 +001A Filename Length 0005 +001C Extra Length 001C +001E Filename 'file1' +0023 Extra ID #0001 5455 'UT: Extended Timestamp' +0025 Length 0009 +0027 Flags '03 mod access' +0028 Mod Time 5C3E2584 'Tue Jan 15 13:25:08 2019' +002C Access Time 5C3E27BB 'Tue Jan 15 13:34:35 2019' +0030 Extra ID #0002 7875 'ux: Unix Extra Type 3' +0032 Length 000B +0034 Version 01 +0035 UID Size 04 +0036 UID 000003E8 +003A GID Size 04 +003B GID 000003E8 +003F PAYLOAD + +2943 LOCAL HEADER #2 04034B50 +2947 Extract Zip Spec 14 '2.0' +2948 Extract OS 00 'MS-DOS' +2949 General Purpose Flag 0001 + [Bit 0] 1 'Encryption' + [Bits 1-2] 1 'Maximum Compression' +294B Compression Method 0008 'Deflated' +294D Last Mod Time 4E2F6C56 'Tue Jan 15 13:34:44 2019' +2951 CRC EC214569 +2955 Compressed Length 00002913 +2959 Uncompressed Length 0000E635 +295D Filename Length 0005 +295F Extra Length 001C +2961 Filename 'file2' +2966 Extra ID #0001 5455 'UT: Extended Timestamp' +2968 Length 0009 +296A Flags '03 mod access' +296B Mod Time 5C3E27C4 'Tue Jan 15 13:34:44 2019' +296F Access Time 5C3E27BD 'Tue Jan 15 13:34:37 2019' +2973 Extra ID #0002 7875 'ux: Unix Extra Type 3' +2975 Length 000B +2977 Version 01 +2978 UID Size 04 +2979 UID 000003E8 +297D GID Size 04 +297E GID 000003E8 +2982 PAYLOAD + +5295 CENTRAL HEADER #1 02014B50 +5299 Created Zip Spec 1E '3.0' +529A Created OS 03 'Unix' +529B Extract Zip Spec 14 '2.0' +529C Extract OS 00 'MS-DOS' +529D General Purpose Flag 0001 + [Bit 0] 1 'Encryption' + [Bits 1-2] 1 'Maximum Compression' +529F Compression Method 0008 'Deflated' +52A1 Last Mod Time 4E2F6B24 'Tue Jan 15 13:25:08 2019' +52A5 CRC F1B115BD +52A9 Compressed Length 00002904 +52AD Uncompressed Length 0000E2A5 +52B1 Filename Length 0005 +52B3 Extra Length 0018 +52B5 Comment Length 0000 +52B7 Disk Start 0000 +52B9 Int File Attributes 0001 + [Bit 0] 1 Text Data +52BB Ext File Attributes 81B40000 +52BF Local Header Offset 00000000 +52C3 Filename 'file1' +52C8 Extra ID #0001 5455 'UT: Extended Timestamp' +52CA Length 0005 +52CC Flags '03 mod access' +52CD Mod Time 5C3E2584 'Tue Jan 15 13:25:08 2019' +52D1 Extra ID #0002 7875 'ux: Unix Extra Type 3' +52D3 Length 000B +52D5 Version 01 +52D6 UID Size 04 +52D7 UID 000003E8 +52DB GID Size 04 +52DC GID 000003E8 + +52E0 CENTRAL HEADER #2 02014B50 +52E4 Created Zip Spec 1E '3.0' +52E5 Created OS 03 'Unix' +52E6 Extract Zip Spec 14 '2.0' +52E7 Extract OS 00 'MS-DOS' +52E8 General Purpose Flag 0001 + [Bit 0] 1 'Encryption' + [Bits 1-2] 1 'Maximum Compression' +52EA Compression Method 0008 'Deflated' +52EC Last Mod Time 4E2F6C56 'Tue Jan 15 13:34:44 2019' +52F0 CRC EC214569 +52F4 Compressed Length 00002913 +52F8 Uncompressed Length 0000E635 +52FC Filename Length 0005 +52FE Extra Length 0018 +5300 Comment Length 0000 +5302 Disk Start 0000 +5304 Int File Attributes 0001 + [Bit 0] 1 Text Data +5306 Ext File Attributes 81B40000 +530A Local Header Offset 00002943 +530E Filename 'file2' +5313 Extra ID #0001 5455 'UT: Extended Timestamp' +5315 Length 0005 +5317 Flags '03 mod access' +5318 Mod Time 5C3E27C4 'Tue Jan 15 13:34:44 2019' +531C Extra ID #0002 7875 'ux: Unix Extra Type 3' +531E Length 000B +5320 Version 01 +5321 UID Size 04 +5322 UID 000003E8 +5326 GID Size 04 +5327 GID 000003E8 + +532B END CENTRAL HEADER 06054B50 +532F Number of this disk 0000 +5331 Central Dir Disk no 0000 +5333 Entries in this disk 0002 +5335 Total Entries 0002 +5337 Size of Central Dir 00000096 +533B Offset to Central Dir 00005295 +533F Comment Length 0000 +Done +``` + +### The zipgrep command + +The **zipgrep** command is going to use a grep-type feature to locate particular content in your zipped files. If the file is encrypted, you will need to enter the password provided for the encryption for each file you want to examine. If you only want to check the contents of a single file from the archive, add its name to the end of the zipgrep command as shown below. + +``` +$ zipgrep hazard twofiles.zip file1 +[twofiles.zip] file1 password: +Certain pesticides should be banned since they are hazardous to the environment. +``` + +### The zipinfo command + +The **zipinfo** command provides information on the contents of a zipped file whether encrypted or not. This includes the file names, sizes, dates and permissions. + +``` +$ zipinfo twofiles.zip +Archive: twofiles.zip +Zip file size: 21313 bytes, number of entries: 2 +-rw-rw-r-- 3.0 unx 58021 Tx defN 19-Jan-15 13:25 file1 +-rw-rw-r-- 3.0 unx 58933 Tx defN 19-Jan-15 13:34 file2 +2 files, 116954 bytes uncompressed, 20991 bytes compressed: 82.1% +``` + +### The zipnote command + +The **zipnote** command can be used to extract comments from zip archives or add them. To display comments, just preface the name of the archive with the command. If no comments have been added previously, you will see something like this: + +``` +$ zipnote twofiles.zip +@ file1 +@ (comment above this line) +@ file2 +@ (comment above this line) +@ (zip file comment below this line) +``` + +If you want to add comments, write the output from the zipnote command to a file: + +``` +$ zipnote twofiles.zip > comments +``` + +Next, edit the file you've just created, inserting your comments above the **(comment above this line)** lines. Then add the comments using a zipnote command like this one: + +``` +$ zipnote -w twofiles.zip < comments +``` + +### The zipsplit command + +The **zipsplit** command can be used to break a zip archive into multiple zip archives when the original file is too large — maybe because you're trying to add one of the files to a small thumb drive. The easiest way to do this seems to be to specify the max size for each of the zipped file portions. This size must be large enough to accomodate the largest included file. + +``` +$ zipsplit -n 12000 twofiles.zip +2 zip files will be made (100% efficiency) +creating: twofile1.zip +creating: twofile2.zip +$ ls twofile*.zip +-rw-rw-r-- 1 shs shs 10697 Jan 15 14:52 twofile1.zip +-rw-rw-r-- 1 shs shs 10702 Jan 15 14:52 twofile2.zip +-rw-rw-r-- 1 shs shs 21377 Jan 15 14:27 twofiles.zip +``` + +Notice how the extracted files are sequentially named "twofile1" and "twofile2". + +### Wrap-up + +The **zip** command, along with some of its zipping compatriots, provide a lot of control over how you generate and work with compressed file archives. + +**[ Also see:[Invaluable tips and tricks for troubleshooting Linux][1] ]** + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-the-many-variations-and-how-to-use-them.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From 816f62f97b9c570b32eac844725a90c27f48e24f Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:11:43 +0800 Subject: [PATCH 0756/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190121=20Boot?= =?UTF-8?q?ing=20Linux=20faster=20sources/talk/20190121=20Booting=20Linux?= =?UTF-8?q?=20faster.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20190121 Booting Linux faster.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/talk/20190121 Booting Linux faster.md diff --git a/sources/talk/20190121 Booting Linux faster.md b/sources/talk/20190121 Booting Linux faster.md new file mode 100644 index 0000000000..ef79351e0e --- /dev/null +++ b/sources/talk/20190121 Booting Linux faster.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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/ From 978bee95ccbfb70be77b52394c2218bac01a853f Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:14:51 +0800 Subject: [PATCH 0757/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190118=20Top?= =?UTF-8?q?=205=20Linux=20Server=20Distributions=20sources/tech/20190118?= =?UTF-8?q?=20Top=205=20Linux=20Server=20Distributions.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190118 Top 5 Linux Server Distributions.md | 268 ++++++++++++++++++ 1 file changed, 268 insertions(+) create mode 100644 sources/tech/20190118 Top 5 Linux Server Distributions.md diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md new file mode 100644 index 0000000000..0cb6e83247 --- /dev/null +++ b/sources/tech/20190118 Top 5 Linux Server Distributions.md @@ -0,0 +1,268 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Server Distributions) +[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +Top 5 Linux Server Distributions +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) + +Ah, the age-old question: Which Linux distribution is best suited for servers? Typically, when this question is asked, the standard responses pop up: + + * RHEL + + * SUSE + + * Ubuntu Server + + * Debian + + * CentOS + + + + +However, in the name of opening your eyes to maybe something a bit different, I’m going to approach this a bit differently. I want to consider a list of possible distributions that are not only outstanding candidates but also easy to use, and that can serve many functions within your business. In some cases, my choices are drop-in replacements for other operating systems, whereas others require a bit of work to get them up to speed. + +Some of my choices are community editions of enterprise-grade servers, which could be considered gateways to purchasing a much more powerful platform. You’ll even find one or two entries here to be duty-specific platforms. Most importantly, however, what you’ll find on this list isn’t the usual fare. + +### ClearOS + +What is ClearOS? For home and small business usage, you might not find a better solution. Out of the box, ClearOS includes tools like intrusion detection, a strong firewall, bandwidth management tools, a mail server, a domain controller, and much more. What makes ClearOS stand out above some of the competition is its purpose is to server as a simple Home and SOHO server with a user-friendly, graphical web-based interface. From that interface, you’ll find an application marketplace (Figure 1), with hundreds of apps (some of which are free, whereas some have an associated cost), that makes it incredibly easy to extend the ClearOS featureset. In other words, you make ClearOS the platform your home and small business needs it to be. Best of all, unlike many other alternatives, you only pay for the software and support you need. +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) +There are three different editions of ClearOS: + + * [ClearOS Community][1] - the free edition of ClearOS + + * [ClearOS Home][2] - ideal for home offices + + * [ClearOS Business][3] - ideal for small businesses, due to the inclusion of paid support + + + + +To make the installation of software even easier, the ClearOS marketplace allows you to select via: + + * By Function (which displays apps according to task) + + * By Category (which displays groups of related apps) + + * Quick Select File (which allows you to select pre-configured templates to get you up and running fast) + + + + +In other words, if you’re looking for a Linux Home, SOHO, or SMB server, ClearOS is an outstanding choice (especially if you don’t have the Linux chops to get a standard server up and running). + +### Fedora Server + +You’ve heard of Fedora Linux. Of course you have. It’s one of the finest bleeding edge distributions on the market. But did you know the developers of that excellent Fedora Desktop distribution also has a Server edition? The Fedora Server platform is a short-lifecycle, community-supported server OS. This take on the server operating system enables seasoned system administrators, experienced with any flavor of Linux (or any OS at all), to make use of the very latest technologies available in the open source community. There are three key words in that description: + + * Seasoned + + * System + + * Administrators + + + + +In other words, new users need not apply. Although Fedora Server is quite capable of handling any task you throw at it, it’s going to require someone with a bit more Linux kung fu to make it work and work well. One very nice inclusion with Fedora Server is that, out of the box, it includes one of the finest open source, web-based interface for servers on the market. With Cockpit (Figure 2) you get a quick glance at system resources, logs, storage, network, as well as the ability to manage accounts, services, applications, and updates. + +![Fedora Server][5] + +Figure 2: Cockpit running on Fedora Server. + +[Used with permission][6] + +If you’re okay working with bleeding edge software, and want an outstanding admin dashboard, Fedora Server might be the platform for you. + +### NethServer + +NethServer is about as no-brainer of a drop-in SMB Linux server as you’ll find. With the latest iteration of NethServer, your small business will enjoy: + + * Built-in Samba Active Directory Controller + + * Seamless Nextcloud integration + + * Certificate management + + * Transparent HTTPS proxy + + * Firewall + + * Mail server and filter + + * Web server and filter + + * Groupware + + * IPS/IDS or VPN + + + + +All of the included features can be easily configured with a user-friendly, web-based interface that includes single-click installation of modules to expand the NethServer feature set (Figure 3) What sets NethServer apart from ClearOS is that it was designed to make the admin job easier. In other words, this platform offers much more in the way of flexibility and power. Unlike ClearOS, which is geared more toward home office and SOHO deployments, NethServer is equally at home in small business environments. + +![NethServer][8] + +Figure 3: Adding modules to NethServer. + +[Used with permission][6] + +### Rockstor + +Rockstor is a Linux and Btfrs powered advanced Network Attached Storage (NAS) and Cloud storage server that can be deployed for Home, SOHO, as well as small- and mid-sized businesses alike. With Rockstor, you get a full-blown NAS/Cloud solution with a user-friendly, web-based GUI tool that is just as easy for admins to set up as it is for users to use. Once you have Rockstor deployed, you can create pools, shares, snapshots, manage replication and users, share files (with the help of Samba, NFS, SFTP, and AFP), and even extend the featureset, thanks to add-ons (called Rock-ons). The list of Rock-ons includes: + + * CouchPotato (Downloader for usenet and bittorrent users) + + * Deluge (Movie downloader for bittorrent users) + + * EmbyServer (Emby media server) + + * Ghost (Publishing platform for professional bloggers) + + * GitLab CE (Git repository hosting and collaboration) + + * Gogs Go Git Service (Lightweight Git version control server and front end) + + * Headphones (An automated music downloader for NZB and Torrent) + + * Logitech Squeezebox Server for Squeezebox Devices + + * MariaDB (Relational database management system) + + * NZBGet (Efficient usenet downloader) + + * OwnCloud-Official (Secure file sharing and hosting) + + * Plexpy (Python-based Plex Usage tracker) + + * Rocket.Chat (Open Source Chat Platform) + + * SaBnzbd (Usenet downloader) + + * Sickbeard (Internet PVR for TV shows) + + * Sickrage (Automatic Video Library Manager for TV Shows) + + * Sonarr (PVR for usenet and bittorrent users) + + * Symform (Backup service) + + + + +Rockstor also includes an at-a-glance dashboard that gives admins quick access to all the information they need about their server (Figure 4). + +![Rockstor][10] + +The Rockstor dashboard in action. + +[Used with permission][6] + +### Zentyal + +Zentyal is another Small Business Server that does a great job of handling multiple tasks. If you’re looking for a Linux distribution that can handle the likes of: + + * Directory and Domain server + + * Mail server + + * Gateway + + * DHCP, DNS, and NTP server + + * Certification Authority + + * VPN + + * Instant Messaging + + * FTP server + + * Antivirus + + * SSO authentication + + * File sharing + + * RADIUS + + * Virtualization Management + + * And more + + + + +Zentyal might be your new go-to. Zentyal has been around since 2004 and is based on Ubuntu Server, so it enjoys a rock-solid base and plenty of applications. And with the help of the Zentyal dashboard (Figure 5), admins can easily manage: + + * System + + * Network + + * Logs + + * Software updates and installation + + * Users/groups + + * Domains + + * File sharing + + * Mail + + * DNS + + * Firewall + + * Certificates + + * And much more + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) + + +Adding new components to the Zentyal server is as simple as opening the Dashboard, clicking on Software Management > Zentyal Components, selecting what you want to add, and clicking Install. The one issue you might find with Zentyal is that it doesn’t offer nearly the amount of addons as you’ll find in the likes of Nethserver and ClearOS. But the services it does offer, Zentyal does incredibly well. + +### Plenty More Where These Came From + +This list of Linux servers is clearly not exhaustive. What it is, however, is a unique look at the top five server distributions you’ve probably not heard of. Of course, if you’d rather opt to use a more traditional Linux server distribution, you can always stick with [CentOS][11], [Ubuntu Server][12], [SUSE][13], [Red Hat Enterprise Linux][14], or [Debian][15]… most of which are found on every list of best server distributions on the market. If, however, you’re looking for something a bit different, give one of these five distos a try. + +Learn more about Linux through the free ["Introduction to Linux" ][16]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions + +作者:[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.clearos.com/clearfoundation/software/clearos-7-community +[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home +[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business +[4]: https://www.linux.com/files/images/fedoraserverjpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) +[6]: https://www.linux.com/licenses/category/used-permission +[7]: https://www.linux.com/files/images/nethserverjpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) +[9]: https://www.linux.com/files/images/rockstorejpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) +[11]: https://www.centos.org/ +[12]: https://www.ubuntu.com/download/server +[13]: https://www.suse.com/ +[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[15]: https://www.debian.org/ +[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 5b4a15efa702f4ee44397533c5b4ae956a720cde Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:18:03 +0800 Subject: [PATCH 0758/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190118=20Get?= =?UTF-8?q?=20started=20with=20WTF,=20a=20dashboard=20for=20the=20terminal?= =?UTF-8?q?=20sources/tech/20190118=20Get=20started=20with=20WTF,=20a=20da?= =?UTF-8?q?shboard=20for=20the=20terminal.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... with WTF, a dashboard for the terminal.md | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md diff --git a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md new file mode 100644 index 0000000000..822cd8b7e8 --- /dev/null +++ b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with WTF, a dashboard for the terminal) +[#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard) +[#]: author: (Kevein Sonney https://opensource.com/users/ksonney) + +Get started with WTF, a dashboard for the terminal +====== +Keep key information in view with WTF, the sixth 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 sixth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### WTF + +Once upon a time, I was doing some consulting at a firm that used [Bloomberg Terminals][1] . My reaction was, "Wow, that's WAY too much information on one screen." These days, however, it seems like I can't get enough information on a screen when I'm working and have multiple web pages, dashboards, and console apps open to try to keep track of things. + +While [tmux][2] and [Screen][3] can do split screens and multiple windows, they are a pain to set up, and the keybindings can take a while to learn (and often conflict with other applications). + +[WTF][4] is a simple, easily configured information dashboard for the terminal. It is written in [Go][5], uses a YAML configuration file, and can pull data from several different sources. All the data sources are contained in [modules][6] and include things like weather, issue trackers, date and time, Google Sheets, and a whole lot more. Some panes are interactive, and some just update with the most recent information available. + +Setup is as easy as downloading the latest release for your operating system and running the command. Since it is written in Go, it is very portable and should run anywhere you can compile it (although the developer only builds for Linux and MacOS at this time). + +![](https://opensource.com/sites/default/files/uploads/wtf-1.png) + +When you run WTF for the first time, you'll get the default screen, identical to the image above. + +![](https://opensource.com/sites/default/files/uploads/wtf-2.png) + +You also get the default configuration file in **~/.wtf/config.yml** , and you can edit the file to suit your needs. The grid layout is configured in the top part of the file. + +``` +grid: +  columns: [45, 45] +  rows: [7, 7, 7, 4] +``` + +The numbers in the grid settings represent the character dimensions of each block. The default configuration is two columns of 40 characters, two rows 13 characters tall, and one row 4 characters tall. In the code above, I made the columns wider (45, 45), the rows smaller, and added a fourth row so I can have more widgets. + +![](https://opensource.com/sites/default/files/uploads/wtf-3.png) + +I like to see the day's weather on my dashboard. There are two weather modules to chose from: [Weather][7], which shows just the text information, and [Pretty Weather][8], which is colorful and uses text-based graphics in the display. + +``` +prettyweather: +  enabled: true +  position: +    top: 0 +    left: 1 +    height: 2 +    width: 1 +``` + +This code creates a pane two blocks tall (height: 2) and one block wide (height: 1), positioned on the second column (left: 1) on the top row (top: 0) containing the Pretty Weather module. + +Some modules, like Jira, GitHub, and Todo, are interactive, and you can scroll, update, and save information in them. You can move between the interactive panes using the Tab key. The \ key brings up a help screen for the active pane so you can see what you can do and how. The Todo module lets you add, edit, and delete to-do items, as well as check them off as you complete them. + +![](https://opensource.com/sites/default/files/uploads/wtf-4.png) + +There are also modules to execute commands and present the output, watch a text file, and monitor build and integration server output. All the documentation is very well done. + +WTF is a valuable tool for anyone who needs to see a lot of data on one screen from different sources. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/wtf-information-dashboard + +作者:[Kevein Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Bloomberg_Terminal +[2]: https://github.com/tmux/tmux +[3]: https://www.gnu.org/software/screen/ +[4]: https://wtfutil.com/ +[5]: https://golang.org/ +[6]: https://wtfutil.com/posts/modules/ +[7]: https://wtfutil.com/posts/modules/weather/ +[8]: https://wtfutil.com/posts/modules/prettyweather/ From 4e429f1febf45b49252023124e2249afa298e423 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:21:29 +0800 Subject: [PATCH 0759/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190122=20How?= =?UTF-8?q?=20To=20Copy=20A=20File/Folder=20From=20A=20Local=20System=20To?= =?UTF-8?q?=20Remote=20System=20In=20Linux=3F=20sources/tech/20190122=20Ho?= =?UTF-8?q?w=20To=20Copy=20A=20File-Folder=20From=20A=20Local=20System=20T?= =?UTF-8?q?o=20Remote=20System=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Local System To Remote System In Linux.md | 398 ++++++++++++++++++ 1 file changed, 398 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..6de6cd173f --- /dev/null +++ b/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @@ -0,0 +1,398 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From ca782053dfc50cc2b08d9ad339e1cc8bad482ac3 Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 25 Jan 2019 20:39:29 +0800 Subject: [PATCH 0760/4278] 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 a6957992a2ea7ff32e8634583d63fce25d994b3c Mon Sep 17 00:00:00 2001 From: MjSeven Date: Fri, 25 Jan 2019 20:48:46 +0800 Subject: [PATCH 0761/4278] Translating 20190411 How to setup static... --- .../tech/20180411 How To Setup Static File Server Instantly.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180411 How To Setup Static File Server Instantly.md b/sources/tech/20180411 How To Setup Static File Server Instantly.md index b388b389fa..b925c75f1f 100644 --- a/sources/tech/20180411 How To Setup Static File Server Instantly.md +++ b/sources/tech/20180411 How To Setup Static File Server Instantly.md @@ -1,3 +1,5 @@ +Transltaing by MjSeven + How To Setup Static File Server Instantly ====== From 91fe3aa4c78bf088fe1204c6410dd7ad613fec8c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 22:28:31 +0800 Subject: [PATCH 0762/4278] PRF:20190113 Get started with Joplin, a note-taking app.md @geekpi --- ... started with Joplin, a note-taking app.md | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/translated/tech/20190113 Get started with Joplin, a note-taking app.md b/translated/tech/20190113 Get started with Joplin, a note-taking app.md index 495dd4c9d1..949d6a97cd 100644 --- a/translated/tech/20190113 Get started with Joplin, a note-taking app.md +++ b/translated/tech/20190113 Get started with Joplin, a note-taking app.md @@ -1,40 +1,46 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Joplin, a note-taking app) [#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用一款笔记应用 Joplin +开始使用 Joplin 吧,一款开源笔记应用 ====== -了解开源工具如何帮助你在 2019 年提高工作效率。先从 Joplin 开始。 + +> 了解开源工具如何帮助你在 2019 年提高工作效率。先从 Joplin 开始。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S) -每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件。这不一定要这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。 ### Joplin -在生产力工具领域,笔记应用非常方便。是的,你可以使用开源 [NixNote][1] 访问 [Evernote][2 ] 笔记,但它仍然与 Evernote 服务器相关联,并且仍然依赖于第三方的安全性。虽然你可以从 NixNote 导出 Evernote 笔记,但可选格式只有 NixNote XML 或 PDF。 +在生产力工具领域,笔记应用**非常**方便。是的,你可以使用开源 [NixNote][1] 访问 [Evernote][2] 笔记,但它仍然与 Evernote 服务器相关联,并且仍然依赖于第三方的安全性。虽然你**可以**从 NixNote 导出 Evernote 笔记,但可选格式只有 NixNote XML 或 PDF。 ![](https://opensource.com/sites/default/files/uploads/joplin-1.png) -看看 [Joplin][3]。Joplin 是一个 NodeJS 应用,它在本地运行和存储笔记,它允许你加密笔记并支持多种同步方法。Joplin 可在 Windows、Mac 和 Linux 上作为控制台或图形应用运行。Joplin 还有适用于 Android 和 iOS 的移动应用,这意味着你可以随身携带笔记而不会有任何麻烦。Joplin 甚至允许你使用 Markdown、HTML 或纯文本格式笔记。 +*Joplin 的图形界面* + +看看 [Joplin][3]。Joplin 是一个 NodeJS 应用,它在本地运行和存储笔记,它允许你加密笔记并支持多种同步方法。Joplin 可在 Windows、Mac 和 Linux 上作为控制台应用或图形应用运行。Joplin 还有适用于 Android 和 iOS 的移动应用,这意味着你可以随身携带笔记而不会有任何麻烦。Joplin 甚至允许你使用 Markdown、HTML 或纯文本格式笔记。 ![](https://opensource.com/sites/default/files/uploads/joplin-3.png) +*Joplin 的 Android 应用* + 关于 Joplin 很棒的一件事是它支持两种类型笔记:普通笔记和待办事项笔记。普通笔记是你所想的包含文本的文档。另一个,待办事项笔记在笔记列表中有一个复选框,允许你将其标记为“已完成”。由于待办事项仍然是一个笔记,因此你可以在待办事项中添加列表、文档和其他待办事项。 -当使用 GUI 时,你可以在纯文本、WYSIWYG 和同时显示源文本和渲染视图的分屏之间切换编辑器视图。你还可以在 GUI 中指定外部编辑器,以便使用 Vim、Emacs 或任何其他能够处理文本文档的编辑器轻松更新笔记。 +当使用图形界面时,你可以在纯文本、WYSIWYG 和同时显示源文本和渲染视图的分屏之间切换编辑器视图。你还可以在图形界面中指定外部编辑器,以便使用 Vim、Emacs 或任何其他能够处理文本文档的编辑器轻松更新笔记。 ![Joplin console version][5] -控制台中的 Joplin +*控制台中的 Joplin* -控制台界面非常棒。虽然它缺少 WYSIWYG 编辑器,但默认登录使用文本编辑器。它还有强大的命令模式,它允许执行在 GUI 版本中几乎所有的操作。并且能够在视图中正确渲染 Markdown。 +控制台界面非常棒。虽然它缺少 WYSIWYG 编辑器,但默认登录使用文本编辑器。它还有强大的命令模式,它允许执行在图形版本中几乎所有的操作。并且能够在视图中正确渲染 Markdown。 你可以将笔记本中的笔记分组,还能为笔记打上标记,以便于在笔记本中进行分组。它甚至还有内置的搜索功能,因此如果你忘了笔记在哪,你可以通过它找到它们。 @@ -47,7 +53,7 @@ via: https://opensource.com/article/19/1/productivity-tool-joplin 作者:[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 2c263d5aafff7546b288f4cd8db3df783891a626 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 22:29:19 +0800 Subject: [PATCH 0763/4278] PUB:20190113 Get started with Joplin, a note-taking app.md @geekpi https://linux.cn/article-10476-1.html --- .../20190113 Get started with Joplin, a note-taking app.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190113 Get started with Joplin, a note-taking app.md (98%) diff --git a/translated/tech/20190113 Get started with Joplin, a note-taking app.md b/published/20190113 Get started with Joplin, a note-taking app.md similarity index 98% rename from translated/tech/20190113 Get started with Joplin, a note-taking app.md rename to published/20190113 Get started with Joplin, a note-taking app.md index 949d6a97cd..e287e143f8 100644 --- a/translated/tech/20190113 Get started with Joplin, a note-taking app.md +++ b/published/20190113 Get started with Joplin, a note-taking app.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10476-1.html) [#]: subject: (Get started with Joplin, a note-taking app) [#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From 1246212c9f8812cf3e700301746d2fdc684dc80d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 23:02:45 +0800 Subject: [PATCH 0764/4278] PRF:20190109 Bash 5.0 Released with New Features.md @geekpi --- ...109 Bash 5.0 Released with New Features.md | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/translated/tech/20190109 Bash 5.0 Released with New Features.md index 25a1735e78..6d2a2bad60 100644 --- a/translated/tech/20190109 Bash 5.0 Released with New Features.md +++ b/translated/tech/20190109 Bash 5.0 Released with New Features.md @@ -1,50 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Bash 5.0 Released with New Features) [#]: via: (https://itsfoss.com/bash-5-release) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Bash 5.0 发布了新功能 +Bash 5.0 发布及其新功能 ====== -[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新功能和新变量。 +[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新的功能和变量。 如果你一直在使用 Bash 4.4.XX,那么你一定会喜欢 [Bash][2] 的第五个主要版本。 -第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能还有一些让 bash-4.4 和 bash-5.0 之间不兼容的更改。 +第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能,以及一些与 bash-4.4 不兼容的更改。 ![Bash logo][3] ### 新功能怎么样? -邮件列表解释了此版本中修复的 bug: +在邮件列表解释了此版本中修复的 bug: -> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 $@ 和 $* 的展开做了许多变化,另外还有解决极端情况中 Posix 一致性的修改。 +> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 `$@` 和 `$*` 的展开做了许多改变,另外还有解决极端情况中 Posix 一致性的修改。 -它还引入了一些新功能。根据发布说明,最值得注意的新功能是几个新的 shell 变量: +它还引入了一些新功能。根据其发布说明,最值得注意的新功能是几个新的 shell 变量: -> BASH_ARGV0、EPOCHSECONDS 和 EPOCHREALTIME。内置的 “history” 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的shell选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。“globasciiranges” 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 +> `BASH_ARGV0`、`EPOCHSECONDS` 和 `EPOCHREALTIME`。内置命令 `history` 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的 shell 选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。`globasciiranges` 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 ### Bash-4.4 和 Bash-5.0 之间有哪些变化? -更新日志提到了不兼容的更改和支持 readline 版本历史记录。它是这么说的: +其更新日志提到了不兼容的更改和所支持的 readline 版本历史记录。它是这么说的: -> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 nameref 变量解析的更改意味着对 namerefs 的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 BASH_ARGC 和 BASH_ARGV。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 +> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 `nameref` 变量解析的更改意味着对变量名引用的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 `BASH_ARGC` 和 `BASH_ARGV`。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 > ->如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 lib/readline 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 +> 如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 `lib/readline` 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 我相信一些添加的功能/变量非常有用。我最喜欢的一些是: * 有一个新的(默认情况下禁用,文档中没有说明)shell 选项,用于在运行时启用/禁用向 syslog 发送历史记录。 - * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 BASH_ARGC 和 BASH_ARGV,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 - * 现在可以使用 “-d start-end” 删除指定范围的 “history” 条目。 + * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 `BASH_ARGC` 和 `BASH_ARGV`,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 + * 现在可以使用 `-d start-end` 删除指定范围的 `history` 条目。 * 如果启用了作业控制的非交互式 shell 检测到前台作业因 SIGINT 而死亡,则其行为就像接收到 SIGINT 一样。 - * BASH_ARGV0:一个新变量,扩展为 $0 并在赋值时设置 $0。 - - + * `BASH_ARGV0`:一个新变量,扩展为 `$0`,并在赋值时设置为 `$0`。 要查看完整的更改和功能列表,请参阅[邮件列表文章][1]。 @@ -69,7 +67,7 @@ via: https://itsfoss.com/bash-5-release 作者:[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/) 荣誉推出 @@ -77,4 +75,4 @@ via: https://itsfoss.com/bash-5-release [b]: https://github.com/lujun9972 [1]: https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00063.html [2]: https://www.gnu.org/software/bash/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 \ No newline at end of file +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 From 23fbe5bc1650cf7e3184a6c77fcd84277f307ade Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 23:03:18 +0800 Subject: [PATCH 0765/4278] PUB:20190109 Bash 5.0 Released with New Features.md @geekpi https://linux.cn/article-10477-1.html --- .../20190109 Bash 5.0 Released with New Features.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190109 Bash 5.0 Released with New Features.md (98%) diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/published/20190109 Bash 5.0 Released with New Features.md similarity index 98% rename from translated/tech/20190109 Bash 5.0 Released with New Features.md rename to published/20190109 Bash 5.0 Released with New Features.md index 6d2a2bad60..92aaedc8fc 100644 --- a/translated/tech/20190109 Bash 5.0 Released with New Features.md +++ b/published/20190109 Bash 5.0 Released with New Features.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10477-1.html) [#]: subject: (Bash 5.0 Released with New Features) [#]: via: (https://itsfoss.com/bash-5-release) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From b433e790a4c4de1655dd8e195e0e6ce29886b087 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Fri, 25 Jan 2019 17:00:25 +0000 Subject: [PATCH 0766/4278] Revert "ScarboroughCoral translating!" This reverts commit 1be827d677fdbf18f75c6bf06acca89967c60d52. --- ...803 How to use Fedora Server to create a router - gateway.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md b/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md index 934693d1cf..0394826c10 100644 --- a/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md +++ b/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md @@ -1,5 +1,3 @@ -ScarboroughCoral translating! - How to use Fedora Server to create a router / gateway ====== From 38ec21d05ab4426a40d00dc3c0cd1fe600087ba5 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 26 Jan 2019 10:28:42 +0800 Subject: [PATCH 0767/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=2020180411=20How=20to=20setup=20static...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...w To Setup Static File Server Instantly.md | 173 ------------------ ...w To Setup Static File Server Instantly.md | 161 ++++++++++++++++ 2 files changed, 161 insertions(+), 173 deletions(-) delete mode 100644 sources/tech/20180411 How To Setup Static File Server Instantly.md create mode 100644 translated/tech/20180411 How To Setup Static File Server Instantly.md diff --git a/sources/tech/20180411 How To Setup Static File Server Instantly.md b/sources/tech/20180411 How To Setup Static File Server Instantly.md deleted file mode 100644 index b925c75f1f..0000000000 --- a/sources/tech/20180411 How To Setup Static File Server Instantly.md +++ /dev/null @@ -1,173 +0,0 @@ -Transltaing by MjSeven - -How To Setup Static File Server Instantly -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/04/serve-720x340.png) -Ever wanted to share your files or project over network, but don’t know how to do? No worries! Here is a simple utility named **“serve”** to share your files instantly over network. This simple utility will instantly turn your system into a static file server, allowing you to serve your files over network. You can access the files from any devices regardless of their operating system. All you need is a web browser. This utility also can be used to serve static websites. It is formerly known as “list” and “micro-list”, but now the name has been changed to “serve”, which is much more suitable for the purpose of this utility. - -### Setup Static File Server Using Serve - -To install “serve”, you need to install NodeJS and NPM first. Refer the following link to install NodeJS and NPM in your Linux box. - -Once NodeJS and NPM installed, run the following command to install “serve”. -``` -$ npm install -g serve - -``` - -Done! Now is the time to serve the files or folders. - -The typical syntax to use “serve” is: -``` -$ serve [options] - -``` - -### Serve Specific files or folders - -For example, let us share the contents of the **Documents** directory. To do so, run: -``` -$ serve Documents/ - -``` - -Sample output would be: - -![][2] - -As you can see in the above screenshot, the contents of the given directory have been served over network via two URLs. - -To access the contents from the local system itself, all you have to do is open your web browser and navigate to **** URL. - -![][3] - -The Serve utility displays the contents of the given directory in a simple layout. You can download (right click on the files and choose “Save link as..”) or just view them in the browser. - -If you want to open local address automatically in the browser, use **-o** flag. -``` -$ serve -o Documents/ - -``` - -Once you run the above command, The Serve utility will open your web browser automatically and display the contents of the shared item. - -Similarly, to access the shared directory from a remote system over network, type **** in the browser’s address bar. Replace 192.168.43.192 with your system’s IP. - -**Serve contents via different port** - -As you may noticed, The serve utility uses port **5000** by default. So, make sure the port 5000 is allowed in your firewall or router. If it is blocked for some reason, you can serve the contents using different port using **-p** flag. -``` -$ serve -p 1234 Documents/ - -``` - -The above command will serve the contents of Documents directory via port **1234**. - -![][4] - -To serve a file, instead of a folder, just give it’s full path like below. -``` -$ serve Documents/Papers/notes.txt - -``` - -The contents of the shared directory can be accessed by any user on the network as long as they know the path. - -**Serve the entire $HOME directory** - -Open your Terminal and type: -``` -$ serve - -``` - -This will share the contents of your entire $HOME directory over network. - -To stop the sharing, press **CTRL+C**. - -**Serve selective files or folders** - -You may not want to share all files or directories, but only a few in a directory. You can do this by excluding the files or directories using **-i** flag. -``` -$ serve -i Downloads/ - -``` - -The above command will serve entire file system except **Downloads** directory. - -**Serve contents only on localhost** - -Sometimes, you want to serve the contents only on the local system itself, not on the entire network. To do so, use **-l** flag as shown below: -``` -$ serve -l Documents/ - -``` - -This command will serve the **Documents** directory only on localhost. - -![][5] - -This can be useful when you’re working on a shared server. All users in the in the system can access the share, but not the remote users. - -**Serve content using SSL** - -Since we serve the contents over the local network, we need not to use SSL. However, Serve utility has the ability to shares contents using SSL using **–ssl** flag. -``` -$ serve --ssl Documents/ - -``` - -![][6] - -To access the shares via web browser use “ or “. - -![][7] - -**Serve contents with authentication** - -In all above examples, we served the contents without any authentication. So anyone on the network can access them without any authentication. You might feel some contents should be accessed with username and password. - -To do so, use: -``` -$ SERVE_USER=ostechnix SERVE_PASSWORD=123456 serve --auth - -``` - -Now the users need to enter the username (i.e **ostechnix** in our case) and password (123456) to access the shares. - -![][8] - -The Serve utility has some other features, such as disable [**Gzip compression**][9], setup * CORS headers to allow requests from any origin, prevent copy address automatically to clipboard etc. You can read the complete help section by running the following command: -``` -$ serve help - -``` - -And, that’s all for now. Hope this helps. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-setup-static-file-server-instantly/ - -作者:[SK][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.ostechnix.com/author/sk/ -[1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-1.png -[3]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-2.png -[4]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-4.png -[5]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-3.png -[6]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-6.png -[7]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-5-1.png -[8]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-7-1.png -[9]:https://www.ostechnix.com/how-to-compress-and-decompress-files-in-linux/ diff --git a/translated/tech/20180411 How To Setup Static File Server Instantly.md b/translated/tech/20180411 How To Setup Static File Server Instantly.md new file mode 100644 index 0000000000..9f31dba91e --- /dev/null +++ b/translated/tech/20180411 How To Setup Static File Server Instantly.md @@ -0,0 +1,161 @@ +如何设置一个即时静态文件服务器 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/04/serve-720x340.png) + +曾经想通过网络共享你的文件或项目,但不知道怎么做?别担心!这里有一个名为 **serve** 的简单实用程序,可以通过网络即时共享你的文件。这个简单的实用程序会立即将你的系统变成一个静态文件服务器,允许你通过网络提供文件。你可以从任何设备访问这些文件,而不用担心它们的操作系统是什么。你所需的只是一个 Web 浏览器。这个实用程序还可以用来服务静态网站。它以前称为 “list” 或 “micri-list”,但现在名称已改为 “serve”,这更适合这个实用程序的目的。 + +### 使用 Serve 来设置一个静态文件服务器 + +要安装 "serve",首先你需要安装 NodeJS 和 NPM。参考以下链接在 Linux 中安装 NodeJS 和 NPM。 + + * [如何在 Linux 上安装 NodeJS](https://www.ostechnix.com/install-node-js-linux/) + +NodeJS 和 NPM 安装完成后,运行以下命令来安装 "serve": +``` +$ npm install -g serve +``` + +完成!现在是时候 serve 文件或文件夹了。 + +使用 "serve" 的典型语法是: +``` +$ serve [options] +``` + +### Serve 特定文件或文件夹 + +例如,让我们共享 **Documents** 目录里的内容。为此,运行: +``` +$ serve Documents/ +``` + +示例输出: +![][2] + +正如你在上图中看到的,给定目录的内容已通过两个 URL 提供网络支持。 + +要从本地系统访问内容,你只需打开 Web 浏览器,输入 **** URL: +![][3] + +Serve 实用程序以简单的布局显示给定目录的内容。你可以下载(右键单击文件并选择“将链接另存为...”)或只在浏览器中查看它们。 + +如果想要在浏览器中自动打开本地地址,使用 **-o** 选项。 +``` +$ serve -o Documents/ +``` + +运行上述命令后,Serve 实用程序将自动打开 Web 浏览器并显示共享项的内容。 + +同样,要通过网络从远程系统访问共享目录,可以在浏览器地址栏中输入 ****。用你系统的 IP 替换 192.168.43.192。 + +**通过不同的端口 Serve 内容** + +你可能已经注意到,默认情况下,serve 实用程序使用端口 **5000**。因此,确保防火墙或路由器中允许使用端口 5000。如果由于某种原因被阻止,你可以使用 **-p** 选项使用不同端口来提供内容。 +``` +$ serve -p 1234 Documents/ +``` + +上面的命令将通过端口 **1234** 提供 Documents 目录的内容。 +![][4] + +要提供文件而不是文件夹,只需给它完整的路径,如下所示。 +``` +$ serve Documents/Papers/notes.txt +``` + +只要知道路径,网络上的任何用户都可以访问共享目录的内容。 + +**Serve 整个 $HOME 目录** + +打开终端输入 +``` +$ serve +``` + +这将通过网络共享整个 $HOME 目录的内容。 + +要停止共享,按下 **CTRL+C**。 + +**Serve 选择的文件或文件夹** + +你可能不想共享所有文件或目录,只想共享其中的一些。你可以使用 **-i** 选项排除文件或目录。 +``` +$ serve -i Downloads/ +``` + +以上命令将 serve 整个文件系统,除了 **Downloads** 目录。 + +**仅在本地主机上提供内容** + +有时,你只想在本地系统而不是整个网络上 serve 内容。为此,使用 **-l** 标志,如下所示: +``` +$ serve -l Documents/ +``` + +此命令会仅在本地提供 **Documents** 目录。 + +![][5] + +当你在共享服务器上工作时,这可能会很有用。系统中的所有用户都可以访问共享,但远程用户不能。 + +**使用 SSL Serve 内容** + +由于我们通过本地网络 serve 内容,因此我们不需要使用 SSL。但是,serve 实用程序可以使用 **-ssl** 选项来使用 SSL 共享内容。 +``` +$ serve --ssl Documents/ +``` + +![][6] + +要通过 Web 浏览器访问共享,输入 “ 或 “. + +![][7] + +**通过身份验证 Serve 内容** + +在上面的所以示例中,我们在没有任何身份验证的情况下 serve 内容,所以网络上的任何人都可以在没有任何身份验证的情况下访问共享内容。你可能会觉得应该使用用户名和密码访问某些内容。 + +为此,使用: +``` +$ SERVE_USER=ostechnix SERVE_PASSWORD=123456 serve --auth +``` + +现在用户需要输入用户名(即 **ostechnix**)和密码(123456)来访问共享。(译者注:123456 是非常不好的密码,仅在实验情况下使用) + +![][8] + +Serve 实用程序还有一些其它功能,例如禁用 [**Gzip 压缩**][9],设置 **CORS** 头以允许来自任河源的请求,防止自动复制地址到剪贴板等。通过以下命令,你可以阅读完整的帮助部分。 +``` +$ serve help +``` + +好了,这就是全部了。希望这可以帮助到你。更多好东西要来了,敬请关注! + +共勉! + +来源: + + * [Serve GitHub 仓库](https://github.com/zeit/serve) + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-setup-static-file-server-instantly/ + +作者:[SK][a] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) +选题:[lujun9972](https://github.com/lujun9972) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.ostechnix.com/author/sk/ +[1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-1.png +[3]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-2.png +[4]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-4.png +[5]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-3.png +[6]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-6.png +[7]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-5-1.png +[8]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-7-1.png +[9]:https://www.ostechnix.com/how-to-compress-and-decompress-files-in-linux/ From 2da14044f004cf72373162ac3006ef884fdef625 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 12:01:10 +0800 Subject: [PATCH 0768/4278] PRF:20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @qhwdw --- ...aboratory - Raspberry Pi- Lesson 2 OK02.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md index 29fa885a4f..fbb35ce53a 100644 --- a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md +++ b/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 – 树莓派:课程 2 OK02 +计算机实验室之树莓派:课程 2 OK02 ====== -OK02 课程是在 OK01 课程的基础上构建,通过不停地打开和关闭 `OK` 或 `ACT` LED 指示灯来实现闪烁。假设你已经有了 [课程 1:OK01][1] 操作系统的代码,它将是这一节课的基础。 +OK02 课程构建于 OK01 课程的基础上,通过不停地打开和关闭 OK 或 ACT LED 指示灯来实现闪烁。假设你已经有了 [课程 1:OK01][1] 操作系统的代码,它将是这一节课的基础。 ### 1、等待 -等待是操作系统开发中非常有用的部分。操作系统经常发现自己无事可做,以及必须要延迟。在这个例子中,我们想去做等待,为了能够让这种等待可以看得见,让 LED 灯打开关闭闪烁起来。如果你只是打开和关闭它,你什么都看不到,因为计算机每秒种可以打开和关闭它好几千次。在后面的课程中,我们将看到精确的等待,但是现在,我们只要简单地去消耗时间就足够了。 +等待是操作系统开发中非常有用的部分。操作系统经常发现自己无事可做,以及必须要延迟。在这个例子中,我们希望通过等待,让 LED 灯打开、关闭的闪烁可以看到。如果你只是打开和关闭它,你将看到这个视觉效果,因为计算机每秒种可以打开和关闭它好几千次(LCTT 译注:视觉暂留效应会使你难以发觉它的闪烁)。在后面的课程中,我们将看到精确的等待,但是现在,我们只要简单地去消耗时间就足够了。 ``` mov r2,#0x3F0000 @@ -24,33 +24,31 @@ cmp r2,#0 bne wait1$ ``` -``` -sub reg,#val 从寄存器 reg 中的值上减去数字 val +> `sub reg,#val` 从寄存器 `reg` 中的值上减去数字 `val` +> +> `cmp reg,#val` 将寄存器中的值与数字 `val` 进行比较。 +> +> 如果最后的比较结果是不相等,那么执行后缀了 `ne` 的 `b` 命令。 -cmp reg,#val 将寄存器中的值与数字 val 进行比较。 - -如果最后的比较结果是不相等,那么执行后面的 ne 命令。 -``` - -上面是一个很常见的产生延迟的代码片段,由于每个树莓派基本上是相同的,所以产生的延迟大致也是相同的。它的工作原理是,使用一个 `mov` 命令将值 3F000016 推入到寄存器 r2 中,然后将这个值减 1,直到这个值减到 0 为止。在这里使用了三个新命令 `sub`、 `cmp` 和 `bne`。 +上面是一个很常见的产生延迟的代码片段,由于每个树莓派基本上是相同的,所以产生的延迟大致也是相同的。它的工作原理是,使用一个 `mov` 命令将值 3F000016 推入到寄存器 `r2` 中,然后将这个值减 1,直到这个值减到 0 为止。在这里使用了三个新命令 `sub`、 `cmp` 和 `bne`。 `sub` 是减法命令,它只是简单地从第一个参数中的值减去第二个参数中的值。 `cmp` 是个很有趣的命令。它将第一个参数与第二个参数进行比较,然后将比较结果记录到一个称为当前处理器状态寄存器的专用寄存器中。你其实不用担心它,它记住的只是两个数谁大或谁小,或是相等而已。[^1] -`bne` 其实是一个伪装的分支命令。在 ARM 汇编语言家族中,任何指令都可以有条件运行。这意味着如果上一个比较结果是某个确定的结果,那个指令才会运行。这是个非常有意思的技巧,我们在后面将大量使用到它,但在本案例中,我们在 `b` 命令后面的 ne 后缀意思是 “只有在上一个比较的结果是值不相等,才去运行分支”。`ne` 后缀可以使用在任何命令上,其它几个(总共 16 个)条件也是如此,比如 `eq` 表示等于,而 `lt` 表示小于。 +`bne` 其实是一个伪装的分支命令。在 ARM 汇编语言家族中,任何指令都可以有条件地运行。这意味着如果上一个比较结果是某个确定的结果,那个指令才会运行。这是个非常有意思的技巧,我们在后面将大量使用到它,但在本案例中,我们在 `b` 命令后面的 `ne` 后缀意思是 “只有在上一个比较的结果是值不相等,才去运行该分支”。`ne` 后缀可以使用在任何命令上,其它几个(总共 16 个)条件也是如此,比如 `eq` 表示等于,而 `lt` 表示小于。 ### 2、组合到一起 -上一节讲我提到过,通过将 GPIO 地址偏移量设置为 28(即:str r1,[r0,#28])而不是 40 即可实现 LED 的关闭。因此,你需要去修改课程 OK01 的代码,在打开 LED 后,运行等待代码,然后再关闭 LED,再次运行等待代码,并包含一个回到开始位置的分支。注意,不需要重新启用 GPIO 的 16 号针脚的输出功能,这个操作只需要做一次就可以了。如果你想更高效,我建议你复用 r1 寄存器的值。所有课程都一样,你可以在 [下载页面][2] 找到所有的解决方案。需要注意的是,必须保证你的所有标签都是唯一的。当你写了 wait1\$: 你其它行上的标签就不能再使用 wait1\$ 了。 +上一节讲我提到过,通过将 GPIO 地址偏移量设置为 28(即:`str r1,[r0,#28]`)而不是 40 即可实现 LED 的关闭。因此,你需要去修改课程 OK01 的代码,在打开 LED 后,运行等待代码,然后再关闭 LED,再次运行等待代码,并包含一个回到开始位置的分支。注意,不需要重新启用 GPIO 的 16 号针脚的输出功能,这个操作只需要做一次就可以了。如果你想更高效,我建议你复用 `r1` 寄存器的值。所有课程都一样,你可以在 [下载页面][2] 找到所有的解决方案。需要注意的是,必须保证你的所有标签都是唯一的。当你写了 `wait1$:` 你其它行上的标签就不能再使用 `wait1$` 了。 -在我的树莓派上,它大约是每秒闪两次。通过改变我们所设置的 r2 寄存器中的值,可以很轻松地修改它。但是,不幸的是,我不能够精确地预测它的运行速度。如果你的树莓派未按预期正常工作,请查看我们的故障排除页面,如果它正常工作,恭喜你。 +在我的树莓派上,它大约是每秒闪两次。通过改变我们所设置的 `r2` 寄存器中的值,可以很轻松地修改它。但是,不幸的是,我不能够精确地预测它的运行速度。如果你的树莓派未按预期正常工作,请查看我们的故障排除页面,如果它正常工作,恭喜你。 在这个课程中,我们学习了另外两个汇编命令:`sub` 和 `cmp`,同时学习了 ARM 中如何实现有条件运行。 在下一个课程,[课程 3:OK03][3] 中我们将学习如何编写代码,以及建立一些代码复用的标准,并且如果需要的话,可能会使用 C 或 C++ 来写代码。 -[^1]:如果你点了这个链接,说明你一定想知道它的具体内容。CPSR 是一个由许多独立的比特位组成的 32 比特寄存器。它有一个位用于表示正数、零和负数。当一个 cmp 指令运行后,它从第一个参数上减去第二个参数,然后用这个位记下它的结果是正数、零还是负数。如果是零意味着它们相等(a-b=0 暗示着 a=b)如果为正数意味着 a 大于 b(a-b>0 暗示着 a>b),如果为负数意味着小于。还有其它比较指令,但 cmp 指令最直观。 +[^1]: 如果你点了这个链接,说明你一定想知道它的具体内容。CPSR 是一个由许多独立的比特位组成的 32 比特寄存器。它有一个位用于表示正数、零和负数。当一个 `cmp` 指令运行后,它从第一个参数上减去第二个参数,然后用这个位记下它的结果是正数、零还是负数。如果是零意味着它们相等(`a-b=0` 暗示着 `a=b`)如果为正数意味着 a 大于 b(`a-b>0` 暗示着 `a>b`),如果为负数意味着小于。还有其它比较指令,但 `cmp` 指令最直观。 -------------------------------------------------------------------------------- @@ -59,12 +57,12 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.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/ok01.html +[1]: https://linux.cn/article-10458-1.html [2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html [3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html From 4fdd5329ecb919391f2f6e9b3f0d2159895949c6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 12:01:45 +0800 Subject: [PATCH 0769/4278] PUB:20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @qhwdw https://linux.cn/article-10478-1.html --- ...20202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md (98%) diff --git a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md similarity index 98% rename from translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md rename to published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md index fbb35ce53a..04d233bcae 100644 --- a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md +++ b/published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10478-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From 54cd7d46560af1a734499e0ca4a77d867a6b41f7 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 26 Jan 2019 12:57:07 +0800 Subject: [PATCH 0770/4278] Translating 20180809 Perform robust... --- .../tech/20180809 Perform robust unit tests with PyHamcrest.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md b/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md index 1c7d7e9226..19bedfc8c5 100644 --- a/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md +++ b/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md @@ -1,3 +1,5 @@ +Translating by MjSeven + Perform robust unit tests with PyHamcrest ====== From 0e59858120983aa1c51572de33beecb317ebe5d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 14:56:21 +0800 Subject: [PATCH 0771/4278] =?UTF-8?q?=E9=80=89=E9=A2=98=EF=BC=9A20180507?= =?UTF-8?q?=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 | 68 +++++++++++++++++++ 1 file changed, 68 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..22a178fbc5 --- /dev/null +++ b/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md @@ -0,0 +1,68 @@ +Modularity in Fedora 28 Server Edition +======== + +![](https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-1024x433.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/working-modules-fedora-28/ + +作者:[Stephen Gallagher][a] +选题:[wxy](https://github.com/wxy) +译者:[译者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/ +[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 04a95b607f8466a13f98a26d7df3a7ac114a46a4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 15:36:38 +0800 Subject: [PATCH 0772/4278] TRD:20180507 Modularity in Fedora 28 Server Edition.md --- ... Modularity in Fedora 28 Server Edition.md | 68 ------------------- ... Modularity in Fedora 28 Server Edition.md | 68 +++++++++++++++++++ 2 files changed, 68 insertions(+), 68 deletions(-) delete mode 100644 sources/tech/20180507 Modularity in Fedora 28 Server Edition.md create mode 100644 translated/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 deleted file mode 100644 index 22a178fbc5..0000000000 --- a/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md +++ /dev/null @@ -1,68 +0,0 @@ -Modularity in Fedora 28 Server Edition -======== - -![](https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-1024x433.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/working-modules-fedora-28/ - -作者:[Stephen Gallagher][a] -选题:[wxy](https://github.com/wxy) -译者:[译者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/ -[1]: https://fedoraproject.org/wiki/Updates_Policy#Stable_Releases -[2]: https://www.softwarecollections.org/ -[3]: https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2018-2b0846cb86 - diff --git a/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md b/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md new file mode 100644 index 0000000000..d3fff6eace --- /dev/null +++ b/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md @@ -0,0 +1,68 @@ +Fedora 28 服务器版的模块化 +======== + +![](https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-1024x433.jpg) + +### 什么是模块化 + +所有开源发行版都面临的一个经典难题是“太快/太慢”的问题。用户安装操作系统是为了能够使用其应用程序。像 Fedora 这样的全面的发行版对大量可用软件有优势和劣势。虽然用户想要的软件包可用,但可能无法在所需的版本中使用。以下是模块化Modularity如何帮助解决该问题。 + +对于某些用户,Fedora 有时升级得太快。其快速发布周期以及尽可能提供最新稳定软件的愿望可能导致与应用程序的兼容性下降。如果因为 Fedora 将 Web 框架升级为不兼容的版本而导致用户无法运行 Web 应用程序,则会非常令人沮丧。对“太快”问题的经典回答是“Fedora 应该有一个 LTS 版本。”然而,这种方法只能解决问题的一半,并使这个难题的另一面变得更糟。 + +有时候 Fedora 对某些用户而言又升级速度太慢。例如,Fedora 的发布可能与其他想要的软件的发布时间不匹配。一旦 Fedora 版本宣布稳定,打包者必须遵守 [稳定更新政策][1] 并且不能在系统中引入不兼容的更改。 + +Fedora 的模块化从两个方面解决了这个问题。Fedora 仍将根据其传统政策发布标准版本。但是,它还将提供一组模块给出流行软件的限定了的替代版本。那些处于“太快”阵营的人仍然可以享受 Fedora 的新内核和其他通用平台增强功能。此外,他们仍然可以访问支持其应用程序的旧框架或工具链。 + +此外,那些喜欢更先锐一些的用户可以访问比发布时更新的软件。 + +### Modularity 不是什么? + +模块化不是 [软件集合][2]Software Collections 的直接替代品。这两种技术试图解决许多相同的问题,但有明显的差异。 + +软件集合可以在系统上并行安装不同版本的软件包。但是,它们的缺点是每份安装包都存在于文件系统上的它们自己的命名空间部分。此外,需要告诉每个依赖它们的应用程序在哪里找到它们。 + +使用模块化,系统上只存在一个版本的软件包,但用户可以选择哪个版本。优点是该版本位于系统的标准位置。该程序包不需要对依赖它的应用程序进行特殊更改。来自用户研究的反馈表明,大多数用户实际上并不依赖于并行安装。容器化和虚拟化解决了这个问题。 + +### 为什么不干脆使用容器化? + +这是另一个常见问题。为什么用户在可以使用容器时还需要模块?答案是,人们仍然需要维护容器中的软件。 模块为那些用户不需要自己维护、更新和修补的容器提供预打包的内容。这就是 Fedora 如何利用发行版的传统价值并将其转移到新的容器化的世界。 + +以下是模块化如何为 Node.js 和 Review Board 的用户解决问题的示例。 + +### Node.js + +许多读者可能熟悉 Node.js,这是一个流行的服务器端 JavaScript 运行时环境。 Node.js 具有偶数/奇数版本策略。它的社区支持偶数版本(6.x、8.x、10.x 等)约 30 个月。同时,他们也支持奇数版本,基本上是 9 个月的开发者预览。 + +由于这个周期的原因,Fedora 在其稳定的存储库中只携带最新的偶数版本的 Node.js。它完全避免了奇数版本,因为它们的生命周期比 Fedora 短,并且通常与 Fedora 发布周期不一致。对于一些希望获得最新和最大增强功能的 Fedora 用户来说,这并不合适。 + +由于模块化,Fedora 28 不仅提供了一个,而是提供了三个版本的 Node.js,以满足开发人员和稳定部署的需求。Fedora 28 的传统存储库带有 Node.js 8.x。此版本是发布时最新的长期稳定版本。模块存储库(默认情况下在 Fedora 28 Server 版本上可用)也使得更旧的 Node.js 6.x 版本和更新的 Node.js 9.x 开发版本可用。 + +另外,Node.js 在 Fedora 28 之后几天发布 10.x 上游版本。过去,想要部署该版本的用户必须等到 Fedora 29,或者使用来自 Fedora 之外的源代码。但是,再次感谢模块化,Node.js 10.x 已经在 Fedora 28 的 Modular Updates-Testing 存储库中 [可用][3] 了。 + +### Review Board + +Review Board 是一个流行的 Django 应用程序,用于执行代码审查。Fedora 从 Fedora 13 到 Fedora 21 都包括了 Review Board。此时,Fedora 转移到了 Django 1.7。由于 Django 数据库支持的向后兼容性不断变化,Review Board 无法跟上。它在 RHEL / CentOS 7 的 EPEL 存储库中仍然存在,而仅仅是因为这些发行版版本幸运地被冻结在 Django 1.6上。尽管如此,它在 Fedora 的时代显然已经过去了。 + +然而,随着模块化的出现,Fedora 能够再次将旧的 Django 作为非默认模块流发布。因此,Review Board 已作为一个模块在 Fedora 上恢复了。Fedora 承载了来自上游的两个受支持的版本:2.5.x 和 3.0.x. + + +### 组合在一起 + +Fedora 一直为用户提供非常广泛的软件使用。Fedora 模块化现在为他们所需的软件版本提供了更深入的选择。接下来的几年对于 Fedora 来说将是非常令人兴奋的,因为开发人员和用户可以以新的和令人兴奋的(或旧的和令人兴奋的)方式组合他们的软件。 + +------ + +via: https://fedoramagazine.org/working-modules-fedora-28/ + +作者:[Stephen Gallagher][a] +选题:[wxy](https://github.com/wxy) +译者:[wxy](https://github.com/wxy) +校对:[校对ID](https://github.com/校对ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/sgallagh/ +[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 12ea9ff57913de9e6efc20e0789cdf7ccfc1d10f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 15:58:41 +0800 Subject: [PATCH 0773/4278] PRF:20180507 Modularity in Fedora 28 Server Edition.md --- ... Modularity in Fedora 28 Server Edition.md | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md b/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md index d3fff6eace..b4247bae8c 100644 --- a/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md +++ b/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md @@ -5,21 +5,21 @@ Fedora 28 服务器版的模块化 ### 什么是模块化 -所有开源发行版都面临的一个经典难题是“太快/太慢”的问题。用户安装操作系统是为了能够使用其应用程序。像 Fedora 这样的全面的发行版对大量可用软件有优势和劣势。虽然用户想要的软件包可用,但可能无法在所需的版本中使用。以下是模块化Modularity如何帮助解决该问题。 +所有开源发行版都面临的一个经典难题是“太快/太慢”的问题。用户安装操作系统是为了能够使用其应用程序。像 Fedora 这样的全面的发行版在大量可用软件方面有其优势和劣势。虽然有用户想要的软件包,但可能无法使用其所需的版本。以下是模块化Modularity如何帮助解决该问题。 对于某些用户,Fedora 有时升级得太快。其快速发布周期以及尽可能提供最新稳定软件的愿望可能导致与应用程序的兼容性下降。如果因为 Fedora 将 Web 框架升级为不兼容的版本而导致用户无法运行 Web 应用程序,则会非常令人沮丧。对“太快”问题的经典回答是“Fedora 应该有一个 LTS 版本。”然而,这种方法只能解决问题的一半,并使这个难题的另一面变得更糟。 -有时候 Fedora 对某些用户而言又升级速度太慢。例如,Fedora 的发布可能与其他想要的软件的发布时间不匹配。一旦 Fedora 版本宣布稳定,打包者必须遵守 [稳定更新政策][1] 并且不能在系统中引入不兼容的更改。 +有时候 Fedora 对某些用户而言又升级速度太慢。例如,Fedora 的发布可能与其它想要的软件的发布时间不匹配。一旦 Fedora 版本宣布稳定,打包者必须遵守 [稳定更新政策][1] 并且不能在系统中引入不兼容的更改。 -Fedora 的模块化从两个方面解决了这个问题。Fedora 仍将根据其传统政策发布标准版本。但是,它还将提供一组模块给出流行软件的限定了的替代版本。那些处于“太快”阵营的人仍然可以享受 Fedora 的新内核和其他通用平台增强功能。此外,他们仍然可以访问支持其应用程序的旧框架或工具链。 +Fedora 的模块化从两个方面解决了这个问题。Fedora 仍将根据其传统政策发布标准版本。但是,它还将提供一组模块给出流行软件的限定替代版本。那些处于“太快”阵营的人仍然可以享受 Fedora 的新内核和其它通用平台增强功能。此外,他们仍然可以访问支持其应用程序的旧框架或工具链。 -此外,那些喜欢更先锐一些的用户可以访问比发布时更新的软件。 +此外,那些喜欢更新潮一些的用户可以访问比发布时更新的软件。 -### Modularity 不是什么? +### 模块化不是什么? 模块化不是 [软件集合][2]Software Collections 的直接替代品。这两种技术试图解决许多相同的问题,但有明显的差异。 -软件集合可以在系统上并行安装不同版本的软件包。但是,它们的缺点是每份安装包都存在于文件系统上的它们自己的命名空间部分。此外,需要告诉每个依赖它们的应用程序在哪里找到它们。 +软件集合可以在系统上并行安装不同版本的软件包。但是,它们的缺点是每份安装包都存在于文件系统上的它们自己的命名空间里面。此外,需要告诉每个依赖它们的应用程序在哪里找到它们。 使用模块化,系统上只存在一个版本的软件包,但用户可以选择哪个版本。优点是该版本位于系统的标准位置。该程序包不需要对依赖它的应用程序进行特殊更改。来自用户研究的反馈表明,大多数用户实际上并不依赖于并行安装。容器化和虚拟化解决了这个问题。 @@ -31,20 +31,19 @@ Fedora 的模块化从两个方面解决了这个问题。Fedora 仍将根据其 ### Node.js -许多读者可能熟悉 Node.js,这是一个流行的服务器端 JavaScript 运行时环境。 Node.js 具有偶数/奇数版本策略。它的社区支持偶数版本(6.x、8.x、10.x 等)约 30 个月。同时,他们也支持奇数版本,基本上是 9 个月的开发者预览。 +许多读者可能熟悉 Node.js,这是一个流行的服务器端 JavaScript 运行时环境。Node.js 采用偶数/奇数版本策略。它的社区支持偶数版本(6.x、8.x、10.x 等)约 30 个月。同时,他们也支持奇数版本,基本上是 9 个月的开发者预览版。 -由于这个周期的原因,Fedora 在其稳定的存储库中只携带最新的偶数版本的 Node.js。它完全避免了奇数版本,因为它们的生命周期比 Fedora 短,并且通常与 Fedora 发布周期不一致。对于一些希望获得最新和最大增强功能的 Fedora 用户来说,这并不合适。 +由于这个周期的原因,Fedora 在其稳定的仓库中只携带最新的偶数版本的 Node.js。它完全避免了奇数版本,因为它们的生命周期比 Fedora 短,并且通常与 Fedora 发布周期不一致。对于一些希望获得最新和最大增强功能的 Fedora 用户来说,这并不合适。 -由于模块化,Fedora 28 不仅提供了一个,而是提供了三个版本的 Node.js,以满足开发人员和稳定部署的需求。Fedora 28 的传统存储库带有 Node.js 8.x。此版本是发布时最新的长期稳定版本。模块存储库(默认情况下在 Fedora 28 Server 版本上可用)也使得更旧的 Node.js 6.x 版本和更新的 Node.js 9.x 开发版本可用。 +由于模块化,Fedora 28 不是提供了一个版本,而是提供了三个版本的 Node.js,以满足开发人员和稳定部署的需求。Fedora 28 的传统仓库带有 Node.js 8.x。此版本是发布时最新的长期稳定版本。模块仓库(默认情况下在 Fedora 28 Server 版本上可用)也使得更旧的 Node.js 6.x 版本和更新的 Node.js 9.x 开发版本可用。 -另外,Node.js 在 Fedora 28 之后几天发布 10.x 上游版本。过去,想要部署该版本的用户必须等到 Fedora 29,或者使用来自 Fedora 之外的源代码。但是,再次感谢模块化,Node.js 10.x 已经在 Fedora 28 的 Modular Updates-Testing 存储库中 [可用][3] 了。 +另外,Node.js 在 Fedora 28 之后几天发布了 10.x 上游版本。过去,想要部署该版本的用户必须等到 Fedora 29,或者使用来自 Fedora 之外的源代码。但是,再次感谢模块化,Node.js 10.x 已经在 Fedora 28 的 Modular Updates-Testing 仓库中 [可用][3] 了。 ### Review Board -Review Board 是一个流行的 Django 应用程序,用于执行代码审查。Fedora 从 Fedora 13 到 Fedora 21 都包括了 Review Board。此时,Fedora 转移到了 Django 1.7。由于 Django 数据库支持的向后兼容性不断变化,Review Board 无法跟上。它在 RHEL / CentOS 7 的 EPEL 存储库中仍然存在,而仅仅是因为这些发行版版本幸运地被冻结在 Django 1.6上。尽管如此,它在 Fedora 的时代显然已经过去了。 - -然而,随着模块化的出现,Fedora 能够再次将旧的 Django 作为非默认模块流发布。因此,Review Board 已作为一个模块在 Fedora 上恢复了。Fedora 承载了来自上游的两个受支持的版本:2.5.x 和 3.0.x. +Review Board 是一个流行的 Django 应用程序,用于执行代码审查。Fedora 从 Fedora 13 到 Fedora 21 都包括了 Review Board。此时,Fedora 转移到了 Django 1.7。由于 Django 数据库支持的向后兼容性在不断变化,而 Review Board 无法跟上。它在 RHEL / CentOS 7 的 EPEL 仓库中仍然存在,而仅仅是因为这些发行版的版本幸运地被冻结在 Django 1.6上。尽管如此,它在 Fedora 的时代显然已经过去了。 +然而,随着模块化的出现,Fedora 能够再次将旧的 Django 作为非默认模块流发布。因此,Review Board 已作为一个模块在 Fedora 上恢复了。Fedora 承载了来自上游的两个受支持的版本:2.5.x 和 3.0.x。 ### 组合在一起 @@ -57,7 +56,7 @@ via: https://fedoramagazine.org/working-modules-fedora-28/ 作者:[Stephen Gallagher][a] 选题:[wxy](https://github.com/wxy) 译者:[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 d9f7de121e66621bb3fa650af2a8d884fbe8789f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 15:59:47 +0800 Subject: [PATCH 0774/4278] PUB:20180507 Modularity in Fedora 28 Server Edition.md @wxy https://linux.cn/article-10479-1.html --- .../20180507 Modularity in Fedora 28 Server Edition.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180507 Modularity in Fedora 28 Server Edition.md (100%) diff --git a/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md b/published/20180507 Modularity in Fedora 28 Server Edition.md similarity index 100% rename from translated/tech/20180507 Modularity in Fedora 28 Server Edition.md rename to published/20180507 Modularity in Fedora 28 Server Edition.md From ac9574176320a4b6b010016f63a77781ffc807f2 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 26 Jan 2019 20:55:38 +0800 Subject: [PATCH 0775/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=2020180809=20Perform=20robust...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rform robust unit tests with PyHamcrest.md | 178 ------------------ ...rform robust unit tests with PyHamcrest.md | 132 +++++++++++++ 2 files changed, 132 insertions(+), 178 deletions(-) delete mode 100644 sources/tech/20180809 Perform robust unit tests with PyHamcrest.md create mode 100644 translated/tech/20180809 Perform robust unit tests with PyHamcrest.md diff --git a/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md b/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md deleted file mode 100644 index 19bedfc8c5..0000000000 --- a/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md +++ /dev/null @@ -1,178 +0,0 @@ -Translating by MjSeven - -Perform robust unit tests with PyHamcrest -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) - -At the base of the [testing pyramid][1] are unit tests. Unit tests test one unit of code at a time—usually one function or method. - -Often, a single unit test is designed to test one particular flow through a function, or a specific branch choice. This enables easy mapping of a unit test that fails and the bug that made it fail. - -Ideally, unit tests use few or no external resources, isolating them and making them faster. - -_Good_ tests increase developer productivity by catching bugs early and making testing faster. _Bad_ tests decrease developer productivity. - -Unit test suites help maintain high-quality products by signaling problems early in the development process. An effective unit test catches bugs before the code has left the developer machine, or at least in a continuous integration environment on a dedicated branch. This marks the difference between good and bad unit tests:tests increase developer productivity by catching bugs early and making testing faster.tests decrease developer productivity. - -Productivity usually decreases when testing _incidental features_. The test fails when the code changes, even if it is still correct. This happens because the output is different, but in a way that is not part of the function's contract. - -A good unit test, therefore, is one that helps enforce the contract to which the function is committed. - -If a unit test breaks, the contract is violated and should be either explicitly amended (by changing the documentation and tests), or fixed (by fixing the code and leaving the tests as is). - -While limiting tests to enforce only the public contract is a complicated skill to learn, there are tools that can help. - -One of these tools is [Hamcrest][2], a framework for writing assertions. Originally invented for Java-based unit tests, today the Hamcrest framework supports several languages, including [Python][3]. - -Hamcrest is designed to make test assertions easier to write and more precise. -``` -def add(a, b): - -    return a + b - - - -from hamcrest import assert_that, equal_to - - - -def test_add(): - -    assert_that(add(2, 2), equal_to(4))   - -``` - -This is a simple assertion, for simple functionality. What if we wanted to assert something more complicated? -``` -def test_set_removal(): - -    my_set = {1, 2, 3, 4} - -    my_set.remove(3) - -    assert_that(my_set, contains_inanyorder([1, 2, 4])) - -    assert_that(my_set, is_not(has_item(3))) - -``` - -Note that we can succinctly assert that the result has `1`, `2`, and `4` in any order since sets do not guarantee order. - -We also easily negate assertions with `is_not`. This helps us write _precise assertions_ , which allow us to limit ourselves to enforcing public contracts of functions. - -Sometimes, however, none of the built-in functionality is _precisely_ what we need. In those cases, Hamcrest allows us to write our own matchers. - -Imagine the following function: -``` -def scale_one(a, b): - -    scale = random.randint(0, 5) - -    pick = random.choice([a,b]) - -    return scale * pick - -``` - -We can confidently assert that the result divides into at least one of the inputs evenly. - -A matcher inherits from `hamcrest.core.base_matcher.BaseMatcher`, and overrides two methods: -``` -class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher): - - - -    def __init__(self, factor): - -        self.factor = factor - - - -    def _matches(self, item): - -        return (item % self.factor) == 0 - - - -    def describe_to(self, description): - -        description.append_text('number divisible by') - -        description.append_text(repr(self.factor)) - -``` - -Writing high-quality `describe_to` methods is important, since this is part of the message that will show up if the test fails. -``` -def divisible_by(num): - -    return DivisibleBy(num) - -``` - -By convention, we wrap matchers in a function. Sometimes this gives us a chance to further process the inputs, but in this case, no further processing is needed. -``` -def test_scale(): - -    result = scale_one(3, 7) - -    assert_that(result, - -                any_of(divisible_by(3), - -                       divisible_by(7))) - -``` - -Note that we combined our `divisible_by` matcher with the built-in `any_of` matcher to ensure that we test only what the contract commits to. - -While editing this article, I heard a rumor that the name "Hamcrest" was chosen as an anagram for "matches". Hrm... -``` ->>> assert_that("matches", contains_inanyorder(*"hamcrest") - -Traceback (most recent call last): - -  File "", line 1, in - -  File "/home/moshez/src/devops-python/build/devops/lib/python3.6/site-packages/hamcrest/core/assert_that.py", line 43, in assert_that - -    _assert_match(actual=arg1, matcher=arg2, reason=arg3) - -  File "/home/moshez/src/devops-python/build/devops/lib/python3.6/site-packages/hamcrest/core/assert_that.py", line 57, in _assert_match - -    raise AssertionError(description) - -AssertionError: - -Expected: a sequence over ['h', 'a', 'm', 'c', 'r', 'e', 's', 't'] in any order - -      but: no item matches: 'r' in ['m', 'a', 't', 'c', 'h', 'e', 's'] - -``` - -Researching more, I found the source of the rumor: It is an anagram for "matchers". -``` ->>> assert_that("matchers", contains_inanyorder(*"hamcrest")) - ->>> - -``` - -If you are not yet writing unit tests for your Python code, now is a good time to start. If you are writing unit tests for your Python code, using Hamcrest will allow you to make your assertion _precise_ —neither more nor less than what you intend to test. This will lead to fewer false positives when modifying code and less time spent modifying tests for working code. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/8/robust-unit-tests-hamcrest - -作者:[Moshe Zadka][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/moshez -[1]:https://martinfowler.com/bliki/TestPyramid.html -[2]:http://hamcrest.org/ -[3]:https://www.python.org/ diff --git a/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md b/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md new file mode 100644 index 0000000000..5d44d86bce --- /dev/null +++ b/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md @@ -0,0 +1,132 @@ +Perform robust unit tests with PyHamcrest +使用 PyHamcrest 执行健壮的单元测试 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +在[测试金字塔][1]的底部是单元测试。单元测试每次只测试一个代码单元,通常是一个函数或方法。 + +通常,设计单个单元测试是为了测试通过函数或特定分支选择的特定流,这使得失败的单元测试和导致失败的 bug 之间的映射变得容易。 + +理想情况下,单元测试使用很少或不使用外部资源,从而隔离它们并使它们更快。 + +_好_ 测试通过尽早发现 bug 并加快测试速度来提高开发人员的工作效率。_坏_ 测试降低了开发人员的工作效率。 + +单元测试套件通过在开发过程的早期发现问题来帮助维护高质量的产品。有效的单元测试在代码离开开发人员机器之前捕获 bug,或者至少在特定分支上的持续集成环境中捕获 bug。这标志着好的和坏的单元测试之间的区别:好的测试通过尽早捕获 bug 并使测试更快来提高开发人员的生产力。坏的测试降低了开发人员的工作效率。 + +当测试 _附带的特性_ 时,生产率通常会降低。当代码更改时测试失败,即时它仍然是正确的。发生这种情况是因为输出不同,但在某种程度上它不是函数契约的一部分。 + +因此,一个好的单元测试可以帮助执行函数所提交的契约。 + +如果单元测试中断,那意味着契约被违反了,应该明确修改(通过更改文档和测试),或者被修复(通过修复代码并保持测试不变)。 + +虽然将测试限制为只执行公共契约是一项需要学习的复杂技能,但有一些工具可以提供帮助。 + +其中一个工具是 [Hamcrest][2],一个用于编写断言的框架。最初是为基于 Java 的单元测试而发明的,它现在支持多种语言,包括 [Python][3]。 + +Hamcrest 旨在使测试断言更容易编写和更精确。 + +``` +def add(a, b): +    return a + b + +from hamcrest import assert_that, equal_to + +def test_add(): +    assert_that(add(2, 2), equal_to(4))   +``` + +这是一个用于简单功能的断言。如果我们想要断言更复杂的怎么办? +``` +def test_set_removal(): +    my_set = {1, 2, 3, 4} +    my_set.remove(3) +    assert_that(my_set, contains_inanyorder([1, 2, 4])) +    assert_that(my_set, is_not(has_item(3))) +``` + +注意,我们可以简单地断言结果的顺序为 `1`, `2` 和 `4`,因为集合不保证顺序。 + +我们也可以很容易用 `is_not` 来否定断言。这有助于我们编写 _精确的断言_,使我们能够把自己限制在执行职能的公共契约方面。 + +然而,有时候,内置功能都不是我们 _真正_ 需要的。在这些情况下,Hamcrest 允许我们编写自己的匹配器。 + +想象一下以下功能: +``` +def scale_one(a, b): +    scale = random.randint(0, 5) +    pick = random.choice([a,b]) +    return scale * pick +``` + +我们可以自信地断言结果均匀地划分为至少一个输入。(to 校正:???什么意思) + +匹配器继承自 `hamcrest.core.base_matcher.BaseMatcher`,重写两个方法: +``` +class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher): +    def __init__(self, factor): +        self.factor = factor + +    def _matches(self, item): +        return (item % self.factor) == 0 + +    def describe_to(self, description): +        description.append_text('number divisible by') +        description.append_text(repr(self.factor)) +``` + +编写高质量的 `describe_to` 方法很重要,因为这是测试失败时显示的消息的一部分。 +``` +def divisible_by(num): +    return DivisibleBy(num) +``` + +按照惯例,我们将匹配器包装在一个函数中。有时这给了我们进一步处理输入的机会,但在这种情况下,我们不需要进一步处理。 +``` +def test_scale(): +    result = scale_one(3, 7) +    assert_that(result, +                any_of(divisible_by(3), +                divisible_by(7))) +``` + +请注意,我们将 `divisible_by` 匹配器与内置的 `any_of` 匹配器结合起来,以确保我们只测试函数提交的内容。 + +在编辑这篇文章时,我听到一个传言,“Hamcrest” 这个名字被认为是 “matches” 的字谜。人力资源管理... +``` +>>> assert_that("matches", contains_inanyorder(*"hamcrest") +Traceback (most recent call last): +  File "", line 1, in +  File "/home/moshez/src/devops-python/build/devops/lib/python3.6/site-packages/hamcrest/core/assert_that.py", line 43, in assert_that +    _assert_match(actual=arg1, matcher=arg2, reason=arg3) +  File "/home/moshez/src/devops-python/build/devops/lib/python3.6/site-packages/hamcrest/core/assert_that.py", line 57, in _assert_match +    raise AssertionError(description) +AssertionError: +Expected: a sequence over ['h', 'a', 'm', 'c', 'r', 'e', 's', 't'] in any order +      but: no item matches: 'r' in ['m', 'a', 't', 'c', 'h', 'e', 's'] +``` + +经过进一步的研究,我找到了谣言的来源:它是 “matchers” 的字谜。 +``` +>>> assert_that("matchers", contains_inanyorder(*"hamcrest")) +>>> +``` + +如果你还没有为你的 Python 代码编写单元测试,那么现在是开始的好时机。如果你正在为你的 Python 代码编写单元测试,那么使用 Hamcrest 将允许你使你的断言更加 _精确_,既不会比你想要测试的多也不会少。这将在修改代码时减少误报,并减少修改工作代码的测试所花费的时间。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/8/robust-unit-tests-hamcrest + +作者:[Moshe Zadka][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/moshez +[1]:https://martinfowler.com/bliki/TestPyramid.html +[2]:http://hamcrest.org/ +[3]:https://www.python.org/ From 259b2f466cdeee8a360588b9b39a6bc17499acaf Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Sat, 26 Jan 2019 21:37:05 +0800 Subject: [PATCH 0776/4278] =?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/talk/20190114 Remote Working Survival Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190114 Remote Working Survival Guide.md b/sources/talk/20190114 Remote Working Survival Guide.md index 42b151f4cb..b21fd8f400 100644 --- a/sources/talk/20190114 Remote Working Survival Guide.md +++ b/sources/talk/20190114 Remote Working Survival Guide.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (beamrolling) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d80a73c8f0ed441266d3df10c8819ff5575f251e Mon Sep 17 00:00:00 2001 From: ZmJ <35414361+zzzzzzmj@users.noreply.github.com> Date: Sat, 26 Jan 2019 22:12:57 +0800 Subject: [PATCH 0777/4278] Update 20150717 The History of Hello World.md --- sources/tech/20150717 The History of Hello World.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150717 The History of Hello World.md b/sources/tech/20150717 The History of Hello World.md index 9211e9f40f..a7891455ce 100644 --- a/sources/tech/20150717 The History of Hello World.md +++ b/sources/tech/20150717 The History of Hello World.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zzzzzzmj) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d276b9732768c214d0fcef3c0e2326d37bc8ed6e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 01:15:23 +0800 Subject: [PATCH 0778/4278] PRF:20180722 Dawn of the Microcomputer- The Altair 8800.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhs852 翻译的很棒,我做了一遍校对,你看看有无修改补充。预计下周一发。 --- ...n of the Microcomputer- The Altair 8800.md | 77 +++++++++---------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md index d6ae8689bf..2ebac634ff 100644 --- a/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md +++ b/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md @@ -1,46 +1,47 @@ 微型计算机的始祖:Altair 8800 ====== -《大众电子》的订阅者是个复杂的群体,杂志编辑 Arthur Salsberg 不得不在 [1974 年 12 月刊][1] 中的前言部分指出这点。此前,杂志编辑组曾收到了对《如何搭建家庭媒体中心》文章的抱怨,称这篇文章激励了许多业余电视爱好者走出去,削弱了专业修理人员存在的必要性,这对许多人的电视造成了极大伤害。Salsberg 认为,这个担忧的产生可能是因为大家不清楚《大众电子》读者们的真实水平。他解释道,杂志内部调查的数据显示,52 % 的订阅者都是某方面的电子专家,并且其中的 150,000 人在最近 60 天之内都修过电视。此外,订阅者们平均在电子产品上花费了 470 美金(2018 年则是 3578 美金),并且他们有对万用表、真空管伏特计、电子管测试仪、晶体管测试仪、射频讯号产生器和示波器的需求。“《大众电子》的读者们并不全都是新手。”Salsberg 总结道。 -熟悉《大众电子》的人居然会质疑它的订阅者,这令我十分吃惊。不过最近 60 天我的确没修过电视。我的电脑对我来说就是一块铝,我甚至没把它拆开看过。1974 年 12 月的《大众电子》刊登的像《驻波比是什么以及如何处理它》和《对万用表的测试》之类的特色文章,甚至连广告都令人生畏。它们中有个看起来像某种立体声系统的东西大胆地写道“除了‘四通道单元(即内建的 SQ、RM 和 CD-4 解码接收器)’,没有任何音频设备是被期待的”。这也表明了《大众电子》的订阅者一定对电子有很多深入的了解。 +《大众电子Popular Electronics》的订阅者们是个复杂的群体,该杂志的编辑 Arthur Salsberg 不得不在 [1974 年 12 月刊][1] 中的前言部分指出这点。此前,杂志编辑组曾收到了对《如何搭建家庭媒体中心》文章的抱怨,称这篇文章激励了许多业余电视爱好者走出去,削弱了专业修理人员存在的必要性,这对许多人的电视造成了极大伤害。Salsberg 认为,这个担忧的产生可能是因为大家不清楚《大众电子》读者们的真实水平。他解释道,据杂志内部调查的数据显示,52% 的订阅者都是某方面的电子专家,并且其中的 150,000 人在最近 60 天之内都修过电视。此外,订阅者们平均在电子产品上花费了 470 美金(2018 年则是 3578 美金),并且他们拥有万用表、真空管伏特计、电子管测试仪、晶体管测试仪、射频讯号产生器和示波器等必要设备。“《大众电子》的读者们并不全都是新手。”Salsberg 总结道。 -不过在 [1975 年 1 月刊][2] 中,杂志为读者们带来了一些他们从没见过的东西。在标题“发现项目”下面,杂志的封面是一个黑灰色的盒子,它的前面板上有一组开关和灯。这便是 Altair 8800,“世界上首个有商业竞争力的迷你计算机”,它的售价低于 400 美元。尽管 Altair 作为“迷你计算机”被宣传,但其实大家都将它称为“微机”和PC,它是首个商业上成功的新型电脑。Altair 十分小巧而且很便宜,以至于它成为了当时家家户户都能用起的电脑。正如 Salsberg 所写道,它在《大众电子》上的出现意味着:“家用电脑的时代终于到来了。” +熟悉《大众电子》的人居然会质疑它的订阅者,这令我十分吃惊。不过最近 60 天我的确没修过电视。我的电脑对我来说就是一块铝,我甚至没把它拆开看过。1974 年 12 月的《大众电子》刊登的像《驻波比是什么以及如何处理它》和《对万用表的测试》之类的特色文章,甚至连广告都令人生畏。它们中有个看起来像某种立体声系统的东西大胆地写道“除了‘四通道单元(即内建的 SQ、RM 和 CD-4 解码接收器)’,没有任何音频设备是值得期待的”。这也表明了《大众电子》的订阅者一定对电子有很多深入的了解。 + +不过在 [1975 年 1 月刊][2] 中,该杂志为读者们带来了一些他们从没见过的东西。在标题“突破性项目”下面,杂志的封面是一个大大的黑灰色盒子,其前面板上有一组复杂开关和灯。这便是 Altair 8800,“世界上首个有商业竞争力的小型机”,它的售价低于 400 美元。尽管 Altair 被宣传作“小型机minicomputer”,但它实际上是首个商业上成功的新型计算机成员,它首先被称为“微型计算机microcomputers”,最终被称为 PC(个人计算机Personal Computer)。Altair 十分小巧而且很便宜,以至于它成为了当时家家户户都能用起的电脑。正如 Salsberg 所写道,它在《大众电子》上的出现意味着:“家用电脑的时代终于到来了。” ![《大众电子》1975 年 1 月刊的封面][3] -此前,我曾写过 [关于 Altair 的文章][4],但我觉得 Altair 有让我再次介绍的价值。它在当时性能并不强(虽然它便宜很多),也不是首个装载微处理器(由至少三个微处理器组成)的通用计算机。但是 Altair 是一种可供我们所有人使用的计算机。它是历史上包括我们所拥有的设备中首台流行的计算机,早于 Altair 计算机都是完全不同的机器,它们由穿孔卡编程并且很少与用户交互。不过 Altair 也是台极其简单的计算机,它不附带任何操作系统甚至引导加载器。除非你购买其它外设,否则 Altair 就是一台装配 RAM 并且只有一组开关和灯泡的机器。由于 Altair 操作简单,学习计算的基本理论都成了十分简单的事情,就好像他们在数字世界冒险时遇上了旧世界的居民一样。 +此前,我曾写过 [关于 Altair 的文章][4],但我觉得 Altair 值得重新审视。与当时其它的计算机相比,它并不是一台性能强劲的计算机(尽管它的成本要低得多),它也不是首个采用微处理器的通用计算机(在它之前已经至少有三个基于微处理器的计算机)。但是 Altair 是一种可供我们所有人使用的计算机。它是历史上我们所拥有的设备中首台流行的计算机,而早于 Altair 计算机都是完全不同的机器,那些大型机和笨重的迷你计算机由穿孔卡编程并且很少与之直接交互。不过 Altair 也是台极其简单的计算机,它没有附带任何操作系统甚至是引导程序。除非你为它购买外围设备,否则 Altair 就是一台装配了 RAM、前面板只有一组开关和灯泡的机器。由于 Altair 操作简单,使得重新理解基本的计算概念都成了十分简单的事情,正如模拟信号时代的人们第一次接触到数字设备一样。 ### Roberts 和他的公司 -Altair 被一家名为 MITS 的公司设计和制造,这家公司位于美国新墨西哥州的阿尔布开克。MITS 由一个叫 H. Edward Roberts 运营。他们起初借 19 世纪 70 年代的热潮制造模型火箭的遥测系统。集成电路将计算器的成本降低到十分可观的数字,突然之间它就成了美国教授们的必需品。不幸的是,由于计算器市场竞争过于激烈,到了 1974 年,MITS 便负债累累。 +Altair 是由一家名为微型仪器和遥测系统Micro Instrumentation and Telemetry Systems(MITS)的公司所设计制造,这家公司位于美国新墨西哥州的阿尔布开克。MITS 由一个叫 H. Edward Roberts 的人经营。在进入计算器市场之前,该公司已经开始制造模型火箭的遥测系统,该市场在 20 世纪 70 年代初期蓬勃发展。集成电路大大降低了计算器的成本,突然之间它就成了美国每个在职的专业人士的必需品。不幸的是,由于计算器市场竞争过于激烈,到了 1974 年初,MITS 便负债累累。 -1974 年在计算机界是奇迹迭出的一年annus mirabilis。一月的时候,惠普公司推出了世界首个可编程的手持计算器 HP-65。四月的时候,Intel 发布了 Intel 8080,他们的第二款 8 位微处理器,它也是首款受欢迎的微处理器。接着,六月的时候,《Radio Electronics》杂志介绍了 Mark-8 这个自制迷你计算机,它使用了 Intel 在 1972 年推出的 Intel 8008 微处理器。Mark-8 是使用微处理器搭建的第三台电脑,它的首次登场是在杂志的封面上。Mark-8 在《Radio Electronics》上的出现促使了《大众电子》寻找微机项目的出现。 +1974 年在计算机界是奇迹迭出的一年annus mirabilis。[^1] 一月的时候,惠普公司推出了世界首个可编程的手持计算器 HP-65。四月的时候,Intel 发布了 Intel 8080,这是他们的第二款 8 位微处理器,它也是首款广受欢迎的微处理器。接着,六月的时候,《无线电电子Radio Electronics》杂志宣传了一台名为 Mark-8 的自制小型计算机,它使用了 Intel 在 1972 年推出的 Intel 8008 微处理器。Mark-8 是有史以来使用微处理器搭建的第三台电脑,它的首次登场是在杂志的封面上。[^2] Mark-8 在《无线电电子》上的出现促使了《大众电子》寻找他们要自己宣传的小型机项目。 -《大众电子》的订阅者们其实早在 1974 年 12 月就通过电邮获得了 1975 年 1 月刊的副本。他们公布的 Altair 为这个奇迹迭出的一年annus mirabilis画上了圆满的句号。Altair 的出现是十分重要的,因为此前从未有过向公众提供的价格公道而又功能齐全的电脑。当时,作为最受欢迎的迷你计算机之一的 PDP-8 要几千美金才能买到。不过 Altair 搭载的 Intel 8080 芯片几乎能与 PDP-8 匹敌;8080 支持更广泛的指令集,而且 Altair 可以扩展到 64 kb 内存,显然强于仅有 4 kb 内存的 PDP-8。并且,Mark-8 也不是他的对手,因为它搭载的是只能处理 16 kb 内存的 Intel 8008。在 Mark-8 必须由用户按照说明书手动拼装的情况下,Altair 在购买时就已经被组装好了(不过由于后来 MITS 被大量订单淹没,最后真正能获得 Altair 的方式也只有买零件拼装了)。 +《大众电子》的订阅者们其实早在 1974 年 12 月就通过邮件获得了 1975 年 1 月刊的刊物。[^3] 所以 Altair 的宣布为这个奇迹迭出的一年annus mirabilis画上了圆满的句号。Altair 的出现是十分重要的,因为此前从未有过向公众提供的价格公道而又功能齐全的电脑。当时,作为最受欢迎的小型计算机之一的 PDP-8 要几千美金才能买到。然而作为 Altair 核心的 Intel 8080 芯片几乎能与 PDP-8 匹敌,甚至更强;8080 支持更广泛的指令集,而且 Altair 可以扩展到 64 kb 内存,显然强于仅有 4 kb 内存的 PDP-8。并且,Mark-8 也不是它的对手,因为它搭载的是只能处理 16 kb 内存的 Intel 8008。在 Mark-8 必须由用户按照说明书在印刷电路板上手动拼装的情况下,Altair 在购买时就已经被组装好了(不过由于后来 MITS 被大量订单淹没,最后真正能获得 Altair 的方式也只有买套件拼装了)。 -对许多《大众电子》的读者来说,Altair 是他们了解数字计算的起点。1975 年 1 月刊上那篇介绍 Altair 的文章由 Roberts 和 Altair 的联合设计师 William Yates 所写。Roberts 和 Yates 煞费苦心地用电工和无线电狂热者们所熟悉的词汇来介绍了数字硬件和计算机编程的基本概念。他们写道:“一台计算机其实由一堆可变的硬件构成。仅需修改储存于内存之中的为组合形式,便可改变硬件设备的种类。”同时,Roberts 和 Yates 认为编程的基本概念是“足够简单并能在较短时间内掌握,但是想要成为一个高效的程序员必须经验丰富且富有创造力。”对此我十分认同。尽管已经组装好了,文章仍包含了用来讲解 Intel 8080 的组成的详细图表。文章解释了 CPU 和计算机内存单元的区别,堆栈指针的概念和汇编语言以及更高级的语言(例如 FORTRAN 和 BASIC)比起手动输入机器码所带来的巨大优势。 +对许多《大众电子》的读者来说,Altair 是他们了解数字计算的起点。1975 年 1 月刊上那篇介绍 Altair 的文章由 Roberts 和 Altair 的共同设计师 William Yates 所写。Roberts 和 Yates 煞费苦心地用电工和无线电狂热者们所熟悉的词汇来介绍了数字硬件和计算机编程的基本概念。他们写道:“一台计算机其实由一块可变的硬件。仅需修改储存于内存之中的位组合形式,便可改变硬件设备的种类。”同时,Roberts 和 Yates 认为编程的基本概念是“足够简单并能在较短时间内掌握,但是想要成为一个高效的程序员必须经验丰富且富有创造力。”对此我十分认同。尽管该部分已经完全组装好了,文章仍包含了用来讲解 Intel 8080 的组成电路的详细图表。文章解释了 CPU 和计算机内存单元的区别,堆栈指针的用法,和汇编语言以及更高级的语言(例如 FORTRAN 和 BASIC)比起手动输入机器码所带来的巨大优势。 其实,《大众电子》在 1975 年 1 月刊之前就出版过 Roberts 撰写的系列文章。这一系列作为短期课程被收录在“数字逻辑”专栏中。在 1974 年 12 月刊中,Roberts 为读者们带来了关于构建“超低成本计算机终端”的文章,文章中介绍了可以用于 8 位电脑中输入值的八进制键盘。在介绍这个键盘时,Roberts 解释了晶体管到晶体管的逻辑工作原理,以及关于构建一种可以“记住”数字值的触发器的方法。Roberts 承诺说,这个键盘可以在下个月即将公布的 Altair 电脑中使用。 -有多少《大众电子》的读者制作了这个键盘我们无从得知,但是那个键盘的确是个很有用的东西。如果没有键盘和其它输入设备,我们只能通过拨动 Altair 面板上的开关来输入值。Altair 的面板上有 16 行开关被用来设置地址,而下方的 8 个则是用来操作计算机的。16 行中最右边的开关是用来指定要储存在内存中的值的。这么做不无道理,因为 Intel 8080 使用 16 位的值来处理 8 位的信息。而这 16 个开关每一个都代表了一个位,当开关向上时代表 1,向下则代表 0。用这样的方式交互是个启示(一会儿我们就会讲到),因为 Altair 的面板是真正的二进制界面。这使得你可以触摸到裸露的金属。 +有多少《大众电子》的读者制作了这个键盘我们无从得知,但是那个键盘的确是个很有用的东西。如果没有键盘和其它输入设备,我们只能通过拨动 Altair 面板上的开关来输入值。Altair 的前面板上有一行 16 个开关被用来设置地址,而下方的 8 个则是用来操作计算机的。一行 16 个开关中最右边的 8 个开关也能用来指定要储存在内存中的值。这么做不无道理,因为 Intel 8080 使用 16 位的值来寻址 8 位的字。而前面板的这 16 个开关每一个都代表了一个位,当开关向上时代表 1,向下则代表 0。用这样的方式与计算机交互是个启示(一会儿我们就会讲到),因为 Altair 的面板是真正的二进制界面。这使得你可以尽可能地接触到计算机实体。 -尽管在当下 Altair 的界面对我们来说完全不像是人用的,不过在那个时候这可是不平凡的。比如 PDP-8 的面板上有个类似的但更漂亮的二进制输入装置,而且它被涂上了吸引人的黄色和橙色,不过讲真,它应该重新来过。然而 PDP-8 经常与纸带阅读器或电传打字机配合使用,这使得程序输入更加容易。这些 I/O 设备价格高昂,这意味着 Altair 的用户们大都会被面板卡住。正如你所想,通过这一堆开关进入一个大型程序是个繁重的工作。不过幸运的是,Altair 可以与盒式记录器连接,这样一来载入程序就不是什么难事了。Bill Gates 和 Paul Allen 进行了微软的首次商业合作,为 Altair 编写了 BASIC 语言,并在 1975 年以 MITS 许可证发行。此后,那些买得起电传打字机的用户就能 [通过纸带来将 BASIC 载入 Altair][5] 了,并能使得用户能够通过字符界面与 Altair 交互。之后,BASIC 便成为了学生们最爱的入门编程语言,并成了早期微机时代的标准接口。 +尽管在当下 Altair 的界面对我们来说完全不像是人用的,不过在那个时代却并不罕见。比如 PDP-8 的面板上有个类似的但更漂亮的二进制输入装置,而且它被涂上了吸引人的黄色和橙色,不过讲真,它真的应该卷土重来。然而 PDP-8 经常与纸带阅读器或电传打字机配合使用,这使得程序输入更加容易。这些 I/O 设备价格高昂,这意味着 Altair 的用户们大都会被那个前面板拦住。正如你可能想象的那样,通过这一堆开关输入一个大型程序是个苦差事。不过幸运的是,Altair 可以与盒式记录器连接,这样一来载入程序就不是什么难事了。Bill Gates 和 Paul Allen 在 MITS 的授权下为 Altair 编写了一个 BASIC 语言版本,并在 1975 年中期发行,这成为了微软有史以来的首次商业尝试。此后,那些买得起电传打字机的用户就能 [通过纸带来将 BASIC 载入 Altair][5] 了,并能使得用户能够通过文字与 Altair 交互。之后,BASIC 便成为了学生们最爱的入门编程语言,并成了早期小型机时代的标准接口。 ### z80pack -多亏了网络上一些人,特别是 Udo Munk 的努力,你可以在你的电脑上运行 Altair 的模拟器。这个模拟器是在 Zilog Z80 CPU 的虚拟套件上构建的,这个 CPU 可以运行 Intel 8080 的软件。Altair 模拟器允许你像 Altair 的用户们一样调整面板上的开关。尽管点击这些开关的感觉不如拨动真实开关,但是使用 Altair 模拟器仍是一个能让你知道二进制人机交互效率有多低的途径,不过我觉得这同时也很简明直观。 +多亏了网络上一些人,特别是 Udo Munk 的努力,你可以在你的计算机上运行 Altair 的模拟器。这个模拟器是在 Zilog Z80 CPU 的虚拟套件上构建的,这个 CPU 可以运行 Intel 8080 的软件。Altair 模拟器允许你像 Altair 的早期用户们一样拨动前面板上的开关。尽管点击这些开关的感觉不如拨动真实开关的触觉,但是使用 Altair 模拟器仍是一个能让你感受二进制人机交互效率有多低的途径,至少在我看来这非常简明直观。 z80pack 是 Udo Munk 开发的 Z80 模拟器套件,你可以在 z80pack 的官网上找到它的下载链接。我在 [上一篇介绍 Altair 的文章中][4] 写到过在 macOS 上使用它的详细过程。如果你能编译 FrontPanel 库和 `altairsim` 可执行程序,你应该能直接运行 `altairsim` 并看到这个窗口: ![模拟器中的 Altair 面板][6] -在新版的 z80pack 中(比如我正在使用的 1.36 版本),你可以使用一个叫 Tarbell boot ROM 的功能,我觉得这是用来加载磁盘镜像的。经我测试,它的意思是你不能写入 RAM 中的前几个信息。在编辑 `/altairsim/conf/system.conf` 之后,你可以构建带有一个 16 页 RAM 且没有 ROM 或引导加载器的 Altair。除此之外,你还可以用这个配置文件来扩大运行模拟器的窗口,不得不说这还是挺方便的。 +在新版的 z80pack 中(比如我正在使用的 1.36 版本),你可以使用一个叫 Tarbell boot ROM 的功能,我觉得这是用来加载磁盘镜像的。经我测试,这意味着你不能写入到 RAM 中的前几个字。在编辑 `/altairsim/conf/system.conf` 之后,你可以构建带有一个 16 页 RAM 且没有 ROM 或引导加载器的 Altair。除此之外,你还可以用这个配置文件来扩大运行模拟器的窗口大小,不得不说这还是挺方便的。 -Altair 的面板看起来就很吓人,不过事实上并没有我们想象中的这么可怕。[Altair 说明书][7] 对解释开关和指示灯起到了很大的作用,这个 [YouTube 视频][8] 也是。若想运行一个简易的程序,你只需要了解一点点东西。Altair 右上方标签为 D0 到 D7 的指示灯代表当前处理地址的信息。标签为 A0 到 A15 的指示灯标识当前的地址。地址指示灯下的 16 个开关可以用来设置新地址;当 “EXAMINE” 开关被向上推动时,数据指示灯将会更新,并显示新地址上的内容。用这个功能,你便能观察到内存中所有的信息了。你也可以将 “EXAMINE” 推下来自动检查下一个位置上的信息,这使得检索信息更容易了。 +Altair 的面板看起来令人生畏,不过事实上并没有我们想象中的这么可怕。[Altair 说明书][7] 对解释开关和指示灯起到了很大的作用,这个 [YouTube 视频][8] 也是如此。若想输入和运行一个简易的程序,你只需要了解一点点东西。Altair 右上方标签为 D0 到 D7 的指示灯代表当前寻址的字的内容。标签为 A0 到 A15 的指示灯表示当前的地址。地址指示灯下的 16 个开关可以用来设置新地址;当 “EXAMINE” 开关被向上推动时,数据指示灯才会更新以显示新地址上的内容。用这个功能,你便能“观察”到内存中所有的信息了。你也可以将 “EXAMINE” 推下来“EXAMINE NEXT”位置,以自动检查下一个位置上的信息,这使得查看连续的信息更容易了。 -要将模式保存到信息中,请使用最左边的 8 个标签为 0 到 7 的开关。然后,请向上推动 “DEPOSIT” 按钮。 +要将位组合方式保存到内存信息中,请使用最右边的 8 个标签为 0 到 7 的开关。然后,请向上推动 “DEPOSIT” 按钮。 -在《大众电子》 的 [1975 年 2 月刊][9] 中,Roberts 和 Yates 制作了一小段程序来确保用户们的 Altair 正常工作。这个程序从内存中读取两个整型数据并添加之后将它们存回内存中。这个小程序仅由 6 条指令组成,但是这 6 条指令包含了 14 条在一起的内存信息,所以要正确地输入它们需要一点时间。这个程序也被写入了 Altair 的说明书,原文如下: +在《大众电子》 的 [1975 年 2 月刊][9] 中,Roberts 和 Yates 引导用户输入一小段程序来确保他们的 Altair 正常工作。这个程序从内存中读取两个整型数据并相加之后将和存回内存中。这个小程序仅由 6 条指令组成,但是这 6 条指令涉及了 14 个字的内存,所以要正确地输入它们需要一点时间。这个示例程序也被写入了 Altair 的说明书,原文如下: | Address | Mnemonic | Bit Pattern | Octal Equivalent | | :------: | :------: | :------: | :------: | @@ -59,18 +60,18 @@ Altair 的面板看起来就很吓人,不过事实上并没有我们想象中 | 12 | (address) | 00 000 000 | 0 0 0 | | 13 | (address) | 00 000 000 | 0 0 0 | -如果你通过开关来输入上面这些值,最终会得到一个程序,它会读取内存 128 中的值,并将其添加至 129 中,最终将其保存至 130 中。每条指令都会占用一个地址,它们最开始会被给予最低有效位,这便是第二个字节总会被清零(没有高于 255 的地址)的原因了。在输入这个程序并在 128 和 129 中输入了一些值之后,你可以向下推动 “RUN” ,之后再将它推到 “STOP” 位置。因为程序循环执行,以一秒内执行上千次的速度反复地添加并保存那些值。并且最后得到的值总是相同的,如果你暂停程序并检查 130,你应该能找到正确答案。 +如果你通过开关来将上表的这些值输入到 Altair,最终会得到一个程序,它会读取内存 128 中的值,并将其与 129 中的值相加,最终将其保存至 130 中。伴随每条取一个地址的指令的地址,它们最开始会给出最低有效位,这便是第二个字节总会被清零的原因了(没有高于 255 的地址)。在输入这个程序并在 128 和 129 中输入了一些值之后,你可以向下短暂推动 “RUN” ,之后再将它推到 “STOP” 位置。因为程序循环执行,以一秒内执行上千次的速度反复地添加并保存那些值。并且最后得到的值总是相同的,如果你停止该程序并查看 130 的内容,你应该能找到正确答案。 -我不知道普通的 Altair 用户是否使用过,不过 z80pack 包括了一个汇编程序 —— `z80asm`,意思是适用于 Z80 的汇编程序Z80 assembly,所以它使用了不同的助记符。不过因为 Z80 是被设计来适配为 Intel 8080 写的软件的,所以即使助记符不一样,它们的操作码也是相同的。你可以直接将 `z80asm` 装载进 Altair: +我不知道普通的 Altair 用户是否使用过汇编程序,不过 z80pack 包括了一个:`z80asm`,意思是适用于 Z80 的汇编程序Z80 assembly,所以它使用了一组不同的助记符。不过因为 Z80 是被设计来兼容为 Intel 8080 写的软件的,所以即使助记符不一样,它们的操作码也是相同的。你可以直接将 `z80asm` 汇编码装载进 Altair: ``` - ORG 0000H -START: LD A,(80H) ;Load from address 128. - LD B,A ;Move loaded value from accumulator (A) to reg B. - LD A,(81H) ;Load from address 129. - ADD A,B ;Add A and B. - LD (82H),A ;Store A at address 130. - JP START ;Jump to start. + ORG 0000H +START: LD A,(80H) ;Load from address 128. + LD B,A ;Move loaded value from accumulator (A) to reg B. + LD A,(81H) ;Load from address 129. + ADD A,B ;Add A and B. + LD (82H),A ;Store A at address 130. + JP START ;Jump to start. ``` 编译之后,你可以调用汇编程序来将其转换为 Intel HEX 文件: @@ -79,21 +80,21 @@ START: LD A,(80H) ;Load from address 128. $ ./z80asm -fh -oadd.hex add.asm ``` -我们用带有 `h` 参数的 `-f` 标识来定义输出的 HEX 文件。你可以用 `-x` 标识来传递 HEX 文件,从而使得 Altair 能够加载程序: +我们用带有 `h` 参数的 `-f` 标识来定义输出的 HEX 文件。你可以用 `-x` 标识来传递 HEX 文件,从而使得 Altair 能够加载该程序: ```shell $ ./altairsim -x add.hex ``` -这会在内存中自动设置前 14 个信息,就和你通过开关手动输入这些值一样。你可以直接使用 “RUN” 按钮来替代以前那些繁琐的步骤,这是如此的简单! +这会在内存中自动设置前 14 个字,就和你通过开关手动输入这些值一样。你可以直接使用 “RUN” 按钮来替代以前那些繁琐的步骤,这是如此的简单! -我不觉得有很多 Altair 用户以这种方式来编写软件。Altair BASIC 发布后,使得 BASIC 成为了 Altair 编程最简单的方法。z80pack 同时也包括了一些包含不同版本 Altair BASIC 的 HEX 文件;在模拟器中,你可以用这个方式加载 4.0 版本的 4K BASIC: +我不觉得有很多 Altair 用户以这种方式来编写软件。Altair BASIC 发布后,使得 BASIC 成为了 Altair 编程最简单的方法。z80pack 同时也包括了一些不同版本 Altair BASIC 的 HEX 文件;在模拟器中,你可以用这个方式加载 4.0 版本的 4K BASIC: ```shell $ ./altairsim -x basic4k40.hex ``` -当你开启模拟器并按下 “RUN” 按钮之后,你就会看到 BASIC 开始执行了,同时它会在终端中与你交互。它首先会提示你输入你内存的可用量,我们输入 4000 字节。随后,在显示 “OK” 提示符之前,它会问你几个问题,Gates 和 Allen 用这个来代替标准的 “READY” 并以此节省内存。在这之后,你便可以使用 BASIC 了: +当你开启模拟器并按下 “RUN” 按钮之后,你就会看到 BASIC 开始执行了,同时它会在终端中与你交互。它首先会提示你输入你的内存可用量,我们输入 4000 字节。随后,在显示 “OK” 提示符之前,它会问你几个问题,Gates 和 Allen 用这个“OK”来代替标准的 “READY” 并以此节省内存。在这之后,你便可以使用 BASIC 了: ``` OK @@ -101,26 +102,24 @@ PRINT 3 + 4 7 ``` -尽管只有极小的 4 kb 空间来运行 BASIC,不过你仍迈出了使用面板操控电脑的重要一步。 +虽然运行 BASIC 只有 4kb 的内存并没有给你足够的空间,但你可以看到它是如何从使用前面板迈出了重要的一步。 -很显然,Altair 远不及如今的家用电脑,并且比它晚十多年发布的 Mac 电脑看上去也是对 Altair 电脑的巨大飞跃。但是对亲手组装了 Altair 的《大众电子》的读者们来说,只用了低于 400 美金和一半的书柜空间的 Altair 才是第一个它们真正能拥有的全功能电脑。对那时只能用 [一叠卡片][10] 或一卷磁带来与计算机交互的人们来说,Altair 是个令人眼前一亮的玩意。这之后的微机基本都是在对 Altair 改进,使得它更易用。从某种意义上来说,我们甚至可以把它们看成更复杂的 Altair。Altair,一个野兽派的极简作品,却为之后的许多微机打下了铺垫。 +很显然,Altair 远不及如今的家用电脑和笔记本电脑,并且比它晚十多年发布的 Mac 电脑看上去也是对 这个简朴的 Altair 电脑的巨大飞跃。但是对第一批购买并亲手组装了 Altair 的《大众电子》的读者们来说,Altair 才是他们拥有的第一个真正的全功能电脑,而这一切只用了 400 美金低价和一半的书柜空间。对那时只能用 [一叠卡片][10] 或一卷磁带来与计算机交互的人们来说,Altair 是个令人眼前一亮的玩意。这之后的微型计算机基本都是在对 Altair 改进,使得它更易用。从某种意义上来说,它们只是更复杂的 Altair。Altair,一个野兽派的极简作品,却为之后的许多微型计算机打下了铺垫。 如果你觉得这篇文章写的不错,你可以在推特上关注 [@TwoBitHistory][11] 或订阅 [RSS feed][12] 来获得我们文章的更新提醒。文章每两周就会更新一次! -TwoBitHistory 的上一篇文章是………… - -> “跟我一起来进行这振奋人心的冒险吧!只需要十分钟,你就能了解到 10 年都没人用过的软件。” -> -> — TwoBitHistory (@TwoBitHistory) [写于 2018 年 7 月 7 日][13] +[^1]: Paul E. Ceruzzi, A History of Modern Computing (Cambridge, Mass: MIT Press, 2003), 226. +[^2]: “Mark-8 Minicomputer,” Byran’s Old Computers, accessed July 21, 2018, http://bytecollector.com/mark_8.htm. +[^3]: Paul E. Ceruzzi, A History of Modern Computing (Cambridge, Mass: MIT Press, 2003), 226. -------------------------------------------------------------------------------- via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html -作者:[Two-Bit History][a] +作者:[Sinclair Target][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/) 荣誉推出 @@ -129,13 +128,13 @@ via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html [1]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1974/Poptronics-1974-12.pdf [2]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-01.pdf [3]: https://twobithistory.org/images/jan1975-altair.jpg -[4]: https://twobithistory.org/2017/12/02/simulating-the-altair.html +[4]: https://linux.cn/article-10181-1.html [5]: https://www.youtube.com/watch?v=qv5b1Xowxdk [6]: https://www.autometer.de/unix4fun/z80pack/altair.png [7]: http://www.classiccmp.org/dunfield/altair/d/88opman.pdf [8]: https://www.youtube.com/watch?v=suyiMfzmZKs [9]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-02.pdf -[10]: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html +[10]: https://linux.cn/article-10382-1.html [11]: https://twitter.com/TwoBitHistory [12]: https://twobithistory.org/feed.xml [13]: https://twitter.com/TwoBitHistory/status/1015647820353867776?ref_src=twsrc%5Etfw From ee5ee1cbc771973c5c36a48bff4a7f00d4c009b0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 11:57:06 +0800 Subject: [PATCH 0779/4278] PRF:20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @MjSeven 这篇我做了比较大的调整,不是你的问题,是原文粗制滥造。 --- ...lexer For Heavy Command-Line Linux User.md | 144 +++++++++--------- 1 file changed, 71 insertions(+), 73 deletions(-) diff --git a/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md index dab7489ba4..a227f86d7d 100644 --- a/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md +++ b/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md @@ -1,20 +1,17 @@ -tmux - 适用于重度命令行 Linux 用户的强大终端复用器 +tmux:适用于重度命令行 Linux 用户的终端复用器 ====== -tmux 是终端复用的缩写,它允许用户在单个窗口中创建或启用多个终端(垂直或水平),当你处理不同的问题时,可以在单个窗口中轻松访问和控制。 +tmux 是终端复用器terminal multiplexer的缩写,它允许用户在单个窗口中创建或启用多个终端(垂直或水平),当你处理不同的问题时,可以在单个窗口中轻松访问和控制它们。 -它使用客户端-服务器模型,允许用户之间共享会话,也可以将终端连接到 tmux 会话。我们可以根据需要轻松移动或重新排列虚拟控制台。终端会话可以从一个虚拟控制台自由切换到另一个。 +它使用客户端-服务器模型,允许在用户之间共享会话,也可以将终端连接到 tmux 会话。我们可以根据需要轻松移动或重新排列虚拟控制台。终端会话可以从一个虚拟控制台自由切换到另一个。 - -tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一个状态行,它显示当前 tmux 会话的有关信息,例如当前窗口编号,窗口名称,用户名,主机名,当前时间和日期。 +tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一个状态行,它显示当前 tmux 会话的有关信息,例如当前窗口编号、窗口名称、用户名、主机名、当前时间和日期。 启动 tmux 时,它会在一个单独窗口上创建一个新的会话,并将其显示在屏幕上。它允许用户在同一个会话中创建任意数量的窗口。 -许多人说它相当于一块屏幕,但我不这么认为,因为它提供了许多配置选项。 +许多人说它类似于 `screen`,但我不这么认为,因为它提供了许多配置选项。 -**注意:** `Ctrl+b` 是 tmux 中的默认前缀,因此,要在 tmux 中执行任何操作,你必须先输入前缀然后输入所需的选项。 - -**建议阅读:** [适用于 Linux 的终端仿真器列表][1] +**注意:** `Ctrl+b` 是 tmux 中的默认命令前缀,因此,要在 tmux 中执行任何操作,你必须先输入该前缀然后输入所需的选项。 ### tmux 特性 @@ -26,34 +23,40 @@ tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一 * tmux 提供许多配置技巧 **建议阅读:** -**(#)** [tmate - 马上与其他人分享你的终端会话][2] -**(#)** [Teleconsole - 一个与其他人分享终端会话的工具][3] + +- [tmate - 马上与其他人分享你的终端会话][2] +- [Teleconsole - 一个与其他人分享终端会话的工具][3] ### 如何安装 tmux 命令 大多数 Linux 系统默认预安装 tmux 命令。如果没有,按照以下步骤安装。 -对于 **`Debian/Ubuntu`**,使用 [APT-GET 命令][4]或 [APT 命令][5]来安装: +对于 Debian/Ubuntu,使用 [APT-GET 命令][4]或 [APT 命令][5]来安装: + ``` $ sudo apt install tmux ``` -对于 **`RHEL/CentOS`**,使用 [YUM 命令][6]来安装: +对于 RHEL/CentOS,使用 [YUM 命令][6]来安装: + ``` $ sudo yum install tmux ``` -对于 **`Fedora`**,使用 [DNF 命令][7]来安装: +对于 Fedora,使用 [DNF 命令][7]来安装: + ``` $ sudo dnf install tmux ``` -对于 **`Arch Linux`**,使用 [Pacman 命令][8]来安装: +对于 Arch Linux,使用 [Pacman 命令][8]来安装: + ``` $ sudo pacman -S tmux ``` -对于 **`openSUSE`**,使用 [Zypper 命令][9]来安装: +对于 openSUSE,使用 [Zypper 命令][9]来安装: + ``` $ sudo zypper in tmux ``` @@ -61,56 +64,51 @@ $ sudo zypper in tmux ### 如何使用 tmux 在终端上运行以下命令来启动 tmux 会话。启动 tmux 后,它会在一个新窗口中创建新会话,并将使用你的用户账户自动登录到你的默认 shell。 + ``` $ tmux ``` ![][11] -你会得到类似于我们上面的截图。tmux 附带状态栏,显示有关当前会话详细信息,日期,时间等。 +你会得到类似于我们上面的截图。tmux 附带状态栏,显示有关当前会话详细信息、日期、时间等。 状态栏信息如下: - * **`0 :`** 它表示由 tmux 服务器创建的会话号。默认情况下,它从 0 开始。 - * **`0:username@host: :`** ) 0 表示会话号。用户名和主机名是当前的使用窗口的人。 - * **`~ :`** 它表示当前目录(我们在家目录中)。 - * **`* :`** 这表示窗口现在处于活动状态。 - * **`Hostname :`** 显示服务器的完全主机名。 - * **`Date& Time:`** 显示当前日期和时间。 + * `[0]`:它表示由 tmux 服务器创建的会话号。默认情况下,它从 0 开始。 + * `0:bash`:表示会话号、命令行提示符(这里的 `bash` 表示 shell 名称)。 + * `*`:这表示该窗口现在处于活动状态。 + * 主机名:显示服务器的完全主机名。 + * 日期与时间:显示当前日期和时间。 +(LCTT 译注:tmux 的状态可以根据需要定制,也会因环境、版本的不同而不同。) - ### 如何拆分窗口 +### 如何拆分窗口 - tmux 允许用户垂直或水平分割窗口。我们来看看如何做到这一点。 +tmux 允许用户垂直或水平分割窗口,称为窗格。每个窗格都包含自己独立运行的终端实例。我们来看看如何做到这一点。 + +按下 `Ctrl+b, %` 来垂直分割窗格。 -按下 `**(Ctrl+b), %**` 来垂直分割窗口。 ![][13] -Press `**(Ctrl+b), "**` 来水平分割窗口。 +按下 `Ctrl+b, "` 来水平分割窗格。 + ![][14] ### 如何在窗格之间移动 假设,我们创建了一些窗格,希望在它们之间移动,这该怎么做?如果你不知道怎么做,那么使用 tmux 就没有意义了。使用以下控制键执行操作。在窗格之间移动有许多方法。 +- 按 `Ctrl+b, ←` - 选择左边的窗格 +- 按 `Ctrl+b, →` - 选择右边的窗格 +- 按 `Ctrl+b, ↑` - 选择上边的窗格 +- 按 `Ctrl+b, ↓` - 选择下边的窗格 +- 按 `Ctrl+b, {` - 来向左交换窗格 +- 按 `Ctrl+b, }` - 来向右交换窗格 +- 按 `Ctrl+b, o` - 切换到下一个窗格(从左到右,从上到下) +- 按 `Ctrl+b, ;` - 移动到先前活动的窗格 -按 `(Ctrl+b), 左箭头` - 来向左移动 - -按 `(Ctrl+b), 右箭头` - 来向右移动 - -按 `(Ctrl+b), 上箭头` - 来向上移动 - -按 `(Ctrl+b), 下箭头` - 来向下移动 - -按 `(Ctrl+b), {` - 来向左移动 - -按 `(Ctrl+b), }` - 来向右移动 - -按 `(Ctrl+b), o` - 切换到下一个窗格(从左到右,从上到下) - -按 `(Ctrl+b), ;` - 移动到先前活动的窗格 - -出于测试目的,我们将在窗格之间移动。现在我们在 `pane2` 中,它 `lsb_release -a` 命令的输出。 +出于测试目的,我们将在窗格之间移动。现在我们在 `pane2` 中,它展示了 `lsb_release -a` 命令的输出。 ![][15] @@ -120,25 +118,23 @@ Press `**(Ctrl+b), "**` 来水平分割窗口。 ### 如何打开/创建新窗口 -你可以在一个终端内打开任意数量的窗口。终端窗口可以垂直和水平分割,称为 `panes`。每个窗格都包含自己独立运行的终端实例。 +你可以在一个终端内打开任意数量的窗口。 -按 `(Ctrl+b), c` 来创建一个新窗口。 +- 按 `Ctrl+b, c` 来创建一个新窗口。 +- 按 `Ctrl+b, n` 移动到下一个窗口。 +- 按 `Ctrl+b, p` 移动到上一个窗口。 +- 按 `Ctrl+b, 0` ~ `Ctrl+b, 9` 立即移动到特定窗口。 +- 按 `Ctrl+b, l` 移动到先前选择的窗口。 -按 `(Ctrl+b), n` 移动到下一个窗口 +我有两个窗口,第一个窗口有三个窗格,其中包含操作系统版本信息,`top` 命令输出和内核信息。 -按 `(Ctrl+b), p` 移动到上一个窗口。 - -按 `(Ctrl+b), (0-9)` 立即移动到特定窗口。 - -按 `(Ctrl+b), l` 移动到先前选择的窗口。 - -我有两个窗口,第一个窗口有三个窗格,其中包含操作系统版本信息,top 命令输出和内核信息。 ![][17] 第二个窗口有两个窗格,其中包含 Linux 发行版 logo 信息。使用以下命令执行操作: + ![][18] -按 `(Ctrl+b), w` 以交互方式选择当前窗口。 +按 `Ctrl+b, w` 以交互方式选择当前窗口。 ![][19] @@ -146,46 +142,48 @@ Press `**(Ctrl+b), "**` 来水平分割窗口。 你正在一些非常小的窗格中工作,并且你希望将其缩小以进行进一步的工作。要做到这一点,使用以下键绑定。 -目前我们有三个窗格,我在 `pane1` 工作,它使用 **Top** 命令显示系统活动信息,我将缩放它。 +目前我们有三个窗格,我在 `pane1` 工作,它使用 `top` 命令显示系统活动信息,我将缩放它。 + ![][17] 缩放窗格时,它将隐藏所有其它窗格,并只显示窗口中的缩放窗格。 ![][20] -按 `(Ctrl+b), z` 缩放窗格并再次按下它,使缩放窗格恢复原状。 +按 `Ctrl+b, z` 缩放窗格,并再次按下它使缩放窗格恢复原状。 ### 显示窗格信息 要了解窗格编号及其大小,运行以下命令。 -按 `(Ctrl+b), q` 可简单显示窗格索引。 +按 `Ctrl+b, q` 可简单显示窗格索引。 + ![][21] ### 显示窗口信息 -要知道窗口编号,布局大小,与窗口关联的窗格数量及其大小等,运行以下命令。 +要知道窗口编号、布局大小,与窗口关联的窗格数量及其大小等,运行以下命令。 只需运行 `tmux list-windows` 即可查看窗口信息。 + ![][22] ### 如何调整窗格大小 -你可能需要调整窗格大小来满足你的要求。你必须按下 `(Ctrl+b), :`,然后在页面底部的 `黄色(yellow)` 颜色条上输入以下详细信息。 +你可能需要调整窗格大小来满足你的要求。你必须按下 `Ctrl+b, :`,然后在页面底部的黄色颜色条上输入以下详细信息。 + ![][23] -在上一部分中,我们有打印了窗格索引,它同时也显示了窗格大小。为了测试,我们要向上增加 `10` 个单元。参考以下输出,该窗格将 pane1 和 pane2 的大小从 `55x21` 增加到 `55x31`。 +在上一部分中,我们打印了窗格索引,它同时也显示了窗格大小。为了测试,我们要向增加 `10` 个单元。参考以下输出,该窗格将 pane1 和 pane2 的大小从 `55x21` 增加到 `55x31`。 + ![][24] -**语法:** `(Ctrl+b), :` 然后输入 `resize-pane [options] [cells size]` +**语法:** `Ctrl+b, :` 然后输入 `resize-pane [options] [cells size]` -`(Ctrl+b), :` 然后输入 `resize-pane -D 10` 将当前窗格大小向下调整 10 个单元。 - -`(Ctrl+b), :` 然后输入 `resize-pane -U 10` 将当前窗格大小向上调整 10 个单元。 - -`(Ctrl+b), :` 然后输入 `resize-pane -L 10` 将当前窗格大小向左调整 10 个单元。 - -`(Ctrl+b), :` 然后输入 `resize-pane -R 10` 将当前窗格大小向右调整 10 个单元。 +- `Ctrl+b, :` 然后输入 `resize-pane -D 10` 将当前窗格大小向下调整 10 个单元。 +- `Ctrl+b, :` 然后输入 `resize-pane -U 10` 将当前窗格大小向上调整 10 个单元。 +- `Ctrl+b, :` 然后输入 `resize-pane -L 10` 将当前窗格大小向左调整 10 个单元。 +- `Ctrl+b, :` 然后输入 `resize-pane -R 10` 将当前窗格大小向右调整 10 个单元。 ### 分离并重新连接 tmux 会话 @@ -208,23 +206,23 @@ $ rsync -avzhe ssh /backup root@192.168.0.161:/backups/week-1/ ``` 运行以下命令以列出可用的 tmux 会话。 + ``` $ tmux ls 0: 3 windows (created Tue Jan 30 06:17:47 2018) [109x45] ``` 现在,使用适当的会话 ID 重新连接 tmux 会话,如下所示: + ``` $ tmux attach -t 0 ``` ### 如何关闭窗格和窗口 -只需在相应的窗格中输入 `exit` 或按下 `Ctrl-d` 即可关闭它,和终端关闭类似。要关闭窗口,按下 `(Ctrl+b), &`。 +只需在相应的窗格中输入 `exit` 或按下 `Ctrl-d` 即可关闭它,和终端关闭类似。要关闭窗口,按下 `Ctrl+b, &`。 好了,就到这里了,希望你喜欢上它。 -(to 校正:这句话是加的,感觉它结尾很突然,可以删掉。) - -------------------------------------------------------------------------------- @@ -232,7 +230,7 @@ via: https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for- 作者:[Magesh Maruthamuthu][a] 译者:[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 b99105f8ccfda057a970daa16793c952d6442408 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 11:57:47 +0800 Subject: [PATCH 0780/4278] PUB:20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md @MjSeven https://linux.cn/article-10480-1.html --- ...rful Terminal Multiplexer For Heavy Command-Line Linux User.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md (100%) diff --git a/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/published/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md similarity index 100% rename from translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md rename to published/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md From 98e0f9e64e2dc20e3e042b6d989882a8d45af536 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 12:12:00 +0800 Subject: [PATCH 0781/4278] PRF:20180411 How To Setup Static File Server Instantly.md @MjSeven --- ...w To Setup Static File Server Instantly.md | 87 +++++++++++-------- 1 file changed, 51 insertions(+), 36 deletions(-) diff --git a/translated/tech/20180411 How To Setup Static File Server Instantly.md b/translated/tech/20180411 How To Setup Static File Server Instantly.md index 9f31dba91e..b0f4fd29b5 100644 --- a/translated/tech/20180411 How To Setup Static File Server Instantly.md +++ b/translated/tech/20180411 How To Setup Static File Server Instantly.md @@ -1,131 +1,146 @@ -如何设置一个即时静态文件服务器 +如何即时设置一个静态文件服务器 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/04/serve-720x340.png) -曾经想通过网络共享你的文件或项目,但不知道怎么做?别担心!这里有一个名为 **serve** 的简单实用程序,可以通过网络即时共享你的文件。这个简单的实用程序会立即将你的系统变成一个静态文件服务器,允许你通过网络提供文件。你可以从任何设备访问这些文件,而不用担心它们的操作系统是什么。你所需的只是一个 Web 浏览器。这个实用程序还可以用来服务静态网站。它以前称为 “list” 或 “micri-list”,但现在名称已改为 “serve”,这更适合这个实用程序的目的。 +曾经想通过网络共享你的文件或项目,但不知道怎么做?别担心!这里有一个名为 **serve** 的简单实用程序,可以通过网络即时共享你的文件。这个简单的实用程序会立即将你的系统变成一个静态文件服务器,允许你通过网络提供文件。你可以从任何设备访问这些文件,而不用担心它们的操作系统是什么。你所需的只是一个 Web 浏览器。这个实用程序还可以用来服务静态网站。它以前称为 “list” 或 “micri-list”,但现在名称已改为 “serve”(提供),这更适合这个实用程序的目的。 ### 使用 Serve 来设置一个静态文件服务器 -要安装 "serve",首先你需要安装 NodeJS 和 NPM。参考以下链接在 Linux 中安装 NodeJS 和 NPM。 +要安装 serve,首先你需要安装 NodeJS 和 NPM。参考以下链接在 Linux 中安装 NodeJS 和 NPM。 - * [如何在 Linux 上安装 NodeJS](https://www.ostechnix.com/install-node-js-linux/) +* [如何在 Linux 上安装 NodeJS](https://www.ostechnix.com/install-node-js-linux/) + +NodeJS 和 NPM 安装完成后,运行以下命令来安装 serve: -NodeJS 和 NPM 安装完成后,运行以下命令来安装 "serve": ``` $ npm install -g serve ``` 完成!现在是时候 serve 文件或文件夹了。 -使用 "serve" 的典型语法是: +使用 serve 的典型语法是: + ``` $ serve [options] ``` -### Serve 特定文件或文件夹 +### 提供特定文件或文件夹 + +例如,让我们共享 `Documents` 目录里的内容。为此,运行: -例如,让我们共享 **Documents** 目录里的内容。为此,运行: ``` $ serve Documents/ ``` 示例输出: + ![][2] 正如你在上图中看到的,给定目录的内容已通过两个 URL 提供网络支持。 -要从本地系统访问内容,你只需打开 Web 浏览器,输入 **** URL: +要从本地系统访问内容,你只需打开 Web 浏览器,输入 URL `http://localhost:5000/`: + ![][3] -Serve 实用程序以简单的布局显示给定目录的内容。你可以下载(右键单击文件并选择“将链接另存为...”)或只在浏览器中查看它们。 +serve 实用程序以简单的布局显示给定目录的内容。你可以下载(右键单击文件并选择“将链接另存为...”)或只在浏览器中查看它们。 + +如果想要在浏览器中自动打开本地地址,使用 `-o` 选项。 -如果想要在浏览器中自动打开本地地址,使用 **-o** 选项。 ``` $ serve -o Documents/ ``` -运行上述命令后,Serve 实用程序将自动打开 Web 浏览器并显示共享项的内容。 +运行上述命令后,serve 实用程序将自动打开 Web 浏览器并显示共享项的内容。 -同样,要通过网络从远程系统访问共享目录,可以在浏览器地址栏中输入 ****。用你系统的 IP 替换 192.168.43.192。 +同样,要通过网络从远程系统访问共享目录,可以在浏览器地址栏中输入 `http://192.168.43.192:5000`。用你系统的 IP 替换 192.168.43.192。 -**通过不同的端口 Serve 内容** +### 通过不同的端口提供内容 + +你可能已经注意到,默认情况下,serve 实用程序使用端口 5000。因此,确保防火墙或路由器中允许使用端口 5000。如果由于某种原因被阻止,你可以使用 `-p` 选项使用不同端口来提供内容。 -你可能已经注意到,默认情况下,serve 实用程序使用端口 **5000**。因此,确保防火墙或路由器中允许使用端口 5000。如果由于某种原因被阻止,你可以使用 **-p** 选项使用不同端口来提供内容。 ``` $ serve -p 1234 Documents/ ``` -上面的命令将通过端口 **1234** 提供 Documents 目录的内容。 +上面的命令将通过端口 1234 提供 `Documents` 目录的内容。 + ![][4] 要提供文件而不是文件夹,只需给它完整的路径,如下所示。 + ``` $ serve Documents/Papers/notes.txt ``` 只要知道路径,网络上的任何用户都可以访问共享目录的内容。 -**Serve 整个 $HOME 目录** +### 提供整个 `$HOME` 目录 打开终端输入 + ``` $ serve ``` -这将通过网络共享整个 $HOME 目录的内容。 +这将通过网络共享整个 `$HOME` 目录的内容。 -要停止共享,按下 **CTRL+C**。 +要停止共享,按下 `CTRL+C`。 -**Serve 选择的文件或文件夹** +### 提供选定的文件或文件夹 + +你可能不想共享所有文件或目录,只想共享其中的一些。你可以使用 `-i` 选项排除文件或目录。 -你可能不想共享所有文件或目录,只想共享其中的一些。你可以使用 **-i** 选项排除文件或目录。 ``` $ serve -i Downloads/ ``` -以上命令将 serve 整个文件系统,除了 **Downloads** 目录。 +以上命令将提供整个文件系统,除了 `Downloads` 目录。 -**仅在本地主机上提供内容** +### 仅在本地主机上提供内容 + +有时,你只想在本地系统而不是整个网络上提供内容。为此,使用 `-l` 标志,如下所示: -有时,你只想在本地系统而不是整个网络上 serve 内容。为此,使用 **-l** 标志,如下所示: ``` $ serve -l Documents/ ``` -此命令会仅在本地提供 **Documents** 目录。 +此命令会仅在本地提供 `Documents` 目录。 ![][5] 当你在共享服务器上工作时,这可能会很有用。系统中的所有用户都可以访问共享,但远程用户不能。 -**使用 SSL Serve 内容** +### 使用 SSL 提供内容 + +由于我们通过本地网络提供内容,因此我们不需要使用 SSL。但是,serve 实用程序可以使用 `-ssl` 选项来使用 SSL 共享内容。 -由于我们通过本地网络 serve 内容,因此我们不需要使用 SSL。但是,serve 实用程序可以使用 **-ssl** 选项来使用 SSL 共享内容。 ``` $ serve --ssl Documents/ ``` ![][6] -要通过 Web 浏览器访问共享,输入 “ 或 “. +要通过 Web 浏览器访问共享,输入 `https://localhost:5000` 或 `https://ip:5000`。 ![][7] -**通过身份验证 Serve 内容** +### 通过身份验证提供内容 -在上面的所以示例中,我们在没有任何身份验证的情况下 serve 内容,所以网络上的任何人都可以在没有任何身份验证的情况下访问共享内容。你可能会觉得应该使用用户名和密码访问某些内容。 +在上面的所有示例中,我们在没有任何身份验证的情况下提供内容,所以网络上的任何人都可以在没有任何身份验证的情况下访问共享内容。你可能会觉得应该使用用户名和密码访问某些内容。 为此,使用: + ``` $ SERVE_USER=ostechnix SERVE_PASSWORD=123456 serve --auth ``` -现在用户需要输入用户名(即 **ostechnix**)和密码(123456)来访问共享。(译者注:123456 是非常不好的密码,仅在实验情况下使用) +现在用户需要输入用户名(即 `ostechnix`)和密码(`123456`)来访问共享。(LCTT 译注:123456 是非常不好的密码,仅在实验情况下使用) ![][8] -Serve 实用程序还有一些其它功能,例如禁用 [**Gzip 压缩**][9],设置 **CORS** 头以允许来自任河源的请求,防止自动复制地址到剪贴板等。通过以下命令,你可以阅读完整的帮助部分。 +serve 实用程序还有一些其它功能,例如禁用 [Gzip 压缩][9],设置 CORS 头以允许来自任河源的请求,防止自动复制地址到剪贴板等。通过以下命令,你可以阅读完整的帮助部分。 + ``` $ serve help ``` @@ -134,18 +149,18 @@ $ serve help 共勉! -来源: +资源: - * [Serve GitHub 仓库](https://github.com/zeit/serve) +* [Serve GitHub 仓库](https://github.com/zeit/serve) -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-setup-static-file-server-instantly/ 作者:[SK][a] -译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 00e2b892160a54ca64b59beadfe183f1f8080c1e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 13:48:51 +0800 Subject: [PATCH 0782/4278] PUB:20180411 How To Setup Static File Server Instantly.md @MjSeven https://linux.cn/article-10481-1.html --- .../20180411 How To Setup Static File Server Instantly.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180411 How To Setup Static File Server Instantly.md (100%) diff --git a/translated/tech/20180411 How To Setup Static File Server Instantly.md b/published/20180411 How To Setup Static File Server Instantly.md similarity index 100% rename from translated/tech/20180411 How To Setup Static File Server Instantly.md rename to published/20180411 How To Setup Static File Server Instantly.md From eeecde4bfb28fab43dc53adb1830963c8b653c72 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 27 Jan 2019 14:30:13 +0800 Subject: [PATCH 0783/4278] Translating by qhwdw --- ...0120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md index c6724ff672..9795a43296 100644 --- a/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md +++ b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From dc60fdd61bcf75932c68e16c61c9290e8150a5c6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 17:21:00 +0800 Subject: [PATCH 0784/4278] APL:20190118 Top 5 Linux Server Distributions.md --- sources/tech/20190118 Top 5 Linux Server Distributions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md index 0cb6e83247..d9f2edf6d9 100644 --- a/sources/tech/20190118 Top 5 Linux Server Distributions.md +++ b/sources/tech/20190118 Top 5 Linux Server Distributions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 06cc442e581ad7588b8c7168bdd99f9179a2ced5 Mon Sep 17 00:00:00 2001 From: wwhio Date: Sun, 27 Jan 2019 17:42:50 +0800 Subject: [PATCH 0785/4278] 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 b6af3c1bdf0bf07f16deb32f0f8b0c4553339d28 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 19:21:17 +0800 Subject: [PATCH 0786/4278] TSD:20190118 Top 5 Linux Server Distributions.md --- ...190118 Top 5 Linux Server Distributions.md | 264 ++++++------------ 1 file changed, 93 insertions(+), 171 deletions(-) diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md index d9f2edf6d9..b263bb3b89 100644 --- a/sources/tech/20190118 Top 5 Linux Server Distributions.md +++ b/sources/tech/20190118 Top 5 Linux Server Distributions.md @@ -7,235 +7,157 @@ [#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -Top 5 Linux Server Distributions +另一种 5 个顶级 Linux 服务器发行版 ====== + +> Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) -Ah, the age-old question: Which Linux distribution is best suited for servers? Typically, when this question is asked, the standard responses pop up: +啊,这个古老的问题:哪种 Linux 发行版最适合做服务器?通常,问这种问题时,所浮现出来的标准的答复就是: * RHEL - * SUSE - - * Ubuntu Server - + * Ubuntu 服务器 * Debian - * CentOS +然而,假如你将眼界放得更宽(不将服务器只看做是 IDC 托管的那种互联网服务器时),可能答案会有点不同。我准备稍微来点不同的。我想做出一个满足入选标准的发行版列表,这些发行版不仅是优秀的候选者,而且易于使用,可以为你的业务中的许多功能提供服务。在某些情况下,我选择的是一些替代品,可以取代其它需要一些工作才能达成要求的操作系统。 - - -However, in the name of opening your eyes to maybe something a bit different, I’m going to approach this a bit differently. I want to consider a list of possible distributions that are not only outstanding candidates but also easy to use, and that can serve many functions within your business. In some cases, my choices are drop-in replacements for other operating systems, whereas others require a bit of work to get them up to speed. - -Some of my choices are community editions of enterprise-grade servers, which could be considered gateways to purchasing a much more powerful platform. You’ll even find one or two entries here to be duty-specific platforms. Most importantly, however, what you’ll find on this list isn’t the usual fare. +我的一些选择是企业级服务器的社区版本,它们可以被视为购买更强大平台的入门级产品。你甚至可以在这里找到一两个作为特定任务平台的候选者。然而,最重要的是,你在此列表中找到的并非寻常的泛泛之辈。 ### ClearOS -What is ClearOS? For home and small business usage, you might not find a better solution. Out of the box, ClearOS includes tools like intrusion detection, a strong firewall, bandwidth management tools, a mail server, a domain controller, and much more. What makes ClearOS stand out above some of the competition is its purpose is to server as a simple Home and SOHO server with a user-friendly, graphical web-based interface. From that interface, you’ll find an application marketplace (Figure 1), with hundreds of apps (some of which are free, whereas some have an associated cost), that makes it incredibly easy to extend the ClearOS featureset. In other words, you make ClearOS the platform your home and small business needs it to be. Best of all, unlike many other alternatives, you only pay for the software and support you need. +什么是 ClearOS?对于家庭和小型企业用途,你可能找不到比它更好的解决方案。ClearOS 开箱即用,包括了入侵检测、强大的防火墙、带宽管理工具、邮件服务器、域控制器等工具。其目的是将服务器作为一个简单的家庭和 SOHO 服务器,并具有用户友好的基于 Web 的图形化界面,这使得 ClearOS 在某些评比中脱颖而出。从其界面中,你可以找到一个应用程序市场(图 1),其中包含数百个应用程序(其中一些是免费的,而另一些则具有相关费用),这使得扩展 ClearOS 功能集非常容易。换句话说,你可以将 ClearOS 作为你的家庭和小型企业所需的平台。最重要的是,与许多其他替代方案不同,你只需支付所需的软件和支持。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) -There are three different editions of ClearOS: - * [ClearOS Community][1] - the free edition of ClearOS +*图 1:ClearOS 应用程序市场* - * [ClearOS Home][2] - ideal for home offices +有三种版本的 ClearOS: - * [ClearOS Business][3] - ideal for small businesses, due to the inclusion of paid support + * [ClearOS Community][1] - 免费版 ClearOS + * [ClearOS Home][2] - 适于家庭办公 + * [ClearOS Business][3] - 适于小型企业,包括了付费支持。 +为了使软件安装更加容易,ClearOS 应用市场允许你通过以下方式进行选择软件: +   * 按功能(根据任务显示应用程序) +   * 按类别(显示相关应用程序组) +   * 快速选择文件(允许你按预先配置的模板选择,以帮助你快速启动和运行) +换句话说,如果你正在寻找 Linux 的家庭、SOHO 或 SMB 服务器,ClearOS 是一个出色的选择(特别是如果你没有启动和运行标准的 Linux 服务器的能力时)。 -To make the installation of software even easier, the ClearOS marketplace allows you to select via: +### Fedora 服务器 - * By Function (which displays apps according to task) +你肯定听说过 Fedora Linux。它是市场上最好的前沿发行版之一。但是你知道这个出色的 Fedora 桌面发行版的开发者们也开发了服务器版吗?Fedora 服务器平台是一个短生命周期的、社区支持的服务器操作系统。这使得经验丰富的、或对任何类型的 Linux(或任何操作系统)有经验的系统管理员,可以使用开源社区中提供的最新技术。在这段描述中有三个关键词: - * By Category (which displays groups of related apps) + * 经验丰富 + * 系统 + * 管理员 - * Quick Select File (which allows you to select pre-configured templates to get you up and running fast) - - - - -In other words, if you’re looking for a Linux Home, SOHO, or SMB server, ClearOS is an outstanding choice (especially if you don’t have the Linux chops to get a standard server up and running). - -### Fedora Server - -You’ve heard of Fedora Linux. Of course you have. It’s one of the finest bleeding edge distributions on the market. But did you know the developers of that excellent Fedora Desktop distribution also has a Server edition? The Fedora Server platform is a short-lifecycle, community-supported server OS. This take on the server operating system enables seasoned system administrators, experienced with any flavor of Linux (or any OS at all), to make use of the very latest technologies available in the open source community. There are three key words in that description: - - * Seasoned - - * System - - * Administrators - - - - -In other words, new users need not apply. Although Fedora Server is quite capable of handling any task you throw at it, it’s going to require someone with a bit more Linux kung fu to make it work and work well. One very nice inclusion with Fedora Server is that, out of the box, it includes one of the finest open source, web-based interface for servers on the market. With Cockpit (Figure 2) you get a quick glance at system resources, logs, storage, network, as well as the ability to manage accounts, services, applications, and updates. +换言之,新用户就不要考虑了。虽然 Fedora 服务器完全能够处理你抛出的任何任务,但它需要一些拥有更多的 Linux 功夫的人来使它工作并且运行良好。Fedora 服务器非常好的一点是,开箱即用,它包括了市场上用于服务器的开源的基于 Web 的最好的界面之一。通过 Cockpit(图 2),你可以快速浏览系统资源、日志、存储、网络以及拥有管理帐户、服务、应用程序和更新的能力。 ![Fedora Server][5] -Figure 2: Cockpit running on Fedora Server. +*图 2:运行在 Fedora 服务器上的 Cockpit* -[Used with permission][6] - -If you’re okay working with bleeding edge software, and want an outstanding admin dashboard, Fedora Server might be the platform for you. +如果你可以使用最前沿的软件,并想要一个出色的管理仪表板,Fedora 服务器可能就是你要的平台。 ### NethServer -NethServer is about as no-brainer of a drop-in SMB Linux server as you’ll find. With the latest iteration of NethServer, your small business will enjoy: +正如你所发现的那样,NethServer 是每个人都知道的简单 SMB Linux 服务器。通过 NethServer 的最新版本,你的小型企业将得到: - * Built-in Samba Active Directory Controller + * 内置 Samba 活动目录控制器 +   * 与 Nextcloud 的无缝集成 +   * 证书管理 +   * HTTPS 透明代理 +   * 防火墙 +   * 邮件服务器和过滤器 +   * Web 服务器和过滤器 +   * 群件 +   * IPS / IDS 或 VPN - * Seamless Nextcloud integration - - * Certificate management - - * Transparent HTTPS proxy - - * Firewall - - * Mail server and filter - - * Web server and filter - - * Groupware - - * IPS/IDS or VPN - - - - -All of the included features can be easily configured with a user-friendly, web-based interface that includes single-click installation of modules to expand the NethServer feature set (Figure 3) What sets NethServer apart from ClearOS is that it was designed to make the admin job easier. In other words, this platform offers much more in the way of flexibility and power. Unlike ClearOS, which is geared more toward home office and SOHO deployments, NethServer is equally at home in small business environments. +所有包含的功能都可以通过用户友好的基于 Web 的界面轻松配置,包括单击安装模块以扩展 NethServer 功能集(图 3)。NethServer 与 ClearOS 的区别在于它的设计目的是使管理工作更轻松。换句话说,这个平台提供了更多的灵活性和功能。与面向家庭办公室和 SOHO 部署的 ClearOS 不同,NethServer 在小型商业环境中用起来就像在家庭里使用一样方便。 ![NethServer][8] -Figure 3: Adding modules to NethServer. - -[Used with permission][6] +*图 3:给 NethServer 添加模块* ### Rockstor -Rockstor is a Linux and Btfrs powered advanced Network Attached Storage (NAS) and Cloud storage server that can be deployed for Home, SOHO, as well as small- and mid-sized businesses alike. With Rockstor, you get a full-blown NAS/Cloud solution with a user-friendly, web-based GUI tool that is just as easy for admins to set up as it is for users to use. Once you have Rockstor deployed, you can create pools, shares, snapshots, manage replication and users, share files (with the help of Samba, NFS, SFTP, and AFP), and even extend the featureset, thanks to add-ons (called Rock-ons). The list of Rock-ons includes: +Rockstor 是采用 Linux 和 Btfrs 的高级网络附加存储(NAS)和云存储服务器,可部署用于家庭、SOHO 以及中小型企业。借助 Rockstor,你可以获得一个完整的 NAS /云解决方案,其中包含一个用户友好的基于 Web 的 GUI 工具,管理员可以像普通用户一样轻松使用它来设置。一旦部署好了 Rockstor,你就可以创建存储池、共享、快照、管理复制和用户、共享文件(借助 Samba、NFS、SFTP 和 AFP),甚至扩展它的功能集,这要归功于附加组件(称为 Rock-ons)。Rock-ons 列表包括: - * CouchPotato (Downloader for usenet and bittorrent users) + * CouchPotato(Usenet 和 BitTorrent 用户的下载器) + * Deluge(BitTorrent 用户的电影下载器) + * EmbyServer(Emby 媒体服务器) + * Ghost(专业博主的发布平台) + * GitLab CE(Git 仓库托管和协作) + * Gogs Go Git Service(轻量级 Git 版本控制服务器和前端) + * Headphones(NZB 和 Torrent 的音乐自动下载器) + * 用于 Squeezebox 设备的罗技 Squeezebox 服务器 + * MariaDB(关系型数据管理系统) + * NZBGet(高效的 usenet 下载器) + * OwnCloud-Official(安全的文件共享和托管) + * Plexpy(基于 Python 的 Plex 用量跟踪器) + * Rocket.Chat(开源聊天平台) + * SaBnzbd(Usenet 下载器) + * Sickbeard(用于电视节目的互联网个人视频录像机) + * Sickrage(电视节目的自动视频库管理器) + * Sonarr(Usenet 和 BitTorrent 用户的个人视频录像机) + * Symform(备份设备) - * Deluge (Movie downloader for bittorrent users) - - * EmbyServer (Emby media server) - - * Ghost (Publishing platform for professional bloggers) - - * GitLab CE (Git repository hosting and collaboration) - - * Gogs Go Git Service (Lightweight Git version control server and front end) - - * Headphones (An automated music downloader for NZB and Torrent) - - * Logitech Squeezebox Server for Squeezebox Devices - - * MariaDB (Relational database management system) - - * NZBGet (Efficient usenet downloader) - - * OwnCloud-Official (Secure file sharing and hosting) - - * Plexpy (Python-based Plex Usage tracker) - - * Rocket.Chat (Open Source Chat Platform) - - * SaBnzbd (Usenet downloader) - - * Sickbeard (Internet PVR for TV shows) - - * Sickrage (Automatic Video Library Manager for TV Shows) - - * Sonarr (PVR for usenet and bittorrent users) - - * Symform (Backup service) - - - - -Rockstor also includes an at-a-glance dashboard that gives admins quick access to all the information they need about their server (Figure 4). +Rockstor 还包括了一目了然的仪表板,使管理员可以快速访问他们所需的有关其服务器的所有信息(图 4)。 ![Rockstor][10] -The Rockstor dashboard in action. - -[Used with permission][6] +*图 4: Rockstor 面板* ### Zentyal -Zentyal is another Small Business Server that does a great job of handling multiple tasks. If you’re looking for a Linux distribution that can handle the likes of: - - * Directory and Domain server - - * Mail server - - * Gateway - - * DHCP, DNS, and NTP server - - * Certification Authority +Zentyal 是另一个小型企业服务器,可以很好地处理多个任务。如果你正在寻找可以处理以下内容的 Linux 发行版: + * 目录和域服务器 + * 邮件服务器 + * 网关 + * DHCP、DNS 和 NTP 服务器 + * 认证机构(CA) * VPN + * 实时消息(IM) + * FTP 服务器 + * 反病毒 + * SSO 认证 + * 文件共享 + * RADIUS 认证 + * 虚拟化管理 + * 等等 - * Instant Messaging - - * FTP server - - * Antivirus - - * SSO authentication - - * File sharing - - * RADIUS - - * Virtualization Management - - * And more - - - - -Zentyal might be your new go-to. Zentyal has been around since 2004 and is based on Ubuntu Server, so it enjoys a rock-solid base and plenty of applications. And with the help of the Zentyal dashboard (Figure 5), admins can easily manage: - - * System - - * Network - - * Logs - - * Software updates and installation - - * Users/groups - - * Domains - - * File sharing - - * Mail +Zentyal 可能是你的新选择。从 2004 年 Zentyal 就存在了,它基于 Ubuntu Server,因此它拥有坚实的基础和丰富的应用程序。在 Zentyal 仪表板的帮助下(图 5),管理员可以轻松管理: + * 系统 + * 网络 + * 日志 + * 软件更新和安装 + * 用户/组 + * 域 + * 文件共享 + * 邮件 * DNS - - * Firewall - - * Certificates - - * And much more + * 防火墙 + * 证书 + * 等等 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) +*图 5:Zentyal 仪表板* -Adding new components to the Zentyal server is as simple as opening the Dashboard, clicking on Software Management > Zentyal Components, selecting what you want to add, and clicking Install. The one issue you might find with Zentyal is that it doesn’t offer nearly the amount of addons as you’ll find in the likes of Nethserver and ClearOS. But the services it does offer, Zentyal does incredibly well. +向 Zentyal 服务器添加新组件只需要打开仪表板,单击“软件管理” -> “Zentyal 组件”,选择要添加的组件,然后单击安装。Zentyal 可能会遇到的一个问题是,它提供不了与 Nethserver 和 ClearOS 一样多的插件。但它提供的服务,则做得非常好。 -### Plenty More Where These Came From +### 更多来自于 -This list of Linux servers is clearly not exhaustive. What it is, however, is a unique look at the top five server distributions you’ve probably not heard of. Of course, if you’d rather opt to use a more traditional Linux server distribution, you can always stick with [CentOS][11], [Ubuntu Server][12], [SUSE][13], [Red Hat Enterprise Linux][14], or [Debian][15]… most of which are found on every list of best server distributions on the market. If, however, you’re looking for something a bit different, give one of these five distos a try. +这个 Linux 服务器列表显然不是详尽无遗的。然而,这是一种对你可能没有听说过的五大服务器发行版的独特视角。当然,如果你更愿意使用更传统的 Linux 服务器发行版,你可以随时坚持使用 [CentOS][11]、[Ubuntu 服务器][12]、[SUSE][13]、[RHEL][14] 或 [Debian][15]……它们大多都出现在市场上最好的服务器发行版列表中。但是,如果你正在寻找一些不同的东西,那么试试这五个发行版中的一个。 -Learn more about Linux through the free ["Introduction to Linux" ][16]course from The Linux Foundation and edX. +通过 Linux 基金会和 edX 的免费[“Linux 简介”][16]课程了解有关 Linux 的更多信息。 -------------------------------------------------------------------------------- @@ -243,7 +165,7 @@ via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions 作者:[Jack Wallen][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 8fb365cd29425beb3c48097ea92271c00b2a9f4e Mon Sep 17 00:00:00 2001 From: ZmJ <1352252181@qq.com> Date: Sun, 27 Jan 2019 19:28:10 +0800 Subject: [PATCH 0787/4278] TSD: 20150717 The History of Hello World --- .../20150717 The History of Hello World.md | 143 ----------------- .../20150717 The History of Hello World.md | 147 ++++++++++++++++++ 2 files changed, 147 insertions(+), 143 deletions(-) delete mode 100644 sources/tech/20150717 The History of Hello World.md create mode 100644 translated/tech/20150717 The History of Hello World.md diff --git a/sources/tech/20150717 The History of Hello World.md b/sources/tech/20150717 The History of Hello World.md deleted file mode 100644 index 9211e9f40f..0000000000 --- a/sources/tech/20150717 The History of Hello World.md +++ /dev/null @@ -1,143 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The History of Hello World) -[#]: via: (https://www.thesoftwareguild.com/blog/the-history-of-hello-world/) -[#]: author: (thussong https://www.thesoftwareguild.com/blog/author/thussong/) - -The History of Hello World -====== - - -Veteran software developers know the [Hello World][2] program as the first step in learning to code. The program, which outputs some variant of “Hello, World!” on a device’s display, can be created in most languages, making it some of the most basic syntax involved in the coding process. In fact, a recent project at the Association for Computing Machinery (ACM) at Louisiana Tech [found][3] that there are at least 204 versions of the program. - -Traditionally, Hello World programs are used to illustrate how the process of coding works, as well as to ensure that a language or system is operating correctly. They are usually the first programs that new coders learn, because even those with little or no experience can execute Hello World both easily and correctly. - -Above all, Hello World is simple. That’s why it is so often used as a barometer of program success. If Hello World does not work effectively within the framework, then it is likely that other, more complex programs will also fail. As one expert at [Win-Vector][4] puts it, Hello World is actually a confrontational program. “The author is saying ‘it isn’t obvious your computer system will work, so I am not going to invest a lot of time in it until I see it can at least print one line of text,’” Win-Vector blogger John Mount says. - -But this two-word phrase has big implications for the field of computer science. With Hello World as a foundation, novice programmers can easily understand computer science principles or elements. And professionals with years of coding experience can use it to learn how a given programming language works, especially in terms of structure and syntax. With applications at all skill levels and in almost every language, there is a long history behind such a short program. - -### Uses - -The main use for Hello World programs was outlined above: It is a way for rookie coders to become acquainted with a new language. However, the applications of these programs go beyond an introduction to the coding world. Hello World can, for example, be used as a sanity test to make sure that the components of a language (its compiler, development and run-time environment) have been correctly installed. Because the process involved in configuring a complete programming toolchain is lengthy and complex, a simple program like Hello World is often used as a first-run test on a new toolchain. - -Hackers also use Hello World “as proof of concept that arbitrary code can be executed through an exploit where the system designers did not intend code to be executed,” according to programming consultants at Cunningham & Cunningham (C2). In fact, it’s the first step in using homemade content, or “home brew” on a device. When [experienced coders][5] are configuring an environment or learning a previously unknown one, they verify that Hello World behaves correctly. - -It is also used as part of the debugging process, allowing programmers to check that they are editing the right aspect of a modifiable program at runtime and that it is being reloaded. - -One more popular use for Hello World is as a basis for comparison. Coders can “compare the size of the executable that the language generates, and how much supporting infrastructure must exist behind the program for it to execute,” according to C2’s wiki. - -### Beginnings - -Though the origins of Hello World remain somewhat unclear, its use as a test phrase is widely believed to have begun with Brian Kernigham’s 1972 book, A Tutorial Introduction to the Language B. In this text, the first known version of the program was used to illustrate external variables. Because the previous example in the tutorial printed “hi!” on the terminal, the more complex “hello, world!” required more character constants for expression and was the next step in the learning process. - -From there, it was used in a Bell Laboratories memo in 1974, as well as The C Programming Language in 1978. This popular text is what made Hello World famous. The example from that book (the first, and most pure, example) printed “hello, world,” with no capital letters or exclamation point. At this time, Hello World was used almost solely to illustrate a few functions of a language— not to test whether the system was running. - -Before Kernigham’s seminal texts on B and C, there was no standard first program. Even as late as 1972, it was not widely in use. The popular BASIC tutorial, “My Computer Likes Me, When I Speak in Basic,” starts with a simple program that writes a line of text. However, this message was “MY HUMAN UNDERSTANDS ME,” far from the two-word greeting programmers use today. But once Hello World was invented, it spread quickly, becoming well-known by the late 1970s. Its popularity continues to this day. - -### One Statement, Many Languages - -Here’s what the code for Hello World looks like in some of the most popular programming languages currently in use. - -#### Java - -``` -class HelloWorld { -public static void main(String[] args) { -System.out.println("Hello, world!"); -} -} -``` - -#### C# - -``` -using System; -class Program -{ -public static void Main(string[] args) -{ -Console.WriteLine("Hello, world!"); -} -} -``` - -#### Python - -``` -print("Hello, world!") -``` - -#### Ruby - -``` -puts "Hello, world!" -``` - -#### Scala - -``` -object HelloWorld extends App { -println("Hello, world!") -} -``` - -#### ASP.NET - -`Response.Write("Hello World!");` - -#### Lisp - -``` -(princ "Hello, world!") -``` - -#### Haskell - -``` -main = putStrLn "Hello, world!" -``` - -#### Malbolge - -``` -('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}= -``` - -#### Go - -``` -package main -import "fmt" -func main() { -fmt.Println("Hello, world!") -} -``` - -### Hello World Today: A Standard Practice in Varied Forms - -In modern coding languages, Hello World is deployed at different levels of sophistication. For example, the Go language introduced a multilingual Hello World program, and XL features a spinning, 3D version complete with graphics. Some languages, like Ruby and Python, need only a single statement to print “hello world,” but a low-level assembly language could require several commands to do so. Modern languages also introduce variations in punctuation and casing. These include the presence or absence of the comma and exclamation point, as well as the capitalization of both words. For example, when systems only support capital letters, the phrase appears as “HELLO WORLD.” The first nontrivial Malbolge program printed “HEllO WORld.” Variations go beyond the literal as well. In functional languages like Lisp and Haskell, factorial programs are substituted for Hello World to emphasize recursive techniques. This is different from the original examples, which emphasized I/O and produced side effects. - -With the increasing complexity of modern coding languages, Hello World is more important than ever. Both as a test and a teaching tool, it has become a standardized way of allowing programmers to configure their environment. No one can be sure why Hello World has stood the test of time in an industry known for rapid-fire innovation, but it is here to stay. - --------------------------------------------------------------------------------- - -via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/ - -作者:[thussong][a] -选题:[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.thesoftwareguild.com/blog/author/thussong/ -[b]: https://github.com/lujun9972 -[1]: https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.thesoftwareguild.com%2Fblog%2Fthe-history-of-hello-world%2F&title=The%20History%20of%20Hello%20World -[2]: http://en.wikipedia.org/wiki/%22Hello,_World!%22_program -[3]: http://whatis.techtarget.com/definition/Hello-World -[4]: http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/ -[5]: http://c2.com/cgi/wiki?HelloWorld diff --git a/translated/tech/20150717 The History of Hello World.md b/translated/tech/20150717 The History of Hello World.md new file mode 100644 index 0000000000..514f24d109 --- /dev/null +++ b/translated/tech/20150717 The History of Hello World.md @@ -0,0 +1,147 @@ +[#]: collector: "lujun9972" +[#]: translator: "zzzzzzmj" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "The History of Hello World" +[#]: via: "https://www.thesoftwareguild.com/blog/the-history-of-hello-world/" +[#]: author: "thussong https://www.thesoftwareguild.com/blog/author/thussong/" + + + +# Hello World 的由来 + +资深软件开发人员都知道[Hello world](2)程序,一个能被输出多种"Hello, World!"的程序,是学习编程的第一步。这个编程中只涉及到一些最基本语法的程序,可以被大多数语言输出在显示器上。事实上,路易斯安纳理工学院计算机协会(ACM)在最近统计[发现](3)这个项目至少有204个版本。 + +传统意义上,Hello World程序是用于说明编码过程是如何工作的,以及确保语言或系统能正常运行。它们经常是新手程序员学习的第一个程序,因为即使是经验很少或者没有经验的人也能轻松正确的执行Hello World。 + +首先,Hello World 简单,这就是为什么它经常被用做程序执行成功的晴雨表。如果Hello World在框架中无法有效执行,那么在其他更复杂的程序中也可能会失败。正如[Win-Vector](4)的一位专家所说,"Hello World实际上是一个对抗性程序"。该作者还说道,"你的计算机系统没有工作并不起眼,所有我们不会花很多时间在上面,不过我要看到它至少能打印一行文字"。 + +但是 这个两词短语在计算机科学领域有着重大的影响。以Hello World为基础,新手程序员可以轻松的去理解计算机科学原理,而拥有多年编码经验的程序员可以用它来学习编程语言的工作原理,特别是在结构与语言方面。这样的一个小程序,在任何难度和几乎所有的语言的应用程序中都有着悠久的历史。 + +### 用途 + +上文中一句话概括Hello World程序的主要用途:这是新手程序员熟悉新语言的一种方式。然而,这些程序不仅仅是对编码世界的介绍。例如,Hello World 可以作为测试,以确保语言的组件(编译器,开发和运行环境)安装正确。因为配置完整的编程工具链的过程复杂而漫长,所以像Hello World这样简单的程序通常用作新工具的首次运行测试。 + +根据Cunningham & Cunningham (C2)的编程顾问所说, 黑客经常使用Hello World程序, 来证明猜想,因为任何代码都可以通过漏洞执行,而系统设计人员并不允许执行代码。事实上,它是在设备上使用自制内容或者“home brew”的第一步, 当[有经验的编码人员](5)正在配置环境或在学习新事物时,他们会Hello World 来验证动作是否正确。 + +它也是作为调试的一部分,允许程序员在程序运行时检查他么编辑修改了的地方是否正确,然后重新加载。 + +Hello World的一个更常用的用途是作为基础的比较。根据C2的wiki所讲,程序员可以比较语言生成的可执行文件的大小,以及程序背后必须存在多少支持基础结构才能执行。 + +### 开端 + +虽然Hello World 的起源还有些不太明了,不过人们普遍认为它是作为测试用语,最早出现在Brian Kernigham 在1972年发布的B语言教程简介中。在此文中,该程序的第一个已知版本用于说明外部变量。因为教程中的前一个例子在终端上打印了“hi!”,而需要更多字符常量来表达相对复杂的“hello,world!”,是学习过程的下一步。 + +在那以后,它还被用于1974年的贝尔实验室备忘录,以及1987年的C语言程序设计。这两篇著名的文章是让Hello World闻名于世的主要原因。在书中的一个例子(第一个也是最著名的例子)打印了没有大写字母和感叹号的“hello,world”,此时的Hello World几乎只是用于说明语言的一些功能,而不是测试系统是否正常运行。 + +在Kernigham的关于B语言和C语言的开创性文章之前,没有真正意义上的第一个程序,甚至直到1974年,它也没被广泛使用。著名的BASIC教程“My Computer Likes Me,When I Speak BASIC”,从一个写一行文本的简单程序开始,不过那句话是“MY HUMAN UNDERSTANDS ME”,跟如今程序员侃侃而谈的双词问候语差的有点远。不过,当Hello World被发明后,它就迅速传播,并在20世纪70年代后从所周知。直到今天它也依然受欢迎。 + +### 一个声明, 多种语言 + +以下是目前正在被使用的一些流行的编程语言中的Hello World 代码 + +#### Java + +``` +class HelloWorld { +public static void main(String[] args) { +System.out.println("Hello, world!"); +} +} +``` + +#### C# + +``` +using System; +class Program +{ +public static void Main(string[] args) +{ +Console.WriteLine("Hello, world!"); +} +} +``` + +#### Python + +``` +print("Hello, world!") +``` + +#### Ruby + +``` +puts "Hello, world!" +``` + +#### Scala + +``` +object HelloWorld extends App { +println("Hello, world!") +} +``` + +#### ASP.NET + +``` +Response.Write("Hello World!"); +``` + +#### Lisp + +``` +(princ "Hello, world!") +``` + +#### Haskell + +``` +main = putStrLn "Hello, world!" +``` + +#### Malbolge + +``` +('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}= +``` + +#### Go + +``` +package main +import "fmt" +func main() { +fmt.Println("Hello, world!") +} +``` + + + +### 如今的 Hello world: 各种形式下的标准实践 + +在现在的编程语言中,Hello world有着不同的复杂程度。例如,Go语言中引入一个多语言的Hello World程序,XL则会提供一个具有图形、可旋转的3D版本。一些编程语言,像Ruby,Python,仅仅需要一个声明去打印"Hello World",但是低级汇编语言则需要几个命令才能做到这样。现在的编程语言还引入对标点符号的支持,包括逗号或者感叹号是否存在,以及两个词的大写。举个例子,当系统只支持大写字母,会呈现像"HELLO WORLD"的短语。第一个不平凡的Malbolge程序打印出了"HEllO WORld",跨域了原本的字面意思。功能语言像Lisp、Haskell,阶乘程序替代了Hello World,从而注重递归技术。这与原来的示例不同,后者更强调I/O以及产生的副作用。 + +随着现在的编程语言越来越复杂,Hello World 比以往显得更加重要。同样作为测试和教学工具,它已经成为程序员测试配置的编程环境的标准方法。没有人能确切说出为什么Hello World能在快速创新著称的行业中经受住时间的考验,但是它又确实留下来了。 + +-------------------------------------------------------------------------------- + +via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/ + +作者:[thussong][a] +选题:[lujun9972][b] +译者:[zzzzzzmj](https://github.com/zzzzzzmj) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.thesoftwareguild.com/blog/author/thussong/ +[b]: https://github.com/lujun9972 +[1]: https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.thesoftwareguild.com%2Fblog%2Fthe-history-of-hello-world%2F&title=The%20History%20of%20Hello%20World +[2]: http://en.wikipedia.org/wiki/%22Hello,_World!%22_program +[3]: http://whatis.techtarget.com/definition/Hello-World +[4]: http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/ +[5]: http://c2.com/cgi/wiki?HelloWorld From 43b5a2229f831201bf6fbf9d03d5591e9749397c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 19:45:02 +0800 Subject: [PATCH 0788/4278] TSD:20190118 Top 5 Linux Server Distributions --- ...190118 Top 5 Linux Server Distributions.md | 268 ------------------ ...190118 Top 5 Linux Server Distributions.md | 190 +++++++++++++ 2 files changed, 190 insertions(+), 268 deletions(-) delete mode 100644 sources/tech/20190118 Top 5 Linux Server Distributions.md create mode 100644 translated/tech/20190118 Top 5 Linux Server Distributions.md diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md deleted file mode 100644 index d9f2edf6d9..0000000000 --- a/sources/tech/20190118 Top 5 Linux Server Distributions.md +++ /dev/null @@ -1,268 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 5 Linux Server Distributions) -[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) - -Top 5 Linux Server Distributions -====== -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) - -Ah, the age-old question: Which Linux distribution is best suited for servers? Typically, when this question is asked, the standard responses pop up: - - * RHEL - - * SUSE - - * Ubuntu Server - - * Debian - - * CentOS - - - - -However, in the name of opening your eyes to maybe something a bit different, I’m going to approach this a bit differently. I want to consider a list of possible distributions that are not only outstanding candidates but also easy to use, and that can serve many functions within your business. In some cases, my choices are drop-in replacements for other operating systems, whereas others require a bit of work to get them up to speed. - -Some of my choices are community editions of enterprise-grade servers, which could be considered gateways to purchasing a much more powerful platform. You’ll even find one or two entries here to be duty-specific platforms. Most importantly, however, what you’ll find on this list isn’t the usual fare. - -### ClearOS - -What is ClearOS? For home and small business usage, you might not find a better solution. Out of the box, ClearOS includes tools like intrusion detection, a strong firewall, bandwidth management tools, a mail server, a domain controller, and much more. What makes ClearOS stand out above some of the competition is its purpose is to server as a simple Home and SOHO server with a user-friendly, graphical web-based interface. From that interface, you’ll find an application marketplace (Figure 1), with hundreds of apps (some of which are free, whereas some have an associated cost), that makes it incredibly easy to extend the ClearOS featureset. In other words, you make ClearOS the platform your home and small business needs it to be. Best of all, unlike many other alternatives, you only pay for the software and support you need. -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) -There are three different editions of ClearOS: - - * [ClearOS Community][1] - the free edition of ClearOS - - * [ClearOS Home][2] - ideal for home offices - - * [ClearOS Business][3] - ideal for small businesses, due to the inclusion of paid support - - - - -To make the installation of software even easier, the ClearOS marketplace allows you to select via: - - * By Function (which displays apps according to task) - - * By Category (which displays groups of related apps) - - * Quick Select File (which allows you to select pre-configured templates to get you up and running fast) - - - - -In other words, if you’re looking for a Linux Home, SOHO, or SMB server, ClearOS is an outstanding choice (especially if you don’t have the Linux chops to get a standard server up and running). - -### Fedora Server - -You’ve heard of Fedora Linux. Of course you have. It’s one of the finest bleeding edge distributions on the market. But did you know the developers of that excellent Fedora Desktop distribution also has a Server edition? The Fedora Server platform is a short-lifecycle, community-supported server OS. This take on the server operating system enables seasoned system administrators, experienced with any flavor of Linux (or any OS at all), to make use of the very latest technologies available in the open source community. There are three key words in that description: - - * Seasoned - - * System - - * Administrators - - - - -In other words, new users need not apply. Although Fedora Server is quite capable of handling any task you throw at it, it’s going to require someone with a bit more Linux kung fu to make it work and work well. One very nice inclusion with Fedora Server is that, out of the box, it includes one of the finest open source, web-based interface for servers on the market. With Cockpit (Figure 2) you get a quick glance at system resources, logs, storage, network, as well as the ability to manage accounts, services, applications, and updates. - -![Fedora Server][5] - -Figure 2: Cockpit running on Fedora Server. - -[Used with permission][6] - -If you’re okay working with bleeding edge software, and want an outstanding admin dashboard, Fedora Server might be the platform for you. - -### NethServer - -NethServer is about as no-brainer of a drop-in SMB Linux server as you’ll find. With the latest iteration of NethServer, your small business will enjoy: - - * Built-in Samba Active Directory Controller - - * Seamless Nextcloud integration - - * Certificate management - - * Transparent HTTPS proxy - - * Firewall - - * Mail server and filter - - * Web server and filter - - * Groupware - - * IPS/IDS or VPN - - - - -All of the included features can be easily configured with a user-friendly, web-based interface that includes single-click installation of modules to expand the NethServer feature set (Figure 3) What sets NethServer apart from ClearOS is that it was designed to make the admin job easier. In other words, this platform offers much more in the way of flexibility and power. Unlike ClearOS, which is geared more toward home office and SOHO deployments, NethServer is equally at home in small business environments. - -![NethServer][8] - -Figure 3: Adding modules to NethServer. - -[Used with permission][6] - -### Rockstor - -Rockstor is a Linux and Btfrs powered advanced Network Attached Storage (NAS) and Cloud storage server that can be deployed for Home, SOHO, as well as small- and mid-sized businesses alike. With Rockstor, you get a full-blown NAS/Cloud solution with a user-friendly, web-based GUI tool that is just as easy for admins to set up as it is for users to use. Once you have Rockstor deployed, you can create pools, shares, snapshots, manage replication and users, share files (with the help of Samba, NFS, SFTP, and AFP), and even extend the featureset, thanks to add-ons (called Rock-ons). The list of Rock-ons includes: - - * CouchPotato (Downloader for usenet and bittorrent users) - - * Deluge (Movie downloader for bittorrent users) - - * EmbyServer (Emby media server) - - * Ghost (Publishing platform for professional bloggers) - - * GitLab CE (Git repository hosting and collaboration) - - * Gogs Go Git Service (Lightweight Git version control server and front end) - - * Headphones (An automated music downloader for NZB and Torrent) - - * Logitech Squeezebox Server for Squeezebox Devices - - * MariaDB (Relational database management system) - - * NZBGet (Efficient usenet downloader) - - * OwnCloud-Official (Secure file sharing and hosting) - - * Plexpy (Python-based Plex Usage tracker) - - * Rocket.Chat (Open Source Chat Platform) - - * SaBnzbd (Usenet downloader) - - * Sickbeard (Internet PVR for TV shows) - - * Sickrage (Automatic Video Library Manager for TV Shows) - - * Sonarr (PVR for usenet and bittorrent users) - - * Symform (Backup service) - - - - -Rockstor also includes an at-a-glance dashboard that gives admins quick access to all the information they need about their server (Figure 4). - -![Rockstor][10] - -The Rockstor dashboard in action. - -[Used with permission][6] - -### Zentyal - -Zentyal is another Small Business Server that does a great job of handling multiple tasks. If you’re looking for a Linux distribution that can handle the likes of: - - * Directory and Domain server - - * Mail server - - * Gateway - - * DHCP, DNS, and NTP server - - * Certification Authority - - * VPN - - * Instant Messaging - - * FTP server - - * Antivirus - - * SSO authentication - - * File sharing - - * RADIUS - - * Virtualization Management - - * And more - - - - -Zentyal might be your new go-to. Zentyal has been around since 2004 and is based on Ubuntu Server, so it enjoys a rock-solid base and plenty of applications. And with the help of the Zentyal dashboard (Figure 5), admins can easily manage: - - * System - - * Network - - * Logs - - * Software updates and installation - - * Users/groups - - * Domains - - * File sharing - - * Mail - - * DNS - - * Firewall - - * Certificates - - * And much more - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) - - -Adding new components to the Zentyal server is as simple as opening the Dashboard, clicking on Software Management > Zentyal Components, selecting what you want to add, and clicking Install. The one issue you might find with Zentyal is that it doesn’t offer nearly the amount of addons as you’ll find in the likes of Nethserver and ClearOS. But the services it does offer, Zentyal does incredibly well. - -### Plenty More Where These Came From - -This list of Linux servers is clearly not exhaustive. What it is, however, is a unique look at the top five server distributions you’ve probably not heard of. Of course, if you’d rather opt to use a more traditional Linux server distribution, you can always stick with [CentOS][11], [Ubuntu Server][12], [SUSE][13], [Red Hat Enterprise Linux][14], or [Debian][15]… most of which are found on every list of best server distributions on the market. If, however, you’re looking for something a bit different, give one of these five distos a try. - -Learn more about Linux through the free ["Introduction to Linux" ][16]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions - -作者:[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.clearos.com/clearfoundation/software/clearos-7-community -[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home -[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business -[4]: https://www.linux.com/files/images/fedoraserverjpg -[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) -[6]: https://www.linux.com/licenses/category/used-permission -[7]: https://www.linux.com/files/images/nethserverjpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) -[9]: https://www.linux.com/files/images/rockstorejpg -[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) -[11]: https://www.centos.org/ -[12]: https://www.ubuntu.com/download/server -[13]: https://www.suse.com/ -[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[15]: https://www.debian.org/ -[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20190118 Top 5 Linux Server Distributions.md b/translated/tech/20190118 Top 5 Linux Server Distributions.md new file mode 100644 index 0000000000..b263bb3b89 --- /dev/null +++ b/translated/tech/20190118 Top 5 Linux Server Distributions.md @@ -0,0 +1,190 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Server Distributions) +[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +另一种 5 个顶级 Linux 服务器发行版 +====== + +> Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) + +啊,这个古老的问题:哪种 Linux 发行版最适合做服务器?通常,问这种问题时,所浮现出来的标准的答复就是: + + * RHEL + * SUSE + * Ubuntu 服务器 + * Debian + * CentOS + +然而,假如你将眼界放得更宽(不将服务器只看做是 IDC 托管的那种互联网服务器时),可能答案会有点不同。我准备稍微来点不同的。我想做出一个满足入选标准的发行版列表,这些发行版不仅是优秀的候选者,而且易于使用,可以为你的业务中的许多功能提供服务。在某些情况下,我选择的是一些替代品,可以取代其它需要一些工作才能达成要求的操作系统。 + +我的一些选择是企业级服务器的社区版本,它们可以被视为购买更强大平台的入门级产品。你甚至可以在这里找到一两个作为特定任务平台的候选者。然而,最重要的是,你在此列表中找到的并非寻常的泛泛之辈。 + +### ClearOS + +什么是 ClearOS?对于家庭和小型企业用途,你可能找不到比它更好的解决方案。ClearOS 开箱即用,包括了入侵检测、强大的防火墙、带宽管理工具、邮件服务器、域控制器等工具。其目的是将服务器作为一个简单的家庭和 SOHO 服务器,并具有用户友好的基于 Web 的图形化界面,这使得 ClearOS 在某些评比中脱颖而出。从其界面中,你可以找到一个应用程序市场(图 1),其中包含数百个应用程序(其中一些是免费的,而另一些则具有相关费用),这使得扩展 ClearOS 功能集非常容易。换句话说,你可以将 ClearOS 作为你的家庭和小型企业所需的平台。最重要的是,与许多其他替代方案不同,你只需支付所需的软件和支持。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) + +*图 1:ClearOS 应用程序市场* + +有三种版本的 ClearOS: + + * [ClearOS Community][1] - 免费版 ClearOS + * [ClearOS Home][2] - 适于家庭办公 + * [ClearOS Business][3] - 适于小型企业,包括了付费支持。 + +为了使软件安装更加容易,ClearOS 应用市场允许你通过以下方式进行选择软件: + +   * 按功能(根据任务显示应用程序) +   * 按类别(显示相关应用程序组) +   * 快速选择文件(允许你按预先配置的模板选择,以帮助你快速启动和运行) + +换句话说,如果你正在寻找 Linux 的家庭、SOHO 或 SMB 服务器,ClearOS 是一个出色的选择(特别是如果你没有启动和运行标准的 Linux 服务器的能力时)。 + +### Fedora 服务器 + +你肯定听说过 Fedora Linux。它是市场上最好的前沿发行版之一。但是你知道这个出色的 Fedora 桌面发行版的开发者们也开发了服务器版吗?Fedora 服务器平台是一个短生命周期的、社区支持的服务器操作系统。这使得经验丰富的、或对任何类型的 Linux(或任何操作系统)有经验的系统管理员,可以使用开源社区中提供的最新技术。在这段描述中有三个关键词: + + * 经验丰富 + * 系统 + * 管理员 + +换言之,新用户就不要考虑了。虽然 Fedora 服务器完全能够处理你抛出的任何任务,但它需要一些拥有更多的 Linux 功夫的人来使它工作并且运行良好。Fedora 服务器非常好的一点是,开箱即用,它包括了市场上用于服务器的开源的基于 Web 的最好的界面之一。通过 Cockpit(图 2),你可以快速浏览系统资源、日志、存储、网络以及拥有管理帐户、服务、应用程序和更新的能力。 + +![Fedora Server][5] + +*图 2:运行在 Fedora 服务器上的 Cockpit* + +如果你可以使用最前沿的软件,并想要一个出色的管理仪表板,Fedora 服务器可能就是你要的平台。 + +### NethServer + +正如你所发现的那样,NethServer 是每个人都知道的简单 SMB Linux 服务器。通过 NethServer 的最新版本,你的小型企业将得到: + + * 内置 Samba 活动目录控制器 +   * 与 Nextcloud 的无缝集成 +   * 证书管理 +   * HTTPS 透明代理 +   * 防火墙 +   * 邮件服务器和过滤器 +   * Web 服务器和过滤器 +   * 群件 +   * IPS / IDS 或 VPN + +所有包含的功能都可以通过用户友好的基于 Web 的界面轻松配置,包括单击安装模块以扩展 NethServer 功能集(图 3)。NethServer 与 ClearOS 的区别在于它的设计目的是使管理工作更轻松。换句话说,这个平台提供了更多的灵活性和功能。与面向家庭办公室和 SOHO 部署的 ClearOS 不同,NethServer 在小型商业环境中用起来就像在家庭里使用一样方便。 + +![NethServer][8] + +*图 3:给 NethServer 添加模块* + +### Rockstor + +Rockstor 是采用 Linux 和 Btfrs 的高级网络附加存储(NAS)和云存储服务器,可部署用于家庭、SOHO 以及中小型企业。借助 Rockstor,你可以获得一个完整的 NAS /云解决方案,其中包含一个用户友好的基于 Web 的 GUI 工具,管理员可以像普通用户一样轻松使用它来设置。一旦部署好了 Rockstor,你就可以创建存储池、共享、快照、管理复制和用户、共享文件(借助 Samba、NFS、SFTP 和 AFP),甚至扩展它的功能集,这要归功于附加组件(称为 Rock-ons)。Rock-ons 列表包括: + + * CouchPotato(Usenet 和 BitTorrent 用户的下载器) + * Deluge(BitTorrent 用户的电影下载器) + * EmbyServer(Emby 媒体服务器) + * Ghost(专业博主的发布平台) + * GitLab CE(Git 仓库托管和协作) + * Gogs Go Git Service(轻量级 Git 版本控制服务器和前端) + * Headphones(NZB 和 Torrent 的音乐自动下载器) + * 用于 Squeezebox 设备的罗技 Squeezebox 服务器 + * MariaDB(关系型数据管理系统) + * NZBGet(高效的 usenet 下载器) + * OwnCloud-Official(安全的文件共享和托管) + * Plexpy(基于 Python 的 Plex 用量跟踪器) + * Rocket.Chat(开源聊天平台) + * SaBnzbd(Usenet 下载器) + * Sickbeard(用于电视节目的互联网个人视频录像机) + * Sickrage(电视节目的自动视频库管理器) + * Sonarr(Usenet 和 BitTorrent 用户的个人视频录像机) + * Symform(备份设备) + +Rockstor 还包括了一目了然的仪表板,使管理员可以快速访问他们所需的有关其服务器的所有信息(图 4)。 + +![Rockstor][10] + +*图 4: Rockstor 面板* + +### Zentyal + +Zentyal 是另一个小型企业服务器,可以很好地处理多个任务。如果你正在寻找可以处理以下内容的 Linux 发行版: + + * 目录和域服务器 + * 邮件服务器 + * 网关 + * DHCP、DNS 和 NTP 服务器 + * 认证机构(CA) + * VPN + * 实时消息(IM) + * FTP 服务器 + * 反病毒 + * SSO 认证 + * 文件共享 + * RADIUS 认证 + * 虚拟化管理 + * 等等 + +Zentyal 可能是你的新选择。从 2004 年 Zentyal 就存在了,它基于 Ubuntu Server,因此它拥有坚实的基础和丰富的应用程序。在 Zentyal 仪表板的帮助下(图 5),管理员可以轻松管理: + + * 系统 + * 网络 + * 日志 + * 软件更新和安装 + * 用户/组 + * 域 + * 文件共享 + * 邮件 + * DNS + * 防火墙 + * 证书 + * 等等 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) + +*图 5:Zentyal 仪表板* + +向 Zentyal 服务器添加新组件只需要打开仪表板,单击“软件管理” -> “Zentyal 组件”,选择要添加的组件,然后单击安装。Zentyal 可能会遇到的一个问题是,它提供不了与 Nethserver 和 ClearOS 一样多的插件。但它提供的服务,则做得非常好。 + +### 更多来自于 + +这个 Linux 服务器列表显然不是详尽无遗的。然而,这是一种对你可能没有听说过的五大服务器发行版的独特视角。当然,如果你更愿意使用更传统的 Linux 服务器发行版,你可以随时坚持使用 [CentOS][11]、[Ubuntu 服务器][12]、[SUSE][13]、[RHEL][14] 或 [Debian][15]……它们大多都出现在市场上最好的服务器发行版列表中。但是,如果你正在寻找一些不同的东西,那么试试这五个发行版中的一个。 + +通过 Linux 基金会和 edX 的免费[“Linux 简介”][16]课程了解有关 Linux 的更多信息。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions + +作者:[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.clearos.com/clearfoundation/software/clearos-7-community +[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home +[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business +[4]: https://www.linux.com/files/images/fedoraserverjpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) +[6]: https://www.linux.com/licenses/category/used-permission +[7]: https://www.linux.com/files/images/nethserverjpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) +[9]: https://www.linux.com/files/images/rockstorejpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) +[11]: https://www.centos.org/ +[12]: https://www.ubuntu.com/download/server +[13]: https://www.suse.com/ +[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[15]: https://www.debian.org/ +[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From a2f90a20f0cc8daee032d781775314b572d801a0 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 27 Jan 2019 19:53:42 +0800 Subject: [PATCH 0789/4278] Translating by MjSeven --- ...20181203 How to bring good fortune to your Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md b/sources/tech/20181203 How to bring good fortune to your Linux terminal.md index 7549dc0249..28bd2996a1 100644 --- a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md +++ b/sources/tech/20181203 How to bring good fortune to your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (How to bring good fortune to your Linux terminal) From b342cb4a87c0f29c09a7d223f9052e1f5da214ee Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 19:58:21 +0800 Subject: [PATCH 0790/4278] Revert "TSD:20190118 Top 5 Linux Server Distributions" This reverts commit 43b5a2229f831201bf6fbf9d03d5591e9749397c. --- ...190118 Top 5 Linux Server Distributions.md | 268 ++++++++++++++++++ ...190118 Top 5 Linux Server Distributions.md | 190 ------------- 2 files changed, 268 insertions(+), 190 deletions(-) create mode 100644 sources/tech/20190118 Top 5 Linux Server Distributions.md delete mode 100644 translated/tech/20190118 Top 5 Linux Server Distributions.md diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md new file mode 100644 index 0000000000..d9f2edf6d9 --- /dev/null +++ b/sources/tech/20190118 Top 5 Linux Server Distributions.md @@ -0,0 +1,268 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Server Distributions) +[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +Top 5 Linux Server Distributions +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) + +Ah, the age-old question: Which Linux distribution is best suited for servers? Typically, when this question is asked, the standard responses pop up: + + * RHEL + + * SUSE + + * Ubuntu Server + + * Debian + + * CentOS + + + + +However, in the name of opening your eyes to maybe something a bit different, I’m going to approach this a bit differently. I want to consider a list of possible distributions that are not only outstanding candidates but also easy to use, and that can serve many functions within your business. In some cases, my choices are drop-in replacements for other operating systems, whereas others require a bit of work to get them up to speed. + +Some of my choices are community editions of enterprise-grade servers, which could be considered gateways to purchasing a much more powerful platform. You’ll even find one or two entries here to be duty-specific platforms. Most importantly, however, what you’ll find on this list isn’t the usual fare. + +### ClearOS + +What is ClearOS? For home and small business usage, you might not find a better solution. Out of the box, ClearOS includes tools like intrusion detection, a strong firewall, bandwidth management tools, a mail server, a domain controller, and much more. What makes ClearOS stand out above some of the competition is its purpose is to server as a simple Home and SOHO server with a user-friendly, graphical web-based interface. From that interface, you’ll find an application marketplace (Figure 1), with hundreds of apps (some of which are free, whereas some have an associated cost), that makes it incredibly easy to extend the ClearOS featureset. In other words, you make ClearOS the platform your home and small business needs it to be. Best of all, unlike many other alternatives, you only pay for the software and support you need. +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) +There are three different editions of ClearOS: + + * [ClearOS Community][1] - the free edition of ClearOS + + * [ClearOS Home][2] - ideal for home offices + + * [ClearOS Business][3] - ideal for small businesses, due to the inclusion of paid support + + + + +To make the installation of software even easier, the ClearOS marketplace allows you to select via: + + * By Function (which displays apps according to task) + + * By Category (which displays groups of related apps) + + * Quick Select File (which allows you to select pre-configured templates to get you up and running fast) + + + + +In other words, if you’re looking for a Linux Home, SOHO, or SMB server, ClearOS is an outstanding choice (especially if you don’t have the Linux chops to get a standard server up and running). + +### Fedora Server + +You’ve heard of Fedora Linux. Of course you have. It’s one of the finest bleeding edge distributions on the market. But did you know the developers of that excellent Fedora Desktop distribution also has a Server edition? The Fedora Server platform is a short-lifecycle, community-supported server OS. This take on the server operating system enables seasoned system administrators, experienced with any flavor of Linux (or any OS at all), to make use of the very latest technologies available in the open source community. There are three key words in that description: + + * Seasoned + + * System + + * Administrators + + + + +In other words, new users need not apply. Although Fedora Server is quite capable of handling any task you throw at it, it’s going to require someone with a bit more Linux kung fu to make it work and work well. One very nice inclusion with Fedora Server is that, out of the box, it includes one of the finest open source, web-based interface for servers on the market. With Cockpit (Figure 2) you get a quick glance at system resources, logs, storage, network, as well as the ability to manage accounts, services, applications, and updates. + +![Fedora Server][5] + +Figure 2: Cockpit running on Fedora Server. + +[Used with permission][6] + +If you’re okay working with bleeding edge software, and want an outstanding admin dashboard, Fedora Server might be the platform for you. + +### NethServer + +NethServer is about as no-brainer of a drop-in SMB Linux server as you’ll find. With the latest iteration of NethServer, your small business will enjoy: + + * Built-in Samba Active Directory Controller + + * Seamless Nextcloud integration + + * Certificate management + + * Transparent HTTPS proxy + + * Firewall + + * Mail server and filter + + * Web server and filter + + * Groupware + + * IPS/IDS or VPN + + + + +All of the included features can be easily configured with a user-friendly, web-based interface that includes single-click installation of modules to expand the NethServer feature set (Figure 3) What sets NethServer apart from ClearOS is that it was designed to make the admin job easier. In other words, this platform offers much more in the way of flexibility and power. Unlike ClearOS, which is geared more toward home office and SOHO deployments, NethServer is equally at home in small business environments. + +![NethServer][8] + +Figure 3: Adding modules to NethServer. + +[Used with permission][6] + +### Rockstor + +Rockstor is a Linux and Btfrs powered advanced Network Attached Storage (NAS) and Cloud storage server that can be deployed for Home, SOHO, as well as small- and mid-sized businesses alike. With Rockstor, you get a full-blown NAS/Cloud solution with a user-friendly, web-based GUI tool that is just as easy for admins to set up as it is for users to use. Once you have Rockstor deployed, you can create pools, shares, snapshots, manage replication and users, share files (with the help of Samba, NFS, SFTP, and AFP), and even extend the featureset, thanks to add-ons (called Rock-ons). The list of Rock-ons includes: + + * CouchPotato (Downloader for usenet and bittorrent users) + + * Deluge (Movie downloader for bittorrent users) + + * EmbyServer (Emby media server) + + * Ghost (Publishing platform for professional bloggers) + + * GitLab CE (Git repository hosting and collaboration) + + * Gogs Go Git Service (Lightweight Git version control server and front end) + + * Headphones (An automated music downloader for NZB and Torrent) + + * Logitech Squeezebox Server for Squeezebox Devices + + * MariaDB (Relational database management system) + + * NZBGet (Efficient usenet downloader) + + * OwnCloud-Official (Secure file sharing and hosting) + + * Plexpy (Python-based Plex Usage tracker) + + * Rocket.Chat (Open Source Chat Platform) + + * SaBnzbd (Usenet downloader) + + * Sickbeard (Internet PVR for TV shows) + + * Sickrage (Automatic Video Library Manager for TV Shows) + + * Sonarr (PVR for usenet and bittorrent users) + + * Symform (Backup service) + + + + +Rockstor also includes an at-a-glance dashboard that gives admins quick access to all the information they need about their server (Figure 4). + +![Rockstor][10] + +The Rockstor dashboard in action. + +[Used with permission][6] + +### Zentyal + +Zentyal is another Small Business Server that does a great job of handling multiple tasks. If you’re looking for a Linux distribution that can handle the likes of: + + * Directory and Domain server + + * Mail server + + * Gateway + + * DHCP, DNS, and NTP server + + * Certification Authority + + * VPN + + * Instant Messaging + + * FTP server + + * Antivirus + + * SSO authentication + + * File sharing + + * RADIUS + + * Virtualization Management + + * And more + + + + +Zentyal might be your new go-to. Zentyal has been around since 2004 and is based on Ubuntu Server, so it enjoys a rock-solid base and plenty of applications. And with the help of the Zentyal dashboard (Figure 5), admins can easily manage: + + * System + + * Network + + * Logs + + * Software updates and installation + + * Users/groups + + * Domains + + * File sharing + + * Mail + + * DNS + + * Firewall + + * Certificates + + * And much more + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) + + +Adding new components to the Zentyal server is as simple as opening the Dashboard, clicking on Software Management > Zentyal Components, selecting what you want to add, and clicking Install. The one issue you might find with Zentyal is that it doesn’t offer nearly the amount of addons as you’ll find in the likes of Nethserver and ClearOS. But the services it does offer, Zentyal does incredibly well. + +### Plenty More Where These Came From + +This list of Linux servers is clearly not exhaustive. What it is, however, is a unique look at the top five server distributions you’ve probably not heard of. Of course, if you’d rather opt to use a more traditional Linux server distribution, you can always stick with [CentOS][11], [Ubuntu Server][12], [SUSE][13], [Red Hat Enterprise Linux][14], or [Debian][15]… most of which are found on every list of best server distributions on the market. If, however, you’re looking for something a bit different, give one of these five distos a try. + +Learn more about Linux through the free ["Introduction to Linux" ][16]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions + +作者:[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.clearos.com/clearfoundation/software/clearos-7-community +[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home +[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business +[4]: https://www.linux.com/files/images/fedoraserverjpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) +[6]: https://www.linux.com/licenses/category/used-permission +[7]: https://www.linux.com/files/images/nethserverjpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) +[9]: https://www.linux.com/files/images/rockstorejpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) +[11]: https://www.centos.org/ +[12]: https://www.ubuntu.com/download/server +[13]: https://www.suse.com/ +[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[15]: https://www.debian.org/ +[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20190118 Top 5 Linux Server Distributions.md b/translated/tech/20190118 Top 5 Linux Server Distributions.md deleted file mode 100644 index b263bb3b89..0000000000 --- a/translated/tech/20190118 Top 5 Linux Server Distributions.md +++ /dev/null @@ -1,190 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 5 Linux Server Distributions) -[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) - -另一种 5 个顶级 Linux 服务器发行版 -====== - -> Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。 - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) - -啊,这个古老的问题:哪种 Linux 发行版最适合做服务器?通常,问这种问题时,所浮现出来的标准的答复就是: - - * RHEL - * SUSE - * Ubuntu 服务器 - * Debian - * CentOS - -然而,假如你将眼界放得更宽(不将服务器只看做是 IDC 托管的那种互联网服务器时),可能答案会有点不同。我准备稍微来点不同的。我想做出一个满足入选标准的发行版列表,这些发行版不仅是优秀的候选者,而且易于使用,可以为你的业务中的许多功能提供服务。在某些情况下,我选择的是一些替代品,可以取代其它需要一些工作才能达成要求的操作系统。 - -我的一些选择是企业级服务器的社区版本,它们可以被视为购买更强大平台的入门级产品。你甚至可以在这里找到一两个作为特定任务平台的候选者。然而,最重要的是,你在此列表中找到的并非寻常的泛泛之辈。 - -### ClearOS - -什么是 ClearOS?对于家庭和小型企业用途,你可能找不到比它更好的解决方案。ClearOS 开箱即用,包括了入侵检测、强大的防火墙、带宽管理工具、邮件服务器、域控制器等工具。其目的是将服务器作为一个简单的家庭和 SOHO 服务器,并具有用户友好的基于 Web 的图形化界面,这使得 ClearOS 在某些评比中脱颖而出。从其界面中,你可以找到一个应用程序市场(图 1),其中包含数百个应用程序(其中一些是免费的,而另一些则具有相关费用),这使得扩展 ClearOS 功能集非常容易。换句话说,你可以将 ClearOS 作为你的家庭和小型企业所需的平台。最重要的是,与许多其他替代方案不同,你只需支付所需的软件和支持。 - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) - -*图 1:ClearOS 应用程序市场* - -有三种版本的 ClearOS: - - * [ClearOS Community][1] - 免费版 ClearOS - * [ClearOS Home][2] - 适于家庭办公 - * [ClearOS Business][3] - 适于小型企业,包括了付费支持。 - -为了使软件安装更加容易,ClearOS 应用市场允许你通过以下方式进行选择软件: - -   * 按功能(根据任务显示应用程序) -   * 按类别(显示相关应用程序组) -   * 快速选择文件(允许你按预先配置的模板选择,以帮助你快速启动和运行) - -换句话说,如果你正在寻找 Linux 的家庭、SOHO 或 SMB 服务器,ClearOS 是一个出色的选择(特别是如果你没有启动和运行标准的 Linux 服务器的能力时)。 - -### Fedora 服务器 - -你肯定听说过 Fedora Linux。它是市场上最好的前沿发行版之一。但是你知道这个出色的 Fedora 桌面发行版的开发者们也开发了服务器版吗?Fedora 服务器平台是一个短生命周期的、社区支持的服务器操作系统。这使得经验丰富的、或对任何类型的 Linux(或任何操作系统)有经验的系统管理员,可以使用开源社区中提供的最新技术。在这段描述中有三个关键词: - - * 经验丰富 - * 系统 - * 管理员 - -换言之,新用户就不要考虑了。虽然 Fedora 服务器完全能够处理你抛出的任何任务,但它需要一些拥有更多的 Linux 功夫的人来使它工作并且运行良好。Fedora 服务器非常好的一点是,开箱即用,它包括了市场上用于服务器的开源的基于 Web 的最好的界面之一。通过 Cockpit(图 2),你可以快速浏览系统资源、日志、存储、网络以及拥有管理帐户、服务、应用程序和更新的能力。 - -![Fedora Server][5] - -*图 2:运行在 Fedora 服务器上的 Cockpit* - -如果你可以使用最前沿的软件,并想要一个出色的管理仪表板,Fedora 服务器可能就是你要的平台。 - -### NethServer - -正如你所发现的那样,NethServer 是每个人都知道的简单 SMB Linux 服务器。通过 NethServer 的最新版本,你的小型企业将得到: - - * 内置 Samba 活动目录控制器 -   * 与 Nextcloud 的无缝集成 -   * 证书管理 -   * HTTPS 透明代理 -   * 防火墙 -   * 邮件服务器和过滤器 -   * Web 服务器和过滤器 -   * 群件 -   * IPS / IDS 或 VPN - -所有包含的功能都可以通过用户友好的基于 Web 的界面轻松配置,包括单击安装模块以扩展 NethServer 功能集(图 3)。NethServer 与 ClearOS 的区别在于它的设计目的是使管理工作更轻松。换句话说,这个平台提供了更多的灵活性和功能。与面向家庭办公室和 SOHO 部署的 ClearOS 不同,NethServer 在小型商业环境中用起来就像在家庭里使用一样方便。 - -![NethServer][8] - -*图 3:给 NethServer 添加模块* - -### Rockstor - -Rockstor 是采用 Linux 和 Btfrs 的高级网络附加存储(NAS)和云存储服务器,可部署用于家庭、SOHO 以及中小型企业。借助 Rockstor,你可以获得一个完整的 NAS /云解决方案,其中包含一个用户友好的基于 Web 的 GUI 工具,管理员可以像普通用户一样轻松使用它来设置。一旦部署好了 Rockstor,你就可以创建存储池、共享、快照、管理复制和用户、共享文件(借助 Samba、NFS、SFTP 和 AFP),甚至扩展它的功能集,这要归功于附加组件(称为 Rock-ons)。Rock-ons 列表包括: - - * CouchPotato(Usenet 和 BitTorrent 用户的下载器) - * Deluge(BitTorrent 用户的电影下载器) - * EmbyServer(Emby 媒体服务器) - * Ghost(专业博主的发布平台) - * GitLab CE(Git 仓库托管和协作) - * Gogs Go Git Service(轻量级 Git 版本控制服务器和前端) - * Headphones(NZB 和 Torrent 的音乐自动下载器) - * 用于 Squeezebox 设备的罗技 Squeezebox 服务器 - * MariaDB(关系型数据管理系统) - * NZBGet(高效的 usenet 下载器) - * OwnCloud-Official(安全的文件共享和托管) - * Plexpy(基于 Python 的 Plex 用量跟踪器) - * Rocket.Chat(开源聊天平台) - * SaBnzbd(Usenet 下载器) - * Sickbeard(用于电视节目的互联网个人视频录像机) - * Sickrage(电视节目的自动视频库管理器) - * Sonarr(Usenet 和 BitTorrent 用户的个人视频录像机) - * Symform(备份设备) - -Rockstor 还包括了一目了然的仪表板,使管理员可以快速访问他们所需的有关其服务器的所有信息(图 4)。 - -![Rockstor][10] - -*图 4: Rockstor 面板* - -### Zentyal - -Zentyal 是另一个小型企业服务器,可以很好地处理多个任务。如果你正在寻找可以处理以下内容的 Linux 发行版: - - * 目录和域服务器 - * 邮件服务器 - * 网关 - * DHCP、DNS 和 NTP 服务器 - * 认证机构(CA) - * VPN - * 实时消息(IM) - * FTP 服务器 - * 反病毒 - * SSO 认证 - * 文件共享 - * RADIUS 认证 - * 虚拟化管理 - * 等等 - -Zentyal 可能是你的新选择。从 2004 年 Zentyal 就存在了,它基于 Ubuntu Server,因此它拥有坚实的基础和丰富的应用程序。在 Zentyal 仪表板的帮助下(图 5),管理员可以轻松管理: - - * 系统 - * 网络 - * 日志 - * 软件更新和安装 - * 用户/组 - * 域 - * 文件共享 - * 邮件 - * DNS - * 防火墙 - * 证书 - * 等等 - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) - -*图 5:Zentyal 仪表板* - -向 Zentyal 服务器添加新组件只需要打开仪表板,单击“软件管理” -> “Zentyal 组件”,选择要添加的组件,然后单击安装。Zentyal 可能会遇到的一个问题是,它提供不了与 Nethserver 和 ClearOS 一样多的插件。但它提供的服务,则做得非常好。 - -### 更多来自于 - -这个 Linux 服务器列表显然不是详尽无遗的。然而,这是一种对你可能没有听说过的五大服务器发行版的独特视角。当然,如果你更愿意使用更传统的 Linux 服务器发行版,你可以随时坚持使用 [CentOS][11]、[Ubuntu 服务器][12]、[SUSE][13]、[RHEL][14] 或 [Debian][15]……它们大多都出现在市场上最好的服务器发行版列表中。但是,如果你正在寻找一些不同的东西,那么试试这五个发行版中的一个。 - -通过 Linux 基金会和 edX 的免费[“Linux 简介”][16]课程了解有关 Linux 的更多信息。 - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions - -作者:[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.clearos.com/clearfoundation/software/clearos-7-community -[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home -[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business -[4]: https://www.linux.com/files/images/fedoraserverjpg -[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) -[6]: https://www.linux.com/licenses/category/used-permission -[7]: https://www.linux.com/files/images/nethserverjpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) -[9]: https://www.linux.com/files/images/rockstorejpg -[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) -[11]: https://www.centos.org/ -[12]: https://www.ubuntu.com/download/server -[13]: https://www.suse.com/ -[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[15]: https://www.debian.org/ -[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 5cd0650e14e3bd31e00dbadcaf05caa2b719039f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 20:21:15 +0800 Subject: [PATCH 0791/4278] PUB:20180722 Dawn of the Microcomputer- The Altair 8800.md @zhs852 https://linux.cn/article-10482-1.html --- .../20180722 Dawn of the Microcomputer- The Altair 8800.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180722 Dawn of the Microcomputer- The Altair 8800.md (100%) diff --git a/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/published/20180722 Dawn of the Microcomputer- The Altair 8800.md similarity index 100% rename from translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md rename to published/20180722 Dawn of the Microcomputer- The Altair 8800.md From 484178f9066002edde72d651eab40cba13f7d079 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 20:51:20 +0800 Subject: [PATCH 0792/4278] PUB:20180606 Working with modules in Fedora 28.md @geekpi --- ...80606 Working with modules in Fedora 28.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) rename {translated/tech => published}/20180606 Working with modules in Fedora 28.md (90%) diff --git a/translated/tech/20180606 Working with modules in Fedora 28.md b/published/20180606 Working with modules in Fedora 28.md similarity index 90% rename from translated/tech/20180606 Working with modules in Fedora 28.md rename to published/20180606 Working with modules in Fedora 28.md index bf5c4237f2..338e6accc6 100644 --- a/translated/tech/20180606 Working with modules in Fedora 28.md +++ b/published/20180606 Working with modules in Fedora 28.md @@ -23,7 +23,7 @@ sudo dnf -y update dnf module list ``` -输出列出了一组模块,这些模块显示了每个模块的关联流、版本和可用安装配置文件。模块流旁边的 `[d]` 表示安装命名模块时使用的默认流。 +输出列出了一组模块,这些模块显示了每个模块的关联的流、版本和可用安装配置文件。模块流旁边的 `[d]` 表示安装命名模块时使用的默认流。 输出还显示大多数模块都有名为 `default` 的配置文件。这不是巧合,因为 `default` 是默认配置文件使用的名称。 @@ -83,22 +83,22 @@ sudo dnf -y module install reviewboard/server 但是,安装 reviewboard:3.0/server 配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 —— 因此无需安装。 -### 启动 Review Board 网站 +### 启动 Review Board 网站 现在已经安装了 Review Board 3.0 模块及其相关软件包,[创建一个本地运行的 Review Board 网站][6]。无需解释,请复制并粘贴以下命令: ``` sudo rb-site install --noinput \ - --domain-name=localhost --db-type=sqlite3 \ - --db-name=/var/www/rev.local/data/reviewboard.db \ - --admin-user=rbadmin --admin-password=secret \ - /var/www/rev.local + --domain-name=localhost --db-type=sqlite3 \ + --db-name=/var/www/rev.local/data/reviewboard.db \ + --admin-user=rbadmin --admin-password=secret \ + /var/www/rev.local sudo chown -R apache /var/www/rev.local/htdocs/media/uploaded \ - /var/www/rev.local/data + /var/www/rev.local/data sudo ln -s /var/www/rev.local/conf/apache-wsgi.conf \ - /etc/httpd/conf.d/reviewboard-localhost.conf + /etc/httpd/conf.d/reviewboard-localhost.conf sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \ - httpd_can_network_memcache=1 httpd_unified=1 + httpd_can_network_memcache=1 httpd_unified=1 sudo systemctl enable --now httpd ``` @@ -131,7 +131,7 @@ via: https://fedoramagazine.org/working-modules-fedora-28/ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://fedoramagazine.org/author/merlinm/ -[1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/ +[1]:https://linux.cn/article-10479-1.html [2]:https://getfedora.org/server/ [3]:https://fedoramagazine.org/howto-use-sudo/ [4]:https://fedoramagazine.org/modularity-fedora-28-server-edition/#comment-476696 From 9e474c5f0feee1eb6c4d6e206c16716c77d8ae71 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 20:54:23 +0800 Subject: [PATCH 0793/4278] TSD:20190120 Get started with HomeBank, an open source personal finance app.md @wxy --- .../tech/20190118 Top 5 Linux Server Distributions.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190118 Top 5 Linux Server Distributions.md (100%) diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/translated/tech/20190118 Top 5 Linux Server Distributions.md similarity index 100% rename from sources/tech/20190118 Top 5 Linux Server Distributions.md rename to translated/tech/20190118 Top 5 Linux Server Distributions.md From 1f6daa8df96978ee367137e3d090bdf4e28d8a2d Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 27 Jan 2019 19:59:21 +0800 Subject: [PATCH 0794/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=2020181203=20How=20to=20bring=20good...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ing good fortune to your Linux terminal.md | 86 ------------------- ...ing good fortune to your Linux terminal.md | 86 +++++++++++++++++++ 2 files changed, 86 insertions(+), 86 deletions(-) delete mode 100644 sources/tech/20181203 How to bring good fortune to your Linux terminal.md create mode 100644 translated/tech/20181203 How to bring good fortune to your Linux terminal.md diff --git a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md b/sources/tech/20181203 How to bring good fortune to your Linux terminal.md deleted file mode 100644 index 28bd2996a1..0000000000 --- a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (How to bring good fortune to your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) - -How to bring good fortune to your Linux terminal -====== -Bring quotes and quips to the command line with the fortune utility. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-fortune.png?itok=5PVVZVer) - -It's December, and if you haven't found a [tech advent calendar][1] that sparks your fancy yet, well, maybe this one will do the trick. Every day, from now to the 24th, we're bringing you a different Linux command-line toy. What's a command-line toy, you ask? It could be a game or any simple diversion to bring a little happiness to your terminal. - -You may have seen some of these before. We hope you'll find something new, too. Either way, we hope you have fun following along. - -Today's toy, **fortune** , is an old one. Versions of it date back to the 1980s when it was included with Unix. The version I installed in Fedora was available under a BSD license, and I grabbed it with the following. - -``` -$ sudo dnf install fortune-mod -y -``` - -Your distribution may be different. On some, you may need to install the fortunes separately from **fortune** itself (try searching your package manager for "fortunes*"). You can also check out the source code on [GitHub][2]. Then, just run **fortune** to get, well, a fortune. - -``` -$ fortune -"Time is an illusion.  Lunchtime doubly so." --- Ford Prefect, _Hitchhiker's Guide to the Galaxy_ -``` - -So why do you need fortunes at the terminal? For fun, of course. Perhaps you'd like to add them to the message of the day on your system? - -Personally, I like using the **fortune** command as a built-in piece of dummy data when I'm using the terminal to parse text, particularly with [regular expressions][3], and want something simple to try it out on. - -For example, let's say I was testing our a transformation with the **tr** command to replace letter the letter e with a numeral 3. - -``` -$ fortune | tr 'eE' '3' -Unix 3xpr3ss: -All pass3ng3r bring a pi3c3 of th3 a3roplan3 and a box of tools with th3m to -th3 airport. Th3y gath3r on th3 tarmac, arguing constantly about what kind -of plan3 th3y want to build and how to put it tog3th3r. 3v3ntually, th3 -pass3ng3rs split into groups and build s3v3ral diff3r3nt aircraft, but giv3 -th3m all th3 sam3 nam3. Som3 pass3ng3rs actually r3ach th3ir d3stinations. -All pass3ng3rs b3li3v3 th3y got th3r3. -``` - -So what fortunes come with your distribution? Take a look in your **/usr/share/games/fortune** directory to find them all. Here are a few of my favorites. - -``` -Never laugh at live dragons. -                -- Bilbo Baggins [J.R.R. Tolkien, "The Hobbit"] - -I dunno, I dream in Perl sometimes... -             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> - -I have an existential map.  It has "You are here" written all over it. -                -- Steven Wright -``` - -Looking for more on **fortune**? You can, of course, always check out the man page to learn more about the options, or read a little bit more about the history of the command on [Wikipedia][4]. - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Drive a locomotive through your Linux terminal][5], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-fortune - -作者:[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/16/11/7-tech-advent-calendars-holiday-season -[2]: https://github.com/shlomif/fortune-mod -[3]: https://opensource.com/article/18/5/getting-started-regular-expressions -[4]: https://en.wikipedia.org/wiki/Fortune_%28Unix%29 -[5]: https://opensource.com/article/18/12/linux-toy-sl diff --git a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md b/translated/tech/20181203 How to bring good fortune to your Linux terminal.md new file mode 100644 index 0000000000..19d703afab --- /dev/null +++ b/translated/tech/20181203 How to bring good fortune to your Linux terminal.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (How to bring good fortune to your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) +[#]: url: ( ) + +如何为你的 Linux 终端带来好运 +====== +使用 fortune 实用程序将引号和俏皮话带到命令行。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-fortune.png?itok=5PVVZVer) + +这是 12 月,如果你还没有找到一款能激发你灵感的[科技降临节日历][1],那么,也许这个系列可以。从现在到 24 日,每天我们都会为你带来一个不同的 Linux 命令行玩具。你可能会问,什么是命令行玩具?它可能是一个游戏或任何简单的娱乐,为你的终端带来一点点快乐。 + +你可能之前已经看过其中的一些,我们希望你也能发现一些新的东西。不管怎样,我们都希望你在关注时保有乐趣。 + +今天的玩具是 **fortune**,它很古老。它的版本可以追溯到 1980 年,当时它包含在 Unix 中。我在 Fedora 中安装的版本是在 BSD 许可下提供的,我可以使用以下命令获取它。 +``` +$ sudo dnf install fortune-mod -y +``` + +你的发行版可能会有所不同。在某些情况下,你可能需要将 fortunes 独立于 **fortune** 本身安装(尝试在你的包管理器中搜索 "fortunes")。你还可以在 [GitHub][2] 上查看它的源代码,然后,只需运行 **fortune** 即可获得好运。 + +``` +$ fortune +"Time is an illusion.  Lunchtime doubly so." +-- Ford Prefect, _Hitchhiker's Guide to the Galaxy_ +``` + +那么,你为什么会在终端上需要 fortune 呢?当然是为了好玩啦。也许你想将它们添加到系统上的每天消息中? + +就我个人而言,当我使用终端来解析文本时,我喜欢使用 **fortune** 命令作为一段内置的虚拟数据,特别是使用[正则表达式][3]时,我想要一些简单的东西来尝试一下。 + +例如,假设我使用 **tr** 命令来测试转换,用数字 3 替换字母 e。 + +``` +$ fortune | tr 'eE' '3' +Unix 3xpr3ss: +All pass3ng3r bring a pi3c3 of th3 a3roplan3 and a box of tools with th3m to +th3 airport. Th3y gath3r on th3 tarmac, arguing constantly about what kind +of plan3 th3y want to build and how to put it tog3th3r. 3v3ntually, th3 +pass3ng3rs split into groups and build s3v3ral diff3r3nt aircraft, but giv3 +th3m all th3 sam3 nam3. Som3 pass3ng3rs actually r3ach th3ir d3stinations. +All pass3ng3rs b3li3v3 th3y got th3r3. +``` + +那么 fortunes 到底为你的发行版带来了什么呢?看看你的 **/usr/share/games/fortune** 目录,找到它们。以下我最喜欢的几个。 +``` +Never laugh at live dragons. +                -- Bilbo Baggins [J.R.R. Tolkien, "The Hobbit"] + +I dunno, I dream in Perl sometimes... +             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> + +I have an existential map.  It has "You are here" written all over it. +                -- Steven Wright +``` + +想要了解更多关于 **fortune**?当然,你可以经常查看 man 页来了解更多选项,或者在[维基百科][4]上阅读更多关于此命令的历史信息。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +看看昨天的玩具:[驾驶火车头通过你的 Linux 终端][5]。记得明天再来! + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-fortune + +作者:[Jason Baker][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/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/16/11/7-tech-advent-calendars-holiday-season +[2]: https://github.com/shlomif/fortune-mod +[3]: https://opensource.com/article/18/5/getting-started-regular-expressions +[4]: https://en.wikipedia.org/wiki/Fortune_%28Unix%29 +[5]: https://opensource.com/article/18/12/linux-toy-sl From 68fb5efd01a9f10bd917f5eb315901c6b2294348 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 21:45:16 +0800 Subject: [PATCH 0795/4278] APL:20190118 Get started with WTF, a dashboard for the terminal --- ...190118 Get started with WTF, a dashboard for the terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md index 822cd8b7e8..55e2ee93fa 100644 --- a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md +++ b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b9773d230c8e3e7cad307a5becf6d8e211b72f5c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 23:23:38 +0800 Subject: [PATCH 0796/4278] TSD:20190118 Get started with WTF, a dashboard for the terminal.md --- ... with WTF, a dashboard for the terminal.md | 90 ------------------ ... with WTF, a dashboard for the terminal.md | 91 +++++++++++++++++++ 2 files changed, 91 insertions(+), 90 deletions(-) delete mode 100644 sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md create mode 100644 translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md diff --git a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md deleted file mode 100644 index 55e2ee93fa..0000000000 --- a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md +++ /dev/null @@ -1,90 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with WTF, a dashboard for the terminal) -[#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard) -[#]: author: (Kevein Sonney https://opensource.com/users/ksonney) - -Get started with WTF, a dashboard for the terminal -====== -Keep key information in view with WTF, the sixth 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 sixth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### WTF - -Once upon a time, I was doing some consulting at a firm that used [Bloomberg Terminals][1] . My reaction was, "Wow, that's WAY too much information on one screen." These days, however, it seems like I can't get enough information on a screen when I'm working and have multiple web pages, dashboards, and console apps open to try to keep track of things. - -While [tmux][2] and [Screen][3] can do split screens and multiple windows, they are a pain to set up, and the keybindings can take a while to learn (and often conflict with other applications). - -[WTF][4] is a simple, easily configured information dashboard for the terminal. It is written in [Go][5], uses a YAML configuration file, and can pull data from several different sources. All the data sources are contained in [modules][6] and include things like weather, issue trackers, date and time, Google Sheets, and a whole lot more. Some panes are interactive, and some just update with the most recent information available. - -Setup is as easy as downloading the latest release for your operating system and running the command. Since it is written in Go, it is very portable and should run anywhere you can compile it (although the developer only builds for Linux and MacOS at this time). - -![](https://opensource.com/sites/default/files/uploads/wtf-1.png) - -When you run WTF for the first time, you'll get the default screen, identical to the image above. - -![](https://opensource.com/sites/default/files/uploads/wtf-2.png) - -You also get the default configuration file in **~/.wtf/config.yml** , and you can edit the file to suit your needs. The grid layout is configured in the top part of the file. - -``` -grid: -  columns: [45, 45] -  rows: [7, 7, 7, 4] -``` - -The numbers in the grid settings represent the character dimensions of each block. The default configuration is two columns of 40 characters, two rows 13 characters tall, and one row 4 characters tall. In the code above, I made the columns wider (45, 45), the rows smaller, and added a fourth row so I can have more widgets. - -![](https://opensource.com/sites/default/files/uploads/wtf-3.png) - -I like to see the day's weather on my dashboard. There are two weather modules to chose from: [Weather][7], which shows just the text information, and [Pretty Weather][8], which is colorful and uses text-based graphics in the display. - -``` -prettyweather: -  enabled: true -  position: -    top: 0 -    left: 1 -    height: 2 -    width: 1 -``` - -This code creates a pane two blocks tall (height: 2) and one block wide (height: 1), positioned on the second column (left: 1) on the top row (top: 0) containing the Pretty Weather module. - -Some modules, like Jira, GitHub, and Todo, are interactive, and you can scroll, update, and save information in them. You can move between the interactive panes using the Tab key. The \ key brings up a help screen for the active pane so you can see what you can do and how. The Todo module lets you add, edit, and delete to-do items, as well as check them off as you complete them. - -![](https://opensource.com/sites/default/files/uploads/wtf-4.png) - -There are also modules to execute commands and present the output, watch a text file, and monitor build and integration server output. All the documentation is very well done. - -WTF is a valuable tool for anyone who needs to see a lot of data on one screen from different sources. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/wtf-information-dashboard - -作者:[Kevein Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Bloomberg_Terminal -[2]: https://github.com/tmux/tmux -[3]: https://www.gnu.org/software/screen/ -[4]: https://wtfutil.com/ -[5]: https://golang.org/ -[6]: https://wtfutil.com/posts/modules/ -[7]: https://wtfutil.com/posts/modules/weather/ -[8]: https://wtfutil.com/posts/modules/prettyweather/ diff --git a/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md new file mode 100644 index 0000000000..5bb1d135af --- /dev/null +++ b/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with WTF, a dashboard for the terminal) +[#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard) +[#]: author: (Kevein Sonney https://opensource.com/users/ksonney) + +开始使用 WTF 吧,一款终端仪表板 +====== + +> 使用 WTF 将关键信息置于视野之中,这个系列中第六个开源工具可使你在 2019 年更有工作效率。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。 + +### WTF + +曾几何时,我在一家使用[彭博终端][1]的公司做咨询。我的反应是,“哇,在一个屏幕上显示的信息太多了。” 然而,现在,当我正在工作并且打开多个网页、仪表板和控制台应用程序以试图跟踪事物时,我似乎无法在屏幕上获得足够的信息。 + +虽然 [tmux][2] 和 [Screen][3] 可以进行分屏和打开多个窗口,但它们很难设置,并且它们的键绑定可能需要一段时间才能学会(还经常与其他应用程序冲突)。 + +[WTF][4] 是一个简单的、易于配置的终端信息仪表板。它是用 [Go][5] 语言编写的,使用 YAML 配置文件,可以从几个不同的源提取数据。所有的数据源都包含在[模块][6]中,包括天气、问题跟踪器、日期和时间、Google 表格以及更多内容。有些窗格是交互式的,有些窗格只是使用最新的信息进行更新。 + +安装它就像下载适用于您的操作系统的最新版本并运行命令一样简单。因为它是用 Go 编写的,所以它的移植性很好,应该可以在任何可以编译它的地方运行(尽管开发人员目前只为 Linux 和 MacOS 做了构建)。 + +![](https://opensource.com/sites/default/files/uploads/wtf-1.png) + +当您第一次运行 WTF 时,您将看到如上图的默认屏幕。 + +![](https://opensource.com/sites/default/files/uploads/wtf-2.png) + +其默认配置文件在 `~/.wtf/config.yml`,您可以编辑该文件以满足您的需要。网格布局的配置在文件的顶部。 + +``` +grid: +  columns: [45, 45] +  rows: [7, 7, 7, 4] +``` + +网格设置中的数字表示每个块的字符尺寸。默认配置是两列,每列 40 个字符,两行 13 个字符高,一行 4 个字符高。在上面的代码中,我使列更宽(`45,45`),行更小,并添加了第四行,所以我可以放更多的小部件。 + +![](https://opensource.com/sites/default/files/uploads/wtf-3.png) + +我喜欢在仪表板上看到当天的天气。有两个天气模块可供选择:[Weather][7],它只显示文本信息;[Pretty Weather][8] 则色彩丰富,并使用基于文本的图形显示。 + +``` +prettyweather: +  enabled: true +  position: +    top: 0 +    left: 1 +    height: 2 +    width: 1 +``` + +此代码创建了一个窗格,高为两个块(`height: 2`),宽为一个块(`width: 1`),位于顶行(`top: 0`)的第二列(`left: 1`)上,包含 Pretty Weather 模块. + +一些模块是交互式的,如 Jira、GitHub 和 Todo,您可以在其中滚动、更新和保存信息。您可以使用 Tab 键在交互式窗格之间移动。`\` 键会显示活动窗格的帮助屏幕,以便您可以查看可以执行的操作以及操作方式。Todo 模块允许您添加、编辑和删除待办事项,并在完成后勾掉它们。 + +![](https://opensource.com/sites/default/files/uploads/wtf-4.png) + +还有一些模块可以执行命令并显示输出、监视文本文件,以及监视构建和集成服务器的输出。所有文档都做得很好。 + +对于需要在不同来源的一个屏幕上查看大量数据的人来说,WTF 是一个有价值的工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/wtf-information-dashboard + +作者:[Kevein Sonney][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/ksonney +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Bloomberg_Terminal +[2]: https://github.com/tmux/tmux +[3]: https://www.gnu.org/software/screen/ +[4]: https://wtfutil.com/ +[5]: https://golang.org/ +[6]: https://wtfutil.com/posts/modules/ +[7]: https://wtfutil.com/posts/modules/weather/ +[8]: https://wtfutil.com/posts/modules/prettyweather/ From b555c287567dc26b01b36e76352650bff922e18d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 23:37:09 +0800 Subject: [PATCH 0797/4278] PUB:20190118 Get started with WTF, a dashboard for the terminal.md @wxy https://linux.cn/article-10484-1.html --- ... Get started with WTF, a dashboard for the terminal.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename {translated/tech => published}/20190118 Get started with WTF, a dashboard for the terminal.md (97%) diff --git a/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/published/20190118 Get started with WTF, a dashboard for the terminal.md similarity index 97% rename from translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md rename to published/20190118 Get started with WTF, a dashboard for the terminal.md index 5bb1d135af..c7da18b982 100644 --- a/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md +++ b/published/20190118 Get started with WTF, a dashboard for the terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10484-1.html) [#]: subject: (Get started with WTF, a dashboard for the terminal) [#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard) [#]: author: (Kevein Sonney https://opensource.com/users/ksonney) @@ -75,7 +75,7 @@ via: https://opensource.com/article/19/1/wtf-information-dashboard 作者:[Kevein Sonney][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 e7c84daf3fbbd59b3075a439c20b26fa8f158973 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 Jan 2019 08:51:55 +0800 Subject: [PATCH 0798/4278] translated --- ...The Linux terminal is no one-trick pony.md | 66 ------------------- ...The Linux terminal is no one-trick pony.md | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 66 deletions(-) delete mode 100644 sources/tech/20181214 The Linux terminal is no one-trick pony.md create mode 100644 translated/tech/20181214 The Linux terminal is no one-trick pony.md diff --git a/sources/tech/20181214 The Linux terminal is no one-trick pony.md b/sources/tech/20181214 The Linux terminal is no one-trick pony.md deleted file mode 100644 index 56b7711659..0000000000 --- a/sources/tech/20181214 The Linux terminal is no one-trick pony.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Linux terminal is no one-trick pony) -[#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -The Linux terminal is no one-trick pony -====== -Bring the magic of My Little Pony to your Linux command line. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-ponysay.png?itok=ehl6pTr_) - -Welcome to another day of the 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. - -Reader [Lori][1] made the suggestion of today's toy in a comment on my previous article on [cowsay][2]: - -"Hmmm, I've been playing with something called ponysay which seems to be a full-color variant on your cowsay." - -Intrigued, I had to check it out, and I was not disappointed with what I found. - -In a nutshell, **[ponysay][3]** is exactly that: a rewrite of **cowsay** that includes many full-color characters from [My Little Pony][4], that you can use to output phrases at the Linux command line. It's actually a really well-done project, that features over 400 characters and character combinations, and is incredibly well documented in a [78-page PDF][5] covering full usage. - -To install **ponysay** , you'll want to check out the project [README][6] to select the installation method that works best for your distribution and situation. Since ponysay didn't appear to be packaged for my distribution, Fedora, I opted to try out the Docker container image, but do what works best for you; installation from source may also work for you. - -I was curious to try out [**podman**][7] as a drop-in replacement for **docker** for a casual container users, and for me at least, it just worked! - -``` -$ podman run -ti --rm mpepping/ponysay 'Ponytastic' -``` - -The outputs are amazing, and I challenge you to try it out and let me know your favorite. Here was one of mine: - -![](https://opensource.com/sites/default/files/uploads/linux-toy-ponysay-output.png) - -It's developers chose to write the code in [Pony][8]! (Update: Sadly, I was wrong about this. It's written in Python, though GitHub believes it to be Pony because of the file extensions.) Ponysay is licensed under the GPL version 3, and you can pick up its source code [on GitHub][3]. - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Relax by the fire at your Linux terminal][9], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-ponysay - -作者:[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/users/n8chz -[2]: https://opensource.com/article/18/12/linux-toy-cowsay -[3]: https://github.com/erkin/ponysay -[4]: https://en.wikipedia.org/wiki/My_Little_Pony -[5]: https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true -[6]: https://github.com/erkin/ponysay/blob/master/README.md -[7]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers -[8]: https://opensource.com/article/18/5/pony -[9]: https://opensource.com/article/18/12/linux-toy-aafire diff --git a/translated/tech/20181214 The Linux terminal is no one-trick pony.md b/translated/tech/20181214 The Linux terminal is no one-trick pony.md new file mode 100644 index 0000000000..c33a8b0e85 --- /dev/null +++ b/translated/tech/20181214 The Linux terminal is no one-trick pony.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Linux terminal is no one-trick pony) +[#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Linux 终端能做其他事 +====== +将小马宝莉的魔力带到终端 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-ponysay.png?itok=ehl6pTr_) + +欢迎再次来到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们正在思考中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 + +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +读者 [Lori][1] 在我之前关于 [cowsay][2] 的文章的评论中提出了今天玩具的建议: + +“嗯,我一直在玩一个叫 ponysay 的东西,它似乎是你的 cowsay 的彩色变种。” + +我对此感到好奇,并去看了一下,发现没有让我失望。 + +简而言之,**[ponysay][3]** 的 **cowsay**的重写,它包括了来自[小马宝莉][4]中的许多全彩色人物,你可以用它在 Linux 命令行输出短句。它实际上是一个非常完善的项目,拥有超过 400 个字符和字符组合,它还有让人难以置信的的[ 78 页的 PDF 文档][5]涵盖了了所有的用法。 + +要安装 **ponysay**,你需要查看项目的 [README][6] 来选择最适合你的发行版和情况的安装方法。由于 ponysay 似乎没有为我的 Fedora 发行版打包,我选择试用 Docker 容器镜像,但你可以选择最适合你的方法。从源码安装可能也适合你。 + +作为一个业余容器用户,我很想试试 [**podman**][7] 来代替 **docker**。至少对于我而言,它可以正常工作。 + +``` +$ podman run -ti --rm mpepping/ponysay 'Ponytastic' +``` + +输出很神奇,我建议你也试下,然后告诉我你最喜欢的。这是我其中一个: + +![](https://opensource.com/sites/default/files/uploads/linux-toy-ponysay-output.png) + +它的开发人员选择用 [Pony][8] 来编写代码。(更新:很遗憾我写错了。虽然 Gihutb 根据它的文件扩展名认为它是 Pony,但是它是用 Python 写的。)Ponysay 使用 GPLv3 许可,你可以在 [GitHub][3] 中获取它的源码。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +查看昨天的玩具,[在 Linux 终端中用火焰放松][9],记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-ponysay + +作者:[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/users/n8chz +[2]: https://opensource.com/article/18/12/linux-toy-cowsay +[3]: https://github.com/erkin/ponysay +[4]: https://en.wikipedia.org/wiki/My_Little_Pony +[5]: https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true +[6]: https://github.com/erkin/ponysay/blob/master/README.md +[7]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers +[8]: https://opensource.com/article/18/5/pony +[9]: https://opensource.com/article/18/12/linux-toy-aafire From 5901202d1d4517ecbe92503b9db4735f22bcd493 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 Jan 2019 08:55:18 +0800 Subject: [PATCH 0799/4278] translating --- ...tarted with HomeBank, an open source personal finance app.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md index 0c905c86f5..a925448cfb 100644 --- a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md +++ b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 648ae2536ed5b84a899e64238a1b07e26c357281 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:03:46 +0800 Subject: [PATCH 0800/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190127=20Get?= =?UTF-8?q?=20started=20with=20eDEX-UI,=20a=20Tron-influenced=20terminal?= =?UTF-8?q?=20program=20for=20tablets=20and=20desktops=20sources/tech/2019?= =?UTF-8?q?0127=20Get=20started=20with=20eDEX-UI,=20a=20Tron-influenced=20?= =?UTF-8?q?terminal=20program=20for=20tablets=20and=20desktops.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rminal program for tablets and desktops.md | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md diff --git a/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md new file mode 100644 index 0000000000..f181f4ebd1 --- /dev/null +++ b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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)) + +Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops +====== +Make work more fun with eDEX-UI, the 15th 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/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) + +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 15th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### eDEX-UI + +I was 11 years old when [Tron][1] was in movie theaters. I cannot deny that, despite the fantastical nature of the film, it had an impact on my career choice later in life. + +![](https://opensource.com/sites/default/files/uploads/edex-ui-1.png) + +[eDEX-UI][2] is a cross-platform terminal program designed for tablets and desktops that was inspired by the user interface in Tron. It has five terminals in a tabbed interface, so it is easy to switch between tasks, as well as useful displays of system information. + +At launch, eDEX-UI goes through a boot sequence with information about the ElectronJS system it is based on. After the boot, eDEX-UI shows system information, a file browser, a keyboard (for tablets), and the main terminal tab. The other four tabs (labeled EMPTY) don't have anything loaded and will start a shell when you click on one. The default shell in eDEX-UI is Bash (if you are on Windows, you will likely have to change it to either PowerShell or cmd.exe). + +![](https://opensource.com/sites/default/files/uploads/edex-ui-2.png) + +Changing directories in the file browser will change directories in the active terminal and vice-versa. The file browser does everything you'd expect, including opening associated applications when you click on a file. The one exception is eDEX-UI's settings.json file (in .config/eDEX-UI by default), which opens the configuration editor instead. This allows you to set the shell command for the terminals, change the theme, and modify several other settings for the user interface. Themes are also stored in the configuration directory and, since they are also JSON files, creating a custom theme is pretty straightforward. + +![](https://opensource.com/sites/default/files/uploads/edex-ui-3.png) + +eDEX-UI allows you to run five terminals with full emulation. The default terminal type is xterm-color, meaning it has full-color support. One thing to be aware of is that the keys light up on the keyboard while you type, so if you're using eDEX-UI on a tablet, the keyboard could present a security risk in environments where people can see the screen. It is better to use a theme without the keyboard on those devices, although it does look pretty cool when you are typing. + +![](https://opensource.com/sites/default/files/uploads/edex-ui-4.png) + +While eDEX-UI supports only five terminal windows, that has been more than enough for me. On a tablet, eDEX-UI gives me that cyberspace feel without impacting my productivity. On a desktop, eDEX-UI allows all of that and lets me look cool in front of my co-workers. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-edex-ui + +作者:[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/Tron +[2]: https://github.com/GitSquared/edex-ui From 03c1561b44b4723cd079d01ce565cd39cc6ff023 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:06:04 +0800 Subject: [PATCH 0801/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20GStr?= =?UTF-8?q?eamer=20WebRTC:=20A=20flexible=20solution=20to=20web-based=20me?= =?UTF-8?q?dia=20sources/tech/20190123=20GStreamer=20WebRTC-=20A=20flexibl?= =?UTF-8?q?e=20solution=20to=20web-based=20media.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... A flexible solution to web-based media.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20190123 GStreamer WebRTC- A flexible solution to web-based media.md diff --git a/sources/tech/20190123 GStreamer WebRTC- A flexible solution to web-based media.md b/sources/tech/20190123 GStreamer WebRTC- A flexible solution to web-based media.md new file mode 100644 index 0000000000..bb7e129ff3 --- /dev/null +++ b/sources/tech/20190123 GStreamer WebRTC- A flexible solution to web-based media.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GStreamer WebRTC: A flexible solution to web-based media) +[#]: via: (https://opensource.com/article/19/1/gstreamer) +[#]: author: (Nirbheek Chauhan https://opensource.com/users/nirbheek) + +GStreamer WebRTC: A flexible solution to web-based media +====== +GStreamer's WebRTC implementation eliminates some of the shortcomings of using WebRTC in native apps, server applications, and IoT devices. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe) + +Currently, [WebRTC.org][1] is the most popular and feature-rich WebRTC implementation. It is used in Chrome and Firefox and works well for browsers, but the Native API and implementation have several shortcomings that make it a less-than-ideal choice for uses outside of browsers, including native apps, server applications, and internet of things (IoT) devices. + +Last year, our company ([Centricular][2]) made an independent implementation of a Native WebRTC API available in GStreamer 1.14. This implementation is much easier to use and more flexible than the WebRTC.org Native API, is transparently compatible with WebRTC.org, has been tested with all browsers, and is already in production use. + +### What are GStreamer and WebRTC? + +[GStreamer][3] is an open source, cross-platform multimedia framework and one of the easiest and most flexible ways to implement any application that needs to play, record, or transform media-like data across a diverse scale of devices and products, including embedded (IoT, in-vehicle infotainment, phones, TVs, etc.), desktop (video/music players, video recording, non-linear editing, video conferencing, [VoIP][4] clients, browsers, etc.), servers (encode/transcode farms, video/voice conferencing servers, etc.), and [more][5]. + +The main feature that makes GStreamer the go-to multimedia framework for many people is its pipeline-based model, which solves one of the hardest problems in API design: catering to applications of varying complexity; from the simplest one-liners and quick solutions to those that need several hundreds of thousands of lines of code to implement their full feature set. If you want to learn how to use GStreamer, [Jan Schmidt's tutorial][6] from [LCA 2018][7] is a good place to start. + +[WebRTC][8] is a set of draft specifications that build upon existing [RTP][9], [RTCP][10], [SDP][11], [DTLS][12], [ICE][13], and other real-time communication (RTC) specifications and define an API for making them accessible using browser JavaScript (JS) APIs. + +People have been doing real-time communication over [IP][14] for [decades][15] with the protocols WebRTC builds upon. WebRTC's real innovation was creating a bridge between native applications and web apps by defining a standard yet flexible API that browsers can expose to untrusted JavaScript code. + +These specifications are [constantly being improved][16], which, combined with the ubiquitous nature of browsers, means WebRTC is fast becoming the standard choice for video conferencing on all platforms and for most applications. + +### **Everything is great, let's build amazing apps!** + +Not so fast, there's more to the story! For web apps, the [PeerConnection API][17] is [everywhere][18]. There are some browser-specific quirks, and the API keeps changing, but the [WebRTC JS adapter][19] handles most of that. Overall, the web app experience is mostly 👍. + +Unfortunately, for native code or applications that need more flexibility than a sandboxed JavaScript app can achieve, there haven't been a lot of great options. + +[Libwebrtc][20] (Google's implementation), [Janus][21], [Kurento][22], and [OpenWebRTC][23] have traditionally been the main contenders, but each implementation has its own inflexibilities, shortcomings, and constraints. + +Libwebrtc is still the most mature implementation, but it is also the most difficult to work with. Since it's embedded inside Chrome, it's a moving target and the project [is quite difficult to build and integrate][24]. These are all obstacles for native or server app developers trying to quickly prototype and experiment with things. + +Also, WebRTC was not built for multimedia, so the lower layers get in the way of non-browser use cases and applications. It is quite painful to do anything other than the default "set raw media, transmit" and "receive from remote, get raw media." This means if you want to use your own filters or hardware-specific codecs or sinks/sources, you end up having to fork libwebrtc. + +[**OpenWebRTC**][23] by Ericsson was the first attempt to rectify this situation. It was built on top of GStreamer. Its target audience was app developers, and it fit the bill quite well as a proof of concept—even though it used a custom API and some of the architectural decisions made it quite inflexible for most other uses. However, after an initial flurry of activity around the project, momentum petered out, the project failed to gather a community, and it is now effectively dead. Full disclosure: Centricular worked with Ericsson to polish some of the rough edges around the project immediately prior to its public release. + +### WebRTC in GStreamer + +GStreamer's WebRTC implementation gives you full control, as it does with any other [GStreamer pipeline][25]. + +As we said, the WebRTC standards build upon existing standards and protocols that serve similar purposes. GStreamer has supported almost all of them for a while now because they were being used for real-time communication, live streaming, and many other IP-based applications. This led Ericsson to choose GStreamer as the base for its OpenWebRTC project. + +Combined with the [SRTP][26] and DTLS plugins that were written during OpenWebRTC's development, it means that the implementation is built upon a solid and well-tested base, and implementing WebRTC features does not involve as much code-from-scratch work as one might presume. However, WebRTC is a large collection of standards, and reaching feature-parity with libwebrtc is an ongoing task. + +Due to decisions made while architecting WebRTCbin's internals, the API follows the PeerConnection specification quite closely. Therefore, almost all its missing features involve writing code that would plug into clearly defined sockets. For instance, since the GStreamer 1.14 release, the following features have been added to the WebRTC implementation and will be available in the next release of the GStreamer WebRTC: + + * Forward error correction + * RTP retransmission (RTX) + * RTP BUNDLE + * Data channels over SCTP + + + +We believe GStreamer's API is the most flexible, versatile, and easy to use WebRTC implementation out there, and it will only get better as time goes by. Bringing the power of pipeline-based multimedia manipulation to WebRTC opens new doors for interesting, unique, and highly efficient applications. If you'd like to demo the technology and play with the code, build and run [these demos][27], which include C, Rust, Python, and C# examples. + +Matthew Waters will present [GStreamer WebRTC—The flexible solution to web-based media][28] at [linux.conf.au][29], January 21-25 in Christchurch, New Zealand. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/gstreamer + +作者:[Nirbheek Chauhan][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/nirbheek +[b]: https://github.com/lujun9972 +[1]: http://webrtc.org/ +[2]: https://www.centricular.com/ +[3]: https://gstreamer.freedesktop.org/documentation/application-development/introduction/gstreamer.html +[4]: https://en.wikipedia.org/wiki/Voice_over_IP +[5]: https://wiki.ligo.org/DASWG/GstLAL +[6]: https://www.youtube.com/watch?v=ZphadMGufY8 +[7]: http://lca2018.linux.org.au/ +[8]: https://en.wikipedia.org/wiki/WebRTC +[9]: https://en.wikipedia.org/wiki/Real-time_Transport_Protocol +[10]: https://en.wikipedia.org/wiki/RTP_Control_Protocol +[11]: https://en.wikipedia.org/wiki/Session_Description_Protocol +[12]: https://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security +[13]: https://en.wikipedia.org/wiki/Interactive_Connectivity_Establishment +[14]: https://en.wikipedia.org/wiki/Internet_Protocol +[15]: https://en.wikipedia.org/wiki/Session_Initiation_Protocol +[16]: https://datatracker.ietf.org/wg/rtcweb/documents/ +[17]: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection +[18]: https://caniuse.com/#feat=rtcpeerconnection +[19]: https://github.com/webrtc/adapter +[20]: https://github.com/aisouard/libwebrtc +[21]: https://janus.conf.meetecho.com/ +[22]: https://www.kurento.org/kurento-architecture +[23]: https://en.wikipedia.org/wiki/OpenWebRTC +[24]: https://webrtchacks.com/building-webrtc-from-source/ +[25]: https://gstreamer.freedesktop.org/documentation/application-development/introduction/basics.html +[26]: https://en.wikipedia.org/wiki/Secure_Real-time_Transport_Protocol +[27]: https://github.com/centricular/gstwebrtc-demos/ +[28]: https://linux.conf.au/schedule/presentation/143/ +[29]: https://linux.conf.au/ From e8efcb0f11e8067cc29c234d164552ca7c0fe22a Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:08:04 +0800 Subject: [PATCH 0802/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190126=20Get?= =?UTF-8?q?=20started=20with=20Tint2,=20an=20open=20source=20taskbar=20for?= =?UTF-8?q?=20Linux=20sources/tech/20190126=20Get=20started=20with=20Tint2?= =?UTF-8?q?,=20an=20open=20source=20taskbar=20for=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Tint2, an open source taskbar for Linux.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md diff --git a/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md new file mode 100644 index 0000000000..601b90370c --- /dev/null +++ b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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)) + +Get started with Tint2, an open source taskbar for Linux +====== + +Tint2, the 14th in our series on open source tools that will make you more productive in 2019, offers a consistent user experience with any window manager. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl) + +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 14th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Tint2 + +One of the best ways for me to be more productive is to use a clean interface with as little distraction as possible. As a Linux user, this means using a minimal window manager like [Openbox][1], [i3][2], or [Awesome][3]. Each has customization options that make me more efficient. The one thing that slows me down is that none has a consistent configuration, so I have to tweak and re-tune my window manager constantly. + +![](https://opensource.com/sites/default/files/uploads/tint2-1.png) + +[Tint2][4] is a lightweight panel and taskbar that provides a consistent experience with any window manager. It is included with most distributions, so it is as easy to install as any other package. + +It includes two programs, Tint2 and Tint2conf. At first launch, Tint2 starts with its default layout and theme. The default configuration includes multiple web browsers, the tint2conf program, a taskbar, and a system tray. + +![](https://opensource.com/sites/default/files/uploads/tint2-2.png) + +Launching the configuration tool allows you to select from the included themes and customize the top, bottom, and sides of the screen. I recommend starting with the theme that is closest to what you want and customizing from there. + +![](https://opensource.com/sites/default/files/uploads/tint2-3.png) + +Within the themes, you can customize where panel items are placed as well as background and font options for every item on the panel. You can also add and remove items from the launcher. + +![](https://opensource.com/sites/default/files/uploads/tint2-4.png) + +Tint2 is a lightweight taskbar that helps you get to the tools you need quickly and efficiently. It is highly customizable, unobtrusive (unless the user wants it not to be), and compatible with almost any window manager on a Linux desktop. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-tint2 + +作者:[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://openbox.org/wiki/Main_Page +[2]: https://i3wm.org/ +[3]: https://awesomewm.org/ +[4]: https://gitlab.com/o9000/tint2 From b883b0a4ff690beb1db6ac9d8ffc6b85a2d539aa Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:15:05 +0800 Subject: [PATCH 0803/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20Top?= =?UTF-8?q?=205=20Linux=20Distributions=20for=20Development=20in=202019=20?= =?UTF-8?q?sources/tech/20190125=20Top=205=20Linux=20Distributions=20for?= =?UTF-8?q?=20Development=20in=202019.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...x Distributions for Development in 2019.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..b3e2de22ba --- /dev/null +++ b/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 2a5eaf7780cfed47bb3e5ab47a1155435745c1a5 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:56:51 +0800 Subject: [PATCH 0804/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20ODri?= =?UTF-8?q?ve=20(Open=20Drive)=20=E2=80=93=20Google=20Drive=20GUI=20Client?= =?UTF-8?q?=20For=20Linux=20sources/tech/20190124=20ODrive=20(Open=20Drive?= =?UTF-8?q?)=20-=20Google=20Drive=20GUI=20Client=20For=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ve) - Google Drive GUI Client For Linux.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md 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 new file mode 100644 index 0000000000..71a91ec3d8 --- /dev/null +++ b/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ODrive (Open Drive) – Google Drive GUI Client For Linux) +[#]: 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 +====== + +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. + +There are many applications available in Linux for Google Drive integration. + +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]**. + +Today also we are going to discuss about the same topic and the utility name is ODrive. + +### What’s ODrive? + +ODrive stands for Open Drive. It’s a GUI client for Google Drive which was written in electron framework. + +It’s simple GUI which allow users to integrate the Google Drive with few steps. + +### How To Install & Setup ODrive on Linux? + +Since the developer is offering the AppImage package and there is no difficulty for installing the ODrive on Linux. + +Simple download the latest ODrive AppImage package from developer github page using **wget Command**. + +``` +$ 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. + +``` +$ 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-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. +![][6] + +Enter your email id which you want to setup a Google Drive account. +![][7] + +Enter your password for the given email id. +![][8] + +Allow ODrive (Open Drive) to access your Google account. +![][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. +![][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. + +``` +$ 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. +![][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. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/odrive-open-drive-google-drive-gui-client-for-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/drivesync-google-drive-sync-client-for-linux/ +[2]: https://www.2daygeek.com/mount-access-google-drive-on-linux-with-google-drive-ocamlfuse-client/ +[3]: https://www.2daygeek.com/mount-access-setup-google-drive-in-linux/ +[4]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[5]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-1.png +[6]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-2.png +[7]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-3.png +[8]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-4.png +[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-5.png +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-6.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-7.png +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-8a.png +[13]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-9.png +[14]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-11.png +[15]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-9b.png +[16]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-10.png From cb141a76e2ef5c575e4d7631ec14e222c88ff709 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 13:03:08 +0800 Subject: [PATCH 0805/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20Get?= =?UTF-8?q?=20started=20with=20LogicalDOC,=20an=20open=20source=20document?= =?UTF-8?q?=20management=20system=20sources/tech/20190124=20Get=20started?= =?UTF-8?q?=20with=20LogicalDOC,=20an=20open=20source=20document=20managem?= =?UTF-8?q?ent=20system.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... open source document management system.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..21687c0ce3 --- /dev/null +++ b/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From bfb56404e93927bebb67fed1b1b23c1aeba23fe4 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 13:05:02 +0800 Subject: [PATCH 0806/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20What?= =?UTF-8?q?=20does=20DevOps=20mean=20to=20you=3F=20sources/tech/20190124?= =?UTF-8?q?=20What=20does=20DevOps=20mean=20to=20you.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190124 What does DevOps mean to you.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20190124 What does DevOps mean to you.md diff --git a/sources/tech/20190124 What does DevOps mean to you.md b/sources/tech/20190124 What does DevOps mean to you.md new file mode 100644 index 0000000000..c62f0f83ba --- /dev/null +++ b/sources/tech/20190124 What does DevOps mean to you.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What does DevOps mean to you?) +[#]: via: (https://opensource.com/article/19/1/what-does-devops-mean-you) +[#]: author: (Girish Managoli https://opensource.com/users/gammay) + +What does DevOps mean to you? +====== +6 experts break down DevOps and the practices and philosophies key to making it work. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) + +It's said if you ask 10 people about DevOps, you will get 12 answers. This is a result of the diversity in opinions and expectations around DevOps—not to mention the disparity in its practices. + +To decipher the paradoxes around DevOps, we went to the people who know it the best—its top practitioners around the industry. These are people who have been around the horn, who know the ins and outs of technology, and who have practiced DevOps for years. Their viewpoints should encourage, stimulate, and provoke your thoughts around DevOps. + +### What does DevOps mean to you? + +Let's start with the fundamentals. We're not looking for textbook answers, rather we want to know what the experts say. + +In short, the experts say DevOps is about principles, practices, and tools. + +[Ann Marie Fred][1], DevOps lead for IBM Digital Business Group's Commerce Platform, says, "to me, DevOps is a set of principles and practices designed to make teams more effective in designing, developing, delivering, and operating software." + +According to [Daniel Oh][2], senior DevOps evangelist at Red Hat, "in general, DevOps is compelling for enterprises to evolve current IT-based processes and tools related to app development, IT operations, and security protocol." + +[Brent Reed][3], founder of Tactec Strategic Solutions, talks about continuous improvement for the stakeholders. "DevOps means to me a way of working that includes a mindset that allows for continuous improvement for operational performance, maturing to organizational performance, resulting in delighted stakeholders." + +Many of the experts also emphasize culture. Ann Marie says, "it's also about continuous improvement and learning. It's about people and culture as much as it is about tools and technology." + +To [Dan Barker][4], chief architect and DevOps leader at the National Association of Insurance Commissioners (NAIC), "DevOps is primarily about culture. … It has brought several independent areas together like lean, [just culture][5], and continuous learning. And I see culture as being the most critical and the hardest to execute on." + +[Chris Baynham-Hughes][6], head of DevOps at Atos, says, "[DevOps] practice is adopted through the evolution of culture, process, and tooling within an organization. The key focus is culture change, and the key tenants of DevOps culture are collaboration, experimentation, fast-feedback, and continuous improvement." + +[Geoff Purdy][7], cloud architect, talks about agility and feedback "shortening and amplifying feedback loops. We want teams to get feedback in minutes rather than weeks." + +But in the end, Daniel nails it by explaining how open source and open culture allow him to achieve his goals "in easy and quick ways. In DevOps initiatives, the most important thing for me should be open culture rather than useful tools, multiple solutions." + +### What DevOps practices have you found effective? + +"Picking one, automated provisioning has been hugely effective for my team. " + +The most effective practices cited by the experts are pervasive yet disparate. + +According to Ann Marie, "some of the most powerful [practices] are agile project management; breaking down silos between cross-functional, autonomous squads; fully automated continuous delivery; green/blue deploys for zero downtime; developers setting up their own monitoring and alerting; blameless post-mortems; automating security and compliance." + +Chris says, "particular breakthroughs have been empathetic collaboration; continuous improvement; open leadership; reducing distance to the business; shifting from vertical silos to horizontal, cross-functional product teams; work visualization; impact mapping; Mobius loop; shortening of feedback loops; automation (from environments to CI/CD)." + +Brent supports "evolving a learning culture that includes TDD [test-driven development] and BDD [behavior-driven development] capturing of a story and automating the sequences of events that move from design, build, and test through implementation and production with continuous integration and delivery pipelines. A fail-first approach to testing, the ability to automate integration and delivery processes and include fast feedback throughout the lifecycle." + +Geoff highlights automated provisioning. "Picking one, automated provisioning has been hugely effective for my team. More specifically, automated provisioning from a versioned Infrastructure-as-Code codebase." + +Dan uses fun. "We do a lot of different things to create a DevOps culture. We hold 'lunch and learns' with free food to encourage everyone to come and learn together; we buy books and study in groups." + +### How do you motivate your team to achieve DevOps goals? + +``` +"Celebrate wins and visualize the progress made." +``` + +Daniel emphasizes "automation that matters. In order to minimize objection from multiple teams in a DevOps initiative, you should encourage your team to increase the automation capability of development, testing, and IT operations along with new processes and procedures. For example, a Linux container is the key tool to achieve the automation capability of DevOps." + +Geoff agrees, saying, "automate the toil. Are there tasks you hate doing? Great. Engineer them out of existence if possible. Otherwise, automate them. It keeps the job from becoming boring and routine because the job constantly evolves." + +Dan, Ann Marie, and Brent stress team motivation. + +Dan says, "at the NAIC, we have a great awards system for encouraging specific behaviors. We have multiple tiers of awards, and two of them can be given to anyone by anyone. We also give awards to teams after they complete something significant, but we often award individual contributors." + +According to Ann Marie, "the biggest motivator for teams in my area is seeing the success of others. We have a weekly playback for each other, and part of that is sharing what we've learned from trying out new tools or practices. When teams are enthusiastic about something they're doing and willing to help others get started, more teams will quickly get on board." + +Brent agrees. "Getting everyone educated and on the same baseline of knowledge is essential ... assessing what helps the team achieve [and] what it needs to deliver with the product owner and users is the first place I like to start." + +Chris recommends a two-pronged approach. "Run small, weekly goals that are achievable and agreed by the team as being important and [where] they can see progress outside of the feature work they are doing. Celebrate wins and visualize the progress made." + +### How do DevOps and agile work together? + +``` +"DevOps != Agile, second Agile != Scrum." +``` + +This is an important question because both DevOps and agile are cornerstones of modern software development. + +DevOps is a process of software development focusing on communication and collaboration to facilitate rapid application and product deployment, whereas agile is a development methodology involving continuous development, continuous iteration, and continuous testing to achieve predictable and quality deliverables. + +So, how do they relate? Let's ask the experts. + +In Brent's view, "DevOps != Agile, second Agile != Scrum. … Agile tools and ways of working—that support DevOps strategies and goals—are how they mesh together." + +Chris says, "agile is a fundamental component of DevOps for me. Sure, we could talk about how we adopt DevOps culture in a non-agile environment, but ultimately, improving agility in the way software is engineered is a key indicator as to the maturity of DevOps adoption within the organization." + +Dan relates DevOps to the larger [Agile Manifesto][8]. "I never talk about agile without referencing the Agile Manifesto in order to set the baseline. There are many implementations that don't focus on the Manifesto. When you read the Manifesto, they've really described DevOps from a development perspective. Therefore, it is very easy to fit agile into a DevOps culture, as agile is focused on communication, collaboration, flexibility to change, and getting to production quickly." + +Geoff sees "DevOps as one of many implementations of agile. Agile is essentially a set of principles, while DevOps is a culture, process, and toolchain that embodies those principles." + +Ann Marie keeps it succinct, saying "agile is a prerequisite for DevOps. DevOps makes agile more effective." + +### Has DevOps benefited from open source? + +``` +"Open source done well requires a DevOps culture." +``` + +This question receives a fervent "yes" from all participants followed by an explanation of the benefits they've seen. + +Ann Marie says, "we get to stand on the shoulders of giants and build upon what's already available. The open source model of maintaining software, with pull requests and code reviews, also works very well for DevOps teams." + +Chris agrees that DevOps has "undoubtedly" benefited from open source. "From the engineering and tooling side (e.g., Ansible), to the process and people side, through the sharing of stories within the industry and the open leadership community." + +A benefit Geoff cites is "grassroots adoption. Nobody had to sign purchase requisitions for free (as in beer) software. Teams found tooling that met their needs, were free (as in freedom) to modify, [then] built on top of it, and contributed enhancements back to the larger community. Rinse, repeat." + +Open source has shown DevOps "better ways you can adopt new changes and overcome challenges, just like open source software developers are doing it," says Daniel. + +Brent concurs. "DevOps has benefited in many ways from open source. One way is the ability to use the tools to understand how they can help accelerate DevOps goals and strategies. Educating the development and operations folks on crucial things like automation, virtualization and containerization, auto-scaling, and many of the qualities that are difficult to achieve without introducing technology enablers that make DevOps easier." + +Dan notes the two-way, symbiotic relationship between DevOps and open source. "Open source done well requires a DevOps culture. Most open source projects have very open communication structures with very little obscurity. This has actually been a great learning opportunity for DevOps practitioners around what they might bring into their own organizations. Also, being able to use tools from a community that is similar to that of your own organization only encourages your own culture growth. I like to use GitLab as an example of this symbiotic relationship. When I bring [GitLab] into a company, we get a great tool, but what I'm really buying is their unique culture. That brings substantial value through our interactions with them and our ability to contribute back. Their tool also has a lot to offer for a DevOps organization, but their culture has inspired awe in the companies where I've introduced it." + +Now that our DevOps experts have weighed in, please share your thoughts on what DevOps means—as well as the other questions we posed—in the comments. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/what-does-devops-mean-you + +作者:[Girish Managoli][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gammay +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/DukeAMO +[2]: https://twitter.com/danieloh30?lang=en +[3]: https://twitter.com/brentareed +[4]: https://twitter.com/barkerd427 +[5]: https://psnet.ahrq.gov/resources/resource/1582 +[6]: https://twitter.com/onlychrisbh?lang=en +[7]: https://twitter.com/geoff_purdy +[8]: https://agilemanifesto.org/ From e3e43e688e08770972e5d120ca9b05d40ea02bd0 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 28 Jan 2019 13:29:08 +0800 Subject: [PATCH 0807/4278] Translating An Introduction to Go. --- translated/tech/20181224 An Introduction to Go.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 0c2758fe2f..3e595e4cea 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -213,7 +213,7 @@ if err != nil { } ``` -There are two functions to quickly unwind and recover the call stack, though: `panic()` and `recover()`. When `panic()` is called, the call stack is unwound, and any deferred functions are run as usual. When a deferred function invokes `recover()`, the unwinding stops, and the value given to `panic()` is returned. If we are unwinding normally and not due to a panic, `recover()` simply returns `nil`. In the example below, a function is deferred and any `error` value that is given to `panic()` will be recovered and stored in an error return value. Libraries sometimes use that approach to make highly recursive code like parsers more readable, while still maintaining the usual error return value for public functions. +有两个函数可以快速跳出和恢复调用栈:`panic()` 和 `recover()`。当 `panic()` 被调用时,调用栈开始弹出,同时每个 `defer` 函数都会正常运行。当一个 `defer` 函数调用 `recover()`时,调用栈停止弹出,同时返回函数 `panic()` 给出的值。如果我们让调用栈正常弹出而不是由于调用 `panic()` 函数,`recover()` 将只返回 `nil`。在下面的例子中,`defer` 函数将捕获 `panic()` 抛出的任何 `error` 类型的值并储存在错误返回值中。第三方库中有时会使用这个方法增强递归代码的可读性,如解析器,同时保持公有函数仍使用普通错误返回值。 ``` func Function() (err error) { @@ -229,7 +229,7 @@ func Function() (err error) { } ``` -### Arrays 和 slices +### 数组和切片 As mentioned before, an array is a value type and a slice is a pointer into an array, created either by slicing an existing array or by using `make()` to create a slice, which will create an anonymous array to hold the elements. From 84f48abce5de96e9073cd333e098ea296d7eca43 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:03:09 +0800 Subject: [PATCH 0808/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20Usin?= =?UTF-8?q?g=20Antora=20for=20your=20open=20source=20documentation=20sourc?= =?UTF-8?q?es/tech/20190125=20Using=20Antora=20for=20your=20open=20source?= =?UTF-8?q?=20documentation.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tora for your open source documentation.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 sources/tech/20190125 Using Antora for your open source documentation.md diff --git a/sources/tech/20190125 Using Antora for your open source documentation.md b/sources/tech/20190125 Using Antora for your open source documentation.md new file mode 100644 index 0000000000..3df2862ba1 --- /dev/null +++ b/sources/tech/20190125 Using Antora for your open source documentation.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Antora for your open source documentation) +[#]: via: (https://fedoramagazine.org/using-antora-for-your-open-source-documentation/) +[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) + +Using Antora for your open source documentation +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/01/antora-816x345.jpg) + +Are you looking for an easy way to write and publish technical documentation? Let me introduce [Antora][1] — an open source documentation site generator. Simple enough for a tiny project, but also complex enough to cover large documentation sites such as [Fedora Docs][2]. + +With sources stored in git, written in a simple yet powerful markup language AsciiDoc, and a static HTML as an output, Antora makes writing, collaborating on, and publishing your documentation a no-brainer. + +### The basic concepts + +Before we build a simple site, let’s have a look at some of the core concepts Antora uses to make the world a happier place. Or, at least, to build a documentation website. + +#### Organizing the content + +All sources that are used to build your documentation site are stored in a **git repository**. Or multiple ones — potentially owned by different people. For example, at the time of writing, the Fedora Docs had its sources stored in 24 different repositories owned by different groups having their own rules around contributions. + +The content in Antora is organized into **components** , usually representing different areas of your project, or, well, different components of the software you’re documenting — such as the backend, the UI, etc. Components can be independently versioned, and each component gets a separate space on the docs site with its own menu. + +Components can be optionally broken down into so-called **modules**. Modules are mostly invisible on the site, but they allow you to organize your sources into logical groups, and even store each in different git repository if that’s something you need to do. We use this in Fedora Docs to separate [the Release Notes, the Installation Guide, and the System Administrator Guide][3] into three different source repositories with their own rules, while preserving a single view in the UI. + +What’s great about this approach is that, to some extent, the way your sources are physically structured is not reflected on the site. + +#### Virtual catalog + +When assembling the site, Antora builds a **virtual catalog** of all pages, assigning a [unique ID][4] to each one based on its name and the component, the version, and module it belongs to. The page ID is then used to generate URLs for each page, and for internal links as well. So, to some extent, the source repository structure doesn’t really matter as far as the site is concerned. + +As an example, if we’d for some reason decided to merge all the 24 repositories of Fedora Docs into one, nothing on the site would change. Well, except the “Edit this page” link on every page that would suddenly point to this one repository. + +#### Independent UI + +We’ve covered the content, but how it’s going to look like? + +Documentation sites generated with Antora use a so-called [UI bundle][5] that defines the look and feel of your site. The UI bundle holds all graphical assets such as CSS, images, etc. to make your site look beautiful. + +It is expected that the UI will be developed independently of the documentation content, and that’s exactly what Antora supports. + +#### Putting it all together + +Having sources distributed in multiple repositories might raise a question: How do you build the site? The answer is: [Antora Playbook][6]. + +Antora Playbook is a file that points to all the source repositories and the UI bundle. It also defines additional metadata such as the name of your site. + +The Playbook is the only file you need to have locally available in order to build the site. Everything else gets fetched automatically as a part of the build process. + +### Building a site with Antora + +Demo time! To build a minimal site, you need three things: + + 1. At least one component holding your AsciiDoc sources. + 2. An Antora Playbook. + 3. A UI bundle + + + +Good news is the nice people behind Antora provide [example Antora sources][7] we can try right away. + +#### The Playbook + +Let’s first have a look at [the Playbook][8]: + +``` +site: + title: Antora Demo Site +# the 404 page and sitemap files only get generated when the url property is set + url: https://example.org/docs + start_page: component-b::index.adoc +content: + sources: + - url: https://gitlab.com/antora/demo/demo-component-a.git + branches: master + - url: https://gitlab.com/antora/demo/demo-component-b.git + branches: [v2.0, v1.0] + start_path: docs +ui: + bundle: + url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/master/raw/build/ui-bundle.zip?job=bundle-stable + snapshot: true +``` + +As we can see, the Playbook defines some information about the site, lists the content repositories, and points to the UI bundle. + +There are two repositories. The [demo-component-a][9] with a single branch, and the [demo-component-b][10] having two branches, each representing a different version. + +#### Components + +The minimal source repository structure is nicely demonstrated in the [demo-component-a][9] repository: + +``` +antora.yml <- component metadata +modules/ + ROOT/ <- the default module + nav.adoc <- menu definition + pages/ <- a directory with all the .adoc sources + source1.adoc + source2.adoc + ... +``` + +The following + +``` +antora.yml +``` + +``` +name: component-a +title: Component A +version: 1.5.6 +start_page: ROOT:inline-text-formatting.adoc +nav: + - modules/ROOT/nav.adoc +``` + +contains metadata for this component such as the name and the version of the component, the starting page, and it also points to a menu definition file. + +The menu definition file is a simple list that defines the structure of the menu and the content. It uses the [page ID][4] to identify each page. + +``` +* xref:inline-text-formatting.adoc[Basic Inline Text Formatting] +* xref:special-characters.adoc[Special Characters & Symbols] +* xref:admonition.adoc[Admonition] +* xref:sidebar.adoc[Sidebar] +* xref:ui-macros.adoc[UI Macros] +* Lists +** xref:lists/ordered-list.adoc[Ordered List] +** xref:lists/unordered-list.adoc[Unordered List] + +And finally, there's the actual content under modules/ROOT/pages/ — you can see the repository for examples, or the AsciiDoc syntax reference +``` + +#### The UI bundle + +For the UI, we’ll be using the example UI provided by the project. + +Going into the details of Antora UI would be above the scope of this article, but if you’re interested, please see the [Antora UI documentation][5] for more info. + +#### Building the site + +Note: We’ll be using Podman to run Antora in a container. You can [learn about Podman on the Fedora Magazine][11]. + +To build the site, we only need to call Antora on the Playbook file. + +The easiest way to get antora at the moment is to use the container image provided by the project. You can get it by running: + +``` +$ podman pull antora/antora +``` + +Let’s get the playbook repository: + +``` +$ git clone https://gitlab.com/antora/demo/demo-site.git +$ cd demo-site +``` + +And run Antora using the following command: + +``` +$ podman run --rm -it -v $(pwd):/antora:z antora/antora site.yml +``` + +The site will be available in the + +public + +``` +$ cd public +$ python3 -m http.server 8080 +``` + +directory. You can either open it in your web browser directly, or start a local web server using: + +Your site will be available on . + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-antora-for-your-open-source-documentation/ + +作者:[Adam Šamalík][a] +选题:[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/asamalik/ +[b]: https://github.com/lujun9972 +[1]: https://antora.org/ +[2]: http://docs.fedoraproject.org/ +[3]: https://docs.fedoraproject.org/en-US/fedora/f29/ +[4]: https://docs.antora.org/antora/2.0/page/page-id/#structure +[5]: https://docs.antora.org/antora-ui-default/ +[6]: https://docs.antora.org/antora/2.0/playbook/ +[7]: https://gitlab.com/antora/demo +[8]: https://gitlab.com/antora/demo/demo-site/blob/master/site.yml +[9]: https://gitlab.com/antora/demo/demo-component-a +[10]: https://gitlab.com/antora/demo/demo-component-b +[11]: https://fedoramagazine.org/running-containers-with-podman/ From 7fac971d424ec937649cdcebdd2fe86a6b89c3f9 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:05:00 +0800 Subject: [PATCH 0809/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Comm?= =?UTF-8?q?ands=20to=20help=20you=20monitor=20activity=20on=20your=20Linux?= =?UTF-8?q?=20server=20sources/tech/20190123=20Commands=20to=20help=20you?= =?UTF-8?q?=20monitor=20activity=20on=20your=20Linux=20server.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...u monitor activity on your Linux server.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20190123 Commands to help you monitor activity on your Linux server.md diff --git a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md new file mode 100644 index 0000000000..43f1c480ad --- /dev/null +++ b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Commands to help you monitor activity on your Linux server) +[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Commands to help you monitor activity on your Linux server +====== +The watch, top, and ac commands provide some effective ways to oversee what is happening on your Linux servers. + +![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg) + +Linux systems provide a number of commands that make it easy to report on system activity. In this post, we're going to look at several commands that are especially helpful. + +### The watch command + +The **watch** command is one that makes it easy to repeatedly examine a variety of data on your system — user activities, running processes, logins, memory usage, etc. All the command really does is run the command that you specify repeatedly, each time overwriting the previously displayed output, but this lends itself to a very convenient way of monitoring what's happening on your system. + +To start with a very basic and not particularly useful command, you could run **watch -n 5 date** and see a display with the current date and time that updates every 5 seconds. As you likely have guessed, the **-n 5** option specifies the number of seconds to wait between each run of the command. The default is 2 seconds. The command will run and update a display like this until you stop it with a ^c. + +``` +Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019 + +Wed Jan 23 15:59:14 EST 2019 +``` + +As a more interesting command example, you can watch an updated list of whoever is logging into the server. As written, this command will update every 10 seconds. Users who log out will disappear from the current display and those who log in will come into view. If no one is logging in or out, the display will remain the same except for the time displayed. + +``` +$ watch -n 10 who + +Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019 + +shs :0 2019-01-23 09:45 (:0) +dory pts/0 2019-01-23 15:50 (192.168.0.5) +nemo pts/1 2019-01-23 16:01 (192.168.0.15) +shark pts/3 2019-01-23 11:11 (192.168.0.27) +``` + +If you just want to see how many users are logged in, you can get a user count along with load averages showing you how hard the system is working by having watch call the **uptime** command. + +``` +$ watch uptime + +Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019 + + 16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02 +``` + +If you want to use watch to repeat a command that includes a pipe, you need to put the command between quote marks like this command that every 5 seconds shows you how many processes are running: + +``` +$ watch -n 5 'ps -ef | wc -l' + +Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019 + +245 +``` + +To watch memory usage, you might try a command like this one: + +``` +$ watch -n 5 free -m + +Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019 + + total used free shared buff/cache available +Mem: 5959 776 3276 12 1906 4878 +Swap: 2047 0 2047 +``` + +You could watch processes being run by one particular user with **watch,** but the **top** command provides a much better option. + +### The top command + +If you want to watch one particular user's processes, top has an ideal option for you — the -u option: + +``` +$ top -u nemo +top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02 +Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache +MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND +23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd +23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam) +23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd +23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh +``` + +You not only see what processes the user is running, but the resources (CPU time and memory) that the process is consuming and how hard the system is working overall. + +### The ac command + +If you'd like to see how much time each of your users is spending logged in, you can make use of the **ac** command. This requires installation of the **acct** (Debian) or **psacct** (RHEL, Centos, etc.) package. + +The **ac** command has a number of options, but it pulls its data from the current **wtmp** file. Here's an example showing the total number of hours users were logged in recently: + +``` +$ ac + total 1261.72 +``` + +This command shows total hours by user: + +``` +$ ac -p + shark 5.24 + nemo 5.52 + shs 1251.00 + total 1261.76 +``` + +This ac command shows daily counts of how many hours users were logged in: + +``` +$ ac -d | tail -10 + +Jan 11 total 0.05 +Jan 12 total 1.36 +Jan 13 total 16.39 +Jan 15 total 55.33 +Jan 16 total 38.02 +Jan 17 total 28.51 +Jan 19 total 48.66 +Jan 20 total 1.37 +Jan 22 total 23.48 +Today total 9.83 +``` + +### Wrap-up + +There are many commands for examining system activity. The **watch** command allows you to run just about any command in a repetitive way and watch how the output changes. The **top** command is a better option for focusing on user processes and also loops in a way that allows you to see the changes as they happen, while the **ac** command examines user connect time. + +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/3335200/linux/how-to-monitor-activity-on-your-linux-server.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 3bbe109a90d182ec7d1b51df4dc561848947e8db Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:06:57 +0800 Subject: [PATCH 0810/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20PyGa?= =?UTF-8?q?me=20Zero:=20Games=20without=20boilerplate=20sources/tech/20190?= =?UTF-8?q?125=20PyGame=20Zero-=20Games=20without=20boilerplate.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... PyGame Zero- Games without boilerplate.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..bdc100973a --- /dev/null +++ b/sources/tech/20190125 PyGame Zero- Games without boilerplate.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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] +译者:[译者ID](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://www.pygame.org/news +[2]: https://pygame-zero.readthedocs.io/en/stable/ From 8a546cceddecce6bc16f4701e99694499d332b65 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:09:16 +0800 Subject: [PATCH 0811/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20Unde?= =?UTF-8?q?rstanding=20Angle=20Brackets=20in=20Bash=20sources/tech/2019012?= =?UTF-8?q?4=20Understanding=20Angle=20Brackets=20in=20Bash.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...24 Understanding Angle Brackets in Bash.md | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 sources/tech/20190124 Understanding Angle Brackets in Bash.md diff --git a/sources/tech/20190124 Understanding Angle Brackets in Bash.md b/sources/tech/20190124 Understanding Angle Brackets in Bash.md new file mode 100644 index 0000000000..bd9a3782fb --- /dev/null +++ b/sources/tech/20190124 Understanding Angle Brackets in Bash.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding Angle Brackets in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +Understanding Angle Brackets in Bash +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/architecture-1839450_1920.jpg?itok=ra6XonD3) + +[Bash][1] provides many important built-in commands, like `ls`, `cd`, and `mv`, as well as regular tools such as `grep`, `awk,` and `sed`. But, it is equally important to know the punctuation marks -- [the glue in the shape of dots][2], commas, brackets. and quotes -- that allow you to transform and push data from one place to another. Take angle brackets (`< >`), for example. + +### Pushing Around + +If you are familiar with other programming and scripting languages, you may have used `<` and `>` as logical operators to check in a condition whether one value is larger or smaller than another. If you have ever written HTML, you have used angle brackets to enclose tags. + +In shell scripting, you can also use brackets to push data from place to place, for example, to a file: + +``` +ls > dir_content.txt +``` + +In this example, instead of showing the contents of the directory on the command line, `>` tells the shell to copy it into a file called _dir_content.txt_. If _dir_content.txt_ doesn't exist, Bash will create it for you, but if _dir_content.txt_ already exists and is not empty, you will overwrite whatever it contained, so be careful! + +You can avoid overwriting existing content by tacking the new stuff onto the end of the old stuff. For that you use `>>` (instead of `>`): + +``` +ls $HOME > dir_content.txt; wc -l dir_content.txt >> dir_content.txt +``` + +This line stores the list of contents of your home directory into _dir_content.txt_. You then count the number of lines in _dir_content.txt_ (which gives you the number of items in the directory) with [`wc -l`][3] and you tack that value onto the end of the file. + +After running the command line on my machine, this is what my _dir_content.txt_ file looks like: + +``` +Applications +bin +cloud +Desktop +Documents +Downloads +Games +ISOs +lib +logs +Music +OpenSCAD +Pictures +Public +Templates +test_dir +Videos +17 dir_content.txt +``` + +The mnemonic here is to look at `>` and `>>` as arrows. In fact, the arrows can point the other way, too. Say you have a file called _CBActors_ containing some names of actors and the number of films by the Coen brothers they have been in. Something like this: + +``` +John Goodman 5 +John Turturro 3 +George Clooney 2 +Frances McDormand 6 +Steve Buscemi 5 +Jon Polito 4 +Tony Shalhoub 3 +James Gandolfini 1 +``` + +Something like + +``` +sort < CBActors # Do this +Frances McDormand 6 # And you get this +George Clooney 2 +James Gandolfini 1 +John Goodman 5 +John Turturro 3 +Jon Polito 4 +Steve Buscemi 5 +Tony Shalhoub 3 +``` + +Will [sort][4] the list alphabetically. But then again, you don't need `<` here since `sort` already expects a file anyway, so `sort CBActors` will work just as well. + +However, if you need to see who is the Coens' favorite actor, you can check with : + +``` +while read name surname films; do echo $films $name $surname > filmsfirst.txt; done < CBActors +``` + +Or, to make that a bit more readable: + +``` +while read name surname films;\ + do + echo $films $name $surname >> filmsfirst;\ + done < CBActors +``` + +Let's break this down, shall we? + + * the [`while ...; do ... done`][5] structure is a loop. The instructions between `do` and `done` are repeatedly executed while a condition is met, in this case... + * ... the [`read`][6] instruction has lines to read. `read` reads from the standard input and will continue reading until there is nothing more to read... + * ... And as standard input is fed in via `<` and comes from _CBActors_ , that means the `while` loop will loop until the last line of _CBActors_ is piped into the loop. + * Getting back to `read` for a sec, the tool is clever enough to see that there are three distinct fields separated by spaces on each line of the file. That allows you to put the first field from each line in the `name` variable, the second in `surname` and the third in `films`. This comes in handy later, on the line that says `echo $films $name $surname >> filmsfirst;\`, allowing you to reorder the fields and push them into a file called _filmsfirst_. + + + +At the end of all that, you have a file called _filmsfirst_ that looks like this: + +``` +5 John Goodman +3 John Turturro +2 George Clooney +6 Frances McDormand +5 Steve Buscemi +4 Jon Polito +3 Tony Shalhoub +1 James Gandolfini +``` + +which you can now use with `sort`: + +``` +sort -r filmsfirst +``` + +to see who is the Coens' favorite actor. Yes, it is Frances McDormand. (The [`-r`][4] option reverses the sort, so McDormand ends up on top). + +We'll look at more angles on this topic next time! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-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/2019/1/bash-shell-utility-reaches-50-milestone +[2]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[3]: https://linux.die.net/man/1/wc +[4]: https://linux.die.net/man/1/sort +[5]: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html +[6]: https://linux.die.net/man/2/read From 8a3782fbf0fe5b0089e7d3fba50e458b198750e7 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:17:38 +0800 Subject: [PATCH 0812/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Gett?= =?UTF-8?q?ing=20started=20with=20Isotope,=20an=20open=20source=20webmail?= =?UTF-8?q?=20client=20sources/tech/20190123=20Getting=20started=20with=20?= =?UTF-8?q?Isotope,=20an=20open=20source=20webmail=20client.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Isotope, an open source webmail client.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20190123 Getting started with Isotope, an open source webmail client.md diff --git a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md new file mode 100644 index 0000000000..e4a24a28a8 --- /dev/null +++ b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Isotope, an open source webmail client) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Getting started with Isotope, an open source webmail client +====== +Read rich-text emails with Isotope, a lightweight email client and the 11th 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/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH) + +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 11th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Isotope + +As we discussed in the [fourth article in this series][1] (about Cypht), we all spend a whole lot of time dealing with email. There are many options for dealing with it, and I've spent hours upon hours trying to find the best email client that works for me. I think that is an important distinction: What works for me doesn't always work for everyone else. And sometimes what works for me is a full client like [Thunderbird][2], sometimes it is a console client like [Mutt][3], and sometimes it's a web-based interface like [Gmail][4] or [RoundCube][5]. + +![](https://opensource.com/sites/default/files/uploads/isotope_1.png) + +[Isotope][6] is a locally hosted, web-based email client. It is exceptionally lightweight, uses IMAP exclusively, and takes up very little disk space. Unlike Cypht, Isotope has full HTML mail support, which means there are no issues displaying rich-text only emails. + +![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png) + +Installing Isotope is very easy if you have [Docker][7] installed. You only need to copy the commands from the documentation into a console and press Enter. Point a browser at **localhost** to get the Isotope login screen, and entering your IMAP server, login name, and password will open the inbox view. + +![](https://opensource.com/sites/default/files/uploads/isotope_3.png) + +At this point, Isotope functions pretty much as you'd expect. Click a message to view it, click the pencil icon to create a new message, etc. You will note that the user interface (UI) is very minimalistic and doesn't have the typical buttons for things like "move to folder," "copy to folder," and "archive." You move messages around with drag and drop, so you don't really miss the buttons anyway. + +![](https://opensource.com/sites/default/files/uploads/isotope_4.png) + +Overall, Isotope is clean, fast, and works exceptionally well. Even better, it is under active development (the most recent commit was two hours before I wrote this article), so it is constantly getting improvements. You can check out the code and contribute to it on [GitHub][8]. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-isotope + +作者:[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-cypht-email +[2]: https://www.thunderbird.net/ +[3]: http://www.mutt.org/ +[4]: https://mail.google.com/ +[5]: https://roundcube.net/ +[6]: https://blog.marcnuri.com/isotope-mail-client-introduction/ +[7]: https://www.docker.com/ +[8]: https://github.com/manusa/isotope-mail From c07992967de7d87c66deed694d638f99b4ebf726 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:19:45 +0800 Subject: [PATCH 0813/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190121=20How?= =?UTF-8?q?=20to=20Resize=20OpenStack=20Instance=20(Virtual=20Machine)=20f?= =?UTF-8?q?rom=20Command=20line=20sources/tech/20190121=20How=20to=20Resiz?= =?UTF-8?q?e=20OpenStack=20Instance=20(Virtual=20Machine)=20from=20Command?= =?UTF-8?q?=20line.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nce (Virtual Machine) from Command line.md | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 sources/tech/20190121 How to Resize OpenStack Instance (Virtual Machine) from Command line.md diff --git a/sources/tech/20190121 How to Resize OpenStack Instance (Virtual Machine) from Command line.md b/sources/tech/20190121 How to Resize OpenStack Instance (Virtual Machine) from Command line.md new file mode 100644 index 0000000000..e235cabdbf --- /dev/null +++ b/sources/tech/20190121 How to Resize OpenStack Instance (Virtual Machine) from Command line.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Resize OpenStack Instance (Virtual Machine) from Command line) +[#]: via: (https://www.linuxtechi.com/resize-openstack-instance-command-line/) +[#]: author: (Pradeep Kumar http://www.linuxtechi.com/author/pradeep/) + +How to Resize OpenStack Instance (Virtual Machine) from Command line +====== + +Being a Cloud administrator, resizing or changing resources of an instance or virtual machine is one of the most common tasks. + +![](https://www.linuxtechi.com/wp-content/uploads/2019/01/Resize-openstack-instance.jpg) + +In Openstack environment, there are some scenarios where cloud user has spin a vm using some flavor( like m1.smalll) where root partition disk size is 20 GB, but at some point of time user wants to extends the root partition size to 40 GB. So resizing of vm’s root partition can be accomplished by using the resize option in nova command. During the resize, we need to specify the new flavor that will include disk size as 40 GB. + +**Note:** Once you extend the instance resources like RAM, CPU and disk using resize option in openstack then you can’t reduce it. + +**Read More on** : [**How to Create and Delete Virtual Machine(VM) from Command line in OpenStack**][1] + +In this tutorial I will demonstrate how to resize an openstack instance from command line. Let’s assume I have an existing instance named “ **test_resize_vm** ” and it’s associated flavor is “m1.small” and root partition disk size is 20 GB. + +Execute the below command from controller node to check on which compute host our vm “test_resize_vm” is provisioned and its flavor details + +``` +:~# openstack server show test_resize_vm | grep -E "flavor|hypervisor" +| OS-EXT-SRV-ATTR:hypervisor_hostname  | compute-57    | +| flavor                               | m1.small (2)  | +:~# +``` + +Login to VM as well and check the root partition size, + +``` +[[email protected] ~]# df -Th +Filesystem     Type      Size  Used Avail Use% Mounted on +/dev/vda1      xfs        20G  885M   20G   5% / +devtmpfs       devtmpfs  900M     0  900M   0% /dev +tmpfs          tmpfs     920M     0  920M   0% /dev/shm +tmpfs          tmpfs     920M  8.4M  912M   1% /run +tmpfs          tmpfs     920M     0  920M   0% /sys/fs/cgroup +tmpfs          tmpfs     184M     0  184M   0% /run/user/1000 +[[email protected] ~]# echo "test file for resize operation" > demofile +[[email protected] ~]# cat demofile +test file for resize operation +[[email protected] ~]# +``` + +Get the available flavor list using below command, + +``` +:~# openstack flavor list ++--------------------------------------|-----------------|-------|------|-----------|-------|-----------+ +| ID                                   | Name            |   RAM | Disk | Ephemeral | VCPUs | Is Public | ++--------------------------------------|-----------------|-------|------|-----------|-------|-----------+ +| 2                                    | m1.small        |  2048 |   20 |         0 |     1 | True      | +| 3                                    | m1.medium       |  4096 |   40 |         0 |     2 | True      | +| 4                                    | m1.large        |  8192 |   80 |         0 |     4 | True      | +| 5                                    | m1.xlarge       | 16384 |  160 |         0 |     8 | True      | ++--------------------------------------|-----------------|-------|------|-----------|-------|-----------+ +``` + +So we will be using the flavor “m1.medium” for resize operation, Run the beneath nova command to resize “test_resize_vm”, + +Syntax: # nova resize {VM_Name} {flavor_id} —poll + +``` +:~# nova resize test_resize_vm 3 --poll +Server resizing... 100% complete +Finished +:~# +``` + +Now confirm the resize operation using “ **openstack server –confirm”** command, + +``` +~# openstack server list | grep -i test_resize_vm +| 1d56f37f-94bd-4eef-9ff7-3dccb4682ce0 | test_resize_vm | VERIFY_RESIZE |private-net=10.20.10.51                                  | +:~# +``` + +As we can see in the above command output the current status of the vm is “ **verify_resize** “, execute below command to confirm resize, + +``` +~# openstack server resize --confirm 1d56f37f-94bd-4eef-9ff7-3dccb4682ce0 +~# +``` + +After the resize confirmation, status of VM will become active, now re-verify hypervisor and flavor details for the vm + +``` +:~# openstack server show test_resize_vm | grep -E "flavor|hypervisor" +| OS-EXT-SRV-ATTR:hypervisor_hostname  | compute-58   | +| flavor                               | m1.medium (3)| +``` + +Login to your VM now and verify the root partition size + +``` +[[email protected] ~]# df -Th +Filesystem     Type      Size  Used Avail Use% Mounted on +/dev/vda1      xfs        40G  887M   40G   3% / +devtmpfs       devtmpfs  1.9G     0  1.9G   0% /dev +tmpfs          tmpfs     1.9G     0  1.9G   0% /dev/shm +tmpfs          tmpfs     1.9G  8.4M  1.9G   1% /run +tmpfs          tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup +tmpfs          tmpfs     380M     0  380M   0% /run/user/1000 +[[email protected] ~]# cat demofile +test file for resize operation +[[email protected] ~]# +``` + +This confirm that VM root partition has been resized successfully. + +**Note:** Due to some reason if resize operation was not successful and you want to revert the vm back to previous state, then run the following command, + +``` +# openstack server resize --revert {instance_uuid} +``` + +If have noticed “ **openstack server show** ” commands output, VM is migrated from compute-57 to compute-58 after resize. This is the default behavior of “nova resize” command ( i.e nova resize command will migrate the instance to another compute & then resize it based on the flavor details) + +In case if you have only one compute node then nova resize will not work, but we can make it work by changing the below parameter in nova.conf file on compute node, + +Login to compute node, verify the parameter value + +If “ **allow_resize_to_same_host** ” is set as False then change it to True and restart the nova compute service. + +**Read More on** [**OpenStack Deployment using Devstack on CentOS 7 / RHEL 7 System**][2] + +That’s all from this tutorial, in case it helps you technically then please do share your feedback and comments. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/resize-openstack-instance-command-line/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/create-delete-virtual-machine-command-line-openstack/ +[2]: https://www.linuxtechi.com/openstack-deployment-devstack-centos-7-rhel-7/ From 8a11dc4975795fabda7d3c63cdcf75ce8ff68ec3 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:23:20 +0800 Subject: [PATCH 0814/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20Orpi?= =?UTF-8?q?e:=20A=20command-line=20reverse=20Polish=20notation=20calculato?= =?UTF-8?q?r=20sources/tech/20190124=20Orpie-=20A=20command-line=20reverse?= =?UTF-8?q?=20Polish=20notation=20calculator.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...line reverse Polish notation calculator.md | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 sources/tech/20190124 Orpie- A command-line reverse Polish notation calculator.md diff --git a/sources/tech/20190124 Orpie- A command-line reverse Polish notation calculator.md b/sources/tech/20190124 Orpie- A command-line reverse Polish notation calculator.md new file mode 100644 index 0000000000..10e666f625 --- /dev/null +++ b/sources/tech/20190124 Orpie- A command-line reverse Polish notation calculator.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Orpie: A command-line reverse Polish notation calculator) +[#]: via: (https://opensource.com/article/19/1/orpie) +[#]: author: (Peter Faller https://opensource.com/users/peterfaller) + +Orpie: A command-line reverse Polish notation calculator +====== +Orpie is a scientific calculator that functions much like early, well-loved HP calculators. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c) +Orpie is a text-mode [reverse Polish notation][1] (RPN) calculator for the Linux console. It works very much like the early, well-loved Hewlett-Packard calculators. + +### Installing Orpie + +RPM and DEB packages are available for most distributions, so installation is just a matter of using either: + +``` +$ sudo apt install orpie +``` + +or + +``` +$ sudo yum install orpie +``` + +Orpie has a comprehensive man page; new users may want to have it open in another terminal window as they get started. Orpie can be customized for each user by editing the **~/.orpierc** configuration file. The [orpierc(5)][2] man page describes the contents of this file, and **/etc/orpierc** describes the default configuration. + +### Starting up + +Start Orpie by typing **orpie** at the command line. The main screen shows context-sensitive help on the left and the stack on the right. The cursor, where you enter numbers you want to calculate, is at the bottom-right corner. + +![](https://opensource.com/sites/default/files/uploads/orpie_start.png) + +### Example calculation + +For a simple example, let's calculate the factorial of **5 (2 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 3 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 4 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 5)**. First the long way: + +| Keys | Result | +| --------- | --------- | +| 2 | Push 2 onto the stack | +| 3 | Push 3 onto the stack | +| * | Multiply to get 6 | +| 4 | Push 4 onto the stack | +| * | Multiply to get 24 | +| 5 | Push 5 onto the stack | +| * | Multiply to get 120 | + +Note that the multiplication happens as soon as you type *****. If you hit **< enter>** after ***** , Orpie will duplicate the value at position 1 on the stack. (If this happens, you can drop the duplicate with **\**.) + +Equivalent sequences are: + +| Keys | Result | +| ------------- | ------------- | +| 2 3 * 4 * 5 * | Faster! | +| 2 3 4 5 * * * | Same result | +| 5 ' fact | Fastest: Use the built-in function | + +Observe that when you enter **'** , the left pane changes to show matching functions as you type. In the example above, typing **fa** is enough to get the **fact** function. Orpie offers many functions—experiment by typing **'** and a few letters to see what's available. + +![](https://opensource.com/sites/default/files/uploads/orpie_functions.png) + +Note that each operation replaces one or more values on the stack. If you want to store the value at position 1 in the stack, key in (for example) **@factot ** and **S'**. To retrieve the value, key in (for example) **@factot ** then **;** (if you want to see it; otherwise just leave **@factot** as the value for the next calculation). + +### Constants and units + +Orpie understands units and predefines many useful scientific constants. For example, to calculate the energy in a blue light photon at 400nm, calculate **E=hc/(400nm)**. The key sequences are: + +| Keys | Result | +| -------------- | -------------- | +| C c | Get the speed of light in m/s | +| C h | Get Planck's constant in Js | +| * | Calculate h*c | +| 400 9 n _ m | Input 4 _ 10^-9 m | +| / | Do the division and get the result: 4.966 _ 10^-19 J | + +Like choosing functions after typing **'** , typing **C** shows matching constants based on what you type. + +![](https://opensource.com/sites/default/files/uploads/orpie_constants.png) + +### Matrices + +Orpie can also do operations with matrices. For example, to multiply two 2x2 matrices: + +| Keys | Result | +| -------- | -------- | +| [ 1 , 2 [ 3 , 4 | Stack contains the matrix [[ 1, 2 ][ 3, 4 ]] | +| [ 1 , 0 [ 1 , 1 | Push the multiplier matrix onto the stack | +| * | The result is: [[ 3, 2 ][ 7, 4 ]] | + +Note that the **]** characters are automatically inserted—entering **[** starts a new row. + +### Complex numbers + +Orpie can also calculate with complex numbers. They can be entered or displayed in either polar or rectangular form. You can toggle between the polar and rectangular display using the **p** key, and between degrees and radians using the **r** key. For example, to multiply **3 + 4i** by **4 + 4i** : + +| Keys | Result | +| -------- | -------- | +| ( 3 , 4 | The stack contains (3, 4) | +| ( 4 , 4 | Push (4, 4) | +| * | Get the result: (-4, 28) | + +Note that as you go, the results are kept on the stack so you can observe intermediate results in a lengthy calculation. + +![](https://opensource.com/sites/default/files/uploads/orpie_final.png) + +### Quitting Orpie + +You can exit from Orpie by typing **Q**. Your state is saved, so the next time you start Orpie, you'll find the stack as you left it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/orpie + +作者:[Peter Faller][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/peterfaller +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Reverse_Polish_notation +[2]: https://github.com/pelzlpj/orpie/blob/master/doc/orpierc.5 From 3f48a7b6b7f58bc42c1cd386a393aaf0a63e8db9 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:24:50 +0800 Subject: [PATCH 0815/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Dock?= =?UTF-8?q?ter:=20A=20container=20image=20builder=20for=20researchers=20so?= =?UTF-8?q?urces/tech/20190123=20Dockter-=20A=20container=20image=20builde?= =?UTF-8?q?r=20for=20researchers.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...container image builder for researchers.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20190123 Dockter- A container image builder for researchers.md diff --git a/sources/tech/20190123 Dockter- A container image builder for researchers.md b/sources/tech/20190123 Dockter- A container image builder for researchers.md new file mode 100644 index 0000000000..359d0c1d1e --- /dev/null +++ b/sources/tech/20190123 Dockter- A container image builder for researchers.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Dockter: A container image builder for researchers) +[#]: via: (https://opensource.com/article/19/1/dockter-image-builder-researchers) +[#]: author: (Nokome Bentley https://opensource.com/users/nokome) + +Dockter: A container image builder for researchers +====== +Dockter supports the specific requirements of researchers doing data analysis, including those using R. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/building_skyscaper_organization.jpg?itok=Ir5epxm8) + +Dependency hell is ubiquitous in the world of software for research, and this affects research transparency and reproducibility. Containerization is one solution to this problem, but it creates new challenges for researchers. Docker is gaining popularity in the research community—but using it efficiently requires solid Dockerfile writing skills. + +As a part of the [Stencila][1] project, which is a platform for creating, collaborating on, and sharing data-driven content, we are developing [Dockter][2], an open source tool that makes it easier for researchers to create Docker images for their projects. Dockter scans a research project's source code, generates a Dockerfile, and builds a Docker image. It has a range of features that allow flexibility and can help researchers learn more about working with Docker. + +Dockter also generates a JSON file with information about the software environment (based on [CodeMeta][3] and [Schema.org][4]) to enable further processing and interoperability with other tools. + +Several other projects create Docker images from source code and/or requirements files, including: [alibaba/derrick][5], [jupyter/repo2docker][6], [Gueils/whales][7], [o2r-project/containerit][8]; [openshift/source-to-image][9], and [ViDA-NYU/reprozip][10]. Dockter is similar to repo2docker, containerit, and ReproZip in that it is aimed at researchers doing data analysis (and supports R), whereas most other tools are aimed at software developers (and don't support R). + +Dockter differs from these projects principally in that it: + + * Performs static code analysis for multiple languages to determine package requirements + * Uses package databases to determine package system dependencies and generate linked metadata (containerit does this for R) + * Installs language package dependencies quicker (which can be useful during research projects where dependencies often change) + * By default but optionally, installs Stencila packages so that Stencila client interfaces can execute code in the container + + + +### Dockter's features + +Following are some of the ways researchers can use Dockter. + +#### Generating Docker images from code + +Dockter scans a research project folder and builds a Docker image for it. If the folder already has a Dockerfile, Dockter will build the image from that. If not, Dockter will scan the source code files in the folder and generate one. Dockter currently handles R, Python, and Node.js source code. The .dockerfile (with the dot at the beginning) it generates is fully editable so users can take over from Dockter and carry on with editing the file as they see fit. + +If the folder contains an R package [DESCRIPTION][11] file, Dockter will install the R packages listed under Imports into the image. If the folder does not contain a DESCRIPTION file, Dockter will scan all the R files in the folder for package import or usage statements and create a .DESCRIPTION file. + +If the folder contains a [requirements.txt][12] file for Python, Dockter will copy it into the Docker image and use [pip][13] to install the specified packages. If the folder does not contain either of those files, Dockter will scan all the folder's .py files for import statements and create a .requirements.txt file. + +If the folder contains a [package.json][14] file, Dockter will copy it into the Docker image and use npm to install the specified packages. If the folder does not contain a package.json file, Dockter will scan all the folder's .js files for require calls and create a .package.json file. + +#### Capturing system requirements automatically + +One of the headaches researchers face when hand-writing Dockerfiles is figuring out which system dependencies their project needs. Often this involves a lot of trial and error. Dockter automatically checks if any dependencies (or dependencies of dependencies, or dependencies of…) require system packages and installs those into the image. No more trial and error cycles of build, fail, add dependency, repeat… + +#### Reinstalling language packages faster + +If you have ever built a Docker image, you know it can be frustrating waiting for all your project's dependencies to reinstall when you add or remove just one. + +This happens because of Docker's layered filesystem: When you update a requirements file, Docker throws away all the subsequent layers—including the one where you previously installed your dependencies. That means all the packages have to be reinstalled. + +Dockter takes a different approach. It leaves the installation of language packages to the language package managers: Python's pip, Node.js's npm, and R's install.packages. These package managers are good at the job they were designed for: checking which packages need to be updated and updating only them. The result is much faster rebuilds, especially for R packages, which often involve compilation. + +Dockter does this by looking for a special **# dockter** comment in a Dockerfile. Instead of throwing away layers, it executes all instructions after this comment in the same layer—thereby reusing packages that were previously installed. + +#### Generating structured metadata for a project + +Dockter uses [JSON-LD][15] as its internal data structure. When it parses a project's source code, it generates a JSON-LD tree using vocabularies from schema.org and CodeMeta. + +Dockter also fetches metadata on a project's dependencies, which could be used to generate a complete software citation for the project. + +### Easy to pick up, easy to throw away + +Dockter is designed to make it easier to get started creating Docker images for your project. But it's also designed to not get in your way or restrict you from using bare Docker. You can easily and individually override any of the steps Dockter takes to build an image. + + * **Code analysis:** To stop Dockter from doing code analysis and specify your project's package dependencies, just remove the leading **.** (dot) from the .DESCRIPTION, .requirements.txt, or .package.json files. + + * **Dockerfile generation:** Dockter aims to generate readable Dockerfiles that conform to best practices. They include comments on what each section does and are a good way to start learning how to write your own Dockerfiles. To stop Dockter from generating a .Dockerfile and start editing it yourself, just rename it Dockerfile (without the leading dot). + + + + +### Install Dockter + +[Dockter is available][16] as pre-compiled, standalone command line tool or as a Node.js package. Click [here][17] for a demo. + +We welcome and encourage all [contributions][18]! + +A longer version of this article is available on the project's [GitHub page][19]. + +Aleksandra Pawlik will present [Building reproducible computing environments: a workshop for non-experts][20] at [linux.conf.au][21], January 21-25 in Christchurch, New Zealand. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/dockter-image-builder-researchers + +作者:[Nokome Bentley][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/nokome +[b]: https://github.com/lujun9972 +[1]: https://stenci.la/ +[2]: https://stencila.github.io/dockter/ +[3]: https://codemeta.github.io/index.html +[4]: http://Schema.org +[5]: https://github.com/alibaba/derrick +[6]: https://github.com/jupyter/repo2docker +[7]: https://github.com/Gueils/whales +[8]: https://github.com/o2r-project/containerit +[9]: https://github.com/openshift/source-to-image +[10]: https://github.com/ViDA-NYU/reprozip +[11]: http://r-pkgs.had.co.nz/description.html +[12]: https://pip.readthedocs.io/en/1.1/requirements.html +[13]: https://pypi.org/project/pip/ +[14]: https://docs.npmjs.com/files/package.json +[15]: https://json-ld.org/ +[16]: https://github.com/stencila/dockter/releases/ +[17]: https://asciinema.org/a/pOHpxUqIVkGdA1dqu7bENyxZk?size=medium&cols=120&autoplay=1 +[18]: https://github.com/stencila/dockter/blob/master/CONTRIBUTING.md +[19]: https://github.com/stencila/dockter +[20]: https://2019.linux.conf.au/schedule/presentation/185/ +[21]: https://linux.conf.au/ From 4b4c6dc0ef1049df74f2db812c75ed521c9a5a55 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:26:29 +0800 Subject: [PATCH 0816/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190122=20Get?= =?UTF-8?q?=20started=20with=20Go=20For=20It,=20a=20flexible=20to-do=20lis?= =?UTF-8?q?t=20application=20sources/tech/20190122=20Get=20started=20with?= =?UTF-8?q?=20Go=20For=20It,=20a=20flexible=20to-do=20list=20application.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...r It, a flexible to-do list application.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..56dde41884 --- /dev/null +++ b/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 2392636dbf30afe06682caebc7b41d35a8733514 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:11:35 +0800 Subject: [PATCH 0817/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Mind?= =?UTF-8?q?=20map=20yourself=20using=20FreeMind=20and=20Fedora=20sources/t?= =?UTF-8?q?ech/20190123=20Mind=20map=20yourself=20using=20FreeMind=20and?= =?UTF-8?q?=20Fedora.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... map yourself using FreeMind and Fedora.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..146f95752a --- /dev/null +++ b/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 257fd061a813a238dae0461e7d647619a708a887 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:15:21 +0800 Subject: [PATCH 0818/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20ffse?= =?UTF-8?q?nd=20=E2=80=93=20Easily=20And=20Securely=20Share=20Files=20From?= =?UTF-8?q?=20Linux=20Command=20Line=20Using=20Firefox=20Send=20Client=20s?= =?UTF-8?q?ources/tech/20190124=20ffsend=20-=20Easily=20And=20Securely=20S?= =?UTF-8?q?hare=20Files=20From=20Linux=20Command=20Line=20Using=20Firefox?= =?UTF-8?q?=20Send=20Client.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Command Line Using Firefox Send Client.md | 330 ++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md diff --git a/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md b/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md new file mode 100644 index 0000000000..fcbdd3c5c7 --- /dev/null +++ b/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md @@ -0,0 +1,330 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client) +[#]: via: (https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client +====== + +Linux users were preferred to go with scp or rsync for files or folders copy. + +However, so many new options are coming to Linux because it’s a opensource. + +Anyone can develop a secure software for Linux. + +We had written multiple articles in our site in the past about this topic. + +Even, today we are going to discuss the same kind of topic called ffsend. + +Those are **[OnionShare][1]** , **[Magic Wormhole][2]** , **[Transfer.sh][3]** and **[Dcp – Dat Copy][4]**. + +### What’s ffsend? + +[ffsend][5] is a command line Firefox Send client that allow users to transfer and receive files and folders through command line. + +It allow us to easily and securely share files and directories from the command line through a safe, private and encrypted link using a single simple command. + +Files are shared using the Send service and the allowed file size is up to 2GB. + +Others are able to download these files with this tool, or through their web browser. + +All files are always encrypted on the client, and secrets are never shared with the remote host. + +Additionally you can add a password for the file upload. + +The uploaded files will be removed after the download (default count is 1 up to 10) or after 24 hours. This will make sure that your files does not remain online forever. + +This tool is currently in the alpha phase. Use at your own risk. Also, only limited installation options are available right now. + +### ffsend Features: + + * Fully featured and friendly command line tool + * Upload and download files and directories securely + * Always encrypted on the client + * Additional password protection, generation and configurable download limits + * Built-in file and directory archiving and extraction + * History tracking your files for easy management + * Ability to use your own Send host + * Inspect or delete shared files + * Accurate error reporting + * Low memory footprint, due to encryption and download/upload streaming + * Intended to be used in scripts without interaction + + + +### How To Install ffsend in Linux? + +There is no package for each distributions except Debian and Arch Linux systems. However, we can easily get this utility by downloading the prebuilt appropriate binaries file based on the operating system and architecture. + +Run the below command to download the latest available version for your operating system. + +``` +$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend-v0.1.2-linux-x64.tar.gz +``` + +Extract the tar archive using the following command. + +``` +$ tar -xvf ffsend-v0.1.2-linux-x64.tar.gz +``` + +Run the following command to identify your path variable. + +``` +$ echo $PATH +/home/daygeek/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl +``` + +As i told previously, just move the executable file to your path directory. + +``` +$ sudo mv ffsend /usr/local/sbin +``` + +Run the `ffsend` command alone to get the basic usage information. + +``` +$ ffsend +ffsend 0.1.2 +Usage: ffsend [FLAGS] ... + +Easily and securely share files from the command line. +A fully featured Firefox Send client. + +Missing subcommand. Here are the most used: + ffsend upload ... + ffsend download ... + +To show all subcommands, features and other help: + ffsend help [SUBCOMMAND] +``` + +For Arch Linux based users can easily install it with help of **[AUR Helper][6]** , as this package is available in AUR repository. + +``` +$ yay -S ffsend +``` + +For **`Debian/Ubuntu`** systems, use **[DPKG Command][7]** to install ffsend. + +``` +$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend_0.1.2_amd64.deb +$ sudo dpkg -i ffsend_0.1.2_amd64.deb +``` + +### How To Send A File Using ffsend? + +It’s not complicated. We can easily send a file using simple syntax. + +**Syntax:** + +``` +$ ffsend upload [/Path/to/the/file/name] +``` + +In the following example, we are going to upload a file called `passwd-up1.sh`. Once you upload the file then you will be getting the unique URL. + +``` +$ ffsend upload passwd-up1.sh --copy +Upload complete +Share link: https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ +``` + +![][9] + +Just download the above unique URL to get the file in any remote system. + +**Syntax:** + +``` +$ ffsend download [Generated URL] +``` + +Output for the above command. + +``` +$ ffsend download https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ +Download complete +``` + +![][10] + +Use the following syntax format for directory upload. + +``` +$ ffsend upload [/Path/to/the/Directory] --copy +``` + +In this example, we are going to upload `2g` directory. + +``` +$ ffsend upload /home/daygeek/2g --copy +You've selected a directory, only a single file may be uploaded. +Archive the directory into a single file? [Y/n]: y +Archiving... +Upload complete +Share link: https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg +``` + +Just download the above generated the unique URL to get a folder in any remote system. + +``` +$ ffsend download https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg +You're downloading an archive, extract it into the selected directory? [Y/n]: y +Extracting... +Download complete +``` + +As this already send files through a safe, private, and encrypted link. However, if you would like to add a additional security at your level. Yes, you can add a password for a file. + +``` +$ ffsend upload file-copy-rsync.sh --copy --password +Password: +Upload complete +Share link: https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA +``` + +It will prompt you to update a password when you are trying to download a file in the remote system. + +``` +$ ffsend download https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA +This file is protected with a password. +Password: +Download complete +``` + +Alternatively you can limit a download speed by providing the download speed while uploading a file. + +``` +$ ffsend upload file-copy-scp.sh --copy --downloads 10 +Upload complete +Share link: https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +``` + +Just download the above unique URL to get a file in any remote system. + +``` +ffsend download https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +Download complete +``` + +If you want to see more details about the file, use the following format. It will shows you the file name, file size, Download counts and when it will going to expire. + +**Syntax:** + +``` +$ ffsend info [Generated URL] + +$ ffsend info https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +ID: 23cb923c4e +Name: file-copy-scp.sh +Size: 115 B +MIME: application/x-sh +Downloads: 3 of 10 +Expiry: 23h58m (86280s) +``` + +You can view your transaction history using the following format. + +``` +$ ffsend history +# LINK EXPIRY +1 https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw 23h57m +2 https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA 23h55m +3 https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg 23h52m +4 https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ 23h46m +5 https://send.firefox.com/download/74ff30e43e/#NYfDOUp_Ai-RKg5g0fCZXw 23h44m +6 https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf6RcA 23h43m +``` + +If you don’t want the link anymore then we can delete it. + +**Syntax:** + +``` +$ ffsend delete [Generated URL] + +$ ffsend delete https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf6RcA +File deleted +``` + +Alternatively this can be done using firefox browser by opening the page . + +Just drag and drop a file to upload it. +![][11] + +Once the file is downloaded, it will show you that 100% download completed. +![][12] + +To check other possible options, navigate to man page or help page. + +``` +$ ffsend --help +ffsend 0.1.2 +Tim Visee +Easily and securely share files from the command line. +A fully featured Firefox Send client. + +USAGE: + ffsend [FLAGS] [OPTIONS] [SUBCOMMAND] + +FLAGS: + -f, --force Force the action, ignore warnings + -h, --help Prints help information + -i, --incognito Don't update local history for actions + -I, --no-interact Not interactive, do not prompt + -q, --quiet Produce output suitable for logging and automation + -V, --version Prints version information + -v, --verbose Enable verbose information and logging + -y, --yes Assume yes for prompts + +OPTIONS: + -H, --history Use the specified history file [env: FFSEND_HISTORY] + -t, --timeout Request timeout (0 to disable) [env: FFSEND_TIMEOUT] + -T, --transfer-timeout Transfer timeout (0 to disable) [env: FFSEND_TRANSFER_TIMEOUT] + +SUBCOMMANDS: + upload Upload files [aliases: u, up] + download Download files [aliases: d, down] + debug View debug information [aliases: dbg] + delete Delete a shared file [aliases: del] + exists Check whether a remote file exists [aliases: e] + help Prints this message or the help of the given subcommand(s) + history View file history [aliases: h] + info Fetch info about a shared file [aliases: i] + parameters Change parameters of a shared file [aliases: params] + password Change the password of a shared file [aliases: pass, p] + +The public Send service that is used as default host is provided by Mozilla. +This application is not affiliated with Mozilla, Firefox or Firefox Send. +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/ + +作者:[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/onionshare-secure-way-to-share-files-sharing-tool-linux/ +[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ +[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ +[4]: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/ +[5]: https://github.com/timvisee/ffsend +[6]: https://www.2daygeek.com/category/aur-helper/ +[7]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/ +[8]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-1.png +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-2.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-3.png +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-4.png From 80fd194842eda72d4832472b130b4b8513346468 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:18:01 +0800 Subject: [PATCH 0819/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Book?= =?UTF-8?q?=20Review:=20Fundamentals=20of=20Linux=20sources/talk/20190123?= =?UTF-8?q?=20Book=20Review-=20Fundamentals=20of=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0123 Book Review- Fundamentals of Linux.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/talk/20190123 Book Review- Fundamentals of Linux.md diff --git a/sources/talk/20190123 Book Review- Fundamentals of Linux.md b/sources/talk/20190123 Book Review- Fundamentals of Linux.md new file mode 100644 index 0000000000..5e0cffd9bc --- /dev/null +++ b/sources/talk/20190123 Book Review- Fundamentals of Linux.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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/) + +Book Review: Fundamentals of Linux +====== + +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] 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? + +![Fundamental of Linux books][4] + +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. + +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. + +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. + +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. + +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. + +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 + +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. + +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. + +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. + +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. + +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: + +We will be trying to review more Linux books in coming months so stay tuned with us. + +What is your favorite introductory book on Linux? 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][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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://www.packtpub.com/networking-and-servers/fundamentals-linux +[2]: https://www.packtpub.com/ +[3]: http://www.oliverpelz.de/index.html +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/fundamentals-of-linux-book-review.jpeg?resize=800%2C450&ssl=1 +[5]: https://centos.org/ +[6]: https://www.virtualbox.org/ +[7]: https://www.centos.org/ +[8]: http://reddit.com/r/linuxusersgroup From adb460d03ae6ada6ad41c61e20c8d6c4ac0fbd97 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:22:08 +0800 Subject: [PATCH 0820/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190119=20Get?= =?UTF-8?q?=20started=20with=20Roland,=20a=20random=20selection=20tool=20f?= =?UTF-8?q?or=20the=20command=20line=20sources/tech/20190119=20Get=20start?= =?UTF-8?q?ed=20with=20Roland,=20a=20random=20selection=20tool=20for=20the?= =?UTF-8?q?=20command=20line.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dom selection tool for the command line.md | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md diff --git a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md new file mode 100644 index 0000000000..1bfeb92c0c --- /dev/null +++ b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Roland, a random selection tool for the command line) +[#]: via: (https://opensource.com/article/19/1/productivity-tools-roland) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Roland, a random selection tool for the command line +====== + +Get help making hard choices with Roland, the seventh 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/dice_tabletop_board_gaming_game.jpg?itok=y93eW7HN) + +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 seventh of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Roland + +By the time the workday has ended, often the only thing I want to think about is hitting the couch and playing the video game of the week. But even though my professional obligations stop at the end of the workday, I still have to manage my household. Laundry, pet care, making sure my teenager has what he needs, and most important: deciding what to make for dinner. + +Like many people, I often suffer from [decision fatigue][1], and I make less-than-healthy choices for dinner based on speed, ease of preparation, and (quite frankly) whatever causes me the least stress. + +![](https://opensource.com/sites/default/files/uploads/roland-1.png) + +[Roland][2] makes planning my meals much easier. Roland is a Perl application designed for tabletop role-playing games. It picks randomly from a list of items, such as monsters and hirelings. In essence, Roland does the same thing at the command line that a game master does when rolling physical dice to look up things in a table from the Game Master's Big Book of Bad Things to Do to Players. + +With minor modifications, Roland can do so much more. For example, just by adding a table, I can enable Roland to help me choose what to cook for dinner. + +The first step is installing Roland and all its dependencies. + +``` +git clone git@github.com:rjbs/Roland.git +cpan install Getopt::Long::Descriptive Moose \ +   namespace::autoclean List:AllUtils Games::Dice \ +   Sort::ByExample Data::Bucketeer Text::Autoformat \ +   YAML::XS +cd oland +``` + +Next, I create a YAML document named **dinner** and enter all our meal options. + +``` +type: list +pick: 1 +items: + - "frozen pizza" + - "chipotle black beans" + - "huevos rancheros" + - "nachos" + - "pork roast" + - "15 bean soup" + - "roast chicken" + - "pot roast" + - "grilled cheese sandwiches" +``` + +Running the command **bin/roland dinner** will read the file and pick one of the options. + +![](https://opensource.com/sites/default/files/uploads/roland-2.png) + +I like to plan for the week ahead so I can shop for all my ingredients in advance. The **pick** command determines how many items from the list to chose, and right now, the **pick** option is set to 1. If I want to plan a full week's dinner menu, I can just change **pick: 1** to **pick: 7** and it will give me a week's worth of dinners. You can also use the **-m** command line option to manually enter the choices. + +![](https://opensource.com/sites/default/files/uploads/roland-3.png) + +You can also do fun things with Roland, like adding a file named **8ball** with some classic phrases. + +![](https://opensource.com/sites/default/files/uploads/roland-4.png) + +You can create all kinds of files to help with common decisions that seem so stressful after a long day of work. And even if you don't use it for that, you can still use it to decide which devious trap to set up for tonight's game. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tools-roland + +作者:[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/Decision_fatigue +[2]: https://github.com/rjbs/Roland From 441b66b06b1f9210858c441077f044afcd9d7a52 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:55:20 +0800 Subject: [PATCH 0821/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190122=20Dcp?= =?UTF-8?q?=20(Dat=20Copy)=20=E2=80=93=20Easy=20And=20Secure=20Way=20To=20?= =?UTF-8?q?Transfer=20Files=20Between=20Linux=20Systems=20sources/tech/201?= =?UTF-8?q?90122=20Dcp=20(Dat=20Copy)=20-=20Easy=20And=20Secure=20Way=20To?= =?UTF-8?q?=20Transfer=20Files=20Between=20Linux=20Systems.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To Transfer Files Between Linux Systems.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md diff --git a/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md b/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md new file mode 100644 index 0000000000..b6499932ae --- /dev/null +++ b/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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) – Easy And Secure Way To Transfer Files Between Linux Systems +====== + +Linux has native command to perform this task nicely using scp and rsync. However, we need to try new things. + +Also, we need to encourage the developers who is working new things with different concept and new technology. + +We also written few articles about these kind of topic, you can navigate those by clicking the below appropriate links. + +Those are **[OnionShare][1]** , **[Magic Wormhole][2]** , **[Transfer.sh][3]** and **ffsend**. + +### What’s Dcp? + +[dcp][4] copies files between hosts on a network using the peer-to-peer Dat network. + +dcp can be seen as an alternative to tools like scp, removing the need to configure SSH access between hosts. + +This lets you transfer files between two remote hosts, without you needing to worry about the specifics of how said hosts reach each other and regardless of whether hosts are behind NATs. + +dcp requires zero configuration and is secure, fast, and peer-to-peer. Also, this is not production-ready software. Use at your own risk. + +### What’s Dat Protocol? + +Dat is a peer-to-peer protocol. A community-driven project powering a next-generation Web. + +### How dcp works: + +dcp will create a dat archive for a specified set of files or directories and, using the generated public key, lets you download said archive from a second host. + +Any data shared over the network is encrypted using the public key of the archive, meaning data access is limited to those who have access to said key. + +### dcp Use cases: + + * Send files to multiple colleagues – just send the generated public key via chat and they can receive the files on their machine. + * Sync files between two physical computers on your local network, without needing to set up SSH access. + * Easily send files to a friend without needing to create a zip and upload it the cloud. + * Copy files to a remote server when you have shell access but not SSH, for example on a kubernetes pod. + * Share files between Linux/macOS and Windows, which isn’t exactly known for great SSH support. + + + +### How To Install NodeJS & npm in Linux? + +dcp package was written in JavaScript programming language so, we need to install NodeJS as a prerequisites to install dcp. Use the following command to install NodeJS in Linux. + +For **`Fedora`** system, use **[DNF Command][5]** to install NodeJS & npm. + +``` +$ sudo dnf install nodejs npm +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][6]** or **[APT Command][7]** to install NodeJS & npm. + +``` +$ sudo apt install nodejs npm +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][8]** to install NodeJS & npm. + +``` +$ sudo pacman -S nodejs npm +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][9]** to install NodeJS & npm. + +``` +$ sudo yum install epel-release +$ sudo yum install nodejs npm +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][10]** to install NodeJS & npm. + +``` +$ sudo zypper nodejs6 +``` + +### How To Install dcp in Linux? + +Once you have installed the NodeJS, use the following npm command to install dcp. + +npm is a package manager for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js. + +``` +# npm i -g dat-cp +``` + +### How to Send Files Through dcp? + +Enter the files or folders which you want to transfer to remote server followed by the dcp command, And no need to mention the destination machine name. + +``` +# dcp [File Name Which You Want To Transfer] +``` + +It will generate a dat archive for the given file when you ran the dcp command. Once it’s done then it will geerate a public key at the bottom of the page. + +### How To Receive Files Through dcp? + +Enter the generated the public key on remote server to receive the files or folders. + +``` +# dcp [Public Key] +``` + +To recursively copy directories. + +``` +# dcp [Folder Name Which You Want To Transfer] -r +``` + +In the following example, we are going to transfer a single file. +![][12] + +Output for the above file transfer. +![][13] + +If you want to send more than one file, use the following format. +![][14] + +Output for the above file transfer. +![][15] + +To recursively copy directories. +![][16] + +Output for the above folder transfer. +![][17] + +It won’t allow you to download the files or folders in second time. It means once you downloaded the files or folders then immediately the link will be expired. +![][18] + +Navigate to man page to know about other options. + +``` +# dcp --help +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/ + +作者:[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/onionshare-secure-way-to-share-files-sharing-tool-linux/ +[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ +[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ +[4]: https://github.com/tom-james-watson/dat-cp +[5]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[6]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[7]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[8]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[9]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[10]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[11]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-1.png +[13]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-2.png +[14]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-3.jpg +[15]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-4.jpg +[16]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-6.jpg +[17]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-7.jpg +[18]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-5.jpg From 7463be52e586bcddb6511eb951a30d3c2f1e3b0b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:57:11 +0800 Subject: [PATCH 0822/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190121=20Get?= =?UTF-8?q?=20started=20with=20TaskBoard,=20a=20lightweight=20kanban=20boa?= =?UTF-8?q?rd=20sources/tech/20190121=20Get=20started=20with=20TaskBoard,?= =?UTF-8?q?=20a=20lightweight=20kanban=20board.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...h TaskBoard, a lightweight kanban board.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..e77e5e3b1c --- /dev/null +++ b/sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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/ From c621b80f44d7288f94ba6f8f73ae305d34a72cbd Mon Sep 17 00:00:00 2001 From: MjSeven Date: Mon, 28 Jan 2019 19:31:26 +0800 Subject: [PATCH 0823/4278] Translating --- ...tting started with Isotope, an open source webmail client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md index e4a24a28a8..71307d1550 100644 --- a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md +++ b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ec3bd5b5881f5a08f1deebe8bc2108663f7e5141 Mon Sep 17 00:00:00 2001 From: jrg Date: Mon, 28 Jan 2019 20:36:13 +0800 Subject: [PATCH 0824/4278] Delete 20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md --- ...n a Raspberry Pi 3B- into a PriTunl VPN.md | 113 ------------------ 1 file changed, 113 deletions(-) delete mode 100644 sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md diff --git a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md deleted file mode 100644 index 3d6d94cabf..0000000000 --- a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md +++ /dev/null @@ -1,113 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (jrglinux) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) -[#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) -[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) - -Turn a Raspberry Pi 3B+ into a PriTunl VPN -====== -PriTunl is a VPN solution for small businesses and individuals who want private access to their network. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2) - -[PriTunl][1] is a fantastic VPN terminator solution that's perfect for small businesses and individuals who want a quick and simple way to access their network privately. It's open source, and the basic free version is more than enough to get you started and cover most simple use cases. There is also a paid enterprise version with advanced features like Active Directory integration. - -### Special considerations on Raspberry Pi 3B+ - -PriTunl is generally simple to install, but this project—turning a Raspberry Pi 3B+ into a PriTunl VPN appliance—adds some complexity. For one thing, PriTunl is supplied only as AMD64 and i386 binaries, but the 3B+ uses ARM architecture. This means you must compile your own binaries from source. That's nothing to be afraid of; it can be as simple as copying and pasting a few commands and watching the terminal for a short while. - -Another problem: PriTunl seems to require 64-bit architecture. I found this out when I got errors when I tried to compile PriTunl on my Raspberry Pi's 32-bit operating system. Fortunately, Ubuntu's beta version of 18.04 for ARM64 boots on the Raspberry Pi 3B+. - -Also, the Raspberry Pi 3B+ uses a different bootloader from other Raspberry Pi models. This required a complicated set of steps to install and update the necessary files to get a Raspberry Pi 3B+ to boot. - -### Installing PriTunl - -You can overcome these problems by installing a 64-bit operating system on the Raspberry Pi 3B+ before installing PriTunl. I'll assume you have basic knowledge of how to get around the Linux command line and a Raspberry Pi. - -Start by opening a terminal and downloading the Ubuntu 18.04 ARM64 beta release by entering: - -``` -$ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img.xz -``` - -Unpack the download: - -``` -$ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz -``` - -Insert the SD card you'll use with your Raspberry Pi into your desktop or laptop computer. Your computer will assign the SD card a drive letter—something like **/dev/sda** or **/dev/sdb**. Enter the **dmesg** command and examine the last lines of the output to find out the card's drive assignment. - -**Be VERY CAREFUL with the next step! I can't stress that enough; if you get the drive assignment wrong, you could destroy your system.** - -Write the image to your SD card with the following command, changing **< DRIVE>** to your SD card's drive assignment (obtained in the previous step): - -``` -$ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of= bs=8M -``` - -After it finishes, insert the SD card into your Pi and power it up. Make sure the Pi is connected to your network, then log in with username/password combination ubuntu/ubuntu. - -Enter the following commands on your Pi to install a few things to prepare to compile PriTunl: - -``` -$ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb -``` - -There are a few changes from the standard PriTunl source [installation instructions on GitHub][2]. Make sure you are logged into your Pi and **sudo** to root: - -``` -$ sudo su - -``` - -This should leave you in root's home directory. To install PriTunl version 1.29.1914.98, enter (per GitHub): - -``` -export VERSION=1.29.1914.98 -tee -a ~/.bashrc << EOF -export GOPATH=\$HOME/go -export PATH=/usr/local/go/bin:\$PATH -EOF -source ~/.bashrc -mkdir pritunl && cd pritunl -go get -u github.com/pritunl/pritunl-dns -go get -u github.com/pritunl/pritunl-web -sudo ln -s ~/go/bin/pritunl-dns /usr/bin/pritunl-dns -sudo ln -s ~/go/bin/pritunl-web /usr/bin/pritunl-web -wget https://github.com/pritunl/pritunl/archive/$VERSION.tar.gz -tar -xf $VERSION.tar.gz -cd pritunl-$VERSION -python2 setup.py build -pip install -r requirements.txt -python2 setup.py install --prefix=/usr/local -``` - -Now the MongoDB and PriTunl systemd units should be ready to start up. Assuming you're still logged in as root, enter: - -``` -systemctl daemon-reload -systemctl start mongodb pritunl -systemctl enable mongodb pritunl -``` - -That's it! You're ready to hit PriTunl's browser user interface and configure it by following PriTunl's [installation and configuration instructions][3] on its website. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi - -作者:[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://pritunl.com/ -[2]: https://github.com/pritunl/pritunl -[3]: https://docs.pritunl.com/docs/configuration-5 From 18d944a254382dd664069f1c2f83a5b3b6781fd6 Mon Sep 17 00:00:00 2001 From: jrg Date: Mon, 28 Jan 2019 20:36:58 +0800 Subject: [PATCH 0825/4278] Create 20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成 --- ...n a Raspberry Pi 3B- into a PriTunl VPN.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md diff --git a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md new file mode 100644 index 0000000000..a610a2cfbd --- /dev/null +++ b/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (jrglinux) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) +[#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +将树梅派3B+变为 PriTunl VPN +====== +PriTunl 是一种 VPN 解决方案,适用于希望私密的访问其网络的小型企业和个人。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2) + +[PriTunl][1] 是一款出色的 VPN 终端解决方案,非常适合希望以简单快捷的方式私密的访问网络的小型企业和个人。 它是开源的,基本的免费版本涵盖最通用的简单的实例,足以让你快速入门。 也有集成 Active Directory 等高级功能的付费企业版 + +### 有关树梅派3B+的特别注意事项 + +PriTunl 的安装通常也很简单,但要在树梅派3B+上安装 PriTunl 有点小复杂。比如,PriTunl 只提供了 AMD64 和 i386 架构的二进制文件,但树梅派3B+是 ARM 架构的,这意味着需要从源码自行编译可用于树梅派3B+的 PriTunl 可执行文件。不过,无需担心,编译过程很简单,只需花一点时间执行几行命令即可。 + +另一个问题:PriTunl 好像必须要是64位处理器架构,当我在32位操作系统上尝试编译的时候报错了。但幸运的是,用于 ARM64 架构的 Ubuntu 18.04 测试版本可以安装在树梅派3B+上。 + +同样,树梅派3B+需要和其他树梅派不同的引导程序。需要一组小复杂的命令来安装更新树梅派3B+上必要的组件。 + + +### 安装 PriTunl + +你可以先在树梅派3B+上安装64位的操作系统来避免下面这些问题。此处需要一些必要的基础知识如在树梅派上执行命令行。 + +打开终端,用如下命令下载 Ubuntu 18.04 用于 ARM64 架构的测试版: + +``` +$ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img.xz +``` + +将下载的固件解压: + +``` +$ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz +``` + +将准备好的 SD 卡插入电脑读卡槽,电脑会为 SD 卡分配一个驱动分配器号,例如 **/dev/sda** 或者 **/dev/sdb**。 输入命令 **dmesg** 然后观察屏幕上的最后几行找到 SD 卡的驱动分配器。 + +**下一步小心操作,如果搞错了驱动分配器号,可能会破坏你的系统** + +用如下命令往 SD 卡中写入数据,将其中的 **** 替换成你的 SD 驱动器号。 + +``` +$ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of= bs=8M +``` + +完成上一步之后,将 SD 卡插入树梅派3B+,并启动它。确保树梅派3B+是连网的,然后登陆系统,用户名/密码:ubuntu/ubuntu。 + +在树梅派上输入以下命令以安装一些准备编译PriTunl的东西: + +``` +$ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb +``` + +和 PriTunl 标准源码上的 [安装说明][2] 有一点不一样。确保已经登录进树梅派然后切换到管理员账户: + +``` +$ sudo su - +``` + +现在你应该在管理员账户的目录下,按如下命令来安装 PriTunl 1.29.1914.98 版本: + +``` +export VERSION=1.29.1914.98 +tee -a ~/.bashrc << EOF +export GOPATH=\$HOME/go +export PATH=/usr/local/go/bin:\$PATH +EOF +source ~/.bashrc +mkdir pritunl && cd pritunl +go get -u github.com/pritunl/pritunl-dns +go get -u github.com/pritunl/pritunl-web +sudo ln -s ~/go/bin/pritunl-dns /usr/bin/pritunl-dns +sudo ln -s ~/go/bin/pritunl-web /usr/bin/pritunl-web +wget https://github.com/pritunl/pritunl/archive/$VERSION.tar.gz +tar -xf $VERSION.tar.gz +cd pritunl-$VERSION +python2 setup.py build +pip install -r requirements.txt +python2 setup.py install --prefix=/usr/local +``` + +现在,不出意外的话应该可以启动 MongoDB 和 PriTunl 系统单元了。假如现在还是以管理员账户登录的话,输入: + +``` +systemctl daemon-reload +systemctl start mongodb pritunl +systemctl enable mongodb pritunl +``` + +大功告成!你现在可以登录 PriTunl 的用户界面并按照官网上的 [安装和配置手册][3] 来配置它了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi + +作者:[Stephen Bancroft][a] +选题:[lujun9972][b] +译者:[jrg](https://github.com/jrglinux) +校对:[校对者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://pritunl.com/ +[2]: https://github.com/pritunl/pritunl +[3]: https://docs.pritunl.com/docs/configuration-5 From e836ea817279f26be68718192c8d814fa212254f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 22:35:22 +0800 Subject: [PATCH 0826/4278] PRF:20150717 The History of Hello World.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zzzzzzmj 恭喜你完成了第一篇翻译! --- .../20150717 The History of Hello World.md | 61 +++++++++---------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/translated/tech/20150717 The History of Hello World.md b/translated/tech/20150717 The History of Hello World.md index 514f24d109..d896e03f16 100644 --- a/translated/tech/20150717 The History of Hello World.md +++ b/translated/tech/20150717 The History of Hello World.md @@ -1,53 +1,52 @@ [#]: collector: "lujun9972" [#]: translator: "zzzzzzmj" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "The History of Hello World" [#]: via: "https://www.thesoftwareguild.com/blog/the-history-of-hello-world/" [#]: author: "thussong https://www.thesoftwareguild.com/blog/author/thussong/" +Hello World 的由来 +========= +资深软件开发人员都知道 [Hello World][2] 程序,这是一个能在设备显示器上输出某种变体的 “Hello, World!” 的程序,是学习编程的第一步。在这个编程中只涉及到一些最基本语法的程序,可以用大多数编程语言了来编写。事实上,路易斯安纳理工学院计算机协会(ACM)在最近统计[发现][3]这个程序至少有 204 个版本。 -# Hello World 的由来 +传统意义上,Hello World 程序是用于说明编码过程是如何工作的,以及确保编程语言或系统能正常运行。它们经常是新手程序员学习的第一个程序,因为即使是经验很少或者没有经验的人也能轻松正确的执行 Hello World。 -资深软件开发人员都知道[Hello world](2)程序,一个能被输出多种"Hello, World!"的程序,是学习编程的第一步。这个编程中只涉及到一些最基本语法的程序,可以被大多数语言输出在显示器上。事实上,路易斯安纳理工学院计算机协会(ACM)在最近统计[发现](3)这个项目至少有204个版本。 +首先,Hello World 简单,这就是为什么它经常被用做程序执行成功的晴雨表。如果 Hello World 在该框架中无法有效执行,那么其它更复杂的程序中也可能会失败。正如 [Win-Vector][4] 的一位专家所说,Hello World 实际上是一个对抗性程序。“该作者还说道,‘你的计算机系统能不能工作并不是一目了然,除非我能看到它至少能打印一行文字,否则我不会在上面浪费太多时间。’” Win-Vector 博主 John Mount 说。 -传统意义上,Hello World程序是用于说明编码过程是如何工作的,以及确保语言或系统能正常运行。它们经常是新手程序员学习的第一个程序,因为即使是经验很少或者没有经验的人也能轻松正确的执行Hello World。 - -首先,Hello World 简单,这就是为什么它经常被用做程序执行成功的晴雨表。如果Hello World在框架中无法有效执行,那么在其他更复杂的程序中也可能会失败。正如[Win-Vector](4)的一位专家所说,"Hello World实际上是一个对抗性程序"。该作者还说道,"你的计算机系统没有工作并不起眼,所有我们不会花很多时间在上面,不过我要看到它至少能打印一行文字"。 - -但是 这个两词短语在计算机科学领域有着重大的影响。以Hello World为基础,新手程序员可以轻松的去理解计算机科学原理,而拥有多年编码经验的程序员可以用它来学习编程语言的工作原理,特别是在结构与语言方面。这样的一个小程序,在任何难度和几乎所有的语言的应用程序中都有着悠久的历史。 +但是这个两词短语在计算机科学领域有着重大的影响。以 Hello World 为基础,新手程序员可以轻松的理解计算机科学原理或元素,而拥有多年编码经验的程序员可以用它来学习编程语言的工作原理,特别是在结构与语法方面。这样的一个小程序,在任何难度的应用程序和几乎所有语言中都有着悠久的历史。 ### 用途 -上文中一句话概括Hello World程序的主要用途:这是新手程序员熟悉新语言的一种方式。然而,这些程序不仅仅是对编码世界的介绍。例如,Hello World 可以作为测试,以确保语言的组件(编译器,开发和运行环境)安装正确。因为配置完整的编程工具链的过程复杂而漫长,所以像Hello World这样简单的程序通常用作新工具的首次运行测试。 +以上概括了 Hello World 程序的主要用途:这是新手程序员熟悉新语言的一种方式。然而,这些程序不仅仅是对编码世界的介绍。例如,Hello World 可以作为测试,以确保语言的组件(编译器、开发和运行环境)安装正确。因为配置完整的编程工具链的过程复杂而漫长,所以像 Hello World 这样简单的程序通常用作新工具链的首次运行测试。 -根据Cunningham & Cunningham (C2)的编程顾问所说, 黑客经常使用Hello World程序, 来证明猜想,因为任何代码都可以通过漏洞执行,而系统设计人员并不允许执行代码。事实上,它是在设备上使用自制内容或者“home brew”的第一步, 当[有经验的编码人员](5)正在配置环境或在学习新事物时,他们会Hello World 来验证动作是否正确。 +根据 Cunningham & Cunningham(C2)的编程顾问所说,在系统设计人员并不预期可以执行代码的地方,黑客经常使用 Hello World 程序作为一个可以通过漏洞执行任意代码的概念验证(POC)。事实上,它是在设备上使用自制内容或者“自酿”的第一步,当[有经验的编码人员][5]正在配置环境或在学习新事物时,他们会通过 Hello World 来验证其行为是否正确。 -它也是作为调试的一部分,允许程序员在程序运行时检查他么编辑修改了的地方是否正确,然后重新加载。 +它也作为调试过程的一部分,允许程序员检查他们是否正确地编辑了可在运行时修改的程序并重新加载。 -Hello World的一个更常用的用途是作为基础的比较。根据C2的wiki所讲,程序员可以比较语言生成的可执行文件的大小,以及程序背后必须存在多少支持基础结构才能执行。 +Hello World 的一个更常用的用途是作为基础比较。根据 C2 的 wiki 所讲,程序员可以“比较语言生成的可执行文件的大小,以及程序背后必须存在多少支持的基础设施才能执行。” ### 开端 -虽然Hello World 的起源还有些不太明了,不过人们普遍认为它是作为测试用语,最早出现在Brian Kernigham 在1972年发布的B语言教程简介中。在此文中,该程序的第一个已知版本用于说明外部变量。因为教程中的前一个例子在终端上打印了“hi!”,而需要更多字符常量来表达相对复杂的“hello,world!”,是学习过程的下一步。 +虽然 Hello World 的起源还有些不太明了,不过人们普遍认为它作为测试用语,最早出现在 Brian Kernigham 在 1972 年发布的《B 语言简介教程A Tutorial Introduction to the Language B》中。在此文中,该程序的第一个已知版本用于说明外部变量。因为该教程中的前一个例子在终端上打印了 “hi!”,而需要更多的字符常量来表达相对复杂的 “hello,world!”,这是学习过程的下一步。 -在那以后,它还被用于1974年的贝尔实验室备忘录,以及1987年的C语言程序设计。这两篇著名的文章是让Hello World闻名于世的主要原因。在书中的一个例子(第一个也是最著名的例子)打印了没有大写字母和感叹号的“hello,world”,此时的Hello World几乎只是用于说明语言的一些功能,而不是测试系统是否正常运行。 +在那以后,它还被用于 1974 年的贝尔实验室备忘录,以及 1987 年的《C 语言程序设计The C Programming Language》。这两篇著名的文字是让 Hello World 闻名于世的主要原因。在书中的一个例子(第一个,也是最著名的例子)打印了没有大写字母和感叹号的 “hello,world”。此时的 Hello World 几乎只是用于说明语言的一些功能,而不是测试系统是否正常运行。 -在Kernigham的关于B语言和C语言的开创性文章之前,没有真正意义上的第一个程序,甚至直到1974年,它也没被广泛使用。著名的BASIC教程“My Computer Likes Me,When I Speak BASIC”,从一个写一行文本的简单程序开始,不过那句话是“MY HUMAN UNDERSTANDS ME”,跟如今程序员侃侃而谈的双词问候语差的有点远。不过,当Hello World被发明后,它就迅速传播,并在20世纪70年代后从所周知。直到今天它也依然受欢迎。 +在 Kernigham 的关于 B 语言和 C 语言的开创性文章之前,没有真正意义上的第一个程序,甚至直到 1974 年,它也没被广泛使用。著名的 BASIC 教程 “我的电脑喜欢我用 BASIC 跟它讲话My Computer Likes Me,When I Speak BASIC”,从一个写一行文本的简单程序开始,不过那句话是 “MY HUMAN UNDERSTANDS ME”,跟如今程序员侃侃而谈的这个双词问候语差的有点远。不过,当 Hello World 被发明后,它就迅速传播,并在 20 世纪 70 年代后变成了众所周知。直到今天它也依然受欢迎。 -### 一个声明, 多种语言 +### 一个声明,多种语言 -以下是目前正在被使用的一些流行的编程语言中的Hello World 代码 +以下是目前正在被使用的一些流行的编程语言中的 Hello World 代码。 #### Java ``` class HelloWorld { -public static void main(String[] args) { -System.out.println("Hello, world!"); -} + public static void main(String[] args) { + System.out.println("Hello, world!"); + } } ``` @@ -57,10 +56,10 @@ System.out.println("Hello, world!"); using System; class Program { -public static void Main(string[] args) -{ -Console.WriteLine("Hello, world!"); -} + public static void Main(string[] args) + { + Console.WriteLine("Hello, world!"); + } } ``` @@ -80,7 +79,7 @@ puts "Hello, world!" ``` object HelloWorld extends App { -println("Hello, world!") + println("Hello, world!") } ``` @@ -115,17 +114,15 @@ main = putStrLn "Hello, world!" package main import "fmt" func main() { -fmt.Println("Hello, world!") + fmt.Println("Hello, world!") } ``` +### 如今的 Hello world:各种形式下的标准实践 +在现在的编程语言中,Hello World 有着不同的复杂程度。例如,Go 语言中引入一个多语言版的 Hello World 程序,XL 则会提供一个具有图形、可旋转的 3D 版本。一些编程语言,像 Ruby、Python,仅仅需要一个语句去打印“Hello World”,但是低级汇编语言则需要几个命令才能做到这样。现在的编程语言还引入对标点符号和大小写的变化,包括是否有逗号或者感叹号,以及两个词的大写形式。举个例子,当系统只支持大写字母,会呈现像“HELLO WORLD”的短语。值得纪念的第一个 Malbolge 程序打印出了“HEllO WORld”(LCTT 译注:Malbolge 是最难的编程语言之一。事实上,在它诞生后,花了 2 年时间才完成第一个 Malbolge 程序)。它的变体跨越了原本的字面意思。像 Lisp、Haskell 这样函数语言,用阶乘程序替代了 Hello World,从而注重递归技术。这与原来的示例不同,后者更强调 I/O 以及产生的副作用。 -### 如今的 Hello world: 各种形式下的标准实践 - -在现在的编程语言中,Hello world有着不同的复杂程度。例如,Go语言中引入一个多语言的Hello World程序,XL则会提供一个具有图形、可旋转的3D版本。一些编程语言,像Ruby,Python,仅仅需要一个声明去打印"Hello World",但是低级汇编语言则需要几个命令才能做到这样。现在的编程语言还引入对标点符号的支持,包括逗号或者感叹号是否存在,以及两个词的大写。举个例子,当系统只支持大写字母,会呈现像"HELLO WORLD"的短语。第一个不平凡的Malbolge程序打印出了"HEllO WORld",跨域了原本的字面意思。功能语言像Lisp、Haskell,阶乘程序替代了Hello World,从而注重递归技术。这与原来的示例不同,后者更强调I/O以及产生的副作用。 - -随着现在的编程语言越来越复杂,Hello World 比以往显得更加重要。同样作为测试和教学工具,它已经成为程序员测试配置的编程环境的标准方法。没有人能确切说出为什么Hello World能在快速创新著称的行业中经受住时间的考验,但是它又确实留下来了。 +随着现在的编程语言越来越复杂,Hello World 比以往显得更加重要。作为测试和教学工具,它已经成为程序员测试配置的编程环境的标准方法。没有人能确切说出为什么 Hello World 能在快速创新著称的行业中经受住时间的考验,但是它又确实留下来了。 -------------------------------------------------------------------------------- @@ -134,7 +131,7 @@ via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/ 作者:[thussong][a] 选题:[lujun9972][b] 译者:[zzzzzzmj](https://github.com/zzzzzzmj) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8c3942968d69944577f72022941bee553c1fdb08 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 22:36:41 +0800 Subject: [PATCH 0827/4278] PUB:20150717 The History of Hello World.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zzzzzzmj 本文首发地址: https://linux.cn/article-10485-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/zzzzzzmj 请注册领取 LCCN: https://lctt.linux.cn/ --- .../tech => published}/20150717 The History of Hello World.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20150717 The History of Hello World.md (99%) diff --git a/translated/tech/20150717 The History of Hello World.md b/published/20150717 The History of Hello World.md similarity index 99% rename from translated/tech/20150717 The History of Hello World.md rename to published/20150717 The History of Hello World.md index d896e03f16..de2b3bb551 100644 --- a/translated/tech/20150717 The History of Hello World.md +++ b/published/20150717 The History of Hello World.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "zzzzzzmj" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10485-1.html" [#]: subject: "The History of Hello World" [#]: via: "https://www.thesoftwareguild.com/blog/the-history-of-hello-world/" [#]: author: "thussong https://www.thesoftwareguild.com/blog/author/thussong/" From eed786ab1d8b93a4a0f3c55ff2f9744e75df160f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 23:12:34 +0800 Subject: [PATCH 0828/4278] PRF:20181203 How to bring good fortune to your Linux terminal.md @MjSeven --- ...ing good fortune to your Linux terminal.md | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md b/translated/tech/20181203 How to bring good fortune to your Linux terminal.md index 19d703afab..97def132e7 100644 --- a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md +++ b/translated/tech/20181203 How to bring good fortune to your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (How to bring good fortune to your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) @@ -9,20 +9,21 @@ 如何为你的 Linux 终端带来好运 ====== -使用 fortune 实用程序将引号和俏皮话带到命令行。 +> 使用 fortune 实用程序将名言和俏皮话带到命令行。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-fortune.png?itok=5PVVZVer) -这是 12 月,如果你还没有找到一款能激发你灵感的[科技降临节日历][1],那么,也许这个系列可以。从现在到 24 日,每天我们都会为你带来一个不同的 Linux 命令行玩具。你可能会问,什么是命令行玩具?它可能是一个游戏或任何简单的娱乐,为你的终端带来一点点快乐。 +这是 12 月,如果你还没有找到一款能激发你灵感的[科技降临节日历][1],那么,也许这个系列可以。从现在到 24 日,每天我们都会为你带来一个不同的 Linux 命令行玩具。你可能会问,什么是命令行玩具?它可能是一个游戏或任何简单的娱乐程序,为你的终端带来一点点快乐。 你可能之前已经看过其中的一些,我们希望你也能发现一些新的东西。不管怎样,我们都希望你在关注时保有乐趣。 -今天的玩具是 **fortune**,它很古老。它的版本可以追溯到 1980 年,当时它包含在 Unix 中。我在 Fedora 中安装的版本是在 BSD 许可下提供的,我可以使用以下命令获取它。 +今天的玩具是 `fortune`,它很古老。它的版本可以追溯到 1980 年,当时它包含在 Unix 中。我在 Fedora 中安装的版本是在 BSD 许可下提供的,我可以使用以下命令获取它。(LCTT 译注:fortune 这个命令得名于 fortune cookies,是流行于西方的中餐馆的一种脆饼干,里面包含格言、幸运数字等。) + ``` $ sudo dnf install fortune-mod -y ``` -你的发行版可能会有所不同。在某些情况下,你可能需要将 fortunes 独立于 **fortune** 本身安装(尝试在你的包管理器中搜索 "fortunes")。你还可以在 [GitHub][2] 上查看它的源代码,然后,只需运行 **fortune** 即可获得好运。 +你的发行版可能会有所不同。在某些情况下,你可能需要在 `fortune` 命令之外单独安装那些“幸运饼干”(尝试在你的包管理器中搜索 “fortunes”)。你还可以在 [GitHub][2] 上查看它的源代码,然后,只需运行 `fortune` 即可获得好运。 ``` $ fortune @@ -30,11 +31,11 @@ $ fortune -- Ford Prefect, _Hitchhiker's Guide to the Galaxy_ ``` -那么,你为什么会在终端上需要 fortune 呢?当然是为了好玩啦。也许你想将它们添加到系统上的每天消息中? +那么,你为什么会在终端上需要 `fortune` 呢?当然是为了好玩啦。也许你想将它们添加到系统上的每天消息(motd)中? -就我个人而言,当我使用终端来解析文本时,我喜欢使用 **fortune** 命令作为一段内置的虚拟数据,特别是使用[正则表达式][3]时,我想要一些简单的东西来尝试一下。 +就我个人而言,当我使用终端来解析文本时,我喜欢使用 `fortune` 命令作为一段内置的虚拟数据,特别是使用[正则表达式][3]时,我想要一些简单的东西来尝试一下。 -例如,假设我使用 **tr** 命令来测试转换,用数字 3 替换字母 e。 +例如,假设我使用 `tr` 命令来测试转换,用数字 3 替换字母 e。 ``` $ fortune | tr 'eE' '3' @@ -47,19 +48,20 @@ th3m all th3 sam3 nam3. Som3 pass3ng3rs actually r3ach th3ir d3stinations. All pass3ng3rs b3li3v3 th3y got th3r3. ``` -那么 fortunes 到底为你的发行版带来了什么呢?看看你的 **/usr/share/games/fortune** 目录,找到它们。以下我最喜欢的几个。 +那么你的发行版带来了什么幸运饼干呢?看看你的 `/usr/share/games/fortune` 目录,找到它们。以下我最喜欢的几个。 + ``` Never laugh at live dragons.                 -- Bilbo Baggins [J.R.R. Tolkien, "The Hobbit"] I dunno, I dream in Perl sometimes... -             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> +             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> I have an existential map.  It has "You are here" written all over it.                 -- Steven Wright ``` -想要了解更多关于 **fortune**?当然,你可以经常查看 man 页来了解更多选项,或者在[维基百科][4]上阅读更多关于此命令的历史信息。 +关于 `fortune` 想要了解更多?当然,你可以经常查看 man 页来了解更多选项,或者在[维基百科][4]上阅读更多关于此命令的历史信息。 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -73,7 +75,7 @@ via: https://opensource.com/article/18/12/linux-toy-fortune 作者:[Jason Baker][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 37ed877a1ca89e11fed90ce48c08cc46f66c4cbd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 23:13:16 +0800 Subject: [PATCH 0829/4278] PUB:20181203 How to bring good fortune to your Linux terminal.md @MjSeven https://linux.cn/article-10486-1.html --- ...181203 How to bring good fortune to your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181203 How to bring good fortune to your Linux terminal.md (98%) diff --git a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md b/published/20181203 How to bring good fortune to your Linux terminal.md similarity index 98% rename from translated/tech/20181203 How to bring good fortune to your Linux terminal.md rename to published/20181203 How to bring good fortune to your Linux terminal.md index 97def132e7..816ead368e 100644 --- a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md +++ b/published/20181203 How to bring good fortune to your Linux terminal.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (How to bring good fortune to your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10486-1.html) 如何为你的 Linux 终端带来好运 ====== From 590a7c58a515abac030ff061af7486cd0ed3d7d6 Mon Sep 17 00:00:00 2001 From: suncle Date: Mon, 28 Jan 2019 23:32:54 +0800 Subject: [PATCH 0830/4278] translating by Flowsnow --- ...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 a16e604774..03a6fa6494 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: ( ) +[#]: translator: (Flowsnow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (An introduction to the Pyramid web framework for Python) From f957ca204b39a0aeb249201086fbec0da44374e4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 23:34:52 +0800 Subject: [PATCH 0831/4278] PRF:20150717 The History of Hello World.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免转义 --- published/20150717 The History of Hello World.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20150717 The History of Hello World.md b/published/20150717 The History of Hello World.md index de2b3bb551..5d2af398dd 100644 --- a/published/20150717 The History of Hello World.md +++ b/published/20150717 The History of Hello World.md @@ -50,7 +50,7 @@ class HelloWorld { } ``` -#### C# +#### C# ``` using System; From 8d5472c48f5cc4b8b5cd0638795ae41ccb5fb6d0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 00:32:37 +0800 Subject: [PATCH 0832/4278] PRF:20180809 Perform robust unit tests with PyHamcrest.md @MjSeven --- ...rform robust unit tests with PyHamcrest.md | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md b/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md index 5d44d86bce..4911aec938 100644 --- a/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md +++ b/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md @@ -1,28 +1,26 @@ -Perform robust unit tests with PyHamcrest 使用 PyHamcrest 执行健壮的单元测试 ====== +> 使用此框架编写断言,提高开发测试的准确性。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) 在[测试金字塔][1]的底部是单元测试。单元测试每次只测试一个代码单元,通常是一个函数或方法。 -通常,设计单个单元测试是为了测试通过函数或特定分支选择的特定流,这使得失败的单元测试和导致失败的 bug 之间的映射变得容易。 +通常,设计单个单元测试是为了测试通过一个函数或特定分支的特定执行流程,这使得将失败的单元测试和导致失败的 bug 对应起来变得容易。 -理想情况下,单元测试使用很少或不使用外部资源,从而隔离它们并使它们更快。 +理想情况下,单元测试很少使用或不使用外部资源,从而隔离它们并使它们更快。 -_好_ 测试通过尽早发现 bug 并加快测试速度来提高开发人员的工作效率。_坏_ 测试降低了开发人员的工作效率。 +单元测试套件通过在开发过程的早期发现问题来帮助维护高质量的产品。有效的单元测试可以在代码离开开发人员机器之前捕获 bug,或者至少可以在特定分支上的持续集成环境中捕获 bug。这标志着好的和坏的单元测试之间的区别:*好的*测试通过尽早捕获 bug 并使测试更快来提高开发人员的生产力。*坏的*测试降低了开发人员的工作效率。 -单元测试套件通过在开发过程的早期发现问题来帮助维护高质量的产品。有效的单元测试在代码离开开发人员机器之前捕获 bug,或者至少在特定分支上的持续集成环境中捕获 bug。这标志着好的和坏的单元测试之间的区别:好的测试通过尽早捕获 bug 并使测试更快来提高开发人员的生产力。坏的测试降低了开发人员的工作效率。 - -当测试 _附带的特性_ 时,生产率通常会降低。当代码更改时测试失败,即时它仍然是正确的。发生这种情况是因为输出不同,但在某种程度上它不是函数契约的一部分。 +当测试*附带的特性*时,生产率通常会降低。当代码更改时测试会失败,即使它仍然是正确的。发生这种情况是因为输出的不同,但在某种程度上是因为它不是函数契约function's contract的一部分。 因此,一个好的单元测试可以帮助执行函数所提交的契约。 -如果单元测试中断,那意味着契约被违反了,应该明确修改(通过更改文档和测试),或者被修复(通过修复代码并保持测试不变)。 +如果单元测试中断,那意味着该契约被违反了,应该(通过更改文档和测试)明确修改,或者(通过修复代码并保持测试不变)来修复。 虽然将测试限制为只执行公共契约是一项需要学习的复杂技能,但有一些工具可以提供帮助。 -其中一个工具是 [Hamcrest][2],一个用于编写断言的框架。最初是为基于 Java 的单元测试而发明的,它现在支持多种语言,包括 [Python][3]。 +其中一个工具是 [Hamcrest][2],这是一个用于编写断言的框架。最初是为基于 Java 的单元测试而发明的,但它现在支持多种语言,包括 [Python][3]。 Hamcrest 旨在使测试断言更容易编写和更精确。 @@ -36,7 +34,8 @@ def test_add():     assert_that(add(2, 2), equal_to(4))   ``` -这是一个用于简单功能的断言。如果我们想要断言更复杂的怎么办? +这是一个用于简单函数的断言。如果我们想要断言更复杂的函数怎么办? + ``` def test_set_removal():     my_set = {1, 2, 3, 4} @@ -45,13 +44,14 @@ def test_set_removal():     assert_that(my_set, is_not(has_item(3))) ``` -注意,我们可以简单地断言结果的顺序为 `1`, `2` 和 `4`,因为集合不保证顺序。 +注意,我们可以简单地断言其结果是任何顺序的 `1`、`2` 和 `4`,因为集合不保证顺序。 -我们也可以很容易用 `is_not` 来否定断言。这有助于我们编写 _精确的断言_,使我们能够把自己限制在执行职能的公共契约方面。 +我们也可以很容易用 `is_not` 来否定断言。这有助于我们编写*精确的断言*,使我们能够把自己限制在执行函数的公共契约方面。 -然而,有时候,内置功能都不是我们 _真正_ 需要的。在这些情况下,Hamcrest 允许我们编写自己的匹配器。 +然而,有时候,内置的功能都不是我们*真正*需要的。在这些情况下,Hamcrest 允许我们编写自己的匹配器matchers。 想象一下以下功能: + ``` def scale_one(a, b):     scale = random.randint(0, 5) @@ -59,9 +59,10 @@ def scale_one(a, b):     return scale * pick ``` -我们可以自信地断言结果均匀地划分为至少一个输入。(to 校正:???什么意思) +我们可以自信地断言其结果均匀地分配到至少一个输入。 匹配器继承自 `hamcrest.core.base_matcher.BaseMatcher`,重写两个方法: + ``` class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher):     def __init__(self, factor): @@ -76,12 +77,14 @@ class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher): ``` 编写高质量的 `describe_to` 方法很重要,因为这是测试失败时显示的消息的一部分。 + ``` def divisible_by(num):     return DivisibleBy(num) ``` 按照惯例,我们将匹配器包装在一个函数中。有时这给了我们进一步处理输入的机会,但在这种情况下,我们不需要进一步处理。 + ``` def test_scale():     result = scale_one(3, 7) @@ -92,7 +95,8 @@ def test_scale(): 请注意,我们将 `divisible_by` 匹配器与内置的 `any_of` 匹配器结合起来,以确保我们只测试函数提交的内容。 -在编辑这篇文章时,我听到一个传言,“Hamcrest” 这个名字被认为是 “matches” 的字谜。人力资源管理... +在编辑这篇文章时,我听到一个传言,取 “Hamcrest” 这个名字是因为它是 “matches” 字母组成的字谜。嗯... + ``` >>> assert_that("matches", contains_inanyorder(*"hamcrest") Traceback (most recent call last): @@ -106,13 +110,14 @@ Expected: a sequence over ['h', 'a', 'm', 'c', 'r', 'e', 's', 't'] in any order       but: no item matches: 'r' in ['m', 'a', 't', 'c', 'h', 'e', 's'] ``` -经过进一步的研究,我找到了谣言的来源:它是 “matchers” 的字谜。 +经过进一步的研究,我找到了传言的来源:它是 “matchers” 字母组成的字谜。 + ``` >>> assert_that("matchers", contains_inanyorder(*"hamcrest")) >>> ``` -如果你还没有为你的 Python 代码编写单元测试,那么现在是开始的好时机。如果你正在为你的 Python 代码编写单元测试,那么使用 Hamcrest 将允许你使你的断言更加 _精确_,既不会比你想要测试的多也不会少。这将在修改代码时减少误报,并减少修改工作代码的测试所花费的时间。 +如果你还没有为你的 Python 代码编写单元测试,那么现在是开始的好时机。如果你正在为你的 Python 代码编写单元测试,那么使用 Hamcrest 将允许你使你的断言更加*精确*,既不会比你想要测试的多也不会少。这将在修改代码时减少误报,并减少修改工作代码的测试所花费的时间。 -------------------------------------------------------------------------------- @@ -121,8 +126,8 @@ via: https://opensource.com/article/18/8/robust-unit-tests-hamcrest 作者:[Moshe Zadka][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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 927408d535bf785513e99b52397570f050b4afb0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 00:32:56 +0800 Subject: [PATCH 0833/4278] PUB:20180809 Perform robust unit tests with PyHamcrest.md @MjSeven https://linux.cn/article-10487-1.html --- .../20180809 Perform robust unit tests with PyHamcrest.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180809 Perform robust unit tests with PyHamcrest.md (100%) diff --git a/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md b/published/20180809 Perform robust unit tests with PyHamcrest.md similarity index 100% rename from translated/tech/20180809 Perform robust unit tests with PyHamcrest.md rename to published/20180809 Perform robust unit tests with PyHamcrest.md From 0852a7f9c9a687f6407ee5337cb2164c247174f7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 Jan 2019 08:51:45 +0800 Subject: [PATCH 0834/4278] translated --- ... How to open source your Python library.md | 114 ----------------- ... How to open source your Python library.md | 115 ++++++++++++++++++ 2 files changed, 115 insertions(+), 114 deletions(-) delete mode 100644 sources/tech/20181219 How to open source your Python library.md create mode 100644 translated/tech/20181219 How to open source your Python library.md diff --git a/sources/tech/20181219 How to open source your Python library.md b/sources/tech/20181219 How to open source your Python library.md deleted file mode 100644 index 79c25c9a00..0000000000 --- a/sources/tech/20181219 How to open source your Python library.md +++ /dev/null @@ -1,114 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to open source your Python library) -[#]: via: (https://opensource.com/article/18/12/tips-open-sourcing-python-libraries) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -How to open source your Python library -====== -This 12-step checklist will ensure a successful launch. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) - -You wrote a Python library. I'm sure it's amazing! Wouldn't it be neat if it was easy for people to use it? Here is a checklist of things to think about and concrete steps to take when open sourcing your Python library. - -### 1\. Source - -Put the code up on [GitHub][1], where most open source projects happen and where it is easiest for people to submit pull requests. - -### 2\. License - -Choose an open source license. A good, permissive default is the [MIT License][2]. If you have specific requirements, Creative Common's [Choose a License][3] can guide you through the alternatives. Most importantly, there are three rules to keep in mind when choosing a license: - - * Don't create your own license. - * Don't create your own license. - * Don't create your own license. - - - -### 3\. README - -Put a file called README.rst, formatted with ReStructured Text, at the top of your tree. - -GitHub will render ReStructured Text just as well as Markdown, and ReST plays better with Python's documentation ecosystem. - -### 4\. Tests - -Write tests. This is not useful just for you: it is useful for people who want to make patches that avoid breaking related functionality. - -Tests help collaborators collaborate. - -Usually, it is best if they are runnable with [**pytest**][4]. There are other test runners—but very little reason to use them. - -### 5\. Style - -Enforce style with a linter: PyLint, Flake8, or Black with **\--check**. Unless you use Black, make sure to specify configuration options in a file checked into source control. - -### 6\. API documentation - -Use docstrings to document modules, functions, classes, and methods. - -There are a few styles you can use. I prefer the [Google-style docstrings][5], but [ReST docstrings][6] are an option. - -Both Google-style and ReST docstrings can be processed by Sphinx to integrate API documentation with prose documentation. - -### 7\. Prose documentation - -Use [Sphinx][7]. (Read [our article on it][8].) A tutorial is useful, but it is also important to specify what this thing is, what it is good for, what it is bad for, and any special considerations. - -### 8\. Building - -Use **tox** or **nox** to automatically run your tests and linter and build the documentation. These tools support a "dependency matrix." These matrices tend to explode fast, but try to test against a reasonable sample, such as Python versions, versions of dependencies, and possibly optional dependencies you install. - -### 9\. Packaging - -Use [setuptools][9]. Write a **setup.py** and a **setup.cfg**. If you support both Python 2 and 3, specify universal wheels in the **setup.cfg**. - -One thing **tox** or **nox** should do is build a wheel and run tests against the installed wheel. - -Avoid C extensions. If you absolutely need them for performance or binding reasons, put them in a separate package. Properly packaging C extensions deserves its own post. There are a lot of gotchas! - -### 10\. Continuous integration - -### 11\. Versions - -Use a public continuous integration runner. [TravisCI][10] and [CircleCI][11] offer free tiers for open source projects. Configure GitHub or other repo to require passing checks before merging pull requests, and you'll never have to worry about telling people to fix their tests or their style in code reviews. - -Use either [SemVer][12] or [CalVer][13]. There are many tools to help manage versions: [incremental][14], [bumpversion][15], and [setuptools_scm][16] are all packages on PyPI that help manage versions for you. - -### 12\. Release - -Release by running **tox** or **nox** and using **twine** to upload the artifacts to PyPI. You can do a "test upload" by running [DevPI][17]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/tips-open-sourcing-python-libraries - -作者:[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://github.com/ -[2]: https://en.wikipedia.org/wiki/MIT_License -[3]: https://choosealicense.com/ -[4]: https://docs.pytest.org/en/latest/ -[5]: https://github.com/google/styleguide/blob/gh-pages/pyguide.md -[6]: https://www.python.org/dev/peps/pep-0287/ -[7]: http://www.sphinx-doc.org/en/master/ -[8]: https://opensource.com/article/18/11/building-custom-workflows-sphinx -[9]: https://pypi.org/project/setuptools/ -[10]: https://travis-ci.org/ -[11]: https://circleci.com/ -[12]: https://semver.org/ -[13]: https://calver.org/ -[14]: https://pypi.org/project/incremental/ -[15]: https://pypi.org/project/bumpversion/ -[16]: https://pypi.org/project/setuptools_scm/ -[17]: https://opensource.com/article/18/7/setting-devpi diff --git a/translated/tech/20181219 How to open source your Python library.md b/translated/tech/20181219 How to open source your Python library.md new file mode 100644 index 0000000000..7c4a2d3f25 --- /dev/null +++ b/translated/tech/20181219 How to open source your Python library.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to open source your Python library) +[#]: via: (https://opensource.com/article/18/12/tips-open-sourcing-python-libraries) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +如何开源你的 Python 库 +====== +这 12 个步骤能确保成功发布。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) + +你写了一个 Python 库。我觉着这太棒了!如果让人们能够轻松使用它不是很优雅么?这有一个需要考虑的清单,以及在开源 Python 库时要采取的具体步骤。 + +### 1\. 源码 + +将代码放在 [GitHub][1] 上,这里有很多开源项目,并且人们很容易提交拉取请求。 + +### 2\. 许可证 + +选择一个开源许可证。默认的一个不错的,宽容的是 [MIT 许可][2]。如果你有特定要求,Creative Common 的[选择许可][3]可以指导你完成其他选择。最重要的是,在选择许可时要记住三条规则: + + + * 不要创建自己的许可证。 + * 不要创建自己的许可证。 + * 不要创建自己的许可证。 + + + +### 3\. README + +将一个名为 README.rst 的文件(使用 ReStructured Text 格式化)放在项目树的顶层。 + +GitHub 将像 Markdown 一样渲染 ReStructured Text,而 ReST 在 Python 的文档生态系统中的表现更好。 + +### 4\. 测试 + +写测试。这对你来说没有用处。但对于想要编写避免破坏相关功能的补丁的人来说,它非常有用。 + +测试可帮助协作者进行协作。 + +通常情况下,如果可以用 [**pytest**][4] 运行就最好了。还有其他测试工具 - 但很少有理由去使用它们。 + +### 5\. 样式 + +使用 linter 制定样式:PyLint、Flake8 或者带上 **\--check** 的 Black 。除非你使用Black,否则请确保在下载源代码文件中指定配置选项。 + +### 6\. API 文档 + +使用 docstrings 来记录模块、函数、类和方法。 + +你可以使用几种样式。我更喜欢 [Google 风格的 docstrings][5],但 [ReST docstrings][6] 也是一种选择。 + +Sphinx 可以同时处理 Google 风格和 ReST 的 docstrings,以将零散的文档集成为 API 文档。 + +### 7\. 零散文档 + +使用 [Sphinx][7]。(阅读[我们这篇文章][8]。)教程很有用,但同样重要的是要指明这是什么、它有什么好处、它有什么坏处、以及任何特殊的考虑因素。 + +### 8\. 构建 + +使用 **tox** 或 **nox** 自动运行测试、linter 并构建文档。这些工具支持“依赖矩阵”。这些矩阵往往会快速增长,但你可以尝试针对合理的样本进行测试,例如 Python 版本、依赖项版本以及可能安装的可选依赖项。 + +### 9\. 打包 + +使用 [setuptools][9] 工具。写一个 **setup.py** 和一个 **setup.cfg**。如果同时支持 Python 2 和 3,请在 **setup.cfg** 中指定 universal wheel。 + +**tox** 或 **nox** 应该做的一件事是构建 wheel 并对已安装的 wheel 进行测试。 + +避免使用 C 扩展。如果出于性能或绑定的原因一定需要它们,请将它们放在单独的包中。正确打包 C 扩展可以写一篇新的文章。这里有很多问题! + +### 10\. 持续集成 + +使用公共持续工具。[TravisCI][10] and [CircleCI][11] 为开源项目提供免费套餐。将 GitHub 或其他仓库配置为在合并拉请求之前需要先通过检查, 那么你就不必担心在代码评审中告知用户修复测试或样式。 + +### 11\. 版本 + +使用 [SemVer][12] 或 [CalVer][13]。有许多工具可以帮助你管理版本:[incremental][14]、[bumpversion][15] 和 [setuptools_scm][16] 等都是 PyPI 上的包,都可以帮助你管理版本。 + +### 12\. 发布 + +通过运行 **tox** 或 **nox** 并使用 **twine** 将文件上传到 PyPI 上发布。你可以通过在 [DevPI][17] 中“测试上传”。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/tips-open-sourcing-python-libraries + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://github.com/ +[2]: https://en.wikipedia.org/wiki/MIT_License +[3]: https://choosealicense.com/ +[4]: https://docs.pytest.org/en/latest/ +[5]: https://github.com/google/styleguide/blob/gh-pages/pyguide.md +[6]: https://www.python.org/dev/peps/pep-0287/ +[7]: http://www.sphinx-doc.org/en/master/ +[8]: https://opensource.com/article/18/11/building-custom-workflows-sphinx +[9]: https://pypi.org/project/setuptools/ +[10]: https://travis-ci.org/ +[11]: https://circleci.com/ +[12]: https://semver.org/ +[13]: https://calver.org/ +[14]: https://pypi.org/project/incremental/ +[15]: https://pypi.org/project/bumpversion/ +[16]: https://pypi.org/project/setuptools_scm/ +[17]: https://opensource.com/article/18/7/setting-devpi From 6fd0b0a89749722fdd6824206c69af66642e71a0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 Jan 2019 08:54:48 +0800 Subject: [PATCH 0835/4278] translating --- ... Get started with Tint2, an open source taskbar for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md index 601b90370c..e8afdbb417 100644 --- a/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md +++ b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 378f6364157fbbfcb921364d36a7af66ae3d3132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=AE=A6=E6=88=90?= Date: Tue, 29 Jan 2019 08:57:11 +0800 Subject: [PATCH 0836/4278] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=20PyGame=20Zero-=20Games=20without=20boilerplate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190125 PyGame Zero- Games without boilerplate.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190125 PyGame Zero- Games without boilerplate.md b/sources/tech/20190125 PyGame Zero- Games without boilerplate.md index bdc100973a..f60c2b3407 100644 --- a/sources/tech/20190125 PyGame Zero- Games without boilerplate.md +++ b/sources/tech/20190125 PyGame Zero- Games without boilerplate.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (xiqingongzi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -88,7 +88,7 @@ via: https://opensource.com/article/19/1/pygame-zero 作者:[Moshe Zadka][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[xiqingongzi](https://github.com/xiqingongzi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b0eda2970907881f3b03188ae7fed413eaac748a Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Tue, 29 Jan 2019 12:14:31 +0800 Subject: [PATCH 0837/4278] translating --- ...ommands to help you monitor activity on your Linux server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md index 43f1c480ad..c2a95d7ec2 100644 --- a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md +++ b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f283796c03c073e841b320e0848a0118a2e8ab5f Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 29 Jan 2019 13:30:28 +0800 Subject: [PATCH 0838/4278] Translating An Introduction to Go. --- translated/tech/20181224 An Introduction to Go.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 3e595e4cea..0e4b77aadc 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -231,17 +231,17 @@ func Function() (err error) { ### 数组和切片 -As mentioned before, an array is a value type and a slice is a pointer into an array, created either by slicing an existing array or by using `make()` to create a slice, which will create an anonymous array to hold the elements. +正如前边说的,数组是值类型而切片是指向数组的指针。切片可以由现有的数组切片产生,也可以使用 `make()` 创建切片,这会创建一个匿名数组以保存元素。 ``` -slice1 := make([]int, 2, 5) // 5 elements allocated, 2 initialized to 0 -slice2 := array[:] // sliced entire array -slice3 := array[1:] // slice of array without first element +slice1 := make([]int, 2, 5) // 分配 5 个元素,其中 2 个初始化为0 +slice2 := array[:] // 整个数组的切片 +slice3 := array[1:] // 除了首元素的切片 ``` There are some more possible combinations for the slicing operator than mentioned above, but this should give a good first impression. -A slice can be used as a dynamically growing array, using the `append()` function. +使用 `append()` 函数,切片可以作为一个变长数组使用。 ``` slice = append(slice, value1, value2) @@ -252,11 +252,11 @@ Slices are also used internally to represent variable parameters in variable len ### Maps -Maps are simple key-value stores and support indexing and assigning. They are not thread-safe. +Maps 是简单的键值对储存容器并支持索引和分配。但它们不是线程安全的。 ``` someValue := someMap[someKey] -someValue, ok := someMap[someKey] // ok is false if key not in someMap +someValue, ok := someMap[someKey] // 如果键值不在 someMap 中,变量 ok 会赋值为 `false` someMap[someKey] = someValue ``` -------------------------------------------------------------------------------- From ce9dc3303ac2cc4b41c41edc5ae2d5b3521393d2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 20:18:35 +0800 Subject: [PATCH 0839/4278] PRF:20181214 The Linux terminal is no one-trick pony.md @geekpi --- ...14 The Linux terminal is no one-trick pony.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181214 The Linux terminal is no one-trick pony.md b/translated/tech/20181214 The Linux terminal is no one-trick pony.md index c33a8b0e85..b27a7d59e6 100644 --- a/translated/tech/20181214 The Linux terminal is no one-trick pony.md +++ b/translated/tech/20181214 The Linux terminal is no one-trick pony.md @@ -1,15 +1,17 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The Linux terminal is no one-trick pony) [#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) [#]: 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-ponysay.png?itok=ehl6pTr_) 欢迎再次来到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们正在思考中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 @@ -22,11 +24,11 @@ Linux 终端能做其他事 我对此感到好奇,并去看了一下,发现没有让我失望。 -简而言之,**[ponysay][3]** 的 **cowsay**的重写,它包括了来自[小马宝莉][4]中的许多全彩色人物,你可以用它在 Linux 命令行输出短句。它实际上是一个非常完善的项目,拥有超过 400 个字符和字符组合,它还有让人难以置信的的[ 78 页的 PDF 文档][5]涵盖了了所有的用法。 +简而言之,[ponysay][3] 的 cowsay 的重写,它包括了来自[小马宝莉][4]中的许多全彩色人物,你可以用它在 Linux 命令行输出短句。它实际上是一个非常完善的项目,拥有超过 400 个字符和字符组合,它还有让人难以置信的的 [78 页的 PDF 文档][5]涵盖了所有的用法。 -要安装 **ponysay**,你需要查看项目的 [README][6] 来选择最适合你的发行版和情况的安装方法。由于 ponysay 似乎没有为我的 Fedora 发行版打包,我选择试用 Docker 容器镜像,但你可以选择最适合你的方法。从源码安装可能也适合你。 +要安装 `ponysay`,你需要查看项目的 [README][6] 来选择最适合你的发行版和情况的安装方法。由于 `ponysay` 似乎没有为我的 Fedora 发行版打包,我选择试用 Docker 容器镜像,但你可以选择最适合你的方法。从源码安装可能也适合你。 -作为一个业余容器用户,我很想试试 [**podman**][7] 来代替 **docker**。至少对于我而言,它可以正常工作。 +作为一个业余容器用户,我很想试试 [podman][7] 来代替 docker。至少对于我而言,它可以正常工作。 ``` $ podman run -ti --rm mpepping/ponysay 'Ponytastic' @@ -49,7 +51,7 @@ via: https://opensource.com/article/18/12/linux-toy-ponysay 作者:[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 3fe41b1cb7b10b41788e12782aecbee7c0757218 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 20:19:15 +0800 Subject: [PATCH 0840/4278] PUB:20181214 The Linux terminal is no one-trick pony.md @geekpi https://linux.cn/article-10488-1.html --- .../20181214 The Linux terminal is no one-trick pony.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181214 The Linux terminal is no one-trick pony.md (98%) diff --git a/translated/tech/20181214 The Linux terminal is no one-trick pony.md b/published/20181214 The Linux terminal is no one-trick pony.md similarity index 98% rename from translated/tech/20181214 The Linux terminal is no one-trick pony.md rename to published/20181214 The Linux terminal is no one-trick pony.md index b27a7d59e6..f7c76392f9 100644 --- a/translated/tech/20181214 The Linux terminal is no one-trick pony.md +++ b/published/20181214 The Linux terminal is no one-trick pony.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10488-1.html) [#]: subject: (The Linux terminal is no one-trick pony) [#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 26688ce9ba8ef73650403d8e1b24140119e0f60b Mon Sep 17 00:00:00 2001 From: MjSeven Date: Tue, 29 Jan 2019 21:03:44 +0800 Subject: [PATCH 0841/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=2020190123=20Getting=20started=20with=20Isotope..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Isotope, an open source webmail client.md | 60 ------------------ ... Isotope, an open source webmail client.md | 62 +++++++++++++++++++ 2 files changed, 62 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20190123 Getting started with Isotope, an open source webmail client.md create mode 100644 translated/tech/20190123 Getting started with Isotope, an open source webmail client.md diff --git a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md deleted file mode 100644 index 71307d1550..0000000000 --- a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Isotope, an open source webmail client) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Getting started with Isotope, an open source webmail client -====== -Read rich-text emails with Isotope, a lightweight email client and the 11th 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/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH) - -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 11th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Isotope - -As we discussed in the [fourth article in this series][1] (about Cypht), we all spend a whole lot of time dealing with email. There are many options for dealing with it, and I've spent hours upon hours trying to find the best email client that works for me. I think that is an important distinction: What works for me doesn't always work for everyone else. And sometimes what works for me is a full client like [Thunderbird][2], sometimes it is a console client like [Mutt][3], and sometimes it's a web-based interface like [Gmail][4] or [RoundCube][5]. - -![](https://opensource.com/sites/default/files/uploads/isotope_1.png) - -[Isotope][6] is a locally hosted, web-based email client. It is exceptionally lightweight, uses IMAP exclusively, and takes up very little disk space. Unlike Cypht, Isotope has full HTML mail support, which means there are no issues displaying rich-text only emails. - -![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png) - -Installing Isotope is very easy if you have [Docker][7] installed. You only need to copy the commands from the documentation into a console and press Enter. Point a browser at **localhost** to get the Isotope login screen, and entering your IMAP server, login name, and password will open the inbox view. - -![](https://opensource.com/sites/default/files/uploads/isotope_3.png) - -At this point, Isotope functions pretty much as you'd expect. Click a message to view it, click the pencil icon to create a new message, etc. You will note that the user interface (UI) is very minimalistic and doesn't have the typical buttons for things like "move to folder," "copy to folder," and "archive." You move messages around with drag and drop, so you don't really miss the buttons anyway. - -![](https://opensource.com/sites/default/files/uploads/isotope_4.png) - -Overall, Isotope is clean, fast, and works exceptionally well. Even better, it is under active development (the most recent commit was two hours before I wrote this article), so it is constantly getting improvements. You can check out the code and contribute to it on [GitHub][8]. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-isotope - -作者:[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-cypht-email -[2]: https://www.thunderbird.net/ -[3]: http://www.mutt.org/ -[4]: https://mail.google.com/ -[5]: https://roundcube.net/ -[6]: https://blog.marcnuri.com/isotope-mail-client-introduction/ -[7]: https://www.docker.com/ -[8]: https://github.com/manusa/isotope-mail diff --git a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md b/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md new file mode 100644 index 0000000000..0598fc8963 --- /dev/null +++ b/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Isotope, an open source webmail client) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + + +Isotope 入门:一个开源的 Web 邮件客户端 +====== +使用 Isotope(一个轻量级的电子邮件客户端)阅读富文本电子邮件,它是我们在开源工具系列的第 11 个,将使你在 2019 年更高效。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH) + +在每年的年初,似乎都有一股疯狂的寻找提高工作效率方法的冲动。新年决心,渴望以正确的方式开始新的一年。当然,“旧不去的,新的不来”的态度都会导致这种情况。一般的建议都偏向于私有和专业软件,然而并不是必须这样。 + +以下是我挑选的 19 个新的(或者对你来说是新的)开源工具中的第 11 个,它将帮助你在 2019 年提高工作效率。 + +### Isotope + +正如我们在[本系列的第四篇文章][1](关于 Cypht)中所讨论的那样,我们花了很多时间来处理电子邮件。有很多方法可以解决它,我已经花了很多时间来寻找最适合我的电子邮件客户端。我认为这是一个重要的区别:对我有效的方法并不总是对其它人有效。有时对我有用的是像 [Thunderbird][2] 这样的完整客户端,有时是像 [Mutt][3] 这样的控制台客户端,有时是像 [Gmail][4] 和 [RoundCube][5] 这样基于 Web 的界面。 + +![](https://opensource.com/sites/default/files/uploads/isotope_1.png) + +[Isotope][6] 是一个本地托管的,基于 Web 的电子邮件客户端。它非常轻巧,只使用 IMAP 协议,占用的磁盘空间非常小。与 Cypht 不同,Isotope 具有完整的 HTML 邮件支持,这意味着显示富文本电子邮件没有问题。 + +![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png) + +如果你安装了 [Docker][7],那么安装 Isotope 非常容易。你只需将文档中的命令复制到控制台中,然后按下 Enter 键。在浏览器中输入 **localhost** 来获取 Isotope 登录界面,输入你的 IMAP 服务器,登录名和密码将打开收件箱视图。 + +![](https://opensource.com/sites/default/files/uploads/isotope_3.png) + +在这一点上,Isotope 的功能和你想象的差不多。单击消息进行查看,单击铅笔图标以创建新邮件等。你会注意到用户界面(UI)非常简单,没有“移动到文件夹”,“复制到文件夹”和“存档”等常规按钮。你可以通过拖动来移动消息,因此无论如何你都不会错过这些按钮。 + +![](https://opensource.com/sites/default/files/uploads/isotope_4.png) + +总的来说,Isotope 干净,速度快,工作得非常好。更棒的是,它正在积极开发中(最近一次的提交是在我撰写本文的两小时之前),所以它正在不断得到改进。你可以查看代码并在 [GitHub][8] 上为它做出贡献。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-isotope + +作者:[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-cypht-email +[2]: https://www.thunderbird.net/ +[3]: http://www.mutt.org/ +[4]: https://mail.google.com/ +[5]: https://roundcube.net/ +[6]: https://blog.marcnuri.com/isotope-mail-client-introduction/ +[7]: https://www.docker.com/ +[8]: https://github.com/manusa/isotope-mail From eff9a28f2a3abfcb269facef3f7c68ece61dd75e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 21:53:17 +0800 Subject: [PATCH 0842/4278] PRF:20190118 Top 5 Linux Server Distributions.md @wxy --- .../tech/20190118 Top 5 Linux Server Distributions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20190118 Top 5 Linux Server Distributions.md b/translated/tech/20190118 Top 5 Linux Server Distributions.md index b263bb3b89..89f86ab016 100644 --- a/translated/tech/20190118 Top 5 Linux Server Distributions.md +++ b/translated/tech/20190118 Top 5 Linux Server Distributions.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Top 5 Linux Server Distributions) [#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -另一种 5 个顶级 Linux 服务器发行版 +5 个用于 SOHO 的 Linux 服务器发行版 ====== > Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。 @@ -166,7 +166,7 @@ via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions 作者:[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 6d3de7543e00804d3cab3c92ca7e4fc44640e3ba Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 21:54:24 +0800 Subject: [PATCH 0843/4278] PUB:20190118 Top 5 Linux Server Distributions.md @wxy https://linux.cn/article-10490-1.html --- .../20190118 Top 5 Linux Server Distributions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190118 Top 5 Linux Server Distributions.md (99%) diff --git a/translated/tech/20190118 Top 5 Linux Server Distributions.md b/published/20190118 Top 5 Linux Server Distributions.md similarity index 99% rename from translated/tech/20190118 Top 5 Linux Server Distributions.md rename to published/20190118 Top 5 Linux Server Distributions.md index 89f86ab016..e1515510a3 100644 --- a/translated/tech/20190118 Top 5 Linux Server Distributions.md +++ b/published/20190118 Top 5 Linux Server Distributions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10490-1.html) [#]: subject: (Top 5 Linux Server Distributions) [#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) From ba2842017d51ed3b2c52946f55bce7e9709214be Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Tue, 29 Jan 2019 22:54:16 +0800 Subject: [PATCH 0844/4278] Update 20171222 10 keys to quick game development.md --- ...71222 10 keys to quick game development.md | 69 +++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/sources/talk/20171222 10 keys to quick game development.md b/sources/talk/20171222 10 keys to quick game development.md index 50c8164ae0..5897adaae8 100644 --- a/sources/talk/20171222 10 keys to quick game development.md +++ b/sources/talk/20171222 10 keys to quick game development.md @@ -1,78 +1,77 @@ -XYenChi is translating -10 keys to quick game development +快速开发游戏的十个关键 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) -In early October, the inaugural [Open Jam][1] sponsored by Opensource.com drew 45 entries from teams located around the world. The teams had just three days to create a game using open source software to enter into the competition, and [three teams came out on top][2]. +十月早些时候,Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐,并 [取前三][2]。 -We hosted our own Open Jam event at our university for anyone who wanted to participate. We reserved a computer lab for the weekend and taught people how to use open source software--[Godot][3] for the game engine, [LMMS][4] for music creation, [GIMP][5] for 2D art, and [Blender][6] for 3D art--to create games and game art assets. Three games were submitted from our event: [Loathsome][7], [Lost Artist][8], and [Paint Rider][9] (which I created). +我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] ,2D画面: [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7], [Lost Artist][8], 和 [Paint Rider][9] (我做的)。 -From my experience with game jams and game development in general, here are 10 lessons I've learned about game engines, coding, and rapid game development. +总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。 -## 1\. Narrow your scope +## 1\. 限定规模 -It's easy to get carried away with ideas to make an expansive adventure game or something that compares to your favorite game. Pursuing that outside of a game jam can be awesome, once you have some experience, but don't overestimate what you have time for. What I love about game jams is they force you to focus on getting a game from the conceptual stage to a final product quickly, since you have such a limited amount of time. This is why narrowing your scope is so important. +很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。 -The theme for Open Jam was "Leave a Mark." As soon as it was announced, my friends and I started brainstorming games that could fit that theme. One idea was a 3D boxing game where the player left bruises on their enemy. I had very little experience making 3D games and, while I would have loved to get better at them, I probably would have spent too much time learning how to get all the textures situated and hit boxes working before I could even start to figure out what would make a fun game. +Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 -## 2\. Have something playable very early +## 2\. 尽早可玩 -This is my favorite advice for game jams. Try to come up with the core mechanics and code them to a working state quickly so you can test them and decide whether it's worthy of making a full game. You shouldn't be hours away from the deadline and still trying to get your game playable. For a three-day jam like Open Jam, it shouldn't take more than a few hours to have some sort of demo running. +对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。 -## 3\. Keep it simple +## 3\. 保持简单 -Every feature that you want to include extends your total development time. You never know if committing to a feature will lead to a major time sink because you just can't quite get it to work. Arcade-style high-score games typically work well for game jams because they're usually simple by nature. Once you've finished the core, you can start adding features and polish without having to worry whether you'll have a functioning game in the end. +你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。 -## 4\. Take inspiration from other games +## 4\. 从其他游戏获取灵感 -You may be tempted to create something totally original, but having models to base your work on is extremely helpful. It will decrease the time it takes to come up with the mechanics, since you'll already have an idea of what is fun. Remind yourself that the more experience you have under your belt, the easier it is to create that massive game you have so many ideas for, so you might as well practice by trying to recreate things other people have done. +可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。 -Considering Open Jam's "Leave a Mark" theme, I thought it would be fun to create a game where you leave a trail of paint as you played, so you could see the mark you left. I remembered the old Flash game [Line Rider 2 Beta][10] (hence the name Paint Rider), and about the secret feature where you could draw a track if you held the Control button down while you played. I simplified that concept even more by requiring only one button for vertical movement (much like old helicopter games). About an hour or two into the jam, I had a basic demo where you could move up or down with one button and leave a trail of little black circles. +考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。 -## 5\. Don't overlook accessibility +## 5\. 不要忽视可得性 -Make sure as many people as possible can play your game. One of the games submitted to Open Jam was a virtual-reality game. As cool as that was, hardly anyone was able to play it, because not many people have a VR device. Luckily, its developer didn't expect it would do well in the ratings, and instead considered it practice. But, if you want to share your game with lots of people (or win game jams), it's important to pay attention to accessibility. +确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏创作),注意可得性是很重要的。 -Godot (and most other game engines) allow you to export your game to all major platforms. When submitting a game specifically to [Itch.io][11], having an in-browser version will allow most people to play it. But always look into exporting to as many platforms and operating systems as you can. I even tried exporting Paint Rider to mobile, but technical difficulties got in the way. +Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。 -## 6\. Don't make it too difficult +## 6\. 不要做得太难 -If your game takes too much effort to learn or play, you'll lose a portion of your audience. This aligns nicely with keeping your game simple and within scope, and it puts even more importance on the game planning phase. Again, it's easy to come up with an epic game idea you could spend weeks or months developing; it's harder to come up with a good, simple game. +如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。 -I showed Paint Rider to my Mom and she was able to play it immediately. I don't think I need to say anything more about that. +给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 -## 7\. Don't be too neat +## 7\. 不用太整洁 -If you're used to taking your time applying design patterns everywhere and making sure that your code will be reusable and readable, try to loosen up a bit. If you spend too much time worrying about design, when you finally get to the point when you can play your game, you may find out it's not very fun. By then, it's too late to make changes. +如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 -This process is also used for prototyping more serious games: You quickly code up messy proof-of-concept demos until you find one that's worth making into a full game, then you dive into building a perfect code base to support it. Creating a game for a game jam is like quickly coding up a proof of concept. +这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。 -## 8\. But don't be too messy, either +## 8\. 但也不要太随意 -On the other hand, [spaghetti code][12] can easily get out of control, even if there's not a ton of code in a game. Luckily, most game engines are built with design patterns in mind. Take Godot's [Signals][13] functionality, which allows nodes to send messages with data to nodes they've been "connected" with--it's the [observer pattern][14] automatically baked into your design. As long as you know how to take advantage of the game engine's features, you should be able to code quickly without making your code too painful to look at. +另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。Luckily, most game engines are built with design patterns in mind. 就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。 -## 9\. Get feedback +## 9\. 取得反馈 -Show people what you're working on. Have them try it out and see what they say about it. Watch how they play your game and see if they find something you didn't expect. If the game jam has a [Discord][15] channel or something similar, post your game there, or bounce your ideas off people. One of Paint Rider's defining features is that the canvas loops, so you see the paint you left before. I hadn't even considered that mechanic until someone asked me why the game didn't have it. +向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。 -Working on a team will ensure that there are other people built into the process who can pass feedback around. +团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。 -And don't forget to help other people out in the same way; it's a win-win if you realize something that could help your game while you're playing someone else's game. +而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 -## 10\. Know where to find resources +## 10\. 哪里找资源 -Creating all your own assets can really slow you down. During Open Jam, I noticed that Loathsome's developer was spending multiple hours drawing the main character while I was busy incorporating new features and fixing bugs. You could simplify your art style for the game and still come up with something that looks and sounds good, but there are other options. Try looking for assets in [Creative Commons][16] or on free music sites like [Anttis Instrumentals][17]. Or, if possible, form a team with a dedicated artist, writer, or musician. +做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色 developer was spending multiple hours drawing the main character while I was busy incorporating new features and fixing bugs. 你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。 -Other software you might find useful includes [Krita][18], an open source 2D image creator that's nice for digital painting, especially if you have a drawing tablet, and [sfxr][19], a game sound-effect creator that has a lot of parameters to play with, but as its creator says: "Basic usage involves hitting the randomize button." (All sound effects in Paint Rider were made with Sfxr.) You can also check out [Calinou][20]'s large and neatly organized list of open source game development software. +其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 -Have you participated in Open Jam or another a game jam and have other advice? Or do you have questions I didn't address? If so, please share them in the comments. +你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 -------------------------------------------------------------------------------- via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development 作者:[Ryan Estes][a] -译者:[译者ID](https://github.com/译者ID) +译者:[XYenChi](https://github.com/XYenChi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 324999d2167cff2db5adf1c1d24a8f8334d18057 Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Tue, 29 Jan 2019 23:27:02 +0800 Subject: [PATCH 0845/4278] Create 20171222 10 keys to quick game development.md --- ...71222 10 keys to quick game development.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 translated/talk/20171222 10 keys to quick game development.md diff --git a/translated/talk/20171222 10 keys to quick game development.md b/translated/talk/20171222 10 keys to quick game development.md new file mode 100644 index 0000000000..c41f66bfc7 --- /dev/null +++ b/translated/talk/20171222 10 keys to quick game development.md @@ -0,0 +1,99 @@ +快速开发游戏的十个关键 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) + +十月早些时候,Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐,并 [取前三][2]。 + +我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] ,2D画面: [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7], [Lost Artist][8], 和 [Paint Rider][9] (我做的)。 + +总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。 + +## 1\. 限定规模 + +很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。 + +Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 + +## 2\. 尽早可玩 + +对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。 + +## 3\. 保持简单 + +你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。 + +## 4\. 从其他游戏获取灵感 + +可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。 + +考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。 + +## 5\. 不要忽视可得性 + +确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏创作),注意可得性是很重要的。 + +Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。 + +## 6\. 不要做得太难 + +如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。 + +给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 + +## 7\. 不用太整洁 + +如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 + +这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。 + +## 8\. 但也不要太随意 + +另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。 + +## 9\. 取得反馈 + +向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。 + +团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。 + +而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 + +## 10\. 哪里找资源 + +做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上,你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。 + +其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 + +你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development + +作者:[Ryan Estes][a] +译者:[XYenChi](https://github.com/XYenChi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/figytuna +[1]:https://itch.io/jam/open-jam-1 +[2]:https://opensource.com/article/17/11/open-jam +[3]:https://godotengine.org/ +[4]:https://lmms.io/ +[5]:https://www.gimp.org/ +[6]:https://www.blender.org/ +[7]:https://astropippin.itch.io/loathsome +[8]:https://masonraus.itch.io/lost-artist +[9]:https://figytuna.itch.io/paint-rider +[10]:http://www.andkon.com/arcade/racing/lineriderbeta2/ +[11]:https://itch.io/ +[12]:https://en.wikipedia.org/wiki/Spaghetti_code +[13]:http://kidscancode.org/blog/2017/03/godot_101_07/ +[14]:https://en.wikipedia.org/wiki/Observer_pattern +[15]:https://discordapp.com/ +[16]:https://creativecommons.org/ +[17]:http://www.soundclick.com/bands/default.cfm?bandID=1277008 +[18]:https://krita.org/en/ +[19]:http://www.drpetter.se/project_sfxr.html +[20]:https://notabug.org/Calinou/awesome-gamedev/src/master/README.md From 088c6b86b70ea58aeaf5b34e071e5968f156c2af Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 29 Jan 2019 23:31:44 +0800 Subject: [PATCH 0846/4278] hankchow translated --- ...12 Top 5 configuration management tools.md | 122 ------------------ ...12 Top 5 configuration management tools.md | 120 +++++++++++++++++ 2 files changed, 120 insertions(+), 122 deletions(-) delete mode 100644 sources/tech/20181212 Top 5 configuration management tools.md create mode 100644 translated/tech/20181212 Top 5 configuration management tools.md diff --git a/sources/tech/20181212 Top 5 configuration management tools.md b/sources/tech/20181212 Top 5 configuration management tools.md deleted file mode 100644 index f7e59bcf08..0000000000 --- a/sources/tech/20181212 Top 5 configuration management tools.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 5 configuration management tools) -[#]: via: (https://opensource.com/article/18/12/configuration-management-tools) -[#]: author: (Marco Bravo https://opensource.com/users/marcobravo) - -Top 5 configuration management tools -====== -Learn about configuration management tools and figure out which will work best for your DevOps organization. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) - -DevOps is evolving and gaining traction as organizations discover how it enables them to produce better applications and reduce their software products' time to market. - -[DevOps' core values][1] are Culture, Automation, Measurement, and Sharing (CAMS), and an organization's adherence to them influences how successful it is. - - * **Culture** brings people and processes together; - * **Automation** creates a fabric for DevOps; - * **Measurement** permits improvements; and - * **Sharing** enables the feedback loop in the CAMS cycle. - - - -Another DevOps concept is the idea that almost everything can be managed in code: servers, databases, networks, log files, application configurations, documentation, automated tests, deployment processes, and more. - -In this article, I'll focus on one aspect of automation: Configuration management. As part of [Infrastructure as Code][2] (IaC), configuration management tools enable the use of tested and proven software development practices for managing and provisioning data centers through plaintext definition files. - -By manipulating simple configuration files, a DevOps team can use application development best practices, such as version control, testing, small deployments, and design patterns. In short, this means code can be written to provision and manage an infrastructure as well as automate processes. - -### Why use configuration management tools? - -Configuration management tools enable changes and deployments to be faster, repeatable, scalable, predictable, and able to maintain the desired state, which brings controlled assets into an expected state. - -Some advantages of using configuration management tools include: - - * Adherence to coding conventions that make it easier to navigate code - * Idempotency, which means that the end state remains the same, no matter how many times the code is executed - * Distribution design to improve managing large numbers of remote servers - - - -Some configuration management tools use a pull model, in which an agent installed on the servers runs periodically to pull the latest definitions from a central repository and apply them to the server. Other tools use a push model, where a central server triggers updates to managed servers. - -### Top 5 configuration management tools - -There are a variety of configuration management tools available, and each has specific features that make it better for some situations than others. Yet the top five configuration management tools, presented below in alphabetical order, have several things in common that I believe are essential for DevOps success: all have an open source license, use externalized configuration definition files, run unattended, and are scriptable. All of the descriptions are based on information from the tools' software repositories and websites. - -#### Ansible - -"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications—automate in a language that approaches plain English, using SSH, with no agents to install on remote systems." —[GitHub repository][3] - -Ansible is one of my favorite tools; I started using it several years ago and fell in love with it. You can use Ansible to execute the same command for a list of servers from the command line. You can also use it to automate tasks using "playbooks" written into a YAML file, which facilitate communication between teams and non-technical people. Its main advantages are that it is simple, agentless, and easy to read (especially for non-programmers). - -Because agents are not required, there is less overhead on servers. An SSH connection is necessary when running in push mode (which is the default), but pull mode is available if needed. [Playbooks][4] can be written with a minimal set of commands or they can be scaled for more elaborate automation tasks that could include roles, variables, and modules written by other people. - -You can combine Ansible with other tools to create a central console to control processes. Those tools include Ansible Works (AWX), Jenkins, RunDeck, and [ARA][5], which offers [traceability when running playbooks][6]. - -### CFEngine - -"CFEngine 3 is a popular open source configuration management system. Its primary function is to provide automated configuration and maintenance of large-scale computer systems." —[GitHub repository][7] - -CFEngine was introduced by Mark Burgess in 1993 as a scientific approach to automated configuration management. The goal was to deal with the entropy in computer systems' configuration and resolve it with end-state "convergence." Convergence means a desired end-state and elaborates on idempotence as a capacity to reach the desired end-state. Burgess' research evolved in 2004 when he proposed the [Promise theory][8] as a model of voluntary cooperation between agents. - -The current version of CFEngine incorporates Promise theory and uses agents running on each server that pull the configuration from a central repository. It requires some expert knowledge to deal with configurations, so it's best suited for technical people. - -### Chef - -"A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure." —[GitHub repository][9] - -Chef uses "recipes" written in Ruby to keep your infrastructure running up-to-date and compliant. The recipes describe a series of resources that should be in a particular state. Chef can run in client/server mode or in a standalone configuration named [chef-solo][10]. It has good integration with the major cloud providers to automatically provision and configure new machines. - -Chef has a solid user base and provides a full toolset to allow people with different technical backgrounds and skills to interact around the recipes. But, at its base, it is more technically oriented tool. - -### Puppet - -"Puppet, an automated administrative engine for your Linux, Unix, and Windows systems, performs administrative tasks (such as adding users, installing packages, and updating server configurations) based on a centralized specification." —[GitHub repository][11] - -Conceived as a tool oriented toward operations and sysadmins, Puppet has consolidated as a configuration management tool. It usually works in a client-server architecture, and an agent communicates with the server to fetch configuration instructions. - -Puppet uses a declarative language or Ruby to describe the system configuration. It is organized in modules, and manifest files contain the desired-state goals to keep everything as required. Puppet uses the push model by default, and the pull model can be configured. - -### Salt - -"Software to automate the management and configuration of any infrastructure or application at scale." — [GitHub repository][12] - -Salt was created for high-speed data collection and scale beyond tens of thousands of servers. It uses Python modules to handle configuration details and specific actions. These modules manage all of Salt's remote execution and state management behavior. Some level of technical skills are required to configure the modules. - -Salt uses a client-server topology (with the Salt master as server and Salt minions as clients). Configurations are kept in Salt state files, which describe everything required to keep a system in the desired state. - -### Conclusion - -The landscape of DevOps tools is evolving all the time, and it is important to keep an eye on the changes. I hope this article will encourage you to explore these concepts and tools further. If so, the Cloud Native Computing Foundation (CNCF) maintains a good reference in the [Cloud Native Landscape Project][13]. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/configuration-management-tools - -作者:[Marco Bravo][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/marcobravo -[b]: https://github.com/lujun9972 -[1]: https://www.oreilly.com/learning/why-use-terraform -[2]: https://www.oreilly.com/library/view/infrastructure-as-code/9781491924334/ch04.html -[3]: https://github.com/ansible/ansible -[4]: https://opensource.com/article/18/8/ansible-playbooks-you-should-try -[5]: https://github.com/openstack/ara -[6]: https://opensource.com/article/18/5/analyzing-ansible-runs-using-ara -[7]: https://github.com/cfengine/core -[8]: https://en.wikipedia.org/wiki/Promise_theory -[9]: https://github.com/chef/chef -[10]: https://docs.chef.io/chef_solo.html -[11]: https://github.com/puppetlabs/puppet -[12]: https://github.com/saltstack/salt -[13]: https://github.com/cncf/landscape diff --git a/translated/tech/20181212 Top 5 configuration management tools.md b/translated/tech/20181212 Top 5 configuration management tools.md new file mode 100644 index 0000000000..d618833492 --- /dev/null +++ b/translated/tech/20181212 Top 5 configuration management tools.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 configuration management tools) +[#]: via: (https://opensource.com/article/18/12/configuration-management-tools) +[#]: author: (Marco Bravo https://opensource.com/users/marcobravo) + +五大最流行的配置管理工具 +====== +在寻找合适的 DevOps 工具之前,你最好要对配置管理工具有一定的了解。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) + +DevOps 正因为有提高产品质量、缩短产品开发时间等优势,目前备受业界关注,同时也在长足发展当中。 + +[DevOps 的核心价值观][1]是团队文化Culture自动化Automation评估Measurement分享Sharing(CAMS),同时,团队对 DevOps 的执行力也是 DevOps 能否成功的重要因素。 + + * **团队文化**让大家团结一致; + * **自动化**是 DevOps 的基础; + * **评估**保证了及时的改进; + * **分享**让 CAMS 成为一个完整的循环过程。 + + + +DevOps 的另一个思想是任何东西,包括服务器、数据库、网络、日志文件、应用配置、文档、自动化测试、部署流程等,都可以通过代码来管理。 + +在本文中,我主要介绍配置管理的自动化。配置管理工具作为[基础架构即代码Infrastructure as Code][2](IaC)的一部分,支持使用软件进行开发实践,以及通过明文定义的文件来管理数据中心。 + +DevOps 团队只需要通过操作简单的配置文件,就可以实现应用开发中包括版本控制、测试、小型部署、设计模式这些最佳实践。总而言是,配置管理工具实现了通过编写代码来使基础架构管理变得自动化。 + +### 为什么要使用配置管理工具? + +配置管理工具可以提高应用部署和变更的效率,还可以让这些流程变得可重用、可扩展、可预测,甚至让它们维持在期望的状态,从而让资产的可控性提高。 + +使用配置管理工具的优势还包括: + + * 让代码遵守编码规范,提高代码可读性; + * 具有幂等性Idempotency,也就是说,无论执行多少次重复的配置管理操作,得到的结果都是一致的; + * 可以方便地管理分布式系统和大量的远程服务器。 + +配置管理工具主要分为拉取pull模式和推送push模式。拉取模式是指安装在各台服务器上的代理agent定期从中央存储库central repository拉取最新的配置并应用到对应的服务器上;而推送模式则由中央服务器central server主动向其它服务器推送更新的配置。 + +### 五大最流行的配置管理工具 + +目前配置管理工具有很多,不同的配置管理工具都有自己最适合的使用场景。而对于下面五个我按照字母顺序列出的配置管理工具,都对 DevOps 有明显的帮助:具有开源许可证、使用外部配置文件、支持无人值守运行、可以通过脚本自定义运行。下面对它们的介绍都来源于它们的软件库和官网内容。 + +#### Ansible + +“Ansible 是一个极其简洁的 IT 自动化平台,可以让你的应用和系统以更简单的方式部署。不需要安装任何代理,只需要使用 SSH 的方式和简单的语言,就可以免去脚本或代码部署应用的过程。”——[GitHub Ansible 代码库][3] + +Ansible 是我最喜欢的工具之一,我在几年前就开始使用了。你可以使用 Ansible 在命令行中让多个服务器执行同一个命令,也可以使用 YAML 格式的 playbook 来让它自动执行特定的操作,这让技术团队和非技术团队之间的沟通变得更加明确。简洁、无代理、配置文件对非技术人员友好是它的几个主要优点。 + +由于 Ansible 不需要代理,因此对服务器的资源消耗会很少。在默认情况下,Ansible 使用的推送模式需要借助 SSH 连接,但 Ansible 也支持拉取模式。[playbook][4] 可以使用最少的命令集编写,当然也可以扩展为更加精细的自动化任务,包括引入其它角色、变量和模块。 + +你可以将 Ansible 和其它工具(包括 Ansible Works、Jenkins、RunDeck、[ARA][5] 等)结合起来使用,因为这些工具支持 [playbook 的回溯功能][6],这样就可以很方便地控制整个开发周期中的不同流程。 + +### CFEngine + +“CFEngine 3 是一个流行的开源配置管理系统,它可以为大规模的系统提供自动化配置和维护。”——[GitHub CFEngine 代码库][7] + +CFEngine 最早在 1993 年由 Mark Burgess 以自动配置管理的科学方法提出,目的是降低计算机系统配置中的熵,最终收敛到期望的配置状态,同时还阐述了幂等性是让系统达到期望状态的能力。Burgess 在 2004 年又提出了承诺理论Promise Theory,这个理论描述了代理之间自发合作的模型。 + +CFEngine 的最新版本已经用到了承诺理论,在各个服务器上的代理程序会从中央存储库拉取配置。CFEngine 的配置对专业技能要求较高,因此它比较适合技术团队使用。 + +### Chef + +“为整个基础架构在配置管理上带来便利的一个系统集成框架。”——[GitHub Chef 代码库][9] + +Chef 通过由 Ruby 编写的“菜谱recipe”来让你的基础架构保持在最新、最兼容的状态,这些“菜谱”描述了一系列资源的某种状态。Chef 既可以通过客户端-服务端的模式运行,也可以在 [chef-solo][10] 这种独立配置的模式下运行。大部分云提供商都很好地集成了 Chef,因此可以使用它为新机器做自动配置。 + +Chef 有广泛的用户基础,同时也提供了完备的工具包,让不同技术背景的团队可以通过“菜谱”进行沟通。尽管如此,它仍然算是一个技术导向的工具。 + +### Puppet + +“Puppet 是可以在 Linux、Unix 和 Windows 系统上运行的自动化管理引擎,它可以根据集中的规范来执行诸如添加用户、安装软件包、更新服务器配置等等管理任务。”——[GitHub Puppet 代码库][11] + +Puppet 作为一款面向运维工程师和系统管理员的工具,在更多情况下是作为配置管理工具来使用。它通过客户端-服务端的模式工作,使用代理从主服务器获取配置指令。 + +Puppet 使用声明式语言declarative language或 Ruby 来描述系统配置。它包含了不同的模块,并使用清单文件manifest files记录期望达到的目标状态。Puppet 默认使用推送模式,但也支持拉取模式。 + +### Salt + +“为大规模基础结构或应用程序实现自动化管理的软件。”——[GitHub Salt 代码库][12] + +Salt 的专长就是快速收集数据,即使是上万台服务器也能够轻松完成任务。它使用 Python 模块来管理配置信息和执行特定的操作,这些模块可以让 Salt 实现所有远程操作和状态管理。但配置 Salt 模块对技术水平有一定的要求。 + +Salt 使用客户端-服务端的结构(Salt minions 是客户端,而 Salt master 是服务端),并以 Salt 状态文件记录需要达到的目标状态。 + +### 总结 + +DevOps 工具领域一直在发展,因此必须时刻关注其中的最新动态。希望这篇文章能够鼓励读者进一步探索相关的概念和工具。为此,云原生计算基金会Cloud Native Computing Foundation(CNCF)在 [Cloud Native Landscape Project][13] 中也提供了很好的参考案例。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/configuration-management-tools + +作者:[Marco Bravo][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/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://www.oreilly.com/learning/why-use-terraform +[2]: https://www.oreilly.com/library/view/infrastructure-as-code/9781491924334/ch04.html +[3]: https://github.com/ansible/ansible +[4]: https://opensource.com/article/18/8/ansible-playbooks-you-should-try +[5]: https://github.com/openstack/ara +[6]: https://opensource.com/article/18/5/analyzing-ansible-runs-using-ara +[7]: https://github.com/cfengine/core +[8]: https://en.wikipedia.org/wiki/Promise_theory +[9]: https://github.com/chef/chef +[10]: https://docs.chef.io/chef_solo.html +[11]: https://github.com/puppetlabs/puppet +[12]: https://github.com/saltstack/salt +[13]: https://github.com/cncf/landscape + From 76e0f3a6182312eac690a2a56684e39a28861518 Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Tue, 29 Jan 2019 23:56:09 +0800 Subject: [PATCH 0847/4278] Delete 20171222 10 keys to quick game development.md --- ...71222 10 keys to quick game development.md | 99 ------------------- 1 file changed, 99 deletions(-) delete mode 100644 sources/talk/20171222 10 keys to quick game development.md diff --git a/sources/talk/20171222 10 keys to quick game development.md b/sources/talk/20171222 10 keys to quick game development.md deleted file mode 100644 index 5897adaae8..0000000000 --- a/sources/talk/20171222 10 keys to quick game development.md +++ /dev/null @@ -1,99 +0,0 @@ -快速开发游戏的十个关键 -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) - -十月早些时候,Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐,并 [取前三][2]。 - -我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] ,2D画面: [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7], [Lost Artist][8], 和 [Paint Rider][9] (我做的)。 - -总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。 - -## 1\. 限定规模 - -很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。 - -Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 - -## 2\. 尽早可玩 - -对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。 - -## 3\. 保持简单 - -你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。 - -## 4\. 从其他游戏获取灵感 - -可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。 - -考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。 - -## 5\. 不要忽视可得性 - -确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏创作),注意可得性是很重要的。 - -Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。 - -## 6\. 不要做得太难 - -如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。 - -给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 - -## 7\. 不用太整洁 - -如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 - -这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。 - -## 8\. 但也不要太随意 - -另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。Luckily, most game engines are built with design patterns in mind. 就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。 - -## 9\. 取得反馈 - -向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。 - -团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。 - -而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 - -## 10\. 哪里找资源 - -做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色 developer was spending multiple hours drawing the main character while I was busy incorporating new features and fixing bugs. 你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。 - -其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 - -你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development - -作者:[Ryan Estes][a] -译者:[XYenChi](https://github.com/XYenChi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/figytuna -[1]:https://itch.io/jam/open-jam-1 -[2]:https://opensource.com/article/17/11/open-jam -[3]:https://godotengine.org/ -[4]:https://lmms.io/ -[5]:https://www.gimp.org/ -[6]:https://www.blender.org/ -[7]:https://astropippin.itch.io/loathsome -[8]:https://masonraus.itch.io/lost-artist -[9]:https://figytuna.itch.io/paint-rider -[10]:http://www.andkon.com/arcade/racing/lineriderbeta2/ -[11]:https://itch.io/ -[12]:https://en.wikipedia.org/wiki/Spaghetti_code -[13]:http://kidscancode.org/blog/2017/03/godot_101_07/ -[14]:https://en.wikipedia.org/wiki/Observer_pattern -[15]:https://discordapp.com/ -[16]:https://creativecommons.org/ -[17]:http://www.soundclick.com/bands/default.cfm?bandID=1277008 -[18]:https://krita.org/en/ -[19]:http://www.drpetter.se/project_sfxr.html -[20]:https://notabug.org/Calinou/awesome-gamedev/src/master/README.md From 8d1305203ca28ec1234a1fcc9f308d4e35f4c6bf Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 30 Jan 2019 00:09:52 +0800 Subject: [PATCH 0848/4278] Translating by MjSeven --- ... Plan your own holiday calendar at the Linux command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md index b4d6f58b32..9188914bbb 100644 --- a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 538c7b4a3e348548e3bffab157585010a2ba8eeb Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Jan 2019 08:54:24 +0800 Subject: [PATCH 0849/4278] translated --- ... And Hardware Monitoring Tool For Linux.md | 139 ------------------ 1 file changed, 139 deletions(-) delete mode 100644 sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md diff --git a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md deleted file mode 100644 index 24b5f93af7..0000000000 --- a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md +++ /dev/null @@ -1,139 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Hegemon – A Modular System And Hardware Monitoring Tool For Linux) -[#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -Hegemon – A Modular System And Hardware Monitoring Tool For Linux -====== - -I know that everybody is preferring for **[TOP Command][1]** to monitor system utilization. - -It’s one of the best and native command which used by vast of Linux administrators. - -In Linux there is an alternative for everything respective of packages. - -There are many utilities are available for this purpose in Linux and i prefer **[HTOP Command][2]**. - -If you want to know about other alternatives, i would suggest you to navigate to the each link to know more about it. - -Those are htop, CorFreq, glances, atop, Dstat, Gtop, Linux Dash, Netdata, Monit, etc. - -All these tools only allow us to monitor system utilization and not for the system hardware’s. - -But Hegemon is allow us to monitor both in the single dashboard. - -If you are looking for system hardware monitoring then i would suggest you to check **[lm_sensors][3]** and **[s-tui Stress Terminal UI][4]** utilities. - -### What’s Hegemon? - -Hegemon is a work-in-progress modular system monitor written in safe Rust. - -It allow users to monitor both utilization in a single dashboard. It’s system utilization and hardware temperatures. - -### Currently Available Features in Hegemon - - * Monitor CPU and memory usage, temperatures, and fan speeds - * Expand any data stream to reveal a more detailed graph and additional information - * Adjustable update interval - * Clean MVC architecture with good code quality - * Unit tests - - - -### Planned Features include - - * macOS and BSD support (only Linux is supported at the moment) - * Monitor disk and network I/O, GPU usage (maybe), and more - * Select and reorder data streams - * Mouse control - - - -### How to Install Hegemon in Linux? - -Hegemon is requires Rust 1.26 or later and the development files for libsensors. So, make sure these packages were installed before your perform Hegemon installation. - -libsensors library package is available in most of the distribution official repository so, use the following command to install it. - -For **`Debian/Ubuntu`** systems, use **[APT-GET Command][5]** or **[APT Command][6]** to install libsensors on your systems. - -``` -# apt install lm_sensors-devel -``` - -For **`Fedora`** system, use **[DNF Package Manager][7]** to install libsensors on your system. - -``` -# dnf install libsensors4-dev -``` - -Run the following command to install Rust programming language and follow the instruction. Navigate to the following URL if you want handy tutorials for **[Rust installation][8]**. - -``` -$ curl https://sh.rustup.rs -sSf | sh -``` - -If you have successfully installed Rust. Run the following command to install Hegemon. - -``` -$ cargo install hegemon -``` - -### How to Lunch Hegemon in Linux? - -Once you successfully install Hegemon package. Run run the below command to launch it. - -``` -$ hegemon -``` - -![][10] - -I was facing an issue when i was launching the “Hegemon” application due to libsensors.so.4 libraries issue. - -``` -$ hegemon -error while loading shared libraries: libsensors.so.4: cannot open shared object file: No such file or directory manjaro -``` - -I’m using Manjaro 18.04. It has the libsensors.so & libsensors.so.5 shared libraries and not for libsensors.so.4. So, i just created the following symlink to fix the issue. - -``` -$ sudo ln -s /usr/lib/libsensors.so /usr/lib/libsensors.so.4 -``` - -Here is the sample gif file which was taken from my Lenovo-Y700 laptop. -![][11] - -By default it shows only overall summary and if you would like to see the detailed output then you need to expand the each section. See the expanded output with Hegemon. -![][12] - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-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/top-command-examples-to-monitor-server-performance/ -[2]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/ -[3]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ -[4]: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ -[5]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ -[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[7]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ -[8]: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ -[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-1.png -[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-2a.gif -[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-3.png From defbf592185ad54c5df00614109de4b448c3be72 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Jan 2019 09:14:39 +0800 Subject: [PATCH 0850/4278] translated --- ... And Hardware Monitoring Tool For Linux.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md diff --git a/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md new file mode 100644 index 0000000000..9dd255cb67 --- /dev/null +++ b/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Hegemon – A Modular System And Hardware Monitoring Tool For Linux) +[#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Hegemon - 一个 Linux 中的模块化系统和硬件监控工具 +====== + +我知道每个人都更喜欢使用 **[top 命令][1]**来监控系统利用率。 + +这是被 Linux 系统管理员大量使用的原生命令之一。 + +在 Linux 中,每个包都有一个替代品。 + +Linux 中有许多可用于此的工具,我更喜欢 **[htop 命令][2]**。 + +如果你想了解其他替代方案,我建议你浏览每个链接了解更多信息。 + +它们有 htop、CorFreq、glances、atop、Dstat、Gtop、Linux Dash、Netdata、Monit 等。 + +所有这些只允许我们监控系统利用率而不能监控系统硬件。 + +但是 Hegemon 允许我们在单个仪表板中监控两者。 + +如果你正在寻找系统硬件监控软件,那么我建议你看下 **[lm_sensors][3]** 和 **[s-tui 压力终端 UI][4]**。 + +### Hegemon 是什么? + +Hegemon 是一个正在开发中的模块化系统监视器, 以安全的 Rust 编写。 + +它允许用户在单个仪表板中监控两种使用情况。分别是系统利用率和硬件温度。 + +### Hegemon 目前的特性 + + * 监控 CPU 和内存使用情况、温度和风扇速度 +  * 展开任何数据流以显示更详细的图表和其他信息 +  * 可调整的更新间隔 +  * 干净的 MVC 架构,具有良好的代码质量 +  * 单元测试 + + + +### 计划的特性包括 + + * macOS 和 BSD 支持(目前仅支持 Linux) +  * 监控磁盘和网络 I/O、GPU使用情况(可能)等 +  * 选择并重新排序数据流 +  * 鼠标控制 + + + +### 如何在 Linux 中安装 Hegemon? + +Hegemon 需要 Rust 1.26 或更高版本以及 libsensors 的开发文件。因此,请确保在安装 Hegemon 之前安装了这些软件包。 + +libsensors 库在大多数发行版官方仓库中都有,因此,使用以下命令进行安装。 + +对于 **`Debian/Ubuntu`** 系统,使用 **[apt-get 命令][5]** 或 **[apt 命令][6]** 在你的系统上安装 libsensors。 + +``` +# apt install lm_sensors-devel +``` + +对于 **`Fedora`** 系统,使用 **[dnf 包管理器][7]**在你的系统上安装 libsensors。 + +``` +# dnf install libsensors4-dev +``` + +运行以下命令安装 Rust 语言,并按照指示来做。如果你想要看 **[Rust 安装][8]**的方便教程,请进入这个 URL。 + +``` +$ curl https://sh.rustup.rs -sSf | sh +``` + +如果你已成功安装 Rust。运行以下命令安装 Hegemon。 + +``` +$ cargo install hegemon +``` + +### 如何在 Linux 中启动 Hegemon? + +成功安装 Hegemon 包后,运行下面的命令启动。 + +``` +$ hegemon +``` + +![][10] + +由于 libsensors.so.4 库的问题,我在启动 “Hegemon” 时遇到了一个问题。 + +``` +$ hegemon +error while loading shared libraries: libsensors.so.4: cannot open shared object file: No such file or directory manjaro +``` + +我使用的是 Manjaro 18.04。它存在 libsensors.so 和 libsensors.so.5 共享库,而没有 libsensors.so.4。所以,我刚刚创建了以下符号链接来解决问题。 + +``` +$ sudo ln -s /usr/lib/libsensors.so /usr/lib/libsensors.so.4 +``` + +这是从我的 Lenovo-Y700 笔记本中截取的示例 gif。 +![][11] + +默认它仅显示总体摘要,如果你想查看详细输出,则需要展开每个部分。使用 Hegemon 查看展开内容。 +![][12] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-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/top-command-examples-to-monitor-server-performance/ +[2]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/ +[3]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ +[4]: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ +[5]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[7]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[8]: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ +[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-1.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-2a.gif +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-3.png From 13b6b3f25df10c44bc5dcc8b8ec61fa76dead1c5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Jan 2019 09:20:35 +0800 Subject: [PATCH 0851/4278] translating --- ...Tron-influenced terminal program for tablets and desktops.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md index f181f4ebd1..78f31a6b94 100644 --- a/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md +++ b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 00deeb2367d702173592d8a3df52d041e08e203e Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Wed, 30 Jan 2019 09:29:55 +0800 Subject: [PATCH 0852/4278] hankchow translating --- sources/tech/20190124 Understanding Angle Brackets in Bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190124 Understanding Angle Brackets in Bash.md b/sources/tech/20190124 Understanding Angle Brackets in Bash.md index bd9a3782fb..063eec3fd0 100644 --- a/sources/tech/20190124 Understanding Angle Brackets in Bash.md +++ b/sources/tech/20190124 Understanding Angle Brackets in Bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2927c795f9226ceafc7b057b660145eda2a63416 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 30 Jan 2019 13:38:25 +0800 Subject: [PATCH 0853/4278] Translating An Introduction to Go. --- translated/tech/20181224 An Introduction to Go.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 0e4b77aadc..a9f50f6770 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -239,7 +239,7 @@ slice2 := array[:] // 整个数组的切片 slice3 := array[1:] // 除了首元素的切片 ``` -There are some more possible combinations for the slicing operator than mentioned above, but this should give a good first impression. +除了上述例子,还有更多可行的切片运算组合,但需要明了直观。 使用 `append()` 函数,切片可以作为一个变长数组使用。 @@ -248,7 +248,7 @@ slice = append(slice, value1, value2) slice = append(slice, arrayOrSlice...) ``` -Slices are also used internally to represent variable parameters in variable length functions. +切片也可以用于函数的变长参数。 ### Maps From 0727e429656262101a842cfddcd00cf4fb80c16c Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Wed, 30 Jan 2019 15:01:30 +0800 Subject: [PATCH 0854/4278] translated --- ...u monitor activity on your Linux server.md | 156 ----------------- ...u monitor activity on your Linux server.md | 157 ++++++++++++++++++ 2 files changed, 157 insertions(+), 156 deletions(-) delete mode 100644 sources/tech/20190123 Commands to help you monitor activity on your Linux server.md create mode 100644 translated/tech/20190123 Commands to help you monitor activity on your Linux server.md diff --git a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md deleted file mode 100644 index c2a95d7ec2..0000000000 --- a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md +++ /dev/null @@ -1,156 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (dianbanjiu ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Commands to help you monitor activity on your Linux server) -[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Commands to help you monitor activity on your Linux server -====== -The watch, top, and ac commands provide some effective ways to oversee what is happening on your Linux servers. - -![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg) - -Linux systems provide a number of commands that make it easy to report on system activity. In this post, we're going to look at several commands that are especially helpful. - -### The watch command - -The **watch** command is one that makes it easy to repeatedly examine a variety of data on your system — user activities, running processes, logins, memory usage, etc. All the command really does is run the command that you specify repeatedly, each time overwriting the previously displayed output, but this lends itself to a very convenient way of monitoring what's happening on your system. - -To start with a very basic and not particularly useful command, you could run **watch -n 5 date** and see a display with the current date and time that updates every 5 seconds. As you likely have guessed, the **-n 5** option specifies the number of seconds to wait between each run of the command. The default is 2 seconds. The command will run and update a display like this until you stop it with a ^c. - -``` -Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019 - -Wed Jan 23 15:59:14 EST 2019 -``` - -As a more interesting command example, you can watch an updated list of whoever is logging into the server. As written, this command will update every 10 seconds. Users who log out will disappear from the current display and those who log in will come into view. If no one is logging in or out, the display will remain the same except for the time displayed. - -``` -$ watch -n 10 who - -Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019 - -shs :0 2019-01-23 09:45 (:0) -dory pts/0 2019-01-23 15:50 (192.168.0.5) -nemo pts/1 2019-01-23 16:01 (192.168.0.15) -shark pts/3 2019-01-23 11:11 (192.168.0.27) -``` - -If you just want to see how many users are logged in, you can get a user count along with load averages showing you how hard the system is working by having watch call the **uptime** command. - -``` -$ watch uptime - -Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019 - - 16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02 -``` - -If you want to use watch to repeat a command that includes a pipe, you need to put the command between quote marks like this command that every 5 seconds shows you how many processes are running: - -``` -$ watch -n 5 'ps -ef | wc -l' - -Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019 - -245 -``` - -To watch memory usage, you might try a command like this one: - -``` -$ watch -n 5 free -m - -Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019 - - total used free shared buff/cache available -Mem: 5959 776 3276 12 1906 4878 -Swap: 2047 0 2047 -``` - -You could watch processes being run by one particular user with **watch,** but the **top** command provides a much better option. - -### The top command - -If you want to watch one particular user's processes, top has an ideal option for you — the -u option: - -``` -$ top -u nemo -top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02 -Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie -%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache -MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem - - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND -23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd -23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam) -23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd -23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh -``` - -You not only see what processes the user is running, but the resources (CPU time and memory) that the process is consuming and how hard the system is working overall. - -### The ac command - -If you'd like to see how much time each of your users is spending logged in, you can make use of the **ac** command. This requires installation of the **acct** (Debian) or **psacct** (RHEL, Centos, etc.) package. - -The **ac** command has a number of options, but it pulls its data from the current **wtmp** file. Here's an example showing the total number of hours users were logged in recently: - -``` -$ ac - total 1261.72 -``` - -This command shows total hours by user: - -``` -$ ac -p - shark 5.24 - nemo 5.52 - shs 1251.00 - total 1261.76 -``` - -This ac command shows daily counts of how many hours users were logged in: - -``` -$ ac -d | tail -10 - -Jan 11 total 0.05 -Jan 12 total 1.36 -Jan 13 total 16.39 -Jan 15 total 55.33 -Jan 16 total 38.02 -Jan 17 total 28.51 -Jan 19 total 48.66 -Jan 20 total 1.37 -Jan 22 total 23.48 -Today total 9.83 -``` - -### Wrap-up - -There are many commands for examining system activity. The **watch** command allows you to run just about any command in a repetitive way and watch how the output changes. The **top** command is a better option for focusing on user processes and also loops in a way that allows you to see the changes as they happen, while the **ac** command examines user connect time. - -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/3335200/linux/how-to-monitor-activity-on-your-linux-server.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 diff --git a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md new file mode 100644 index 0000000000..3c0e44a946 --- /dev/null +++ b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: (dianbanjiu ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Commands to help you monitor activity on your Linux server) +[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +帮你监控你的 Linux 服务器的命令 +====== + +watch、top 和 ac 命令为我们监视 Linux 服务器上的活动提供了一些十分高效的途径。 + +![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg) + +为了在获取系统活动时更加轻松,Linux 系统提供了一系列相关的命令。在这篇文章中,我们就一起来看看这些对我们很有帮助的命令吧。 + +### watch 命令 + +**watch** 是一个使得重复检测 Linux 系统中一系列数据,例如用户活动、正在运行进程、登录、内存使用等更加容易的命令。这个命令实际上是重复地运行一个特定的命令,每次都会重写之前显示的输出,它提供了一个比较方便的方式用以监测在你的系统中发生的活动。 + +首先以一个基础且不是特别有用的命令开始,你可以运行 `watch -n 5 date`,然后你可以看到在终端中显示了当前的日期和时间,这些数据会每五秒更新一次。你可能已经猜到了,**-n 5** 选项指定了运行接下来一次命令需要等待的秒数。默认是 2 秒。这个命令将会一直运行并按照指定的时间更新显示,直到你使用 ^C 停下它。 + +``` +Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019 + +Wed Jan 23 15:59:14 EST 2019 +``` + +下面是一个很有趣的命令实例,你可以监控一个在服务器中登录用户的列表,该列表会按照指定的时间定时更新。就像下面写到的,这个命令会每 10 秒更新一次这个列表。登出的用户将会从当前显示的列表中消失,那些新登录的将会被添加到这个表格当中。如果没有用户再登录或者登出,这个表格跟之前显示的将不会有任何不同。 + +``` +$ watch -n 10 who + +Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019 + +shs :0 2019-01-23 09:45 (:0) +dory pts/0 2019-01-23 15:50 (192.168.0.5) +nemo pts/1 2019-01-23 16:01 (192.168.0.15) +shark pts/3 2019-01-23 11:11 (192.168.0.27) +``` + +如果你只是想看有多少用户登录过,可以通过 watch 调用 **uptime** 命令获取用户数和负载的平均水平,以及系统的工作状况。 + +``` +$ watch uptime + +Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019 + + 16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02 +``` + +如果你想使用 watch 重复一个包含了管道的命令,就需要将该命令用引号括起来,就比如下面这个每五秒显示一次有多少进程正在运行的命令。 + +``` +$ watch -n 5 'ps -ef | wc -l' + +Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019 + +245 +``` + +要查看内存使用,你也许会想要试一下下面的这个命令组合: + +``` +$ watch -n 5 free -m + +Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019 + + total used free shared buff/cache available +Mem: 5959 776 3276 12 1906 4878 +Swap: 2047 0 2047 +``` + +你可以在 **watch** 后添加一些选项查看某个特定用户下运行的进程,不过 **top** 为此提供了更好的选择。 + +### top 命令 + +如果你想查看某个特定用户下的进程,top 命令的 `-u` 选项可以很轻松地帮你达到这个目的。 + +``` +$ top -u nemo +top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02 +Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache +MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND +23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd +23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam) +23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd +23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh +``` + +你可能不仅可以看到某个用户下的进程,还可以查看每个进程所占用的资源,以及系统总的工作状况。 + +### ac 命令 + +如果你想查看系统中每个用户登录的时长,可以使用 **ac** 命令。运行该命令之前首先需要安装 **acct**(Debian 等) 或者 **psacct**(RHEL、Centos 等) 包。 + +**ac** 命令有一系列的选项,该命令从 **wtmp** 文件中拉取数据。这个例子展示的是最近用户登录的总小时数。 + +``` +$ ac + total 1261.72 +``` + +这个命令显示了用户登录的总的小时数: + +``` +$ ac -p + shark 5.24 + nemo 5.52 + shs 1251.00 + total 1261.76 +``` + +这个命令显示了用户每天登录的小时数: + +``` +$ ac -d | tail -10 + +Jan 11 total 0.05 +Jan 12 total 1.36 +Jan 13 total 16.39 +Jan 15 total 55.33 +Jan 16 total 38.02 +Jan 17 total 28.51 +Jan 19 total 48.66 +Jan 20 total 1.37 +Jan 22 total 23.48 +Today total 9.83 +``` + +### 总结 + +Linux 系统上有很多命令可以用于检查系统活动。**watch** 命令允许你以重复的方式运行任何命令,并观察输出有何变化。**top** 命令是一个专注于用户进程的最佳选项,以及允许你以动态方式查看进程的变化,还可以使用 **ac** 命令检查用户连接到系统的时间。 + +加入 [Facebook][1] 和 [LinkedIn][2] 上的 Network World 社区,来交流更多有用的主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html + +作者:[Sandra Henry-Stocker][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.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 fafa7cf025301f5bcae7cc5a38dc6399a597a06c Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Wed, 30 Jan 2019 15:07:14 +0800 Subject: [PATCH 0855/4278] translated --- ...ommands to help you monitor activity on your Linux server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md index 3c0e44a946..394b553d13 100644 --- a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md +++ b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -7,7 +7,7 @@ [#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -帮你监控你的 Linux 服务器的命令 +监控 Linux 服务器的几个常用命令 ====== watch、top 和 ac 命令为我们监视 Linux 服务器上的活动提供了一些十分高效的途径。 From d83e4d3970e055a7b2cf4ed555b90280c476863f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 17:51:37 +0800 Subject: [PATCH 0856/4278] PRF:20181219 How to open source your Python library.md @geekpi --- ... How to open source your Python library.md | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/translated/tech/20181219 How to open source your Python library.md b/translated/tech/20181219 How to open source your Python library.md index 7c4a2d3f25..8569db33c1 100644 --- a/translated/tech/20181219 How to open source your Python library.md +++ b/translated/tech/20181219 How to open source your Python library.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to open source your Python library) @@ -9,45 +9,44 @@ 如何开源你的 Python 库 ====== -这 12 个步骤能确保成功发布。 + +> 这 12 个步骤能确保成功发布。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) -你写了一个 Python 库。我觉着这太棒了!如果让人们能够轻松使用它不是很优雅么?这有一个需要考虑的清单,以及在开源 Python 库时要采取的具体步骤。 +你写了一个 Python 库。自己觉着这太棒了!如果让人们能够轻松使用它不是很优雅么?这有一个需要考虑的清单,以及在开源 Python 库时要采取的具体步骤。 -### 1\. 源码 +### 1、源码 将代码放在 [GitHub][1] 上,这里有很多开源项目,并且人们很容易提交拉取请求。 -### 2\. 许可证 - -选择一个开源许可证。默认的一个不错的,宽容的是 [MIT 许可][2]。如果你有特定要求,Creative Common 的[选择许可][3]可以指导你完成其他选择。最重要的是,在选择许可时要记住三条规则: +### 2、许可证 +选择一个开源许可证。一般来说 [MIT 许可证][2]是一个挺好的宽容许可证。如果你有特定要求,Creative Common 的[选择许可证][3]可以指导你完成其它选择。最重要的是,在选择许可证时要记住三条规则: * 不要创建自己的许可证。 * 不要创建自己的许可证。 * 不要创建自己的许可证。 +### 3、README - -### 3\. README - -将一个名为 README.rst 的文件(使用 ReStructured Text 格式化)放在项目树的顶层。 +将一个名为 `README.rst` 的文件(使用 ReStructured Text 格式化)放在项目树的顶层。 GitHub 将像 Markdown 一样渲染 ReStructured Text,而 ReST 在 Python 的文档生态系统中的表现更好。 -### 4\. 测试 +### 4、测试 写测试。这对你来说没有用处。但对于想要编写避免破坏相关功能的补丁的人来说,它非常有用。 测试可帮助协作者进行协作。 -通常情况下,如果可以用 [**pytest**][4] 运行就最好了。还有其他测试工具 - 但很少有理由去使用它们。 +通常情况下,如果可以用 [pytest][4] 运行就最好了。还有其他测试工具 —— 但很少有理由去使用它们。 -### 5\. 样式 +### 5、样式 -使用 linter 制定样式:PyLint、Flake8 或者带上 **\--check** 的 Black 。除非你使用Black,否则请确保在下载源代码文件中指定配置选项。 +使用 linter 制定样式:PyLint、Flake8 或者带上 `--check` 的 Black 。除非你使用 Black,否则请确保在一个文件中指定配置选项,并签入到版本控制系统中。 -### 6\. API 文档 +### 6、API 文档 使用 docstrings 来记录模块、函数、类和方法。 @@ -55,33 +54,33 @@ GitHub 将像 Markdown 一样渲染 ReStructured Text,而 ReST 在 Python 的 Sphinx 可以同时处理 Google 风格和 ReST 的 docstrings,以将零散的文档集成为 API 文档。 -### 7\. 零散文档 +### 7、零散文档 使用 [Sphinx][7]。(阅读[我们这篇文章][8]。)教程很有用,但同样重要的是要指明这是什么、它有什么好处、它有什么坏处、以及任何特殊的考虑因素。 -### 8\. 构建 +### 8、构建 -使用 **tox** 或 **nox** 自动运行测试、linter 并构建文档。这些工具支持“依赖矩阵”。这些矩阵往往会快速增长,但你可以尝试针对合理的样本进行测试,例如 Python 版本、依赖项版本以及可能安装的可选依赖项。 +使用 tox 或 nox 自动运行测试和 linter,并构建文档。这些工具支持“依赖矩阵”。这些矩阵往往会快速增长,但你可以尝试针对合理的样本进行测试,例如 Python 版本、依赖项版本以及可能安装的可选依赖项。 -### 9\. 打包 +### 9、打包 -使用 [setuptools][9] 工具。写一个 **setup.py** 和一个 **setup.cfg**。如果同时支持 Python 2 和 3,请在 **setup.cfg** 中指定 universal wheel。 +使用 [setuptools][9] 工具。写一个 `setup.py` 和一个 `setup.cfg`。如果同时支持 Python 2 和 3,请在 `setup.cfg` 中指定 universal 格式的 wheel。 -**tox** 或 **nox** 应该做的一件事是构建 wheel 并对已安装的 wheel 进行测试。 +tox 或 nox 应该做的一件事是构建 wheel 并对已安装的 wheel 进行测试。 避免使用 C 扩展。如果出于性能或绑定的原因一定需要它们,请将它们放在单独的包中。正确打包 C 扩展可以写一篇新的文章。这里有很多问题! -### 10\. 持续集成 +### 10、持续集成 -使用公共持续工具。[TravisCI][10] and [CircleCI][11] 为开源项目提供免费套餐。将 GitHub 或其他仓库配置为在合并拉请求之前需要先通过检查, 那么你就不必担心在代码评审中告知用户修复测试或样式。 +使用公共持续工具。[TravisCI][10] 和 [CircleCI][11] 为开源项目提供免费套餐。将 GitHub 或其他仓库配置为在合并拉请求之前需要先通过检查,那么你就不必担心在代码评审中告知用户修复测试或样式。 -### 11\. 版本 +### 11、版本 使用 [SemVer][12] 或 [CalVer][13]。有许多工具可以帮助你管理版本:[incremental][14]、[bumpversion][15] 和 [setuptools_scm][16] 等都是 PyPI 上的包,都可以帮助你管理版本。 -### 12\. 发布 +### 12、发布 -通过运行 **tox** 或 **nox** 并使用 **twine** 将文件上传到 PyPI 上发布。你可以通过在 [DevPI][17] 中“测试上传”。 +通过运行 tox 或 nox 并使用 twine 将文件上传到 PyPI 上发布。你可以通过在 [DevPI][17] 中“测试上传”。 -------------------------------------------------------------------------------- @@ -90,7 +89,7 @@ via: https://opensource.com/article/18/12/tips-open-sourcing-python-libraries 作者:[Moshe Zadka][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 a339e75ac9863a0e4c7cfacf7047d3a50dadb7ca Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 17:53:24 +0800 Subject: [PATCH 0857/4278] PUB:20181219 How to open source your Python library.md @geekpi https://linux.cn/article-10491-1.html --- .../20181219 How to open source your Python library.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181219 How to open source your Python library.md (98%) diff --git a/translated/tech/20181219 How to open source your Python library.md b/published/20181219 How to open source your Python library.md similarity index 98% rename from translated/tech/20181219 How to open source your Python library.md rename to published/20181219 How to open source your Python library.md index 8569db33c1..e21eaeedb8 100644 --- a/translated/tech/20181219 How to open source your Python library.md +++ b/published/20181219 How to open source your Python library.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10491-1.html) [#]: subject: (How to open source your Python library) [#]: via: (https://opensource.com/article/18/12/tips-open-sourcing-python-libraries) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From c14d0eec4400351d1fdf836da8dbe5b802c6f11a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 18:40:16 +0800 Subject: [PATCH 0858/4278] PRF:20180814 5 open source strategy and simulation games for Linux.md @Scoutydren --- ...strategy and simulation games for Linux.md | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/translated/tech/20180814 5 open source strategy and simulation games for Linux.md b/translated/tech/20180814 5 open source strategy and simulation games for Linux.md index b7878dd1b6..9666e74c0f 100644 --- a/translated/tech/20180814 5 open source strategy and simulation games for Linux.md +++ b/translated/tech/20180814 5 open source strategy and simulation games for Linux.md @@ -1,73 +1,67 @@ -5款开源的Linux策略模拟游戏 +5 款开源的 Linux 策略模拟游戏 ====== +> 用这些开源游戏来挑战你的战略技能,探索新世界。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) -长久以来,游戏都是 Linux 的软肋。近些年,Steam,GOG等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 +长久以来,游戏都是 Linux 的软肋。近些年,Steam、GOG 等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 -那么,我们能找到既免费开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。就算某个游戏在不在某个发行版本的库中,我们也可以在这个游戏项目的网站上找到直接的安装方法。 +那么,我们能找到既自由开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和 3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。就算某个游戏在不在某个发行版本的库中,我们也可以在这个游戏项目的网站上找到直接的安装方法。 -本篇文章将会介绍策略和模拟类游戏。我已经写了街机游戏、桌面卡牌游戏、解谜游戏、竞速飞行游戏以及角色扮演游戏。 +本篇文章将会介绍策略和模拟类游戏。我已经写了[街机游戏][1]、[桌面卡牌游戏][2]、[解谜游戏][3]、[竞速飞行游戏][4]以及[角色扮演游戏][5]。 -### Freeciv 开源“文明” +### 开源版“文明”(Freeciv) ![](https://opensource.com/sites/default/files/uploads/freeciv.png) -[Freeciv][6] 可以被视为是文明系列游戏的开源版本。游戏玩法和文明系列最早期的游戏十分类似, Freeciv 可以让玩家选择选用文明 1 或者文明 2 中的游戏规则设置。Freeciv 中包含了很多元素,例如建造城市、探索世界地图、发展科技以及和其他扩张中的文明竞争。胜利条件包括打败所有其他的文明或建立一个外星殖民地,如果在前两者都没有达成的话,在游戏时间期限前存活下来也可以算作胜利。这个游戏可以和其他玩家联机也可以和 AI 对战,不同的地图集可以改变游戏的外观。 +[Freeciv][6] 可以被视为是[文明系列][7]游戏的开源版本。游戏玩法和文明系列最早期的游戏十分类似,Freeciv 可以让玩家选择选用文明 1 或者文明 2 中的游戏规则设置。Freeciv 中包含了很多元素,例如建造城市、探索世界地图、发展科技以及和其他扩张中的文明竞争。胜利条件包括打败所有其他的文明或建立一个外星殖民地,如果在前两者都没有达成的话,在游戏时间期限前存活下来也可以算作胜利。这个游戏可以和其他玩家联机也可以和 AI 对战,不同的地图集可以改变游戏的外观。 安装 Freeciv,你只需要在终端下运行以下指令。 * Fedora 用户: `dnf install freeciv` - * Debian/Ubuntu 用户:`apt install freeciv` - ### MegaGlest ![](https://opensource.com/sites/default/files/uploads/megaglest.png) -[MegaGlest][8] 是一个开源的实时战略游戏,类似暴雪公司制作的游戏魔兽世界和星际争霸。玩家控制不同派别的人员、建造新建筑、招募士兵、拓展领土并与敌人作战。在游戏比赛的最开始,玩家仅能建造最基础的建筑和招募最基础的士兵。为了建造更高级的建筑并招募级别更高的人员,玩家必须通过增加建筑和人员从而一路提高科技树、解锁更加高级的选项。当敌人进入国土领域之中,战斗单元必须迎战。但是最好的应对策略是,通过控制战斗单元直接操控每一场战斗。在管理新建筑的建立,新人员的招募的同时控制战斗局势听上去十分困难,但是这就是RTS(实时战略游戏)游戏的精华所在。MegaGlest 这个游戏提供了大量的人员派类,玩家可以不断尝试这些不同的技巧。 +[MegaGlest][8] 是一个开源的实时战略游戏,类似暴雪公司制作的游戏[魔兽世界][9]和[星际争霸][10]。玩家控制不同派别的人员、建造新建筑、招募士兵、拓展领土并与敌人作战。在游戏比赛的最开始,玩家仅能建造最基础的建筑和招募最基础的士兵。为了建造更高级的建筑并招募级别更高的人员,玩家必须通过增加建筑和人员从而一路提高科技树、解锁更加高级的选项。当敌人进入国土领域之中,战斗单元将会迎战。但是最好的应对策略是,通过控制战斗单元直接操控每一场战斗。在管理新建筑的建立,新人员的招募的同时控制战斗局势听上去十分困难,但是这就是 RTS(实时战略游戏)游戏的精华所在。MegaGlest 这个游戏提供了大量的人员派别,玩家可以不断尝试这些不同的技巧。 安装 MegaGlest,你只需要在终端下运行以下指令: * Fedora 用户: `dnf install megaglest` * Debian/Ubuntu 用户:`apt install megaglest` - - -### OpenTTD 开源版“运输大亨” +### 开源版“运输大亨”(OpenTTD) ![](https://opensource.com/sites/default/files/uploads/openttd.png) -[OpenTTD][11] (见我们的 [评测][12] )是一个开源实现的 [运输大亨][13] 。该游戏的目的在于创建一个交通运输网络并获得金钱,从而建立更加复杂的运输网络。这个运输网络包括了船只、巴士、火车、货车和飞机。默认的游戏时间在1950和2050之间,玩家的目标就是在规定时间内拿到最高的游戏分数。游戏的最终分数基于很多因素,例如货物运输的数量、玩家所拥有的汽车数量以及他们赚到的钱。 +[OpenTTD][11](见我们的 [评测][12] )是一个开源实现的 [运输大亨][13] 。该游戏的目的在于创建一个交通运输网络并获得金钱,从而建立更加复杂的运输网络。这个运输网络包括了船只、巴士、火车、货车和飞机。默认的游戏时间在 1950 和 2050 之间,玩家的目标就是在规定时间内拿到最高的游戏分数。游戏的最终分数基于很多因素,例如货物运输的数量、玩家所拥有的汽车数量以及他们赚到的钱。 安装 OpenTTD,你只需要在终端运行以下指令: * Fedora 用户: `dnf install openttd` * Debian/Ubuntu 用户 `apt install openttd` - - -### The Battle for Wesnoth 韦诺之战 +### 韦诺之战The Battle for Wesnoth ![](https://opensource.com/sites/default/files/uploads/the_battle_for_wesnoth.png) -[韦诺之战][14] 是目前最完善的开源游戏之一。这个回合制游戏在一个奇幻的故事设定下。游戏在一个六角形网格中进行,各个单元可以互相操作进行战斗。每个类型的单元都有它独特的能力和弱点,因此玩家需要根据这些特点来设计不同的行动。韦诺之战中有很多不同的行动分支,每个行动分支都有它特别的故事线和目标。The 韦诺之战同时也有一个地图编辑器,感兴趣的玩家可以创作自己的地图以及行动分支。 +[韦诺之战][14] 是目前最完善的开源游戏之一。这个回合制游戏在一个奇幻的故事设定下。游戏在一个六角形网格中进行,各个单元可以互相操作进行战斗。每个类型的单元都有它独特的能力和弱点,因此玩家需要根据这些特点来设计不同的行动。韦诺之战中有很多不同的行动分支,每个行动分支都有它特别的故事线和目标。韦诺之战同时也有一个地图编辑器,感兴趣的玩家可以创作自己的地图以及行动分支。 安装韦诺之战,你只需要在终端运行以下指令: - * Fedora 用户: `dnf install wesnoth ` + * Fedora 用户: `dnf install wesnoth` * Debian/Ubuntu 用户: `apt install wesnoth` - - -### UFO: Alien Invasion (UFO:外星入侵) +### UFO:外星入侵UFO: Alien Invasion ![](https://opensource.com/sites/default/files/uploads/ufo_alien_invasion.png) -[UFO: Alien Invasion][15] 是一个开源策略游戏,基于幽浮系列 [X-COM series][20]。 有两个不同的游戏模式: geoscape 和tactical。在 geoscape 模式下,玩家控制大局、管理基地、开发新技术以及掌控整体策略。 在tactical 游戏模式下,玩家控制一群士兵并且以回合制的形式直接迎战外星侵略者。两个游戏模式提供了不同的游戏玩法,两者都需要相当复杂的策略和战术。 +[UFO: Alien Invasion][15] 是一个开源策略游戏,基于 [幽浮系列][20]X-COM。 有两个不同的游戏模式: geoscape 和 tactical。在 geoscape 模式下,玩家控制大局、管理基地、开发新技术以及掌控整体策略。 在 tactical 游戏模式下,玩家控制一群士兵并且以回合制的形式直接迎战外星侵略者。两个游戏模式提供了不同的游戏玩法,两者都需要相当复杂的策略和战术。 -安装 UFO:外星入侵,你只需要在终端下运行以下指令: +安装这个游戏,你只需要在终端下运行以下指令: * Debian/Ubuntu 用户: `apt install ufoai` @@ -81,13 +75,13 @@ via: https://opensource.com/article/18/8/strategy-simulation-games-linux 作者:[Joshua Allen Holm][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[Scoutydren](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Scoutydren](https://github.com/Scoutydren) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://opensource.com/users/holmja -[1]:https://opensource.com/article/18/1/arcade-games-linux +[1]:https://linux.cn/article-10433-1.html [2]:https://opensource.com/article/18/3/card-board-games-linux [3]:https://opensource.com/article/18/6/puzzle-games-linux [4]:https://opensource.com/article/18/7/racing-flying-games-linux From 641d22173d1ce4db68ac635eb8dc1403f9d0d2d5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 18:40:53 +0800 Subject: [PATCH 0859/4278] PUB:20180814 5 open source strategy and simulation games for Linux.md @Scoutydren https://linux.cn/article-10492-1.html --- ...80814 5 open source strategy and simulation games for Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180814 5 open source strategy and simulation games for Linux.md (100%) diff --git a/translated/tech/20180814 5 open source strategy and simulation games for Linux.md b/published/20180814 5 open source strategy and simulation games for Linux.md similarity index 100% rename from translated/tech/20180814 5 open source strategy and simulation games for Linux.md rename to published/20180814 5 open source strategy and simulation games for Linux.md From 5a080a24807595f17608782ebbbb34e06a138af4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 21:53:10 +0800 Subject: [PATCH 0860/4278] PRF:20181016 Final JOS project.md --- published/20181016 Final JOS project.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20181016 Final JOS project.md b/published/20181016 Final JOS project.md index 92b14d8f97..93358e622a 100644 --- a/published/20181016 Final JOS project.md +++ b/published/20181016 Final JOS project.md @@ -1,4 +1,4 @@ -Caffeinated 6.828:实验 6:最终的 JOS 项目 +Caffeinated 6.828:实验 7:最终的 JOS 项目 ====== ### 简介 From 3bca9d4cb3498e8708f7cae244aa50471637d9cc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 22:16:47 +0800 Subject: [PATCH 0861/4278] PRF:20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @jrglinux 战战兢兢发这篇 @lujun9972 --- ...n a Raspberry Pi 3B- into a PriTunl VPN.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md index a610a2cfbd..c39d7ea46a 100644 --- a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md +++ b/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -1,32 +1,32 @@ [#]: collector: (lujun9972) [#]: translator: (jrglinux) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) [#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) [#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) -将树梅派3B+变为 PriTunl VPN +将树莓派 3B+ 变为 PriTunl VPN ====== -PriTunl 是一种 VPN 解决方案,适用于希望私密的访问其网络的小型企业和个人。 + +> PriTunl 是一种 VPN 解决方案,适用于希望私密的访问其网络的小型企业和个人。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2) -[PriTunl][1] 是一款出色的 VPN 终端解决方案,非常适合希望以简单快捷的方式私密的访问网络的小型企业和个人。 它是开源的,基本的免费版本涵盖最通用的简单的实例,足以让你快速入门。 也有集成 Active Directory 等高级功能的付费企业版 +[PriTunl][1] 是一款出色的 VPN 终端解决方案,非常适合希望以简单快捷的方式私密的访问网络的小型企业和个人。它是开源的,基本的免费版本涵盖最通用的简单的实例,足以让你快速入门。也有集成了活动目录等高级功能的付费企业版。 -### 有关树梅派3B+的特别注意事项 +### 有关树莓派 3B+ 的特别注意事项 -PriTunl 的安装通常也很简单,但要在树梅派3B+上安装 PriTunl 有点小复杂。比如,PriTunl 只提供了 AMD64 和 i386 架构的二进制文件,但树梅派3B+是 ARM 架构的,这意味着需要从源码自行编译可用于树梅派3B+的 PriTunl 可执行文件。不过,无需担心,编译过程很简单,只需花一点时间执行几行命令即可。 +PriTunl 的安装通常也很简单,但要在树莓派 3B+ 上安装 PriTunl 有点小复杂。比如,PriTunl 只提供了 AMD64 和 i386 架构的二进制文件,但树莓派 3B+ 是 ARM 架构的,这意味着需要从源码自行编译可用于树莓派 3B+ 的 PriTunl 可执行文件。不过,无需担心,编译过程很简单,只需花一点时间执行几行命令即可。 -另一个问题:PriTunl 好像必须要是64位处理器架构,当我在32位操作系统上尝试编译的时候报错了。但幸运的是,用于 ARM64 架构的 Ubuntu 18.04 测试版本可以安装在树梅派3B+上。 - -同样,树梅派3B+需要和其他树梅派不同的引导程序。需要一组小复杂的命令来安装更新树梅派3B+上必要的组件。 +另一个问题:PriTunl 好像必须要是 64 位处理器架构,当我在 32 位操作系统上尝试编译的时候报错了。但幸运的是,用于 ARM64 架构的 Ubuntu 18.04 测试版本可以安装在树莓派 3B+ 上。 +同样,树莓派 3B+ 需要和其他树莓派不同的引导程序。需要一组小复杂的命令来安装更新树莓派 3B+ 上必要的组件。 ### 安装 PriTunl -你可以先在树梅派3B+上安装64位的操作系统来避免下面这些问题。此处需要一些必要的基础知识如在树梅派上执行命令行。 +你可以先在树莓派 3B+ 上安装 64 位的操作系统来避免下面这些问题。此处需要一些必要的基础知识如在树莓派上执行命令行。 打开终端,用如下命令下载 Ubuntu 18.04 用于 ARM64 架构的测试版: @@ -40,25 +40,25 @@ $ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstal $ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz ``` -将准备好的 SD 卡插入电脑读卡槽,电脑会为 SD 卡分配一个驱动分配器号,例如 **/dev/sda** 或者 **/dev/sdb**。 输入命令 **dmesg** 然后观察屏幕上的最后几行找到 SD 卡的驱动分配器。 +将准备好的 SD 卡插入电脑读卡槽,电脑会为 SD 卡分配一个驱动分配器号,例如 `/dev/sda` 或者 `/dev/sdb`。 输入命令 `dmesg` 然后观察屏幕上的最后几行找到 SD 卡的驱动分配器。 -**下一步小心操作,如果搞错了驱动分配器号,可能会破坏你的系统** +**下一步小心操作,如果搞错了驱动分配器号,可能会破坏你的系统。** -用如下命令往 SD 卡中写入数据,将其中的 **** 替换成你的 SD 驱动器号。 +用如下命令往 SD 卡中写入数据,将其中的 `` 替换成你的 SD 驱动器号。 ``` $ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of= bs=8M ``` -完成上一步之后,将 SD 卡插入树梅派3B+,并启动它。确保树梅派3B+是连网的,然后登陆系统,用户名/密码:ubuntu/ubuntu。 +完成上一步之后,将 SD 卡插入树莓派 3B+ ,并启动它。确保树莓派 3B+ 是连网的,然后登录系统,用户名/密码:`ubuntu` / `ubuntu`。 -在树梅派上输入以下命令以安装一些准备编译PriTunl的东西: +在树莓派上输入以下命令以安装一些编译 PriTunl 所需的包: ``` $ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb ``` -和 PriTunl 标准源码上的 [安装说明][2] 有一点不一样。确保已经登录进树梅派然后切换到管理员账户: +和 PriTunl 标准源码上的 [安装说明][2] 有一点不一样。确保已经登录进树莓派然后切换到管理员账户: ``` $ sudo su - @@ -86,7 +86,7 @@ pip install -r requirements.txt python2 setup.py install --prefix=/usr/local ``` -现在,不出意外的话应该可以启动 MongoDB 和 PriTunl 系统单元了。假如现在还是以管理员账户登录的话,输入: +现在,不出意外的话应该可以启动 MongoDB 和 PriTunl 的 systemd 单元了。假如现在还是以管理员账户登录的话,输入: ``` systemctl daemon-reload @@ -103,7 +103,7 @@ via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi 作者:[Stephen Bancroft][a] 选题:[lujun9972][b] 译者:[jrg](https://github.com/jrglinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 55f7e7609fb25f874b8b536388266e6fa7213c57 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 22:17:20 +0800 Subject: [PATCH 0862/4278] PUB:20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @jrglinux https://linux.cn/article-10493-1.html --- .../20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md (98%) diff --git a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md similarity index 98% rename from translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md rename to published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md index c39d7ea46a..9baed49a1e 100644 --- a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md +++ b/published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (jrglinux) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10493-1.html) [#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) [#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) [#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) From ed682e17f3914a6d8e4e04fafc1da2219fd69a66 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 30 Jan 2019 22:40:55 +0800 Subject: [PATCH 0863/4278] =?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 --- ...iday calendar at the Linux command line.md | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) rename {sources => translated}/tech/20181207 Plan your own holiday calendar at the Linux command line.md (62%) diff --git a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md similarity index 62% rename from sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md rename to translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md index 9188914bbb..6d959d7339 100644 --- a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md @@ -7,18 +7,18 @@ [#]: via: (https://opensource.com/article/18/12/linux-toy-cal) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -Plan your own holiday calendar at the Linux command line +在 Linux 命令行中规划你的假期日历 ====== -Link commands together to build a colorful calendar, and then whisk it away in a snowstorm. +将命令链接在一起,构建一个彩色日历,然后在暴风雪中将其拂去。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cal.png?itok=S0F8RY9k) -Welcome to today's installment of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game or any simple diversion that helps you have fun at the terminal. +欢迎阅读今天推出的 Linux 命令行玩具降临日历。如果这是你第一次访问本系列,你可能会问:什么是命令行玩具。即使我不太确定,但一般来说,它可以是一个游戏或任何简单的娱乐,可以帮助你在终端玩得开心。 -It's quite possible that some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. +很可能你们中的一些人之前已经看过我们日历上的各种选择,但我们希望给每个人至少一件新东西。 -We've somehow made it to the seventh day of our series without creating an actual calendar to celebrate with, so let's use a command-line tool to do that today: **cal**. By itself, **cal** is perhaps not the most amazing of tools, but we can use a few other utilities to spice it up a bit. +我们在没有创建实际日历的情况下完成了本系列的第 7 天,所以今天让我们使用命令行工具来做到这一点:**cal**。就其本身而言,**cal** 可能不是最令人惊奇的工具,但我们可以使用其它一些实用程序来为它增添一些趣味。 -Chances are, **cal** is installed on your system already. To use it in this instance, just type **cal**. +很可能,你的系统上已经安装了 **cal**。要使用它,只需要输入 **cal** 即可。 ``` $ cal @@ -32,9 +32,10 @@ Su Mo Tu We Th Fr Sa 30 31           ``` -We aren't going to go into advanced usage in this article, so if you want to learn more about **cal** , go check out Opensource.com Community Moderator Don Watkin's excellent [overview of the date and cal commands][1]. +我们不打算在本文中深入介绍高级用法,因此如果你想了解有关 **cal** 的更多信息,查看 Opensouce.com 社区版主 Don Watkin 的优秀文章 [date 和 cal 命令概述][1]。 + +现在,让我们用一个漂亮的盒子来为它增添趣味,就像我们在上一篇 Linux 玩具文章中介绍的那样。我将使用钻石块,用一点内边距来对齐。 -Now, let's spice it up with a pretty box, as we covered in our previous Linux toy article. I'll use the diamonds box, and use a little bit of padding to get it nicely aligned. ``` $ cal | boxes -d diamonds -p a1l4t2  @@ -60,7 +61,7 @@ $ cal | boxes -d diamonds -p a1l4t2         \/          \/          \/ ``` -That looks nice, but for good measure, let's put the whole thing in a second box, just for fun. We'll use the scoll design this time. +看起来很不错,但是为了好的测量,让我们把整个东西放到另一个盒子里,为了好玩,这次我们将使用滚动设计。 ``` cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll         @@ -92,25 +93,25 @@ cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll            ~~~                                                ~~~ ``` -Perfect. Now, here's where things get a little crazy. I like our design, but, I'd like to go all out. So I'm going to colorize it. But here in the Raleigh, NC office where Opensource.com's staff are based, there's a good chance for snow this weekend. So let's enjoy our colorized advent calendar, and then wipe it out with snow. +完美。现在,事情变得有点疯狂了。我喜欢我们的设计,但我想全力以赴,所以我要给它上色。但是 Opensource.com 员工所在的北卡罗来版纳州罗利办公室,本周末很有可能下雪。所以,让我们享受彩色降临日历,然后用雪擦掉它。 -For the snow, I'm grabbing a nifty [snippet][2] of Bash and Gawk goodness I found over on CLIMagic. If you're not familiar with CLIMagic, go check out their [website][3] and follow them on [Twitter][4]. You'll be glad you did. +关于雪,我抓取了一些 Bash 和 Gawk 的漂亮[代码片段][2],幸亏我发现了 CLIMagic。如果你不熟悉 CLIMagic,去查看他们的[网站][3],在 [Twitter][4] 上关注他们。你会满意的。 -So here we go. Let's clear the screen, throw up our boxy calendar, colorize it, wait a few seconds, then snowstorm it away. All here at the terminal, in one line. +我们开始吧。让我们清除屏幕,扔掉四四方方的日历,给它上色,等几秒钟,然后用暴风雪把它吹走。这些在终端可以用一行命令完成。 ``` $ clear;cal|boxes -d diamonds -p a1t2l3|boxes -a c -d scroll|lolcat;sleep 3;while :;do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS)) $(printf "\u2744\n");sleep 0.1;done|gawk '{a[$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH ",o,x;printf "\033[%s;%sH%s \033[0;0H",a[x],x,$4;}}' ``` -And there we go. +大功告成。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-cal-animated.gif) -For this to work on your system, you'll need all of the referenced utilities (boxes, lolcat, cal, gawk, etc.), and you'll need to use a terminal emulator that supports Unicode. +要使它在你的系统上工作,你需要所有它引用的实用程序(box, lolcat, gawk 等),还需要使用支持 Unicode 的终端仿真器。 -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 -Check out yesterday's toy, [Take a break at the Linux command line with Nyan Cat][5], and check back tomorrow for another! +看看昨天的玩具:[使用 Nyan Cat 在 Linux 命令行休息][5]。记得明天再来! -------------------------------------------------------------------------------- @@ -118,7 +119,7 @@ via: https://opensource.com/article/18/12/linux-toy-cal 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[MjSeven](https://github.com/MjSeven) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a5824262594760241113773520b088b1640b1646 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Wed, 30 Jan 2019 17:00:24 +0000 Subject: [PATCH 0864/4278] =?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 102c89d8621e0d376c3fb053b53f3c6d5c0f5410. --- sources/tech/20180914 A day in the life of a log message.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/tech/20180914 A day in the life of a log message.md b/sources/tech/20180914 A day in the life of a log message.md index cc6ebd0f5b..8d60ec9fe6 100644 --- a/sources/tech/20180914 A day in the life of a log message.md +++ b/sources/tech/20180914 A day in the life of a log message.md @@ -1,4 +1,3 @@ -Ryze-Borgia is translating A day in the life of a log message ====== From 516a5d32d4d29a4015f79cd0b7fdac98cea5ac1b Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:42:41 +0800 Subject: [PATCH 0865/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180507=20Modu?= =?UTF-8?q?larity=20in=20Fedora=2028=20Server=20Edition=20sources/tech/201?= =?UTF-8?q?80507=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 f9c3542ec172e24ba91bfb634b7a7ba8f538fa20 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:44:53 +0800 Subject: [PATCH 0866/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180129=20Tips?= =?UTF-8?q?=20and=20tricks=20for=20using=20CUPS=20for=20printing=20with=20?= =?UTF-8?q?Linux=20sources/tech/20180129=20Tips=20and=20tricks=20for=20usi?= =?UTF-8?q?ng=20CUPS=20for=20printing=20with=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... for using CUPS for printing with Linux.md | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md diff --git a/sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md b/sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md new file mode 100644 index 0000000000..f676b0efb9 --- /dev/null +++ b/sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tips and tricks for using CUPS for printing with Linux) +[#]: via: (https://opensource.com/article/19/1/cups-printing-linux) +[#]: author: (Antoine Thomas https://opensource.com/users/ttoine) + +Tips and tricks for using CUPS for printing with Linux +====== +One of Apple's most important contributions to GNU/Linux was adopting CUPS in Mac OS X. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ) + +Did you ever try to configure a printer on a GNU/Linux desktop distribution at the end of the '90s? Or even before? + +To make a long story short: That was fine if you worked at a large organization with an IT team to handle it and dedicated hardware or a printing server. There were many different standards and protocols to handle printers. And only a few big vendors (usually Unix vendors) provided specific support and drivers for their entire range of products. + +However, if open source enthusiasts wanted a home printer that would work with their favorite distribution, that was another story. They probably spent a fair amount of time on forums, newsgroups, or IRC (remember those ancestors of social networks and chats?) asking about printers with easy-to-install Linux drivers. + +In 1999, the first version of [CUPS][1] (the Common Unix Printing System) was released by Easy Software Products. Most of the most popular distributions at the time adopted CUPS as their default printing system. That was a huge success: one standard could handle many printers and protocols. + +But if the printer vendor didn't provide a CUPS driver, it was still tricky or impossible to make it work. Some smart people might do reverse engineering. And a few printers, with native support of PostScript and Internet Printing Protocol (IPP), worked "out of the box." + +### Then came Apple + +In the early 2000s, Apple was struggling to build a new printing system for its new Mac OS X. In March 2002, it decided to save time by adopting CUPS for its flagship operating system. + +No printer vendor could ignore Apple computers' market share, so a lot of new printer drivers for Mac OS X's CUPS became available, spanning most vendors and product ranges, including corporate, graphic arts, consumer, and photo printing. + +CUPS became so important for Apple that it bought the software from Easy Software Products in 2007; since then Apple has continued to maintain it and manage its intellectual property. + +### But what does that have to do with GNU/Linux? + +At the time Apple integrated CUPS in Mac OS X, it was already used by default in many distros and available for most others. But few dedicated drivers were available, meaning they were not packaged or listed as "for GNU/Linux." + +However, once CUPS drivers were available for Mac OS X, a simple hack became popular with GNU/Linux enthusiasts: download the Mac driver, extract the PPD files, and test them with your printer. I used this hack many times with my Epson printers. + +That's the CUPS magic: If a driver exists, it usually works with all operating systems that use CUPS for printing, as long as they use a supported protocol (like IPP). + +That's how printer drivers began to be available for GNU/Linux. + +### Nowadays + +Afterward, printer vendors realized it was quite easy to provide drivers for GNU/Linux since they already developed them for Mac. It's now easy to find a GNU/Linux driver for a printer, even a newer one. Some distributions include packages with a lot of drivers, and most vendors provide dedicated drivers—sometimes via a package, other times with PPD files in an archive. + +Advanced control applications are available too, some official, some not, which make it possible (for example) to look at ink levels or clean printing heads. + +In some cases, installing a printer on GNU/Linux is even easier than on other operating systems, particularly with distributions using [zero-configuration networking][2] (e.g., Bonjour, Avahi) to auto-discover and share network printers. + +### Tips and tricks + + * **Install a PDF printer:** Installing a PDF printer on GNU/Linux is very easy. Just look for the **cups-pdf** package in your favorite distribution and install it. If the package doesn't automatically create the PDF printer, you can add one using your system preferences to print in PDF from any application. + + * **Access the CUPS web interface:** If your usual interface for managing printers doesn't work or you don't like it, open a web browser and go to . You can manage all the printers installed on your computer, adjust their settings, and even add new ones—all from this web interface. Note that this might be available on other computers on your network; if so, replace "localhost" with the relevant hostname or IP address. + + * **Check ink level:** If you have an Epson, Canon, HP, or Sony printer, you can see its ink level with a simple application. Look for the "ink" package in your distribution repositories. + + * **Contribute to CUPS:** Like many open source project, CUPS is maintained on GitHub. Check the [CUPS website][1] and [GitHub issues][3] to find out how you can contribute to improving it. + + + + +### CUPS license + +Originally, CUPS was released under GPLv2. I'm not sure why; maybe to make it easier to distribute with GNU/Linux. Or maybe it was just what most open source projects did at the time. + +Apple decided to [change the license][4] in November 2017 to the Apache 2.0 license. Many observers commented that it was consistent with Apple's strategy to move the IP of its open source projects to more business-compliant licenses. + +While this change could create issues with shipping CUPS with GNU/Linux, it is still available in most distributions. + +### Happy 20th birthday, CUPS! + +CUPS was released in 1999, so, let's celebrate and thank all the people involved in this successful open source project, from the original authors to the driver developers to its current maintainers. + +The next time you print with your favorite GNU/Linux operating system, remind yourself to say "thank you" to Apple. + +The company isn't well known for its contributions to open source. But if you look carefully (at, for example, [Apple's Open Source Releases][5] and [Open Source Development][6] pages), you'll see how many open source components are in Apple's operating systems and applications. + +You'll also discover other important open source projects Apple kicked off. For example, it forked KHTML, the KDE browser, to create [WebKit][7] for the Safari Browser. Wait, THE WebKit? Yes, Apple initiated WebKit. But that is another story... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/cups-printing-linux + +作者:[Antoine Thomas][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ttoine +[b]: https://github.com/lujun9972 +[1]: https://www.cups.org/ +[2]: https://en.wikipedia.org/wiki/Zero-configuration_networking#Major_implementations +[3]: https://github.com/apple/cups/issues +[4]: https://www.cups.org/blog/2017-11-07-cups-license-change.html +[5]: https://opensource.apple.com/ +[6]: https://developer.apple.com/opensource/ +[7]: https://webkit.org/ From 3b2120ebef743c98d8312a0a4d0d70eebd900f05 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:47:37 +0800 Subject: [PATCH 0867/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=207=20?= =?UTF-8?q?Methods=20To=20Identify=20Disk=20Partition/FileSystem=20UUID=20?= =?UTF-8?q?On=20Linux=20sources/tech/20190129=207=20Methods=20To=20Identif?= =?UTF-8?q?y=20Disk=20Partition-FileSystem=20UUID=20On=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Disk Partition-FileSystem UUID On Linux.md | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 sources/tech/20190129 7 Methods To Identify Disk Partition-FileSystem UUID On Linux.md diff --git a/sources/tech/20190129 7 Methods To Identify Disk Partition-FileSystem UUID On Linux.md b/sources/tech/20190129 7 Methods To Identify Disk Partition-FileSystem UUID On Linux.md new file mode 100644 index 0000000000..366e75846d --- /dev/null +++ b/sources/tech/20190129 7 Methods To Identify Disk Partition-FileSystem UUID On Linux.md @@ -0,0 +1,159 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Methods To Identify Disk Partition/FileSystem UUID On Linux) +[#]: via: (https://www.2daygeek.com/check-partitions-uuid-filesystem-uuid-universally-unique-identifier-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +7 Methods To Identify Disk Partition/FileSystem UUID On Linux +====== + +As a Linux administrator you should aware of that how do you check partition UUID or filesystem UUID. + +Because most of the Linux systems are mount the partitions with UUID. The same has been verified in the `/etc/fstab` file. + +There are many utilities are available to check UUID. In this article we will show you how to check UUID in many ways and you can choose the one which is suitable for you. + +### What Is UUID? + +UUID stands for Universally Unique Identifier which helps Linux system to identify a hard drives partition instead of block device file. + +libuuid is part of the util-linux-ng package since kernel version 2.15.1 and it’s installed by default in Linux system. + +The UUIDs generated by this library can be reasonably expected to be unique within a system, and unique across all systems. + +It’s a 128 bit number used to identify information in computer systems. UUIDs were originally used in the Apollo Network Computing System (NCS) and later UUIDs are standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE). + +UUIDs are represented as 32 hexadecimal (base 16) digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four hyphens). + +For example: d92fa769-e00f-4fd7-b6ed-ecf7224af7fa + +Sample of my /etc/fstab file. + +``` +# cat /etc/fstab + +# /etc/fstab: static file system information. +# +# Use 'blkid' to print the universally unique identifier for a device; this may +# be used with UUID= as a more robust way to name devices that works even if +# disks are added and removed. See fstab(5). +# +# +UUID=69d9dd18-36be-4631-9ebb-78f05fe3217f / ext4 defaults,noatime 0 1 +UUID=a2092b92-af29-4760-8e68-7a201922573b swap swap defaults,noatime 0 2 +``` + +We can check this using the following seven commands. + + * **`blkid Command:`** locate/print block device attributes. + * **`lsblk Command:`** lsblk lists information about all available or the specified block devices. + * **`hwinfo Command:`** hwinfo stands for hardware information tool is another great utility that used to probe for the hardware present in the system. + * **`udevadm Command:`** udev management tool. + * **`tune2fs Command:`** adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems. + * **`dumpe2fs Command:`** dump ext2/ext3/ext4 filesystem information. + * **`Using by-uuid Path:`** The directory contains UUID and real block device files, UUIDs were symlink with real block device files. + + + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing 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 Disk Partition/FileSystem UUID In Linux Uusing 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 -o name,mountpoint,size,uuid +NAME MOUNTPOINT SIZE UUID +sda 30G +└─sda1 / 20G d92fa769-e00f-4fd7-b6ed-ecf7224af7fa +sdb 10G +sdc 10G +├─sdc1 1G d17e3c31-e2c9-4f11-809c-94a549bc43b7 +├─sdc3 1G ca307aa4-0866-49b1-8184-004025789e63 +├─sdc4 1K +└─sdc5 1G +sdd 10G +sde 10G +sr0 1024M +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing by-uuid path? + +The directory contains UUID and real block device files, UUIDs were symlink with real block device files. + +``` +# ls -lh /dev/disk/by-uuid/ +total 0 +lrwxrwxrwx 1 root root 10 Jan 29 08:34 ca307aa4-0866-49b1-8184-004025789e63 -> ../../sdc3 +lrwxrwxrwx 1 root root 10 Jan 29 08:34 d17e3c31-e2c9-4f11-809c-94a549bc43b7 -> ../../sdc1 +lrwxrwxrwx 1 root root 10 Jan 29 08:34 d92fa769-e00f-4fd7-b6ed-ecf7224af7fa -> ../../sda1 +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing hwinfo Command? + +**[hwinfo][1]** 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 | grep by-uuid | awk '{print $3,$7}' +/dev/sdc1, /dev/disk/by-uuid/d17e3c31-e2c9-4f11-809c-94a549bc43b7 +/dev/sdc3, /dev/disk/by-uuid/ca307aa4-0866-49b1-8184-004025789e63 +/dev/sda1, /dev/disk/by-uuid/d92fa769-e00f-4fd7-b6ed-ecf7224af7fa +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing udevadm Command? + +udevadm expects a command and command specific options. It controls the runtime behavior of systemd-udevd, requests kernel events, manages the event queue, and provides simple debugging mechanisms. + +``` +udevadm info -q all -n /dev/sdc1 | grep -i by-uuid | head -1 +S: disk/by-uuid/d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing tune2fs Command? + +tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2, ext3, or ext4 filesystems. The current values of these options can be displayed by using the -l option. + +``` +# tune2fs -l /dev/sdc1 | grep UUID +Filesystem UUID: d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing dumpe2fs Command? + +dumpe2fs prints the super block and blocks group information for the filesystem present on device. + +``` +# dumpe2fs /dev/sdc1 | grep UUID +dumpe2fs 1.43.5 (04-Aug-2017) +Filesystem UUID: d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/check-partitions-uuid-filesystem-uuid-universally-unique-identifier-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/hwinfo-check-display-detect-system-hardware-information-linux/ From ea5483292c08362ccef1faa70a224751cb253ae2 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:53:16 +0800 Subject: [PATCH 0868/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=20How?= =?UTF-8?q?=20To=20Configure=20System-wide=20Proxy=20Settings=20Easily=20A?= =?UTF-8?q?nd=20Quickly=20sources/tech/20190129=20How=20To=20Configure=20S?= =?UTF-8?q?ystem-wide=20Proxy=20Settings=20Easily=20And=20Quickly.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-wide Proxy Settings Easily And Quickly.md | 309 ++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 sources/tech/20190129 How To Configure System-wide Proxy Settings Easily And Quickly.md diff --git a/sources/tech/20190129 How To Configure System-wide Proxy Settings Easily And Quickly.md b/sources/tech/20190129 How To Configure System-wide Proxy Settings Easily And Quickly.md new file mode 100644 index 0000000000..0848111d08 --- /dev/null +++ b/sources/tech/20190129 How To Configure System-wide Proxy Settings Easily And Quickly.md @@ -0,0 +1,309 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Configure System-wide Proxy Settings Easily And Quickly) +[#]: via: (https://www.ostechnix.com/how-to-configure-system-wide-proxy-settings-easily-and-quickly/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Configure System-wide Proxy Settings Easily And Quickly +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/ProxyMan-720x340.png) + +Today, we will be discussing a simple, yet useful command line utility named **“ProxyMan”**. As the name says, it helps you to apply and manage proxy settings on our system easily and quickly. Using ProxyMan, we can set or unset proxy settings automatically at multiple points, without having to configure them manually one by one. It also allows you to save the settings for later use. In a nutshell, ProxyMan simplifies the task of configuring system-wide proxy settings with a single command. It is free, open source utility written in **Bash** and standard POSIX tools, no dependency required. ProxyMan can be helpful if you’re behind a proxy server and you want to apply the proxy settings system-wide in one go. + +### Installing ProxyMan + +Download the latest ProxyMan version from the [**releases page**][1]. It is available as zip and tar file. I am going to download zip file. + +``` +$ wget https://github.com/himanshub16/ProxyMan/archive/v3.1.1.zip +``` + +Extract the downloaded zip file: + +``` +$ unzip v3.1.1.zip +``` + +The above command will extract the contents in a folder named “ **ProxyMan-3.1.1** ” in your current working directory. Cd to that folder and install ProxyMan as shown below: + +``` +$ cd ProxyMan-3.1.1/ + +$ ./install +``` + +If you see **“Installed successfully”** message as output, congratulations! ProxyMan has been installed. + +Let us go ahead and see how to configure proxy settings. + +### Configure System-wide Proxy Settings + +ProxyMan usage is pretty simple and straight forward. Like I already said, It allows us to set/unset proxy settings, list current proxy settings, list available configs, save settings in a profile and load profile later. Proxyman currently manages proxy settings for **GNOME gsettings** , **bash** , **apt** , **dnf** , **git** , **npm** and **Dropbox**. + +**Set proxy settings** + +To set proxy settings system-wide, simply run: + +``` +$ proxyman set +``` + +You will asked to answer a series of simple questions such as, + + 1. HTTP Proxy host IP address, + 2. HTTP port, + 3. Use username/password authentication, + 4. Use same settings for HTTPS and FTP, + 5. Save profile for later use, + 6. Finally, choose the list of targets to apply the proxy settings. You can choose all at once or separate multiple choices with space. + + + +Sample output for the above command: + +``` +Enter details to set proxy +HTTP Proxy Host 192.168.225.22 +HTTP Proxy Port 8080 +Use auth - userid/password (y/n)? n +Use same for HTTPS and FTP (y/n)? y +No Proxy (default localhost,127.0.0.1,192.168.1.1,::1,*.local) +Save profile for later use (y/n)? y +Enter profile name : proxy1 +Saved to /home/sk/.config/proxyman/proxy1. + +Select targets to modify +| 1 | All of them ... Don't bother me +| 2 | Terminal / bash / zsh (current user) +| 3 | /etc/environment +| 4 | apt/dnf (Package manager) +| 5 | Desktop settings (GNOME/Ubuntu) +| 6 | npm & yarn +| 7 | Dropbox +| 8 | Git +| 9 | Docker + +Separate multiple choices with space +? 1 +Setting proxy... +To activate in current terminal window +run source ~/.bashrc +[sudo] password for sk: +Done +``` + +**List proxy settings** + +To view the current proxy settings, run: + +``` +$ proxyman list +``` + +Sample output: + +``` +Hmm... listing it all + +Shell proxy settings : /home/sk/.bashrc +export http_proxy="http://192.168.225.22:8080/" +export ftp_proxy="ftp://192.168.225.22:8080/" +export rsync_proxy="rsync://192.168.225.22:8080/" +export no_proxy="localhost,127.0.0.1,192.168.1.1,::1,*.local" +export HTTP_PROXY="http://192.168.225.22:8080/" +export FTP_PROXY="ftp://192.168.225.22:8080/" +export RSYNC_PROXY="rsync://192.168.225.22:8080/" +export NO_PROXY="localhost,127.0.0.1,192.168.1.1,::1,*.local" +export https_proxy="/" +export HTTPS_PROXY="/" + +git proxy settings : +http http://192.168.225.22:8080/ +https https://192.168.225.22:8080/ + +APT proxy settings : +3 +Done +``` + +**Unset proxy settings** + +To unset proxy settings, the command would be: + +``` +$ proxyman unset +``` + +You can unset proxy settings for all targets at once by entering number **1** or enter any given number to unset proxy settings for the respective target. + +``` +Select targets to modify +| 1 | All of them ... Don't bother me +| 2 | Terminal / bash / zsh (current user) +| 3 | /etc/environment +| 4 | apt/dnf (Package manager) +| 5 | Desktop settings (GNOME/Ubuntu) +| 6 | npm & yarn +| 7 | Dropbox +| 8 | Git +| 9 | Docker + +Separate multiple choices with space +? 1 +Unset all proxy settings +To activate in current terminal window +run source ~/.bashrc +Done +``` + +To apply the changes, simply run: + +``` +$ source ~/.bashrc +``` + +On ZSH, use this command instead: + +``` +$ source ~/.zshrc +``` + +To verify if the proxy settings have been removed, simply run “proxyman list” command: + +``` +$ proxyman list +Hmm... listing it all + +Shell proxy settings : /home/sk/.bashrc +None + +git proxy settings : +http +https + +APT proxy settings : +None +Done +``` + +As you can see, there is no proxy settings for all targets. + +**View list of configs (profiles)** + +Remember we saved proxy settings as a profile in the “Set proxy settings” section? You can view the list of available profiles with command: + +``` +$ proxyman configs +``` + +Sample output: + +``` +Here are available configs! +proxy1 +Done +``` + +As you can see, we have only one profile i.e **proxy1**. + +**Load profiles** + +The profiles will be available until you delete them permanently, so you can load a profile (E.g proxy1) at any time using command: + +``` +$ proxyman load proxy1 +``` + +This command will list the proxy settings for proxy1 profile. You can apply these settings to all or multiple targets by entering the respective number with space-separated. + +``` +Loading profile : proxy1 +HTTP > 192.168.225.22 8080 +HTTPS > 192.168.225.22 8080 +FTP > 192.168.225.22 8080 +no_proxy > localhost,127.0.0.1,192.168.1.1,::1,*.local +Use auth > n +Use same > y +Config > +Targets > +Select targets to modify +| 1 | All of them ... Don't bother me +| 2 | Terminal / bash / zsh (current user) +| 3 | /etc/environment +| 4 | apt/dnf (Package manager) +| 5 | Desktop settings (GNOME/Ubuntu) +| 6 | npm & yarn +| 7 | Dropbox +| 8 | Git +| 9 | Docker + +Separate multiple choices with space +? 1 +Setting proxy... +To activate in current terminal window +run source ~/.bashrc +Done +``` + +Finally, activate the changes using command: + +``` +$ source ~/.bashrc +``` + +For ZSH: + +``` +$ source ~/.zshrc +``` + +**Deleting profiles** + +To delete a profile, run: + +``` +$ proxyman delete proxy1 +``` + +Output: + +``` +Deleting profile : proxy1 +Done +``` + +To display help, run: + +``` +$ proxyman help +``` + + +### Conclusion + +Before I came to know about Proxyman, I used to apply proxy settings manually at multiple places, for example package manager, web browser etc. Not anymore! ProxyMan did this job automatically in couple seconds. + +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-configure-system-wide-proxy-settings-easily-and-quickly/ + +作者:[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://github.com/himanshub16/ProxyMan/releases/ From 72f5dcccde89be61ce3bfadbd3f89678c0b4283b Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:56:46 +0800 Subject: [PATCH 0869/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180128=20Get?= =?UTF-8?q?=20started=20with=20Org=20mode=20without=20Emacs=20sources/tech?= =?UTF-8?q?/20180128=20Get=20started=20with=20Org=20mode=20without=20Emacs?= =?UTF-8?q?.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Get started with Org mode without Emacs.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..75a5bcb092 --- /dev/null +++ b/sources/tech/20180128 Get started with Org mode without Emacs.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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] +译者:[译者ID](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://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 7b675e456bf11a82362edd4b3ef1d511edc5d37f Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 10:07:17 +0800 Subject: [PATCH 0870/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190128=203=20?= =?UTF-8?q?simple=20and=20useful=20GNOME=20Shell=20extensions=20sources/te?= =?UTF-8?q?ch/20190128=203=20simple=20and=20useful=20GNOME=20Shell=20exten?= =?UTF-8?q?sions.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...imple and useful GNOME Shell extensions.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20190128 3 simple and useful GNOME Shell extensions.md diff --git a/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md b/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md new file mode 100644 index 0000000000..c22feddf01 --- /dev/null +++ b/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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/) + +3 simple and useful GNOME Shell extensions +====== + +![](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. + + +### 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: + +![](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. + +![][3] +Removable Drive Menu in the Software application + +### Extensions Extension. + +![][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. + +![][6] +the Extensions extension in the Software application + +### 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. + +![][9] + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/ + +作者:[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/01/removable-disk-1024x459.jpg +[2]: https://extensions.gnome.org/extension/7/removable-drive-menu/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/01/removable-software-1024x723.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/extensions-extension-1024x459.jpg +[5]: https://extensions.gnome.org/extension/1036/extensions/ +[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/extensions-software-1024x723.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/01/move_clock-1024x189.jpg +[8]: https://extensions.gnome.org/extension/2/move-clock/ +[9]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-28-21-53-18-1024x723.png From 96a36a45bf938f64920bb579be1495552a55039c Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 10:08:56 +0800 Subject: [PATCH 0871/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190128=20fdis?= =?UTF-8?q?k=20=E2=80=93=20Easy=20Way=20To=20Manage=20Disk=20Partitions=20?= =?UTF-8?q?In=20Linux=20sources/tech/20190128=20fdisk=20-=20Easy=20Way=20T?= =?UTF-8?q?o=20Manage=20Disk=20Partitions=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Way To Manage Disk Partitions In Linux.md | 524 ++++++++++++++++++ 1 file changed, 524 insertions(+) create mode 100644 sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md diff --git a/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md b/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md new file mode 100644 index 0000000000..cc89e8c7f1 --- /dev/null +++ b/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md @@ -0,0 +1,524 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (fdisk – Easy Way To Manage Disk Partitions In Linux) +[#]: via: (https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +fdisk – Easy Way To Manage Disk Partitions In Linux +====== + +Hard disks can be divided into one or more logical disks called partitions. + +This division is described in the partition table (MBR or GPT) found in sector 0 of the disk. + +Linux needs at least one partition, namely for its root file system and we can’t install Linux OS without partitions. + +Once created, a partition must be formatted with an appropriate file system before files can be written to it. + +To do so, we need some utility to perform this in Linux. + +There are many utilities are available for that in Linux. We had written about **[Parted Command][1]** in the past and today we are going to discuss about fdisk. + +fdisk command is one of the the best tool to manage disk partitions in Linux. + +It supports maximum `2 TB`, and everyone prefer to go with fdisk. + +This tool is used by vast of Linux admin because we don’t use more than 2TB now a days due to LVM and SAN. It’s used in most of the infra structure around the world. + +Still if you want to create a large partitions, like more than 2TB then you have to go either **Parted Command** or **cfdisk Command**. + +Disk partition and file system creations is one of the routine task for Linux admin. + +If you are working on vast environment then you have to perform this task multiple times in a day. + +### How Linux Kernel Understand Hard Disks? + +As a human we can easily understand things but computer needs the proper naming conversion to understand each and everything. + +In Linux, devices are located on `/dev` partition and Kernel understand the hard disk in the following format. + + * **`/dev/hdX[a-z]:`** IDE Disk is named hdX in Linux + * **`/dev/sdX[a-z]:`** SCSI Disk is named sdX in Linux + * **`/dev/xdX[a-z]:`** XT Disk is named sdX in Linux + * **`/dev/vdX[a-z]:`** Virtual Hard Disk is named vdX in Linux + * **`/dev/fdN:`** Floppy Drive is named fdN in Linux + * **`/dev/scdN or /dev/srN:`** CD-ROM is named /dev/scdN or /dev/srN in Linux + + + +### What Is fdisk Command? + +fdisk 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. + +It understands MBR, Sun, SGI and BSD partition tables and it doesn’t understand GUID Partition Table (GPT) and it is not designed for large partitions. + +fdisk allows us to create a maximum of four primary partitions per disk. One of these may be an extended partition and it holds multiple logical partitions. + +1-4 is reserved for four primary partitions and Logical partitions start numbering from 5. +![][3] + +### How To Install fdisk On Linux + +You don’t need to install fdisk in Linux system because it has installed by default as part of core utility. + +### How To List Available Disks Using fdisk Command + +First we have to know what are the disks were added in the system before performing any action. To list all available disks on your system run the following command. + +It lists possible information about the disks such as disk name, how many partitions are created in it, Disk Size, Disklabel type, Disk Identifier, Partition ID and Partition Type. + +``` +$ sudo 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 + + +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 List A Specific Disk Partitions Using fdisk Command + +If you would like to see a specific disk and it’s partitions, use the following format. + +``` +$ sudo fdisk -l /dev/sda +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 +``` + +### How To List Available Actions For fdisk Command + +When you hit `m` in the fdisk command that will show you available actions for fdisk command. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Device does not contain a recognized partition table. +Created a new DOS disklabel with disk identifier 0xe944b373. + +Command (m for help): m + +Help: + + DOS (MBR) + a toggle a bootable flag + b edit nested BSD disklabel + c toggle the dos compatibility flag + + Generic + d delete a partition + F list free unpartitioned space + l list known partition types + n add a new partition + p print the partition table + t change a partition type + v verify the partition table + i print information about a partition + + Misc + m print this menu + u change display/entry units + x extra functionality (experts only) + + Script + I load disk layout from sfdisk script file + O dump disk layout to sfdisk script file + + Save & Exit + w write table to disk and exit + q quit without saving changes + + Create a new label + g create a new empty GPT partition table + G create a new empty SGI (IRIX) partition table + o create a new empty DOS partition table + s create a new empty Sun partition table +``` + +### How To List Partitions Types Using fdisk Command + +When you hit `l` in the fdisk command that will show you an available partitions type for fdisk command. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Device does not contain a recognized partition table. +Created a new DOS disklabel with disk identifier 0x9ffd00db. + +Command (m for help): l + + 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris + 1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- + 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- + 3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT- + 4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx + 5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data + 6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / . + 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility + 8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt + 9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access + a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O + b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor + c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment + e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs + f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT +10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/ +11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b +12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor +14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor +16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary +17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS +18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE +1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto +1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep +1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT +``` + +### How To Create A Disk Partition Using fdisk Command + +If you would like to create a new partition use the following steps. In my case, i'm going to create 4 partitions (3 Primary and 1 Extended) on `/dev/sdc` disk. To the same for other partitions too. + +As this takes value from partition table so, hit `Enter` for first sector. Enter the size which you want to set for the partition (We can add a partition size using KB,MB,G and TB) for last sector. + +For example, if you would like to add 1GB partition then the last sector value should be `+1G`. Once you have created 3 partitions, it will automatically change the partition type to extended as a default. If you still want to create a fourth primary partitions then hit `p` instead of default value `e`. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + + +Command (m for help): n +Partition type + p primary (0 primary, 0 extended, 4 free) + e extended (container for logical partitions) +Select (default p): Enter + +Using default response p. +Partition number (1-4, default 1): Enter +First sector (2048-20971519, default 2048): Enter +Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519): +1G + +Created a new partition 1 of type 'Linux' and of size 1 GiB. + +Command (m for help): p +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 + +Command (m for help): w +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +### How To Create A Extended Disk Partition Using fdisk Command + +Make a note, you have to use remaining all space when you create a extended partition because again you can able to create multiple logical partition in that. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + + +Command (m for help): n +Partition type + p primary (3 primary, 0 extended, 1 free) + e extended (container for logical partitions) +Select (default e): Enter + +Using default response e. +Selected partition 4 +First sector (6293504-20971519, default 6293504): Enter +Last sector, +sectors or +size{K,M,G,T,P} (6293504-20971519, default 20971519): Enter + +Created a new partition 4 of type 'Extended' and of size 7 GiB. + +Command (m for help): p +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/sdc2 2099200 4196351 2097152 1G 83 Linux +/dev/sdc3 4196352 6293503 2097152 1G 83 Linux +/dev/sdc4 6293504 20971519 14678016 7G 5 Extended + +Command (m for help): w +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +### How To View Unpartitioned Disk Space Using fdisk Command + +As described in the above section, we have totally created 4 partitions (3 Primary and 1 Extended). Extended partition disk space will show unpartitioned until you create a logical partitions in that. + +Use the following command to view the unpartitioned space for a disk. As per the below output we have `7GB` unpartitioned disk. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + + +Command (m for help): F +Unpartitioned space /dev/sdc: 7 GiB, 7515144192 bytes, 14678016 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 + + Start End Sectors Size +6293504 20971519 14678016 7G + +Command (m for help): q +``` + +### How To Create A Logical Partition Using fdisk Command + +Follow the same above procedure to create a logical partition once you have created the extended partition. +Here, i have created `1GB` of logical partition called `/dev/sdc5`, you can double confirm this by checking the partition table value. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Command (m for help): n +All primary partitions are in use. +Adding logical partition 5 +First sector (6295552-20971519, default 6295552): Enter +Last sector, +sectors or +size{K,M,G,T,P} (6295552-20971519, default 20971519): +1G + +Created a new partition 5 of type 'Linux' and of size 1 GiB. + +Command (m for help): p +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/sdc2 2099200 4196351 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 + +Command (m for help): w +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +### How To Delete A Partition Using fdisk Command + +If the partition is no more used in the system than we can remove it by using the below steps. + +Make sure you have to enter the correct partition number to delete it. In this case, i'm going to remove `/dev/sdc2` partition. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + + +Command (m for help): d +Partition number (1-5, default 5): 2 + +Partition 2 has been deleted. + +Command (m for help): p +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 + +Command (m for help): w +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +### How To Format A Partition Or Create A FileSystem On The Partition + +In computing, a file system or filesystem controls how data is stored and retrieved through inode tables. + +Without a file system, the system can't find where the information is stored on the partition. Filesystem can be created in three ways. Here, i'm going to create a filesystem on `/dev/sdc1` partition. + +``` +$ sudo mkfs.ext4 /dev/sdc1 +or +$ sudo mkfs -t ext4 /dev/sdc1 +or +$ sudo mke2fs /dev/sdc1 + +mke2fs 1.43.5 (04-Aug-2017) +Creating filesystem with 262144 4k blocks and 65536 inodes +Filesystem UUID: c0a99b51-2b61-4f6a-b960-eb60915faab0 +Superblock backups stored on blocks: + 32768, 98304, 163840, 229376 + +Allocating group tables: done +Writing inode tables: done +Creating journal (8192 blocks): done +Writing superblocks and filesystem accounting information: done +``` + +When you creating a filesystem on tha partition that will create the following important things on it. + + * **`Filesystem UUID:`** UUID stands for Universally Unique Identifier, UUIDs are used to identify block devices in Linux. It's 128 bit long numbers represented by 32 hexadecimal digits. + * **`Superblock:`** Superblock stores metadata of the file system. If the superblock of a file system is corrupted, then the filesystem cannot be mounted and thus files cannot be accessed. + * **`Inode:`** An inode is a data structure on a filesystem on a Unix-like operating system that stores all the information about a file except its name and its actual data. + * **`Journal:`** A journaling filesystem is a filesystem that maintains a special file called a journal that is used to repair any inconsistencies that occur as the result of an improper shutdown of a computer. + + + +### How To Mount A Partition In Linux + +Once you have created the partition and filesystem then we need to mount the partition to use. + +To do so, we need to create a mountpoint to mount the partition. Use mkdir command to create a mountpoint. + +``` +$ sudo mkdir -p /mnt/2g-new +``` + +For temporary mount, use the following command. You will be lose this mountpoint after rebooting your system. + +``` +$ sudo mount /dev/sdc1 /mnt/2g-new +``` + +For permanent mount, add the partition details in the fstab file. It can be done in two ways either adding device name or UUID value. + +Permanent mount using Device Name: + +``` +# vi /etc/fstab + +/dev/sdc1 /mnt/2g-new ext4 defaults 0 0 +``` + +Permanent mount using UUID Value. To get a UUID of the partition use blkid command. + +``` +$ sudo blkid +/dev/sdc1: UUID="d17e3c31-e2c9-4f11-809c-94a549bc43b7" TYPE="ext2" PARTUUID="8cc8f9e5-01" +/dev/sda1: UUID="d92fa769-e00f-4fd7-b6ed-ecf7224af7fa" TYPE="ext4" PARTUUID="eab59449-01" +/dev/sdc3: UUID="ca307aa4-0866-49b1-8184-004025789e63" TYPE="ext4" PARTUUID="8cc8f9e5-03" +/dev/sdc5: PARTUUID="8cc8f9e5-05" + +# vi /etc/fstab + +UUID=d17e3c31-e2c9-4f11-809c-94a549bc43b7 /mnt/2g-new ext4 defaults 0 0 +``` + +The same has been verified using df Command. + +``` +$ df -h +Filesystem Size Used Avail Use% Mounted on +udev 969M 0 969M 0% /dev +tmpfs 200M 7.0M 193M 4% /run +/dev/sda1 20G 16G 3.0G 85% / +tmpfs 997M 0 997M 0% /dev/shm +tmpfs 5.0M 4.0K 5.0M 1% /run/lock +tmpfs 997M 0 997M 0% /sys/fs/cgroup +tmpfs 200M 28K 200M 1% /run/user/121 +tmpfs 200M 25M 176M 13% /run/user/1000 +/dev/sdc1 1008M 1.3M 956M 1% /mnt/2g-new +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/ + +作者:[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-manage-disk-partitions-using-parted-command/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2019/01/linux-fdisk-command-to-manage-disk-partitions-1a.png From 8e85962146fbdc9eb5a21ff0d910ef237a6e5043 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 10:17:20 +0800 Subject: [PATCH 0872/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190128=20Top?= =?UTF-8?q?=20Hex=20Editors=20for=20Linux=20sources/tech/20190128=20Top=20?= =?UTF-8?q?Hex=20Editors=20for=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190128 Top Hex Editors for Linux.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..5cd47704b4 --- /dev/null +++ b/sources/tech/20190128 Top Hex Editors for Linux.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 6f30e87f847856c8406df4094ce16a62149c2e0e Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 31 Jan 2019 10:24:24 +0800 Subject: [PATCH 0873/4278] translated --- ...nk, an open source personal finance app.md | 61 ------------------- ...nk, an open source personal finance app.md | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md create mode 100644 translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md diff --git a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md deleted file mode 100644 index a925448cfb..0000000000 --- a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with HomeBank, an open source personal finance app) -[#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with HomeBank, an open source personal finance app -====== -Keep track of where your money is going with HomeBank, the eighth 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/math_money_financial_calculator_colors.jpg?itok=_yEVTST1) - -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 eighth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### HomeBank - -Managing my finances can be really stressful. I don't look at my bank balance every day and sometimes have trouble keeping track of where my money is going. I often spend more time managing my finances than I need to, digging into accounts and payment histories to figure out where my money went. Knowing my finances are OK helps keep me calm and allows me to focus on other things. - -![](https://opensource.com/sites/default/files/uploads/homebank-1.png) - -[HomeBank][1] is a personal finance desktop application that helps decrease this type of stress by making it fairly easy to keep track of your finances. It has some nice reports to help you figure out where you're spending your money, allows you to set up rules for importing transactions, and supports most modern formats. - -HomeBank is available on most distributions by default, so installation is very easy. When you start it up for the first time, it will walk you through setup and allow you to create an account. From there, you can either import one of the supported file formats or start entering transactions. The transaction register itself is just that—a list of transactions. [Unlike some other apps][2], you don't have to learn [double-entry bookkeeping][3] to use HomeBank. - -![](https://opensource.com/sites/default/files/uploads/homebank-2.png) - -Importing files from your bank is handled with another step-by-step wizard, with options to create a new account or populate an existing one. Importing into a new account saves a little time since you don't have to pre-create all the accounts before starting the import. You can also import multiple files into an account at once, so you don't need to repeat the same steps for every file in every account. - -![](https://opensource.com/sites/default/files/uploads/homebank-3.png) - -The one pain point I've had with importing and managing accounts is category assignment. Categories are what allow you to break down your spending and see what you are spending money on, in general terms. HomeBank, unlike commercial services (and some commercial programs), requires you to manually set up all the assignments. But this is generally a one-time thing, and then the categories can be auto-applied as transactions are added/imported. There is also a button to analyze the account and auto-apply things that already exist, which speeds up categorizing a large import (like I did the first time). HomeBank comes with a large number of categories you can start with, and you can add your own as well. - -HomeBank also has budgeting features, allowing you to plan for the months ahead. - -![](https://opensource.com/sites/default/files/uploads/homebank-4.png) - -The big win, for me, is HomeBank's reports feature. Not only is there a chart on the main screen showing where you are spending your money, but there are a whole host of other reports you can look at. If you use the budget feature, there is a report that tracks your spending against your budget. You can also view those reports as pie and bar charts. There is also a trend report and a balance report, so you can look back and see changes or patterns over time. - -Overall, HomeBank is a very friendly, useful application to help you keep your finances in order. It is simple to use and really helpful if keeping track of your money is a major stress point in your life. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tools-homebank - -作者:[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://homebank.free.fr/en/index.php -[2]: https://www.gnucash.org/ -[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system diff --git a/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md new file mode 100644 index 0000000000..d124db94c0 --- /dev/null +++ b/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with HomeBank, an open source personal finance app) +[#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 HomeBank,一个开源个人财务应用 +====== +使用 HomeBank 跟踪你的资金流向,这是我们开源工具系列中的第八个工具,它将在 2019 年提高你的工作效率。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。 + +### HomeBank + +管理我的财务可能会很有压力。我不会每天查看我的银行余额,有时也很难跟踪我的钱流向哪里。我经常会花更多的时间来管理我的财务,挖掘账户和付款历史并找出我的钱去了哪里。了解我的财务状况可以帮助我保持冷静,并让我专注于其他事情。 + +![](https://opensource.com/sites/default/files/uploads/homebank-1.png) + +[HomeBank][1] 是一款个人财务桌面应用,帮助你轻松跟踪你的财务状况,来帮助减少此类压力。它有很好的报告可以帮助你找出你花钱的地方,允许你设置导入交易的规则,并支持大多数现代格式。 + +HomeBank 默认可在大多数发行版上可用,因此安装它非常简单。当你第一次启动它时,它将引导你完成设置并让你创建一个帐户。之后,你可以导入任意一种支持的文件格式或开始输入交易。交易簿本身就是一个交易列表。 [与其他一些应用不同][2],你不必学习[复式簿记][3]来使用 HomeBank。 + +![](https://opensource.com/sites/default/files/uploads/homebank-2.png) + +从银行导入文件将使用另一个分步向导进行处理,该向导提供了创建新帐户或填充现有帐户的选项。导入新帐户可节省一点时间,因为你无需在开始导入之前预先创建所有帐户。你还可以一次将多个文件导入帐户,因此不需要对每个帐户中的每个文件重复相同的步骤。 + +![](https://opensource.com/sites/default/files/uploads/homebank-3.png) + +我在导入和管理帐户时遇到的一个痛点是指定类别。一般而言,类别可以让你分解你的支出,看看你花钱的方式。HomeBank 与一些商业服务(以及一些商业程序)不同,它要求你手动设置所有类别。但这通常是一次性的事情,它可以在添加/导入交易时自动添加类别。还有一个按钮来分析帐户并跳过已存在的内容,这样可以加快对大量导入的分类(就像我第一次做的那样)。HomeBank 提供了大量可用的类别,你也可以添加自己的类别。 + +HomeBank 还有预算功能,允许你计划未来几个月的开销。 + +![](https://opensource.com/sites/default/files/uploads/homebank-4.png) + +对我来说,最棒的功能是 HomeBank 的报告。主页面上不仅有一个图表显示你花钱的地方,而且还有许多其他报告可供你查看。如果你使用预算功能,还会有一份报告会根据预算跟踪你的支出情况。你还可以以饼图和条形图的方式查看报告。它还有趋势报告和余额报告,因此你可以回顾并查看一段时间内的变化或模式。 + +总的来说,HomeBank 是一个非常友好,有用的程序,可以帮助你保持良好的财务。如果跟踪你的钱是你生活中的一件麻烦事,它使用起来很简单并且非常有用。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tools-homebank + +作者:[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://homebank.free.fr/en/index.php +[2]: https://www.gnucash.org/ +[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system \ No newline at end of file From 1bca7924f63db7f1d5b1d87fac3fba4e75442434 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 31 Jan 2019 10:28:41 +0800 Subject: [PATCH 0874/4278] translating --- ...with Roland, a random selection tool for the command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md index 1bfeb92c0c..edf787447b 100644 --- a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md +++ b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b0aad8e5b3517b64ecc339dc61760cc684f53b1b Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 31 Jan 2019 14:32:48 +0800 Subject: [PATCH 0875/4278] hankchow translated --- ...24 Understanding Angle Brackets in Bash.md | 154 ------------------ ...24 Understanding Angle Brackets in Bash.md | 151 +++++++++++++++++ 2 files changed, 151 insertions(+), 154 deletions(-) delete mode 100644 sources/tech/20190124 Understanding Angle Brackets in Bash.md create mode 100644 translated/tech/20190124 Understanding Angle Brackets in Bash.md diff --git a/sources/tech/20190124 Understanding Angle Brackets in Bash.md b/sources/tech/20190124 Understanding Angle Brackets in Bash.md deleted file mode 100644 index 063eec3fd0..0000000000 --- a/sources/tech/20190124 Understanding Angle Brackets in Bash.md +++ /dev/null @@ -1,154 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Understanding Angle Brackets in Bash) -[#]: via: (https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) - -Understanding Angle Brackets in Bash -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/architecture-1839450_1920.jpg?itok=ra6XonD3) - -[Bash][1] provides many important built-in commands, like `ls`, `cd`, and `mv`, as well as regular tools such as `grep`, `awk,` and `sed`. But, it is equally important to know the punctuation marks -- [the glue in the shape of dots][2], commas, brackets. and quotes -- that allow you to transform and push data from one place to another. Take angle brackets (`< >`), for example. - -### Pushing Around - -If you are familiar with other programming and scripting languages, you may have used `<` and `>` as logical operators to check in a condition whether one value is larger or smaller than another. If you have ever written HTML, you have used angle brackets to enclose tags. - -In shell scripting, you can also use brackets to push data from place to place, for example, to a file: - -``` -ls > dir_content.txt -``` - -In this example, instead of showing the contents of the directory on the command line, `>` tells the shell to copy it into a file called _dir_content.txt_. If _dir_content.txt_ doesn't exist, Bash will create it for you, but if _dir_content.txt_ already exists and is not empty, you will overwrite whatever it contained, so be careful! - -You can avoid overwriting existing content by tacking the new stuff onto the end of the old stuff. For that you use `>>` (instead of `>`): - -``` -ls $HOME > dir_content.txt; wc -l dir_content.txt >> dir_content.txt -``` - -This line stores the list of contents of your home directory into _dir_content.txt_. You then count the number of lines in _dir_content.txt_ (which gives you the number of items in the directory) with [`wc -l`][3] and you tack that value onto the end of the file. - -After running the command line on my machine, this is what my _dir_content.txt_ file looks like: - -``` -Applications -bin -cloud -Desktop -Documents -Downloads -Games -ISOs -lib -logs -Music -OpenSCAD -Pictures -Public -Templates -test_dir -Videos -17 dir_content.txt -``` - -The mnemonic here is to look at `>` and `>>` as arrows. In fact, the arrows can point the other way, too. Say you have a file called _CBActors_ containing some names of actors and the number of films by the Coen brothers they have been in. Something like this: - -``` -John Goodman 5 -John Turturro 3 -George Clooney 2 -Frances McDormand 6 -Steve Buscemi 5 -Jon Polito 4 -Tony Shalhoub 3 -James Gandolfini 1 -``` - -Something like - -``` -sort < CBActors # Do this -Frances McDormand 6 # And you get this -George Clooney 2 -James Gandolfini 1 -John Goodman 5 -John Turturro 3 -Jon Polito 4 -Steve Buscemi 5 -Tony Shalhoub 3 -``` - -Will [sort][4] the list alphabetically. But then again, you don't need `<` here since `sort` already expects a file anyway, so `sort CBActors` will work just as well. - -However, if you need to see who is the Coens' favorite actor, you can check with : - -``` -while read name surname films; do echo $films $name $surname > filmsfirst.txt; done < CBActors -``` - -Or, to make that a bit more readable: - -``` -while read name surname films;\ - do - echo $films $name $surname >> filmsfirst;\ - done < CBActors -``` - -Let's break this down, shall we? - - * the [`while ...; do ... done`][5] structure is a loop. The instructions between `do` and `done` are repeatedly executed while a condition is met, in this case... - * ... the [`read`][6] instruction has lines to read. `read` reads from the standard input and will continue reading until there is nothing more to read... - * ... And as standard input is fed in via `<` and comes from _CBActors_ , that means the `while` loop will loop until the last line of _CBActors_ is piped into the loop. - * Getting back to `read` for a sec, the tool is clever enough to see that there are three distinct fields separated by spaces on each line of the file. That allows you to put the first field from each line in the `name` variable, the second in `surname` and the third in `films`. This comes in handy later, on the line that says `echo $films $name $surname >> filmsfirst;\`, allowing you to reorder the fields and push them into a file called _filmsfirst_. - - - -At the end of all that, you have a file called _filmsfirst_ that looks like this: - -``` -5 John Goodman -3 John Turturro -2 George Clooney -6 Frances McDormand -5 Steve Buscemi -4 Jon Polito -3 Tony Shalhoub -1 James Gandolfini -``` - -which you can now use with `sort`: - -``` -sort -r filmsfirst -``` - -to see who is the Coens' favorite actor. Yes, it is Frances McDormand. (The [`-r`][4] option reverses the sort, so McDormand ends up on top). - -We'll look at more angles on this topic next time! - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-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/2019/1/bash-shell-utility-reaches-50-milestone -[2]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot -[3]: https://linux.die.net/man/1/wc -[4]: https://linux.die.net/man/1/sort -[5]: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html -[6]: https://linux.die.net/man/2/read diff --git a/translated/tech/20190124 Understanding Angle Brackets in Bash.md b/translated/tech/20190124 Understanding Angle Brackets in Bash.md new file mode 100644 index 0000000000..7e2ed95182 --- /dev/null +++ b/translated/tech/20190124 Understanding Angle Brackets in Bash.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding Angle Brackets in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +理解 Bash 中的尖括号 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/architecture-1839450_1920.jpg?itok=ra6XonD3) + +[Bash][1] 内置了很多诸如 `ls`、`cd`、`mv` 这样的重要的命令,也有很多诸如 `grep`、`awk`、`sed` 这些有用的工具。但除此之外,其实 [Bash][1] 中还有很多可以[起到胶水作用][2]的标点符号,例如点号(`.`)、逗号(`,`)、括号(`<>`)、引号(`"`)之类。下面我们就来看一下可以用来进行数据转换和转移的尖括号()。 + +### 转移数据 + +如果你对其它编程语言有所了解,你会知道尖括号 `<` 和 `>` 一般是作为逻辑运算符,用来比较两个值之间的大小关系。如果你还编写 HTML,尖括号作为各种标签的一部分,就更不会让你感到陌生了。 + +在 shell 脚本语言中,尖括号可以将数据从一个地方转移到另一个地方。例如可以这样把数据存放到一个文件当中: + +``` +ls > dir_content.txt +``` + +在上面的例子中,`>` 符号让 shell 将 `ls` 命令的输出结果写入到 `dir_content.txt` 里,而不是直接显示在命令行中。需要注意的是,如果 `dir_content.txt` 这个文件不存在,Bash 会为你创建出来;但是如果 `dir_content.txt` 是一个已有得非空文件,它的内容就会被覆盖掉。所以执行类似的操作之前务必谨慎。 + +你也可以不使用 `>` 而使用 `>>`,这样就可以把新的数据追加到文件的末端而不会覆盖掉文件中已有的数据了。例如: + +``` +ls $HOME > dir_content.txt; wc -l dir_content.txt >> dir_content.txt +``` + +在这串命令里,首先将 home 目录的内容写入到 `dir_content.txt` 文件中,然后使用 `wc -l` 计算出 `dir_content.txt` 文件的行数(也就是 home 目录中的文件数)并追加到 `dir_content.txt` 的末尾。 + +在我的机器上执行上述命令之后,`dir_content.txt` 的内容会是以下这样: + +``` +Applications +bin +cloud +Desktop +Documents +Downloads +Games +ISOs +lib +logs +Music +OpenSCAD +Pictures +Public +Templates +test_dir +Videos +17 dir_content.txt +``` + +你可以将 `>` 和 `>>` 作为箭头来理解。当然,这个箭头的指向也可以反过来。例如,Coen brothers 的一些演员以及他们出演电影的次数保存在 `CBActors` 文件中,就像这样: + +``` +John Goodman 5 +John Turturro 3 +George Clooney 2 +Frances McDormand 6 +Steve Buscemi 5 +Jon Polito 4 +Tony Shalhoub 3 +James Gandolfini 1 +``` + +你可以执行这样的命令: + +``` +sort < CBActors +Frances McDormand 6 # 你会得到这样的输出 +George Clooney 2 +James Gandolfini 1 +John Goodman 5 +John Turturro 3 +Jon Polito 4 +Steve Buscemi 5 +Tony Shalhoub 3 +``` + +就可以使用 [`sort`][4] 命令将这个列表按照字母顺序输出。但是,`sort` 命令本来就可以接受传入一个文件,因此在这里使用 `<` 会略显多余,直接执行 `sort CBActors` 就可以得到期望的结果。 + +如果你想知道 Coens 最喜欢的演员是谁,你可以这样操作。首先: + +``` +while read name surname films; do echo $films $name $surname > filmsfirst.txt; done < CBActors +``` + +上面这串命令写在多行中可能会比较易读: + +``` +while read name surname films;\ + do + echo $films $name $surname >> filmsfirst;\ + done < CBActors +``` + +下面来分析一下这些命令做了什么: + + * [`while ...; do ... done`][5] 是一个循环结构。当 `while` 后面的条件成立时,`do` 和 `done` 之间的部分会一直重复执行; + * [`read`][6] 语句会按行读入内容。`read` 会从标准输入中持续读入,直到没有内容可读入; + * `CBActors` 文件的内容会通过 `<` 从标准输入中读入,因此 `while` 循环会将 `CBActors` 文件逐行完整读入; + * `read` 命令可以按照空格将每一行内容划分为三个字段,然后分别将这三个字段赋值给 `name`、`surname` 和 `films` 三个变量,这样就可以很方便地通过 `echo $films $name $surname >> filmsfirst;\` 来重新排列几个字段的放置顺序并存放到 `filmfirst` 文件里面了。 + +执行完以后,查看 `filmsfirst` 文件,内容会是这样的: + +``` +5 John Goodman +3 John Turturro +2 George Clooney +6 Frances McDormand +5 Steve Buscemi +4 Jon Polito +3 Tony Shalhoub +1 James Gandolfini +``` + +这时候再使用 `sort` 命令: + +``` +sort -r filmsfirst +``` + +就可以看到 Coens 最喜欢的演员是 Frances McDormand 了。(`-r` 参数表示降序排列,因此 McDormand 会排在最前面) + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-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/2019/1/bash-shell-utility-reaches-50-milestone +[2]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[3]: https://linux.die.net/man/1/wc +[4]: https://linux.die.net/man/1/sort +[5]: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html +[6]: https://linux.die.net/man/2/read + From 6bf9dcc001232dd10c0ebb44d88247a00c5bf56f Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 30 Jan 2019 23:48:30 +0800 Subject: [PATCH 0876/4278] Translating by MjSeven --- ... A Package Is Available On Your Linux Distribution Or Not.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md b/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md index b731465a55..f1390faab0 100644 --- a/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md +++ b/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md @@ -1,3 +1,5 @@ +Translating by MjSeven + How To Search If A Package Is Available On Your Linux Distribution Or Not ====== You can directly install the require package which you want if you know the package name. From f142e62ae4baff70dd01eaea01077dbd728fa5aa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 21:42:35 +0800 Subject: [PATCH 0877/4278] PRF:20190123 Getting started with Isotope, an open source webmail client.md @MjSeven --- ... Isotope, an open source webmail client.md | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md b/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md index 0598fc8963..2f8be92851 100644 --- a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md +++ b/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md @@ -1,43 +1,42 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with Isotope, an open source webmail client) [#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Isotope 入门:一个开源的 Web 邮件客户端 +开始使用 Isotope 吧,一款开源的 Web 邮件客户端 ====== -使用 Isotope(一个轻量级的电子邮件客户端)阅读富文本电子邮件,它是我们在开源工具系列的第 11 个,将使你在 2019 年更高效。 + +> 使用轻量级的电子邮件客户端 Isotope 阅读富文本电子邮件,这个开源工具系列的第十一个工具将使你在 2019 年更高效。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH) -在每年的年初,似乎都有一股疯狂的寻找提高工作效率方法的冲动。新年决心,渴望以正确的方式开始新的一年。当然,“旧不去的,新的不来”的态度都会导致这种情况。一般的建议都偏向于私有和专业软件,然而并不是必须这样。 +在每年的年初,似乎都有一股疯狂的寻找提高工作效率方法的冲动。新年决心,渴望以正确的方式开始新的一年。当然,“旧不去的,新的不来”的态度都会导致这种情况。一般的建议都偏向于闭源和专有软件,然而并不是必须这样。 以下是我挑选的 19 个新的(或者对你来说是新的)开源工具中的第 11 个,它将帮助你在 2019 年提高工作效率。 ### Isotope -正如我们在[本系列的第四篇文章][1](关于 Cypht)中所讨论的那样,我们花了很多时间来处理电子邮件。有很多方法可以解决它,我已经花了很多时间来寻找最适合我的电子邮件客户端。我认为这是一个重要的区别:对我有效的方法并不总是对其它人有效。有时对我有用的是像 [Thunderbird][2] 这样的完整客户端,有时是像 [Mutt][3] 这样的控制台客户端,有时是像 [Gmail][4] 和 [RoundCube][5] 这样基于 Web 的界面。 +正如我们在[本系列的第四篇文章][1](Cypht)中所讨论的那样,我们花了很多时间来处理电子邮件。有很多方法可以解决它,我已经花了很多时间来寻找最适合我的电子邮件客户端。我认为这是一个重要的区别:对我有效的方法并不总是对其它人有效。有时对我有用的是像 [Thunderbird][2] 这样的完整客户端,有时是像 [Mutt][3] 这样的控制台客户端,有时是像 [Gmail][4] 和 [RoundCube][5] 这样基于 Web 的界面。 ![](https://opensource.com/sites/default/files/uploads/isotope_1.png) -[Isotope][6] 是一个本地托管的,基于 Web 的电子邮件客户端。它非常轻巧,只使用 IMAP 协议,占用的磁盘空间非常小。与 Cypht 不同,Isotope 具有完整的 HTML 邮件支持,这意味着显示富文本电子邮件没有问题。 +[Isotope][6] 是一个本地托管的、基于 Web 的电子邮件客户端。它非常轻巧,只使用 IMAP 协议,占用的磁盘空间非常小。与 Cypht 不同,Isotope 具有完整的 HTML 邮件支持,这意味着显示富文本电子邮件没有问题。 ![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png) -如果你安装了 [Docker][7],那么安装 Isotope 非常容易。你只需将文档中的命令复制到控制台中,然后按下 Enter 键。在浏览器中输入 **localhost** 来获取 Isotope 登录界面,输入你的 IMAP 服务器,登录名和密码将打开收件箱视图。 +如果你安装了 [Docker][7],那么安装 Isotope 非常容易。你只需将文档中的命令复制到控制台中,然后按下回车键。在浏览器中输入 `localhost` 来访问 Isotope 登录界面,输入你的 IMAP 服务器,登录名和密码将打开收件箱视图。 ![](https://opensource.com/sites/default/files/uploads/isotope_3.png) -在这一点上,Isotope 的功能和你想象的差不多。单击消息进行查看,单击铅笔图标以创建新邮件等。你会注意到用户界面(UI)非常简单,没有“移动到文件夹”,“复制到文件夹”和“存档”等常规按钮。你可以通过拖动来移动消息,因此无论如何你都不会错过这些按钮。 +在这一点上,Isotope 的功能和你想象的差不多。单击消息进行查看,单击铅笔图标以创建新邮件等。你会注意到用户界面(UI)非常简单,没有“移动到文件夹”、“复制到文件夹”和“存档”等常规按钮。你可以通过拖动来移动消息,因此其实你并不太需要这些按钮。 ![](https://opensource.com/sites/default/files/uploads/isotope_4.png) -总的来说,Isotope 干净,速度快,工作得非常好。更棒的是,它正在积极开发中(最近一次的提交是在我撰写本文的两小时之前),所以它正在不断得到改进。你可以查看代码并在 [GitHub][8] 上为它做出贡献。 - +总的来说,Isotope 干净、速度快、工作得非常好。更棒的是,它正在积极开发中(最近一次的提交是在我撰写本文的两小时之前),所以它正在不断得到改进。你可以查看代码并在 [GitHub][8] 上为它做出贡献。 -------------------------------------------------------------------------------- @@ -45,8 +44,8 @@ via: https://opensource.com/article/19/1/productivity-tool-isotope 作者:[Kevin Sonney][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 705dee23094348ce14f54628dd207d43272703d5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 21:43:11 +0800 Subject: [PATCH 0878/4278] PUB:20190123 Getting started with Isotope, an open source webmail client.md @MjSeven https://linux.cn/article-10494-1.html --- ...ing started with Isotope, an open source webmail client.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190123 Getting started with Isotope, an open source webmail client.md (98%) diff --git a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md b/published/20190123 Getting started with Isotope, an open source webmail client.md similarity index 98% rename from translated/tech/20190123 Getting started with Isotope, an open source webmail client.md rename to published/20190123 Getting started with Isotope, an open source webmail client.md index 2f8be92851..5397aad573 100644 --- a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md +++ b/published/20190123 Getting started with Isotope, an open source webmail client.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10494-1.html) [#]: subject: (Getting started with Isotope, an open source webmail client) [#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From 9251382368ae0507c909f6bf0f3f04bd8693b4d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 21:52:08 +0800 Subject: [PATCH 0879/4278] PRF:20181207 Plan your own holiday calendar at the Linux command line.md @MjSeven --- ...iday calendar at the Linux command line.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md index 6d959d7339..30a529a1d3 100644 --- a/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Plan your own holiday calendar at the Linux command line) @@ -9,16 +9,18 @@ 在 Linux 命令行中规划你的假期日历 ====== -将命令链接在一起,构建一个彩色日历,然后在暴风雪中将其拂去。 + +> 将命令链接在一起,构建一个彩色日历,然后在暴风雪中将其拂去。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cal.png?itok=S0F8RY9k) 欢迎阅读今天推出的 Linux 命令行玩具降临日历。如果这是你第一次访问本系列,你可能会问:什么是命令行玩具。即使我不太确定,但一般来说,它可以是一个游戏或任何简单的娱乐,可以帮助你在终端玩得开心。 很可能你们中的一些人之前已经看过我们日历上的各种选择,但我们希望给每个人至少一件新东西。 -我们在没有创建实际日历的情况下完成了本系列的第 7 天,所以今天让我们使用命令行工具来做到这一点:**cal**。就其本身而言,**cal** 可能不是最令人惊奇的工具,但我们可以使用其它一些实用程序来为它增添一些趣味。 +我们在没有创建实际日历的情况下完成了本系列的第 7 天,所以今天让我们使用命令行工具来做到这一点:`cal`。就其本身而言,`cal` 可能不是最令人惊奇的工具,但我们可以使用其它一些实用程序来为它增添一些趣味。 -很可能,你的系统上已经安装了 **cal**。要使用它,只需要输入 **cal** 即可。 +很可能,你的系统上已经安装了 `cal`。要使用它,只需要输入 `cal` 即可。 ``` $ cal @@ -32,7 +34,7 @@ Su Mo Tu We Th Fr Sa 30 31           ``` -我们不打算在本文中深入介绍高级用法,因此如果你想了解有关 **cal** 的更多信息,查看 Opensouce.com 社区版主 Don Watkin 的优秀文章 [date 和 cal 命令概述][1]。 +我们不打算在本文中深入介绍高级用法,因此如果你想了解有关 `cal` 的更多信息,查看 Opensouce.com 社区版主 Don Watkin 的优秀文章 [date 和 cal 命令概述][1]。 现在,让我们用一个漂亮的盒子来为它增添趣味,就像我们在上一篇 Linux 玩具文章中介绍的那样。我将使用钻石块,用一点内边距来对齐。 @@ -61,7 +63,7 @@ $ cal | boxes -d diamonds -p a1l4t2         \/          \/          \/ ``` -看起来很不错,但是为了好的测量,让我们把整个东西放到另一个盒子里,为了好玩,这次我们将使用滚动设计。 +看起来很不错,但是为了更规整,让我们把整个东西放到另一个盒子里,为了好玩,这次我们将使用卷轴式设计。 ``` cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll         @@ -93,7 +95,7 @@ cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll            ~~~                                                ~~~ ``` -完美。现在,事情变得有点疯狂了。我喜欢我们的设计,但我想全力以赴,所以我要给它上色。但是 Opensource.com 员工所在的北卡罗来版纳州罗利办公室,本周末很有可能下雪。所以,让我们享受彩色降临日历,然后用雪擦掉它。 +完美。现在,这事有点小激动了。我喜欢我们的设计,但我想更妙一些,所以我要给它上色。但是 Opensource.com 员工所在的北卡罗来版纳州罗利办公室,本周末很有可能下雪。所以,让我们享受彩色降临日历,然后用雪擦掉它。 关于雪,我抓取了一些 Bash 和 Gawk 的漂亮[代码片段][2],幸亏我发现了 CLIMagic。如果你不熟悉 CLIMagic,去查看他们的[网站][3],在 [Twitter][4] 上关注他们。你会满意的。 @@ -107,7 +109,7 @@ $ clear;cal|boxes -d diamonds -p a1t2l3|boxes -a c -d scroll|lolcat;sleep 3;whil ![](https://opensource.com/sites/default/files/uploads/linux-toy-cal-animated.gif) -要使它在你的系统上工作,你需要所有它引用的实用程序(box, lolcat, gawk 等),还需要使用支持 Unicode 的终端仿真器。 +要使它在你的系统上工作,你需要所有它引用的实用程序(`box`、`lolcat`、`gawk` 等),还需要使用支持 Unicode 的终端仿真器。 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -120,7 +122,7 @@ via: https://opensource.com/article/18/12/linux-toy-cal 作者:[Jason Baker][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 ad03e06bc4b7c85a0588106f559ccd91f9cd689e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 21:53:07 +0800 Subject: [PATCH 0880/4278] PUB:20181207 Plan your own holiday calendar at the Linux command line.md @MjSeven https://linux.cn/article-10495-1.html --- ...lan your own holiday calendar at the Linux command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181207 Plan your own holiday calendar at the Linux command line.md (99%) diff --git a/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/published/20181207 Plan your own holiday calendar at the Linux command line.md similarity index 99% rename from translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md rename to published/20181207 Plan your own holiday calendar at the Linux command line.md index 30a529a1d3..0a216f0d7b 100644 --- a/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/published/20181207 Plan your own holiday calendar at the Linux command line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10495-1.html) [#]: subject: (Plan your own holiday calendar at the Linux command line) [#]: via: (https://opensource.com/article/18/12/linux-toy-cal) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From afd552fab296606cf2ee915b2c2a7e86bdddb53b Mon Sep 17 00:00:00 2001 From: MjSeven Date: Thu, 31 Jan 2019 23:23:03 +0800 Subject: [PATCH 0881/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=2020180626?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lable On Your Linux Distribution Or Not.md | 101 ++++++++---------- 1 file changed, 44 insertions(+), 57 deletions(-) rename {sources => translated}/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md (68%) diff --git a/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md b/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md similarity index 68% rename from sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md rename to translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md index f1390faab0..4f6a2dbe35 100644 --- a/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md +++ b/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md @@ -1,51 +1,46 @@ -Translating by MjSeven - -How To Search If A Package Is Available On Your Linux Distribution Or Not +如何搜索一个包是否在你的 Linux 发行版中 ====== -You can directly install the require package which you want if you know the package name. +如果你知道包名称,那么你可以直接安装所需的包。 -In some cases, if you don’t know the exact package name or you want to search some packages then you can easily search that package with help of distribution package manager. +在某些情况下,如果你不知道确切的包名称或者你想搜索某些包,那么你可以在分发包管理器的帮助下轻松搜索该包。 -Searches automatically include both installed and available packages. +自动搜索包括已安装和可用的包。 -The format of the results depends upon the option. If the query produces no information, there are no packages matching the criteria. +结果的格式取决于选项。如果查询没有生成任何信息,那么意味着没有匹配条件的包。 -This can be done through distribution package managers with variety of options. +这可以通过具有各种选项的分发包管理器来完成。 -I had added all the possible options in this article and you can select which is the best and suitable for you. +我已经在本文中添加了所有可能的选项,你可以选择最好的和最合适你的选项。 -Alternatively we can achieve this through **whohas** command. This will search the given package to all the major distributions (such as Debian, Ubuntu, Fedora, etc.,) not only your own system distribution. +或者,我们可以通过 **whohas** 命令实现这一点。它会从所有的主流发行版(例如 Debian, Ubuntu, Fedora 等)中搜索,而不仅仅是你自己的系统发行版。 -**Suggested Read :** -**(#)** [List of Command line Package Managers For Linux & Usage][1] -**(#)** [A Graphical frontend tool for Linux Package Manager][2] +**建议阅读:** +**(#)** [适用于 Linux 的命令行包管理器列表以及用法][1] +**(#)** [Linux 包管理器的图形前端工具][2] -### How to Search a Package in Debian/Ubuntu +### 如何在 Debian/Ubuntu 中搜索一个包 -We can use apt, apt-cache and aptitude package managers to find a given package on Debian based distributions. I had included vast of options with this package managers. +我们可以使用 apt, apt-cache 和 aptitude 包管理器在基于 Debian 的发行版上查找给定的包。我为这个包管理器中包括了大量的选项。 -We can done this on three ways in Debian based systems. +我们可以在基于 Debian 的系统中使用三种方式完成此操作。 - * apt command - * apt-cache command - * aptitude command + * apt 命令 + * apt-cache 命令 + * aptitude 命令 +### 如何使用 apt 命令搜索一个包 +APT 代表高级包管理工具 Advanced Packaging Tool(APT),它取代了 apt-get。它有功能丰富的命令行工具,包括所有功能包含在一个命令(APT)里,包括 apt-cache, apt-search, dpkg, apt-cdrom, apt-config, apt-key 等,还有其他几个独特的功能。 -### How to search a package using apt command - -APT stands for Advanced Packaging Tool (APT) which is replacement for apt-get. It’s feature rich command-line tools with included all the futures in one command (APT) such as apt-cache, apt-search, dpkg, apt-cdrom, apt-config, apt-key, etc..,. and several other unique features. - -APT is a powerful command-line tool for installing, downloading, removing, searching and managing as well as querying information about packages as a low-level access to all features of the libapt-pkg library. It’s contains some less used command-line utilities related to package management. +APT 是一个强大的命令行工具,它可以访问 libapt-pkg 底层库的所有特性,它可以用于安装,下载,删除,搜索和管理以及查询关于包的信息,另外它还包含一些较少使用的与包管理相关的命令行实用程序。 ``` $ apt -q list nano vlc Listing... nano/artful,now 2.8.6-3 amd64 [installed] vlc/artful 2.2.6-6 amd64 - ``` -Alternatively we can search a given package using below format. +或者,我们可以使用以下格式搜索指定的包。 ``` $ apt search ^vlc Sorting... Done @@ -70,9 +65,9 @@ vlc-plugin-base/artful 2.2.6-6 amd64 ``` -### How to search a package using apt-cache command +### 如何使用 apt-cache 命令搜索一个包 -apt-cache performs a variety of operations on APT’s package cache. Displays information about the given packages. apt-cache does not manipulate the state of the system but does provide operations to search and generate interesting output from the package metadata. +apt-cache 会在 APT 的包缓存上执行各种操作。它会显示有关指定包的信息。apt-cache 不会操纵系统的状态,但提供了从包的元数据中搜索和生成有趣输出的操作。 ``` $ apt-cache search nano | grep ^nano nano - small, friendly text editor inspired by Pico @@ -86,7 +81,7 @@ nanopolish - consensus caller for nanopore sequencing data ``` -Alternatively we can search a given package using below format. +或者,我们可以使用以下格式搜索指定的包。 ``` $ apt-cache policy vlc vlc: @@ -98,7 +93,7 @@ vlc: ``` -Alternatively we can search a given package using below format. +或者,我们可以使用以下格式搜索给定的包。 ``` $ apt-cache pkgnames vlc vlc-bin @@ -123,9 +118,9 @@ vlc-plugin-base ``` -### How to search a package using aptitude command +### 如何使用 aptitude 命令搜索一个包 -aptitude is a text-based interface to the Debian GNU/Linux package system. It allows the user to view the list of packages and to perform package management tasks such as installing, upgrading, and removing packages. Actions may be performed from a visual interface or from the command-line. +aptitude 一个基于文本的 Debian GNU/Linux 软件包系统的接口。它允许用户查看包列表,并执行包管理任务,例如安装,升级和删除包,它可以从可视化界面或命令行执行操作。 ``` $ aptitude search ^vlc p vlc - multimedia player and streamer @@ -168,9 +163,9 @@ p vlc-plugin-zvbi:i386 ``` -### How to Search a Package in RHEL/CentOS +### 如何在 RHEL/CentOS 中搜索一个包 -Yum (Yellowdog Updater Modified) is one of the package manager utility in Linux operating system. Yum command is used to install, update, search & remove packages on some Linux distributions based on RedHat. +Yum(Yellowdog Updater Modified)是 Linux 操作系统中的包管理器实用程序之一。Yum 命令用于在一些基于 RedHat 的 Linux 发行版上,它用来安装,更新,搜索和删除软件包。 ``` # yum search ftpd Loaded plugins: fastestmirror, refresh-packagekit, security @@ -189,15 +184,14 @@ vsftpd.x86_64 : Very Secure Ftp Daemon ``` -Alternatively we can search the same using below command. +或者,我们可以使用以下命令搜索相同内容。 ``` # yum list ftpd - ``` -### How to Search a Package in Fedora +### 如何在 Fedora 中搜索一个包 -DNF stands for Dandified yum. We can tell DNF, the next generation of yum package manager (Fork of Yum) using hawkey/libsolv library for backend. Aleš Kozumplík started working on DNF since Fedora 18 and its implemented/launched in Fedora 22 finally. +DNF 代表 Dandified yum。我们可以说 DNF 是下一代 yum 包管理器(Yum 的衍生),它使用 hawkey/libsolv 库作为底层。自从 Fedora 18 开始以及它最终在 Fedora 22 中实施以来,Aleš Kozumplík 就在开始研究 DNF。 ``` # dnf search ftpd Last metadata expiration check performed 0:42:28 ago on Tue Jun 9 22:52:44 2018. @@ -217,24 +211,22 @@ perl-ftpd.noarch : Secure, extensible and configurable Perl FTP server pure-ftpd.x86_64 : Lightweight, fast and secure FTP server pyftpdlib.noarch : Python FTP server library nordugrid-arc-gridftpd.x86_64 : ARC gridftp server - ``` -Alternatively we can search the same using below command. +或者,我们可以使用以下命令搜索相同的内容。 ``` # dnf list proftpd Failed to synchronize cache for repo 'heikoada-terminix', disabling. Last metadata expiration check: 0:08:02 ago on Tue 26 Jun 2018 04:30:05 PM IST. Available Packages proftpd.x86_64 - ``` -### How to Search a Package in Arch Linux +### 如何在 Arch Linux 中搜索一个包 -pacman stands for package manager utility (pacman). pacman is a command-line utility to install, build, remove and manage Arch Linux packages. pacman uses libalpm (Arch Linux Package Management (ALPM) library) as a back-end to perform all the actions. +pacman 代表包管理实用程序(pacman)。它是一个用于安装,构建,删除和管理 Arch Linux 软件包的命令行实用程序。pacman 使用 libalpm(Arch Linux Package Management(ALPM)库)作为底层来执行所有操作。 -In my case, i’m going to search chromium package. +在本例中,我将要搜索 chromium 包。 ``` # pacman -Ss chromium extra/chromium 48.0.2564.116-1 @@ -249,24 +241,22 @@ community/chromium-chromevox latest-1 community/fcitx-mozc 2.17.2313.102-1 Fcitx Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input) - ``` -By default `-s`‘s builtin ERE (Extended Regular Expressions) can cause a lot of unwanted results. Use the following format to match the package name only. +默认情况下,`-s` 选项内置 ERE(扩展正则表达式)会导致很多不需要的结果。使用以下格式会仅匹配包名称。 ``` # pacman -Ss '^chromium-' ``` -pkgfile is a tool for searching files from packages in the Arch Linux official repositories. +pkgfile 是一个用于在 Arch Linux 官方仓库的包中搜索文件的工具。 ``` # pkgfile chromium - ``` -### How to Search a Package in openSUSE +### 如何在 openSUSE 中搜索一个包 -Zypper is a command line package manager for suse & openSUSE distributions. It’s used to install, update, search & remove packages & manage repositories, perform various queries, and more. Zypper command-line interface to ZYpp system management library (libzypp). +Zypper 是 SUSE 和 openSUSE 发行版的命令行包管理器。它用于安装,更新,搜索和删除包以及管理仓库,执行各种查询等。Zypper 命令行接口到 ZYpp 系统管理库(libzypp)。 ``` # zypper search ftp or @@ -286,12 +276,11 @@ S | Name | Summary | Type | proftpd-sqlite | SQLite Module for ProFTPD | package | pure-ftpd | A Lightweight, Fast, and Secure FTP S-> | package | vsftpd | Very Secure FTP Daemon - Written from-> | package - ``` -### How to Search a Package using whohas command +### 如何使用 whohas 命令搜索一个包 -whohas command such a intelligent tools which search a given package to all the major distributions such as Debian, Ubuntu, Gentoo, Arch, AUR, Mandriva, Fedora, Fink, FreeBSD, NetBSD. +whohas 命令是一个智能工具,从所有主流发行版中搜索指定包,如 Debian, Ubuntu, Gentoo, Arch, AUR, Mandriva, Fedora, Fink, FreeBSD 和 NetBSD。 ``` $ whohas nano Mandriva nano-debug 2.3.1-1mdv2010.2.x http://sophie.zarb.org/rpms/0b33dc73bca710749ad14bbc3a67e15a @@ -308,10 +297,9 @@ Gentoo nano 9999 http://packages.gentoo.org/package/app-editors/nano Gentoo nano 9999 http://packages.gentoo.org/package/app-editors/nano Gentoo nano 2.9.8 http://packages.gentoo.org/package/app-editors/nano Gentoo nano 2.9.7 http://packages.gentoo.org/package/app-editors/nano - ``` -If you want to search a given package to only current distribution repository, use the below format. +如果你希望只从当前发行版仓库中搜索指定包,使用以下格式: ``` $ whohas -d Ubuntu vlc Ubuntu vlc 2.1.6-0ubuntu14.04 1M all http://packages.ubuntu.com/trusty/vlc @@ -330,7 +318,6 @@ Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/cosmic/brow Ubuntu libvlc-bin 2.2.6-6 27K all http://packages.ubuntu.com/artful/libvlc-bin Ubuntu libvlc-bin 3.0.1-3build1 17K all http://packages.ubuntu.com/bionic/libvlc-bin Ubuntu libvlc-bin 3.0.2-0ubuntu0.1 17K all http://packages.ubuntu.com/bionic-updates/libvlc-bin - ``` -------------------------------------------------------------------------------- @@ -339,7 +326,7 @@ via: https://www.2daygeek.com/how-to-search-if-a-package-is-available-on-your-li 作者:[Prakash Subramanian][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[MjSeven](https://github.com/MjSeven) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2568015e470d4c92622ae773c963d54bd02d7292 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 23:27:17 +0800 Subject: [PATCH 0882/4278] PRF:20171222 10 keys to quick game development.md @XYenChi --- ...71222 10 keys to quick game development.md | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/translated/talk/20171222 10 keys to quick game development.md b/translated/talk/20171222 10 keys to quick game development.md index c41f66bfc7..54dbd9fb99 100644 --- a/translated/talk/20171222 10 keys to quick game development.md +++ b/translated/talk/20171222 10 keys to quick game development.md @@ -1,70 +1,71 @@ 快速开发游戏的十个关键 ====== + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) -十月早些时候,Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐,并 [取前三][2]。 +十月初,由 Opensource.com 赞助的首届 [Open Jam][1] 吸引了来自世界各地的团队的 45 个参赛项目。这些队伍只用了三天时间就用开源软件制作出一个游戏来参与角逐,[有三支队伍取得了胜利][2]。 -我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] ,2D画面: [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7], [Lost Artist][8], 和 [Paint Rider][9] (我做的)。 +我们在我们的大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。我们预留了周末的计算机实验室,并教大家使用开源软件来创建游戏和游戏素材:游戏引擎:[Godot][3]、音乐:[LMMS][4]、2D 素材:[GIMP][5]、3D 素材:[Blender][6]。我们的活动产出了三个游戏:[Loathsome][7]、[Lost Artist][8] 和 [Paint Rider][9](我做的)。 -总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。 +根据我在游戏开发和游戏开发方面的经验,这里有 10 条关于游戏引擎、编码和快速游戏开发的经验教训。 -## 1\. 限定规模 +## 1、限定规模 -很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。 +很容易想要去做一个规模宏大的冒险游戏或者可以比拟你最喜欢的游戏的东西。如果你有一些经验,追求超乎游戏 Jam 活动的东西可能很酷,但不要高估自己拥有的时间。我欣赏游戏 Jam 活动的一点是它强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要的原因。 -Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 +这个 Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏适合该主题。一个想法就是做玩家能在敌人身上留下伤痕的 3D 拳击游戏。我几乎没有做 3D 游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 -## 2\. 尽早可玩 +## 2、尽早可玩 -对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。 +这是我对游戏 Jam 活动最中肯的建议。试着做出核心机制,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,你的游戏才可玩。像 Open Jam 这样的三天的活动,不应该花费几个小时以上来做一个可以运行的演示。 -## 3\. 保持简单 +## 3、保持简单 -你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。 +你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏 Jam 活动中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能正常。 -## 4\. 从其他游戏获取灵感 +## 4、从其他游戏获取灵感 -可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。 +可能你想做出完全原创的作品,但有个可以基于它开发的原型极其有用。这将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,所以你也能从再创作其他人的作品中得到很好地练习。 -考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。 +考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得有款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了这个概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。进入到 Jam 活动大概一两个小时后,我就有了基本模型,可以用一个按钮上下移动和留下小黑圈的痕迹。 -## 5\. 不要忽视可得性 +## 5、不要忽视可得性 -确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏创作),注意可得性是很重要的。 +确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有 VR 设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏 Jam 活动),注意可得性是很重要的。 -Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。 +Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有个浏览器版本就可以支持大多数人玩。但尽你所能去发布在更多的平台和操作系统上。我甚至试着在移动端发布 Paint Rider,但技术有限。 -## 6\. 不要做得太难 +## 6、不要做得太难 -如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。 +如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。要保持简单和限定规模,这在游戏计划阶段非常重要。再次重申,想出一个需要花上十天半个月开发的宏大的游戏创意很容易;难的是做出好玩、简单的游戏。 -给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 +给我的妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 -## 7\. 不用太整洁 +## 7、不用太整洁 -如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 +如果你习惯于花时间在设计模式上和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 -这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。 +这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型,直到找出值得做成完整游戏的,然后你可以潜心建立完美的代码来支持它。为游戏 Jame 活动创作的游戏就像是个快速开发一个可验证的模型一样。 -## 8\. 但也不要太随意 +## 8、但也不要太随意 -另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。 +另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎都考虑到了设计模式。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点 —— 这是你的设计自动成型的[观察者模式][14]。只要你知道如何利用这种游戏引擎的特性的优势,就可以快速写代码,你的代码也不会特别难读。 -## 9\. 取得反馈 +## 9、取得反馈 -向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。 +向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你预料之外的事。如果游戏 Jam 活动有 [Discord][15] 频道或者类似的,把你的游戏放上去,人们会反馈给你想法。Paint Rider 的一个确定的功能是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个机制。 -团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。 +团队协作的话,确保有可以传递周围反馈的人参与这个开发。 而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 -## 10\. 哪里找资源 +## 10、哪里找资源 -做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上,你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。 +做出所有你自己的资源真的会拖你后腿。Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上。你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,但这里还有其他选择。试着寻找 [Creative Commons][16] 许可的或免费音乐站点(比如 [Anttis Instrumentals][17])的资源。或者,可行的话,组建一个有专门艺术家、作家或者音乐家的团队。 -其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 +其他你可能觉得有用的软件有 [Krita][18],这是一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板的话;还有 [sfxr][19],这是一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“它的基本用法包括了按下随机按钮。”(Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 -你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 +你参加 Open Jam 或者其他游戏 Jam 并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 -------------------------------------------------------------------------------- @@ -72,7 +73,7 @@ via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-develop 作者:[Ryan Estes][a] 译者:[XYenChi](https://github.com/XYenChi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7736dd12f577ebe92883f5447abe955189e0d4e4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 23:27:58 +0800 Subject: [PATCH 0883/4278] PUB:20171222 10 keys to quick game development.md @XYenChi https://linux.cn/article-10496-1.html --- .../20171222 10 keys to quick game development.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20171222 10 keys to quick game development.md (100%) diff --git a/translated/talk/20171222 10 keys to quick game development.md b/published/20171222 10 keys to quick game development.md similarity index 100% rename from translated/talk/20171222 10 keys to quick game development.md rename to published/20171222 10 keys to quick game development.md From 35d521d1c9c4f0b50ee4cf0a795054dc369bbdce Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 23:29:57 +0800 Subject: [PATCH 0884/4278] PRF:20171222 10 keys to quick game development.md --- ...71222 10 keys to quick game development.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/published/20171222 10 keys to quick game development.md b/published/20171222 10 keys to quick game development.md index 54dbd9fb99..34a63f44dc 100644 --- a/published/20171222 10 keys to quick game development.md +++ b/published/20171222 10 keys to quick game development.md @@ -9,49 +9,49 @@ 根据我在游戏开发和游戏开发方面的经验,这里有 10 条关于游戏引擎、编码和快速游戏开发的经验教训。 -## 1、限定规模 +### 1、限定规模 很容易想要去做一个规模宏大的冒险游戏或者可以比拟你最喜欢的游戏的东西。如果你有一些经验,追求超乎游戏 Jam 活动的东西可能很酷,但不要高估自己拥有的时间。我欣赏游戏 Jam 活动的一点是它强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要的原因。 这个 Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏适合该主题。一个想法就是做玩家能在敌人身上留下伤痕的 3D 拳击游戏。我几乎没有做 3D 游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 -## 2、尽早可玩 +### 2、尽早可玩 这是我对游戏 Jam 活动最中肯的建议。试着做出核心机制,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,你的游戏才可玩。像 Open Jam 这样的三天的活动,不应该花费几个小时以上来做一个可以运行的演示。 -## 3、保持简单 +### 3、保持简单 你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏 Jam 活动中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能正常。 -## 4、从其他游戏获取灵感 +### 4、从其他游戏获取灵感 可能你想做出完全原创的作品,但有个可以基于它开发的原型极其有用。这将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,所以你也能从再创作其他人的作品中得到很好地练习。 考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得有款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了这个概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。进入到 Jam 活动大概一两个小时后,我就有了基本模型,可以用一个按钮上下移动和留下小黑圈的痕迹。 -## 5、不要忽视可得性 +### 5、不要忽视可得性 确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有 VR 设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏 Jam 活动),注意可得性是很重要的。 Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有个浏览器版本就可以支持大多数人玩。但尽你所能去发布在更多的平台和操作系统上。我甚至试着在移动端发布 Paint Rider,但技术有限。 -## 6、不要做得太难 +### 6、不要做得太难 如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。要保持简单和限定规模,这在游戏计划阶段非常重要。再次重申,想出一个需要花上十天半个月开发的宏大的游戏创意很容易;难的是做出好玩、简单的游戏。 给我的妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 -## 7、不用太整洁 +### 7、不用太整洁 如果你习惯于花时间在设计模式上和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型,直到找出值得做成完整游戏的,然后你可以潜心建立完美的代码来支持它。为游戏 Jame 活动创作的游戏就像是个快速开发一个可验证的模型一样。 -## 8、但也不要太随意 +### 8、但也不要太随意 另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎都考虑到了设计模式。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点 —— 这是你的设计自动成型的[观察者模式][14]。只要你知道如何利用这种游戏引擎的特性的优势,就可以快速写代码,你的代码也不会特别难读。 -## 9、取得反馈 +### 9、取得反馈 向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你预料之外的事。如果游戏 Jam 活动有 [Discord][15] 频道或者类似的,把你的游戏放上去,人们会反馈给你想法。Paint Rider 的一个确定的功能是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个机制。 @@ -59,7 +59,7 @@ Godot (和其他大多数游戏引擎)允许你在所有主流平台发布 而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 -## 10、哪里找资源 +### 10、哪里找资源 做出所有你自己的资源真的会拖你后腿。Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上。你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,但这里还有其他选择。试着寻找 [Creative Commons][16] 许可的或免费音乐站点(比如 [Anttis Instrumentals][17])的资源。或者,可行的话,组建一个有专门艺术家、作家或者音乐家的团队。 From d1a8ac85714cd93e2423a1f982d1e7fcf3cead86 Mon Sep 17 00:00:00 2001 From: wwhio Date: Thu, 31 Jan 2019 23:39:18 +0800 Subject: [PATCH 0885/4278] 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 f2960461cc678238c7c118419abb63c8685c3352 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 23:43:07 +0800 Subject: [PATCH 0886/4278] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201901?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 0 .../20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md | 0 .../20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md | 0 published/{ => 201901}/20150717 The History of Hello World.md | 0 .../20170523 Best Websites to Download Linux Games.md | 0 published/{ => 201901}/20170921 The Rise and Rise of JSON.md | 0 ...928 How to create a free baby monitoring system with Gonimo.md | 0 published/{ => 201901}/20171119 The Ruby Story.md | 0 ... started with Turtl, an open source alternative to Evernote.md | 0 .../{ => 201901}/20171222 10 keys to quick game development.md | 0 .../20171227 YAML- probably not so great after all.md | 0 .../20180108 5 arcade-style games in your Linux repository.md | 0 ...rful Terminal Multiplexer For Heavy Command-Line Linux User.md | 0 ...2 How to manage your workstation configuration with Ansible.md | 0 ...ith PGP - Part 4- Moving Your Master Key to Offline Storage.md | 0 ...rity with PGP - Part 5- Moving Subkeys to a Hardware Device.md | 0 ...ommon questions about agile development practices for teams.md | 0 ...ecting Code Integrity with PGP - Part 6- Using PGP with Git.md | 0 ...age your workstation with Ansible- Automating configuration.md | 0 ...ode Integrity with PGP - Part 7- Protecting Online Accounts.md | 0 .../20180411 How To Setup Static File Server Instantly.md | 0 ...principles you should know before you design a microservice.md | 0 published/{ => 201901}/20180428 A Beginners Guide To Flatpak.md | 0 .../20180503 11 Methods To Find System-Server Uptime In Linux.md | 0 .../20180507 Modularity in Fedora 28 Server Edition.md | 0 .../20180604 4 Firefox extensions worth checking out.md | 0 .../{ => 201901}/20180606 Working with modules in Fedora 28.md | 0 ...0180625 8 reasons to use the Xfce Linux desktop environment.md | 0 .../{ => 201901}/20180625 The life cycle of a software bug.md | 0 .../20180703 10 killer tools for the admin in a hurry.md | 0 .../20180722 Dawn of the Microcomputer- The Altair 8800.md | 0 .../20180725 Build an interactive CLI with Node.js.md | 0 published/{ => 201901}/20180731 How to be the lazy sysadmin.md | 0 .../20180809 Perform robust unit tests with PyHamcrest.md | 0 ...80814 5 open source strategy and simulation games for Linux.md | 0 .../{ => 201901}/20180919 5 ways DevSecOps changes security.md | 0 ...ount Dropbox Folder Locally As Virtual File System In Linux.md | 0 published/{ => 201901}/20181016 Final JOS project.md | 0 published/{ => 201901}/20181016 Lab 6- Network Driver.md | 0 ...20181029 How I organize my knowledge as a Software Engineer.md | 0 ...h-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md | 0 ...20181128 Turn an old Linux desktop into a home media center.md | 0 .../20181203 How to bring good fortune to your Linux terminal.md | 0 ... To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md | 0 ...07 Plan your own holiday calendar at the Linux command line.md | 0 ...09 Powers of two, powers of Linux- 2048 at the command line.md | 0 ...210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md | 0 ...Fly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md | 0 .../20181210 Snake your way across your Linux terminal.md | 0 .../{ => 201901}/20181211 Winterize your Bash prompt in Linux.md | 0 .../20181212 5 resolutions for open source project maintainers.md | 0 ...What is PPA- Everything You Need to Know About PPA in Linux.md | 0 .../20181214 The Linux terminal is no one-trick pony.md | 0 ...o the arcade in your Linux terminal with this Pac-man clone.md | 0 ...181217 4 cool new projects to try in COPR for December 2018.md | 0 published/{ => 201901}/20181217 Working with tarballs on Linux.md | 0 ... - Record Your Terminal Sessions As SVG Animations In Linux.md | 0 ...20181218 Use your Linux terminal to celebrate a banner year.md | 0 .../20181219 How to open source your Python library.md | 0 ...181219 Solve a puzzle at the Linux command line with nudoku.md | 0 .../20181220 How To Install Microsoft .NET Core SDK On Linux.md | 0 .../20181220 Let your Linux terminal speak its mind.md | 0 ... Easy Way To Remove Programs Installed From Source In Linux.md | 0 .../20181221 How to Build a Netboot Server, Part 3.md | 0 published/{ => 201901}/20181222 A Tale of HTTP-2.md | 0 ...0181222 Top 11 best Image Viewer for Ubuntu and other Linux.md | 0 .../20181222 Watch YouTube videos at the Linux terminal.md | 0 .../20181223 The Linux command line can fetch fun from afar.md | 0 .../20190103 How to create presentations with Beamer.md | 0 ... CPU Temperature, Frequency, Power And Utilization In Linux.md | 0 published/{ => 201901}/20190104 Managing dotfiles with rcm.md | 0 ... started with Pelican- A Python-based static site generator.md | 0 .../{ => 201901}/20190109 Bash 5.0 Released with New Features.md | 0 .../20190109 Understanding -etc-services file in Linux.md | 0 .../20190113 Get started with Joplin, a note-taking app.md | 0 ...0190114 Get started with Wekan, an open source kanban board.md | 0 ...To Move Multiple File Types Simultaneously From Commandline.md | 0 .../20190114 How to Build a Netboot Server, Part 4.md | 0 .../20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md | 0 .../{ => 201901}/20190114 You (probably) don-t need Kubernetes.md | 0 .../{ => 201901}/20190115 Linux Tools- The Meaning of Dot.md | 0 ...20190118 Get started with WTF, a dashboard for the terminal.md | 0 .../{ => 201901}/20190118 Top 5 Linux Server Distributions.md | 0 ...Getting started with Isotope, an open source webmail client.md | 0 84 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201901}/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md (100%) rename published/{ => 201901}/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md (100%) rename published/{ => 201901}/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md (100%) rename published/{ => 201901}/20150717 The History of Hello World.md (100%) rename published/{ => 201901}/20170523 Best Websites to Download Linux Games.md (100%) rename published/{ => 201901}/20170921 The Rise and Rise of JSON.md (100%) rename published/{ => 201901}/20170928 How to create a free baby monitoring system with Gonimo.md (100%) rename published/{ => 201901}/20171119 The Ruby Story.md (100%) rename published/{ => 201901}/20171206 Getting started with Turtl, an open source alternative to Evernote.md (100%) rename published/{ => 201901}/20171222 10 keys to quick game development.md (100%) rename published/{ => 201901}/20171227 YAML- probably not so great after all.md (100%) rename published/{ => 201901}/20180108 5 arcade-style games in your Linux repository.md (100%) rename published/{ => 201901}/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md (100%) rename published/{ => 201901}/20180302 How to manage your workstation configuration with Ansible.md (100%) rename published/{ => 201901}/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md (100%) rename published/{ => 201901}/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md (100%) rename published/{ => 201901}/20180319 6 common questions about agile development practices for teams.md (100%) rename published/{ => 201901}/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md (100%) rename published/{ => 201901}/20180326 Manage your workstation with Ansible- Automating configuration.md (100%) rename published/{ => 201901}/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md (100%) rename published/{ => 201901}/20180411 How To Setup Static File Server Instantly.md (100%) rename published/{ => 201901}/20180419 5 guiding principles you should know before you design a microservice.md (100%) rename published/{ => 201901}/20180428 A Beginners Guide To Flatpak.md (100%) rename published/{ => 201901}/20180503 11 Methods To Find System-Server Uptime In Linux.md (100%) rename published/{ => 201901}/20180507 Modularity in Fedora 28 Server Edition.md (100%) rename published/{ => 201901}/20180604 4 Firefox extensions worth checking out.md (100%) rename published/{ => 201901}/20180606 Working with modules in Fedora 28.md (100%) rename published/{ => 201901}/20180625 8 reasons to use the Xfce Linux desktop environment.md (100%) rename published/{ => 201901}/20180625 The life cycle of a software bug.md (100%) rename published/{ => 201901}/20180703 10 killer tools for the admin in a hurry.md (100%) rename published/{ => 201901}/20180722 Dawn of the Microcomputer- The Altair 8800.md (100%) rename published/{ => 201901}/20180725 Build an interactive CLI with Node.js.md (100%) rename published/{ => 201901}/20180731 How to be the lazy sysadmin.md (100%) rename published/{ => 201901}/20180809 Perform robust unit tests with PyHamcrest.md (100%) rename published/{ => 201901}/20180814 5 open source strategy and simulation games for Linux.md (100%) rename published/{ => 201901}/20180919 5 ways DevSecOps changes security.md (100%) rename published/{ => 201901}/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md (100%) rename published/{ => 201901}/20181016 Final JOS project.md (100%) rename published/{ => 201901}/20181016 Lab 6- Network Driver.md (100%) rename published/{ => 201901}/20181029 How I organize my knowledge as a Software Engineer.md (100%) rename published/{ => 201901}/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md (100%) rename published/{ => 201901}/20181128 Turn an old Linux desktop into a home media center.md (100%) rename published/{ => 201901}/20181203 How to bring good fortune to your Linux terminal.md (100%) rename published/{ => 201901}/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md (100%) rename published/{ => 201901}/20181207 Plan your own holiday calendar at the Linux command line.md (100%) rename published/{ => 201901}/20181209 Powers of two, powers of Linux- 2048 at the command line.md (100%) rename published/{ => 201901}/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md (100%) rename published/{ => 201901}/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md (100%) rename published/{ => 201901}/20181210 Snake your way across your Linux terminal.md (100%) rename published/{ => 201901}/20181211 Winterize your Bash prompt in Linux.md (100%) rename published/{ => 201901}/20181212 5 resolutions for open source project maintainers.md (100%) rename published/{ => 201901}/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md (100%) rename published/{ => 201901}/20181214 The Linux terminal is no one-trick pony.md (100%) rename published/{ => 201901}/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md (100%) rename published/{ => 201901}/20181217 4 cool new projects to try in COPR for December 2018.md (100%) rename published/{ => 201901}/20181217 Working with tarballs on Linux.md (100%) rename published/{ => 201901}/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md (100%) rename published/{ => 201901}/20181218 Use your Linux terminal to celebrate a banner year.md (100%) rename published/{ => 201901}/20181219 How to open source your Python library.md (100%) rename published/{ => 201901}/20181219 Solve a puzzle at the Linux command line with nudoku.md (100%) rename published/{ => 201901}/20181220 How To Install Microsoft .NET Core SDK On Linux.md (100%) rename published/{ => 201901}/20181220 Let your Linux terminal speak its mind.md (100%) rename published/{ => 201901}/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md (100%) rename published/{ => 201901}/20181221 How to Build a Netboot Server, Part 3.md (100%) rename published/{ => 201901}/20181222 A Tale of HTTP-2.md (100%) rename published/{ => 201901}/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md (100%) rename published/{ => 201901}/20181222 Watch YouTube videos at the Linux terminal.md (100%) rename published/{ => 201901}/20181223 The Linux command line can fetch fun from afar.md (100%) rename published/{ => 201901}/20190103 How to create presentations with Beamer.md (100%) rename published/{ => 201901}/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md (100%) rename published/{ => 201901}/20190104 Managing dotfiles with rcm.md (100%) rename published/{ => 201901}/20190107 Getting started with Pelican- A Python-based static site generator.md (100%) rename published/{ => 201901}/20190109 Bash 5.0 Released with New Features.md (100%) rename published/{ => 201901}/20190109 Understanding -etc-services file in Linux.md (100%) rename published/{ => 201901}/20190113 Get started with Joplin, a note-taking app.md (100%) rename published/{ => 201901}/20190114 Get started with Wekan, an open source kanban board.md (100%) rename published/{ => 201901}/20190114 How To Move Multiple File Types Simultaneously From Commandline.md (100%) rename published/{ => 201901}/20190114 How to Build a Netboot Server, Part 4.md (100%) rename published/{ => 201901}/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md (100%) rename published/{ => 201901}/20190114 You (probably) don-t need Kubernetes.md (100%) rename published/{ => 201901}/20190115 Linux Tools- The Meaning of Dot.md (100%) rename published/{ => 201901}/20190118 Get started with WTF, a dashboard for the terminal.md (100%) rename published/{ => 201901}/20190118 Top 5 Linux Server Distributions.md (100%) rename published/{ => 201901}/20190123 Getting started with Isotope, an open source webmail client.md (100%) diff --git a/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/published/201901/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md similarity index 100% rename from published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md rename to published/201901/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md diff --git a/published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/published/201901/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md similarity index 100% rename from published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md rename to published/201901/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md diff --git a/published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/published/201901/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md similarity index 100% rename from published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md rename to published/201901/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md diff --git a/published/20150717 The History of Hello World.md b/published/201901/20150717 The History of Hello World.md similarity index 100% rename from published/20150717 The History of Hello World.md rename to published/201901/20150717 The History of Hello World.md diff --git a/published/20170523 Best Websites to Download Linux Games.md b/published/201901/20170523 Best Websites to Download Linux Games.md similarity index 100% rename from published/20170523 Best Websites to Download Linux Games.md rename to published/201901/20170523 Best Websites to Download Linux Games.md diff --git a/published/20170921 The Rise and Rise of JSON.md b/published/201901/20170921 The Rise and Rise of JSON.md similarity index 100% rename from published/20170921 The Rise and Rise of JSON.md rename to published/201901/20170921 The Rise and Rise of JSON.md diff --git a/published/20170928 How to create a free baby monitoring system with Gonimo.md b/published/201901/20170928 How to create a free baby monitoring system with Gonimo.md similarity index 100% rename from published/20170928 How to create a free baby monitoring system with Gonimo.md rename to published/201901/20170928 How to create a free baby monitoring system with Gonimo.md diff --git a/published/20171119 The Ruby Story.md b/published/201901/20171119 The Ruby Story.md similarity index 100% rename from published/20171119 The Ruby Story.md rename to published/201901/20171119 The Ruby Story.md diff --git a/published/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/published/201901/20171206 Getting started with Turtl, an open source alternative to Evernote.md similarity index 100% rename from published/20171206 Getting started with Turtl, an open source alternative to Evernote.md rename to published/201901/20171206 Getting started with Turtl, an open source alternative to Evernote.md diff --git a/published/20171222 10 keys to quick game development.md b/published/201901/20171222 10 keys to quick game development.md similarity index 100% rename from published/20171222 10 keys to quick game development.md rename to published/201901/20171222 10 keys to quick game development.md diff --git a/published/20171227 YAML- probably not so great after all.md b/published/201901/20171227 YAML- probably not so great after all.md similarity index 100% rename from published/20171227 YAML- probably not so great after all.md rename to published/201901/20171227 YAML- probably not so great after all.md diff --git a/published/20180108 5 arcade-style games in your Linux repository.md b/published/201901/20180108 5 arcade-style games in your Linux repository.md similarity index 100% rename from published/20180108 5 arcade-style games in your Linux repository.md rename to published/201901/20180108 5 arcade-style games in your Linux repository.md diff --git a/published/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/published/201901/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md similarity index 100% rename from published/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md rename to published/201901/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md diff --git a/published/20180302 How to manage your workstation configuration with Ansible.md b/published/201901/20180302 How to manage your workstation configuration with Ansible.md similarity index 100% rename from published/20180302 How to manage your workstation configuration with Ansible.md rename to published/201901/20180302 How to manage your workstation configuration with Ansible.md diff --git a/published/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/published/201901/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md similarity index 100% rename from published/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md rename to published/201901/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md diff --git a/published/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/published/201901/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md similarity index 100% rename from published/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md rename to published/201901/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md diff --git a/published/20180319 6 common questions about agile development practices for teams.md b/published/201901/20180319 6 common questions about agile development practices for teams.md similarity index 100% rename from published/20180319 6 common questions about agile development practices for teams.md rename to published/201901/20180319 6 common questions about agile development practices for teams.md diff --git a/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/published/201901/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md similarity index 100% rename from published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md rename to published/201901/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md diff --git a/published/20180326 Manage your workstation with Ansible- Automating configuration.md b/published/201901/20180326 Manage your workstation with Ansible- Automating configuration.md similarity index 100% rename from published/20180326 Manage your workstation with Ansible- Automating configuration.md rename to published/201901/20180326 Manage your workstation with Ansible- Automating configuration.md diff --git a/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/published/201901/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md similarity index 100% rename from published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md rename to published/201901/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md diff --git a/published/20180411 How To Setup Static File Server Instantly.md b/published/201901/20180411 How To Setup Static File Server Instantly.md similarity index 100% rename from published/20180411 How To Setup Static File Server Instantly.md rename to published/201901/20180411 How To Setup Static File Server Instantly.md diff --git a/published/20180419 5 guiding principles you should know before you design a microservice.md b/published/201901/20180419 5 guiding principles you should know before you design a microservice.md similarity index 100% rename from published/20180419 5 guiding principles you should know before you design a microservice.md rename to published/201901/20180419 5 guiding principles you should know before you design a microservice.md diff --git a/published/20180428 A Beginners Guide To Flatpak.md b/published/201901/20180428 A Beginners Guide To Flatpak.md similarity index 100% rename from published/20180428 A Beginners Guide To Flatpak.md rename to published/201901/20180428 A Beginners Guide To Flatpak.md diff --git a/published/20180503 11 Methods To Find System-Server Uptime In Linux.md b/published/201901/20180503 11 Methods To Find System-Server Uptime In Linux.md similarity index 100% rename from published/20180503 11 Methods To Find System-Server Uptime In Linux.md rename to published/201901/20180503 11 Methods To Find System-Server Uptime In Linux.md diff --git a/published/20180507 Modularity in Fedora 28 Server Edition.md b/published/201901/20180507 Modularity in Fedora 28 Server Edition.md similarity index 100% rename from published/20180507 Modularity in Fedora 28 Server Edition.md rename to published/201901/20180507 Modularity in Fedora 28 Server Edition.md diff --git a/published/20180604 4 Firefox extensions worth checking out.md b/published/201901/20180604 4 Firefox extensions worth checking out.md similarity index 100% rename from published/20180604 4 Firefox extensions worth checking out.md rename to published/201901/20180604 4 Firefox extensions worth checking out.md diff --git a/published/20180606 Working with modules in Fedora 28.md b/published/201901/20180606 Working with modules in Fedora 28.md similarity index 100% rename from published/20180606 Working with modules in Fedora 28.md rename to published/201901/20180606 Working with modules in Fedora 28.md diff --git a/published/20180625 8 reasons to use the Xfce Linux desktop environment.md b/published/201901/20180625 8 reasons to use the Xfce Linux desktop environment.md similarity index 100% rename from published/20180625 8 reasons to use the Xfce Linux desktop environment.md rename to published/201901/20180625 8 reasons to use the Xfce Linux desktop environment.md diff --git a/published/20180625 The life cycle of a software bug.md b/published/201901/20180625 The life cycle of a software bug.md similarity index 100% rename from published/20180625 The life cycle of a software bug.md rename to published/201901/20180625 The life cycle of a software bug.md diff --git a/published/20180703 10 killer tools for the admin in a hurry.md b/published/201901/20180703 10 killer tools for the admin in a hurry.md similarity index 100% rename from published/20180703 10 killer tools for the admin in a hurry.md rename to published/201901/20180703 10 killer tools for the admin in a hurry.md diff --git a/published/20180722 Dawn of the Microcomputer- The Altair 8800.md b/published/201901/20180722 Dawn of the Microcomputer- The Altair 8800.md similarity index 100% rename from published/20180722 Dawn of the Microcomputer- The Altair 8800.md rename to published/201901/20180722 Dawn of the Microcomputer- The Altair 8800.md diff --git a/published/20180725 Build an interactive CLI with Node.js.md b/published/201901/20180725 Build an interactive CLI with Node.js.md similarity index 100% rename from published/20180725 Build an interactive CLI with Node.js.md rename to published/201901/20180725 Build an interactive CLI with Node.js.md diff --git a/published/20180731 How to be the lazy sysadmin.md b/published/201901/20180731 How to be the lazy sysadmin.md similarity index 100% rename from published/20180731 How to be the lazy sysadmin.md rename to published/201901/20180731 How to be the lazy sysadmin.md diff --git a/published/20180809 Perform robust unit tests with PyHamcrest.md b/published/201901/20180809 Perform robust unit tests with PyHamcrest.md similarity index 100% rename from published/20180809 Perform robust unit tests with PyHamcrest.md rename to published/201901/20180809 Perform robust unit tests with PyHamcrest.md diff --git a/published/20180814 5 open source strategy and simulation games for Linux.md b/published/201901/20180814 5 open source strategy and simulation games for Linux.md similarity index 100% rename from published/20180814 5 open source strategy and simulation games for Linux.md rename to published/201901/20180814 5 open source strategy and simulation games for Linux.md diff --git a/published/20180919 5 ways DevSecOps changes security.md b/published/201901/20180919 5 ways DevSecOps changes security.md similarity index 100% rename from published/20180919 5 ways DevSecOps changes security.md rename to published/201901/20180919 5 ways DevSecOps changes security.md diff --git a/published/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/published/201901/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md similarity index 100% rename from published/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md rename to published/201901/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md diff --git a/published/20181016 Final JOS project.md b/published/201901/20181016 Final JOS project.md similarity index 100% rename from published/20181016 Final JOS project.md rename to published/201901/20181016 Final JOS project.md diff --git a/published/20181016 Lab 6- Network Driver.md b/published/201901/20181016 Lab 6- Network Driver.md similarity index 100% rename from published/20181016 Lab 6- Network Driver.md rename to published/201901/20181016 Lab 6- Network Driver.md diff --git a/published/20181029 How I organize my knowledge as a Software Engineer.md b/published/201901/20181029 How I organize my knowledge as a Software Engineer.md similarity index 100% rename from published/20181029 How I organize my knowledge as a Software Engineer.md rename to published/201901/20181029 How I organize my knowledge as a Software Engineer.md diff --git a/published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/published/201901/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md similarity index 100% rename from published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md rename to published/201901/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md diff --git a/published/20181128 Turn an old Linux desktop into a home media center.md b/published/201901/20181128 Turn an old Linux desktop into a home media center.md similarity index 100% rename from published/20181128 Turn an old Linux desktop into a home media center.md rename to published/201901/20181128 Turn an old Linux desktop into a home media center.md diff --git a/published/20181203 How to bring good fortune to your Linux terminal.md b/published/201901/20181203 How to bring good fortune to your Linux terminal.md similarity index 100% rename from published/20181203 How to bring good fortune to your Linux terminal.md rename to published/201901/20181203 How to bring good fortune to your Linux terminal.md diff --git a/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/published/201901/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md similarity index 100% rename from published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md rename to published/201901/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md diff --git a/published/20181207 Plan your own holiday calendar at the Linux command line.md b/published/201901/20181207 Plan your own holiday calendar at the Linux command line.md similarity index 100% rename from published/20181207 Plan your own holiday calendar at the Linux command line.md rename to published/201901/20181207 Plan your own holiday calendar at the Linux command line.md diff --git a/published/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/published/201901/20181209 Powers of two, powers of Linux- 2048 at the command line.md similarity index 100% rename from published/20181209 Powers of two, powers of Linux- 2048 at the command line.md rename to published/201901/20181209 Powers of two, powers of Linux- 2048 at the command line.md diff --git a/published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/published/201901/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md similarity index 100% rename from published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md rename to published/201901/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md diff --git a/published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/published/201901/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md similarity index 100% rename from published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md rename to published/201901/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md diff --git a/published/20181210 Snake your way across your Linux terminal.md b/published/201901/20181210 Snake your way across your Linux terminal.md similarity index 100% rename from published/20181210 Snake your way across your Linux terminal.md rename to published/201901/20181210 Snake your way across your Linux terminal.md diff --git a/published/20181211 Winterize your Bash prompt in Linux.md b/published/201901/20181211 Winterize your Bash prompt in Linux.md similarity index 100% rename from published/20181211 Winterize your Bash prompt in Linux.md rename to published/201901/20181211 Winterize your Bash prompt in Linux.md diff --git a/published/20181212 5 resolutions for open source project maintainers.md b/published/201901/20181212 5 resolutions for open source project maintainers.md similarity index 100% rename from published/20181212 5 resolutions for open source project maintainers.md rename to published/201901/20181212 5 resolutions for open source project maintainers.md diff --git a/published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/published/201901/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md similarity index 100% rename from published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md rename to published/201901/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md diff --git a/published/20181214 The Linux terminal is no one-trick pony.md b/published/201901/20181214 The Linux terminal is no one-trick pony.md similarity index 100% rename from published/20181214 The Linux terminal is no one-trick pony.md rename to published/201901/20181214 The Linux terminal is no one-trick pony.md diff --git a/published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/published/201901/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md similarity index 100% rename from published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md rename to published/201901/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/published/20181217 4 cool new projects to try in COPR for December 2018.md b/published/201901/20181217 4 cool new projects to try in COPR for December 2018.md similarity index 100% rename from published/20181217 4 cool new projects to try in COPR for December 2018.md rename to published/201901/20181217 4 cool new projects to try in COPR for December 2018.md diff --git a/published/20181217 Working with tarballs on Linux.md b/published/201901/20181217 Working with tarballs on Linux.md similarity index 100% rename from published/20181217 Working with tarballs on Linux.md rename to published/201901/20181217 Working with tarballs on Linux.md diff --git a/published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/published/201901/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md similarity index 100% rename from published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md rename to published/201901/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md diff --git a/published/20181218 Use your Linux terminal to celebrate a banner year.md b/published/201901/20181218 Use your Linux terminal to celebrate a banner year.md similarity index 100% rename from published/20181218 Use your Linux terminal to celebrate a banner year.md rename to published/201901/20181218 Use your Linux terminal to celebrate a banner year.md diff --git a/published/20181219 How to open source your Python library.md b/published/201901/20181219 How to open source your Python library.md similarity index 100% rename from published/20181219 How to open source your Python library.md rename to published/201901/20181219 How to open source your Python library.md diff --git a/published/20181219 Solve a puzzle at the Linux command line with nudoku.md b/published/201901/20181219 Solve a puzzle at the Linux command line with nudoku.md similarity index 100% rename from published/20181219 Solve a puzzle at the Linux command line with nudoku.md rename to published/201901/20181219 Solve a puzzle at the Linux command line with nudoku.md diff --git a/published/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/published/201901/20181220 How To Install Microsoft .NET Core SDK On Linux.md similarity index 100% rename from published/20181220 How To Install Microsoft .NET Core SDK On Linux.md rename to published/201901/20181220 How To Install Microsoft .NET Core SDK On Linux.md diff --git a/published/20181220 Let your Linux terminal speak its mind.md b/published/201901/20181220 Let your Linux terminal speak its mind.md similarity index 100% rename from published/20181220 Let your Linux terminal speak its mind.md rename to published/201901/20181220 Let your Linux terminal speak its mind.md diff --git a/published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/published/201901/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md similarity index 100% rename from published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md rename to published/201901/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md diff --git a/published/20181221 How to Build a Netboot Server, Part 3.md b/published/201901/20181221 How to Build a Netboot Server, Part 3.md similarity index 100% rename from published/20181221 How to Build a Netboot Server, Part 3.md rename to published/201901/20181221 How to Build a Netboot Server, Part 3.md diff --git a/published/20181222 A Tale of HTTP-2.md b/published/201901/20181222 A Tale of HTTP-2.md similarity index 100% rename from published/20181222 A Tale of HTTP-2.md rename to published/201901/20181222 A Tale of HTTP-2.md diff --git a/published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/published/201901/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md similarity index 100% rename from published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md rename to published/201901/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md diff --git a/published/20181222 Watch YouTube videos at the Linux terminal.md b/published/201901/20181222 Watch YouTube videos at the Linux terminal.md similarity index 100% rename from published/20181222 Watch YouTube videos at the Linux terminal.md rename to published/201901/20181222 Watch YouTube videos at the Linux terminal.md diff --git a/published/20181223 The Linux command line can fetch fun from afar.md b/published/201901/20181223 The Linux command line can fetch fun from afar.md similarity index 100% rename from published/20181223 The Linux command line can fetch fun from afar.md rename to published/201901/20181223 The Linux command line can fetch fun from afar.md diff --git a/published/20190103 How to create presentations with Beamer.md b/published/201901/20190103 How to create presentations with Beamer.md similarity index 100% rename from published/20190103 How to create presentations with Beamer.md rename to published/201901/20190103 How to create presentations with Beamer.md diff --git a/published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/published/201901/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md similarity index 100% rename from published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md rename to published/201901/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md diff --git a/published/20190104 Managing dotfiles with rcm.md b/published/201901/20190104 Managing dotfiles with rcm.md similarity index 100% rename from published/20190104 Managing dotfiles with rcm.md rename to published/201901/20190104 Managing dotfiles with rcm.md diff --git a/published/20190107 Getting started with Pelican- A Python-based static site generator.md b/published/201901/20190107 Getting started with Pelican- A Python-based static site generator.md similarity index 100% rename from published/20190107 Getting started with Pelican- A Python-based static site generator.md rename to published/201901/20190107 Getting started with Pelican- A Python-based static site generator.md diff --git a/published/20190109 Bash 5.0 Released with New Features.md b/published/201901/20190109 Bash 5.0 Released with New Features.md similarity index 100% rename from published/20190109 Bash 5.0 Released with New Features.md rename to published/201901/20190109 Bash 5.0 Released with New Features.md diff --git a/published/20190109 Understanding -etc-services file in Linux.md b/published/201901/20190109 Understanding -etc-services file in Linux.md similarity index 100% rename from published/20190109 Understanding -etc-services file in Linux.md rename to published/201901/20190109 Understanding -etc-services file in Linux.md diff --git a/published/20190113 Get started with Joplin, a note-taking app.md b/published/201901/20190113 Get started with Joplin, a note-taking app.md similarity index 100% rename from published/20190113 Get started with Joplin, a note-taking app.md rename to published/201901/20190113 Get started with Joplin, a note-taking app.md diff --git a/published/20190114 Get started with Wekan, an open source kanban board.md b/published/201901/20190114 Get started with Wekan, an open source kanban board.md similarity index 100% rename from published/20190114 Get started with Wekan, an open source kanban board.md rename to published/201901/20190114 Get started with Wekan, an open source kanban board.md diff --git a/published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/published/201901/20190114 How To Move Multiple File Types Simultaneously From Commandline.md similarity index 100% rename from published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md rename to published/201901/20190114 How To Move Multiple File Types Simultaneously From Commandline.md diff --git a/published/20190114 How to Build a Netboot Server, Part 4.md b/published/201901/20190114 How to Build a Netboot Server, Part 4.md similarity index 100% rename from published/20190114 How to Build a Netboot Server, Part 4.md rename to published/201901/20190114 How to Build a Netboot Server, Part 4.md diff --git a/published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/published/201901/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md similarity index 100% rename from published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md rename to published/201901/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md diff --git a/published/20190114 You (probably) don-t need Kubernetes.md b/published/201901/20190114 You (probably) don-t need Kubernetes.md similarity index 100% rename from published/20190114 You (probably) don-t need Kubernetes.md rename to published/201901/20190114 You (probably) don-t need Kubernetes.md diff --git a/published/20190115 Linux Tools- The Meaning of Dot.md b/published/201901/20190115 Linux Tools- The Meaning of Dot.md similarity index 100% rename from published/20190115 Linux Tools- The Meaning of Dot.md rename to published/201901/20190115 Linux Tools- The Meaning of Dot.md diff --git a/published/20190118 Get started with WTF, a dashboard for the terminal.md b/published/201901/20190118 Get started with WTF, a dashboard for the terminal.md similarity index 100% rename from published/20190118 Get started with WTF, a dashboard for the terminal.md rename to published/201901/20190118 Get started with WTF, a dashboard for the terminal.md diff --git a/published/20190118 Top 5 Linux Server Distributions.md b/published/201901/20190118 Top 5 Linux Server Distributions.md similarity index 100% rename from published/20190118 Top 5 Linux Server Distributions.md rename to published/201901/20190118 Top 5 Linux Server Distributions.md diff --git a/published/20190123 Getting started with Isotope, an open source webmail client.md b/published/201901/20190123 Getting started with Isotope, an open source webmail client.md similarity index 100% rename from published/20190123 Getting started with Isotope, an open source webmail client.md rename to published/201901/20190123 Getting started with Isotope, an open source webmail client.md From 7b7b1bff4a311bee8812de88e12720d59ebe1429 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Thu, 31 Jan 2019 17:00:20 +0000 Subject: [PATCH 0887/4278] Revert "Update 20181222 How to detect automatically generated emails.md" This reverts commit c8477f3413db743d7868bbd7e42826dce22b7075. --- .../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 3ab907dd27e3690f6ba81415a27acd92aa29ad46 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Fri, 1 Feb 2019 06:07:43 +0800 Subject: [PATCH 0888/4278] hankchow translating --- sources/tech/20190129 More About Angle Brackets in Bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190129 More About Angle Brackets in Bash.md b/sources/tech/20190129 More About Angle Brackets in Bash.md index 6a733a1ccc..5632fe6321 100644 --- a/sources/tech/20190129 More About Angle Brackets in Bash.md +++ b/sources/tech/20190129 More About Angle Brackets in Bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5bef5c1a9e561db4cf16e774f7a685baa33ec213 Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 31 Jan 2019 19:25:35 -0500 Subject: [PATCH 0889/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180611 3 open source alternatives to Adobe Lightroom.md | 2 ++ 1 file changed, 2 insertions(+) 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 664c054913..c489b0f0f1 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,3 +1,5 @@ +scoutydren is translating + 3 open source alternatives to Adobe Lightroom ====== From 1d9eb78b8efae14db10ca4bacfcad82b81117253 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 1 Feb 2019 10:32:17 +0800 Subject: [PATCH 0890/4278] translated --- ...Tint2, an open source taskbar for Linux.md | 59 ------------------- ...Tint2, an open source taskbar for Linux.md | 59 +++++++++++++++++++ 2 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md create mode 100644 translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md diff --git a/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md deleted file mode 100644 index e8afdbb417..0000000000 --- a/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: 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)) - -Get started with Tint2, an open source taskbar for Linux -====== - -Tint2, the 14th in our series on open source tools that will make you more productive in 2019, offers a consistent user experience with any window manager. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl) - -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 14th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Tint2 - -One of the best ways for me to be more productive is to use a clean interface with as little distraction as possible. As a Linux user, this means using a minimal window manager like [Openbox][1], [i3][2], or [Awesome][3]. Each has customization options that make me more efficient. The one thing that slows me down is that none has a consistent configuration, so I have to tweak and re-tune my window manager constantly. - -![](https://opensource.com/sites/default/files/uploads/tint2-1.png) - -[Tint2][4] is a lightweight panel and taskbar that provides a consistent experience with any window manager. It is included with most distributions, so it is as easy to install as any other package. - -It includes two programs, Tint2 and Tint2conf. At first launch, Tint2 starts with its default layout and theme. The default configuration includes multiple web browsers, the tint2conf program, a taskbar, and a system tray. - -![](https://opensource.com/sites/default/files/uploads/tint2-2.png) - -Launching the configuration tool allows you to select from the included themes and customize the top, bottom, and sides of the screen. I recommend starting with the theme that is closest to what you want and customizing from there. - -![](https://opensource.com/sites/default/files/uploads/tint2-3.png) - -Within the themes, you can customize where panel items are placed as well as background and font options for every item on the panel. You can also add and remove items from the launcher. - -![](https://opensource.com/sites/default/files/uploads/tint2-4.png) - -Tint2 is a lightweight taskbar that helps you get to the tools you need quickly and efficiently. It is highly customizable, unobtrusive (unless the user wants it not to be), and compatible with almost any window manager on a Linux desktop. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-tint2 - -作者:[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://openbox.org/wiki/Main_Page -[2]: https://i3wm.org/ -[3]: https://awesomewm.org/ -[4]: https://gitlab.com/o9000/tint2 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 new file mode 100644 index 0000000000..ef58de9fe5 --- /dev/null +++ b/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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)) + +开始使用 Tint2,一款 Linux 中的开源任务栏 +====== + +Tint2 是我们在开源工具系列中的第 14 个工具,它将在 2019 年提高你的工作效率,能在任何窗口管理器中提供一致的用户体验。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 14个工具来帮助你在 2019 年更有效率。 + +### Tint2 + +让我提高工作效率的最佳方法之一是使用尽可能不让我分心的干净界面。作为 Linux 用户,这意味着使用一种最小的窗口管理器,如 [Openbox][1]、[i3][2] 或 [Awesome][3]。它们每种都有让我更有效率的自定义选项。但让我失望的一件事是,它们都没有一致的配置,所以我不得不经常重新调整我的窗口管理器。 + +![](https://opensource.com/sites/default/files/uploads/tint2-1.png) + +[Tint2][4] 是一个轻量级面板和任务栏,它可以为任何窗口管理器提供一致的体验。它包含在大多数发行版中,因此它与任何其他软件包一样易于安装。 + +它包括两个程序,Tint2 和 Tint2conf。首次启动时,Tint2 以默认布局和主题启动。默认配置包括多个 Web 浏览器、tint2conf 程序,任务栏和系统托盘。 + +![](https://opensource.com/sites/default/files/uploads/tint2-2.png) + +启动配置工具能让你选择主题并自定义屏幕的顶部、底部和侧边栏。我建议从最接近你想要的主题开始,然后从那里进行自定义。 + +![](https://opensource.com/sites/default/files/uploads/tint2-3.png) + +在主题中,你可以自定义面板项目的位置以及面板上每个项目的背景和字体选项。你还可以在启动器中添加和删除项目。 + +![](https://opensource.com/sites/default/files/uploads/tint2-4.png) + +Tint2 是一个轻量级的任务栏,可以帮助你快速有效地获得所需的工具。它是高度可定制的,不显眼的 (除非用户不希望这样),并且几乎与 Linux 桌面中的任何窗口管理器兼容。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [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://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 From 3448948a48958daaa56b0246209b9d2d333d67dc Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 1 Feb 2019 10:36:22 +0800 Subject: [PATCH 0891/4278] translating --- .../tech/20190128 3 simple and useful GNOME Shell extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md b/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md index c22feddf01..d7384030c5 100644 --- a/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md +++ b/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6c2a93dfe88605070fc6fb14c5cdab4cb6b08cf0 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 1 Feb 2019 11:52:47 +0800 Subject: [PATCH 0892/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=20Crea?= =?UTF-8?q?te=20an=20online=20store=20with=20this=20Java-based=20framework?= =?UTF-8?q?=20sources/tech/20190129=20Create=20an=20online=20store=20with?= =?UTF-8?q?=20this=20Java-based=20framework.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ne store with this Java-based framework.md | 235 ++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 sources/tech/20190129 Create an online store with this Java-based framework.md diff --git a/sources/tech/20190129 Create an online store with this Java-based framework.md b/sources/tech/20190129 Create an online store with this Java-based framework.md new file mode 100644 index 0000000000..b72a8551de --- /dev/null +++ b/sources/tech/20190129 Create an online store with this Java-based framework.md @@ -0,0 +1,235 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create an online store with this Java-based framework) +[#]: via: (https://opensource.com/article/19/1/scipio-erp) +[#]: author: (Paul Piper https://opensource.com/users/madppiper) + +Create an online store with this Java-based framework +====== +Scipio ERP comes with a large range of applications and functionality. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0) + +So you want to sell products or services online, but either can't find a fitting software or think customization would be too costly? [Scipio ERP][1] may just be what you are looking for. + +Scipio ERP is a Java-based open source e-commerce framework that comes with a large range of applications and functionality. The project was forked from [Apache OFBiz][2] in 2014 with a clear focus on better customization and a more modern appeal. The e-commerce component is quite extensive and works in a multi-store setup, internationally, and with a wide range of product configurations, and it's also compatible with modern HTML frameworks. The software also provides standard applications for many other business cases, such as accounting, warehouse management, or sales force automation. It's all highly standardized and therefore easy to customize, which is great if you are looking for more than a virtual cart. + +The system makes it very easy to keep up with modern web standards, too. All screens are constructed using the system's "[templating toolkit][3]," an easy-to-learn macro set that separates HTML from all applications. Because of it, every application is already standardized to the core. Sounds confusing? It really isn't—it all looks a lot like HTML, but you write a lot less of it. + +### Initial setup + +Before you get started, make sure you have Java 1.8 (or greater) SDK and a Git client installed. Got it? Great! Next, check out the master branch from GitHub: + +``` +git clone https://github.com/ilscipio/scipio-erp.git +cd scipio-erp +git checkout master +``` + +To set up the system, simply run **./install.sh** and select either option from the command line. Throughout development, it is best to stick to an **installation for development** (Option 1), which will also install a range of demo data. For professional installations, you can modify the initial config data ("seed data") so it will automatically set up the company and catalog data for you. By default, the system will run with an internal database, but it [can also be configured][4] with a wide range of relational databases such as PostgreSQL and MariaDB. + +![Setup wizard][6] + +Follow the setup wizard to complete your initial configuration, + +Start the system with **./start.sh** and head over to **** to complete the configuration. If you installed with demo data, you can log in with username **admin** and password **scipio**. During the setup wizard, you can set up a company profile, accounting, a warehouse, your product catalog, your online store, and additional user profiles. Keep the website entries on the product store configuration screen for now. The system allows you to run multiple webstores with different underlying code; unless you want to do that, it is easiest to stick to the defaults. + +Congratulations, you just installed Scipio ERP! Play around with the screens for a minute or two to get a feel for the functionality. + +### Shortcuts + +Before you jump into the customization, here are a few handy commands that will help you along the way: + + * Create a shop-override: **./ant create-component-shop-override** + * Create a new component: **./ant create-component** + * Create a new theme component: **./ant create-theme** + * Create admin user: **./ant create-admin-user-login** + * Various other utility functions: **./ant -p** + * Utility to install & update add-ons: **./git-addons help** + + + +Also, make a mental note of the following locations: + + * Scripts to run Scipio as a service: **/tools/scripts/** + * Log output directory: **/runtime/logs** + * Admin application: **** + * E-commerce application: **** + + + +Last, Scipio ERP structures all code in the following five major directories: + + * Framework: framework-related sources, the application server, generic screens, and configurations + * Applications: core applications + * Addons: third-party extensions + * Themes: modifies the look and feel + * Hot-deploy: your own components + + + +Aside from a few configurations, you will be working within the hot-deploy and themes directories. + +### Webstore customizations + +To really make the system your own, start thinking about [components][7]. Components are a modular approach to override, extend, and add to the system. Think of components as self-contained web modules that capture information on databases ([entity][8]), functions ([services][9]), screens ([views][10]), [events and actions][11], and web applications. Thanks to components, you can add your own code while remaining compatible with the original sources. + +Run **./ant create-component-shop-override** and follow the steps to create your webstore component. A new directory will be created inside of the hot-deploy directory, which extends and overrides the original e-commerce application. + +![component directory structure][13] + +A typical component directory structure. + +Your component will have the following directory structure: + + * config: configurations + * data: seed data + * entitydef: database table definitions + * script: Groovy script location + * servicedef: service definitions + * src: Java classes + * webapp: your web application + * widget: screen definitions + + + +Additionally, the **ivy.xml** file allows you to add Maven libraries to the build process and the **ofbiz-component.xml** file defines the overall component and web application structure. Apart from the obvious, you will also find a **controller.xml** file inside the web apps' **WEB-INF** directory. This allows you to define request entries and connect them to events and screens. For screens alone, you can also use the built-in CMS functionality, but stick to the core mechanics first. Familiarize yourself with **/applications/shop/** before introducing changes. + +#### Adding custom screens + +Remember the [templating toolkit][3]? You will find it used on every screen. Think of it as a set of easy-to-learn macros that structure all content. Here's an example: + +``` +<@section title="Title"> +    <@heading id="slider">Slider +    <@row> +        <@cell columns=6> +            <@slider id="" class="" controls=true indicator=true> +                <@slide link="#" image="https://placehold.it/800x300">Just some content… +                <@slide title="This is a title" link="#" image="https://placehold.it/800x300"> +            +        +        <@cell columns=6>Second column +    + +``` + +Not too difficult, right? Meanwhile, themes contain the HTML definitions and styles. This hands the power over to your front-end developers, who can define the output of each macro and otherwise stick to their own build tools for development. + +Let's give it a quick try. First, define a request on your own webstore. You will modify the code for this. A built-in CMS is also available at **** , which allows you to create new templates and screens in a much more efficient way. It is fully compatible with the templating toolkit and comes with example templates that can be adopted to your preferences. But since we are trying to understand the system here, let's go with the more complicated way first. + +Open the **[controller.xml][14]** file inside of your shop's webapp directory. The controller keeps track of request events and performs actions accordingly. The following will create a new request under **/shop/test** : + +``` + + +      +      + +``` + +You can define multiple responses and, if you want, you could use an event or a service call inside the request to determine which response you may want to use. I opted for a response of type "view." A view is a rendered response; other types are request-redirects, forwards, and alike. The system comes with various renderers and allows you to determine the output later; to do so, add the following: + +``` + + +``` + +Replace **my-component** with your own component name. Then you can define your very first screen by adding the following inside the tags within the **widget/CommonScreens.xml** file: + +``` + +       
+            +            +            +                +                    +                        +                    +                +            +       
+   
+``` + +Screens are actually quite modular and consist of multiple elements ([widgets, actions, and decorators][15]). For the sake of simplicity, leave this as it is for now, and complete the new webpage by adding your very first templating toolkit file. For that, create a new **webapp/mycomponent/test/test.ftl** file and add the following: + +``` +<@alert type="info">Success! +``` + +![Custom screen][17] + +A custom screen. + +Open **** and marvel at your own accomplishments. + +#### Custom themes + +Modify the look and feel of the shop by creating your very own theme. All themes can be found as components inside of the themes folder. Run **./ant create-theme** to add your own. + +![theme component layout][19] + +A typical theme component layout. + +Here's a list of the most important directories and files: + + * Theme configuration: **data/*ThemeData.xml** + * Theme-specific wrapping HTML: **includes/*.ftl** + * Templating Toolkit HTML definition: **includes/themeTemplate.ftl** + * CSS class definition: **includes/themeStyles.ftl** + * CSS framework: **webapp/theme-title/*** + + + +Take a quick look at the Metro theme in the toolkit; it uses the Foundation CSS framework and makes use of all the things above. Afterwards, set up your own theme inside your newly constructed **webapp/theme-title** directory and start developing. The Foundation-shop theme is a very simple shop-specific theme implementation that you can use as a basis for your own work. + +Voila! You have set up your own online store and are ready to customize! + +![Finished Scipio ERP shop][21] + +A finished shop based on Scipio ERP. + +### What's next? + +Scipio ERP is a powerful framework that simplifies the development of complex e-commerce applications. For a more complete understanding, check out the project [documentation][7], try the [online demo][22], or [join the community][23]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/scipio-erp + +作者:[Paul Piper][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/madppiper +[b]: https://github.com/lujun9972 +[1]: https://www.scipioerp.com +[2]: https://ofbiz.apache.org/ +[3]: https://www.scipioerp.com/community/developer/freemarker-macros/ +[4]: https://www.scipioerp.com/community/developer/installation-configuration/configuration/#database-configuration +[5]: /file/419711 +[6]: https://opensource.com/sites/default/files/uploads/setup_step5_sm.jpg (Setup wizard) +[7]: https://www.scipioerp.com/community/developer/architecture/components/ +[8]: https://www.scipioerp.com/community/developer/entities/ +[9]: https://www.scipioerp.com/community/developer/services/ +[10]: https://www.scipioerp.com/community/developer/views-requests/ +[11]: https://www.scipioerp.com/community/developer/events-actions/ +[12]: /file/419716 +[13]: https://opensource.com/sites/default/files/uploads/component_structure.jpg (component directory structure) +[14]: https://www.scipioerp.com/community/developer/views-requests/request-controller/ +[15]: https://www.scipioerp.com/community/developer/views-requests/screen-widgets-decorators/ +[16]: /file/419721 +[17]: https://opensource.com/sites/default/files/uploads/success_screen_sm.jpg (Custom screen) +[18]: /file/419726 +[19]: https://opensource.com/sites/default/files/uploads/theme_structure.jpg (theme component layout) +[20]: /file/419731 +[21]: https://opensource.com/sites/default/files/uploads/finished_shop_1_sm.jpg (Finished Scipio ERP shop) +[22]: https://www.scipioerp.com/demo/ +[23]: https://forum.scipioerp.com/ From df0892f4570d2e975b7d1a65a79c6a8081ffe4e0 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 1 Feb 2019 11:55:02 +0800 Subject: [PATCH 0893/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=20Get?= =?UTF-8?q?=20started=20with=20gPodder,=20an=20open=20source=20podcast=20c?= =?UTF-8?q?lient=20sources/tech/20190129=20Get=20started=20with=20gPodder,?= =?UTF-8?q?=20an=20open=20source=20podcast=20client.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... gPodder, an open source podcast client.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..ca1556e16d --- /dev/null +++ b/sources/tech/20190129 Get started with gPodder, an open source podcast client.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 56e85104cae6376ad263c550e77622bbcd97e6bd Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 1 Feb 2019 11:56:09 +0800 Subject: [PATCH 0894/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=20More?= =?UTF-8?q?=20About=20Angle=20Brackets=20in=20Bash=20sources/tech/20190129?= =?UTF-8?q?=20More=20About=20Angle=20Brackets=20in=20Bash.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90129 More About Angle Brackets in Bash.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20190129 More About Angle Brackets in Bash.md diff --git a/sources/tech/20190129 More About Angle Brackets in Bash.md b/sources/tech/20190129 More About Angle Brackets in Bash.md new file mode 100644 index 0000000000..6a733a1ccc --- /dev/null +++ b/sources/tech/20190129 More About Angle Brackets in Bash.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +More About Angle Brackets in Bash +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/bash-angles.png?itok=mVFnxPzF) + +In the previous article, we [introduced the subject of angle brackets][1] (`< >`) and demonstrated some of their uses. Here, we'll look at the topic from a few more angles. Let's dive right in. + +You can use `<` to trick a tool into believing the output of a command is data from a file. + +Let's say you are not sure your backup is complete, and you want to check that a certain directory contains all the files copied over from the original. You can try this: + +``` +diff <(ls /original/dir/) <(ls /backup/dir/) +``` + +[`diff`][2] is a tool that typically compares two text files line by line, looking for differences. Here it gets the output from two `ls` commands and treats them as if coming from a file and compares them as such. + +Note that there is no space between the `<` and the `(...)`. + +Running that on the original and backup of a directory where I save pretty pictures, I get: + +``` +diff <(ls /My/Pictures/) <(ls /My/backup/Pictures/) 5d4 < Dv7bIIeUUAAD1Fc.jpg:large.jpg +``` + +The `<` in the output is telling me that there is file ( _Dv7bIIeUUAAD1Fc.jpg:large.jpg_ ) on the left side of the comparison (in _/My/Pictures_ ) that is not on the right side of the comparison (in _/My/backup/Pictures_ ), which means copying over has failed for some reason. If `diff` didn't cough up any output, it would mean that the list of files were the same. + +So, you may be wondering, if you can take the output of a command or command line, make it look like the contents of a file, and feed it to an instruction that is expecting a file, that means that in the _sorting by favorite actor_ example from above, you could've done away with the intermediate file and just piped the output from the loop into `sort`. + +In short, yep! The line: + +``` +sort -r <(while read -r name surname films;do echo $films $name $surname ; done < CBactors) +``` + +does the trick nicely. + +### Here string! Good string! + +There is one more case for redirecting data using angle brackets (or arrows, or whatever you want to call them). + +You may be familiar with the practice of passing variables to commands using `echo` and a pipe (`|`). Say you want to convert a variable containing a string to uppercase characters because... I don't know... YOU LIKE SHOUTING A LOT. You could do this: + +``` +myvar="Hello World" echo $myvar | tr '[:lower:]' '[:upper:]' HELLO WORLD +``` + +The [`tr`][3] command _tr_ anslates strings to different formats. In the example above, you are telling `tr` to change all the lowercase characters that come along in the string to uppercase characters. + +It is important to know that you are not passing on the variable, but only its contents, that is, the string " _Hello World_ ". This is called the _here string_ , as in " _it is here, in this context, that we know what string we are dealing with_ ". But there is shorter, clearer, and all round better way of delivering _here strings_ to commands. Using + +``` +tr '[:lower:]' '[:upper:]' <<< $myvar +``` + +does the same thing with no need to use echo or a pipe. It also uses angle brackets, which is the whole obsessive point of this article. + +### Conclusion + +Again, Bash proves to give you lots of options with very little. I mean, who would've thunk that you could do so much with two simple characters like `<` and `>`? + +The thing is we aren't done. There are plenty of more characters that bring meaning to chains of Bash instructions. Without some background, they can make shell commands look like gibberish. Hopefully, post by post, we can help you decipher them. Until next time! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-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/understanding-angle-brackets-bash +[2]: https://linux.die.net/man/1/diff +[3]: https://linux.die.net/man/1/tr From b3410e4db1b88a828d3464b6983ff932fe14bde8 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 1 Feb 2019 11:57:52 +0800 Subject: [PATCH 0895/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190128=20Usin?= =?UTF-8?q?g=20more=20to=20view=20text=20files=20at=20the=20Linux=20comman?= =?UTF-8?q?d=20line=20sources/tech/20190128=20Using=20more=20to=20view=20t?= =?UTF-8?q?ext=20files=20at=20the=20Linux=20command=20line.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ew text files at the Linux command line.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/tech/20190128 Using more to view text files at the Linux command line.md diff --git a/sources/tech/20190128 Using more to view text files at the Linux command line.md b/sources/tech/20190128 Using more to view text files at the Linux command line.md new file mode 100644 index 0000000000..872df3eba8 --- /dev/null +++ b/sources/tech/20190128 Using more to view text files at the Linux command line.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +Using more to view text files at the Linux command line +====== +Text files and Linux go hand in hand. Or so it seems. But how you view those text files depends on what tools you're comfortable with. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE) + +There are a number of utilities that enable you to view text files when you're at the command line. One of them is [**more**][1]. + +**more** is similar to another tool I wrote about called **[less][2]**. The main difference is that **more** only allows you to move forward in a file. + +While that may seem limiting, it has some useful features that are good to know about. Let's take a quick look at what **more** can do and how to use it. + +### The basics + +Let's say you have a text file and want to read it at the command line. Just open the terminal, pop into the directory that contains the file, and type this command: + +``` +more +``` + +For example, **more jekyll-article.md**. + +![](https://opensource.com/sites/default/files/uploads/more-viewing-file.png) + +Press the Spacebar on your keyboard to move through the file or press **q** to quit. + +If you want to search for some text in the file, press the **/** key followed by the word or term you want to find. For example, to find the phrase terminal, type: + +``` +/terminal +``` + +![](https://opensource.com/sites/default/files/uploads/more-searching.png) + +Search is case-sensitive. Typing Terminal isn't the same as typing terminal. + +### Using more with other utilities + +You can pipe text from other command line utilities into **more**. Why do that? Because sometimes the text that those tools spew out spans more than one page. + +To do that, type the command and any options, followed by the pipe symbol ( **|** ), followed by **more**. For example, let's say you have a directory that has a large number of files in it. You can use **more** with the **ls** command to get a full view of the contents of the directory: + +``` +ls | more +``` + +![](https://opensource.com/sites/default/files/uploads/more-with_ls_cmd.png) + +You can also use **more** with the **grep** command to find text in multiple files. In this example, I use **grep** to find the text productivity in multiple source files for my articles: + +``` +**grep ‘productivity’ core.md Dict.md lctt2014.md lctt2016.md lctt2018.md README.md | more** +``` + +![](https://opensource.com/sites/default/files/uploads/more-with_grep_cmd.png) + +Another utility you can combine with **more** is **ps** (which lists processes that are running on your system). Again, this comes in handy when there are a large number of processes running on your system and you need a view of all of them—for example, to find one that you need to kill. To do that, use this command: + +``` +ps -u scott | more +``` + +Note that you'd replace scott with your username. + +![](https://opensource.com/sites/default/files/uploads/more-with_ps_cmd.png) + +As I mentioned at the beginning of this article, **more** is easy to use. It's definitely not as flexible as its cousin **less** , but it can be useful to know. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/more-text-files-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://en.wikipedia.org/wiki/More_(command) +[2]: https://opensource.com/article/18/4/using-less-view-text-files-command-line From a93fb1c5cc5bf6a2815b874d11850107234b1598 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 1 Feb 2019 12:12:16 +0800 Subject: [PATCH 0896/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190117=20How?= =?UTF-8?q?=20to=20Update/Change=20Users=20Password=20in=20Linux=20Using?= =?UTF-8?q?=20Different=20Ways=20sources/tech/20190117=20How=20to=20Update?= =?UTF-8?q?-Change=20Users=20Password=20in=20Linux=20Using=20Different=20W?= =?UTF-8?q?ays.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Password in Linux Using Different Ways.md | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md diff --git a/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md b/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md new file mode 100644 index 0000000000..d3ca9cb0ab --- /dev/null +++ b/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md @@ -0,0 +1,251 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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/) + +How to Update/Change Users Password in Linux Using Different Ways +====== + +It’s a basic thing to set a user password whenever you create an user account in Linux. + +Everybody uses passwd command followed by the user name `passwd USERNAME` to set a password for a user. + +Make sure you have to set a hard and guess password that will help you to make the system more secure. + +I mean to say, it should be the combination of Alphabets, Symbols and numbers. + +Also, i advise you to change the password at least once in a month for security reason. + +When you use the passwd command it will ask you to enter the password twice to set it. It’s a native method to set a user password. + +If you don’t want to update the password twice and would like to do this in different way? + +Yes, we can. There will be a possibility to do. + +If you are working as a Linux admin you might have asked the below questions many times. + +Some of you may or may not got answer for these questions. + +Whatever it’s, don’t worry we are here to answer your all questions. + + * How to Update/Change Users Password in Single Command? + * How to Update/Change a Same Password for Multiple users in Linux? + * How to Update/Change Multiple Users Password in Linux? + * How to Update/Change Password for Multiple Users in Linux? + * How to Update/Change Different Password for Multiple Users in Linux? + * How to Update/Change Users Password in Multiple Linux Servers? + * How to Update/Change Multiple Users Password in Multiple Linux Servers? + + + +### Method-1: Using passwd Command + +passwd command is a standard method to set or update or change password for users in Linux. The below way is a standard method to do it. + +``` +# passwd renu +Changing password for user renu. +New password: +BAD PASSWORD: The password contains the user name in some form +Retype new password: +passwd: all authentication tokens updated successfully. +``` + +Run the following command if you would like to set or change password with single command. This allow users to update password in a single command. + +``` +# echo "new_password" | passwd --stdin thanu +Changing password for user thanu. +passwd: all authentication tokens updated successfully. +``` + +### Method-2: Using chpasswd Command + +chpasswd is an another command will allow us to set or update or change password for users in Linux. Use the following format if you would like to use chpasswd command to change password for user in a single command. + +``` +# echo "thanu:new_password" | chpasswd +``` + +### Method-3: How to Set Different Password for Multiple Users + +Use the below script if you would like to set or update or change a password for multiple users in Linux with different password. + +To do so, first we need to get a users list by using the following command. The below command will list the users who’s having `/home` directory and redirect the output to `user-list.txt` file. + +``` +# cat /etc/passwd | grep "/home" | cut -d":" -f1 > user-list.txt +``` + +List out the users using cat command. Remove the user from the list if you don’t want to reset the password for the specific user. + +``` +# cat user-list.txt +centos +magi +daygeek +thanu +renu +``` + +Create a following small shell script to achieve this. + +``` +# vi password-update.sh + +#!/bin/sh +for user in `more user-list.txt` +do +echo "[email protected]" | passwd --stdin "$user" +chage -d 0 $user +done +``` + +Set an executable permission to `password-update.sh` file. + +``` +# chmod +x password-update.sh +``` + +Finally run the script to achieve this. + +``` +# ./password-up.sh + +magi +Changing password for user magi. +passwd: all authentication tokens updated successfully. +daygeek +Changing password for user daygeek. +passwd: all authentication tokens updated successfully. +thanu +Changing password for user thanu. +passwd: all authentication tokens updated successfully. +renu +Changing password for user renu. +passwd: all authentication tokens updated successfully. +``` + +### Method-4: How to Set a Same Password for Multiple Users + +Use the below script if you would like to set or update or change a same password for multiple users in Linux. + +``` +# vi password-update.sh + +#!/bin/sh +for user in `more user-list.txt` +do +echo "new_password" | passwd --stdin "$user" +chage -d 0 $user +done +``` + +### Method-5: How to Change User password in Multiple Servers + +Use the following script if you want to change a user password in multiple servers. In my case, we are going to change a password for `renu` user. Make sure you have to give the user name which you want to update the password instead of us. + +Make sure you have to update the servers list into `server-list.txt` file. Each server should be in separate line. + +``` +# vi password-update.sh + +#!/bin/bash +for server in `cat server-list.txt` +do +ssh [email protected]$server 'passwd --stdin renu < Date: Thu, 31 Jan 2019 13:32:48 +0800 Subject: [PATCH 0897/4278] Check translation of An Introduction to Go. --- .../tech/20181224 An Introduction to Go.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index a9f50f6770..04adb076dc 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -12,11 +12,11 @@ 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开发。这门语言的设计起始于 2017 年,并在 2019 年推出最初版本;而第一个稳定版本是 2012 年发布的 1.0 版本。 -Go 有 C 风格语法(没有预处理器),垃圾回收机制,而且类似它在贝尔实验室里被开发出来的前辈们,Newsqueak (Rob Pike)、Alef (Phil Winterbottom) 和 Inferno (Pike, Ritchie, et al.),使用所谓的 goroutines 和 channels(一种基于 Hoare 的“通信顺序进程”理论的协程)提供内建的并发支持。 +Go 有 C 风格的语法(没有预处理器),垃圾回收机制,而且类似它在贝尔实验室里被开发出来的前辈们:Newsqueak (Rob Pike)、Alef (Phil Winterbottom) 和 Inferno (Pike, Ritchie, et al.),使用所谓的 goroutines 和信道(一种基于 Hoare 的“通信顺序进程”理论的协程)提供内建的并发支持。 -Go 程序以包的形式组织。包本质是一个包含 Go 文件的文件夹。包内的所有文件共享相同的命名空间,而包内的符号有两种可见行:以大写字母开头的符号对于其他包是可见,而其他符号则是该包私有的: +Go 程序以包的形式组织。包本质是一个包含 Go 文件的文件夹。包内的所有文件共享相同的命名空间,而包内的符号有两种可见性:以大写字母开头的符号对于其他包是可见,而其他符号则是该包私有的: ``` func PublicFunction() { @@ -36,11 +36,11 @@ Go 有一个相当简单的类型系统:没有子类型(但有类型转换 2. `struct` - 3. `interface` \- 一类方法 + 3. `interface` \- 一组方法的集合 - 4. `map[K, V]` \- 从键类型到值类型的映射 + 4. `map[K, V]` \- 一个从键类型到值类型的映射 - 5. `[number]Type` \- 一些元素类型组成的数组 + 5. `[number]Type` \- 一些 Type 类型的元素组成的数组 6. `[]Type` \- 某种类型的切片(指向具有长度和功能的数组) @@ -64,7 +64,7 @@ Maps、slices 和 channels 是类似于引用的类型——他们实际上是 #### 类型转换 -类型转换类似于 C 或其他语言中的转换。它们写成这样子: +类型转换类似于 C 或其他语言中的类型转换。它们写成这样子: ``` TypeName(value) @@ -80,7 +80,7 @@ const foo = 1 // 无类型整数常量 const foo int = 1 // int 类型常量 ``` -无类型值可以分为以下几类:`UntypedBool`、`UntypedInt`、`UntypedRune`、`UntypedFloat`、`UntypedComplex`、`UntypedString` 以及 `UntypedNil`(Go 称它们为基础类型,other basic kinds are available for the concrete types like `uint8`)。一个无类型值可以赋值给一个从基础类型中派生的具名类型;例如: +无类型值可以分为以下几类:`UntypedBool`、`UntypedInt`、`UntypedRune`、`UntypedFloat`、`UntypedComplex`、`UntypedString` 以及 `UntypedNil`(Go 称它们为基础类型,其他基础种类可用于具体类型,如 `uint8`)。一个无类型值可以赋值给一个从基础类型中派生的具名类型;例如: ``` type someType int @@ -131,9 +131,9 @@ Go 提供了三个主要的控制了语句:`if`、`switch` 和 `for`。这些 * `switch` 语句可以处理空的表达式(等于 true) - * 默认情况下,Go 不会从一个 case 进入下一个 case(不需要 `break`),在程序块的末尾使用 `fallthrough` 则会进入下一个 case。 + * 默认情况下,Go 不会从一个 case 进入下一个 case(不需要 `break`语句),在程序块的末尾使用 `fallthrough` 则会进入下一个 case。 - * 循环语句 `for` 不止能循环值域:`for key, val := range map { do something }` + * 循环语句 `for` 不仅能循环值域:`for key, val := range map { do something }` ### Goroutines @@ -152,14 +152,14 @@ func main() { ### 信道 -Goroutines 通常同信道结合以提供一种通信顺序进程的扩展。信道是一个并发安全的队列,而且可以缓冲或者不缓冲: +Goroutines 通常和信道结合,用来提供一种通信顺序进程的扩展。信道是一个并发安全的队列,而且可以选择是否缓冲数据: ``` var unbuffered = make(chan int) // 直到数据被读取时完成数据块发送 var buffered = make(chan int, 5) // 最多有 5 个未读取的数据块 ``` -运输符 `<-` 用于同单个信道通信。 +运算符 `<-` 用于和单个信道进行通信。 ``` valueReadFromChannel := <- channel @@ -179,7 +179,7 @@ select { ### `defer` 声明 -Go 提供语句 `defer` 允许函数退出时调用执行预定的函数。它可以用于资源释放,例如: +Go 提供语句 `defer` 允许函数退出时调用执行预定的函数。它可以用于进行资源释放操作,例如: ``` func myFunc(someFile io.ReadCloser) { From 63cc67826e32e4749cefd1ce4e3eac97d85ae85c Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 1 Feb 2019 12:58:04 +0800 Subject: [PATCH 0898/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190118=20Secu?= =?UTF-8?q?re=20Email=20Service=20Tutanota=20Has=20a=20Desktop=20App=20Now?= =?UTF-8?q?=20sources/tech/20190118=20Secure=20Email=20Service=20Tutanota?= =?UTF-8?q?=20Has=20a=20Desktop=20App=20Now.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Service Tutanota Has a Desktop App Now.md | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sources/tech/20190118 Secure Email Service Tutanota Has a Desktop App Now.md diff --git a/sources/tech/20190118 Secure Email Service Tutanota Has a Desktop App Now.md b/sources/tech/20190118 Secure Email Service Tutanota Has a Desktop App Now.md new file mode 100644 index 0000000000..f56f1272f2 --- /dev/null +++ b/sources/tech/20190118 Secure Email Service Tutanota Has a Desktop App Now.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Secure Email Service Tutanota Has a Desktop App Now) +[#]: via: (https://itsfoss.com/tutanota-desktop) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Secure Email Service Tutanota Has a Desktop App Now +====== + +[Tutanota][1] recently [announced][2] the release of a desktop app for their email service. The beta is available for Linux, Windows, and macOS. + +### What is Tutanota? + +There are plenty of free, ad-supported email services available online. However, the majority of those email services are not exactly secure or privacy-minded. In this post-[Snowden][3] world, [Tutanota][4] offers a free, secure email service with a focus on privacy. + +Tutanota has a number of eye-catching features, such as: + + * End-to-end encrypted mailbox + * End-to-end encrypted address book + * Automatic end-to-end encrypted emails between users + * End-to-end encrypted emails to any email address with a shared password + * Secure password reset that gives Tutanota absolutely no access + * Strips IP addresses from emails sent and received + * The code that runs Tutanota is [open source][5] + * Two-factor authentication + * Focus on privacy + * Passwords are salted and hashed locally with Bcrypt + * Secure servers located in Germany + * TLS with support for PFS, DMARC, DKIM, DNSSEC, and DANE + * Full-text search of encrypted data executed locally + + + +![][6] +Tutanota on the web + +You can [sign up for an account for free][7]. You can also upgrade your account to get extra features, such as custom domains, custom domain login, domain rules, extra storage, and aliases. They also have accounts available for businesses. + +Tutanota is also available on mobile devices. In fact, it’s [Android app is open source as well][8]. + +This German company is planning to expand beyond email. They hope to offer an encrypted calendar and cloud storage. You can help them reach their goals by [donating][9] via PayPal and cryptocurrency. + +### The New Desktop App from Tutanota + +Tutanota announced the [beta release][2] of the desktop app right before Christmas. They based this app on [Electron][10]. + +![][11] +Tutanota desktop app + +They went the Electron route: + + * to support all three major operating systems with minimum effort. + * to quickly adapt the new desktop clients so that they match new features added to the webmail client. + * to allocate development time to particular desktop features, e.g. offline availability, email import, that will simultaneously be available in all three desktop clients. + + + +Because this is a beta, there are several features missing from the app. The development team at Tutanota is working to add the following features: + + * Email import and synchronization with external mailboxes. This will “enable Tutanota to import emails from external mailboxes and encrypt the data locally on your device before storing it on the Tutanota servers.” + * Offline availability of emails + * Two-factor authentication + + + +### How to Install the Tutanota desktop client? + +![][12]Composing email in Tutanota + +You can [download][2] the beta app directly from Tutanota’s website. They have an [AppImage file for Linux][13], a .exe file for Windows, and a .app file for macOS. You can post any bugs that you encounter to the Tutanota [GitHub account][14]. + +To prove the security of the app, Tutanota signed each version. “The signatures make sure that the desktop clients as well as any updates come directly from us and have not been tampered with.” You can verify the signature using from Tutanota’s [GitHub page][15]. + +Remember, you will need to create a Tutanota account before you can use it. This is email client is designed to work solely with Tutanota. + +### Wrapping up + +I tested out the Tutanota email app on Linux Mint MATE. As to be expected, it was a mirror image of the web app. At this point in time, I don’t see any difference between the desktop app and the web app. The only use case that I can see to use the app now is to have Tutanota in its own window. + +Have you ever used [Tutanota][16]? If not, what is your favorite privacy conscience email service? 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][17]. + +![][18] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/tutanota-desktop + +作者:[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/tutanota-review/ +[2]: https://tutanota.com/blog/posts/desktop-clients/ +[3]: https://en.wikipedia.org/wiki/Edward_Snowden +[4]: https://tutanota.com/ +[5]: https://tutanota.com/blog/posts/open-source-email +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/tutanota2.jpg?resize=800%2C490&ssl=1 +[7]: https://tutanota.com/pricing +[8]: https://itsfoss.com/tutanota-fdroid-release/ +[9]: https://tutanota.com/community +[10]: https://electronjs.org/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/tutanota-app1.png?fit=800%2C486&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/tutanota1.jpg?resize=800%2C405&ssl=1 +[13]: https://itsfoss.com/use-appimage-linux/ +[14]: https://github.com/tutao/tutanota +[15]: https://github.com/tutao/tutanota/blob/master/buildSrc/installerSigner.js +[16]: https://tutanota.com/polo/ +[17]: http://reddit.com/r/linuxusersgroup +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/02/tutanota-featured.png?fit=800%2C450&ssl=1 From ad762dbe2c393a83d639c321453db62cd02288dd Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 1 Feb 2019 12:58:51 +0800 Subject: [PATCH 0899/4278] Delete 20181224 An Introduction to Go.md --- .../tech/20181224 An Introduction to Go.md | 278 ------------------ 1 file changed, 278 deletions(-) delete mode 100644 sources/tech/20181224 An Introduction to Go.md diff --git a/sources/tech/20181224 An Introduction to Go.md b/sources/tech/20181224 An Introduction to Go.md deleted file mode 100644 index 5989b6c913..0000000000 --- a/sources/tech/20181224 An Introduction to Go.md +++ /dev/null @@ -1,278 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: 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/) - -An Introduction to Go -====== - -(What follows is an excerpt from my master’s thesis, almost all of section 2.1, quickly introducing Go to people familiar with CS) - -Go is an imperative programming language for concurrent programming created at and mainly developed by Google, initially mostly by Robert Griesemer, Rob Pike, and Ken Thompson. Design of the language started in 2007, and an initial version was released in 2009; with the first stable version, 1.0 released in 2012 . - -Go has a C-like syntax (without a preprocessor), garbage collection, and, like its predecessors devloped at Bell Labs – Newsqueak (Rob Pike), Alef (Phil Winterbottom), and Inferno (Pike, Ritchie, et al.) – provides built-in support for concurrency using so-called goroutines and channels, a form of co-routines, based on the idea of Hoare’s ‘Communicating Sequential Processes’ . - -Go programs are organised in packages. A package is essentially a directory containing Go files. All files in a package share the same namespace, and there are two visibilities for symbols in a package: Symbols starting with an upper case character are visible to other packages, others are private to the package: - -``` -func PublicFunction() { - fmt.Println("Hello world") -} - -func privateFunction() { - fmt.Println("Hello package") -} -``` - -### Types - -Go has a fairly simple type system: There is no subtyping (but there are conversions), no generics, no polymorphic functions, and there are only a few basic categories of types: - - 1. base types: `int`, `int64`, `int8`, `uint`, `float32`, `float64`, etc. - - 2. `struct` - - 3. `interface` \- a set of methods - - 4. `map[K, V]` \- a map from a key type to a value type - - 5. `[number]Type` \- an array of some element type - - 6. `[]Type` \- a slice (pointer to array with length and capability) of some type - - 7. `chan Type` \- a thread-safe queue - - 8. pointer `*T` to some other type - - 9. functions - - 10. named type - aliases for other types that may have associated methods: - -``` -type T struct { foo int } -type T *T -type T OtherNamedType -``` - -Named types are mostly distinct from their underlying types, so you cannot assign them to each other, but some operators like `+` do work on objects of named types with an underlying numerical type (so you could add two `T` in the example above). - - -Maps, slices, and channels are reference-like types - they essentially are structs containing pointers. Other types are passed by value (copied), including arrays (which have a fixed length and are copied). - -#### Conversions - -Conversions are the similar to casts in C and other languages. They are written like this: - -``` -TypeName(value) -``` - -#### Constants - -Go has “untyped” literals and constants. - -``` -1 // untyped integer literal -const foo = 1 // untyped integer constant -const foo int = 1 // int constant -``` - -Untyped values are classified into the following categories: `UntypedBool`, `UntypedInt`, `UntypedRune`, `UntypedFloat`, `UntypedComplex`, `UntypedString`, and `UntypedNil` (Go calls them basic kinds, other basic kinds are available for the concrete types like `uint8`). An untyped value can be assigned to a named type derived from a base type; for example: - -``` -type someType int - -const untyped = 2 // UntypedInt -const bar someType = untyped // OK: untyped can be assigned to someType -const typed int = 2 // int -const bar2 someType = typed // error: int cannot be assigned to someType -``` - -### Interfaces and ‘objects’ - -As mentioned before, interfaces are a set of methods. Go is not an object-oriented language per se, but it has some support for associating methods with named types: When declaring a function, a receiver can be provided - a receiver is an additional function argument that is passed before the function and involved in the function lookup, like this: - -``` -type SomeType struct { ... } - -func (s *SomeType) MyMethod() { -} - -func main() { - var s SomeType - s.MyMethod() -} -``` - -An object implements an interface if it implements all methods; for example, the following interface `MyMethoder` is implemented by `*SomeType` (note the pointer), and values of `*SomeType` can thus be used as values of `MyMethoder`. The most basic interface is `interface{}`, that is an interface with an empty method set - any object satisfies that interface. - -``` -type MyMethoder interface { - MyMethod() -} -``` - -There are some restrictions on valid receiver types; for example, while a named type could be a pointer (for example, `type MyIntPointer *int`), such a type is not a valid receiver type. - -### Control flow - -Go provides three primary statements for control flow: `if`, `switch`, and `for`. The statements are fairly similar to their equivalent in other C-like languages, with some exceptions: - - * There are no parentheses around conditions, so it is `if a == b {}`, not `if (a == b) {}`. The braces are mandatory. - - * All of them can have initialisers, like this - -`if result, err := someFunction(); err == nil { // use result }` - - * The `switch` statement can use arbitrary expressions in cases - - * The `switch` statement can switch over nothing (equals switching over true) - - * Cases do not fall through by default (no `break` needed), use `fallthrough` at the end of a block to fall through. - - * The `for` loop can loop over ranges: `for key, val := range map { do something }` - - - - -### Goroutines - -The keyword `go` spawns a new goroutine, a concurrently executed function. It can be used with any function call, even a function literal: - -``` -func main() { - ... - go func() { - ... - }() - - go some_function(some_argument) -} -``` - -### Channels - -Goroutines are often combined with channels to provide an extended form of Communicating Sequential Processes . A channel is a concurrent-safe queue, and can be buffered or unbuffered: - -``` -var unbuffered = make(chan int) // sending blocks until value has been read -var buffered = make(chan int, 5) // may have up to 5 unread values queued -``` - -The `<-` operator is used to communicate with a single channel. - -``` -valueReadFromChannel := <- channel -otherChannel <- valueToSend -``` - -The `select` statement allows communication with multiple channels: - -``` -select { - case incoming := <- inboundChannel: - // A new message for me - case outgoingChannel <- outgoing: - // Could send a message, yay! -} -``` - -### The `defer` statement - -Go provides a `defer` statement that allows a function call to be scheduled for execution when the function exits. It can be used for resource clean-up, for example: - -``` -func myFunc(someFile io.ReadCloser) { - defer someFile.close() - /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var Do stuff with file */ -} -``` - -It is of course possible to use function literals as the function to call, and any variables can be used as usual when writing the call. - -### Error handling - -Go does not provide exceptions or structured error handling. Instead, it handles errors by returning them in a second or later return value: - -``` -func Read(p []byte) (n int, err error) - -// Built-in type: -type error interface { - Error() string -} -``` - -Errors have to be checked in the code, or can be assigned to `_`: - -``` -n0, _ := Read(Buffer) // ignore error -n, err := Read(buffer) -if err != nil { - return err -} -``` - -There are two functions to quickly unwind and recover the call stack, though: `panic()` and `recover()`. When `panic()` is called, the call stack is unwound, and any deferred functions are run as usual. When a deferred function invokes `recover()`, the unwinding stops, and the value given to `panic()` is returned. If we are unwinding normally and not due to a panic, `recover()` simply returns `nil`. In the example below, a function is deferred and any `error` value that is given to `panic()` will be recovered and stored in an error return value. Libraries sometimes use that approach to make highly recursive code like parsers more readable, while still maintaining the usual error return value for public functions. - -``` -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) - } - } -} -``` - -### Arrays and slices - -As mentioned before, an array is a value type and a slice is a pointer into an array, created either by slicing an existing array or by using `make()` to create a slice, which will create an anonymous array to hold the elements. - -``` -slice1 := make([]int, 2, 5) // 5 elements allocated, 2 initialized to 0 -slice2 := array[:] // sliced entire array -slice3 := array[1:] // slice of array without first element -``` - -There are some more possible combinations for the slicing operator than mentioned above, but this should give a good first impression. - -A slice can be used as a dynamically growing array, using the `append()` function. - -``` -slice = append(slice, value1, value2) -slice = append(slice, arrayOrSlice...) -``` - -Slices are also used internally to represent variable parameters in variable length functions. - -### Maps - -Maps are simple key-value stores and support indexing and assigning. They are not thread-safe. - -``` -someValue := someMap[someKey] -someValue, ok := someMap[someKey] // ok is false if key not in someMap -someMap[someKey] = someValue -``` --------------------------------------------------------------------------------- - -via: https://blog.jak-linux.org/2018/12/24/introduction-to-go/ - -作者:[Julian Andres Klode][a] -选题:[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.jak-linux.org/ -[b]: https://github.com/lujun9972 From 39338d6000f1021eb987c1588ab0de8ccb9992ef Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 1 Feb 2019 13:01:56 +0800 Subject: [PATCH 0900/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190117=20Pyvo?= =?UTF-8?q?c=20=E2=80=93=20A=20Command=20line=20Dictionary=20And=20Vocabul?= =?UTF-8?q?ary=20Building=20Tool=20sources/tech/20190117=20Pyvoc=20-=20A?= =?UTF-8?q?=20Command=20line=20Dictionary=20And=20Vocabulary=20Building=20?= =?UTF-8?q?Tool.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Dictionary And Vocabulary Building Tool.md | 239 ++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 sources/tech/20190117 Pyvoc - A Command line Dictionary And Vocabulary Building Tool.md diff --git a/sources/tech/20190117 Pyvoc - A Command line Dictionary And Vocabulary Building Tool.md b/sources/tech/20190117 Pyvoc - A Command line Dictionary And Vocabulary Building Tool.md new file mode 100644 index 0000000000..b0aa45d618 --- /dev/null +++ b/sources/tech/20190117 Pyvoc - A Command line Dictionary And Vocabulary Building Tool.md @@ -0,0 +1,239 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pyvoc – A Command line Dictionary And Vocabulary Building Tool) +[#]: via: (https://www.ostechnix.com/pyvoc-a-command-line-dictionary-and-vocabulary-building-tool/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +Pyvoc – A Command line Dictionary And Vocabulary Building Tool +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/pyvoc-720x340.jpg) + +Howdy! I have a good news for non-native English speakers. Now, you can improve your English vocabulary and find the meaning of English words, right from your Terminal. Say hello to **Pyvoc** , a cross-platform, open source, command line dictionary and vocabulary building tool written in **Python** programming language. Using this tool, you can brush up some English words meanings, test or improve your vocabulary skill or simply use it as a CLI dictionary on Unix-like operating systems. + +### Installing Pyvoc + +Since Pyvoc is written using Python language, you can install it using [**Pip3**][1] package manager. + +``` +$ pip3 install pyvoc +``` + +Once installed, run the following command to automatically create necessary configuration files in your $HOME directory. + +``` +$ pyvoc word +``` + +Sample output: + +``` +|Creating necessary config files +/getting api keys. please handle with care! +| + +word +Noun: single meaningful element of speech or writing +example: I don't like the word ‘unofficial’ + +Verb: express something spoken or written +example: he words his request in a particularly ironic way + +Interjection: used to express agreement or affirmation +example: Word, that's a good record, man +``` + +Done! Let us go ahead and brush the English skills. + +### Use Pyvoc as a command line Dictionary tool + +Pyvoc fetches the word meaning from **Oxford Dictionary API**. + +Let us say, you want to find the meaning of a word **‘digression’**. To do so, run: + +``` +$ pyvoc digression +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/pyvoc1.png) + +See? Pyvoc not only displays the meaning of word **‘digression’** , but also an example sentence which shows how to use that word in practical. + +Let us see an another example. + +``` +$ pyvoc subterfuge +| + +subterfuge +Noun: deceit used in order to achieve one's goal +example: he had to use subterfuge and bluff on many occasions +``` + +It also shows the word classes as well. As you already know, English has four major **word classes** : + + 1. Nouns, + + 2. Verbs, + + 3. Adjectives, + + 4. Adverbs. + + + + +Take a look at the following example. + +``` +$ pyvoc welcome + / + +welcome +Noun: instance or manner of greeting someone +example: you will receive a warm welcome + +Interjection: used to greet someone in polite or friendly way +example: welcome to the Wildlife Park + +Verb: greet someone arriving in polite or friendly way +example: hotels should welcome guests in their own language + +Adjective: gladly received +example: I'm pleased to see you, lad—you're welcome +``` + +As you see in the above output, the word ‘welcome’ can be used as a verb, noun, adjective and interjection. Pyvoc has given example for each class. + +If you misspell a word, it will inform you to check the spelling of the given word. + +``` +$ pyvoc wlecome +\ +No definition found. Please check the spelling!! +``` + +Useful, isn’t it? + +### Create vocabulary groups + +A vocabulary group is nothing but a collection words added by the user. You can later revise or take quiz from these groups. 100 groups of 60 words are **reserved** for the user. + +To add a word (E.g **sporadic** ) to a group, just run: + +``` +$ pyvoc sporadic -a +- + +sporadic +Adjective: occurring at irregular intervals or only in few places +example: sporadic fighting broke out + + +writing to vocabulary group... +word added to group number 51 +``` + +As you can see, I didn’t provide any group number and pyvoc displayed the meaning of given word and automatically added that word to group number **51**. If you don’t provide the group number, Pyvoc will **incrementally add words** to groups **51-100**. + +Pyvoc also allows you to specify a group number if you want to. You can specify a group from 1-50 using **-g** option. For example, I am going to add a word to Vocabulary group 20 using the following command. + +``` +$ pyvoc discrete -a -g 20 + / + +discrete +Adjective: individually separate and distinct +example: speech sounds are produced as a continuous sound signal rather + than discrete units + +creating group Number 20... +writing to vocabulary group... +word added to group number 20 +``` + +See? The above command displays the meaning of ‘discrete’ word and adds it to the vocabulary group 20. If the group doesn’t exists, Pyvoc will create it and add the word. + +By default, Pyvoc includes three predefined vocabulary groups (101, 102, and 103). These custom groups has 800 words of each. All words in these groups are taken from **GRE** and **SAT** preparation websites. + +To view the user-generated groups, simply run: + +``` +$ pyvoc word -l + - + +word +Noun: single meaningful element of speech or writing +example: I don't like the word ‘unofficial’ + +Verb: express something spoken or written +example: he words his request in a particularly ironic way + +Interjection: used to express agreement or affirmation +example: Word, that's a good record, man + + +USER GROUPS +Group no. No. of words +20 1 + +DEFAULT GROUP +Group no. No. of words +51 1 +``` +``` + +``` + +As you see, I have created one group (20) including the default group (51). + +### Test and improve English vocabulary + +As I already said, you can use the Vocabulary groups to revise or take quiz from them. + +For instance, to revise the group no. **101** , use **-r** option like below. + +``` +$ pyvoc 101 -r +``` + +You can now revise the meaning of all words in the Vocabulary group 101 in random order. Just hit ENTER to go through next questions. Once done, hit **CTRL+C** to exit. + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/pyvoc2-1.png) + +Also, you take quiz from the existing groups to brush up your vocabulary. To do so, use **-q** option like below. + +``` +$ pyvoc 103 -q 50 +``` + +This command allows you to take quiz of 50 questions from vocabulary group 103. Choose the correct answer from the list by entering the appropriate number. You will get 1 point for every correct answer. The more you score the more your vocabulary skill will be. + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/pyvoc3.png) + +Pyvoc is in the early-development stage. I hope the developer will improve it and add more features in the days to come. + +As a non-native English speaker, I personally find it useful to test and learn new word meanings in my free time. If you’re a heavy command line user and wanted to quickly check the meaning of a word, Pyvoc is the right tool. You can also test your English Vocabulary at your free time to memorize and improve your English language skill. Give it a try. You won’t be disappointed. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/pyvoc-a-command-line-dictionary-and-vocabulary-building-tool/ + +作者:[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/manage-python-packages-using-pip/ From d2a95ab5fd4c36aeb64d4eac8fa97631dbe862b6 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 1 Feb 2019 13:04:07 +0800 Subject: [PATCH 0901/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190115=20Comp?= =?UTF-8?q?aring=203=20open=20source=20databases:=20PostgreSQL,=20MariaDB,?= =?UTF-8?q?=20and=20SQLite=20sources/tech/20190115=20Comparing=203=20open?= =?UTF-8?q?=20source=20databases-=20PostgreSQL,=20MariaDB,=20and=20SQLite.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...abases- PostgreSQL, MariaDB, and SQLite.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md diff --git a/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md b/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md new file mode 100644 index 0000000000..624b880168 --- /dev/null +++ b/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +Comparing 3 open source databases: PostgreSQL, MariaDB, and SQLite +====== +Find out how to choose the best open source database for your needs. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_container_block.png?itok=S8MbXEYw) + +In the world of modern enterprise technologies, open source software has firmly established itself as one of the biggest forces to reckon with. After all, some of the biggest technology developments have emerged because of the [open source movement][1]. + +It's not difficult to see why: even though Linux-based open source network standards may not be as popular as proprietary options, they are the reason smart devices from different manufacturers can communicate with each other. In addition, many argue that open source development produces applications that are superior to their proprietary counterparts. This is one reason why the chances are good that your favorite tools (whether open source or proprietary) were developed using open source databases. + +Like any other category of software, the functionality and features of open source database management systems can differ quite significantly. To put that in plainer terms, [not all open source database management systems are equal][2]. If you are choosing an open source database for your organization, it's important to choose one that is user-friendly, can grow with your organization, and offers more-than-adequate security features. + +With that in mind, we've compiled this overview of open source databases and their respective advantages and disadvantages. Sadly, we had to leave out some of the most used databases. Notably, MongoDB has recently changed its licensing model, so it is no longer truly open source. This decision probably made sense from a business perspective, since MongoDB has become the de facto solution for database hosting [with nearly 27,000 companies][3] using it, but it also means MongoDB can no longer be considered a truly open source system. + +In addition, since it acquired MySQL, Oracle has all but killed the open source nature of that project, which was arguably the go-to open source database for decades. However, this has opened space for other truly open source database solutions to challenge it. Here are three of them to consider. + +### PostgreSQL + +No list of open source databases would be complete without [PostgreSQL][4], which has long been the preferred solution for businesses of all sizes. Oracle's acquisition of MySQL might have made good business sense at the time, but the rise of cloud storage has meant that the database [has gradually fallen out of favor with developers][5]. + +Although PostgreSQL has been around for a while, the relative [decline of MySQL][6] has made it a serious contender for the title of most used open source database. Since it works very similarly to MySQL, developers who prefer open source software are converting in droves. + +#### Advantages + + * By far, PostgreSQL's most mentioned advantage is the efficiency of its central algorithm, which means it outperforms many databases that are advertised as more advanced. This is especially useful if you are working with large datasets, for which I/O processes can otherwise become a bottleneck. + + * It is also one of the most flexible open source databases around; you can write functions in a wide range of server-side languages: Python, Perl, Java, Ruby, C, and R. + + * As one of the most commonly used open source databases, PostgreSQL's community support is some of the best around. + + + + +#### Disadvantages + + * PostgreSQL's efficiency with large datasets is well known, but there are quicker tools available for smaller databases. + + * While its community support is very good, PostgreSQL's core documentation could be improved. + + * If you are used to advanced tools like parallelization and clustering, be aware that these require third-party plugins in PostgreSQL. There are plans to gradually add these features to the main release, but it will likely be a few years before they are offered as standard. + + + + +### MariaDB + +[MariaDB][7] is a truly open source distribution of MySQL (released under the [GNU GPLv2][8]). It was [created after Oracle's acquisition][9] of MySQL, when some of MySQL's core developers were concerned that Oracle would undermine its open source philosophy. + +MariaDB was developed to be as compatible with MySQL as possible while replacing several key components. It uses a storage engine, Aria, that functions as both a transactional and non-transactional engine. [Some even speculated][10] Aria would become the standard engine for MySQL in future releases, before MariaDB diverged. + +#### Advantages + + * Many users choose MariaDB over MySQL due to MariaDB's [frequent security releases][11]. While this does not necessarily mean MariaDB is more secure, it does indicate the development community takes security seriously. + + * Others say MariaDB's major advantages are that it will almost definitely remain open source and highly compatible with MySQL. This means migrating from one system to the other is extremely fast. + + * Because of this compatibility, MariaDB also plays well with many other languages that are commonly used with MySQL. This means less time is spent learning and debugging code. + + * You can [install and run][12] WordPress with MariaDB instead of MySQL for better performance and a richer feature set. WordPress is the [most popular CMS by marketshare][13]—powering nearly half the internet—and has an active open source developer community. Third-party themes and plugins work as intended when WordPress is installed with MariaDB. + + + + +#### Disadvantages + + * MariaDB is somewhat liable to bloating. Its central IDX log file, in particular, tends to become very large after protracted use, ultimately slowing performance. + + * Caching is another area where MariaDB could use work—it is not as fast as it could be, which can be frustrating. + + * Despite all the initial promises, MariaDB is no longer completely compatible with MySQL. If you are migrating from MySQL, you will have some re-coding to do. + + + + +### SQLite + +[SQLite][14] is arguably the most implemented database engine in the world, thanks to its adoption by many popular web browsers, operating systems, and mobile phones. Originally developed as a lightweight fork of MySQL, unlike many other databases it is not a client-server engine; rather, the full software is embedded into each implementation. + +This creates SQLite's major advantage: on embedded or distributed systems, each machine carries an entire implementation of the database. This can greatly speed up the performance of databases because it reduces the need for inter-system calls. + +#### Advantages + + * If you are looking to build and implement a small database, SQLite is [arguably the best way to go][15]. It is extremely small, so it can be implemented across a wide range of embedded systems without time-consuming workarounds. + + * Its small size makes the system extremely fast. While some more advanced databases use complex ways of producing efficiency savings, SQLite takes a much simpler approach: By reducing the size of your database and its associated processing software, there is simply less data to work with. + + * Its widespread adoption also means SQLite is probably the most compatible database out there. This is particularly important if you need or plan to integrate your system with smartphones: the system has been native on iOS for as long as there have been third-party apps and works flawlessly in a wide range of environments. + + + + +#### Disadvantages + + * SQLite's tiny size means it lacks some features found in larger databases. It lacks built-in data encryption, for example, something that has become standard to prevent the [most common online hacker attacks][16]. + + * While the wide adoption and publicly available code makes SQLite easy to work with, it also increases its attack surface area. This is its most commonly cited disadvantage. New critical vulnerabilities are frequently discovered in SQLite, such as the recent remote attack vector called [Magellan][17]. + + * Although SQLite's single-file approach creates speed advantages, there is no easy way to implement a multi-user environment using the system. + + + + +### Which open source database is best? + +Ultimately, your choice of open source database will depend on your business needs and particularly on the size of your system. For small databases or those with limited use, go for a lightweight solution: not only will it speed up implementation but a less-complex system means you will spend less time debugging. + +For larger systems, especially in growing businesses, invest the time to implement a more complex database like PostgreSQL. This will save you time—eventually—by removing the need to re-code your databases as your business grows. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/open-source-databases + +作者:[Sam Bocetta][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/2/pivotal-moments-history-open-source +[2]: https://blog.capterra.com/free-database-software/ +[3]: https://idatalabs.com/tech/products/mongodb +[4]: https://www.postgresql.org/ +[5]: https://www.theregister.co.uk/2018/05/31/rise_of_the_open_source_data_strategies/ +[6]: https://www.itworld.com/article/2721995/big-data/signs-of-mysql-decline-on-horizon.html +[7]: https://mariadb.org/ +[8]: https://github.com/MariaDB/server/blob/10.4/COPYING +[9]: https://mariadb.com/about-us/ +[10]: http://kb.askmonty.org/en/aria-faq +[11]: https://mariadb.org/tag/security/ +[12]: https://mariadb.com/resources/blog/how-to-install-and-run-wordpress-with-mariadb/ +[13]: https://websitesetup.org/popular-cms/ +[14]: https://www.sqlite.org/index.html +[15]: https://www.sqlite.org/aff_short.html +[16]: https://hostingcanada.org/most-common-website-vulnerabilities/ +[17]: https://www.securitynewspaper.com/2018/12/18/critical-vulnerability-in-sqlite-you-should-update-now/ From e6cd033e2d4636c80eb353b5d9789d1a27c0e4f2 Mon Sep 17 00:00:00 2001 From: guevaraya Date: Fri, 1 Feb 2019 16:40:08 +0800 Subject: [PATCH 0902/4278] Translated By Guevaraya MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成,请确认 --- ...ntion Of RSI (Repetitive Strain Injury).md | 142 ----------------- ...ntion Of RSI (Repetitive Strain Injury).md | 145 ++++++++++++++++++ 2 files changed, 145 insertions(+), 142 deletions(-) delete mode 100644 sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md create mode 100644 translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md diff --git a/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md b/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md deleted file mode 100644 index 989f54d45a..0000000000 --- a/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md +++ /dev/null @@ -1,142 +0,0 @@ -Translating By Guevaraya - -Linux/Unix App For Prevention Of RSI (Repetitive Strain Injury) -====== -![workrave-image][1] - -[A repetitive strain injury][2] (RSI) is occupational overuse syndrome, non-specific arm pain or work related upper limb disorder. RSI caused from overusing the hands to perform a repetitive task, such as typing, writing, or clicking a mouse. Unfortunately, most people do not understand what RSI is or how dangerous it can be. You can easily prevent RSI using open source software called Workrave. - - -### What are the symptoms of RSI? - -I'm quoting from this [page][3]. Do you experience: - - 1. Fatigue or lack of endurance? - 2. Weakness in the hands or forearms? - 3. Tingling, numbness, or loss of sensation? - 4. Heaviness: Do your hands feel like dead weight? - 5. Clumsiness: Do you keep dropping things? - 6. Lack of strength in your hands? Is it harder to open jars? Cut vegetables? - 7. Lack of control or coordination? - 8. Chronically cold hands? - 9. Heightened awareness? Just being slightly more aware of a body part can be a clue that something is wrong. - 10. Hypersensitivity? - 11. Frequent self-massage (subconsciously)? - 12. Sympathy pains? Do your hands hurt when someone else talks about their hand pain? - - - -### How to reduce your risk of Developing RSI - - * Take breaks, when using your computer, every 30 minutes or so. Use software such as workrave to prevent RSI. - * Regular exercise can prevent all sort of injuries including RSI. - * Use good posture. Adjust your computer desk and chair to support muscles necessary for good posture. - - - -### Workrave - -Workrave is a free open source software application intended to prevent computer users from developing RSI or myopia. The software periodically locks the screen while an animated character, "Miss Workrave," walks the user through various stretching exercises and urges them to take a coffee break. The program frequently alerts you to take micro-pauses, rest breaks and restricts you to your daily limit. The program works under MS-Windows and Linux, UNIX-like operating systems. - -#### Install workrave - -Type the following [apt command][4]/[apt-get command][5] under a Debian / Ubuntu Linux: -`$ sudo apt-get install workrave` -Fedora Linux user should type the following dnf command: -`$ sudo dnf install workrave` -RHEL/CentOS Linux user should enable EPEL repo and install it using [yum command][6]: -``` -### [ **tested on a CentOS/RHEL 7.x and clones** ] ### -$ sudo yum install epel-release -$ sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm -$ sudo yum install workrave -``` -Arch Linux user type the following pacman command to install it: -`$ sudo pacman -S workrave` -FreeBSD user can install it using the following pkg command: -`# pkg install workrave` -OpenBSD user can install it using the following pkg_add command -``` -$ doas pkg_add workrave -``` - -#### How to configure workrave - -Workrave works as an applet which is a small application whose user interface resides within a panel. You need to add workrave to panel to control behavior and appearance of the software. - -##### Adding a New Workrave Object To Panel - - * Right-click on a vacant space on a panel to open the panel popup menu. - * Choose Add to Panel. - * The Add to Panel dialog opens.The available panel objects are listed alphabetically, with launchers at the top. Select workrave applet and click on Add button. - -![Fig.01: Adding an Object \(Workrave\) to a Panel][7] -Fig.01: Adding an Object (Workrave) to a Panel - -##### How Do I Modify Properties Of Workrave Software? - -To modify the properties of an object workrave, perform the following steps: - - * Right-click on the workrave object to open the panel object popup. - * Choose Preference. Use the Properties dialog to modify the properties as required. - -![](https://www.cyberciti.biz/media/new/tips/2009/11/linux-gnome-workwave-preferences-.png) -Fig.02: Modifying the Properties of The Workrave Software - -#### Workrave in Action - -The main window shows the time remaining until it suggests a pause. The windows can be closed and you will the time remaining on the panel itself: -![Fig.03: Time reaming counter ][8] -Fig.03: Time reaming counter - -![Fig.04: Miss Workrave - an animated character walks you through various stretching exercises][9] -Fig.04: Miss Workrave - an animated character walks you through various stretching exercises - -The break prelude window, bugging you to take a micro-pause: -![Fig.05: Time for a micro-pause remainder ][10] -Fig.05: Time for a micro-pause remainder - -![Fig.06: You can skip Micro-break ][11] -Fig.06: You can skip Micro-break - -##### References: - - 1. [Workrave project][12] home page. - 2. [pokoy][13] lightweight daemon that helps prevent RSI and other computer related stress. - 3. [A Pomodoro][14] timer for GNOME 3. - 4. [RSI][2] from the wikipedia. - - - -### about the author - -The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on [Twitter][15], [Facebook][16], [Google+][17]. - --------------------------------------------------------------------------------- - -via: https://www.cyberciti.biz/tips/repetitive-strain-injury-prevention-software.html - -作者:[Vivek Gite][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.cyberciti.biz/ -[1]:https://www.cyberciti.biz/media/new/tips/2009/11/workrave-image.jpg (workrave-image) -[2]:https://en.wikipedia.org/wiki/Repetitive_strain_injury -[3]:https://web.eecs.umich.edu/~cscott/rsi.html##symptoms -[4]:https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/ (See Linux/Unix apt command examples for more info) -[5]:https://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html (See Linux/Unix apt-get command examples for more info) -[6]:https://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/ (See Linux/Unix yum command examples for more info) -[7]:https://www.cyberciti.biz/media/new/tips/2009/11/add-workwave-to-panel.png (Adding an Object (Workrave) to a Gnome Panel) -[8]:https://www.cyberciti.biz/media/new/tips/2009/11/screenshot-workrave.png (Workrave main window shows the time remaining until it suggests a pause.) -[9]:https://www.cyberciti.biz/media/new/tips/2009/11/miss-workrave.png (Miss Workrave Sofrware character walks you through various RSI stretching exercises ) -[10]:https://www.cyberciti.biz/media/new/tips/2009/11/time-for-micro-pause.gif (Workrave RSI Software Time for a micro-pause remainder ) -[11]:https://www.cyberciti.biz/media/new/tips/2009/11/Micro-break.png (Workrave RSI Software Micro-break ) -[12]:http://www.workrave.org/ -[13]:https://github.com/ttygde/pokoy -[14]:http://gnomepomodoro.org -[15]:https://twitter.com/nixcraft -[16]:https://facebook.com/nixcraft -[17]:https://plus.google.com/+CybercitiBiz diff --git a/translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md b/translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md new file mode 100644 index 0000000000..d1ea0ab993 --- /dev/null +++ b/translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md @@ -0,0 +1,145 @@ +如何在Linux下开发避免重复性压迫损伤 +====== +![workrave-image][1] + +[重复性压迫损伤][2] (RSI)是职业性损伤综合征, 非特异性手臂疼痛或工作引起的上肢障碍。重复性压迫损伤 (RSI) 是由于过度使用双手从事重复性任务,如打字,写和使用鼠标. 不幸的是,大部分人不了解什么是重复性压迫损伤 (RSI)以及它的危害有多大。你可以使用名叫Workrave的开源软件轻松的预防重复性压迫损伤 (RSI)。 + +### 重复性压迫损伤 (RSI)有哪些症状? + +我从[page][3]引用过来的, 看看哪些你被说中了: + + 1. 疲惫缺乏忍耐力? + 2. 手掌及上肢乏力 + 3. 疼痛麻木甚至失去知觉? + 4. 沉重:你有没有感觉手很沉? + 5. 笨拙: 你有没有感觉抓不紧东西? + 6. 你有没有感觉手上无力?很难打开罐子或切菜无力? + 7. 缺乏协调和控制? + 8. 手总是冰凉的? + 9. 健康意识有待提高?稍不注意身体就发现有毛病了。 + 10. 是否过敏? + 11. 频繁的自我按摩(潜意识的)? + 12. 共鸣的疼痛? 当别人在谈论手痛的时候,你是否也感觉到了手疼? + + + +### 如何减少开发者的重复性压迫损伤风险(RSI) + + * 使用计算机的时候每个30分钟间隔休息一下。借助软件如 workrave 预防重复性压迫损伤风险(RSI)。 + * 有规律的锻炼可以预防各种损伤,包括重复性压迫损伤 + * 使用合理的姿势。调整你的电脑桌和椅子使身体保持一个肌肉放松状态 + +### Workrave + +Workrave 是一款预防计算机用户患重复性损伤(RSI)或近视。软件会定期锁屏为一个动画: "Workrave 小姐" 引导用户做各种伸展运动并敦促其休息一下。这个软件经常提醒你暂停休息一下并限制你每天的活动。程序可以运行在 MS-Window , Linux以及类UNIX操作系统下。 + + +#### 安装 workrave + +在Debian/Ubuntu Linux系统运行以下 [apt 命令][4]/[apt-get 命令][5]: +`$ sudo apt-get install workrave` + +Fedora Linux 发行版用户运行一下dnf命令: +`$ sudo dnf install workrave` + +RHEL/CentOS Linux 用户可以启动EPEL repo并用[yum 命令][6]安装: +``` +### [ **在CentOS/RHEL 7.x 及衍生版本上测试** ] ### +$ sudo yum install epel-release +$ sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm +$ sudo yum install workrave +``` + +Arch Linux用户运行以下pacman命令来安装: +`$ sudo pacman -S workrave` + +FreeBSD 用户可用一下pkg命令安装: +`# pkg install workrave` + +OpenBSD 用户可用一下pkg_add命令安装: +``` +$ doas pkg_add workrave +``` + +#### 如何配置 workrave + +Workrave 以一个小程序运行,他的用户界面位于面板中。你可以为 workrave 增加一个面板来控制软件的动作和外观。 + +##### 增加一个新workrave对象到面板 + + * 在面板空白区域右键,打开面板弹出菜单 + * 选择新增到面板 + * 新增面板对话框打开,在加载器顶部,可以看到可用的面板对象按照字母排列。选中 workrave 程序并单击新增。 + +![Fig.01: 添加workrave对象到面板][7] +Fig.01: 新增workrave对象到面板 + +##### 如何设置 Workrave 属性? + +如果修改 workrave 对象的属性,执行以下步骤: + + * 右键 workrave 对象打开面板对象弹出 + * 选中偏好。使用属性对话框修改对应属性 + +![](https://www.cyberciti.biz/media/new/tips/2009/11/linux-gnome-workwave-preferences-.png) +Fig.02: 修改 Workrave 对象属性 + +#### Workrave 运行展示 + +主窗口显示下一次提醒休息的剩余时间,这个窗口可以关闭,时间提示窗口会在面板上。 + +![Fig.03: 时间计数器 ][8] +Fig.03:时间计数器 + +![Fig.04: Workrave 小姐- 引导你做伸展运动的动画][9] +Fig.04: Workrave 小姐- 引导你做伸展运动的动画 + +休息提示窗口,请求你暂停一下工作 + +![Fig.05: 休息提示倒计时 ][10] +Fig.05: 休息提示倒计时 + +![Fig.06: 你可以跳过休息按钮 ][11] +Fig.06: 你可以跳过休息按钮 + +##### 参考链接: + + 1. [Workrave 项目][12] 主页 + 2. [pokoy][13] 轻量级防止重复性压迫损伤(RSI)和其他计算机压力的程序 + 3. GNOME3下的[Pomodoro][14] 计数器 . + 4. [RSI][2] 的维基百科 + + + +### 关于作者 + +作者是nixCraft创始人,经验丰富的系统管理员,同时也是一个Linux/Unix系统下的shell脚本培训师。他曾服务于全球客户,并与多个行业合作包括IT,教育,国防和航天研究,以及非盈利机构。可以[Twitter][15], [Facebook][16], [Google+][17]关注他。 + +-------------------------------------------------------------------------------- + +via: https://www.cyberciti.biz/tips/repetitive-strain-injury-prevention-software.html + +作者:[Vivek Gite][a] +译者:[guevaraya](https://github.com/guevaraya) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.cyberciti.biz/ +[1]:https://www.cyberciti.biz/media/new/tips/2009/11/workrave-image.jpg +[2]:https://en.wikipedia.org/wiki/Repetitive_strain_injury +[3]:https://web.eecs.umich.edu/~cscott/rsi.html##symptoms +[4]:https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/ +[5]:https://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html +[6]:https://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/ +[7]:https://www.cyberciti.biz/media/new/tips/2009/11/add-workwave-to-panel.png +[8]:https://www.cyberciti.biz/media/new/tips/2009/11/screenshot-workrave.png +[9]:https://www.cyberciti.biz/media/new/tips/2009/11/miss-workrave.png +[10]:https://www.cyberciti.biz/media/new/tips/2009/11/time-for-micro-pause.gif +[11]:https://www.cyberciti.biz/media/new/tips/2009/11/Micro-break.png +[12]:http://www.workrave.org/ +[13]:https://github.com/ttygde/pokoy +[14]:http://gnomepomodoro.org +[15]:https://twitter.com/nixcraft +[16]:https://facebook.com/nixcraft +[17]:https://plus.google.com/+CybercitiBiz From 14cbe408d2dad53cef5bcbdb09993cd4a448ba63 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Feb 2019 17:52:19 +0800 Subject: [PATCH 0903/4278] PRF:20181212 Top 5 configuration management tools.md @HankChow --- ...12 Top 5 configuration management tools.md | 54 +++++++++++++------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/translated/tech/20181212 Top 5 configuration management tools.md b/translated/tech/20181212 Top 5 configuration management tools.md index d618833492..a62de5ffa2 100644 --- a/translated/tech/20181212 Top 5 configuration management tools.md +++ b/translated/tech/20181212 Top 5 configuration management tools.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Top 5 configuration management tools) @@ -9,7 +9,9 @@ 五大最流行的配置管理工具 ====== -在寻找合适的 DevOps 工具之前,你最好要对配置管理工具有一定的了解。 + +> 了解一下配置管理工具,以找出哪个最适合你的 DevOps 组织。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) DevOps 正因为有提高产品质量、缩短产品开发时间等优势,目前备受业界关注,同时也在长足发展当中。 @@ -21,13 +23,11 @@ DevOps 正因为有提高产品质量、缩短产品开发时间等优势,目 * **评估**保证了及时的改进; * **分享**让 CAMS 成为一个完整的循环过程。 - - DevOps 的另一个思想是任何东西,包括服务器、数据库、网络、日志文件、应用配置、文档、自动化测试、部署流程等,都可以通过代码来管理。 -在本文中,我主要介绍配置管理的自动化。配置管理工具作为[基础架构即代码Infrastructure as Code][2](IaC)的一部分,支持使用软件进行开发实践,以及通过明文定义的文件来管理数据中心。 +在本文中,我主要介绍配置管理的自动化。配置管理工具作为[基础架构即代码Infrastructure as Code][2](IaC)的一部分,支持使用经过测试和验证的软件开发实践,通过明文定义文件管理和配置数据中心。 -DevOps 团队只需要通过操作简单的配置文件,就可以实现应用开发中包括版本控制、测试、小型部署、设计模式这些最佳实践。总而言是,配置管理工具实现了通过编写代码来使基础架构管理变得自动化。 +DevOps 团队只需要通过操作简单的配置文件,就可以实现应用开发中包括版本控制、测试、小型部署、设计模式在内的这些最佳实践。总而言之,配置管理工具实现了通过编写代码来使基础架构的配置和管理变得自动化。 ### 为什么要使用配置管理工具? @@ -37,29 +37,37 @@ DevOps 团队只需要通过操作简单的配置文件,就可以实现应用 * 让代码遵守编码规范,提高代码可读性; * 具有幂等性Idempotency,也就是说,无论执行多少次重复的配置管理操作,得到的结果都是一致的; - * 可以方便地管理分布式系统和大量的远程服务器。 + * 分布式的设计可以方便地管理大量的远程服务器。 -配置管理工具主要分为拉取pull模式和推送push模式。拉取模式是指安装在各台服务器上的代理agent定期从中央存储库central repository拉取最新的配置并应用到对应的服务器上;而推送模式则由中央服务器central server主动向其它服务器推送更新的配置。 +配置管理工具主要分为拉取pull模式和推送push模式。拉取模式是指安装在各台服务器上的代理agent定期从中央存储库central repository拉取最新的配置并应用到对应的服务器上;而推送模式则由中央服务器central server的中央服务器会触发其它受管服务器的更新。 ### 五大最流行的配置管理工具 -目前配置管理工具有很多,不同的配置管理工具都有自己最适合的使用场景。而对于下面五个我按照字母顺序列出的配置管理工具,都对 DevOps 有明显的帮助:具有开源许可证、使用外部配置文件、支持无人值守运行、可以通过脚本自定义运行。下面对它们的介绍都来源于它们的软件库和官网内容。 +目前配置管理工具有很多,不同的配置管理工具都有自己最适合的使用场景。而对于下面五个我按照字母顺序列出的配置管理工具,都对 DevOps 有明显的帮助:全都具有开源许可证、使用外部配置文件、支持无人值守运行、可以通过脚本自定义运行。下面对它们的介绍都来源于它们的软件库和官网内容。 #### Ansible “Ansible 是一个极其简洁的 IT 自动化平台,可以让你的应用和系统以更简单的方式部署。不需要安装任何代理,只需要使用 SSH 的方式和简单的语言,就可以免去脚本或代码部署应用的过程。”——[GitHub Ansible 代码库][3] -Ansible 是我最喜欢的工具之一,我在几年前就开始使用了。你可以使用 Ansible 在命令行中让多个服务器执行同一个命令,也可以使用 YAML 格式的 playbook 来让它自动执行特定的操作,这让技术团队和非技术团队之间的沟通变得更加明确。简洁、无代理、配置文件对非技术人员友好是它的几个主要优点。 +- [官网](https://www.ansible.com/) +- [文档](https://docs.ansible.com/ansible/) +- [社区](https://www.ansible.com/community) -由于 Ansible 不需要代理,因此对服务器的资源消耗会很少。在默认情况下,Ansible 使用的推送模式需要借助 SSH 连接,但 Ansible 也支持拉取模式。[playbook][4] 可以使用最少的命令集编写,当然也可以扩展为更加精细的自动化任务,包括引入其它角色、变量和模块。 +Ansible 是我最喜欢的工具之一,我在几年前就开始使用了。你可以使用 Ansible 在命令行中让多个服务器执行同一个命令,也可以使用 YAML 格式的剧本playbook来让它自动执行特定的操作,这促进了技术团队和非技术团队之间的沟通。简洁、无代理、配置文件对非技术人员友好是它的几个主要优点。 -你可以将 Ansible 和其它工具(包括 Ansible Works、Jenkins、RunDeck、[ARA][5] 等)结合起来使用,因为这些工具支持 [playbook 的回溯功能][6],这样就可以很方便地控制整个开发周期中的不同流程。 +由于 Ansible 不需要代理,因此对服务器的资源消耗会很少。Ansible 默认使用的推送模式需要借助 SSH 连接,但 Ansible 也支持拉取模式。[剧本][4] 可以使用最少的命令集编写,当然也可以扩展为更加精细的自动化任务,包括引入角色、变量和其它人写的模块。 + +你可以将 Ansible 和其它工具(包括 Ansible Works、Jenkins、RunDeck、[ARA][5] 等)结合起来使用,因为这些工具 [提供了运行剧本时的可追溯性][6],这样就可以创建控制流程的中央控制台。 ### CFEngine -“CFEngine 3 是一个流行的开源配置管理系统,它可以为大规模的系统提供自动化配置和维护。”——[GitHub CFEngine 代码库][7] +“CFEngine 3 是一个流行的开源配置管理系统,它主要用于为大规模的系统提供自动化配置和维护。”——[GitHub CFEngine 代码库][7] -CFEngine 最早在 1993 年由 Mark Burgess 以自动配置管理的科学方法提出,目的是降低计算机系统配置中的熵,最终收敛到期望的配置状态,同时还阐述了幂等性是让系统达到期望状态的能力。Burgess 在 2004 年又提出了承诺理论Promise Theory,这个理论描述了代理之间自发合作的模型。 +- [官网](https://cfengine.com/) +- [文档](https://docs.cfengine.com/docs/3.12/) +- [社区](https://cfengine.com/community/) + +CFEngine 最早在 1993 年由 Mark Burgess 作为自动配置管理的科学方法提出,目的是降低计算机系统配置中的熵,最终收敛到期望的配置状态,同时还阐述了幂等性是让系统达到期望状态的能力。Burgess 在 2004 年又提出了[承诺理论][8]Promise Theory,这个理论描述了代理之间自发合作的模型。 CFEngine 的最新版本已经用到了承诺理论,在各个服务器上的代理程序会从中央存储库拉取配置。CFEngine 的配置对专业技能要求较高,因此它比较适合技术团队使用。 @@ -67,13 +75,21 @@ CFEngine 的最新版本已经用到了承诺理论,在各个服务器上的 “为整个基础架构在配置管理上带来便利的一个系统集成框架。”——[GitHub Chef 代码库][9] -Chef 通过由 Ruby 编写的“菜谱recipe”来让你的基础架构保持在最新、最兼容的状态,这些“菜谱”描述了一系列资源的某种状态。Chef 既可以通过客户端-服务端的模式运行,也可以在 [chef-solo][10] 这种独立配置的模式下运行。大部分云提供商都很好地集成了 Chef,因此可以使用它为新机器做自动配置。 +- [官网](http://www.chef.io/chef/) +- [文档](https://docs.chef.io/) +- [社区](https://www.chef.io/community/) + +Chef 通过由 Ruby 编写的“菜谱recipe”来让你的基础架构保持在最新、最兼容的状态,这些“菜谱”描述了一系列应处于某种状态的资源。Chef 既可以通过客户端-服务端的模式运行,也可以在 [chef-solo][10] 这种独立配置的模式下运行。大部分云提供商都很好地集成了 Chef,因此可以使用它为新机器做自动配置。 Chef 有广泛的用户基础,同时也提供了完备的工具包,让不同技术背景的团队可以通过“菜谱”进行沟通。尽管如此,它仍然算是一个技术导向的工具。 ### Puppet -“Puppet 是可以在 Linux、Unix 和 Windows 系统上运行的自动化管理引擎,它可以根据集中的规范来执行诸如添加用户、安装软件包、更新服务器配置等等管理任务。”——[GitHub Puppet 代码库][11] +“Puppet 是一个可以在 Linux、Unix 和 Windows 系统上运行的自动化管理引擎,它可以根据集中的规范来执行诸如添加用户、安装软件包、更新服务器配置等等管理任务。”——[GitHub Puppet 代码库][11] + +- [官网](https://puppet.com/) +- [文档](https://puppet.com/docs) +- [社区](https://puppet.com/community) Puppet 作为一款面向运维工程师和系统管理员的工具,在更多情况下是作为配置管理工具来使用。它通过客户端-服务端的模式工作,使用代理从主服务器获取配置指令。 @@ -83,6 +99,10 @@ Puppet 使用声明式语言declarative language或 Ruby “为大规模基础结构或应用程序实现自动化管理的软件。”——[GitHub Salt 代码库][12] +- [官网](https://www.saltstack.com/) +- [文档](https://docs.saltstack.com/en/latest/contents.html) +- [社区](https://www.saltstack.com/resources/community/) + Salt 的专长就是快速收集数据,即使是上万台服务器也能够轻松完成任务。它使用 Python 模块来管理配置信息和执行特定的操作,这些模块可以让 Salt 实现所有远程操作和状态管理。但配置 Salt 模块对技术水平有一定的要求。 Salt 使用客户端-服务端的结构(Salt minions 是客户端,而 Salt master 是服务端),并以 Salt 状态文件记录需要达到的目标状态。 @@ -98,7 +118,7 @@ via: https://opensource.com/article/18/12/configuration-management-tools 作者:[Marco Bravo][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 1811d815a68ae9aee85008570c19017bc51aaeee Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Feb 2019 17:52:55 +0800 Subject: [PATCH 0904/4278] PUB:20181212 Top 5 configuration management tools.md @HankChow https://linux.cn/article-10497-1.html --- .../20181212 Top 5 configuration management tools.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181212 Top 5 configuration management tools.md (99%) diff --git a/translated/tech/20181212 Top 5 configuration management tools.md b/published/20181212 Top 5 configuration management tools.md similarity index 99% rename from translated/tech/20181212 Top 5 configuration management tools.md rename to published/20181212 Top 5 configuration management tools.md index a62de5ffa2..0f1c42cdf6 100644 --- a/translated/tech/20181212 Top 5 configuration management tools.md +++ b/published/20181212 Top 5 configuration management tools.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10497-1.html) [#]: subject: (Top 5 configuration management tools) [#]: via: (https://opensource.com/article/18/12/configuration-management-tools) [#]: author: (Marco Bravo https://opensource.com/users/marcobravo) From 303f44432bcc62e14f5d37887f6983628199f53c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Feb 2019 19:32:29 +0800 Subject: [PATCH 0905/4278] PRF:20190123 Commands to help you monitor activity on your Linux server.md @dianbanjiu --- ...u monitor activity on your Linux server.md | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md index 394b553d13..29b964b35f 100644 --- a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md +++ b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -1,16 +1,16 @@ [#]: collector: (lujun9972) -[#]: translator: (dianbanjiu ) -[#]: reviewer: ( ) +[#]: translator: (dianbanjiu) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Commands to help you monitor activity on your Linux server) [#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -监控 Linux 服务器的几个常用命令 +监控 Linux 服务器活动的几个命令 ====== -watch、top 和 ac 命令为我们监视 Linux 服务器上的活动提供了一些十分高效的途径。 +> `watch`、`top` 和 `ac` 命令为我们监视 Linux 服务器上的活动提供了一些十分高效的途径。 ![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg) @@ -18,40 +18,40 @@ watch、top 和 ac 命令为我们监视 Linux 服务器上的活动提供了一 ### watch 命令 -**watch** 是一个使得重复检测 Linux 系统中一系列数据,例如用户活动、正在运行进程、登录、内存使用等更加容易的命令。这个命令实际上是重复地运行一个特定的命令,每次都会重写之前显示的输出,它提供了一个比较方便的方式用以监测在你的系统中发生的活动。 +`watch` 是一个用来轻松地重复检测 Linux 系统中一系列数据命令,例如用户活动、正在运行进程、登录、内存使用等。这个命令实际上是重复地运行一个特定的命令,每次都会重写之前显示的输出,它提供了一个比较方便的方式用以监测在你的系统中发生的活动。 -首先以一个基础且不是特别有用的命令开始,你可以运行 `watch -n 5 date`,然后你可以看到在终端中显示了当前的日期和时间,这些数据会每五秒更新一次。你可能已经猜到了,**-n 5** 选项指定了运行接下来一次命令需要等待的秒数。默认是 2 秒。这个命令将会一直运行并按照指定的时间更新显示,直到你使用 ^C 停下它。 +首先以一个基础且不是特别有用的命令开始,你可以运行 `watch -n 5 date`,然后你可以看到在终端中显示了当前的日期和时间,这些数据会每五秒更新一次。你可能已经猜到了,`-n 5` 选项指定了运行接下来一次命令需要等待的秒数。默认是 2 秒。这个命令将会一直运行并按照指定的时间更新显示,直到你使用 `^C` 停下它。 ``` -Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019 +Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019 Wed Jan 23 15:59:14 EST 2019 ``` -下面是一个很有趣的命令实例,你可以监控一个在服务器中登录用户的列表,该列表会按照指定的时间定时更新。就像下面写到的,这个命令会每 10 秒更新一次这个列表。登出的用户将会从当前显示的列表中消失,那些新登录的将会被添加到这个表格当中。如果没有用户再登录或者登出,这个表格跟之前显示的将不会有任何不同。 +下面是一个更有趣的命令实例,你可以监控一个在服务器中登录用户的列表,该列表会按照指定的时间定时更新。就像下面写到的,这个命令会每 10 秒更新一次这个列表。登出的用户将会从当前显示的列表中消失,那些新登录的将会被添加到这个表格当中。如果没有用户再登录或者登出,这个表格跟之前显示的将不会有任何不同。 ``` $ watch -n 10 who -Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019 +Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019 -shs :0 2019-01-23 09:45 (:0) -dory pts/0 2019-01-23 15:50 (192.168.0.5) -nemo pts/1 2019-01-23 16:01 (192.168.0.15) -shark pts/3 2019-01-23 11:11 (192.168.0.27) +shs :0 2019-01-23 09:45 (:0) +dory pts/0 2019-01-23 15:50 (192.168.0.5) +nemo pts/1 2019-01-23 16:01 (192.168.0.15) +shark pts/3 2019-01-23 11:11 (192.168.0.27) ``` -如果你只是想看有多少用户登录过,可以通过 watch 调用 **uptime** 命令获取用户数和负载的平均水平,以及系统的工作状况。 +如果你只是想看有多少用户登录进来,可以通过 `watch` 调用 `uptime` 命令获取用户数和负载的平均水平,以及系统的工作状况。 ``` $ watch uptime -Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019 +Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019 - 16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02 + 16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02 ``` -如果你想使用 watch 重复一个包含了管道的命令,就需要将该命令用引号括起来,就比如下面这个每五秒显示一次有多少进程正在运行的命令。 +如果你想使用 `watch` 重复一个包含了管道的命令,就需要将该命令用引号括起来,就比如下面这个每五秒显示一次有多少进程正在运行的命令。 ``` $ watch -n 5 'ps -ef | wc -l' @@ -68,77 +68,77 @@ $ watch -n 5 free -m Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019 - total used free shared buff/cache available -Mem: 5959 776 3276 12 1906 4878 -Swap: 2047 0 2047 +Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019 + + total used free shared buff/cache available +Mem: 5959 776 3276 12 1906 4878 +Swap: 2047 0 2047 ``` -你可以在 **watch** 后添加一些选项查看某个特定用户下运行的进程,不过 **top** 为此提供了更好的选择。 +你可以在 `watch` 后添加一些选项查看某个特定用户下运行的进程,不过 `top` 为此提供了更好的选择。 ### top 命令 -如果你想查看某个特定用户下的进程,top 命令的 `-u` 选项可以很轻松地帮你达到这个目的。 +如果你想查看某个特定用户下的进程,`top` 命令的 `-u` 选项可以很轻松地帮你达到这个目的。 ``` $ top -u nemo -top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02 -Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie -%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache -MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem +top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02 +Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache +MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND -23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd -23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam) -23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd -23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND +23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd +23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam) +23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd +23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh ``` 你可能不仅可以看到某个用户下的进程,还可以查看每个进程所占用的资源,以及系统总的工作状况。 ### ac 命令 -如果你想查看系统中每个用户登录的时长,可以使用 **ac** 命令。运行该命令之前首先需要安装 **acct**(Debian 等) 或者 **psacct**(RHEL、Centos 等) 包。 +如果你想查看系统中每个用户登录的时长,可以使用 `ac` 命令。运行该命令之前首先需要安装 `acct`(Debian 等)或者 `psacct`(RHEL、Centos 等)包。 -**ac** 命令有一系列的选项,该命令从 **wtmp** 文件中拉取数据。这个例子展示的是最近用户登录的总小时数。 +`ac` 命令有一系列的选项,该命令从 `wtmp` 文件中拉取数据。这个例子展示的是最近用户登录的总小时数。 ``` $ ac - total 1261.72 + total 1261.72 ``` 这个命令显示了用户登录的总的小时数: ``` $ ac -p - shark 5.24 - nemo 5.52 - shs 1251.00 - total 1261.76 + shark 5.24 + nemo 5.52 + shs 1251.00 + total 1261.76 ``` -这个命令显示了用户每天登录的小时数: +这个命令显示了每天登录的用户小时数: ``` $ ac -d | tail -10 -Jan 11 total 0.05 -Jan 12 total 1.36 -Jan 13 total 16.39 -Jan 15 total 55.33 -Jan 16 total 38.02 -Jan 17 total 28.51 -Jan 19 total 48.66 -Jan 20 total 1.37 -Jan 22 total 23.48 -Today total 9.83 +Jan 11 total 0.05 +Jan 12 total 1.36 +Jan 13 total 16.39 +Jan 15 total 55.33 +Jan 16 total 38.02 +Jan 17 total 28.51 +Jan 19 total 48.66 +Jan 20 total 1.37 +Jan 22 total 23.48 +Today total 9.83 ``` ### 总结 -Linux 系统上有很多命令可以用于检查系统活动。**watch** 命令允许你以重复的方式运行任何命令,并观察输出有何变化。**top** 命令是一个专注于用户进程的最佳选项,以及允许你以动态方式查看进程的变化,还可以使用 **ac** 命令检查用户连接到系统的时间。 - -加入 [Facebook][1] 和 [LinkedIn][2] 上的 Network World 社区,来交流更多有用的主题。 +Linux 系统上有很多命令可以用于检查系统活动。`watch` 命令允许你以重复的方式运行任何命令,并观察输出有何变化。`top` 命令是一个专注于用户进程的最佳选项,以及允许你以动态方式查看进程的变化,还可以使用 `ac` 命令检查用户连接到系统的时间。 -------------------------------------------------------------------------------- @@ -147,7 +147,7 @@ via: https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity- 作者:[Sandra Henry-Stocker][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 ce70cf485271aba07ade61f61f080763cf0fba74 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Feb 2019 19:33:03 +0800 Subject: [PATCH 0906/4278] PUB:20190123 Commands to help you monitor activity on your Linux server.md @dianbanjiu https://linux.cn/article-10498-1.html --- ...mands to help you monitor activity on your Linux server.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190123 Commands to help you monitor activity on your Linux server.md (98%) diff --git a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md b/published/20190123 Commands to help you monitor activity on your Linux server.md similarity index 98% rename from translated/tech/20190123 Commands to help you monitor activity on your Linux server.md rename to published/20190123 Commands to help you monitor activity on your Linux server.md index 29b964b35f..4900629eaf 100644 --- a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md +++ b/published/20190123 Commands to help you monitor activity on your Linux server.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (dianbanjiu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10498-1.html) [#]: subject: (Commands to help you monitor activity on your Linux server) [#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 7265d7635cb76672877b526ba1decd92e7e11bf8 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Fri, 1 Feb 2019 21:39:27 +0800 Subject: [PATCH 0907/4278] translating --- ...8 Using more to view text files at the Linux command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190128 Using more to view text files at the Linux command line.md b/sources/tech/20190128 Using more to view text files at the Linux command line.md index 872df3eba8..bc7c9a3c8d 100644 --- a/sources/tech/20190128 Using more to view text files at the Linux command line.md +++ b/sources/tech/20190128 Using more to view text files at the Linux command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 722a87b09e76bdf25cd051311e12f7bf818c5d4b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Feb 2019 22:43:03 +0800 Subject: [PATCH 0908/4278] PRF:20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md @guevaraya --- ...ntion Of RSI (Repetitive Strain Injury).md | 110 ++++++++++-------- 1 file changed, 62 insertions(+), 48 deletions(-) diff --git a/translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md b/translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md index d1ea0ab993..80980b29bb 100644 --- a/translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md +++ b/translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md @@ -1,12 +1,13 @@ -如何在Linux下开发避免重复性压迫损伤 +Linux 下如何避免重复性压迫损伤(RSI) ====== + ![workrave-image][1] -[重复性压迫损伤][2] (RSI)是职业性损伤综合征, 非特异性手臂疼痛或工作引起的上肢障碍。重复性压迫损伤 (RSI) 是由于过度使用双手从事重复性任务,如打字,写和使用鼠标. 不幸的是,大部分人不了解什么是重复性压迫损伤 (RSI)以及它的危害有多大。你可以使用名叫Workrave的开源软件轻松的预防重复性压迫损伤 (RSI)。 +[重复性压迫损伤][2]Repetitive Strain Injury(RSI)是职业性损伤综合症,非特异性手臂疼痛或工作引起的上肢障碍。RSI 是由于过度使用双手从事重复性任务导致的,如打字、书写和使用鼠标. 不幸的是,大部分人不了解什么是 RSI 以及它的危害有多大。你可以使用名叫 Workrave 的开源软件轻松的预防 RSI。 -### 重复性压迫损伤 (RSI)有哪些症状? +### RSI 有哪些症状? -我从[page][3]引用过来的, 看看哪些你被说中了: +我从这个[页面][3]引用过来的,看看哪些你被说中了: 1. 疲惫缺乏忍耐力? 2. 手掌及上肢乏力 @@ -18,31 +19,35 @@ 8. 手总是冰凉的? 9. 健康意识有待提高?稍不注意身体就发现有毛病了。 10. 是否过敏? - 11. 频繁的自我按摩(潜意识的)? - 12. 共鸣的疼痛? 当别人在谈论手痛的时候,你是否也感觉到了手疼? + 11. 频繁的自我按摩(潜意识的)? + 12. 共鸣的疼痛?当别人在谈论手痛的时候,你是否也感觉到了手疼? +### 如何减少发展为 RSI 的风险 - -### 如何减少开发者的重复性压迫损伤风险(RSI) - - * 使用计算机的时候每个30分钟间隔休息一下。借助软件如 workrave 预防重复性压迫损伤风险(RSI)。 - * 有规律的锻炼可以预防各种损伤,包括重复性压迫损伤 - * 使用合理的姿势。调整你的电脑桌和椅子使身体保持一个肌肉放松状态 + * 使用计算机的时候每隔 30 分钟间隔休息一下。借助软件如 workrave 预防 RSI。 + * 有规律的锻炼可以预防各种损伤,包括 RSI。 + * 使用合理的姿势。调整你的电脑桌和椅子使身体保持一个肌肉放松状态。 ### Workrave -Workrave 是一款预防计算机用户患重复性损伤(RSI)或近视。软件会定期锁屏为一个动画: "Workrave 小姐" 引导用户做各种伸展运动并敦促其休息一下。这个软件经常提醒你暂停休息一下并限制你每天的活动。程序可以运行在 MS-Window , Linux以及类UNIX操作系统下。 - +Workrave 是一款预防计算机用户发展为 RSI 或近视的自由开源软件。软件会定期锁屏为一个动画: “Workrave 小姐”,引导用户做各种伸展运动并敦促其休息一下。这个软件经常提醒你暂停休息一下,并限制你每天的限度。程序可以运行在 MS-Window、Linux 以及类 UNIX 操作系统下。 #### 安装 workrave -在Debian/Ubuntu Linux系统运行以下 [apt 命令][4]/[apt-get 命令][5]: -`$ sudo apt-get install workrave` +在 Debian/Ubuntu Linux 系统运行以下 [apt 命令][4]/[apt-get 命令][5]: -Fedora Linux 发行版用户运行一下dnf命令: -`$ sudo dnf install workrave` +``` +$ sudo apt-get install workrave +``` + +Fedora Linux 发行版用户运行以下 dnf 命令: + +``` +$ sudo dnf install workrave +``` + +RHEL/CentOS Linux 用户可以启动 EPEL 仓库并用 [yum 命令][6]安装: -RHEL/CentOS Linux 用户可以启动EPEL repo并用[yum 命令][6]安装: ``` ### [ **在CentOS/RHEL 7.x 及衍生版本上测试** ] ### $ sudo yum install epel-release @@ -50,70 +55,79 @@ $ sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm $ sudo yum install workrave ``` -Arch Linux用户运行以下pacman命令来安装: -`$ sudo pacman -S workrave` +Arch Linux 用户运行以下 pacman 命令来安装: -FreeBSD 用户可用一下pkg命令安装: -`# pkg install workrave` +``` +$ sudo pacman -S workrave +``` + +FreeBSD 用户可用以下 pkg 命令安装: + +``` +# pkg install workrave +``` + +OpenBSD 用户可用以下 pkg_add 命令安装: -OpenBSD 用户可用一下pkg_add命令安装: ``` $ doas pkg_add workrave ``` #### 如何配置 workrave -Workrave 以一个小程序运行,他的用户界面位于面板中。你可以为 workrave 增加一个面板来控制软件的动作和外观。 +Workrave 以一个小程序运行,它的用户界面位于面板中。你可以为 workrave 增加一个面板来控制软件的动作和外观。 -##### 增加一个新workrave对象到面板 +增加一个新 workrave 对象到面板: * 在面板空白区域右键,打开面板弹出菜单 * 选择新增到面板 * 新增面板对话框打开,在加载器顶部,可以看到可用的面板对象按照字母排列。选中 workrave 程序并单击新增。 -![Fig.01: 添加workrave对象到面板][7] -Fig.01: 新增workrave对象到面板 +![图 01:新增 workrave 对象到面板][7] -##### 如何设置 Workrave 属性? +*图 01:新增 workrave 对象到面板* 如果修改 workrave 对象的属性,执行以下步骤: * 右键 workrave 对象打开面板对象弹出 * 选中偏好。使用属性对话框修改对应属性 -![](https://www.cyberciti.biz/media/new/tips/2009/11/linux-gnome-workwave-preferences-.png) -Fig.02: 修改 Workrave 对象属性 +![图 02:修改 Workrave 对象属性](https://www.cyberciti.biz/media/new/tips/2009/11/linux-gnome-workwave-preferences-.png) + +*图 02:修改 Workrave 对象属性* #### Workrave 运行展示 -主窗口显示下一次提醒休息的剩余时间,这个窗口可以关闭,时间提示窗口会在面板上。 +主窗口显示下一次提醒休息的剩余时间,这个窗口可以关闭,时间提示窗口会显示在面板上。 -![Fig.03: 时间计数器 ][8] -Fig.03:时间计数器 +![图 03:时间计数器][8] -![Fig.04: Workrave 小姐- 引导你做伸展运动的动画][9] -Fig.04: Workrave 小姐- 引导你做伸展运动的动画 +*图 03:时间计数器* -休息提示窗口,请求你暂停一下工作 +![图 04:Workrave 小姐 - 引导你做伸展运动的动画][9] -![Fig.05: 休息提示倒计时 ][10] -Fig.05: 休息提示倒计时 +*图 04:Workrave 小姐 - 引导你做伸展运动的动画* -![Fig.06: 你可以跳过休息按钮 ][11] -Fig.06: 你可以跳过休息按钮 +休息提示窗口,请求你暂停一下工作: -##### 参考链接: +![图 05:休息提示倒计时][10] + +*图 05:休息提示倒计时* + +![图 06:你可以跳过休息][11] + +*图 06:你可以跳过休息* + +#### 参考链接: 1. [Workrave 项目][12] 主页 - 2. [pokoy][13] 轻量级防止重复性压迫损伤(RSI)和其他计算机压力的程序 - 3. GNOME3下的[Pomodoro][14] 计数器 . + 2. [pokoy][13] 防止 RSI 和其他计算机压力的轻量级守护进程 + 3. GNOME3 下的 [Pomodoro][14] 计数器 4. [RSI][2] 的维基百科 - - ### 关于作者 -作者是nixCraft创始人,经验丰富的系统管理员,同时也是一个Linux/Unix系统下的shell脚本培训师。他曾服务于全球客户,并与多个行业合作包括IT,教育,国防和航天研究,以及非盈利机构。可以[Twitter][15], [Facebook][16], [Google+][17]关注他。 +作者是 nixCraft 创始人,经验丰富的系统管理员,同时也是一个 Linux/Unix 系统下的 shell 脚本培训师。他曾服务于全球客户,并与多个行业合作包括 IT、教育、国防和航天研究,以及非盈利机构。可以在 [Twitter][15]、[Facebook][16]、[Google+][17] 上关注他。 -------------------------------------------------------------------------------- @@ -121,7 +135,7 @@ via: https://www.cyberciti.biz/tips/repetitive-strain-injury-prevention-software 作者:[Vivek Gite][a] 译者:[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 1c89dd664285ba111742e957c45191877b204767 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Feb 2019 22:45:36 +0800 Subject: [PATCH 0909/4278] PUB:20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md @guevaraya https://linux.cn/article-10499-1.html --- ...x-Unix App For Prevention Of RSI (Repetitive Strain Injury).md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md (100%) diff --git a/translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md b/published/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md similarity index 100% rename from translated/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md rename to published/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md From fa39285e32438e95bda317b71280c396460025c5 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Fri, 1 Feb 2019 17:00:22 +0000 Subject: [PATCH 0910/4278] Revert "Start translating 'managing digital files'" This reverts commit af614d9555cb3f5f8b36e010036ae62fe05494e1. --- ...ing Digital Files (e.g., Photographs) in Files and Folders.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md b/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md index 9a5c691e42..d1fd01ef0c 100644 --- a/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md +++ b/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md @@ -1,4 +1,3 @@ -Moelf translating Managing Digital Files (e.g., Photographs) in Files and Folders ====== Update 2014-05-14: added real world example From a9b4380dfb3b2339dad12499b0e83e1cefd25fa4 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Fri, 1 Feb 2019 17:00:36 +0000 Subject: [PATCH 0911/4278] =?UTF-8?q?Revert=20"fuowang=20=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E4=B8=AD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 7ea9c4c23734b343f5ad5533863989373cefe7c0. --- ...402 An introduction to the Flask Python web app framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180402 An introduction to the Flask Python web app framework.md b/sources/tech/20180402 An introduction to the Flask Python web app framework.md index ffb6e9c441..4b07338bc5 100644 --- a/sources/tech/20180402 An introduction to the Flask Python web app framework.md +++ b/sources/tech/20180402 An introduction to the Flask Python web app framework.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (fuowang) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (An introduction to the Flask Python web app framework) From c4da0579be89af1c32992b14fb7e044107c8ce4f Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sat, 2 Feb 2019 02:07:50 +0800 Subject: [PATCH 0912/4278] hankchow translated --- ...90129 More About Angle Brackets in Bash.md | 88 ------------------- ...90129 More About Angle Brackets in Bash.md | 87 ++++++++++++++++++ 2 files changed, 87 insertions(+), 88 deletions(-) delete mode 100644 sources/tech/20190129 More About Angle Brackets in Bash.md create mode 100644 translated/tech/20190129 More About Angle Brackets in Bash.md diff --git a/sources/tech/20190129 More About Angle Brackets in Bash.md b/sources/tech/20190129 More About Angle Brackets in Bash.md deleted file mode 100644 index 5632fe6321..0000000000 --- a/sources/tech/20190129 More About Angle Brackets in Bash.md +++ /dev/null @@ -1,88 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: 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) - -More About Angle Brackets in Bash -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/bash-angles.png?itok=mVFnxPzF) - -In the previous article, we [introduced the subject of angle brackets][1] (`< >`) and demonstrated some of their uses. Here, we'll look at the topic from a few more angles. Let's dive right in. - -You can use `<` to trick a tool into believing the output of a command is data from a file. - -Let's say you are not sure your backup is complete, and you want to check that a certain directory contains all the files copied over from the original. You can try this: - -``` -diff <(ls /original/dir/) <(ls /backup/dir/) -``` - -[`diff`][2] is a tool that typically compares two text files line by line, looking for differences. Here it gets the output from two `ls` commands and treats them as if coming from a file and compares them as such. - -Note that there is no space between the `<` and the `(...)`. - -Running that on the original and backup of a directory where I save pretty pictures, I get: - -``` -diff <(ls /My/Pictures/) <(ls /My/backup/Pictures/) 5d4 < Dv7bIIeUUAAD1Fc.jpg:large.jpg -``` - -The `<` in the output is telling me that there is file ( _Dv7bIIeUUAAD1Fc.jpg:large.jpg_ ) on the left side of the comparison (in _/My/Pictures_ ) that is not on the right side of the comparison (in _/My/backup/Pictures_ ), which means copying over has failed for some reason. If `diff` didn't cough up any output, it would mean that the list of files were the same. - -So, you may be wondering, if you can take the output of a command or command line, make it look like the contents of a file, and feed it to an instruction that is expecting a file, that means that in the _sorting by favorite actor_ example from above, you could've done away with the intermediate file and just piped the output from the loop into `sort`. - -In short, yep! The line: - -``` -sort -r <(while read -r name surname films;do echo $films $name $surname ; done < CBactors) -``` - -does the trick nicely. - -### Here string! Good string! - -There is one more case for redirecting data using angle brackets (or arrows, or whatever you want to call them). - -You may be familiar with the practice of passing variables to commands using `echo` and a pipe (`|`). Say you want to convert a variable containing a string to uppercase characters because... I don't know... YOU LIKE SHOUTING A LOT. You could do this: - -``` -myvar="Hello World" echo $myvar | tr '[:lower:]' '[:upper:]' HELLO WORLD -``` - -The [`tr`][3] command _tr_ anslates strings to different formats. In the example above, you are telling `tr` to change all the lowercase characters that come along in the string to uppercase characters. - -It is important to know that you are not passing on the variable, but only its contents, that is, the string " _Hello World_ ". This is called the _here string_ , as in " _it is here, in this context, that we know what string we are dealing with_ ". But there is shorter, clearer, and all round better way of delivering _here strings_ to commands. Using - -``` -tr '[:lower:]' '[:upper:]' <<< $myvar -``` - -does the same thing with no need to use echo or a pipe. It also uses angle brackets, which is the whole obsessive point of this article. - -### Conclusion - -Again, Bash proves to give you lots of options with very little. I mean, who would've thunk that you could do so much with two simple characters like `<` and `>`? - -The thing is we aren't done. There are plenty of more characters that bring meaning to chains of Bash instructions. Without some background, they can make shell commands look like gibberish. Hopefully, post by post, we can help you decipher them. Until next time! - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-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/understanding-angle-brackets-bash -[2]: https://linux.die.net/man/1/diff -[3]: https://linux.die.net/man/1/tr diff --git a/translated/tech/20190129 More About Angle Brackets in Bash.md b/translated/tech/20190129 More About Angle Brackets in Bash.md new file mode 100644 index 0000000000..de4f8331ca --- /dev/null +++ b/translated/tech/20190129 More About Angle Brackets in Bash.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +Bash 中尖括号的更多用法 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/bash-angles.png?itok=mVFnxPzF) + +在[上一篇文章][1]当中,我们介绍了尖括号(`<>`)以及它们的一些用法。在这篇文章,我们继续来深入探讨尖括号的更多其它用法。 + +通过使用 `<`,可以实现“欺骗”的效果,让其它命令认为某个命令的输出是一个文件。 + +例如,在进行备份文件的时候不确定备份是否完整,就需要去确认某个目录是否已经包含从原目录中复制过去的所有文件。你可以试一下这样操作: + +``` +diff <(ls /original/dir/) <(ls /backup/dir/) +``` + +[`diff`][2] 命令是一个逐行比较两个文件之间差异的工具。在上面的例子中,就使用了 `<` 让 `diff` 认为两个 `ls` 命令输出的结果都是文件,从而能够比较它们之间的差异。 + +要注意,在 `<` 和 `(...)` 之间是没有空格的。 + +我尝试在我的图片目录和它的备份目录执行上面的命令,输出的是以下结果: + +``` +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 -r <(while read -r name surname films;do echo $films $name $surname ; done < CBactors) +``` + +### Here string + +除此以外,尖括号的重定向功能还有另一种使用方式。 + +使用 `echo` 和管道(`|`)来传递变量的用法,相信大家都不陌生。假如想要把一个字符串变量转换为全大写形式,你可以这样做: + +``` +myvar="Hello World" echo $myvar | tr '[:lower:]' '[:upper:]' HELLO WORLD +``` + +[`tr`][3] 命令可以将一个字符串转换为某种格式。在上面的例子中,就使用了 `tr` 将字符串中的所有小写字母都转换为大写字母。 + +要理解的是,这个传递过程的重点不是变量,而是变量的值,也就是字符串 `Hello World`。这样的字符串叫做 here string,含义是“这就是我们要处理的字符串”。但对于上面的例子,还可以用更直观的方式的处理,就像下面这样: + +``` +tr '[:lower:]' '[:upper:]' <<< $myvar +``` + +这种简便方式并不需要使用到 `echo` 或者管道,而是使用了我们一直在说的尖括号。 + +### 总结 + +使用 `<` 和 `>` 这两个简单的符号,原来可以实现这么多功能,Bash 又一次为工作的灵活性提供了很多选择。 + +当然,我们的介绍还远远没有完结,因为还有很多别的符号可以为 Bash 命令带来更多便利。不过如果没有充分理解它们,充满符号的 Bash 命令看起来只会像是一堆乱码。接下来我会解读更多类似的 Bash 符号,下次见! + +-------------------------------------------------------------------------------- + +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) + +本文由 [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 +[2]: https://linux.die.net/man/1/diff +[3]: https://linux.die.net/man/1/tr + From 739198bf97c7ff27c7d04c4a71f1475a2edc114e Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sat, 2 Feb 2019 04:35:09 +0800 Subject: [PATCH 0913/4278] hankchow translating --- ... 3 open source databases- PostgreSQL, MariaDB, and SQLite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md b/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md index 624b880168..f096fdd264 100644 --- a/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md +++ b/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 644bff1c51ea4414b12e9d4e9f7a42fa1c159c7c Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 2 Feb 2019 10:49:20 +0800 Subject: [PATCH 0914/4278] translated --- ...rminal program for tablets and desktops.md | 55 ------------------- ...rminal program for tablets and desktops.md | 55 +++++++++++++++++++ 2 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md create mode 100644 translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md diff --git a/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md deleted file mode 100644 index 78f31a6b94..0000000000 --- a/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md +++ /dev/null @@ -1,55 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: 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)) - -Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops -====== -Make work more fun with eDEX-UI, the 15th 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/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) - -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 15th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### eDEX-UI - -I was 11 years old when [Tron][1] was in movie theaters. I cannot deny that, despite the fantastical nature of the film, it had an impact on my career choice later in life. - -![](https://opensource.com/sites/default/files/uploads/edex-ui-1.png) - -[eDEX-UI][2] is a cross-platform terminal program designed for tablets and desktops that was inspired by the user interface in Tron. It has five terminals in a tabbed interface, so it is easy to switch between tasks, as well as useful displays of system information. - -At launch, eDEX-UI goes through a boot sequence with information about the ElectronJS system it is based on. After the boot, eDEX-UI shows system information, a file browser, a keyboard (for tablets), and the main terminal tab. The other four tabs (labeled EMPTY) don't have anything loaded and will start a shell when you click on one. The default shell in eDEX-UI is Bash (if you are on Windows, you will likely have to change it to either PowerShell or cmd.exe). - -![](https://opensource.com/sites/default/files/uploads/edex-ui-2.png) - -Changing directories in the file browser will change directories in the active terminal and vice-versa. The file browser does everything you'd expect, including opening associated applications when you click on a file. The one exception is eDEX-UI's settings.json file (in .config/eDEX-UI by default), which opens the configuration editor instead. This allows you to set the shell command for the terminals, change the theme, and modify several other settings for the user interface. Themes are also stored in the configuration directory and, since they are also JSON files, creating a custom theme is pretty straightforward. - -![](https://opensource.com/sites/default/files/uploads/edex-ui-3.png) - -eDEX-UI allows you to run five terminals with full emulation. The default terminal type is xterm-color, meaning it has full-color support. One thing to be aware of is that the keys light up on the keyboard while you type, so if you're using eDEX-UI on a tablet, the keyboard could present a security risk in environments where people can see the screen. It is better to use a theme without the keyboard on those devices, although it does look pretty cool when you are typing. - -![](https://opensource.com/sites/default/files/uploads/edex-ui-4.png) - -While eDEX-UI supports only five terminal windows, that has been more than enough for me. On a tablet, eDEX-UI gives me that cyberspace feel without impacting my productivity. On a desktop, eDEX-UI allows all of that and lets me look cool in front of my co-workers. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-edex-ui - -作者:[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/Tron -[2]: https://github.com/GitSquared/edex-ui 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 new file mode 100644 index 0000000000..cce0f28165 --- /dev/null +++ b/translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: 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 让你的工作更有趣,这是我们开源工具系列中的第 15 个工具,它将使你在 2019 年更高效。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 15 个工具来帮助你在 2019 年更有效率。 + +### eDEX-UI + +当[《创:战纪》][1]上映时我才 11是岁。我不能否认,尽管这部电影充满幻想,但它对我后来的职业选择产生了影响。 + +![](https://opensource.com/sites/default/files/uploads/edex-ui-1.png) + +[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 文件,所以创建自定义主题非常简单。 + +![](https://opensource.com/sites/default/files/uploads/edex-ui-3.png) + +eDEX-UI 允许你使用完全仿真运行五个终端。默认终端类型是 xterm-color,这意味着它支持全色彩。需要注意的一点是,输入时键盘会亮起,因此如果你在平板电脑上使用 eDEX-UI,键盘可能会在人们看见屏幕的环境中带来安全风险。因此最好在这些设备上使用没有键盘的主题,尽管在打字时看起来确实很酷。 + +![](https://opensource.com/sites/default/files/uploads/edex-ui-4.png) + +虽然 eDEX-UI 仅支持五个终端窗口,但这对我来说已经足够了。在平板电脑上,eDEX-UI 给了我网络空间的感觉而不会影响我的效率。在桌面上,eDEX-UI 支持所有功能,并让我在我的同事面前显得很酷。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [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/Tron +[2]: https://github.com/GitSquared/edex-ui From 96d1081f7ecdc7ea90e227a725e128ef5f373a39 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 2 Feb 2019 10:54:12 +0800 Subject: [PATCH 0915/4278] translating --- ...21 Get started with TaskBoard, a lightweight kanban board.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index e77e5e3b1c..e083d650e5 100644 --- 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 @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 606f8824699967560421a64b13a05da18b8187c1 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 2 Feb 2019 13:00:54 +0800 Subject: [PATCH 0916/4278] Translating by MjSeven 20190117 --- ...pdate-Change Users Password in Linux Using Different Ways.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md b/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md index d3ca9cb0ab..f2125027c0 100644 --- a/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md +++ b/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 11ce20b98b40895c4f6989ca29b35748458489f7 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sat, 2 Feb 2019 13:42:38 +0800 Subject: [PATCH 0917/4278] hankchow translated --- ...abases- PostgreSQL, MariaDB, and SQLite.md | 146 ----------------- ...abases- PostgreSQL, MariaDB, and SQLite.md | 149 ++++++++++++++++++ 2 files changed, 149 insertions(+), 146 deletions(-) delete mode 100644 sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md create mode 100644 translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md diff --git a/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md b/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md deleted file mode 100644 index f096fdd264..0000000000 --- a/sources/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: 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) - -Comparing 3 open source databases: PostgreSQL, MariaDB, and SQLite -====== -Find out how to choose the best open source database for your needs. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_container_block.png?itok=S8MbXEYw) - -In the world of modern enterprise technologies, open source software has firmly established itself as one of the biggest forces to reckon with. After all, some of the biggest technology developments have emerged because of the [open source movement][1]. - -It's not difficult to see why: even though Linux-based open source network standards may not be as popular as proprietary options, they are the reason smart devices from different manufacturers can communicate with each other. In addition, many argue that open source development produces applications that are superior to their proprietary counterparts. This is one reason why the chances are good that your favorite tools (whether open source or proprietary) were developed using open source databases. - -Like any other category of software, the functionality and features of open source database management systems can differ quite significantly. To put that in plainer terms, [not all open source database management systems are equal][2]. If you are choosing an open source database for your organization, it's important to choose one that is user-friendly, can grow with your organization, and offers more-than-adequate security features. - -With that in mind, we've compiled this overview of open source databases and their respective advantages and disadvantages. Sadly, we had to leave out some of the most used databases. Notably, MongoDB has recently changed its licensing model, so it is no longer truly open source. This decision probably made sense from a business perspective, since MongoDB has become the de facto solution for database hosting [with nearly 27,000 companies][3] using it, but it also means MongoDB can no longer be considered a truly open source system. - -In addition, since it acquired MySQL, Oracle has all but killed the open source nature of that project, which was arguably the go-to open source database for decades. However, this has opened space for other truly open source database solutions to challenge it. Here are three of them to consider. - -### PostgreSQL - -No list of open source databases would be complete without [PostgreSQL][4], which has long been the preferred solution for businesses of all sizes. Oracle's acquisition of MySQL might have made good business sense at the time, but the rise of cloud storage has meant that the database [has gradually fallen out of favor with developers][5]. - -Although PostgreSQL has been around for a while, the relative [decline of MySQL][6] has made it a serious contender for the title of most used open source database. Since it works very similarly to MySQL, developers who prefer open source software are converting in droves. - -#### Advantages - - * By far, PostgreSQL's most mentioned advantage is the efficiency of its central algorithm, which means it outperforms many databases that are advertised as more advanced. This is especially useful if you are working with large datasets, for which I/O processes can otherwise become a bottleneck. - - * It is also one of the most flexible open source databases around; you can write functions in a wide range of server-side languages: Python, Perl, Java, Ruby, C, and R. - - * As one of the most commonly used open source databases, PostgreSQL's community support is some of the best around. - - - - -#### Disadvantages - - * PostgreSQL's efficiency with large datasets is well known, but there are quicker tools available for smaller databases. - - * While its community support is very good, PostgreSQL's core documentation could be improved. - - * If you are used to advanced tools like parallelization and clustering, be aware that these require third-party plugins in PostgreSQL. There are plans to gradually add these features to the main release, but it will likely be a few years before they are offered as standard. - - - - -### MariaDB - -[MariaDB][7] is a truly open source distribution of MySQL (released under the [GNU GPLv2][8]). It was [created after Oracle's acquisition][9] of MySQL, when some of MySQL's core developers were concerned that Oracle would undermine its open source philosophy. - -MariaDB was developed to be as compatible with MySQL as possible while replacing several key components. It uses a storage engine, Aria, that functions as both a transactional and non-transactional engine. [Some even speculated][10] Aria would become the standard engine for MySQL in future releases, before MariaDB diverged. - -#### Advantages - - * Many users choose MariaDB over MySQL due to MariaDB's [frequent security releases][11]. While this does not necessarily mean MariaDB is more secure, it does indicate the development community takes security seriously. - - * Others say MariaDB's major advantages are that it will almost definitely remain open source and highly compatible with MySQL. This means migrating from one system to the other is extremely fast. - - * Because of this compatibility, MariaDB also plays well with many other languages that are commonly used with MySQL. This means less time is spent learning and debugging code. - - * You can [install and run][12] WordPress with MariaDB instead of MySQL for better performance and a richer feature set. WordPress is the [most popular CMS by marketshare][13]—powering nearly half the internet—and has an active open source developer community. Third-party themes and plugins work as intended when WordPress is installed with MariaDB. - - - - -#### Disadvantages - - * MariaDB is somewhat liable to bloating. Its central IDX log file, in particular, tends to become very large after protracted use, ultimately slowing performance. - - * Caching is another area where MariaDB could use work—it is not as fast as it could be, which can be frustrating. - - * Despite all the initial promises, MariaDB is no longer completely compatible with MySQL. If you are migrating from MySQL, you will have some re-coding to do. - - - - -### SQLite - -[SQLite][14] is arguably the most implemented database engine in the world, thanks to its adoption by many popular web browsers, operating systems, and mobile phones. Originally developed as a lightweight fork of MySQL, unlike many other databases it is not a client-server engine; rather, the full software is embedded into each implementation. - -This creates SQLite's major advantage: on embedded or distributed systems, each machine carries an entire implementation of the database. This can greatly speed up the performance of databases because it reduces the need for inter-system calls. - -#### Advantages - - * If you are looking to build and implement a small database, SQLite is [arguably the best way to go][15]. It is extremely small, so it can be implemented across a wide range of embedded systems without time-consuming workarounds. - - * Its small size makes the system extremely fast. While some more advanced databases use complex ways of producing efficiency savings, SQLite takes a much simpler approach: By reducing the size of your database and its associated processing software, there is simply less data to work with. - - * Its widespread adoption also means SQLite is probably the most compatible database out there. This is particularly important if you need or plan to integrate your system with smartphones: the system has been native on iOS for as long as there have been third-party apps and works flawlessly in a wide range of environments. - - - - -#### Disadvantages - - * SQLite's tiny size means it lacks some features found in larger databases. It lacks built-in data encryption, for example, something that has become standard to prevent the [most common online hacker attacks][16]. - - * While the wide adoption and publicly available code makes SQLite easy to work with, it also increases its attack surface area. This is its most commonly cited disadvantage. New critical vulnerabilities are frequently discovered in SQLite, such as the recent remote attack vector called [Magellan][17]. - - * Although SQLite's single-file approach creates speed advantages, there is no easy way to implement a multi-user environment using the system. - - - - -### Which open source database is best? - -Ultimately, your choice of open source database will depend on your business needs and particularly on the size of your system. For small databases or those with limited use, go for a lightweight solution: not only will it speed up implementation but a less-complex system means you will spend less time debugging. - -For larger systems, especially in growing businesses, invest the time to implement a more complex database like PostgreSQL. This will save you time—eventually—by removing the need to re-code your databases as your business grows. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/open-source-databases - -作者:[Sam Bocetta][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/sambocetta -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/18/2/pivotal-moments-history-open-source -[2]: https://blog.capterra.com/free-database-software/ -[3]: https://idatalabs.com/tech/products/mongodb -[4]: https://www.postgresql.org/ -[5]: https://www.theregister.co.uk/2018/05/31/rise_of_the_open_source_data_strategies/ -[6]: https://www.itworld.com/article/2721995/big-data/signs-of-mysql-decline-on-horizon.html -[7]: https://mariadb.org/ -[8]: https://github.com/MariaDB/server/blob/10.4/COPYING -[9]: https://mariadb.com/about-us/ -[10]: http://kb.askmonty.org/en/aria-faq -[11]: https://mariadb.org/tag/security/ -[12]: https://mariadb.com/resources/blog/how-to-install-and-run-wordpress-with-mariadb/ -[13]: https://websitesetup.org/popular-cms/ -[14]: https://www.sqlite.org/index.html -[15]: https://www.sqlite.org/aff_short.html -[16]: https://hostingcanada.org/most-common-website-vulnerabilities/ -[17]: https://www.securitynewspaper.com/2018/12/18/critical-vulnerability-in-sqlite-you-should-update-now/ 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 new file mode 100644 index 0000000000..6638fb8fb7 --- /dev/null +++ b/translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +开源数据库 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]的东风,很多重大的技术已经得到了长足的发展。 + +个中原因显而易见,尽管一些基于 Linux 的开源网络标准可能不如著名厂商的产品那么受欢迎,但是不同制造商的智能设备之间能够互相通信,开源技术功不可没。当然也有不少人认为开源应用比厂商提供的产品更加好,所以无论如何,使用开源数据库进行开发确实是相当有利的。 + +和其它类型的应用软件一样,[不同的开源数据库管理系统之间在功能和特性上可能会存在着比较大的差异][2]。因此,如果要为整个团队选择一个开源数据库,那么应该重点考察数据库是否对用户友好、是否能够持续适应团队需求、是否能够提供足够安全的功能等方面的因素。 + +出于这方面考虑,我们在这篇文章中对一些开源数据库进行了概述和对比。但也有可能略过了一些常用的数据库。需要提到的是,MongoDB 最近更改了它的许可证,因此它已经不是完全的开源产品了。从商业角度来看,这个决定是很有意义的,因为 MongoDB 已经成为了[约 27000 家公司][3]在数据库托管方面的实际解决方案,这也意味着 MongoDB 已经不再被视为真正的开源产品。 + +另外,在 MySQL 被 Oracle 收购之后,这个产品就已经不再具有开源性质了。MySQL 在过去相当长的一段时间里都是很多项目的首选数据库,因此它的案例也是摆在其它开源数据库面前的一个巨大挑战。 + +下面讨论一下我们提到的三个开源数据库。 + +### PostgreSQL + +[PostgreSQL][4] 可以说是开源数据库中的一个重要成员。无论是哪种规模的企业,PostgreSQL 可能都是它们的首选解决方案。Oracle 对 MySQL 的收购在当时来说可能具有一定的商业意义,但是随着云存储的日益壮大,[开发者对 MySQL 的依赖程度或许并不如以前那么大了][5]。 + +尽管 PostgreSQL 不是一个最近几年才面世的新产品,但它却是借助了 [MySQL 衰落][6]的机会才逐渐成为最受欢迎的开源数据库之一。由于它和 MySQL 的工作方式非常相似,因此很多热衷于使用开源软件的开发者都纷纷转向 PostgreSQL。 + +#### 优势 + + * 目前 PostgreSQL 最显著的优点是它的算法效率高,因此它的性能就比其它的数据库也高一些。这一点在处理大型数据集的时候就可以很明显地体现出来了,否则在运算过程中 I/O 会成为瓶颈。 + * PostgreSQL 也是最灵活的开源数据库之一,使用 Python、Perl、Java、Ruby、C 或者 R 都能够很方便地调用数据库。 + * 作为最常用的几个开源数据库之中,PostgreSQL 的社区支持是做得最好的。 + + + + +#### 劣势 + + * 在数据量比较大的时候,PostgreSQL 的效率毋庸置疑是很高的,但对于数据量较小的情况,使用 PostgreSQL 就显得不如其它的一些工具轻量级了。 + + * 尽管拥有一个很优秀的社区支持,但 PostgreSQL 的核心文档仍然需要作出改进。 + + * 如果你需要使用并行计算或者集群化等高级工具,就需要安装 PostgreSQL 的第三方插件。尽管官方有计划将这些功能逐步添加到主要版本当中,但可能会需要再等待好几年才能实现。 + + + + +### MariaDB + +[MariaDB][7] 是 MySQL 的真正开源发行版本(在 [GNU GPLv2][8] 下发布)。在 Oracle 收购 MySQL 之后,MySQL 的一些核心开发人员认为 Oracle 会破坏 MySQL 的开源理念,因此建立了 MariaDB 这个独立的分支。 + +MariaDB 在开发过程中替换了 MySQL 的几个关键组件,但仍然尽可能地保持兼容 MySQL。MariaDB 使用了 Aria 作为存储引擎,这个存储引擎既可以作为事务式引擎,也可以作为非事务式引擎。在 MariaDB 独立出来之前,就[有一些人推测][10] Aria 会成为 MySQL 未来版本中的标准引擎。 + +#### 优势 + + * 由于 MariaDB [频繁进行安全发布][11],很多用户选择使用 MariaDB 而不选择 MySQL。尽管这不一定代表 MariaDB 会比 MySQL 更加安全,但确实表明它的开发社区对安全性十分重视。 + + * 有一些人认为,MariaDB 的主要优点就是它在坚持开源的同时会与 MySQL 保持高度兼容,这就表示从 MySQL 向 MariaDB 的迁移会非常容易。 + + * 也正是由于这种兼容性,MariaDB 也可以和其它常用于 MySQL 的语言配合使用,因此从 MySQL 迁移到 MariaDB 之后,学习和调试代码的时间成本会非常低。 + + * 你可以将 WordPress 和 MariaDB(而不是 MySQL)[配合使用][12]从而获得更好的性能和更丰富的功能。WordPress 是[最受欢迎的内容管理系统Content Management System][13](CMS),并且拥有活跃的开源开发者社区。各种第三方插件在 WordPress 和 MariaDB 配合使用时都能够正常工作。 + + + + +#### 劣势 + + * MariaDB 有时会变得比较臃肿,尤其是它的 IDX 日志文件在长期使用之后会变得非常大,最终导致性能下降。 + + * MariaDB 的缓存并没有期望中那么快,这可能会让人有所失望。 + + * 尽管 MariaDB 最初承诺兼容 MySQL,但目前 MariaDB 已经不是完全兼容 MySQL。如果要从 MySQL 迁移到 MariaDB,就需要额外做一些兼容工作。 + + + + +### SQLite + +[SQLite][14] 可以说是世界上实现最多的数据库引擎,因为它被很多流行的 web 浏览器、操作系统和手机所采用。它最初是作为 MySQL 的轻量级分支所开发的。SQLite 和很多其它的数据库不同,它不采用客户端-服务端的引擎架构,而是将整个软件嵌入到每个实现当中。 + +这样的架构让 SQLite 拥有一个强大的优势,就是在嵌入式系统或者分布式系统中,每台机器都搭载了数据库的整个实现。这样的做法减少了系统间的调用,从而大大提高了数据库的性能。 + +#### 优势 + + * 如果你需要构建和实现一个小型数据库,SQLite [可能是最好的选择][15]。它小而灵活,不需要费工夫寻求各种变通方案,就可以在嵌入式系统中实现。 + + * SQLite 体积很小,因此速度也很快。其它的一些高级数据库可能会使用复杂的优化方式来提高效率,但不如SQLite 这样减小数据库大小更为直接。 + + * SQLite 被广泛采用也导致它可能是兼容性最高的数据库。如果你希望将应用程序集成到智能手机上,只要有第三方应用程序使用到了 SQLite,就能够正常运行数据库了。 + + + + +#### 劣势 + + * SQLite 的轻量意味着它缺少了很多其它大型数据库的常见功能。例如数据加密就是[抵御网络攻击][16]的标准功能,而 SQLite 却没有内置这个功能。 + + * SQLite 的广泛流行和源码公开使它易于使用,但是也让它更容易遭受攻击。这是它最大的劣势。SQLite 经常被发现高位的漏洞,例如最近的 [Magellan][17]。 + + * 尽管 SQLite 单文件的方式拥有速度上的优势,但是要使用它实现多用户环境却比较困难。 + + + + +### 哪个开源数据库才是最好的? + +当然,对于开源数据库的选择还是取决于业务的需求以及系统的体量。对于小型数据库或者是使用量比较小的数据库,可以使用比较轻量级的解决方案,这样不仅可以加快实现的速度,而且由于系统的复杂程度不算太高,花在调试上的时间成本也不会太高。 + +而对于大型的系统,尤其是业务增长速度较快的业务,最好还是花时间使用更复杂的数据库(例如 PostgreSQL)。这是一个磨刀不误砍柴工的选择,能够让你不至于在后期再重新选择另一款数据库。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/2/pivotal-moments-history-open-source +[2]: https://blog.capterra.com/free-database-software/ +[3]: https://idatalabs.com/tech/products/mongodb +[4]: https://www.postgresql.org/ +[5]: https://www.theregister.co.uk/2018/05/31/rise_of_the_open_source_data_strategies/ +[6]: https://www.itworld.com/article/2721995/big-data/signs-of-mysql-decline-on-horizon.html +[7]: https://mariadb.org/ +[8]: https://github.com/MariaDB/server/blob/10.4/COPYING +[9]: https://mariadb.com/about-us/ +[10]: http://kb.askmonty.org/en/aria-faq +[11]: https://mariadb.org/tag/security/ +[12]: https://mariadb.com/resources/blog/how-to-install-and-run-wordpress-with-mariadb/ +[13]: https://websitesetup.org/popular-cms/ +[14]: https://www.sqlite.org/index.html +[15]: https://www.sqlite.org/aff_short.html +[16]: https://hostingcanada.org/most-common-website-vulnerabilities/ +[17]: https://www.securitynewspaper.com/2018/12/18/critical-vulnerability-in-sqlite-you-should-update-now/ + + From d339a0bea23cca18b8defc3e3f951ed204df6972 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Feb 2019 14:11:13 +0800 Subject: [PATCH 0918/4278] PRF:20190120 Get started with HomeBank, an open source personal finance app.md @geekpi --- ...meBank, an open source personal finance app.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md index d124db94c0..5ef2376379 100644 --- a/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md +++ b/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md @@ -1,15 +1,16 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with HomeBank, an open source personal finance app) [#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 HomeBank,一个开源个人财务应用 +开始使用 HomeBank 吧,一款开源个人财务应用 ====== -使用 HomeBank 跟踪你的资金流向,这是我们开源工具系列中的第八个工具,它将在 2019 年提高你的工作效率。 +> 使用 HomeBank 跟踪你的资金流向,这是我们开源工具系列中的第八个工具,它将在 2019 年提高你的工作效率。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1) 每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 @@ -24,7 +25,7 @@ [HomeBank][1] 是一款个人财务桌面应用,帮助你轻松跟踪你的财务状况,来帮助减少此类压力。它有很好的报告可以帮助你找出你花钱的地方,允许你设置导入交易的规则,并支持大多数现代格式。 -HomeBank 默认可在大多数发行版上可用,因此安装它非常简单。当你第一次启动它时,它将引导你完成设置并让你创建一个帐户。之后,你可以导入任意一种支持的文件格式或开始输入交易。交易簿本身就是一个交易列表。 [与其他一些应用不同][2],你不必学习[复式簿记][3]来使用 HomeBank。 +HomeBank 默认可在大多数发行版上可用,因此安装它非常简单。当你第一次启动它时,它将引导你完成设置并让你创建一个帐户。之后,你可以导入任意一种支持的文件格式或开始输入交易。交易簿本身就是一个交易列表。[与其他一些应用不同][2],你不必学习[复式记账法][3]来使用 HomeBank。 ![](https://opensource.com/sites/default/files/uploads/homebank-2.png) @@ -40,7 +41,7 @@ HomeBank 还有预算功能,允许你计划未来几个月的开销。 对我来说,最棒的功能是 HomeBank 的报告。主页面上不仅有一个图表显示你花钱的地方,而且还有许多其他报告可供你查看。如果你使用预算功能,还会有一份报告会根据预算跟踪你的支出情况。你还可以以饼图和条形图的方式查看报告。它还有趋势报告和余额报告,因此你可以回顾并查看一段时间内的变化或模式。 -总的来说,HomeBank 是一个非常友好,有用的程序,可以帮助你保持良好的财务。如果跟踪你的钱是你生活中的一件麻烦事,它使用起来很简单并且非常有用。 +总的来说,HomeBank 是一个非常友好,有用的程序,可以帮助你保持良好的财务状况。如果跟踪你的钱是你生活中的一件麻烦事,它使用起来很简单并且非常有用。 -------------------------------------------------------------------------------- @@ -50,7 +51,7 @@ via: https://opensource.com/article/19/1/productivity-tools-homebank 作者:[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/) 荣誉推出 @@ -58,4 +59,4 @@ via: https://opensource.com/article/19/1/productivity-tools-homebank [b]: https://github.com/lujun9972 [1]: http://homebank.free.fr/en/index.php [2]: https://www.gnucash.org/ -[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system \ No newline at end of file +[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system From 930c36d7d2093e98c1516c26239a5814ff8a3687 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Feb 2019 14:11:44 +0800 Subject: [PATCH 0919/4278] PUB:20190120 Get started with HomeBank, an open source personal finance app.md @geekpi https://linux.cn/article-10500-1.html --- ...rted with HomeBank, an open source personal finance app.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190120 Get started with HomeBank, an open source personal finance app.md (98%) diff --git a/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/published/20190120 Get started with HomeBank, an open source personal finance app.md similarity index 98% rename from translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md rename to published/20190120 Get started with HomeBank, an open source personal finance app.md index 5ef2376379..602477dd01 100644 --- a/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md +++ b/published/20190120 Get started with HomeBank, an open source personal finance app.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10500-1.html) [#]: subject: (Get started with HomeBank, an open source personal finance app) [#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From a487104755ab5ae5ed20f21055344a78d7a7e2b4 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 2 Feb 2019 14:28:47 +0800 Subject: [PATCH 0920/4278] Translating Translating: fdisk - Easy Way To Manage Disk Partitions In Linux --- ...90128 fdisk - Easy Way To Manage Disk Partitions In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md b/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md index cc89e8c7f1..85a7dfb885 100644 --- a/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md +++ b/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2467cb0299d543440224972880ac13e9e0f4d207 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 15:32:57 +0800 Subject: [PATCH 0921/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190130=20Get?= =?UTF-8?q?=20started=20with=20Budgie=20Desktop,=20a=20Linux=20environment?= =?UTF-8?q?=20sources/tech/20190130=20Get=20started=20with=20Budgie=20Desk?= =?UTF-8?q?top,=20a=20Linux=20environment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ith Budgie Desktop, a Linux environment.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..1c2389693f --- /dev/null +++ b/sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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/ From dcfc4e5c4e95a4c018088801586bf15745aaf8b7 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 2 Feb 2019 15:34:42 +0800 Subject: [PATCH 0922/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=902?= =?UTF-8?q?0190117?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Password in Linux Using Different Ways.md | 251 ------------------ ... Password in Linux Using Different Ways.md | 251 ++++++++++++++++++ 2 files changed, 251 insertions(+), 251 deletions(-) delete mode 100644 sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md create mode 100644 translated/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md diff --git a/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md b/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md deleted file mode 100644 index f2125027c0..0000000000 --- a/sources/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md +++ /dev/null @@ -1,251 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: 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/) - -How to Update/Change Users Password in Linux Using Different Ways -====== - -It’s a basic thing to set a user password whenever you create an user account in Linux. - -Everybody uses passwd command followed by the user name `passwd USERNAME` to set a password for a user. - -Make sure you have to set a hard and guess password that will help you to make the system more secure. - -I mean to say, it should be the combination of Alphabets, Symbols and numbers. - -Also, i advise you to change the password at least once in a month for security reason. - -When you use the passwd command it will ask you to enter the password twice to set it. It’s a native method to set a user password. - -If you don’t want to update the password twice and would like to do this in different way? - -Yes, we can. There will be a possibility to do. - -If you are working as a Linux admin you might have asked the below questions many times. - -Some of you may or may not got answer for these questions. - -Whatever it’s, don’t worry we are here to answer your all questions. - - * How to Update/Change Users Password in Single Command? - * How to Update/Change a Same Password for Multiple users in Linux? - * How to Update/Change Multiple Users Password in Linux? - * How to Update/Change Password for Multiple Users in Linux? - * How to Update/Change Different Password for Multiple Users in Linux? - * How to Update/Change Users Password in Multiple Linux Servers? - * How to Update/Change Multiple Users Password in Multiple Linux Servers? - - - -### Method-1: Using passwd Command - -passwd command is a standard method to set or update or change password for users in Linux. The below way is a standard method to do it. - -``` -# passwd renu -Changing password for user renu. -New password: -BAD PASSWORD: The password contains the user name in some form -Retype new password: -passwd: all authentication tokens updated successfully. -``` - -Run the following command if you would like to set or change password with single command. This allow users to update password in a single command. - -``` -# echo "new_password" | passwd --stdin thanu -Changing password for user thanu. -passwd: all authentication tokens updated successfully. -``` - -### Method-2: Using chpasswd Command - -chpasswd is an another command will allow us to set or update or change password for users in Linux. Use the following format if you would like to use chpasswd command to change password for user in a single command. - -``` -# echo "thanu:new_password" | chpasswd -``` - -### Method-3: How to Set Different Password for Multiple Users - -Use the below script if you would like to set or update or change a password for multiple users in Linux with different password. - -To do so, first we need to get a users list by using the following command. The below command will list the users who’s having `/home` directory and redirect the output to `user-list.txt` file. - -``` -# cat /etc/passwd | grep "/home" | cut -d":" -f1 > user-list.txt -``` - -List out the users using cat command. Remove the user from the list if you don’t want to reset the password for the specific user. - -``` -# cat user-list.txt -centos -magi -daygeek -thanu -renu -``` - -Create a following small shell script to achieve this. - -``` -# vi password-update.sh - -#!/bin/sh -for user in `more user-list.txt` -do -echo "[email protected]" | passwd --stdin "$user" -chage -d 0 $user -done -``` - -Set an executable permission to `password-update.sh` file. - -``` -# chmod +x password-update.sh -``` - -Finally run the script to achieve this. - -``` -# ./password-up.sh - -magi -Changing password for user magi. -passwd: all authentication tokens updated successfully. -daygeek -Changing password for user daygeek. -passwd: all authentication tokens updated successfully. -thanu -Changing password for user thanu. -passwd: all authentication tokens updated successfully. -renu -Changing password for user renu. -passwd: all authentication tokens updated successfully. -``` - -### Method-4: How to Set a Same Password for Multiple Users - -Use the below script if you would like to set or update or change a same password for multiple users in Linux. - -``` -# vi password-update.sh - -#!/bin/sh -for user in `more user-list.txt` -do -echo "new_password" | passwd --stdin "$user" -chage -d 0 $user -done -``` - -### Method-5: How to Change User password in Multiple Servers - -Use the following script if you want to change a user password in multiple servers. In my case, we are going to change a password for `renu` user. Make sure you have to give the user name which you want to update the password instead of us. - -Make sure you have to update the servers list into `server-list.txt` file. Each server should be in separate line. - -``` -# vi password-update.sh - -#!/bin/bash -for server in `cat server-list.txt` -do -ssh [email protected]$server 'passwd --stdin renu < user-list.txt +``` + +使用 cat 命令列出用户。如果你不想重置特定用户的密码,那么从列表中移除该用户。 + +``` +# cat user-list.txt +centos +magi +daygeek +thanu +renu +``` + +创建以下小 shell 脚本来实现此目的。 + +``` +# vi password-update.sh + +#!/bin/sh +for user in `more user-list.txt` +do +echo "[email protected]" | passwd --stdin "$user" +chage -d 0 $user +done +``` + +给 `password-update.sh` 文件设置可执行权限。 + +``` +# chmod +x password-update.sh +``` + +最后运行脚本来实现这一目标。 + +``` +# ./password-up.sh + +magi +Changing password for user magi. +passwd: all authentication tokens updated successfully. +daygeek +Changing password for user daygeek. +passwd: all authentication tokens updated successfully. +thanu +Changing password for user thanu. +passwd: all authentication tokens updated successfully. +renu +Changing password for user renu. +passwd: all authentication tokens updated successfully. +``` + +### 方法-4: 如何为多个用户设置相同的密码 + +如果要在 Linux 中为多个用户设置,更新或更改相同的密码,使用以下脚本。 + +``` +# vi password-update.sh + +#!/bin/sh +for user in `more user-list.txt` +do +echo "new_password" | passwd --stdin "$user" +chage -d 0 $user +done +``` + +### 方法-5: 如何在多个服务器中更改用户密码 + +如果希望更改多个服务器中的用户密码,使用以下脚本。在本例中,我们将更改 `renu` 用户的密码,确保你必须提供你希望更新密码的用户名而不是我们的用户名。 + +确保你必须将服务器列表保存在 `server-list.txt` 文件中,每个服务器应该在单独一行中。 + +``` +# vi password-update.sh + +#!/bin/bash +for server in `cat server-list.txt` +do +ssh [email protected]$server 'passwd --stdin renu < Date: Sat, 2 Feb 2019 15:40:17 +0800 Subject: [PATCH 0923/4278] translated --- ...ew text files at the Linux command line.md | 92 ------------------ ...ew text files at the Linux command line.md | 95 +++++++++++++++++++ 2 files changed, 95 insertions(+), 92 deletions(-) delete mode 100644 sources/tech/20190128 Using more to view text files at the Linux command line.md create mode 100644 translated/tech/20190128 Using more to view text files at the Linux command line.md diff --git a/sources/tech/20190128 Using more to view text files at the Linux command line.md b/sources/tech/20190128 Using more to view text files at the Linux command line.md deleted file mode 100644 index bc7c9a3c8d..0000000000 --- a/sources/tech/20190128 Using more to view text files at the Linux command line.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( dianbanjiu ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: 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) - -Using more to view text files at the Linux command line -====== -Text files and Linux go hand in hand. Or so it seems. But how you view those text files depends on what tools you're comfortable with. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE) - -There are a number of utilities that enable you to view text files when you're at the command line. One of them is [**more**][1]. - -**more** is similar to another tool I wrote about called **[less][2]**. The main difference is that **more** only allows you to move forward in a file. - -While that may seem limiting, it has some useful features that are good to know about. Let's take a quick look at what **more** can do and how to use it. - -### The basics - -Let's say you have a text file and want to read it at the command line. Just open the terminal, pop into the directory that contains the file, and type this command: - -``` -more -``` - -For example, **more jekyll-article.md**. - -![](https://opensource.com/sites/default/files/uploads/more-viewing-file.png) - -Press the Spacebar on your keyboard to move through the file or press **q** to quit. - -If you want to search for some text in the file, press the **/** key followed by the word or term you want to find. For example, to find the phrase terminal, type: - -``` -/terminal -``` - -![](https://opensource.com/sites/default/files/uploads/more-searching.png) - -Search is case-sensitive. Typing Terminal isn't the same as typing terminal. - -### Using more with other utilities - -You can pipe text from other command line utilities into **more**. Why do that? Because sometimes the text that those tools spew out spans more than one page. - -To do that, type the command and any options, followed by the pipe symbol ( **|** ), followed by **more**. For example, let's say you have a directory that has a large number of files in it. You can use **more** with the **ls** command to get a full view of the contents of the directory: - -``` -ls | more -``` - -![](https://opensource.com/sites/default/files/uploads/more-with_ls_cmd.png) - -You can also use **more** with the **grep** command to find text in multiple files. In this example, I use **grep** to find the text productivity in multiple source files for my articles: - -``` -**grep ‘productivity’ core.md Dict.md lctt2014.md lctt2016.md lctt2018.md README.md | more** -``` - -![](https://opensource.com/sites/default/files/uploads/more-with_grep_cmd.png) - -Another utility you can combine with **more** is **ps** (which lists processes that are running on your system). Again, this comes in handy when there are a large number of processes running on your system and you need a view of all of them—for example, to find one that you need to kill. To do that, use this command: - -``` -ps -u scott | more -``` - -Note that you'd replace scott with your username. - -![](https://opensource.com/sites/default/files/uploads/more-with_ps_cmd.png) - -As I mentioned at the beginning of this article, **more** is easy to use. It's definitely not as flexible as its cousin **less** , but it can be useful to know. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/more-text-files-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://en.wikipedia.org/wiki/More_(command) -[2]: https://opensource.com/article/18/4/using-less-view-text-files-command-line 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 new file mode 100644 index 0000000000..f10ac248fc --- /dev/null +++ b/translated/tech/20190128 Using more to view text files at the Linux command line.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( dianbanjiu ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +在 Linux 命令行使用 more 查看文本文件 +====== +文本文件和 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]。 + +**more** 跟我之前另一篇文章里写到的工具 —— **[less][2]** 很相似。它们之间的主要不同点在于 **more** 只允许你向前查看文件。 + +尽管它能提供的功能看起来很有限,不过它依旧有很多有用的特性值得你去了解。下面让我们来快速浏览一下 **more** 可以做什么,以及如何使用它吧。 + +### 基础使用 + +假设你现在想在终端查看一个文本文件。只需打开一个终端,进入对应的目录,然后输入以下命令: + +```shell +$ more +``` + +例如, + +```shell +$ more jekyll-article.md +``` + +![](https://opensource.com/sites/default/files/uploads/more-viewing-file.png) + +使用空格键可以向下翻页,输入 **q** 可以退出。 + +如果你想在这个文件中搜索一些文本,输入 **/** 字符并在其后加上你想要查找的文字。例如你要查看的字段是 terminal,只需输入: + +``` +/terminal +``` + +![](https://opensource.com/sites/default/files/uploads/more-searching.png) + +搜索的内容是区分大小写的,所以输入 /terminal 跟 /Terminal 会出现不同的结果。 + +### 和其他实用工具组合使用 +你可以通过管道将其他命令行工具得到的文本传输到 **more**。你问为什么这样做?因为有时这些工具获取的文本会超过终端一页可以显示的限度。 + +想要做到这个,先输入你想要使用的完整命令,后面跟上管道符(**|**),管道符后跟 **more**。假设现在有一个有很多文件的目录。你就可以组合 **more** 跟 **ls** 命令完整查看这个目录当中的内容。 + +```shell +$ ls | more +``` + +![](https://opensource.com/sites/default/files/uploads/more-with_ls_cmd.png) + +你可以组合 **more** 和 **grep** 命令,从而实现在多个文件中找到指定的文本。下面是我在多篇文章的源文件中查找 productivity 的例子。 + +```shell +$ grep ‘productivity’ core.md Dict.md lctt2014.md lctt2016.md lctt2018.md README.md | more +``` + +![](https://opensource.com/sites/default/files/uploads/more-with_grep_cmd.png) + +另外一个可以和 **more** 组合的实用工具是 **ps**(列出你系统上正在运行的进程)。当你的系统上运行了很多的进程,你现在想要查看他们的时候,这个组合将会派上用场。例如你想找到一个你需要杀死的进程,只需输入下面的命令: + +```shell +$ ps -u scott | more +``` + +注意用你的用户名替换掉 scott。 + +![](https://opensource.com/sites/default/files/uploads/more-with_ps_cmd.png) + +就像我文章开篇提到的, **more** 很容易使用。尽管不如它的双胞胎兄弟 **less** 那般灵活,但是仍然值得了解一下。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/More_(command) +[2]: https://opensource.com/article/18/4/using-less-view-text-files-command-line From 4bab7ec7bbc3012efcf28a0f7fd99835667c17b3 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 15:52:20 +0800 Subject: [PATCH 0924/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190116=20Game?= =?UTF-8?q?Hub=20=E2=80=93=20An=20Unified=20Library=20To=20Put=20All=20Gam?= =?UTF-8?q?es=20Under=20One=20Roof=20sources/tech/20190116=20GameHub=20-?= =?UTF-8?q?=20An=20Unified=20Library=20To=20Put=20All=20Games=20Under=20On?= =?UTF-8?q?e=20Roof.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Library To Put All Games Under One Roof.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 sources/tech/20190116 GameHub - An Unified Library To Put All Games Under One Roof.md diff --git a/sources/tech/20190116 GameHub - An Unified Library To Put All Games Under One Roof.md b/sources/tech/20190116 GameHub - An Unified Library To Put All Games Under One Roof.md new file mode 100644 index 0000000000..bdaae74b43 --- /dev/null +++ b/sources/tech/20190116 GameHub - An Unified Library To Put All Games Under One Roof.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GameHub – An Unified Library To Put All Games Under One Roof) +[#]: via: (https://www.ostechnix.com/gamehub-an-unified-library-to-put-all-games-under-one-roof/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +GameHub – An Unified Library To Put All Games Under One Roof +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/gamehub-720x340.png) + +**GameHub** is an unified gaming library that allows you to view, install, run and remove games on GNU/Linux operating system. It supports both native and non-native games from various sources including Steam, GOG, Humble Bundle, and Humble Trove etc. The non-native games are supported by [Wine][1], Proton, [DOSBox][2], ScummVM and RetroArch. It also allows you to add custom emulators and download bonus content and DLCs for GOG games. Simply put, Gamehub is a frontend for Steam/GoG/Humblebundle/Retroarch. It can use steam technologies like Proton to run windows gog games. GameHub is free, open source gaming platform written in **Vala** using **GTK+3**. If you’re looking for a way to manage all games under one roof, GameHub might be a good choice. + +### Installing GameHub + +The author of GameHub has designed it specifically for elementary OS. So, you can install it on Debian, Ubuntu, elementary OS and other Ubuntu-derivatives using GameHub PPA. + +``` +$ sudo apt install --no-install-recommends software-properties-common +$ sudo add-apt-repository ppa:tkashkin/gamehub +$ sudo apt update +$ sudo apt install com.github.tkashkin.gamehub +``` + +GameHub is available in [**AUR**][3], so just install it on Arch Linux and its variants using any AUR helpers, for example [**YaY**][4]. + +``` +$ yay -S gamehub-git +``` + +It is also available as **AppImage** and **Flatpak** packages in [**releases page**][5]. + +If you prefer AppImage package, do the following: + +``` +$ wget https://github.com/tkashkin/GameHub/releases/download/0.12.1-91-dev/GameHub-bionic-0.12.1-91-dev-cd55bb5-x86_64.AppImage -O gamehub +``` + +Make it executable: + +``` +$ chmod +x gamehub +``` + +And, run GameHub using command: + +``` +$ ./gamehub +``` + +If you want to use Flatpak installer, run the following commands one by one. + +``` +$ git clone https://github.com/tkashkin/GameHub.git +$ cd GameHub +$ scripts/build.sh build_flatpak +``` + +### Put All Games Under One Roof + +Launch GameHub from menu or application launcher. At first launch, you will see the following welcome screen. + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/gamehub1.png) + +As you can see in the above screenshot, you need to login to the given sources namely Steam, GoG or Humble Bundle. If you don’t have Steam client on your Linux system, you need to install it first to access your steam account. For GoG and Humble bundle sources, click on the icon to log in to the respective source. + +Once you logged in to your account(s), all games from the all sources can be visible on GameHub dashboard. + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/gamehub2.png) + +You will see list of logged-in sources on the top left corner. To view the games from each source, just click on the respective icon. + +You can also switch between list view or grid view, sort the games by applying the filters and search games from the list in GameHub dashboard. + +#### Installing a game + +Click on the game of your choice from the list and click Install button. If the game is non-native, GameHub will automatically choose the compatibility layer (E.g Wine) that suits to run the game and install the selected game. As you see in the below screenshot, Indiana Jones game is not available for Linux platform. + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/gamehub3-1.png) + +If it is a native game (i.e supports Linux), simply press the Install button. + +![][7] + +If you don’t want to install the game, just hit the **Download** button to save it in your games directory. It is also possible to add locally installed games to GameHub using the **Import** option. + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/gamehub5.png) + +#### GameHub Settings + +GameHub Settings window can be launched by clicking on the four straight lines on top right corner. + +From Settings section, we can enable, disable and set various settings such as, + + * Switch between light/dark themes. + * Use Symbolic icons instead of colored icons for games. + * Switch to compact list. + * Enable/disable merging games from different sources. + * Enable/disable compatibility layers. + * Set games collection directory. The default directory for storing the collection is **$HOME/Games/_Collection**. + * Set games directories for each source. + * Add/remove emulators, + * And many. + + + +For more details, refer the project links given at the end of this guide. + +**Related read:** + +And, that’s all for now. Hope this helps. I will be soon here with another guide. Until then, stay tuned with OSTechNix. + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/gamehub-an-unified-library-to-put-all-games-under-one-roof/ + +作者:[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/run-windows-games-softwares-ubuntu-16-04/ +[2]: https://www.ostechnix.com/how-to-run-ms-dos-games-and-programs-in-linux/ +[3]: https://aur.archlinux.org/packages/gamehub-git/ +[4]: https://www.ostechnix.com/yay-found-yet-another-reliable-aur-helper/ +[5]: https://github.com/tkashkin/GameHub/releases +[6]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[7]: http://www.ostechnix.com/wp-content/uploads/2019/01/gamehub4.png From 1cc30c456ab96d30cbb5e0c6f972bede6e5df75f Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 15:56:04 +0800 Subject: [PATCH 0925/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190116=20Best?= =?UTF-8?q?=20Audio=20Editors=20For=20Linux=20sources/tech/20190116=20Best?= =?UTF-8?q?=20Audio=20Editors=20For=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190116 Best Audio Editors For Linux.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20190116 Best Audio Editors For Linux.md diff --git a/sources/tech/20190116 Best Audio Editors For Linux.md b/sources/tech/20190116 Best Audio Editors For Linux.md new file mode 100644 index 0000000000..d588c886e2 --- /dev/null +++ b/sources/tech/20190116 Best Audio Editors For Linux.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best Audio Editors For Linux) +[#]: via: (https://itsfoss.com/best-audio-editors-linux) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Best Audio Editors For Linux +====== + +You’ve got a lot of choices when it comes to audio editors for Linux. No matter whether you are a professional music producer or just learning to create awesome music, the audio editors will always come in handy. + +Well, for professional-grade usage, a [DAW][1] (Digital Audio Workstation) is always recommended. However, not everyone needs all the functionalities, so you should know about some of the most simple audio editors as well. + +In this article, we will talk about a couple of DAWs and basic audio editors which are available as **free and open source** solutions for Linux and (probably) for other operating systems. + +### Top Audio Editors for Linux + +![Best audio editors and DAW for Linux][2] + +We will not be focusing on all the functionalities that DAWs offer – but the basic audio editing capabilities. You may still consider this as the list of best DAW for Linux. + +**Installation instruction:** You will find all the mentioned audio editors or DAWs in your AppCenter or Software center. In case, you do not find them listed, please head to their official website for more information. + +#### 1\. Audacity + +![audacity audio editor][3] + +Audacity is one of the most basic yet a capable audio editor available for Linux. It is a free and open-source cross-platform tool. A lot of you must be already knowing about it. + +It has improved a lot when compared to the time when it started trending. I do recall that I utilized it to “try” making karaokes by removing the voice from an audio file. Well, you can still do it – but it depends. + +**Features:** + +It also supports plug-ins that include VST effects. Of course, you should not expect it to support VST Instruments. + + * Live audio recording through a microphone or a mixer + * Export/Import capability supporting multiple formats and multiple files at the same time + * Plugin support: LADSPA, LV2, Nyquist, VST and Audio Unit effect plug-ins + * Easy editing with cut, paste, delete and copy functions. + * Spectogram view mode for analyzing frequencies + + + +#### 2\. LMMS + +![][4] + +LMMS is a free and open source (cross-platform) digital audio workstation. It includes all the basic audio editing functionalities along with a lot of advanced features. + +You can mix sounds, arrange them, or create them using VST instruments. It does support them. Also, it comes baked in with some samples, presets, VST Instruments, and effects to get started. In addition, you also get a spectrum analyzer for some advanced audio editing. + +**Features:** + + * Note playback via MIDI + * VST Instrument support + * Native multi-sample support + * Built-in compressor, limiter, delay, reverb, distortion and bass enhancer + + + +#### 3\. Ardour + +![Ardour audio editor][5] + +Ardour is yet another free and open source digital audio workstation. If you have an audio interface, Ardour will support it. Of course, you can add unlimited multichannel tracks. The multichannel tracks can also be routed to different mixer tapes for the ease of editing and recording. + +You can also import a video to it and edit the audio to export the whole thing. It comes with a lot of built-in plugins and supports VST plugins as well. + +**Features:** + + * Non-linear editing + * Vertical window stacking for easy navigation + * Strip silence, push-pull trimming, Rhythm Ferret for transient and note onset-based editing + + + +#### 4\. Cecilia + +![cecilia audio editor][6] + +Cecilia is not an ordinary audio editor application. It is meant to be used by sound designers or if you are just in the process of becoming one. It is technically an audio signal processing environment. It lets you create ear-bending sound out of them. + +You get in-build modules and plugins for sound effects and synthesis. It is tailored for a specific use – if that is what you were looking for – look no further! + +**Features:** + + * Modules to achieve more (UltimateGrainer – A state-of-the-art granulation processing, RandomAccumulator – Variable speed recording accumulator, +UpDistoRes – Distortion with upsampling and resonant lowpass filter) + * Automatic Saving of modulations + + + +#### 5\. Mixxx + +![Mixxx audio DJ ][7] + +If you want to mix and record something while being able to have a virtual DJ tool, [Mixxx][8] would be a perfect tool. You get to know the BPM, key, and utilize the master sync feature to match the tempo and beats of a song. Also, do not forget that it is yet another free and open source application for Linux! + +It supports custom DJ equipment as well. So, if you have one or a MIDI – you can record your live mixes using this tool. + +**Features** + + * Broadcast and record DJ Mixes of your song + * Ability to connect your equipment and perform live + * Key detection and BPM detection + + + +#### 6\. Rosegarden + +![rosegarden audio editor][9] + +Rosegarden is yet another impressive audio editor for Linux which is free and open source. It is neither a fully featured DAW nor a basic audio editing tool. It is a mixture of both with some scaled down functionalities. + +I wouldn’t recommend this for professionals but if you have a home studio or just want to experiment, this would be one of the best audio editors for Linux to have installed. + +**Features:** + + * Music notation editing + * Recording, Mixing, and samples + + + +### Wrapping Up + +These are some of the best audio editors you could find out there for Linux. No matter whether you need a DAW, a cut-paste editing tool, or a basic mixing/recording audio editor, the above-mentioned tools should help you out. + +Did we miss any of your favorite? Let us know about it in the comments below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-audio-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/Digital_audio_workstation +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors-800x450.jpeg?resize=800%2C450&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/audacity-audio-editor.jpg?fit=800%2C591&ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/lmms-daw.jpg?fit=800%2C472&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/ardour-audio-editor.jpg?fit=800%2C639&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/cecilia.jpg?fit=800%2C510&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/mixxx.jpg?fit=800%2C486&ssl=1 +[8]: https://itsfoss.com/dj-mixxx-2/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/rosegarden.jpg?fit=800%2C391&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors.jpeg?fit=800%2C450&ssl=1 From 9d1c96e0bee5a42498bded345444dc6c5a1c85ae Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 15:59:35 +0800 Subject: [PATCH 0926/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190116=20The?= =?UTF-8?q?=20Evil-Twin=20Framework:=20A=20tool=20for=20improving=20WiFi?= =?UTF-8?q?=20security=20sources/tech/20190116=20The=20Evil-Twin=20Framewo?= =?UTF-8?q?rk-=20A=20tool=20for=20improving=20WiFi=20security.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ork- A tool for improving WiFi security.md | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..81b5d2ddf1 --- /dev/null +++ b/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From d7137e469a0dfba9cf469203f390e751cdd9fab0 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 16:01:06 +0800 Subject: [PATCH 0927/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190115=20Gett?= =?UTF-8?q?ing=20started=20with=20Sandstorm,=20an=20open=20source=20web=20?= =?UTF-8?q?app=20platform=20sources/tech/20190115=20Getting=20started=20wi?= =?UTF-8?q?th=20Sandstorm,=20an=20open=20source=20web=20app=20platform.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dstorm, an open source web app platform.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..4b88a648f7 --- /dev/null +++ b/sources/tech/20190115 Getting started with Sandstorm, an open source web app platform.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 36ea275158f6146e63256dc9602d651fd16ad8d9 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 16:02:36 +0800 Subject: [PATCH 0928/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190115=20What?= =?UTF-8?q?=20happens=20when=20a=20veteran=20teacher=20goes=20to=20an=20op?= =?UTF-8?q?en=20source=20conference=20sources/talk/20190115=20What=20happe?= =?UTF-8?q?ns=20when=20a=20veteran=20teacher=20goes=20to=20an=20open=20sou?= =?UTF-8?q?rce=20conference.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...acher goes to an open source conference.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/talk/20190115 What happens when a veteran teacher goes to an open source conference.md diff --git a/sources/talk/20190115 What happens when a veteran teacher goes to an open source conference.md b/sources/talk/20190115 What happens when a veteran teacher goes to an open source conference.md new file mode 100644 index 0000000000..e16505c36c --- /dev/null +++ b/sources/talk/20190115 What happens when a veteran teacher goes to an open source conference.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What happens when a veteran teacher goes to an open source conference) +[#]: via: (https://opensource.com/open-organization/19/1/educator-at-open-source-conference) +[#]: author: (Ben Owens https://opensource.com/users/engineerteacher) + +What happens when a veteran teacher goes to an open source conference +====== +Sometimes feeling like a fish out of water is precisely what educators need. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4) + +"Change is going to be continual, and today is the slowest day society will ever move."—[Tony Fadell][1] + +If ever there was an experience that brought the above quotation home for me, it was my experience at the [All Things Open conference][2] in Raleigh, NC last October. Thousands of people from all over the world attended the conference, and many (if not most), worked as open source coders and developers. As one of the relatively few educators in attendance, I saw and heard things that were completely foreign to me—terms like as Istio, Stack Overflow, Ubuntu, Sidecar, HyperLedger, and Kubernetes tossed around for days. + +I felt like a fish out of water. But in the end, that was the perfect dose of reality I needed to truly understand how open principles can reshape our approach to education. + +### Not-so-strange attractors + +All Things Open attracted me to Raleigh for two reasons, both of which have to do with how our schools must do a better job of creating environments that truly prepare students for a rapidly changing world. + +The first is my belief that schools should embrace the ideals of the [open source way][3]. The second is that educators have to periodically force themselves out of their relatively isolated worlds of "doing school" in order to get a glimpse of what the world is actually doing. + +When I was an engineer for 20 years, I developed a deep sense of the power of an open exchange of ideas, of collaboration, and of the need for rapid prototyping of innovations. Although we didn't call these ideas "open source" at the time, my colleagues and I constantly worked together to identify and solve problems using tools such as [Design Thinking][4] so that our businesses remained competitive and met market demands. When I became a science and math teacher at a small [public school][5] in rural Appalachia, my goal was to adapt these ideas to my classrooms and to the school at large as a way to blur the lines between a traditional school environment and what routinely happens in the "real world." + +Through several years of hard work and many iterations, my fellow teachers and I were eventually able to develop a comprehensive, school-wide project-based learning model, where students worked in collaborative teams on projects that [made real connections][6] between required curriculum and community-based applications. Doing so gave these students the ability to develop skills they can use for a lifetime, rather than just on the next test—skills such as problem solving, critical thinking, oral and written communication, perseverance through setbacks, and adapting to changing conditions, as well as how to have routine conversations with adult mentors form the community. Only after reading [The Open Organization][7] did I realize that what we had been doing essentially embodied what Jim Whitehurst had described. In our case, of course, we applied open principles to an educational context (that model, called Open Way Learning, is the subject of a [book][8] published in December). + +I felt like a fish out of water. But in the end, that was the perfect dose of reality I needed to truly understand how open principles can reshape our approach to education. + +As good as this model is in terms of pushing students into a relevant, engaging, and often unpredictable learning environments, it can only go so far if we, as educators who facilitate this type of project-based learning, do not constantly stay abreast of changing technologies and their respective lexicon. Even this unconventional but proven approach will still leave students ill-prepared for a global, innovation economy if we aren't constantly pushing ourselves into areas outside our own comfort zones. My experience at the All Things Open conference was a perfect example. While humbling, it also forced me to confront what I didn't know so that I can learn from it to help the work I do with other teachers and schools. + +### A critical decision + +I made this point to others when I shared a picture of the All Things Open job board with dozens of colleagues all over the country. I shared it with the caption: "What did you do in your school today to prepare your students for this reality tomorrow?" The honest answer from many was, unfortunately, "not much." That has to change. + +![](https://opensource.com/sites/default/files/images/open-org/owens_1.jpg) +![](https://opensource.com/sites/default/files/images/open-org/owens_2.jpg) +(Images courtesy of Ben Owens, CC BY-SA) + +People in organizations everywhere have to make a critical decision: either embrace the rapid pace of change that is a fact of life in our world or face the hard reality of irrelevance. Our systems in education are at this same crossroads—even ones who think of themselves as being innovative. It involves admitting to students, "I don't know, but I'm willing to learn." That's the kind of teaching and learning experience our students deserve. + +It can happen, but it will take pioneering educators who are willing to move away from comfortable, back-of-the-book answers to help students as they work on difficult and messy challenges. You may very well be a veritable fish out of water. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/1/educator-at-open-source-conference + +作者:[Ben Owens][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/engineerteacher +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Tony_Fadell +[2]: https://allthingsopen.org/ +[3]: https://opensource.com/open-source-way +[4]: https://dschool.stanford.edu/resources-collections/a-virtual-crash-course-in-design-thinking +[5]: https://www.tricountyearlycollege.org/ +[6]: https://www.bie.org/about/what_pbl +[7]: https://www.redhat.com/en/explore/the-open-organization-book +[8]: https://www.amazon.com/Open-Up-Education-Learning-Transform/dp/1475842007/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=&sr= From b7e9f2c0150af57e5cc97909668416b24b8d8419 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 16:05:57 +0800 Subject: [PATCH 0929/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190104=20Take?= =?UTF-8?q?=20to=20the=20virtual=20skies=20with=20FlightGear=20sources/tec?= =?UTF-8?q?h/20190104=20Take=20to=20the=20virtual=20skies=20with=20FlightG?= =?UTF-8?q?ear.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ke to the virtual skies with FlightGear.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20190104 Take to the virtual skies with FlightGear.md diff --git a/sources/tech/20190104 Take to the virtual skies with FlightGear.md b/sources/tech/20190104 Take to the virtual skies with FlightGear.md new file mode 100644 index 0000000000..c3793e4128 --- /dev/null +++ b/sources/tech/20190104 Take to the virtual skies with FlightGear.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Take to the virtual skies with FlightGear) +[#]: via: (https://opensource.com/article/19/1/flightgear) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Take to the virtual skies with FlightGear +====== +Dreaming of piloting a plane? Try open source flight simulator FlightGear. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/flightgear_cockpit_plane_sky.jpg?itok=LRy0lpOS) + +If you've ever dreamed of piloting a plane, you'll love [FlightGear][1]. It's a full-featured, [open source][2] flight simulator that runs on Linux, MacOS, and Windows. + +The FlightGear project began in 1996 due to dissatisfaction with commercial flight simulation programs, which were not scalable. Its goal was to create a sophisticated, robust, extensible, and open flight simulator framework for use in academia and pilot training or by anyone who wants to play with a flight simulation scenario. + +### Getting started + +FlightGear's hardware requirements are fairly modest, including an accelerated 3D video card that supports OpenGL for smooth framerates. It runs well on my Linux laptop with an i5 processor and only 4GB of RAM. Its documentation includes an [online manual][3]; a [wiki][4] with portals for [users][5] and [developers][6]; and extensive tutorials (such as one for its default aircraft, the [Cessna 172p][7]) to teach you how to operate it. + +It's easy to install on both [Fedora][8] and [Ubuntu][9] Linux. Fedora users can consult the [Fedora installation page][10] to get FlightGear running. + +On Ubuntu 18.04, I had to install a repository: + +``` +$ sudo add-apt-repository ppa:saiarcot895/flightgear +$ sudo apt-get update +$ sudo apt-get install flightgear +``` + +Once the installation finished, I launched it from the GUI, but you can also launch the application from a terminal by entering: + +``` +$ fgfs +``` + +### Configuring FlightGear + +The menu on the left side of the application window provides configuration options. + +![](https://opensource.com/sites/default/files/uploads/flightgear_menu.png) + +**Summary** returns you to the application's home screen. + +**Aircraft** shows the aircraft you have installed and offers the option to install up to 539 other aircraft available in FlightGear's default "hangar." I installed a Cessna 150L, a Piper J-3 Cub, and a Bombardier CRJ-700. Some of the aircraft (including the CRJ-700) have tutorials to teach you how to fly a commercial jet; I found the tutorials informative and accurate. + +![](https://opensource.com/sites/default/files/uploads/flightgear_aircraft.png) + +To select an aircraft to pilot, highlight it and click on **Fly!** at the bottom of the menu. I chose the default Cessna 172p and found the cockpit depiction extremely accurate. + +![](https://opensource.com/sites/default/files/uploads/flightgear_cockpit-view.png) + +The default airport is Honolulu, but you can change it in the **Location** menu by providing your favorite airport's [ICAO airport code][11] identifier. I found some small, local, non-towered airports like Olean and Dunkirk, New York, as well as larger airports including Buffalo, O'Hare, and Raleigh—and could even choose a specific runway. + +Under **Environment** , you can adjust the time of day, the season, and the weather. The simulation includes advance weather modeling and the ability to download current weather from [NOAA][12]. + +**Settings** provides an option to start the simulation in Paused mode by default. Also in Settings, you can select multi-player mode, which allows you to "fly" with other players on FlightGear supporters' global network of servers that allow for multiple users. You must have a moderately fast internet connection to support this functionality. + +The **Add-ons** menu allows you to download aircraft and additional scenery. + +### Take flight + +To "fly" my Cessna, I used a Logitech joystick that worked well. You can calibrate your joystick using an option in the **File** menu at the top. + +Overall, I found the simulation very accurate and think the graphics are great. Try FlightGear yourself — I think you will find it a very fun and complete simulation package. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/flightgear + +作者:[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]: http://home.flightgear.org/ +[2]: http://wiki.flightgear.org/GNU_General_Public_License +[3]: http://flightgear.sourceforge.net/getstart-en/getstart-en.html +[4]: http://wiki.flightgear.org/FlightGear_Wiki +[5]: http://wiki.flightgear.org/Portal:User +[6]: http://wiki.flightgear.org/Portal:Developer +[7]: http://wiki.flightgear.org/Cessna_172P +[8]: http://rpmfind.net/linux/rpm2html/search.php?query=flightgear +[9]: https://launchpad.net/~saiarcot895/+archive/ubuntu/flightgear +[10]: https://apps.fedoraproject.org/packages/FlightGear/ +[11]: https://en.wikipedia.org/wiki/ICAO_airport_code +[12]: https://www.noaa.gov/ From 248544db327a0eb78fe0df6e1ace711e1516711d Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 16:08:59 +0800 Subject: [PATCH 0930/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190104=20Mido?= =?UTF-8?q?ri:=20A=20Lightweight=20Open=20Source=20Web=20Browser=20sources?= =?UTF-8?q?/tech/20190104=20Midori-=20A=20Lightweight=20Open=20Source=20We?= =?UTF-8?q?b=20Browser.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...- A Lightweight Open Source Web Browser.md | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..a2e31daf6c --- /dev/null +++ b/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 180b88a01072d7e45202c6e727339335ee127259 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 16:11:31 +0800 Subject: [PATCH 0931/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190103=20How?= =?UTF-8?q?=20to=20use=20Magit=20to=20manage=20Git=20projects=20sources/te?= =?UTF-8?q?ch/20190103=20How=20to=20use=20Magit=20to=20manage=20Git=20proj?= =?UTF-8?q?ects.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...How to use Magit to manage Git projects.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20190103 How to use Magit to manage Git projects.md 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 new file mode 100644 index 0000000000..dbcb63d736 --- /dev/null +++ b/sources/tech/20190103 How to use Magit to manage Git projects.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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) + +How to use Magit to manage Git projects +====== +Emacs' Magit extension makes it easy to get started with Git version control. +![](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] is an excellent [version control][2] tool for managing projects, but it can be hard for novices to learn. It's difficult to work from the Git command line unless you're familiar with the flags and options and the appropriate situations to use them. This can be discouraging and cause people to be stuck with very limited usage. + +Fortunately, most of today's integrated development environments (IDEs) include Git extensions that make using it a lot easier. One such Git extension available in Emacs is called [Magit][3]. + +The Magit project has been around for 10 years and defines itself as "a Git porcelain inside Emacs." In other words, it's an interface where every action can be managed by pressing a key. This article walks you through the Magit interface and explains how to use it to manage a Git project. + +If you haven't already, [install Emacs][4], then [install Magit][5] before you continue with this tutorial. + +### Magit's interface + +Start by visiting a project directory in Emacs' [Dired mode][6]. For example, all my Emacs configurations are stored in the **~/.emacs.d/** directory, which is managed by Git. + +![](https://opensource.com/sites/default/files/uploads/visiting_a_git_project.png) + +If you were working from the command line, you would enter **git status** to find a project's current status. Magit has a similar function: **magit-status**. You can call this function using **M-x magit-status** (short for the keystroke **Alt+x magit-status** ). Your result will look something like this: + +![](https://opensource.com/sites/default/files/uploads/magit_status.png) + +Magit shows much more information than you would get from the **git status** command. It shows a list of untracked files, files that aren't staged, and staged files. It also shows the stash list and the most recent commits—all in a single window. + +If you want to know what has changed, use the Tab key. For example, if I move my cursor over the unstaged file **custom_functions.org** and press the Tab key, Magit will display the changes: + +![](https://opensource.com/sites/default/files/uploads/show_unstaged_content.png) + +This is similar to using the command **git diff custom_functions.org**. Staging a file is even easier. Simply move the cursor over a file and press the **s** key. The file will be quickly moved to the staged file list: + +![](https://opensource.com/sites/default/files/uploads/staging_a_file.png) + +To unstage a file, use the **u** key. It is quicker and more fun to use **s** and **u** instead of entering **git add -u ** and **git reset HEAD ** on the command line. + +### Commit changes + +In the same Magit window, pressing the **c** key will display a commit window that provides flags like **\--all** to stage all files or **\--signoff** to add a signoff line to a commit message. + +![](https://opensource.com/sites/default/files/uploads/magit_commit_popup.png) + +Move your cursor to the line where you want to enable a signoff flag and press Enter. This will highlight the **\--signoff** text, which indicates that the flag is enabled. + +![](https://opensource.com/sites/default/files/uploads/magit_signoff_commit.png) + +Pressing **c** again will display the window to write the commit message. + +![](https://opensource.com/sites/default/files/uploads/magit_commit_message.png) + +Finally, use **C-c C-c **(short form of the keys Ctrl+cc) to commit the changes. + +![](https://opensource.com/sites/default/files/uploads/magit_commit_message_2.png) + +### Push changes + +Once the changes are committed, the commit line will appear in the **Recent commits** section. + +![](https://opensource.com/sites/default/files/uploads/magit_commit_log.png) + +Place the cursor on that commit and press **p** to push the changes. + +I've uploaded a [demonstration][7] on YouTube if you want to get a feel for using Magit. I have just scratched the surface in this article. It has many cool features to help you with Git branches, rebasing, and more. You can find [documentation, support, and more][8] linked from Magit's homepage. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/how-use-magit + +作者:[Sachin Patil][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/psachin +[b]: https://github.com/lujun9972 +[1]: https://git-scm.com +[2]: https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control +[3]: https://magit.vc +[4]: https://www.gnu.org/software/emacs/download.html +[5]: https://magit.vc/manual/magit/Installing-from-Melpa.html#Installing-from-Melpa +[6]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired-Enter.html#Dired-Enter +[7]: https://youtu.be/Vvw75Pqp7Mc +[8]: https://magit.vc/ From f131af334417056b593e64209caeb5343dbbd4be Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 2 Feb 2019 16:15:14 +0800 Subject: [PATCH 0932/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020181224=20Go?= =?UTF-8?q?=20on=20an=20adventure=20in=20your=20Linux=20terminal=20sources?= =?UTF-8?q?/tech/20181224=20Go=20on=20an=20adventure=20in=20your=20Linux?= =?UTF-8?q?=20terminal.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... on an adventure in your Linux terminal.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..f1b46340bb --- /dev/null +++ b/sources/tech/20181224 Go on an adventure in your Linux terminal.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 860dca821e58e10afe44eba1de279948e44d074d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 2 Feb 2019 20:26:50 +0800 Subject: [PATCH 0933/4278] Translated --- ... Way To Manage Disk Partitions In Linux.md | 166 ++++++++---------- 1 file changed, 70 insertions(+), 96 deletions(-) rename {sources => translated}/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md (63%) diff --git a/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md b/translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md similarity index 63% rename from sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md rename to translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md index 85a7dfb885..a165dbbdd0 100644 --- a/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md +++ b/translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md @@ -7,70 +7,49 @@ [#]: via: (https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -fdisk – Easy Way To Manage Disk Partitions In Linux +fdisk – Linux 下管理磁盘分区的利器 ====== -Hard disks can be divided into one or more logical disks called partitions. +一块硬盘可以被划分成一个或多个逻辑磁盘,我们将其称作分区。我们对硬盘进行的划分信息被储存于建立在扇区 0 的分区表(MBR 或 GPT)中。 -This division is described in the partition table (MBR or GPT) found in sector 0 of the disk. +Linux 需要至少一个分区来当作 root 文件系统,所以我们不能在没有分区的情况下安装 Linux 系统。当我们创建一个分区时,我们必须将它格式化为一个适合的文件系统,否则我们就没办法往里面储存文件了。 -Linux needs at least one partition, namely for its root file system and we can’t install Linux OS without partitions. +要在 Linux 中完成分区的相关工作,我们需要一些工具。Linux 下有很多可用的相关工具,我们曾介绍过 **[Parted 命令][1]**。不过,今天我们的主角是 fdisk。 -Once created, a partition must be formatted with an appropriate file system before files can be written to it. +人人都喜欢用 fdisk,它是 Linux 下管理磁盘分区的最佳利器之一。它可以操作最大 `2TB` 的分区。大量 Linux 管理员都喜欢使用这个工具,因为当下 LVM 和 SAN 的原因,并没有多少人会用到 2TB 以上的分区。并且这个工具被世界上许多的基础设施所使用。如果你还是想创建比 2TB 更大的分区,请使用 **Parted 命令** 或 **cfdisk 命令**。 -To do so, we need some utility to perform this in Linux. +对磁盘进行分区和创建文件系统是 Linux 管理员的日常。如果你在许多不同的环境中工作,你一定每天都会重复几次这项操作。 -There are many utilities are available for that in Linux. We had written about **[Parted Command][1]** in the past and today we are going to discuss about fdisk. +### Linux 内核是如何理解硬盘的? -fdisk command is one of the the best tool to manage disk partitions in Linux. +作为人类,我们可以很轻松地理解一些事情;但是电脑就不是这样了,它们需要合适的命名交流才能理解事情。 -It supports maximum `2 TB`, and everyone prefer to go with fdisk. +在 Linux 中,外围设备都位于 `/dev` 挂载点,内核以一下的方式理解硬盘: -This tool is used by vast of Linux admin because we don’t use more than 2TB now a days due to LVM and SAN. It’s used in most of the infra structure around the world. + * **`/dev/hdX[a-z]:`** IDE 硬盘被命名为 hdX + * **`/dev/sdX[a-z]:`** SCSI 硬盘被命名为 sdX + * **`/dev/xdX[a-z]:`** XT 硬盘被命名为 xdX + * **`/dev/vdX[a-z]:`** 虚拟硬盘被命名为 vdX + * **`/dev/fdN:`** 软盘被命名为 fdN + * **`/dev/scdN or /dev/srN:`** CD-ROM 被命名为 /dev/scdN 或 /dev/srN -Still if you want to create a large partitions, like more than 2TB then you have to go either **Parted Command** or **cfdisk Command**. +### 什么是 fdisk 命令? -Disk partition and file system creations is one of the routine task for Linux admin. +fdisk 的意思是 固定的磁盘Fixed Disk格式化磁盘Format Disk,它是命令行下允许用户对分区进行查看、创建、调整大小、删除、移动和复制的工具。它支持 MBR、Sun、SGI、BSD 分区表,但是它不支持 GUID 分区表(GPT)。它不是为操作大分区设计的。 -If you are working on vast environment then you have to perform this task multiple times in a day. +fdisk 允许我们在每块硬盘上创建最多四个主分区。它们中的其中一个可以作为扩展分区,并下设多个逻辑分区。1-4 扇区作为主分区被保留,逻辑分区从扇区 5 开始。 -### How Linux Kernel Understand Hard Disks? +![磁盘分区结构图][3] -As a human we can easily understand things but computer needs the proper naming conversion to understand each and everything. +### 如何在 Linux 下安装 fdisk? -In Linux, devices are located on `/dev` partition and Kernel understand the hard disk in the following format. +fdisk 作为核心组件内置于 Linux 中,所以你不必手动安装它。 - * **`/dev/hdX[a-z]:`** IDE Disk is named hdX in Linux - * **`/dev/sdX[a-z]:`** SCSI Disk is named sdX in Linux - * **`/dev/xdX[a-z]:`** XT Disk is named sdX in Linux - * **`/dev/vdX[a-z]:`** Virtual Hard Disk is named vdX in Linux - * **`/dev/fdN:`** Floppy Drive is named fdN in Linux - * **`/dev/scdN or /dev/srN:`** CD-ROM is named /dev/scdN or /dev/srN in Linux +### 如何用 fdisk 列出可用磁盘? +在执行操作之前,我们必须知道的是哪些磁盘被加入了系统。要想列出所有可用的磁盘,请执行下文的命令。这个命令将会列出磁盘名称、分区数量、分区表类型、磁盘识别代号、分区 ID 和分区类型。 - -### What Is fdisk Command? - -fdisk 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. - -It understands MBR, Sun, SGI and BSD partition tables and it doesn’t understand GUID Partition Table (GPT) and it is not designed for large partitions. - -fdisk allows us to create a maximum of four primary partitions per disk. One of these may be an extended partition and it holds multiple logical partitions. - -1-4 is reserved for four primary partitions and Logical partitions start numbering from 5. -![][3] - -### How To Install fdisk On Linux - -You don’t need to install fdisk in Linux system because it has installed by default as part of core utility. - -### How To List Available Disks Using fdisk Command - -First we have to know what are the disks were added in the system before performing any action. To list all available disks on your system run the following command. - -It lists possible information about the disks such as disk name, how many partitions are created in it, Disk Size, Disklabel type, Disk Identifier, Partition ID and Partition Type. - -``` +```shell $ sudo 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 @@ -107,11 +86,11 @@ Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes ``` -### How To List A Specific Disk Partitions Using fdisk Command +### 如何使用 fdisk 列出特定分区信息? -If you would like to see a specific disk and it’s partitions, use the following format. +如果你希望查看指定分区的信息,请使用以下命令: -``` +```shell $ sudo fdisk -l /dev/sda 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 @@ -124,11 +103,11 @@ 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 ``` -### How To List Available Actions For fdisk Command +### 如何列出 fdisk 所有的可用操作? -When you hit `m` in the fdisk command that will show you available actions for fdisk command. +在 fdisk 中敲击 `m`,它便会列出所有可用操作: -``` +```shell $ sudo fdisk /dev/sdc Welcome to fdisk (util-linux 2.30.1). @@ -177,11 +156,11 @@ Help: s create a new empty Sun partition table ``` -### How To List Partitions Types Using fdisk Command +### 如何使用 fdisk 列出分区类型? -When you hit `l` in the fdisk command that will show you an available partitions type for fdisk command. +在 fdisk 中敲击 `l`,它便会列出所有可用分区的类型: -``` +```shell $ sudo fdisk /dev/sdc Welcome to fdisk (util-linux 2.30.1). @@ -219,16 +198,13 @@ Command (m for help): l 1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep 1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT ``` +### 如何使用 fdisk 创建一个磁盘分区? -### How To Create A Disk Partition Using fdisk Command +如果你希望新建磁盘分区,请参考下面的步骤。比如我希望在 `/dev/sdc` 中新建四个分区(三个主分区和一个扩展分区),只需要执行下文的命令。 -If you would like to create a new partition use the following steps. In my case, i'm going to create 4 partitions (3 Primary and 1 Extended) on `/dev/sdc` disk. To the same for other partitions too. +首先,请在操作 “First sector” 的时候先按下 `Enter`,然后在 “Last sector” 中输入你希望创建分区的大小(可以在数字后面加 KB、MB、G 和 TB)。例如,你希望为这个分区扩容 1GB,就应该在 “Last sector” 中输入 `+1G`。当你创建三个分区之后,fdisk 默认会将分区类型设为扩展分区,如果你希望创建第四个主分区,请输入 `p` 来替代它的默认值 `e`。 -As this takes value from partition table so, hit `Enter` for first sector. Enter the size which you want to set for the partition (We can add a partition size using KB,MB,G and TB) for last sector. - -For example, if you would like to add 1GB partition then the last sector value should be `+1G`. Once you have created 3 partitions, it will automatically change the partition type to extended as a default. If you still want to create a fourth primary partitions then hit `p` instead of default value `e`. - -``` +```shell $ sudo fdisk /dev/sdc Welcome to fdisk (util-linux 2.30.1). @@ -266,11 +242,11 @@ Calling ioctl() to re-read partition table. Syncing disks. ``` -### How To Create A Extended Disk Partition Using fdisk Command +### 如何使用 fdisk 创建扩展分区? -Make a note, you have to use remaining all space when you create a extended partition because again you can able to create multiple logical partition in that. +请注意,创建扩展分区时,你应该使用剩下的所有空间,以便之后在扩展分区下创建逻辑分区。 -``` +```shell $ sudo fdisk /dev/sdc Welcome to fdisk (util-linux 2.30.1). @@ -311,13 +287,13 @@ Calling ioctl() to re-read partition table. Syncing disks. ``` -### How To View Unpartitioned Disk Space Using fdisk Command +### 如何用 fdisk 查看未分配空间? -As described in the above section, we have totally created 4 partitions (3 Primary and 1 Extended). Extended partition disk space will show unpartitioned until you create a logical partitions in that. +上文中,我们总共创建了四个分区(三个主分区和一个扩展分区)。在创建逻辑分区之前,扩展分区的容量将会以未分配空间显示。 -Use the following command to view the unpartitioned space for a disk. As per the below output we have `7GB` unpartitioned disk. +使用以下命令来显示磁盘上的未分配空间,下面的示例中显示的是 7GB: -``` +```shell $ sudo fdisk /dev/sdc Welcome to fdisk (util-linux 2.30.1). @@ -336,12 +312,11 @@ Sector size (logical/physical): 512 bytes / 512 bytes Command (m for help): q ``` -### How To Create A Logical Partition Using fdisk Command +### 如何使用 fdisk 创建逻辑分区? -Follow the same above procedure to create a logical partition once you have created the extended partition. -Here, i have created `1GB` of logical partition called `/dev/sdc5`, you can double confirm this by checking the partition table value. +创建扩展分区后,请按照之前的步骤创建逻辑分区。在这里,我创建了位于 `/dev/sdc5` 的 `1GB` 逻辑分区。你可以查看分区表值来确认这点。 -``` +```shell $ sudo fdisk /dev/sdc Welcome to fdisk (util-linux 2.30.1). @@ -377,13 +352,13 @@ Calling ioctl() to re-read partition table. Syncing disks. ``` -### How To Delete A Partition Using fdisk Command +### 如何使用 fdisk 命令删除分区? -If the partition is no more used in the system than we can remove it by using the below steps. +如果我们不再使用某个分区,请按照下面的步骤删除它。 -Make sure you have to enter the correct partition number to delete it. In this case, i'm going to remove `/dev/sdc2` partition. +请确保你输入了正确的分区号。在这里,我准备删除 `/dev/sdc2` 分区: -``` +```shell $ sudo fdisk /dev/sdc Welcome to fdisk (util-linux 2.30.1). @@ -416,13 +391,13 @@ Calling ioctl() to re-read partition table. Syncing disks. ``` -### How To Format A Partition Or Create A FileSystem On The Partition +### 如何在 Linux 下格式化分区或建立文件系统? -In computing, a file system or filesystem controls how data is stored and retrieved through inode tables. +在计算时,文件系统控制了数据的储存方式,并通过 索引节点Inode Tables 来检索数据。如果没有文件系统,操作系统是无法找到信息储存的位置的。 -Without a file system, the system can't find where the information is stored on the partition. Filesystem can be created in three ways. Here, i'm going to create a filesystem on `/dev/sdc1` partition. +在此,我准备在 `/dev/sdc1` 上创建分区。有三种方式创建文件系统: -``` +```shell $ sudo mkfs.ext4 /dev/sdc1 or $ sudo mkfs -t ext4 /dev/sdc1 @@ -441,34 +416,32 @@ Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done ``` -When you creating a filesystem on tha partition that will create the following important things on it. +当你在分区上建立文件系统时,以下重要信息会同时被创建: - * **`Filesystem UUID:`** UUID stands for Universally Unique Identifier, UUIDs are used to identify block devices in Linux. It's 128 bit long numbers represented by 32 hexadecimal digits. - * **`Superblock:`** Superblock stores metadata of the file system. If the superblock of a file system is corrupted, then the filesystem cannot be mounted and thus files cannot be accessed. - * **`Inode:`** An inode is a data structure on a filesystem on a Unix-like operating system that stores all the information about a file except its name and its actual data. - * **`Journal:`** A journaling filesystem is a filesystem that maintains a special file called a journal that is used to repair any inconsistencies that occur as the result of an improper shutdown of a computer. + * **`Filesystem UUID:`** UUID 代表了通用且独一无二的识别符,UUID 在 Linux 中通常用来识别设备。它 128 位长的数字代表了 32 个十六进制数。 + * **`Superblock:`** Superblock 储存了文件系统的元数据。如果某个文件系统的 Superblock 被破坏,我们就无法挂载它了(也就是说无法访问其中的文件了)。 + * **`Inode:`** Inode 是类 Unix 系统中文件系统的数据结构,它储存了所有除名称以外的文件信息和数据。 + * **`Journal:`** 日志式文件系统包含了用来修复电脑意外关机产生下错误信息的日志(Journal)。 -### How To Mount A Partition In Linux +### 如何在 Linux 中挂载分区? -Once you have created the partition and filesystem then we need to mount the partition to use. +在你创建完分区和文件系统之后,我们需要挂载它们以便使用。我们需要创建一个挂载点来挂载分区,使用 mkdir 来创建一个挂载点。 -To do so, we need to create a mountpoint to mount the partition. Use mkdir command to create a mountpoint. - -``` +```shell $ sudo mkdir -p /mnt/2g-new ``` -For temporary mount, use the following command. You will be lose this mountpoint after rebooting your system. +如果你希望进行临时挂载,请使用下面的命令。在计算机重启之后,你会丢失这个挂载点。 -``` +```shell $ sudo mount /dev/sdc1 /mnt/2g-new ``` -For permanent mount, add the partition details in the fstab file. It can be done in two ways either adding device name or UUID value. +如果你希望永久挂载某个分区,请将分区详情加入 fstab 文件。我们既可以输入设备名称,也可以输入 UUID。 -Permanent mount using Device Name: +使用设备名称来进行永久挂载: ``` # vi /etc/fstab @@ -477,6 +450,7 @@ Permanent mount using Device Name: ``` Permanent mount using UUID Value. To get a UUID of the partition use blkid command. +使用 UUID 来进行永久挂载(请使用 blkid 来获取 UUID): ``` $ sudo blkid @@ -490,7 +464,7 @@ $ sudo blkid UUID=d17e3c31-e2c9-4f11-809c-94a549bc43b7 /mnt/2g-new ext4 defaults 0 0 ``` -The same has been verified using df Command. +使用 df 命令亦可: ``` $ df -h @@ -512,7 +486,7 @@ via: https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zhs852](https://github.com/zhs852) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6bf9ed046a2b9a18776e8ccdfd46b21fb1b15b69 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Feb 2019 20:34:56 +0800 Subject: [PATCH 0934/4278] PRF:20190124 Understanding Angle Brackets in Bash.md @HankChow --- ...24 Understanding Angle Brackets in Bash.md | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190124 Understanding Angle Brackets in Bash.md b/translated/tech/20190124 Understanding Angle Brackets in Bash.md index 7e2ed95182..1ac6b79db7 100644 --- a/translated/tech/20190124 Understanding Angle Brackets in Bash.md +++ b/translated/tech/20190124 Understanding Angle Brackets in Bash.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Understanding Angle Brackets in Bash) @@ -10,9 +10,11 @@ 理解 Bash 中的尖括号 ====== +> 为初学者介绍尖括号。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/architecture-1839450_1920.jpg?itok=ra6XonD3) -[Bash][1] 内置了很多诸如 `ls`、`cd`、`mv` 这样的重要的命令,也有很多诸如 `grep`、`awk`、`sed` 这些有用的工具。但除此之外,其实 [Bash][1] 中还有很多可以[起到胶水作用][2]的标点符号,例如点号(`.`)、逗号(`,`)、括号(`<>`)、引号(`"`)之类。下面我们就来看一下可以用来进行数据转换和转移的尖括号()。 +[Bash][1] 内置了很多诸如 `ls`、`cd`、`mv` 这样的重要的命令,也有很多诸如 `grep`、`awk`、`sed` 这些有用的工具。但除此之外,其实 [Bash][1] 中还有很多可以[起到胶水作用][2]的标点符号,例如点号(`.`)、逗号(`,`)、括号(`<>`)、引号(`"`)之类。下面我们就来看一下可以用来进行数据转换和转移的尖括号(`<>`)。 ### 转移数据 @@ -24,7 +26,7 @@ ls > dir_content.txt ``` -在上面的例子中,`>` 符号让 shell 将 `ls` 命令的输出结果写入到 `dir_content.txt` 里,而不是直接显示在命令行中。需要注意的是,如果 `dir_content.txt` 这个文件不存在,Bash 会为你创建出来;但是如果 `dir_content.txt` 是一个已有得非空文件,它的内容就会被覆盖掉。所以执行类似的操作之前务必谨慎。 +在上面的例子中,`>` 符号让 shell 将 `ls` 命令的输出结果写入到 `dir_content.txt` 里,而不是直接显示在命令行中。需要注意的是,如果 `dir_content.txt` 这个文件不存在,Bash 会为你创建;但是如果 `dir_content.txt` 是一个已有的非空文件,它的内容就会被覆盖掉。所以执行类似的操作之前务必谨慎。 你也可以不使用 `>` 而使用 `>>`,这样就可以把新的数据追加到文件的末端而不会覆盖掉文件中已有的数据了。例如: @@ -32,7 +34,7 @@ ls > dir_content.txt ls $HOME > dir_content.txt; wc -l dir_content.txt >> dir_content.txt ``` -在这串命令里,首先将 home 目录的内容写入到 `dir_content.txt` 文件中,然后使用 `wc -l` 计算出 `dir_content.txt` 文件的行数(也就是 home 目录中的文件数)并追加到 `dir_content.txt` 的末尾。 +在这串命令里,首先将家目录的内容写入到 `dir_content.txt` 文件中,然后使用 `wc -l` 计算出 `dir_content.txt` 文件的行数(也就是家目录中的文件数)并追加到 `dir_content.txt` 的末尾。 在我的机器上执行上述命令之后,`dir_content.txt` 的内容会是以下这样: @@ -57,7 +59,8 @@ Videos 17 dir_content.txt ``` -你可以将 `>` 和 `>>` 作为箭头来理解。当然,这个箭头的指向也可以反过来。例如,Coen brothers 的一些演员以及他们出演电影的次数保存在 `CBActors` 文件中,就像这样: +你可以将 `>` 和 `>>` 作为箭头来理解。当然,这个箭头的指向也可以反过来。例如,Coen brothers +(LCTT 译注:科恩兄弟,一个美国电影导演组合)的一些演员以及他们出演电影的次数保存在 `CBActors` 文件中,就像这样: ``` John Goodman 5 @@ -84,7 +87,7 @@ Steve Buscemi 5 Tony Shalhoub 3 ``` -就可以使用 [`sort`][4] 命令将这个列表按照字母顺序输出。但是,`sort` 命令本来就可以接受传入一个文件,因此在这里使用 `<` 会略显多余,直接执行 `sort CBActors` 就可以得到期望的结果。 +就可以使用 [sort][4] 命令将这个列表按照字母顺序输出。但是,`sort` 命令本来就可以接受传入一个文件,因此在这里使用 `<` 会略显多余,直接执行 `sort CBActors` 就可以得到期望的结果。 如果你想知道 Coens 最喜欢的演员是谁,你可以这样操作。首先: @@ -103,8 +106,8 @@ while read name surname films;\ 下面来分析一下这些命令做了什么: - * [`while ...; do ... done`][5] 是一个循环结构。当 `while` 后面的条件成立时,`do` 和 `done` 之间的部分会一直重复执行; - * [`read`][6] 语句会按行读入内容。`read` 会从标准输入中持续读入,直到没有内容可读入; + * [while ...; do ... done][5] 是一个循环结构。当 `while` 后面的条件成立时,`do` 和 `done` 之间的部分会一直重复执行; + * [read][6] 语句会按行读入内容。`read` 会从标准输入中持续读入,直到没有内容可读入; * `CBActors` 文件的内容会通过 `<` 从标准输入中读入,因此 `while` 循环会将 `CBActors` 文件逐行完整读入; * `read` 命令可以按照空格将每一行内容划分为三个字段,然后分别将这三个字段赋值给 `name`、`surname` 和 `films` 三个变量,这样就可以很方便地通过 `echo $films $name $surname >> filmsfirst;\` 来重新排列几个字段的放置顺序并存放到 `filmfirst` 文件里面了。 @@ -136,7 +139,7 @@ via: https://www.linux.com/blog/learn/2019/1/understanding-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/) 荣誉推出 From a45ca7058de92b3cf419789277a2175e68399eb0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Feb 2019 20:35:50 +0800 Subject: [PATCH 0935/4278] PUB:20190124 Understanding Angle Brackets in Bash.md @HankChow https://linux.cn/article-10502-1.html --- .../20190124 Understanding Angle Brackets in Bash.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190124 Understanding Angle Brackets in Bash.md (98%) diff --git a/translated/tech/20190124 Understanding Angle Brackets in Bash.md b/published/20190124 Understanding Angle Brackets in Bash.md similarity index 98% rename from translated/tech/20190124 Understanding Angle Brackets in Bash.md rename to published/20190124 Understanding Angle Brackets in Bash.md index 1ac6b79db7..1c8f4ffe7c 100644 --- a/translated/tech/20190124 Understanding Angle Brackets in Bash.md +++ b/published/20190124 Understanding Angle Brackets in Bash.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10502-1.html) [#]: subject: (Understanding Angle Brackets in Bash) [#]: via: (https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash) [#]: author: (Paul Brown https://www.linux.com/users/bro66) From 3eff03e6f535ffcf63187ba6264d47c025b05ed8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Feb 2019 21:09:26 +0800 Subject: [PATCH 0936/4278] PRF:20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @geekpi --- ... And Hardware Monitoring Tool For Linux.md | 52 ++++++++----------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md index 9dd255cb67..d69b29540b 100644 --- a/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md +++ b/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @@ -1,77 +1,65 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Hegemon – A Modular System And Hardware Monitoring Tool For Linux) [#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Hegemon - 一个 Linux 中的模块化系统和硬件监控工具 +Hegemon:一个 Linux 的模块化系统和硬件监控工具 ====== -我知道每个人都更喜欢使用 **[top 命令][1]**来监控系统利用率。 +我知道每个人都更喜欢使用 [top 命令][1]来监控系统利用率。这是被 Linux 系统管理员大量使用的原生命令之一。 -这是被 Linux 系统管理员大量使用的原生命令之一。 +在 Linux 中,每个包都有一个替代品。Linux 中有许多可用于此的工具,我更喜欢 [htop 命令][2]。 -在 Linux 中,每个包都有一个替代品。 +如果你想了解其他替代方案,我建议你浏览每个链接了解更多信息。它们有 htop、CorFreq、glances、atop、Dstat、Gtop、Linux Dash、Netdata、Monit 等。 -Linux 中有许多可用于此的工具,我更喜欢 **[htop 命令][2]**。 +所有这些只允许我们监控系统利用率而不能监控系统硬件。但是 Hegemon 允许我们在单个仪表板中监控两者。 -如果你想了解其他替代方案,我建议你浏览每个链接了解更多信息。 - -它们有 htop、CorFreq、glances、atop、Dstat、Gtop、Linux Dash、Netdata、Monit 等。 - -所有这些只允许我们监控系统利用率而不能监控系统硬件。 - -但是 Hegemon 允许我们在单个仪表板中监控两者。 - -如果你正在寻找系统硬件监控软件,那么我建议你看下 **[lm_sensors][3]** 和 **[s-tui 压力终端 UI][4]**。 +如果你正在寻找系统硬件监控软件,那么我建议你看下 [lm_sensors][3] 和 [s-tui 压力终端 UI][4]。 ### Hegemon 是什么? -Hegemon 是一个正在开发中的模块化系统监视器, 以安全的 Rust 编写。 +Hegemon 是一个正在开发中的模块化系统监视器,以安全的 Rust 编写。 它允许用户在单个仪表板中监控两种使用情况。分别是系统利用率和硬件温度。 ### Hegemon 目前的特性 * 监控 CPU 和内存使用情况、温度和风扇速度 -  * 展开任何数据流以显示更详细的图表和其他信息 -  * 可调整的更新间隔 -  * 干净的 MVC 架构,具有良好的代码质量 -  * 单元测试 - - + * 展开任何数据流以显示更详细的图表和其他信息 + * 可调整的更新间隔 + * 干净的 MVC 架构,具有良好的代码质量 + * 单元测试 ### 计划的特性包括 * macOS 和 BSD 支持(目前仅支持 Linux) -  * 监控磁盘和网络 I/O、GPU使用情况(可能)等 +  * 监控磁盘和网络 I/O、GPU 使用情况(可能)等   * 选择并重新排序数据流   * 鼠标控制 - - ### 如何在 Linux 中安装 Hegemon? Hegemon 需要 Rust 1.26 或更高版本以及 libsensors 的开发文件。因此,请确保在安装 Hegemon 之前安装了这些软件包。 libsensors 库在大多数发行版官方仓库中都有,因此,使用以下命令进行安装。 -对于 **`Debian/Ubuntu`** 系统,使用 **[apt-get 命令][5]** 或 **[apt 命令][6]** 在你的系统上安装 libsensors。 +对于 Debian/Ubuntu 系统,使用 [apt-get 命令][5] 或 [apt 命令][6] 在你的系统上安装 libsensors。 ``` # apt install lm_sensors-devel ``` -对于 **`Fedora`** 系统,使用 **[dnf 包管理器][7]**在你的系统上安装 libsensors。 +对于 Fedora 系统,使用 [dnf 包管理器][7]在你的系统上安装 libsensors。 ``` # dnf install libsensors4-dev ``` -运行以下命令安装 Rust 语言,并按照指示来做。如果你想要看 **[Rust 安装][8]**的方便教程,请进入这个 URL。 +运行以下命令安装 Rust 语言,并按照指示来做。如果你想要看 [Rust 安装][8]的方便教程,请进入该 URL。 ``` $ curl https://sh.rustup.rs -sSf | sh @@ -93,7 +81,7 @@ $ hegemon ![][10] -由于 libsensors.so.4 库的问题,我在启动 “Hegemon” 时遇到了一个问题。 +由于 libsensors.so.4 库的问题,我在启动 Hegemon 时遇到了一个问题。 ``` $ hegemon @@ -107,9 +95,11 @@ $ sudo ln -s /usr/lib/libsensors.so /usr/lib/libsensors.so.4 ``` 这是从我的 Lenovo-Y700 笔记本中截取的示例 gif。 + ![][11] -默认它仅显示总体摘要,如果你想查看详细输出,则需要展开每个部分。使用 Hegemon 查看展开内容。 +默认它仅显示总体摘要,如果你想查看详细输出,则需要展开每个部分。如下是 Hegemon 的展开视图。 + ![][12] -------------------------------------------------------------------------------- @@ -119,7 +109,7 @@ via: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-t 作者:[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 6e3dbaa3723e2656ad1a89eb5f882b3ad95a4a81 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Feb 2019 21:09:56 +0800 Subject: [PATCH 0937/4278] PUB:20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @geekpi https://linux.cn/article-10503-1.html --- ...A Modular System And Hardware Monitoring Tool For Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md (98%) diff --git a/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/published/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md similarity index 98% rename from translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md rename to published/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md index d69b29540b..873ecb8cbb 100644 --- a/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md +++ b/published/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10503-1.html) [#]: subject: (Hegemon – A Modular System And Hardware Monitoring Tool For Linux) [#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From e1fe05495f6c99323e4e04b8e4908b46412e8ac2 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Sat, 2 Feb 2019 22:10:47 +0800 Subject: [PATCH 0938/4278] translating --- ...sy And Secure Way To Transfer Files Between Linux Systems.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md b/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md index b6499932ae..e91412745b 100644 --- a/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md +++ b/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a4351268fcfdeebc7d0fa3d895a32dd0958621db Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Sat, 2 Feb 2019 23:40:51 +0800 Subject: [PATCH 0939/4278] =?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 --- .../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 23b509a77b..2ccaeddeee 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: ( ) +[#]: translator: (wyxplus) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8a38bd6a6f7177fa771cfc7d4892c9ac870891e6 Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Sat, 2 Feb 2019 23:42:38 +0800 Subject: [PATCH 0940/4278] =?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 --- .../20190114 Remote Working Survival Guide.md | 130 ------------------ .../20190114 Remote Working Survival Guide.md | 129 +++++++++++++++++ 2 files changed, 129 insertions(+), 130 deletions(-) delete mode 100644 sources/talk/20190114 Remote Working Survival Guide.md create mode 100644 translated/talk/20190114 Remote Working Survival Guide.md diff --git a/sources/talk/20190114 Remote Working Survival Guide.md b/sources/talk/20190114 Remote Working Survival Guide.md deleted file mode 100644 index b21fd8f400..0000000000 --- a/sources/talk/20190114 Remote Working Survival Guide.md +++ /dev/null @@ -1,130 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (beamrolling) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: 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/) - -Remote Working Survival Guide -====== -![](https://www.jonobacon.com/wp-content/uploads/2019/01/5b5471d7eadb585ec8b8a0c3_featureimage-remotejob-1080x675.jpg) - -Remote working seems to be all the buzz. Apparently, [70% of professionals work from home at least once a week][1]. Similarly, [77% of people work more productively][2] and [68% of millennials would consider a company more if they offered remote working][3]. It seems to make sense: technology, connectivity, and culture seem to be setting the world up more and more for remote working. Oh, and home-brewed coffee is better than ever too. - -Now, I am going to write another piece for how companies should optimize for remote working (so make sure you [Join As a Member][4] to stay tuned — it is free). - -Today though I want to **share recommendations for how individuals can do remote working well themselves**. Whether you are a full-time remote worker or have the option of working from home a few days a week, this article should hopefully be helpful. - -Now, you need to know that **remote working is not a panacea**. Sure, it seems like hanging around at home in your jimjams, listening to your antisocial music, and sipping on buckets of coffee is perfect, but it isn’t for everyone. - -Some people need the structure of an office. Some people need the social element of an office. Some people need to get out the house. Some people lack the discipline to stay focused at home. Some people are avoiding the government coming and knocking on the door due to years of unpaid back taxes. - -**Remote working is like a muscle: it can bring enormous strength and capabilities IF you train and maintain it**. If you don’t, your results are going to vary. - -I have worked from home for the vast majority of my career. I love it. I am more productive, happier, and empowered when I work from home. I don’t dislike working in an office, and I enjoy the social element, but I am more in my “zone” when I work from home. I also love blisteringly heavy metal, which can pose a problem when the office don’t want to listen to [After The Burial][5]. - -![][6] -“Squirrel.” -[Credit][7] - -I have learned how I need to manage remote work, using the right balance of work routine, travel, and other elements, and here are some of my recommendations. Be sure to **share yours in the comments**. - -### 1\. You need discipline and routine (and to understand your “waves”) - -Remote work really is a muscle that needs to be trained. Just like building actual muscle, there needs to be a clear routine and a healthy dollop of discipline mixed in. - -Always get dressed (no jimjams). Set your start and end time for your day (I work 9am – 6pm most days). Choose your lunch break (mine is 12pm). Choose your morning ritual (mine is email followed by a full review of my client needs). Decide where your main workplace will be (mine is my home office). Decide when you will exercise each day (I do it at 5pm most days). - -**Design a realistic routine and do it for 66 days**. It takes this long to build a habit. Try not to deviate from the routine. The more you stick the routine, the less work it will seem further down the line. By the end of the 66 days it will feel natural and you won’t have to think about it. - -Here’s the deal though, we don’t live in a vacuum ([cleaner, or otherwise][8]). We all have waves. - -A wave is when you need a change of routine to mix things up. For example, in summertime I generally want more sunlight. I will often work outside in the garden. Near the holidays I get more distracted, so I need more structure in my day. Sometimes I just need more human contact, so I will work from coffee shops for a few weeks. Sometimes I just fancy working in the kitchen or on the couch. You need to learn your waves and listen to your body. **Build your habit first, and then modify it as you learn your waves**. - -### 2\. Set expectations with your management and colleagues - -Not everyone knows how to do remote working, and if your company is less familiar with remote working, you especially need to set expectations with colleagues. - -This can be pretty simple: **when you have designed your routine, communicate it clearly to your management and team**. Let them know how they can get hold of you, how to contact you in an emergency, and how you will be collaborating while at home. - -The communication component here is critical. There are some remote workers who are scared to leave their computer for fear that someone will send them a message while they are away (and they are worried people may think they are just eating Cheetos and watching Netflix). - -You need time away. You need to eat lunch without one eye on your computer. You are not a 911 emergency responder. **Set expectations that sometimes you may not be immediately responsive, but you will get back to them as soon as possible**. - -Similarly, set expectations on your general availability. For example, I set expectations with clients that I generally work from 9am – 6pm every day. Sure, if a client needs something urgently, I am more than happy to respond outside of those hours, but as a general rule I am usually working between those hours. This is necessary for a balanced life. - -### 3\. Distractions are your enemy and they need managing - -We all get distracted. It is human nature. It could be your young kid getting home and wanting to play Rescue Bots. It could be checking Facebook, Instagram, or Twitter to ensure you don’t miss any unwanted political opinions or photos of people’s lunches. It could be that there is something else going on your life that is taking your attention (such as an upcoming wedding, event, or big trip.) - -**You need to learn what distracts you and how to manage it**. For example, I know I get distracted by my email and Twitter. I check it religiously and every check gets me out of the zone of what I am working on. I also get distracted by grabbing coffee and water, which then may turn into a snack and a YouTube video. - -![][9] -My nemesis for distractions. - -The digital distractions have a simple solution: **lock them out**. Close down the tabs until you complete what you are doing. I do this all the time with big chunks of work: I lock out the distractions until I am done. It requires discipline, but all of this does. - -The human elements are tougher. If you have a family you need to make it clear that when you are work, you need to be generally left alone. This is why a home office is so important: you need to set boundaries that mum or dad is working. Come in if there is emergency, but otherwise they need to be left alone. - -There are all kinds of opportunities for locking these distractions out. Put your phone on silent. Set yourself as away. Move to a different room (or building) where the distraction isn’t there. Again, be honest in what distracts you and manage it. If you don’t, you will always be at their mercy. - -### 4\. Relationships need in-person attention - -Some roles are more attuned to remote working than others. For example, I have seen great work from engineering, quality assurance, support, security, and other teams (typically more focused on digital collaboration). Other teams such as design or marketing often struggle more in remote environments (as they are often more tactile.) - -With any team though, having strong relationship is critical, and in-person discussion, collaboration, and socializing is essential to this. So many of our senses (such as body language) are removed in a digital environment, and these play a key role in how we build trust and relationships. - -![][10] -Rockets also help. - -This is especially important if (a) you are new a company and need to build these relationships, (b) are new to a role and need to build relationships with your team, or (c) are in a leadership position where building buy-in and engagement is a key part of your job. - -**The solution? A sensible mix of remote and in-person time.** If your company is nearby, work from home part of the week and at the office part of the week. If your company is further a away, schedule regular trips to the office (and set expectations with your management that you need this). For example, when I worked at XPRIZE I flew to LA every few weeks for a few days. When I worked at Canonical (who were based in London), we had sprints every three months. - -### 5\. Stay focused, but cut yourself some slack - -The crux of everything in this article is about building a capability, and developing a remote working muscle. This is as simple as building a routine, sticking to it, and having an honest view of your “waves” and distractions and how to manage them. - -I see the world in a fairly specific way: **everything we do has the opportunity to be refined and improved**. For example, I have been public speaking now for over 15 years, but I am always discovering new ways to improve, and new mistakes to fix (speaking of which, see my [10 Ways To Up Your Public Speaking Game][11].) - -There is a thrill in the discovery of new ways to get better, and to see every stumbling block and mistake as an “aha!” moment to kick ass in new and different ways. It is no different with remote working: look for patterns that help to unlock ways in which you can make your remote working time more efficient, more comfortable, and more fun. - -![][12] -Get these books. They are fantastic for personal development. -See my [$150 Personal Development Kit][13] article - -…but don’t go crazy over it. There are some people who obsesses every minute of their day about how to get better. They beat themselves up constantly for “not doing well enough”, “not getting more done”, and not meeting their internal unrealistic view of perfection. - -We are humans. We are animals, and we are not robots. Always strive to improve, but be realistic that not everything will be perfect. You are going to have some off-days or off-weeks. You are going to struggle at times with stress and burnout. You are going to handle a situation poorly remotely that would have been easier in the office. Learn from these moments but don’t obsess over them. Life is too damn short. - -**What are your tips, tricks, and recommendations? How do you manage remote working? What is missing from my recommendations? Share them in the comments box!** - - --------------------------------------------------------------------------------- - -via: https://www.jonobacon.com/2019/01/14/remote-working-survival/ - -作者:[Jono Bacon][a] -选题:[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.jonobacon.com/author/admin/ -[b]: https://github.com/lujun9972 -[1]: https://www.cnbc.com/2018/05/30/70-percent-of-people-globally-work-remotely-at-least-once-a-week-iwg-study.html -[2]: http://www.cosocloud.com/press-release/connectsolutions-survey-shows-working-remotely-benefits-employers-and-employees -[3]: https://www.aftercollege.com/cf/2015-annual-survey -[4]: https://www.jonobacon.com/join/ -[5]: https://www.facebook.com/aftertheburial/ -[6]: https://www.jonobacon.com/wp-content/uploads/2019/01/aftertheburial2.jpg -[7]: https://skullsnbones.com/burial-live-photos-vans-warped-tour-denver-co/ -[8]: https://www.youtube.com/watch?v=wK1PNNEKZBY -[9]: https://www.jonobacon.com/wp-content/uploads/2019/01/IMG_20190114_102429-1024x768.jpg -[10]: https://www.jonobacon.com/wp-content/uploads/2019/01/15381733956_3325670fda_k-1024x576.jpg -[11]: https://www.jonobacon.com/2018/12/11/10-ways-to-up-your-public-speaking-game/ -[12]: https://www.jonobacon.com/wp-content/uploads/2019/01/DwVBxhjX4AgtJgV-1024x532.jpg -[13]: https://www.jonobacon.com/2017/11/13/150-dollar-personal-development-kit/ diff --git a/translated/talk/20190114 Remote Working Survival Guide.md b/translated/talk/20190114 Remote Working Survival Guide.md new file mode 100644 index 0000000000..54893cbdca --- /dev/null +++ b/translated/talk/20190114 Remote Working Survival Guide.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (beamrolling) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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/) + +远程工作生存指南 +====== +![](https://www.jonobacon.com/wp-content/uploads/2019/01/5b5471d7eadb585ec8b8a0c3_featureimage-remotejob-1080x675.jpg) + +远程工作似乎是最近的一个热门话题。CNBC 报道称, [70% 的专业人士至少每周在家工作一次][1]。同样地,CoSo Cloud 调查发现, [77% 的人在远程工作时效率更高][2] ,而 aftercollege 的一份调查显示, [8% 的千禧一代会更多地考虑提供远程工作的公司][3]。 这看起来很合理:技术,网络以及文化似乎越来越推动远程工作的发展。哦,自制咖啡也比以前任何时候更好喝了。 + +目前,我准备写另一篇关于公司如何优化远程工作的文章(所以请确保你加入我们的会员以持续关注——这是免费的)。 + +但今天,我想 **分享一些个人如何做好远程工作的建议**。 不管你是全职远程工作者,或者是可以选择一周某几天在家工作的人,希望这篇文章对你有用。 + +眼下,你需要明白, **远程工作不是万能药**。当然,穿着睡衣满屋子乱逛,听听反社会音乐,喝一大杯咖啡看起来似乎挺完美的,但这不适合每个人。 + +有的人需要办公室的结构。有的人需要办公室的社会元素。有的人需要从家里走出来。有的人在家里缺乏保持关注的纪律。有的人因为好几年未缴退税而避免政府工作人员来住处敲门。 + +**远程工作就好像一块肌肉:如果你锻炼并且保持它,那么它能带来极大的力量和能力**。 如果不这么做,结果就不一样了。 + +在我职业生涯的大多数时间里,我在家工作。我喜欢这么做。当我在家工作的时候,我更有效率,更开心,更有能力。我并非不喜欢在办公室工作,我享受办公室的社会元素,但我更喜欢在家工作时我的“空间”。 我喜欢听重金属音乐,但当整个办公室的人不想听到 [After The Burial][5] 的时候,这会引起一些问题。 +![][6] +“Squirrel.” +[图片来源][7] + +已经学会了如何正确平衡工作,旅行以及其他元素来管理我的远程工作,以下是我的一些建议。 请务必**在评论中分享一些你的建议**。 + +### 1\.你需要训练和习惯(以及了解你的“波浪”) + +远程工作确实是需要训练的一块肌肉。就像构建真正的肌肉一样,它需要一个清楚的惯例和一小块健康的训练混合起来。 + +永远保持穿戴整齐(不要穿睡衣)。设置你一天工作的开始和结束时间(大多时候我从早上9点工作到下午6点)。选好你的午餐休息时间(我的是中午12点)。选好你的早晨仪式(我的是电子邮件,紧接着是全面审查客户需求)。决定你的主工作地在哪(我的主工作地是我家里的工作室)。决定好每天你什么时候运动(大多数时候我在下午5点运动)。 + +**设计一个实际的习惯并坚持66天**。构建一个习惯需要很长时间,不要尝试着背离你的习惯。你越坚持这个习惯,做下去所花费的功夫越少。在这66天的末尾,你想都不会想,自然而然地就按习惯去做了。 + +话虽这么说,我们又不住在真空里 ([更干净,或者别的什么][8])。我们都有自己的“波浪”。 + +“波浪”是你为了改变做事的方法时,对日常做出的一些改变。举个例子,夏天的时候我通常需要更多的阳光。那时我经常会在室外的花园工作。临近假期的时候我更容易分心,所以我在上班时间会更需要呆在室内。有时候我只想要多点人际接触,因此我会在咖啡馆工作几周。有时候我就是喜欢在厨房或者长椅上工作。你需要学习你的“波浪”并倾听你的身体。 **首先构建你自己的兴趣,然后在你认识到自己的“波浪”的时候再对它进行适当的修改**。 + +### 2\. 和你的同事以及上司一起设立预期 + +不是每个人都知道怎么远程工作,如果你的公司对远程工作没那么熟悉,你尤其需要和同事一起设立预期。 + +这件事十分简单:**当你要设计自己的工作日常的时候,清楚地跟你的上司和团队进行交流。**让他们知道如何找到你,紧急情况下如何联系你,以及你在家的时候如何保持合作。 + +这里的通信构件至关重要。有些远程工作者很怕离开他们的电脑,因为害怕当他们不在的时候有人给他们发消息(他们担心别人会觉得他们在边吃奇多边看 Netflix)。 + +你需要离开一会的时间。你需要吃午餐的时候眼睛不用一直盯着电脑屏幕。你又不是911接线员。 **设定预期以后,有时候你可能不能立刻回复,但你会尽快回复**。 + +同样地,设定你的一般可用性的预期。举个例子,我对客户设立的预期是我一般每天早上9点到下午6点工作。当然,如果某个客户急需某样东西,我很乐意在这段时间外回应他,但作为一个一般性规则,我通常只在这段时间内工作。这对于生活的平衡是必要的。 + +### 3\. 分心是你的敌人,它们需要管理 + +我们都会分心,这是人类的本能。让你分心的事情可能是你的孩子回家了,想玩变形金刚:救援机器人;可能是看看Facebook,Instagram,或者 Twitter 以确保你不会错过任何不受欢迎的政治观点,或者某人的午餐图片;可能是你生活中即将到来的某件事带走了你的注意力(例如,即将举办的婚礼,活动,或者一次大旅行)。 + +**你需要明白什么让你分心以及如何管理它**。举个例子,我知道我的电子邮件和 Twitter 会让我分心。我经常查看它们,并且每次查看都会让我脱离我正在工作的空间。拿水或者咖啡的时候我总会分心去吃零食,看 Youtube 的视频。 + +![][9] +我的分心克星 + +由电子产品造成的分心有一个简单对策:**锁起来**。直到你完成你手头的事情再关闭选项卡。有繁重的工作的时候我总这么干:我把让我分心的东西锁起来,直到做完手头的工作。这需要控制能力,但所有的一切都需要。 + +因为别人影响而分心的元素更难解决。如果你是有家庭的人,你需要在你工作的时候不被打扰,你通常需要独处。这也是为什么家庭办公室这么重要:你需要设一些“爸爸/妈妈正在工作”的界限。如果有急事才能进来,否则让孩子自个儿玩去。 + +把让你分心的事分开有许多方法:把你的电话静音;把自己的状态设成“离开”;换到一个没有让你分心的事的房间(或建筑物)。再重申一次,了解是什么让你分心并控制好它。如果不这么做,你会永远被分心的事摆布。 + +### 4\. (良好的)关系需要面对面的关注 + +有的角色比其他角色与远程工作更合拍。例如,我见过工程、质量保证、支持、安全以及其他团队(通常更专注于数字协作)的出色工作。其他团队,如设计或营销,往往在远程环境下更难熬(因为它们更注重触觉)。 + +但是,对于任何团队而言,建立牢固的关系至关重要,而现场讨论,协作和社交很有必要。我们的许多感官(例如肢体语言)在数字环境中被删除,这些在我们建立信任和关系的方式中发挥着关键作用。 + +![][10] +火箭也很有帮助 + +这尤为重要,如果(a)你初来这家公司,需要建立关系;(b)你是一个新角色,需要和你的团队建立关系;或者(c)你处于领导地位,建立买入和参与是你工作的关键部分。 + +**解决方法是?合理搭配远程工作与面对面的时间。** 如果你的公司就在附近,可以用一部分的时间在家工作,一部分时间在公司工作。如果你的公司比较远,安排定期前往办公室(并对你的上司设定你需要这么做的预期)。例如,当我在 XPRIZE 工作的时候,我每几周就会飞往洛杉矶几天。当我在 Canonical 工作时(总部在伦敦),我们每三个月来一次冲刺。 + +### 5\. 保持专注,不要松懈 + +本文所有内容的关键在于构建能力,并培养远程工作的肌肉。这就像建立你的日常,坚持它,并明白你的“波浪”和让你分心的事情以及如何管理它们一样简单。 + +我以一种相当具体的方式来看待这个世界:**我们所做的一切都有机会得到改进和完善**。举个例子,我已经公开演讲超过 15 年,但我总是能发现新的改进方法,以及修复新的错误(说到这些,请参阅我的 [提升你公众演讲的10个方法][11])。 + +发现新的改善方法,以及把每个绊脚石和错误视为一个开启新的不同的“啊哈!”时刻让人兴奋。远程工作和这没什么不同:寻找有助于解锁方式的模式,让你的远程工作时间更高效,更舒适,更有趣。 + +![][12] +看看这些书。它们非常适合个人发展。 +参阅我的 [150 美元个人发展工具包][13] 文章 + +...但别为此狂热。有的人花尽他们每一分钟来关注如何变得更好,他们经常以“做得还不够好”,“完成度不够高”等为由打击自己,无法达到他们内心关于完美的不切实际的观点。 + +我们都是人,我们是有生命的,不是机器人。始终致力于改进,但要明白不是所有东西都是完美的。你将会有一些休息日或休息周。你将会因为压力和倦怠而挣扎。你将会处理一些在办公室比远程工作更容易的情况。从这些时刻中学习,但不要沉迷于此。生命太短暂了。 + +**你有什么提示,技巧和建议吗?你如何管理远程工作?我的建议中还缺少什么吗?在评论区中与我分享!** + + +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.jonobacon.com/author/admin/ +[b]: https://github.com/lujun9972 +[1]: https://www.cnbc.com/2018/05/30/70-percent-of-people-globally-work-remotely-at-least-once-a-week-iwg-study.html +[2]: http://www.cosocloud.com/press-release/connectsolutions-survey-shows-working-remotely-benefits-employers-and-employees +[3]: https://www.aftercollege.com/cf/2015-annual-survey +[4]: https://www.jonobacon.com/join/ +[5]: https://www.facebook.com/aftertheburial/ +[6]: https://www.jonobacon.com/wp-content/uploads/2019/01/aftertheburial2.jpg +[7]: https://skullsnbones.com/burial-live-photos-vans-warped-tour-denver-co/ +[8]: https://www.youtube.com/watch?v=wK1PNNEKZBY +[9]: https://www.jonobacon.com/wp-content/uploads/2019/01/IMG_20190114_102429-1024x768.jpg +[10]: https://www.jonobacon.com/wp-content/uploads/2019/01/15381733956_3325670fda_k-1024x576.jpg +[11]: https://www.jonobacon.com/2018/12/11/10-ways-to-up-your-public-speaking-game/ +[12]: https://www.jonobacon.com/wp-content/uploads/2019/01/DwVBxhjX4AgtJgV-1024x532.jpg +[13]: https://www.jonobacon.com/2017/11/13/150-dollar-personal-development-kit/ From 62a9cf128ab6b4a027872b891d6005016d947ebd Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sun, 3 Feb 2019 04:51:38 +0800 Subject: [PATCH 0941/4278] hankchow translating --- sources/talk/20190108 Hacking math education with Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190108 Hacking math education with Python.md b/sources/talk/20190108 Hacking math education with Python.md index 111b306c7a..81241302a2 100644 --- a/sources/talk/20190108 Hacking math education with Python.md +++ b/sources/talk/20190108 Hacking math education with Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d8419dd31cd78d8f19b339b41c4b130f6e7029e1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 3 Feb 2019 09:58:59 +0800 Subject: [PATCH 0942/4278] translated --- ...dom selection tool for the command line.md | 30 +++---- ...dom selection tool for the command line.md | 90 +++++++++++++++++++ 2 files changed, 105 insertions(+), 15 deletions(-) create mode 100644 translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md diff --git a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md index edf787447b..8ec3401d39 100644 --- a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md +++ b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md @@ -7,30 +7,30 @@ [#]: via: (https://opensource.com/article/19/1/productivity-tools-roland) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -Get started with Roland, a random selection tool for the command line +开始使用 Roland,一款命令行随机选择工具 ====== -Get help making hard choices with Roland, the seventh in our series on open source tools that will make you more productive in 2019. +Roland 是我们在开源工具系列中的第七个工具,它将帮助你在 2019 年提高工作效率。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dice_tabletop_board_gaming_game.jpg?itok=y93eW7HN) -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 seventh of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第七个工具来帮助你在 2019 年更有效率。 ### Roland -By the time the workday has ended, often the only thing I want to think about is hitting the couch and playing the video game of the week. But even though my professional obligations stop at the end of the workday, I still have to manage my household. Laundry, pet care, making sure my teenager has what he needs, and most important: deciding what to make for dinner. +当一周的工作结束后,我唯一想做的就是躺到沙发上打一个周末的游戏。但即使我的职业义务在工作日结束后停止了,但我仍然需要管理我的家庭。洗衣、宠物护理、确保我孩子有他所需要的东西,以及最重要的是:决定晚餐吃什么。 -Like many people, I often suffer from [decision fatigue][1], and I make less-than-healthy choices for dinner based on speed, ease of preparation, and (quite frankly) whatever causes me the least stress. +像许多人一样,我经常受到[决策疲劳][1]的困扰,根据速度、准备难易以及(坦白地说)任何让我压力最小的方式都会导致不太健康的晚餐选择。 ![](https://opensource.com/sites/default/files/uploads/roland-1.png) -[Roland][2] makes planning my meals much easier. Roland is a Perl application designed for tabletop role-playing games. It picks randomly from a list of items, such as monsters and hirelings. In essence, Roland does the same thing at the command line that a game master does when rolling physical dice to look up things in a table from the Game Master's Big Book of Bad Things to Do to Players. +[Roland][2]让我计划饭菜变得容易。Roland 是一款专为桌面角色扮演游戏设计的 Perl 应用。它从怪物和雇佣者等物品列表中随机挑选。从本质上讲,Roland 在命令行做的事情与游戏大师在掷骰子时做的同样的事情,以便在游戏大师的《对玩家的坏事书》中的桌子上查找东西。 -With minor modifications, Roland can do so much more. For example, just by adding a table, I can enable Roland to help me choose what to cook for dinner. +通过微小的修改,Roland 可以做得更多。例如,只需添加一张桌子,我就可以让 Roland 帮我选择晚餐。 -The first step is installing Roland and all its dependencies. +第一步是安装 Roland 及其依赖项。 ``` git clone git@github.com:rjbs/Roland.git @@ -41,7 +41,7 @@ cpan install Getopt::Long::Descriptive Moose \ cd oland ``` -Next, I create a YAML document named **dinner** and enter all our meal options. +接下来,创建一个名为 **dinner** 的 YAML 文档,并输入我们所有的用餐选项。 ``` type: list @@ -58,19 +58,19 @@ items:  - "grilled cheese sandwiches" ``` -Running the command **bin/roland dinner** will read the file and pick one of the options. +运行命令 **bin/roland dinner** 将读取文件并选择其中一项。 ![](https://opensource.com/sites/default/files/uploads/roland-2.png) -I like to plan for the week ahead so I can shop for all my ingredients in advance. The **pick** command determines how many items from the list to chose, and right now, the **pick** option is set to 1. If I want to plan a full week's dinner menu, I can just change **pick: 1** to **pick: 7** and it will give me a week's worth of dinners. You can also use the **-m** command line option to manually enter the choices. +我想提前计划一周,这样我可以提前购买所有食材。 **pick** 命令确定列表中要选择的物品数量,现在,**pick** 设置为 1。如果我想计划一周的晚餐菜单,我可以将 **pick: 1** 变成 **pick: 7**,它会提供一周的菜单。你还可以使用 **-m** 选项手动输入选择。 ![](https://opensource.com/sites/default/files/uploads/roland-3.png) -You can also do fun things with Roland, like adding a file named **8ball** with some classic phrases. +你也可以用 Roland 做些有趣的事情,比如用经典短语添加一个名为 **8ball** 的文件。 ![](https://opensource.com/sites/default/files/uploads/roland-4.png) -You can create all kinds of files to help with common decisions that seem so stressful after a long day of work. And even if you don't use it for that, you can still use it to decide which devious trap to set up for tonight's game. +你可以创建各种文件来帮助做出长时间工作后看起来非常难做的常见决策。即使你不用来做这个,你仍然可以用它来决定为今晚的游戏设置哪个狡猾的陷阱。 -------------------------------------------------------------------------------- @@ -79,7 +79,7 @@ via: https://opensource.com/article/19/1/productivity-tools-roland 作者:[Kevin Sonney][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/) 荣誉推出 diff --git a/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md new file mode 100644 index 0000000000..8ec3401d39 --- /dev/null +++ b/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Roland, a random selection tool for the command line) +[#]: via: (https://opensource.com/article/19/1/productivity-tools-roland) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 Roland,一款命令行随机选择工具 +====== + +Roland 是我们在开源工具系列中的第七个工具,它将帮助你在 2019 年提高工作效率。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dice_tabletop_board_gaming_game.jpg?itok=y93eW7HN) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第七个工具来帮助你在 2019 年更有效率。 + +### Roland + +当一周的工作结束后,我唯一想做的就是躺到沙发上打一个周末的游戏。但即使我的职业义务在工作日结束后停止了,但我仍然需要管理我的家庭。洗衣、宠物护理、确保我孩子有他所需要的东西,以及最重要的是:决定晚餐吃什么。 + +像许多人一样,我经常受到[决策疲劳][1]的困扰,根据速度、准备难易以及(坦白地说)任何让我压力最小的方式都会导致不太健康的晚餐选择。 + +![](https://opensource.com/sites/default/files/uploads/roland-1.png) + +[Roland][2]让我计划饭菜变得容易。Roland 是一款专为桌面角色扮演游戏设计的 Perl 应用。它从怪物和雇佣者等物品列表中随机挑选。从本质上讲,Roland 在命令行做的事情与游戏大师在掷骰子时做的同样的事情,以便在游戏大师的《对玩家的坏事书》中的桌子上查找东西。 + +通过微小的修改,Roland 可以做得更多。例如,只需添加一张桌子,我就可以让 Roland 帮我选择晚餐。 + +第一步是安装 Roland 及其依赖项。 + +``` +git clone git@github.com:rjbs/Roland.git +cpan install Getopt::Long::Descriptive Moose \ +   namespace::autoclean List:AllUtils Games::Dice \ +   Sort::ByExample Data::Bucketeer Text::Autoformat \ +   YAML::XS +cd oland +``` + +接下来,创建一个名为 **dinner** 的 YAML 文档,并输入我们所有的用餐选项。 + +``` +type: list +pick: 1 +items: + - "frozen pizza" + - "chipotle black beans" + - "huevos rancheros" + - "nachos" + - "pork roast" + - "15 bean soup" + - "roast chicken" + - "pot roast" + - "grilled cheese sandwiches" +``` + +运行命令 **bin/roland dinner** 将读取文件并选择其中一项。 + +![](https://opensource.com/sites/default/files/uploads/roland-2.png) + +我想提前计划一周,这样我可以提前购买所有食材。 **pick** 命令确定列表中要选择的物品数量,现在,**pick** 设置为 1。如果我想计划一周的晚餐菜单,我可以将 **pick: 1** 变成 **pick: 7**,它会提供一周的菜单。你还可以使用 **-m** 选项手动输入选择。 + +![](https://opensource.com/sites/default/files/uploads/roland-3.png) + +你也可以用 Roland 做些有趣的事情,比如用经典短语添加一个名为 **8ball** 的文件。 + +![](https://opensource.com/sites/default/files/uploads/roland-4.png) + +你可以创建各种文件来帮助做出长时间工作后看起来非常难做的常见决策。即使你不用来做这个,你仍然可以用它来决定为今晚的游戏设置哪个狡猾的陷阱。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tools-roland + +作者:[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://en.wikipedia.org/wiki/Decision_fatigue +[2]: https://github.com/rjbs/Roland From 54c7a93457c9b008542d7f06482b6d56352c1b9e Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 3 Feb 2019 10:05:02 +0800 Subject: [PATCH 0943/4278] translated --- ...dom selection tool for the command line.md | 90 ------------------- 1 file changed, 90 deletions(-) delete mode 100644 sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md diff --git a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md deleted file mode 100644 index 8ec3401d39..0000000000 --- a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md +++ /dev/null @@ -1,90 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with Roland, a random selection tool for the command line) -[#]: via: (https://opensource.com/article/19/1/productivity-tools-roland) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -开始使用 Roland,一款命令行随机选择工具 -====== - -Roland 是我们在开源工具系列中的第七个工具,它将帮助你在 2019 年提高工作效率。 - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dice_tabletop_board_gaming_game.jpg?itok=y93eW7HN) - -每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 - -这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第七个工具来帮助你在 2019 年更有效率。 - -### Roland - -当一周的工作结束后,我唯一想做的就是躺到沙发上打一个周末的游戏。但即使我的职业义务在工作日结束后停止了,但我仍然需要管理我的家庭。洗衣、宠物护理、确保我孩子有他所需要的东西,以及最重要的是:决定晚餐吃什么。 - -像许多人一样,我经常受到[决策疲劳][1]的困扰,根据速度、准备难易以及(坦白地说)任何让我压力最小的方式都会导致不太健康的晚餐选择。 - -![](https://opensource.com/sites/default/files/uploads/roland-1.png) - -[Roland][2]让我计划饭菜变得容易。Roland 是一款专为桌面角色扮演游戏设计的 Perl 应用。它从怪物和雇佣者等物品列表中随机挑选。从本质上讲,Roland 在命令行做的事情与游戏大师在掷骰子时做的同样的事情,以便在游戏大师的《对玩家的坏事书》中的桌子上查找东西。 - -通过微小的修改,Roland 可以做得更多。例如,只需添加一张桌子,我就可以让 Roland 帮我选择晚餐。 - -第一步是安装 Roland 及其依赖项。 - -``` -git clone git@github.com:rjbs/Roland.git -cpan install Getopt::Long::Descriptive Moose \ -   namespace::autoclean List:AllUtils Games::Dice \ -   Sort::ByExample Data::Bucketeer Text::Autoformat \ -   YAML::XS -cd oland -``` - -接下来,创建一个名为 **dinner** 的 YAML 文档,并输入我们所有的用餐选项。 - -``` -type: list -pick: 1 -items: - - "frozen pizza" - - "chipotle black beans" - - "huevos rancheros" - - "nachos" - - "pork roast" - - "15 bean soup" - - "roast chicken" - - "pot roast" - - "grilled cheese sandwiches" -``` - -运行命令 **bin/roland dinner** 将读取文件并选择其中一项。 - -![](https://opensource.com/sites/default/files/uploads/roland-2.png) - -我想提前计划一周,这样我可以提前购买所有食材。 **pick** 命令确定列表中要选择的物品数量,现在,**pick** 设置为 1。如果我想计划一周的晚餐菜单,我可以将 **pick: 1** 变成 **pick: 7**,它会提供一周的菜单。你还可以使用 **-m** 选项手动输入选择。 - -![](https://opensource.com/sites/default/files/uploads/roland-3.png) - -你也可以用 Roland 做些有趣的事情,比如用经典短语添加一个名为 **8ball** 的文件。 - -![](https://opensource.com/sites/default/files/uploads/roland-4.png) - -你可以创建各种文件来帮助做出长时间工作后看起来非常难做的常见决策。即使你不用来做这个,你仍然可以用它来决定为今晚的游戏设置哪个狡猾的陷阱。 - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tools-roland - -作者:[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://en.wikipedia.org/wiki/Decision_fatigue -[2]: https://github.com/rjbs/Roland From aba4af461a8f85aebbf2e8e1290a72db6b43463c Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Sat, 2 Feb 2019 20:13:54 -0600 Subject: [PATCH 0944/4278] Add translator information --- ...uilding Slack for the Linux community and adopting snaps.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/talk/20180206 Building Slack for the Linux community and adopting snaps.md b/sources/talk/20180206 Building Slack for the Linux community and adopting snaps.md index 3f4774ba74..17132a36c5 100644 --- a/sources/talk/20180206 Building Slack for the Linux community and adopting snaps.md +++ b/sources/talk/20180206 Building Slack for the Linux community and adopting snaps.md @@ -1,3 +1,4 @@ +tomjlw is translating Building Slack for the Linux community and adopting snaps ====== ![][1] @@ -63,7 +64,7 @@ We are taking it step by step currently – first get people on the snap, and bu via: https://insights.ubuntu.com/2018/02/06/building-slack-for-the-linux-community-and-adopting-snaps/ 作者:[Sarah][a] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/tomjlw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 05af231208f6b142fa8e53e917f7d92bcdb07433 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sun, 3 Feb 2019 10:15:22 +0800 Subject: [PATCH 0945/4278] translating --- ...g started with Sandstorm, an open source web app platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 4b88a648f7..2389a5d243 100644 --- 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 @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7503f846d69b16f4b644f3759eb5b50741add83f Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 3 Feb 2019 16:39:44 +0800 Subject: [PATCH 0946/4278] Translated by qhwdw --- ...aboratory - Raspberry Pi- Lesson 3 OK03.md | 383 ------------------ ...aboratory - Raspberry Pi- Lesson 3 OK03.md | 383 ++++++++++++++++++ 2 files changed, 383 insertions(+), 383 deletions(-) delete mode 100644 sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md create mode 100644 translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md diff --git a/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md deleted file mode 100644 index 9795a43296..0000000000 --- a/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md +++ /dev/null @@ -1,383 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: 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) - -Computer Laboratory – Raspberry Pi: Lesson 3 OK03 -====== - -The OK03 lesson builds on OK02 by teaching how to use functions in assembly to make more reusable and rereadable code. It is assumed you have the code for the [Lesson 2: OK02][1] operating system as a basis. - -### 1 Reusable Code - -So far we've made code for our operating system by typing the things we want to happen in order. This is fine for such tiny programs, but if we wrote the whole system like this, the code would be completely unreadable. Instead we use functions. - -``` -A function is a piece of code that can be reused to compute a certain kind of answer, or perform a certain action. You may also hear them called procedures, routines or subroutines. Although these are all different, people rarely use the correct term. - -You should already be happy with the concept of a function from mathematics. For example the cosine function applied to a number gives another number between -1 and 1 which is the cosine of the angle. Notationally we write cos(x) to be the cosine function applied to the value x. - -In code, functions can take multiple inputs (including none), give multiple outputs (including none), and may cause side effects. For example a function might create a file on the file system, named after the first input, with length based on the second. -``` - -![Function as black boxes][2] - -``` -Functions are said to be 'black boxes'. We put inputs in, and outputs come out, but we don't need to know how they work. -``` - -In higher level code such as C or C++, functions are part of the language itself. In assembly code, functions are just ideas we have. - -Ideally we want to be able to set our registers to some input values, branch to an address, and expect that at some point the code will branch back to our code having set the registers to output values. This is what a function is in assembly code. The difficulty comes in what system we use for setting the registers. If we just used any system we felt like, each programmer may use a different system, and would find other programmers' work hard to understand. Further, compilers would not be able to work with assembly code as easily, as they would not know how to use the functions. To prevent confusion, a standard called the Application Binary Interface (ABI) was devised for each assembly language which is an agreement on how functions should be run. If everyone makes functions in the same way, then everyone will be able to use each others' functions. I will teach that standard here, and from now on I will code all of my functions to meet the standard. - -The standard says that r0,r1,r2 and r3 will be used as inputs to a function in order. If a function needs no inputs, then it doesn't matter what value it takes. If it needs only one it always goes in r0, if it needs two, the first goes in r0, and the second goes on r1, and so on. The output will always be in r0. If a function has no output, it doesn't matter what value r0 takes. - -Further, it also requires that after a function is run, r4 to r12 must have the same values as they had when the function started. This means that when you call a function, you can be sure the r4 to r12 will not change value, but you cannot be so sure about r0 to r3. - -When a function completes it has to branch back to the code that started it. This means it must know the address of the code that started it. To facilitate this, there is a special register called lr (link register) which always holds the address of the instruction after the one that called this function. - -Table 1.1 ARM ABI register usage -| Register | Brief | Preserved | Rules | -| -------- | ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| r0 | Argument and result | No | r0 and r1 are used for passing the first two arguments to functions, and returning the results of functions. If a function does not use them for a return value, they can take any value after a function. | -| r1 | Argument and result | No | | -| r2 | Argument | No | r2 and r3 are used for passing the second two arguments to functions. There values after a function is called can be anything. | -| r3 | Argument | No | | -| r4 | General purpose | Yes | r4 to r12 are used for working values, and their value after a function is called must be the same as before. | -| r5 | General purpose | Yes | | -| r6 | General purpose | Yes | | -| r7 | General purpose | Yes | | -| r8 | General purpose | Yes | | -| r9 | General purpose | Yes | | -| r10 | General purpose | Yes | | -| r11 | General purpose | Yes | | -| r12 | General purpose | Yes | | -| lr | Return address | No | lr is the address to branch back to when a function is finished, but this does have to contain the same address after the function has finished. | -| sp | Stack pointer | Yes | sp is the stack pointer, described below. Its value must be the same after the function has finished. | - -Often functions need to use more registers than just r0 to r3. But, since r4 to r12 must stay the same after the method has run, they must be saved somewhere. We save them on something called the stack. - - -![Stack diagram][3] -``` -A stack is a metaphor we use in computing for a method of storing values. Just like in a stack of plates, you can only remove items from the top of a stack, and only add items to the top of the stack. - -The stack is a brilliant idea for storing registers on when functions are running. For example if I have a function which needs to use registers r4 and r5, it could place the current values of those registers on a stack. At the end of the method it could take them back off again. What is most clever is that if my function had to run another function in order to complete and that function needed to save some registers, it could put those on the top of the stack while it ran, and then take them off again at the end. That wouldn't affect the values of r4 and r5 that my method had to save, as they would be added to the top of the stack, and then taken off again. - -The terminology we used to refer to the values put on the stack by a particular method is that methods 'stack frame'. Not every method needs a stack frame, some don't need to store values. -``` - -Because the stack is so useful, it has been implemented in the ARMv6 instruction set directly. A special register called sp (stack pointer) holds the address of the stack. When items are added to the stack, the sp register updates so that it always holds the address of the first item on the stack. push {r4,r5} would put the values in r4 and r5 onto the top of the stack and pop {r4,r5} would take them back off again (in the correct order). - -### 2 Our First Function - -Now that we have some idea about how functions work, let's try to make one. For a basic first example, we are going to make a function that takes no input, and gives an output of the GPIO address. In the last lesson, we just wrote in this value, but it would be better as a function, since it is something we might need to do often in a real operating system, and we might not always remember the address. - -Copy the following code into a new file called 'gpio.s'. Just make the new file in the 'source' directory with 'main.s'. We're going to put all functions related to the GPIO controller in one file to make them easier to find. - -``` -.globl GetGpioAddress -GetGpioAddress: -ldr r0,=0x20200000 -mov pc,lr -``` - -``` -.globl lbl makes the label lbl accessible from other files. - -mov reg1,reg2 copies the value in reg2 into reg1. -``` - -This is a very simple complete function. The .globl GetGpioAddress command is a message to the assembler to make the label GetGpioAddress accessible to all files. This means that in our main.s file we can branch to the label GetGpioAddress even though it is not defined in that file. - -You should recognise the ldr r0,=0x20200000 command, which stores the GPIO controller address in r0. Since this is a function, we have to give the output in r0, so we are not as free to use any register as we once were. - -mov pc,lr copies the value in lr to pc. As mentioned earlier lr always contains the address of the code that we have to go back to when a method finishes. pc is a special register which always contains the address of the next instruction to be run. A normal branch command just changes the value of this register. By copying the value in lr to pc we just change the next line to be run to be the one we were told to go back to. - -A reasonable question would now be, how would we actually run this code? A special type of branch bl does what we need. It branches to a label like a normal branch, but before it does it updates lr to contain the address of the line after the branch. That means that when the function finishes, the line it will go back to will be the one after the bl command. This makes a function running just look like any other command, it simply runs, does whatever it needs to do, and then carries on to the next line. This is a really useful way of thinking about functions. We treat them as 'black boxes' in that when we use them, we don't need to think about how they work, we just need to know what inputs they need, and what outputs they give. - -For now, don't worry about using the function, we will use it in the next section. - -### 3 A Big Function - -Now we're going to implement a bigger function. Our first job was to enable output on GPIO pin 16. It would be nice if this was a function. We could simply specify a pin and a function as the input, and the function would set the function of that pin to that value. That way, we could use the code to control any GPIO pin, not just the LED. - -Copy the following commands below the GetGpioAddress function in gpio.s. - -``` -.globl SetGpioFunction -SetGpioFunction: -cmp r0,#53 -cmpls r1,#7 -movhi pc,lr -``` - -``` -Suffix ls causes the command to be executed only if the last comparison determined that the first number was less than or the same as the second. Unsigned. - -Suffix hi causes the command to be executed only if the last comparison determined that the first number was higher than the second. Unsigned. -``` - -One of the first things we should always think about when writing functions is our inputs. What do we do if they are wrong? In this function, we have one input which is a GPIO pin number, and so must be a number between 0 and 53, since there are 54 pins. Each pin has 8 functions, numbered 0 to 7 and so the function code must be too. We could just assume that the inputs will be correct, but this is very dangerous when working with hardware, as incorrect values could cause very bad side effects. Therefore, in this case, we wish to make sure the inputs are in the right ranges. - -To do this we need to check that r0 <= 53 and r1 <= 7. First of all, we can use the comparison we've seen before to compare the value of r0 with 53. The next instruction, cmpls is a normal comparison instruction that will only be run if r0 was lower than or the same as 53. If that was the case, it compares r1 with 7, otherwise the result of the comparison is the same as before. Finally we go back to the code that ran the function if the result of the last comparison was that the register was higher than the number. - -The effect of this is exactly what we want. If r0 was bigger than 53, then the cmpls command doesn't run, but the movhi does. If r0 is <= 53, then the cmpls command does run, and so r1 is compared with 7, and then if it is higher than 7, movhi is run, and the function ends, otherwise movhi does not run, and we know for sure that r0 <= 53 and r1 <= 7. - -There is a subtle difference between the ls (lower or same) and le (less or equal) as well as between hi (higher) and gt (greater) suffixes, but I will cover this later. - -Copy these commands below the above. - -``` -push {lr} -mov r2,r0 -bl GetGpioAddress -``` - -``` -push {reg1,reg2,...} copies the registers in the list reg1,reg2,... onto the top of the stack. Only general purpose registers and lr can be pushed. - -bl lbl sets lr to the address of the next instruction and then branches to the label lbl. -``` - -These next three commands are focused on calling our first method. The push {lr} command copies the value in lr onto the top of the stack, so that we can retrieve it later. We must do this because when we call GetGpioAddress, we will need to use lr to store the address to come back to in our function. - -If we did not know anything about the GetGpioAddress function, we would have to assume it changes r0,r1,r2 and r3, and would have to move our values to r4 and r5 to keep them the same after it finishes. Fortunately, we do know about GetGpioAddress, and we know it only changes r0 to the address, it doesn't affect r1,r2 or r3. Thus, we only have to move the GPIO pin number out of r0 so it doesn't get overwritten, but we know we can safely move it to r2, as GetGpioAddress doesn't change r2. - -Finally we use the bl instruction to run GetGpioAddress. Normally we use the term 'call' for running a function, and I will from now. As discussed earlier bl calls a function by updating the lr to the next instruction's address, and then branching to the function. - -When a function ends we say it has 'returned'. When the call to GetGpioAddress returns, we now know that r0 contains the GPIO address, r1 contains the function code and r2 contains the GPIO pin number. I mentioned earlier that the GPIO functions are stored in blocks of 10, so first we need to determine which block of ten our pin number is in. This sounds like a job we would use a division for, but divisions are very slow indeed, so it is better for such small numbers to do repeated subtraction. - -Copy the following code below the above. - -``` -functionLoop$: - -cmp r2,#9 -subhi r2,#10 -addhi r0,#4 -bhi functionLoop$ -``` - -``` -add reg,#val adds the number val to the contents of the register reg. -``` - -This simple loop code compares the pin number to 9. If it is higher than 9, it subtracts 10 from the pin number, and adds 4 to the GPIO Controller address then runs the check again. - -The effect of this is that r2 will now contain a number from 0 to 9 which represents the remainder of dividing the pin number by 10. r0 will now contain the address in the GPIO controller of this pin's function settings. This would be the same as GPIO Controller Address + 4 × (GPIO Pin Number ÷ 10). - -Finally, copy the following code below the above. - -``` -add r2, r2,lsl #1 -lsl r1,r2 -str r1,[r0] -pop {pc} -``` - -``` -Argument shift reg,lsl #val shifts the binary representation of the number in reg left by val before using it in the operation before. - -lsl reg,amt shifts the binary representation of the number in reg left by the number in amt. - -str reg,[dst] is the same as str reg,[dst,#0]. - -pop {reg1,reg2,...} copies the values from the top of the stack into the register list reg1,reg2,.... Only general purpose registers and pc can be popped. -``` - -This code finishes off the method. The first line is actually a multiplication by 3 in disguise. Multiplication is a big and slow instruction in assembly code, as the circuit can take a long time to come up with the answer. It is much faster sometimes to use some instructions which can get the answer quicker. In this case, I know that r2 × 3 is the same as r2 × 2 + r2. It is very easy to multiply a register by 2 as this is conveniently the same as shifting the binary representation of the number left by one place. - -One of the very useful features of the ARMv6 assembly code language is the ability to shift an argument before using it. In this case, I add r2 to the result of shifting the binary representation of r2 to the left by one place. In assembly code, you often use tricks such as this to compute answers more easily, but if you're uncomfortable with this, you could also write something like mov r3,r2; add r2,r3; add r2,r3. - -Now we shift the function value left by a number of places equal to r2. Most instructions such as add and sub have a variant which uses a register rather than a number for the amount. We perform this shift because we want to set the bits that correspond to our pin number, and there are three bits per pin. - -We then store the the computed function value at the address in the GPIO controller. We already worked out the address in the loop, so we don't need to store it at an offset like we did in OK01 and OK02. - -Finally, we can return from this method call. Since we pushed lr onto the stack, if we pop pc, it will copy the value that was in lr at the time we pushed it into pc. This would be the same as having used mov pc,lr and so the function call will return when this line is run. - -The very keen may notice that this function doesn't actually work correctly. Although it sets the function of the GPIO pin to the requested value, it causes all the pins in the same block of 10's functions to go back to 0! This would likely be quite annoying in a system which made heavy use of the GPIO pins. I leave it as a challenge to the interested to fix this function so that it does not overwrite other pins values by ensuring that all bits other than the 3 that must be set remain the same. A solution to this can be found on the downloads page for this lesson. Functions that you may find useful are and which computes the Boolean and function of two registers, mvns which computes the Boolean not and orr which computes the Boolean or. - -### 4 Another Function - -So, we now have a function which takes care of the GPIO pin function setting. We now need to make a function to turn a GPIO pin on or off. Rather than having one function for off and one function for on, it would be handy to have a single function which does either. - -We will make a function called SetGpio which takes a GPIO pin number as its first input in r0, and a value as its second in r1. If the value is 0 we will turn the pin off, and if it is not zero we will turn it on. - -Copy and paste the following code at the end of 'gpio.s'. - -``` -.globl SetGpio -SetGpio: -pinNum .req r0 -pinVal .req r1 -``` - -``` -alias .req reg sets alias to mean the register reg. -``` - -Once again we need the .globl command and the label to make the function accessible from other files. This time we're going to use register aliases. Register aliases allow us to use a name other than just r0 or r1 for registers. This may not be so important now, but it will prove invaluable when writing big methods later, and you should try to use aliases from now on. pinNum .req r0 means that pinNum now means r0 when used in instructions. - -Copy and paste the following code after the above. - -``` -cmp pinNum,#53 -movhi pc,lr -push {lr} -mov r2,pinNum -.unreq pinNum -pinNum .req r2 -bl GetGpioAddress -gpioAddr .req r0 -``` - -``` -.unreq alias removes the alias alias. -``` - -Like in SetGpioFunction the first thing we must do is check that we were actually given a valid pin number. We do this in exactly the same way by comparing pinNum (r0) with 53, and returning immediately if it is higher. Once again we wish to call GetGpioAddress, so we have to preserve lr by pushing it onto the stack, and to move pinNum to r2. We then use the .unreq statement to remove our alias from r0. Since the pin number is now stored in r2 we want our alias to reflect this, so we remove the alias from r0 and remake it on r2. You should always .unreq every alias as soon as it is done with, so that you cannot make the mistake of using it further down the code when it no longer exists. - -We then call GetGpioAddress, and we create an alias for r0 to reflect this. - -Copy and paste the following code after the above. - -``` -pinBank .req r3 -lsr pinBank,pinNum,#5 -lsl pinBank,#2 -add gpioAddr,pinBank -.unreq pinBank -``` - -``` -lsr dst,src,#val shifts the binary representation of the number in src right by val, but stores the result in dst. -``` - -The GPIO controller has two sets of 4 bytes each for turning pins on and off. The first set in each case controls the first 32 pins, and the second set controls the remaining 22. In order to determine which set it is in, we need to divide the pin number by 32. Fortunately this is very easy, at is the same as shifting the binary representation of the pin number right by 5 places. Hence, in this case I've named r3 as pinBank and then computed pinNum ÷ 32. Since it is a set of 4 bytes, we then need to multiply the result of this by 4. This is the same as shifting the binary representation left by 2 places, which is the command that follows. You may wonder if we could just shift it right by 3 places, as we went right then left. This won't work however, as some of the answer may have been rounded away when we did ÷ 32 which may not be if we just ÷ 8. - -The result of this is that gpioAddr now contains either 2020000016 if the pin number is 0-31, and 2020000416 if the pin number is 32-53. This means if we add 2810 we get the address for turning the pin on, and if we add 4010 we get the address for turning the pin off. Since we are done with pinBank, I use .unreq immediately afterwards. - -Copy and paste the following code after the above. - -``` -and pinNum,#31 -setBit .req r3 -mov setBit,#1 -lsl setBit,pinNum -.unreq pinNum -``` - -``` -and reg,#val computes the Boolean and function of the number in reg with val. -``` - -This next part of the function is for generating a number with the correct bit set. For the GPIO controller to turn a pin on or off, we give it a number with a bit set in the place of the remainder of that pin's number divided by 32. For example, to set pin 16, we need a number with the 16th bit a 1. To set pin 45 we would need a number with the 13th bit 1 as 45 ÷ 32 = 1 remainder 13. - -The and command computes the remainder we need. How it does this is that the result of an and operation is a number with 1s in all binary digits which had 1s in both of the inputs, and 0s elsewhere. This is a fundamental binary operation, and is very quick. We have given it inputs of pinNum and 3110 = 111112. This means that the answer can only have 1 bits in the last 5 places, and so is definitely between 0 and 31. Specifically it only has 1s where there were 1s in pinNum's last 5 places. This is the same as the remainder of a division by 32. It is no coincidence that 31 = 32 - 1. - -![binary division example][4] - -The rest of this code simply uses this value to shift the number 1 left. This has the effect of creating the binary number we need. - -Copy and paste the following code after the above. - -``` -teq pinVal,#0 -.unreq pinVal -streq setBit,[gpioAddr,#40] -strne setBit,[gpioAddr,#28] -.unreq setBit -.unreq gpioAddr -pop {pc} -``` - -``` -teq reg,#val checks if the number in reg is equal to val. -``` - -This code ends the method. As stated before, we turn the pin off if pinVal is zero, and on otherwise. teq (test equal) is another comparison operation that can only be used to test for equality. It is similar to cmp but it does not work out which number is bigger. If all you wish to do is test if to numbers are the same, you can use teq. - -If pinVal is zero, we store the setBit at 40 away from the GPIO address, which we already know turns the pin off. Otherwise we store it at 28, which turns the pin on. Finally, we return by popping the pc, which sets it to the value that we stored when we pushed the link register. - -### 5 A New Beginning - -Finally, after all that work we have our GPIO functions. We now need to alter 'main.s' to use them. Since 'main.s' is now getting a lot bigger and more complicated, it is better design to split it into two sections. The '.init' we've been using so far is best kept as small as possible. We can change the code to reflect this easily. - -Insert the following just after _start: in main.s: - -``` -b main - -.section .text -main: -mov sp,#0x8000 -``` - -The key change we have made here is to introduce the .text section. I have designed the makefile and linker scripts such that code in the .text section (which is the default section) is placed after the .init section which is placed at address 800016. This is the default load address and gives us some space to store the stack. As the stack exists in memory, it has to have an address. The stack grows down memory, so that each new value is at a lower address, thus making the 'top' of the stack, the lowest address. - -``` -The 'ATAGs' section in the diagram is a place where information about the Raspberry Pi is stored such as how much memory it has, and what its default screen resolution is. -``` - -![Layout diagram of operating system][5] - -Replace all the code that set the function of the GPIO pin with the following: - -``` -pinNum .req r0 -pinFunc .req r1 -mov pinNum,#16 -mov pinFunc,#1 -bl SetGpioFunction -.unreq pinNum -.unreq pinFunc -``` - -This code calls SetGpioFunction with the pin number 16 and the pin function code 1. This has the effect of enabling output to the OK LED. - -Replace any code which turns the OK LED on with the following: - -``` -pinNum .req r0 -pinVal .req r1 -mov pinNum,#16 -mov pinVal,#0 -bl SetGpio -.unreq pinNum -.unreq pinVal -``` - -This code uses SetGpio to turn off GPIO pin 16, thus turning on the OK LED. If we instead used mov pinVal,#1, it would turn the LED off. Replace your old code to turn the LED off with that. - -### 6 Onwards - -Hopefully now, you should be able to test what you have made on the Raspberry Pi. We've done a large amount of code this time, so there is a lot that can go wrong. If it does, head to the troubleshooting page. - -When you get it working, congratulations. Although our operating system does nothing more than it did in [Lesson 2: OK02][1], we've learned a lot about functions and formatting, and we can now code new features much more quickly. It would be very simple now to make an Operating System that alters any GPIO register, which could be used to control hardware! - -In [Lesson 4: OK04][6], we will address our wait function, which is currently imprecise, so that we can gain better control over our LED, and ultimately over all of the GPIO pins. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html - -作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.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 -[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/osLayout.png -[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html 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 new file mode 100644 index 0000000000..21cdb40c2f --- /dev/null +++ b/translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md @@ -0,0 +1,383 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: 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 +====== + +OK03 课程基于 OK02 课程来构建,它教你在汇编中如何使用函数让代码可复用和可读性更好。假设你已经有了 [课程 2:OK02][1] 的操作系统,我们将以它为基础。 + +### 1、可复用的代码 + +到目前为止,我们所写的代码都是以我们希望发生的事为顺序来输入的。对于非常小的程序来说,这种做法很好,但是如果我们以这种方式去写一个完整的系统,所写的代码可读性将非常差。我们应该去使用函数。 + +``` +一个函数是一段可复用的代码片断,可以用于去计算某些答案,或执行某些动作。你也可以称它们为程序、整套动作或子动作。虽然它们都是不同的,但人们几乎都没有正确地使用这个术语。 + +你应该在数学上遇到了函数的概念。例如,余弦函数应用于一个给定的数时,会得到介于 -1 到 1 之间的另一个数,这个数就是角的余弦。一般我们写成 cos(x) 来表示应用到一个值 x 上的余弦函数。 + +在代码中,函数可以有多个输入(也可以没有输入),然后函数给出多个输出(也可以没有输出),并可能导致负面效应。例如一个函数可以在一个文件系统上创建一个文件,第一个输入是它的名字,第二个输入是文件的长度。 +``` + +![Function as black boxes][2] + +``` +函数可以认为是一个“黑匣子”。我们给它输入,然后它给我们输出,而我们不需要知道它是如何工作的。 +``` + +在像 C 或 C++ 这样的高级代码中,函数是语言的组成部分。在汇编代码中,函数只是我们的创意。 + +理想情况下,我们希望能够在我们的寄存器中设置一些值,分支地址,以及预期在某个时刻,分支将返回,并通过代码来设置输出值到寄存器。这就是我们所设想的汇编代码中的函数。困难之处在于我们用什么样的方式去设置寄存器。如果我们只是使用平时所接触到的任意方法去设置寄存器,每个程序可能使用不同的方法,这样你将会发现你很难理解其他程序员所写的代码。另外,编译器也不能像使用汇编代码那样轻松地工作,因为它们压根不知道如何去使用函数。为避免这种困惑,为每个汇编语言设计了一个称为应用程序二进制接口(ABI)的标准,由它来规范函数如何去运行。如果每个人都使用相同的方法去写函数,这样每个人都可以去使用其他人写的函数。在这里,我将教你们这个标准,而从现在开始,我所写的函数将全部遵循这个标准。 + +标准规定,寄存器 `r0`、`r1`、`r2` 和 `r3` 将被依此用于函数的输入。如果函数没有输入,那么它有没有值就无关紧要了。如果只需要一个输入,那么它应该总是在寄存器 `r0` 中,如果它需要两个输入,那么第一个输入在寄存器 `r0` 中,而第二个输入在寄存器 `r1` 中,依此类推。输出值也总是在寄存器 `r0` 中。如果函数没有输出,那么 `ro` 中是什么值就不重要了。 + +另外,标准要求当一个函数运行之后,寄存器 `r4` 到 `r12` 的值必须与函数启动时的值相同。这意味着当你调用一个函数时,你可以确保寄存器 `r4` 到 `r12` 中的值没有发生变化,但是不能确保寄存器 `r0` 到 `r3` 中的值也没有发生变化。 + +当一个函数运行完成后,它将返回到启动它的代码分支处。这意味着它必须知道启动它的代码的地址。为此,需要一个称为`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 是栈指针,在下面有详细描述。它的值在函数运行完成后,必须是相同的。 | + +通常,函数需要使用很多的寄存器,而不仅是 `r0` 到 `r3`。但是,由于 `r4` 到 `r12` 必须在系列动作完成之后值必须保持相同,因此它们需要被保存到某个地方。我们将它们保存到称为栈的地方。 + + +![Stack diagram][3] +``` +一个栈就是我们在计算中用来保存值的一个很形象的方法。就像是摞起来的一堆盘子,你可以从上到下来移除它们,而添加它们时,你只能从下到上来添加。 + +在函数运行时,使用栈来保存寄存器值是个非常好的创意。例如,如果我有一个函数需要去使用寄存器 r4 和 r5,它将在一个栈上存放这些寄存器的值。最后用这种方式,它可以再次将它拿回来。更高明的是,如果为完成运行我的函数,需要去运行另一个函数,并且那个函数需要保存一些寄存器,在它运行时,它将把寄存器保存在栈顶上,然后在结束后再将它们拿走。而这并不会影响我保存在寄存器 r4 和 r5 中的值,因为它们是在栈顶上添加的,拿走时也是从栈顶上取出的。 + +我们用专用的术语“栈帧”来表示使用特定的方法放到栈上的值。不是每种方法都使用一个栈帧,有些是不需要存储值的。 +``` + +因为栈非常有用,它被直接实现在 ARMv6 的指令集中。一个名为 `sp` (栈指针)的专用寄存器用来保存栈的地址。当需要有东西添加到栈上时,`sp` 寄存器被更新,这样就总是保证它保存的是栈上前一个东西的地址。`push {r4,r5}` 将推送 `r4` 和 `r5` 中的值到栈顶上,而 `pop {r4,r5}` 将(以正确的次序)取回它们。 + +### 2、我们的第一个函数 + +现在,关于函数的原理我们已经有了一些概念,我们尝试来写一个函数。由于是我们的第一个很基础的例子,我们写一个没有输入的函数,它将输出 GPIO 的地址。在上一节课程中,我们就是写到这个值上,但将它写成函数更好,因为我们在真实的操作系统中经常需要用到它,而我们不可能总是能够记住这个地址。 + +复制下列代码到一个名为 `gpio.s` 的新文件中。就像在`source` 目录中使用的 `main.s` 一样。我们将把与 GPIO 控制器相关的所有函数放到一个文件中,这样更好查找。 + +```assembly +.globl GetGpioAddress +GetGpioAddress: +ldr r0,=0x20200000 +mov pc,lr +``` + +```assembly +.globl lbl 使标签 lbl 从其它文件中可访问。 + +mov reg1,reg2 复制 reg2 中的值到 reg1 中。 +``` + +这就是一个很简单的完整的函数。`.globl GetGpioAddress` 命令是通知汇编器,让标签 `GetGpioAddress` 在所有文件中全局可访问。这意味着在我们的 `main.s` 文件中,我们可以使用分支指令到标签 `GetGpioAddress` 上,即便这个标签在那个文件中没有定义也没有问题。 + +你应该认得 `ldr r0,=0x20200000` 命令,它将 GPIO 控制器地址保存到 r0 中。由于这是一个函数,我们要让它输出寄存器 `r0` 中的值,因此我们不能再像以前那样随意使用任意一个寄存器了。 + +`mov pc,lr` 将寄存器 `lr` 中的值复制到 `pc` 中。正如前面所提到的,寄存器 `lr` 总是保存着方法完成后我们要返回的代码的地址。`pc` 是一个专用寄存器,它总是包含下一个要运行的指令的地址。一个普通的分支命令只需要改变这个寄存器的值即可。通过将 `lr` 中的值复制到 `pc` 中,我们就可以将运行的下一行命令改变成我们将要返回的那一行。 + +现在这里存在一个合乎常理的问题,那就是我们如何去运行这个代码?我们将需要一个特殊的分支类型 `bl`。它像一个普通的分支一样切换到一个标签,但它在切换之前先更新 `lr` 的值去包含一个分支之后的行的地址。这意味着当函数完成后,将返回到 `bl` 命令之后的那一行上。这就确保了函数能够像任何其它命令那样运行,它简单地运行,做任何需要做的事情,然后推进到下一行。这是函数最有用的方法。当我们使用它时,就将它们按“黑匣子”处理即可,不需要了解它是如何运行的,我们只了解它需要什么输入,以及它给我们什么输出即可。 + +到现在为止,我们已经明白了函数如何使用,下一节我们将使用它。 + +### 3、一个大的函数 + +现在,我们继续去实现一个更大的函数。我们的第一项任务是启用 GPIO 第 16 号针脚的输出。如果它是一个函数那就太好了。我们能够简单地指定针脚号作为函数的输入,然后函数将设置那个针脚的值。那样,我们就可以使用这个代码去控制任意的 GPIO 针脚,而不只是 LED 了。 + +将下列的命令复制到 `gpio.s` 文件中的 GetGpioAddress 函数中。 + +```assembly +.globl SetGpioFunction +SetGpioFunction: +cmp r0,#53 +cmpls r1,#7 +movhi pc,lr +``` + +``` +带后缀 ls 的命令只有在上一个比较命令的结果是第一个数字小于或等于第二个数字的情况下才会被运行。它是无符号的。 + +带后缀 hi 的命令只有上一个比较命令的结果是第一个数字大于第二个数字的情况下才会被运行。它是无符号的。 +``` + +在写一个函数时,我们首先要考虑的事情就是输入,如果输入错了我们怎么办?在这个函数中,我们有一个输入是 GPIO 针脚号,而它必须是介于 0 到 53 之间的数字,因为只有 54 个针脚。每个针脚有 8 个函数,被编号为 0 到 7,因此函数代码也必须是 0 到 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。 + +`ls`(低于或相同)与 `le`(小于或等于)有一些细微的差别,以及后缀 `hi` (高于)和 `gt` (大于)也一样有一些细微差别,我们在后面将会讲到。 + +将这些命令复制到上面的代码的下面位置。 + +```assembly +push {lr} +mov r2,r0 +bl GetGpioAddress +``` + +```assembly +push {reg1,reg2,...} 复制列出的寄存器 reg1、reg2、... 到栈顶。该命令仅能用于通用寄存器和 lr 寄存器。 + +bl lbl sets lr 设置下一个指令的地址并切换到标签 lbl。 +``` + +这三个命令用于调用我们第一个方法。`push {lr}` 命令复制 `lr` 中的值到栈顶,这样我们在后面可以检索到它。当我们调用 GetGpioAddress 时必须要这样做,我们将需要使用 `lr` 去保存我们函数的返回地址。 + +如果我们对 `GetGpioAddress` 函数一无所知,我们应该假设它改变了 `r0`、`r1`、`r2` 和 `r3` 的值 ,我们将移动我们的值到 r4 和 r5 中,以保持在它完成之后寄存器的值相同。幸运的是,我们知道 `GetGpioAddress` 做了什么,并且我们也知道它仅改变了 `r0` 到地址,它并没有影响 `r1`、`r2` 或 `r3` 的值。因此,我们仅去将 GPIO 针脚号从 `r0` 中移出,这样它就不会被覆盖掉,但我们知道,可以将它安全地移到 `r2` 中,因为 `GetGpioAddress` 并不去改变 `r2`。 + +最后我们使用 `bl` 指令去运行 `GetGpioAddress`。通常,运行一个函数,我们使用一个术语叫“调用”,从现在开始我们将一直使用这个术语。正如我们前面讨论过的,`bl` 通过更新 `lr` 中的下一个指令的地址,去调用一个函数,接着切换到函数。 + +当一个函数结束时,我们称为“返回”。当一个 `GetGpioAddress` 调用返回时,我们已经知道了 `r0` 中包含了 GPIO 的地址,`r1` 中包含了函数代码,而 `r2` 中包含了 GPIO 针脚号。我前面说过,GPIO 函数每 10 个保存在一个块中,因此首先我们需要去判断我们的针脚在哪个块中。这似乎听起来像是要使用一个除法,但是除法做起来非常慢,因此对于这些比较小的数来说,不停地做减法要比除法更好。 + +将下面的代码复制到上面的代码中最下面的位置。 + +```assembly +functionLoop$: + +cmp r2,#9 +subhi r2,#10 +addhi r0,#4 +bhi functionLoop$ +``` + +```assembly +add reg,#val 将数字 val 加到寄存器 reg 的内容上。 +``` + +这个简单的循环代码将针脚号与 9 进行比较。如果它大于 9,它将从针脚号上减去 10,并且将 GPIO 控制器地址加上 4,然后再次运行检查。 + +这样做的效果就是,现在,`r2` 中将包含一个 0 到 9 之间的数字,它是针脚号除以 9 的余数。`r0` 将包含这个针脚的函数所设置的 GPIO 控制器的地址。它就如同是 “GPIO 控制器地址 + 4 × (GPIO Pin Number ÷ 10)”。 + +最后,将下面的代码复制到上面的代码中最下面的位置。 + +```assembly +add r2, r2,lsl #1 +lsl r1,r2 +str r1,[r0] +pop {pc} +``` + +```assembly +移位参数 reg,lsl #val 表示将寄存器 reg 中二进制表示的数逻辑左移 val 位之后的结果作为与前面运算的操作数。 + +lsl reg,amt 将寄存器 reg 中的二进制数逻辑左移 amt 中的位数。 + +str reg,[dst] 与 str reg,[dst,#0] 相同。 + +pop {reg1,reg2,...} 从栈顶复制值到寄存器列表 reg1、reg2、.... 仅有通用寄存器与 pc 可以这样弹出值。 +``` + +这个代码完成了这个方法。第一行其实是乘以 3 的变体。乘法在汇编中是一个大而慢的指令,因为电路需要很长时间才能给出答案。有时使用一些能够很快给出答案的指令会让它变得更快。在本案例中,我们知道 r2 × 3 与 r2 × 2 + r2 是相同的。一个寄存器乘以 2 是非常容易的,因为它可以通过将二进制表示的数左移一位来很方便地实现。 + +ARMv6 汇编语言其中一个非常有用的特性就是,在使用它之前可以先移动参数所表示的位数。在本案例中,我将 `r2` 加上 `r2` 中二进制表示的数左移一位的结果。在汇编代码中,你可以经常使用这个技巧去更快更容易地计算出答案,但如果你觉得这个技巧使用起来不方便,你也可以写成类似 `mov r3,r2`; `add r2,r3`; `add r2,r3` 这样的代码。 + +现在,我们可以将一个函数的值左移 `r2` 中所表示的位数。大多数对数量的指令(比如加法和减法)都有一个可以使用寄存器而不是数字的变体。我们执行这个移位是因为我们想去设置表示针脚号的位,并且每个针脚有三个位。 + +然后,我们将函数计算后的值保存到 GPIO 控制器的地址上。我们在循环中已经算出了那个地址,因此我们不需要像 OK01 和 OK02 中那样在一个偏移量上保存它。 + +最后,我们从这个方法调用中返回。由于我们将 `lr` 推送到了栈上,因此我们 `pop pc`,它将复制 `lr` 中的值并将它推送到 `pc` 中。这个操作类似于 `mov pc,lr`,因此函数调用将返回到运行它的那一行上。 + +敏锐的人可能会注意到,这个函数其实并不能正确工作。虽然它将 GPIO 针脚函数设置为所要求的值,但它会导致在同一个块中的 10 个函数的所有针脚都归 0!在一个大量使用 GPIO 针脚的系统中,这将是一个很恼人的问题。我将这个问题留给有兴趣去修复这个函数的人,以确保只设置相关的 3 个位而不去覆写其它位,其它的所有位都保持不变。关于这个问题的解决方案可以在本课程的下载页面上找到。你可能会发现非常有用的几个函数是 `and`,它是计算两个寄存器的布尔与函数,`mvns` 是计算布尔非函数,而 `orr` 是计算布尔或函数。 + +### 4、另一个函数 + +现在,我们已经有了能够设置 GPIO 针脚的函数。我们还需要写一个能够打开或关闭 GPIO 针脚的函数。我们不需要写一个打开的函数和一个关闭的函数,只需要一个函数就可以做这两件事情。 + +我们将写一个名为 `SetGpio` 的函数,它用 `r0` 中的值作为第一个输入,`r1` 中的值作为第二个输入。如果值为 `0`,我们将关闭针脚,而如果为非零则打开针脚。 + +将下列的代码复制粘贴到 `gpio.s` 文件的结尾部分。 + +```assembly +.globl SetGpio +SetGpio: +pinNum .req r0 +pinVal .req r1 +``` + +```assembly +alias .req reg 设置寄存器 reg 的别名为 alias。 +``` + +我们再次需要 `.globl` 命令,标记它为其它文件可访问的全局函数。这次我们将使用寄存器别名。寄存器别名允许我们为寄存器使用名字而不仅是 `r0` 或 `r1`。到目前为止,寄存器别名还不是很重要,但随着我们后面写的方法越来越大,它将被证明非常有用,现在开始我们将尝试使用别名。当在指令中使用到 `pinNum .req r0` 时,它的意思是 `pinNum` 表示 `r0`。 + +将下面的代码复制粘贴到上述的代码下面位置。 + +```assembly +cmp pinNum,#53 +movhi pc,lr +push {lr} +mov r2,pinNum +.unreq pinNum +pinNum .req r2 +bl GetGpioAddress +gpioAddr .req r0 +``` + +```assembly +.unreq alias 删除别名 alias。 +``` + +就像在函数 `SetGpio` 中所做的第一件事情是检查给定的针脚号是否有效一样。我们需要同样的方式去将 `pinNum (r0)` 与 53 进行比较,如果它大于 53 将立即返回。一旦我们再次调用 `GetGpioAddress`,我们就需要将 `lr`推送到栈上来保护它,将将 `pinNum` 移动到 `r2` 中。然后我们使用 `.unreq` 语句来删除我们给 `r0` 定义的别名。因为针脚号现在保存在寄存器 `r2` 中,我们希望通过别名能够映射到它,因此我们重新定义到 `r2` 的别名。你应该每次在别名使用结束后,立即删除它,这样当它不再存在时,你就不会在后面的代码中因它而产生错误。 + +然后,我们调用了 `GetGpioAddress`,并且我们创建了一个指向 `r0`的别名。 + +将下面的代码复制粘贴到上述代码的后面位置。 + +```assembly +pinBank .req r3 +lsr pinBank,pinNum,#5a +lsl pinBank,#2 +add gpioAddr,pinBank +.unreq pinBank +``` + +```assembly +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 时却不会这样。 + +现在,`gpioAddr` 的结果有可能是 20200000~16~(如果针脚号介于 0 到 31 之间),也有可能是 20200004~16~(如果针脚号介于 32 到 53 之间)。这意味着如果加上 28~10~ ,我们将得到打开针脚的地址,而如果加上 40~10~ ,我们将得到关闭针脚的地址。由于我们使用了 `pinBank` ,所以在它之后立即使用 `.unreq` 去删除它。、 + +将下面的代码复制粘贴到上述代码的下面位置。 + +```assembly +and pinNum,#31 +setBit .req r3 +mov setBit,#1 +lsl setBit,pinNum +.unreq pinNum +``` + +```assembly +and reg,#val 计算寄存器中的数与 val 的布尔与。 +``` + +函数的下一个部分是产生一个正确的设置数的位。至于 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 并不是巧合。 + +![binary division example][4] + +代码的其余部分使用这个值去左移 1 位。这就有了创建我们所需要的二进制数的效果。 + +将下面的代码复制粘贴到上述代码的下面位置。 + +```assembly +teq pinVal,#0 +.unreq pinVal +streq setBit,[gpioAddr,#40] +strne setBit,[gpioAddr,#28] +.unreq setBit +.unreq gpioAddr +pop {pc} +``` + +```assembly +teq reg,#val 检查寄存器 reg 中的数字与 val 是否相等。 +``` + +这个代码是方法的结束部分。如前面所说,当 `pinVal` 为 0 时,我们关闭它,否则就打开它。`teq`(等于测试)是另一个比较操作,它仅能够测试是否相等。它类似于 `cmp` ,但它并不能算出哪个数大。如果你只是希望测试数字是否相同,你可以使用 `teq`。 + +如果 `pinVal` 是 0,我们将 `setBit` 保存在 GPIO 地址偏移 40 的位置,我们已经知道,这样会关闭那个针脚。否则将它保存在 GPIO 地址偏移 28 的位置,它将打开那个针脚。最后,我们通过弹出 `pc` 返回,这将设置它为我们推送链接寄存器时保存的值。 + +### 5、一个新的开始 + +在完成上述工作后,我们终于有了我们的 GPIO 函数。现在,我们需要去修改 `main.s` 去使用它们。因为 `main.s` 现在已经有点大了,也更复杂了。将它分成两节将是一个很好的设计。到目前为止,我们一直使用的 `.init` 应该尽可能的让它保持小。我们可以更改代码来很容易地反映出这一点。 + +将下列的代码插入到 `main.s` 文件中 `_start: ` 的后面: + +``` +b main + +.section .text +main: +mov sp,#0x8000 +``` + +在这里重要的改变是引入了 `.text` 节。我设计了 `makefile` 和链接器脚本,它将 `.text` 节(它是默认节)中的代码放在地址为 8000~16~ 的 `.init` 节之后。这是默认加载地址,并且它给我们提供了一些空间去保存栈。由于栈存在于内存中,它也有一个地址。栈向下增长内存,因此每个新值都低于前一个地址,所以,这便得栈顶是最低的一个地址。 + +``` +图中的 'ATAGs' 节的位置保存了有关树莓派的信息,比如它有多少内存,默认屏幕分辨率是多少。 +``` + +![Layout diagram of operating system][5] + +用下面的代码替换掉所有设置 GPIO 函数针脚的代码: + +```assembly +pinNum .req r0 +pinFunc .req r1 +mov pinNum,#16 +mov pinFunc,#1 +bl SetGpioFunction +.unreq pinNum +.unreq pinFunc +``` + +这个代码将使用针脚号 16 和函数代码 1 去调用 `SetGpioFunction`。它的效果就是启用了 OK LED 灯的输出。 + +用下面的代码去替换打开 OK LED 灯的代码: + +```assembly +pinNum .req r0 +pinVal .req r1 +mov pinNum,#16 +mov pinVal,#0 +bl SetGpio +.unreq pinNum +.unreq pinVal +``` + +这个代码使用 `SetGpio` 去关闭 GPIO 第 16 号针脚,因此将打开 OK LED。如果我们(将第 4 行)替换成 `mov pinVal,#1` 它将关闭 LED 灯。用以上的代码去替换掉你关闭 LED 灯的旧代码。 + +### 6、继续向目标前进 + +但愿你能够顺利地在你的树莓派上测试我们所做的这一切。到目前为止,我们已经写了一大段代码,因此不可避免会出现错误。如果有错误,可以去查看我们的排错页面。 + +如果你的代码已经正常工作,恭喜你。虽然我们的操作系统除了做 [课程 2:OK02][1] 中的事情之外,还做不了别的任何事情,但我们已经学会了函数和格式有关的知识,并且我们现在可以更好更快地编写新特性了。现在,我们在操作系统上修改 GPIO 寄存器将变得非常简单,而它就是用于控制硬件的! + +在 [课程 4:OK04][6] 中,我们将处理我们的 `wait` 函数,目前,它的时间控制还不精确,这样我们就可以更好地控制我们的 LED 灯了,进而最终控制所有的 GPIO 针脚。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [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 +[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 +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/osLayout.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html From 48206d797bbe65ec9d8a6b646f7074617a4ecb30 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 3 Feb 2019 21:30:57 +0800 Subject: [PATCH 0947/4278] PRF:20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md @MjSeven --- ...lable On Your Linux Distribution Or Not.md | 277 +++++++++--------- 1 file changed, 140 insertions(+), 137 deletions(-) diff --git a/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md b/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md index 4f6a2dbe35..c1490ee980 100644 --- a/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md +++ b/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md @@ -1,38 +1,33 @@ 如何搜索一个包是否在你的 Linux 发行版中 ====== + 如果你知道包名称,那么你可以直接安装所需的包。 -在某些情况下,如果你不知道确切的包名称或者你想搜索某些包,那么你可以在分发包管理器的帮助下轻松搜索该包。 +在某些情况下,如果你不知道确切的包名称或者你想搜索某些包,那么你可以在发行版的包管理器的帮助下轻松搜索该包。搜索会自动包括已安装和可用的包。结果的格式取决于选项。如果你的查询没有输出任何信息,那么意味着没有匹配条件的包。这可以通过发行版的包管理器的各种选项来完成。我已经在本文中添加了所有可能的选项,你可以选择最好的和最合适你的选项。 -自动搜索包括已安装和可用的包。 +或者,我们可以通过 `whohas` 命令实现这一点。它会从所有的主流发行版(例如 Debian、Ubuntu、 Fedora 等)中搜索,而不仅仅是你自己的系统发行版。 -结果的格式取决于选项。如果查询没有生成任何信息,那么意味着没有匹配条件的包。 +建议阅读: -这可以通过具有各种选项的分发包管理器来完成。 - -我已经在本文中添加了所有可能的选项,你可以选择最好的和最合适你的选项。 - -或者,我们可以通过 **whohas** 命令实现这一点。它会从所有的主流发行版(例如 Debian, Ubuntu, Fedora 等)中搜索,而不仅仅是你自己的系统发行版。 - -**建议阅读:** -**(#)** [适用于 Linux 的命令行包管理器列表以及用法][1] -**(#)** [Linux 包管理器的图形前端工具][2] +- [适用于 Linux 的命令行包管理器列表以及用法][1] +- [Linux 包管理器的图形前端工具][2] ### 如何在 Debian/Ubuntu 中搜索一个包 -我们可以使用 apt, apt-cache 和 aptitude 包管理器在基于 Debian 的发行版上查找给定的包。我为这个包管理器中包括了大量的选项。 +我们可以使用 `apt`、`apt-cache` 和 `aptitude` 包管理器在基于 Debian 的发行版上查找给定的包。我为这个包管理器中包括了大量的选项。 我们可以在基于 Debian 的系统中使用三种方式完成此操作。 - * apt 命令 - * apt-cache 命令 - * aptitude 命令 + * `apt` 命令 + * `apt-cache` 命令 + * `aptitude` 命令 -### 如何使用 apt 命令搜索一个包 +#### 如何使用 apt 命令搜索一个包 -APT 代表高级包管理工具 Advanced Packaging Tool(APT),它取代了 apt-get。它有功能丰富的命令行工具,包括所有功能包含在一个命令(APT)里,包括 apt-cache, apt-search, dpkg, apt-cdrom, apt-config, apt-key 等,还有其他几个独特的功能。 +APT 代表高级包管理工具Advanced Packaging Tool(APT),它取代了 `apt-get`。它有功能丰富的命令行工具,包括所有功能包含在一个命令(`apt`)里,包括 `apt-cache`、`apt-search`、`dpkg`、`apt-cdrom`、`apt-config`、`apt-key` 等,还有其他几个独特的功能。 + +APT 是一个强大的命令行工具,它可以访问 libapt-pkg 底层库的所有特性,它可以用于安装、下载、删除、搜索和管理以及查询包的信息,另外它还包含一些较少使用的与包管理相关的命令行实用程序。 -APT 是一个强大的命令行工具,它可以访问 libapt-pkg 底层库的所有特性,它可以用于安装,下载,删除,搜索和管理以及查询关于包的信息,另外它还包含一些较少使用的与包管理相关的命令行实用程序。 ``` $ apt -q list nano vlc Listing... @@ -41,33 +36,34 @@ vlc/artful 2.2.6-6 amd64 ``` 或者,我们可以使用以下格式搜索指定的包。 + ``` $ apt search ^vlc Sorting... Done Full Text Search... Done vlc/artful 2.2.6-6 amd64 - multimedia player and streamer + multimedia player and streamer vlc-bin/artful 2.2.6-6 amd64 - binaries from VLC + binaries from VLC vlc-data/artful,artful 2.2.6-6 all - Common data for VLC + Common data for VLC vlc-l10n/artful,artful 2.2.6-6 all - Translations for VLC + Translations for VLC vlc-plugin-access-extra/artful 2.2.6-6 amd64 - multimedia player and streamer (extra access plugins) + multimedia player and streamer (extra access plugins) vlc-plugin-base/artful 2.2.6-6 amd64 - multimedia player and streamer (base plugins) - + multimedia player and streamer (base plugins) ``` -### 如何使用 apt-cache 命令搜索一个包 +#### 如何使用 apt-cache 命令搜索一个包 + +`apt-cache` 会在 APT 的包缓存上执行各种操作。它会显示有关指定包的信息。`apt-cache` 不会改变系统的状态,但提供了从包的元数据中搜索和生成有趣输出的操作。 -apt-cache 会在 APT 的包缓存上执行各种操作。它会显示有关指定包的信息。apt-cache 不会操纵系统的状态,但提供了从包的元数据中搜索和生成有趣输出的操作。 ``` $ apt-cache search nano | grep ^nano nano - small, friendly text editor inspired by Pico @@ -78,22 +74,22 @@ nanoc - static site generator written in Ruby nanoc-doc - static site generator written in Ruby - documentation nanomsg-utils - nanomsg utilities nanopolish - consensus caller for nanopore sequencing data - ``` 或者,我们可以使用以下格式搜索指定的包。 + ``` $ apt-cache policy vlc vlc: - Installed: (none) - Candidate: 2.2.6-6 - Version table: - 2.2.6-6 500 - 500 http://in.archive.ubuntu.com/ubuntu artful/universe amd64 Packages - + Installed: (none) + Candidate: 2.2.6-6 + Version table: + 2.2.6-6 500 + 500 http://in.archive.ubuntu.com/ubuntu artful/universe amd64 Packages ``` 或者,我们可以使用以下格式搜索给定的包。 + ``` $ apt-cache pkgnames vlc vlc-bin @@ -115,57 +111,57 @@ vlc vlc-data vlc-plugin-video-splitter vlc-plugin-base - ``` -### 如何使用 aptitude 命令搜索一个包 +#### 如何使用 aptitude 命令搜索一个包 + +`aptitude` 是一个基于文本的 Debian GNU/Linux 软件包系统的命令行界面。它允许用户查看包列表,并执行包管理任务,例如安装、升级和删除包,它可以从可视化界面或命令行执行操作。 -aptitude 一个基于文本的 Debian GNU/Linux 软件包系统的接口。它允许用户查看包列表,并执行包管理任务,例如安装,升级和删除包,它可以从可视化界面或命令行执行操作。 ``` $ aptitude search ^vlc -p vlc - multimedia player and streamer -p vlc:i386 - multimedia player and streamer -p vlc-bin - binaries from VLC -p vlc-bin:i386 - binaries from VLC -p vlc-data - Common data for VLC -v vlc-data:i386 - -p vlc-l10n - Translations for VLC -v vlc-l10n:i386 - -p vlc-plugin-access-extra - multimedia player and streamer (extra access plugins) -p vlc-plugin-access-extra:i386 - multimedia player and streamer (extra access plugins) -p vlc-plugin-base - multimedia player and streamer (base plugins) -p vlc-plugin-base:i386 - multimedia player and streamer (base plugins) -p vlc-plugin-fluidsynth - FluidSynth plugin for VLC -p vlc-plugin-fluidsynth:i386 - FluidSynth plugin for VLC -p vlc-plugin-jack - Jack audio plugins for VLC -p vlc-plugin-jack:i386 - Jack audio plugins for VLC -p vlc-plugin-notify - LibNotify plugin for VLC -p vlc-plugin-notify:i386 - LibNotify plugin for VLC -p vlc-plugin-qt - multimedia player and streamer (Qt plugin) -p vlc-plugin-qt:i386 - multimedia player and streamer (Qt plugin) -p vlc-plugin-samba - Samba plugin for VLC -p vlc-plugin-samba:i386 - Samba plugin for VLC -p vlc-plugin-sdl - SDL video and audio output plugin for VLC -p vlc-plugin-sdl:i386 - SDL video and audio output plugin for VLC -p vlc-plugin-skins2 - multimedia player and streamer (Skins2 plugin) -p vlc-plugin-skins2:i386 - multimedia player and streamer (Skins2 plugin) -p vlc-plugin-svg - SVG plugin for VLC -p vlc-plugin-svg:i386 - SVG plugin for VLC -p vlc-plugin-video-output - multimedia player and streamer (video output plugins) -p vlc-plugin-video-output:i386 - multimedia player and streamer (video output plugins) -p vlc-plugin-video-splitter - multimedia player and streamer (video splitter plugins) -p vlc-plugin-video-splitter:i386 - multimedia player and streamer (video splitter plugins) -p vlc-plugin-visualization - multimedia player and streamer (visualization plugins) -p vlc-plugin-visualization:i386 - multimedia player and streamer (visualization plugins) -p vlc-plugin-vlsub - VLC extension to download subtitles from opensubtitles.org -p vlc-plugin-zvbi - VBI teletext plugin for VLC -p vlc-plugin-zvbi:i386 - +p vlc - multimedia player and streamer +p vlc:i386 - multimedia player and streamer +p vlc-bin - binaries from VLC +p vlc-bin:i386 - binaries from VLC +p vlc-data - Common data for VLC +v vlc-data:i386 - +p vlc-l10n - Translations for VLC +v vlc-l10n:i386 - +p vlc-plugin-access-extra - multimedia player and streamer (extra access plugins) +p vlc-plugin-access-extra:i386 - multimedia player and streamer (extra access plugins) +p vlc-plugin-base - multimedia player and streamer (base plugins) +p vlc-plugin-base:i386 - multimedia player and streamer (base plugins) +p vlc-plugin-fluidsynth - FluidSynth plugin for VLC +p vlc-plugin-fluidsynth:i386 - FluidSynth plugin for VLC +p vlc-plugin-jack - Jack audio plugins for VLC +p vlc-plugin-jack:i386 - Jack audio plugins for VLC +p vlc-plugin-notify - LibNotify plugin for VLC +p vlc-plugin-notify:i386 - LibNotify plugin for VLC +p vlc-plugin-qt - multimedia player and streamer (Qt plugin) +p vlc-plugin-qt:i386 - multimedia player and streamer (Qt plugin) +p vlc-plugin-samba - Samba plugin for VLC +p vlc-plugin-samba:i386 - Samba plugin for VLC +p vlc-plugin-sdl - SDL video and audio output plugin for VLC +p vlc-plugin-sdl:i386 - SDL video and audio output plugin for VLC +p vlc-plugin-skins2 - multimedia player and streamer (Skins2 plugin) +p vlc-plugin-skins2:i386 - multimedia player and streamer (Skins2 plugin) +p vlc-plugin-svg - SVG plugin for VLC +p vlc-plugin-svg:i386 - SVG plugin for VLC +p vlc-plugin-video-output - multimedia player and streamer (video output plugins) +p vlc-plugin-video-output:i386 - multimedia player and streamer (video output plugins) +p vlc-plugin-video-splitter - multimedia player and streamer (video splitter plugins) +p vlc-plugin-video-splitter:i386 - multimedia player and streamer (video splitter plugins) +p vlc-plugin-visualization - multimedia player and streamer (visualization plugins) +p vlc-plugin-visualization:i386 - multimedia player and streamer (visualization plugins) +p vlc-plugin-vlsub - VLC extension to download subtitles from opensubtitles.org +p vlc-plugin-zvbi - VBI teletext plugin for VLC +p vlc-plugin-zvbi:i386 ``` ### 如何在 RHEL/CentOS 中搜索一个包 -Yum(Yellowdog Updater Modified)是 Linux 操作系统中的包管理器实用程序之一。Yum 命令用于在一些基于 RedHat 的 Linux 发行版上,它用来安装,更新,搜索和删除软件包。 +Yum(Yellowdog Updater Modified)是 Linux 操作系统中的包管理器实用程序之一。Yum 命令用于在一些基于 RedHat 的 Linux 发行版上,它用来安装、更新、搜索和删除软件包。 + ``` # yum search ftpd Loaded plugins: fastestmirror, refresh-packagekit, security @@ -180,21 +176,22 @@ nordugrid-arc-gridftpd.x86_64 : ARC gridftp server pure-ftpd.x86_64 : Lightweight, fast and secure FTP server vsftpd.x86_64 : Very Secure Ftp Daemon - Name and summary matches only, use "search all" for everything. - + Name and summary matches only, use "search all" for everything. ``` 或者,我们可以使用以下命令搜索相同内容。 + ``` # yum list ftpd ``` ### 如何在 Fedora 中搜索一个包 -DNF 代表 Dandified yum。我们可以说 DNF 是下一代 yum 包管理器(Yum 的衍生),它使用 hawkey/libsolv 库作为底层。自从 Fedora 18 开始以及它最终在 Fedora 22 中实施以来,Aleš Kozumplík 就在开始研究 DNF。 +DNF 代表 Dandified yum。我们可以说 DNF 是下一代 yum 包管理器(Yum 的衍生品),它使用 hawkey/libsolv 库作为底层。Aleš Kozumplík 从 Fedora 18 开始开发 DNF,最终在 Fedora 22 中发布。 + ``` # dnf search ftpd -Last metadata expiration check performed 0:42:28 ago on Tue Jun 9 22:52:44 2018. +Last metadata expiration check performed 0:42:28 ago on Tue Jun 9 22:52:44 2018. ============================== N/S Matched: ftpd =============================== proftpd-utils.x86_64 : ProFTPD - Additional utilities pure-ftpd-selinux.x86_64 : SELinux support for Pure-FTPD @@ -203,7 +200,7 @@ proftpd-devel.x86_64 : ProFTPD - Tools and header files for developers proftpd-ldap.x86_64 : Module to add LDAP support to the ProFTPD FTP server proftpd-mysql.x86_64 : Module to add MySQL support to the ProFTPD FTP server proftpd-postgresql.x86_64 : Module to add PostgreSQL support to the ProFTPD FTP - : server + : server vsftpd.x86_64 : Very Secure Ftp Daemon proftpd.x86_64 : Flexible, stable and highly-configurable FTP server owfs-ftpd.x86_64 : FTP daemon providing access to 1-Wire networks @@ -214,6 +211,7 @@ nordugrid-arc-gridftpd.x86_64 : ARC gridftp server ``` 或者,我们可以使用以下命令搜索相同的内容。 + ``` # dnf list proftpd Failed to synchronize cache for repo 'heikoada-terminix', disabling. @@ -224,100 +222,105 @@ proftpd.x86_64 ### 如何在 Arch Linux 中搜索一个包 -pacman 代表包管理实用程序(pacman)。它是一个用于安装,构建,删除和管理 Arch Linux 软件包的命令行实用程序。pacman 使用 libalpm(Arch Linux Package Management(ALPM)库)作为底层来执行所有操作。 +pacman 代表包管理实用程序(pacman)。它是一个用于安装、构建、删除和管理 Arch Linux 软件包的命令行实用程序。pacman 使用 libalpm(Arch Linux Package Management(ALPM)库)作为底层来执行所有操作。 在本例中,我将要搜索 chromium 包。 + ``` # pacman -Ss chromium extra/chromium 48.0.2564.116-1 - The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browser + The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browser extra/qt5-webengine 5.5.1-9 (qt qt5) - Provides support for web applications using the Chromium browser project + Provides support for web applications using the Chromium browser project community/chromium-bsu 0.9.15.1-2 - A fast paced top scrolling shooter + A fast paced top scrolling shooter community/chromium-chromevox latest-1 - Causes the Chromium web browser to automatically install and update the ChromeVox screen reader extention. Note: This - package does not contain the extension code. + Causes the Chromium web browser to automatically install and update the ChromeVox screen reader extention. Note: This + package does not contain the extension code. community/fcitx-mozc 2.17.2313.102-1 - Fcitx Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese - Input) + Fcitx Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese + Input) ``` 默认情况下,`-s` 选项内置 ERE(扩展正则表达式)会导致很多不需要的结果。使用以下格式会仅匹配包名称。 + ``` # pacman -Ss '^chromium-' - ``` -pkgfile 是一个用于在 Arch Linux 官方仓库的包中搜索文件的工具。 +`pkgfile` 是一个用于在 Arch Linux 官方仓库的包中搜索文件的工具。 + ``` # pkgfile chromium ``` ### 如何在 openSUSE 中搜索一个包 -Zypper 是 SUSE 和 openSUSE 发行版的命令行包管理器。它用于安装,更新,搜索和删除包以及管理仓库,执行各种查询等。Zypper 命令行接口到 ZYpp 系统管理库(libzypp)。 +Zypper 是 SUSE 和 openSUSE 发行版的命令行包管理器。它用于安装、更新、搜索和删除包以及管理仓库,执行各种查询等。Zypper 命令行对接到 ZYpp 系统管理库(libzypp)。 + ``` # zypper search ftp or # zypper se ftp Loading repository data... Reading installed packages... -S | Name | Summary | Type +S | Name | Summary | Type --+----------------+-----------------------------------------+-------- - | proftpd | Highly configurable GPL-licensed FTP -> | package - | proftpd-devel | Development files for ProFTPD | package - | proftpd-doc | Documentation for ProFTPD | package - | proftpd-lang | Languages for package proftpd | package - | proftpd-ldap | LDAP Module for ProFTPD | package - | proftpd-mysql | MySQL Module for ProFTPD | package - | proftpd-pgsql | PostgreSQL Module for ProFTPD | package - | proftpd-radius | Radius Module for ProFTPD | package - | proftpd-sqlite | SQLite Module for ProFTPD | package - | pure-ftpd | A Lightweight, Fast, and Secure FTP S-> | package - | vsftpd | Very Secure FTP Daemon - Written from-> | package + | proftpd | Highly configurable GPL-licensed FTP -> | package + | proftpd-devel | Development files for ProFTPD | package + | proftpd-doc | Documentation for ProFTPD | package + | proftpd-lang | Languages for package proftpd | package + | proftpd-ldap | LDAP Module for ProFTPD | package + | proftpd-mysql | MySQL Module for ProFTPD | package + | proftpd-pgsql | PostgreSQL Module for ProFTPD | package + | proftpd-radius | Radius Module for ProFTPD | package + | proftpd-sqlite | SQLite Module for ProFTPD | package + | pure-ftpd | A Lightweight, Fast, and Secure FTP S-> | package + | vsftpd | Very Secure FTP Daemon - Written from-> | package ``` ### 如何使用 whohas 命令搜索一个包 -whohas 命令是一个智能工具,从所有主流发行版中搜索指定包,如 Debian, Ubuntu, Gentoo, Arch, AUR, Mandriva, Fedora, Fink, FreeBSD 和 NetBSD。 +`whohas` 命令是一个智能工具,从所有主流发行版中搜索指定包,如 Debian、Ubuntu、Gentoo、Arch、AUR、Mandriva、Fedora、Fink、FreeBSD 和 NetBSD。 + ``` $ whohas nano -Mandriva nano-debug 2.3.1-1mdv2010.2.x http://sophie.zarb.org/rpms/0b33dc73bca710749ad14bbc3a67e15a -Mandriva nano-debug 2.2.4-1mdv2010.1.i http://sophie.zarb.org/rpms/d9dfb2567681e09287b27e7ac6cdbc05 -Mandriva nano-debug 2.2.4-1mdv2010.1.x http://sophie.zarb.org/rpms/3299516dbc1538cd27a876895f45aee4 -Mandriva nano 2.3.1-1mdv2010.2.x http://sophie.zarb.org/rpms/98421c894ee30a27d9bd578264625220 -Mandriva nano 2.3.1-1mdv2010.2.i http://sophie.zarb.org/rpms/cea07b5ef9aa05bac262fc7844dbd223 -Mandriva nano 2.2.4-1mdv2010.1.s http://sophie.zarb.org/rpms/d61f9341b8981e80424c39c3951067fa -Mandriva spring-mod-nanoblobs 0.65-2mdv2010.0.sr http://sophie.zarb.org/rpms/74bb369d4cbb4c8cfe6f6028e8562460 -Mandriva nanoxml-lite 2.2.3-4.1.4mdv2010 http://sophie.zarb.org/rpms/287a4c37bc2a39c0f277b0020df47502 -Mandriva nanoxml-manual-lite 2.2.3-4.1.4mdv2010 http://sophie.zarb.org/rpms/17dc4f638e5e9964038d4d26c53cc9c6 -Mandriva nanoxml-manual 2.2.3-4.1.4mdv2010 http://sophie.zarb.org/rpms/a1b5092cd01fc8bb78a0f3ca9b90370b -Gentoo nano 9999 http://packages.gentoo.org/package/app-editors/nano -Gentoo nano 9999 http://packages.gentoo.org/package/app-editors/nano -Gentoo nano 2.9.8 http://packages.gentoo.org/package/app-editors/nano -Gentoo nano 2.9.7 http://packages.gentoo.org/package/app-editors/nano +Mandriva nano-debug 2.3.1-1mdv2010.2.x http://sophie.zarb.org/rpms/0b33dc73bca710749ad14bbc3a67e15a +Mandriva nano-debug 2.2.4-1mdv2010.1.i http://sophie.zarb.org/rpms/d9dfb2567681e09287b27e7ac6cdbc05 +Mandriva nano-debug 2.2.4-1mdv2010.1.x http://sophie.zarb.org/rpms/3299516dbc1538cd27a876895f45aee4 +Mandriva nano 2.3.1-1mdv2010.2.x http://sophie.zarb.org/rpms/98421c894ee30a27d9bd578264625220 +Mandriva nano 2.3.1-1mdv2010.2.i http://sophie.zarb.org/rpms/cea07b5ef9aa05bac262fc7844dbd223 +Mandriva nano 2.2.4-1mdv2010.1.s http://sophie.zarb.org/rpms/d61f9341b8981e80424c39c3951067fa +Mandriva spring-mod-nanoblobs 0.65-2mdv2010.0.sr http://sophie.zarb.org/rpms/74bb369d4cbb4c8cfe6f6028e8562460 +Mandriva nanoxml-lite 2.2.3-4.1.4mdv2010 http://sophie.zarb.org/rpms/287a4c37bc2a39c0f277b0020df47502 +Mandriva nanoxml-manual-lite 2.2.3-4.1.4mdv2010 http://sophie.zarb.org/rpms/17dc4f638e5e9964038d4d26c53cc9c6 +Mandriva nanoxml-manual 2.2.3-4.1.4mdv2010 http://sophie.zarb.org/rpms/a1b5092cd01fc8bb78a0f3ca9b90370b +Gentoo nano 9999 http://packages.gentoo.org/package/app-editors/nano +Gentoo nano 9999 http://packages.gentoo.org/package/app-editors/nano +Gentoo nano 2.9.8 http://packages.gentoo.org/package/app-editors/nano +Gentoo nano 2.9.7 ``` 如果你希望只从当前发行版仓库中搜索指定包,使用以下格式: + ``` $ whohas -d Ubuntu vlc -Ubuntu vlc 2.1.6-0ubuntu14.04 1M all http://packages.ubuntu.com/trusty/vlc -Ubuntu vlc 2.1.6-0ubuntu14.04 1M all http://packages.ubuntu.com/trusty-updates/vlc -Ubuntu vlc 2.2.2-5ubuntu0.16. 1M all http://packages.ubuntu.com/xenial/vlc -Ubuntu vlc 2.2.2-5ubuntu0.16. 1M all http://packages.ubuntu.com/xenial-updates/vlc -Ubuntu vlc 2.2.6-6 40K all http://packages.ubuntu.com/artful/vlc -Ubuntu vlc 3.0.1-3build1 32K all http://packages.ubuntu.com/bionic/vlc -Ubuntu vlc 3.0.2-0ubuntu0.1 32K all http://packages.ubuntu.com/bionic-updates/vlc -Ubuntu vlc 3.0.3-1 33K all http://packages.ubuntu.com/cosmic/vlc -Ubuntu browser-plugin-vlc 2.0.6-2 55K all http://packages.ubuntu.com/trusty/browser-plugin-vlc -Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/xenial/browser-plugin-vlc -Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/artful/browser-plugin-vlc -Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/bionic/browser-plugin-vlc -Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/cosmic/browser-plugin-vlc -Ubuntu libvlc-bin 2.2.6-6 27K all http://packages.ubuntu.com/artful/libvlc-bin -Ubuntu libvlc-bin 3.0.1-3build1 17K all http://packages.ubuntu.com/bionic/libvlc-bin -Ubuntu libvlc-bin 3.0.2-0ubuntu0.1 17K all http://packages.ubuntu.com/bionic-updates/libvlc-bin +Ubuntu vlc 2.1.6-0ubuntu14.04 1M all http://packages.ubuntu.com/trusty/vlc +Ubuntu vlc 2.1.6-0ubuntu14.04 1M all http://packages.ubuntu.com/trusty-updates/vlc +Ubuntu vlc 2.2.2-5ubuntu0.16. 1M all http://packages.ubuntu.com/xenial/vlc +Ubuntu vlc 2.2.2-5ubuntu0.16. 1M all http://packages.ubuntu.com/xenial-updates/vlc +Ubuntu vlc 2.2.6-6 40K all http://packages.ubuntu.com/artful/vlc +Ubuntu vlc 3.0.1-3build1 32K all http://packages.ubuntu.com/bionic/vlc +Ubuntu vlc 3.0.2-0ubuntu0.1 32K all http://packages.ubuntu.com/bionic-updates/vlc +Ubuntu vlc 3.0.3-1 33K all http://packages.ubuntu.com/cosmic/vlc +Ubuntu browser-plugin-vlc 2.0.6-2 55K all http://packages.ubuntu.com/trusty/browser-plugin-vlc +Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/xenial/browser-plugin-vlc +Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/artful/browser-plugin-vlc +Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/bionic/browser-plugin-vlc +Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/cosmic/browser-plugin-vlc +Ubuntu libvlc-bin 2.2.6-6 27K all http://packages.ubuntu.com/artful/libvlc-bin +Ubuntu libvlc-bin 3.0.1-3build1 17K all http://packages.ubuntu.com/bionic/libvlc-bin +Ubuntu libvlc-bin 3.0.2-0ubuntu0.1 17K all ``` -------------------------------------------------------------------------------- @@ -327,7 +330,7 @@ via: https://www.2daygeek.com/how-to-search-if-a-package-is-available-on-your-li 作者:[Prakash Subramanian][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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 75a8b9db4dd0165cc3d6f422e4d02dddc2fc9904 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 3 Feb 2019 21:31:58 +0800 Subject: [PATCH 0948/4278] PUB:20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md @MjSeven https://linux.cn/article-10506-1.html --- ...If A Package Is Available On Your Linux Distribution Or Not.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md (100%) diff --git a/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md b/published/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md similarity index 100% rename from translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md rename to published/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md From b9be9d9f8bc84ba26c208746fdc57ebb9c5af7e3 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 3 Feb 2019 22:14:18 +0800 Subject: [PATCH 0949/4278] Translating by qhwdw --- ...0120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md b/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md index 00fe349914..ae96b8d5cf 100644 --- a/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md +++ b/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From acecc9fc4dd7e92340f7f2d4c82a0aa2623307ad Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Sun, 3 Feb 2019 22:21:22 +0800 Subject: [PATCH 0950/4278] =?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 --- .../20180530 Introduction to the Pony programming language.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180530 Introduction to the Pony programming language.md b/sources/tech/20180530 Introduction to the Pony programming language.md index 2f32ea6631..2292c65fc2 100644 --- a/sources/tech/20180530 Introduction to the Pony programming language.md +++ b/sources/tech/20180530 Introduction to the Pony programming language.md @@ -1,3 +1,4 @@ +beamrolling is translating. Introduction to the Pony programming language ====== From 156a6cdcd207e2fb164165797da16f174777d048 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Mon, 4 Feb 2019 01:56:15 +0800 Subject: [PATCH 0951/4278] hankchow translated --- ...0108 Hacking math education with Python.md | 84 ------------------ ...0108 Hacking math education with Python.md | 86 +++++++++++++++++++ 2 files changed, 86 insertions(+), 84 deletions(-) delete mode 100644 sources/talk/20190108 Hacking math education with Python.md create mode 100644 translated/talk/20190108 Hacking math education with Python.md diff --git a/sources/talk/20190108 Hacking math education with Python.md b/sources/talk/20190108 Hacking math education with Python.md deleted file mode 100644 index 81241302a2..0000000000 --- a/sources/talk/20190108 Hacking math education with Python.md +++ /dev/null @@ -1,84 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Hacking math education with Python) -[#]: via: (https://opensource.com/article/19/1/hacking-math) -[#]: author: (Don Watkins https://opensource.com/users/don-watkins) - -Hacking math education with Python -====== -Teacher, programmer, and author Peter Farrell explains why teaching math with Python works better than the traditional approach. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl) - -Mathematics instruction has a bad reputation, especially with people (like me) who've had trouble with the traditional approach, which emphasizes rote memorization and theory that seems far removed from students' real world. - -While teaching a student who was baffled by his math lessons, [Peter Farrell][1], a Python developer and mathematics teacher, decided to try using Python to teach the boy the math concepts he was having trouble learning. - -Peter was inspired by the work of [Seymour Papert][2], the father of the Logo programming language, which lives on in Python's [Turtle module][3]. The Turtle metaphor hooked Peter on Python and using it to teach math, much like [I was drawn to Python][4]. - -Peter shares his approach in his new book, [Math Adventures with Python][5]: An Illustrated Guide to Exploring Math with Code. And, I recently interviewed him to learn more about it. - -**Don Watkins:** What is your background? - -**Peter Farrell:** I was a math teacher for eight years, and I tutored math for 10 years after that. When I was a teacher, I read Papert's [Mindstorms][6] and was inspired to introduce all my math classes to Logo and Turtles. - -**DW:** Why did you start using Python? - -**PF:** I was working with a homeschooled boy on a very dry, textbook-driven math curriculum, which at the time seemed like a curse to me. But I found ways to sneak in the Logo Turtles, and he was a programming fan, so he liked that. Once we got into functions and real programming, he asked if we could continue in Python. I didn't know any Python but it didn't seem that different from Logo, so I agreed. And I never looked back! - -I was also looking for a 3D graphics package I could use to model a solar system and lead students through making planets move and get pulled by the force of attraction between the bodies, according to Newton's formula. Many graphics packages required programming in C or something hard, but I found an excellent package called Visual Python that was very easy to use. I used [VPython][7] for years after that. - -So, I was introduced to Python in the context of working with a student on math. For some time after that, he was my programming tutor while I was his math tutor! - -**DW:** What got you interested in math? - -**PF:** I learned it the old-fashioned way: by hand, on paper and blackboards. I was good at manipulating symbols, so algebra was never a problem, and I liked drawing and graphing, so geometry and trig could be fun, too. I did some programming in BASIC and Fortran in college, but it never inspired me. Later on, programming inspired me greatly! I'm still tickled by the way programming makes easy work of the laborious stuff you have to do in math class, freeing you up to do the more fun of exploring, graphing, tweaking, and discovering. - -**DW:** What inspired you to consider your Python approach to math? - -**PF:** When I was teaching the homeschooled student, I was amazed at what we could do by writing a simple function and then calling it a bunch of times with different values using a loop. That would take a half an hour by hand, but the computer spit it out instantly! Then we could look for patterns (which is what a math student should be doing), express the pattern as a function, and extend it further. - -**DW:** How does your approach to teaching help students—especially those who struggle with math? How does it make math more relevant? - -**PF:** Students, especially high-schoolers, question the need to be doing all this calculating, graphing, and solving by hand in the 21st century, and I don't disagree with them. Learning to use Excel, for example, to crunch numbers should be seen as a basic necessity to work in an office. Learning to code, in any language, is becoming a very valuable skill to companies. So, there's a real-world appeal to me. - -But the idea of making art with code can revolutionize math class. Just putting a shape on a screen requires math—the position (x-y coordinates), the dimensions, and even the color are all numbers. If you want something to move or change, you'll need to use variables, and not the "guess what x equals" kind of variable. You'll vary the position using a variable or, more efficiently, using a vector. [This makes] math topics like vectors and matrices seen as helpful tools you can use, rather than required information you'll never use. - -Students who struggle with math might just be turned off to "school math," which is heavy on memorization and following rules and light on creativity and real applications. They might find they're actually good at math, just not the way it was taught in school. I've had parents see the cool graphics their kids have created with code and say, "I never knew that's what sines and cosines were used for!" - -**DW:** How do you see your approach to math and programming encouraging STEM in schools? - -**PF:** I love the idea of combining previously separated topics into an idea like STEM or STEAM! Unfortunately for us math folks, the "M" is very often neglected. I see lots of fun projects being done in STEM labs, even by very young children, and they're obviously getting an education in technology, engineering, and science. But I see precious little math material in the projects. STEM/[mechatronics][8] teacher extraordinaire Ken Hawthorn and I are creating projects to try to remedy that. - -Hopefully, my book helps encourage students, girls and boys, to get creative with technology, real and virtual. There are a lot of beautiful graphics in the book, which I hope will inspire people to go through the coding adventure and make them. All the software I use ([Python Processing][9]) is available for free and can be easily installed, or is already installed, on the Raspberry Pi. Entry into the STEM world should not be cost-prohibitive to schools or individuals. - -**DW:** What would you like to share with other math teachers? - -**PF:** If the math establishment is really serious about teaching students the standards they have agreed upon, like numerical reasoning, logic, analysis, modeling, geometry, interpreting data, and so on, they're going to have to admit that coding can help with every single one of those goals. My approach was born, as I said before, from just trying to enrich a dry, traditional approach, and I think any teacher can do that. They just need somebody who can show them how to do everything they're already doing, just using code to automate the laborious stuff. - -My graphics-heavy approach is made possible by the availability of free graphics software. Folks might need to be shown where to find these packages and how to get started. But a math teacher can soon be leading students through solving problems using 21st-century technology and visualizing progress or results and finding more patterns to pursue. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/hacking-math - -作者:[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://twitter.com/hackingmath -[2]: https://en.wikipedia.org/wiki/Seymour_Papert -[3]: https://en.wikipedia.org/wiki/Turtle_graphics -[4]: https://opensource.com/life/15/8/python-turtle-graphics -[5]: https://nostarch.com/mathadventures -[6]: https://en.wikipedia.org/wiki/Mindstorms_(book) -[7]: http://vpython.org/ -[8]: https://en.wikipedia.org/wiki/Mechatronics -[9]: https://processing.org/ diff --git a/translated/talk/20190108 Hacking math education with Python.md b/translated/talk/20190108 Hacking math education with Python.md new file mode 100644 index 0000000000..120e56c521 --- /dev/null +++ b/translated/talk/20190108 Hacking math education with Python.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Hacking math education with Python) +[#]: via: (https://opensource.com/article/19/1/hacking-math) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +将 Python 结合到数学教育中 +====== +> 身兼教师、开发者、作家数职的 Peter Farrell 来讲述为什么使用 Python 来讲数学课会比传统方法更加好。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl) + +数学课一直都是很讨厌的一件事情,尤其对于在传统教学方法上吃过苦头的人(例如我)来说。传统教学方法强调的是死记硬背和理论知识,这种形式与学生们的现实世界似乎相去甚远。 + +[Peter Farrell][1] 作为一位 Python 开发者和数学教师,发现学生在数学课程中遇到了困难,于是决定尝试使用 Python 来帮助介绍数学概念。 + +Peter 的灵感来源于 Logo 语言之父 [Seymour Papert][2],他的 Logo 语言现在还存在于 Python 的 [Turtle 模块][3]中。Logo 语言中的海龟形象让 Peter 喜欢上了 Python,并且进一步将 Python 应用到数学教学中。 + +Peter 在他的新书《[Python 数学奇遇记Math Adventures with Python][5]》中分享了他的方法:“图文并茂地指导如何用代码探索数学”。因此我最近对他进行了一次采访,向他了解更多这方面的情况。 + +**Don Watkins(译者注:本文作者):** 你的教学背景是什么? + +**Peter Farrell:** 我曾经当过八年的数学老师,之后又教了十年的数学。我还在当老师的时候,就阅读过 Papert 的 《[头脑风暴Mindstorms][6]》并从中受到了启发,将 Logo 语言和海龟引入到了我所有的数学课上。 + +**DW:** 你为什么开始使用 Python 呢? + +**PF:** 在我当家教的时候,需要教学一门枯燥刻板的数学课程,这是一个痛苦的过程。后来我引入了 Logo 语言和海龟,我的学生刚好是一个编程爱好者,他非常喜欢这样的方式。在接触到函数和实际的编程之后,他还提议改用 Python。尽管当时我还不了解 Python,但看起来好像和 Logo 语言差别不大,我就同意了。后来我甚至坚持在 Python 上一条道走到黑了! + +我还曾经寻找过 3D 图形方面的软件包,用来模拟太阳系行星的运动轨迹,让学生们理解行星是如何在牛顿的万有引力定律作用下运动的。很多图形软件包都需要用到 C 语言编程或者其它一些很复杂的内容,后来我发现了一个叫做 VisualPython 的软件包,它非常方便使用。于是在那之后的几年里,我就一直在用 [Vpython][7] 这个软件包。 + +所以,我是在和学生一起学习数学的时候被介绍使用 Python 的。在那段时间里,他是我的编程老师,而我则是他的数学老师。 + +**DW:** 是什么让你对数学感兴趣? + +**PF:** 我是通过传统的方法学习数学的,那时候都是用手写、用纸记、在黑板上计算。我擅长代数和几何,在大学的时候也接触过 Basic 和 Fortran 编程,但那个时候也没有从中获取到灵感。直到后来在从编程中收到了启发,编程可以让你将数学课上一些晦涩难懂的内容变得简单直观,也能让你轻松地绘图、调整、探索,进而发现更多乐趣。 + +**DW:** 是什么启发了你使用 Python 教学? + +**PF:** 还是在我当家教的时候,我惊奇地发现可以通过循环来计算对同一个函数输入不同参数的结果。如果用人手计算,可能要花半个小时的时间,但计算机瞬间就完成了。在这样的基础上,我们只要将一些计算的过程抽象成一个函数,再对其进行一些适当的扩展,就可以让计算机来计算了。 + +**DW:** 你的教学方法如何帮助学生,特别是在数学上感觉吃力的学生?如何将 Python 编程和数学结合起来 + +**PF:** 很多学生,尤其是高中生,都认为通过手工计算和画图来解决问题的方式在当今已经没有必要了,我并不反对这样的观点。例如,使用 Excel 来处理数据确实应该算是办公室工作的基本技能。学习任何一种编程语言,对公司来说都是一项非常有价值的技能。因此,使用计算机计算确实是有实际意义的。 + +而使用代码来为数学课创造艺术,则是一项革命性的改变。例如,仅仅是把某个形状显示到屏幕上,就需要使用到数学,因为位置需要用 x-y 坐标去表示,而尺寸、颜色等等都是数字。如果想要移动或者更改某些内容,会需要用到变量。更特殊地,如果需要改变位置,就需要更有效的向量来实现。这样的最终结果是,类似向量、矩阵这些难以捉摸的空洞概念会转变成实打实有意义的数学工具。 + +那些看起来在数学上吃力的学生,或许只是不太容易接受“书本上的数学”。因为“书本上的数学”过分强调了死记硬背和循规蹈矩,而有些忽视了创造力和实际应用能力。有些学生其实擅长数学,但并不适应学校的教学方式。我的方法会让父母们看到他们的孩子通过代码画出了很多有趣的图形,然后说:“我从来不知道正弦和余弦还能这样用!” + +**DW:** 你的教学方法是如何在学校里促进 STEM 教育的呢? + +**PF:** 我喜欢将这几个学科统称为 STEM(科学、技术、工程、数学Science, Technology, Engineering and Mathematics) 或 STEAM(科学、技术、工程、艺术、数学Science, Technology, Engineering, Art and Mathematics)。但作为数学工作者,我很不希望其中的 M 被忽视。我经常看到很多很小的孩子在 STEM 实验室里参与一些有趣的项目,这表明他们已经在接受科学、技术和工程方面的教育。与此同时,我发现数学方面的材料和项目却很少。因此,我和[机电一体化][8]领域的优秀教师 Ken Hawthorn 正在着手解决这个问题。 + +希望我的书能够帮助鼓励学生们在技术上有所创新,无论在形式上是切实的还是虚拟的。同时书中还有很多漂亮的图形,希望能够激励大家去体验编程的过程,并且应用到实际中来。我使用的软件([Python Processing][9])是免费的,在树莓派等系统上都可以轻松安装。因为我认为,个人或者学校的成本问题不应该成为学生进入 STEM 世界的门槛。 + +**DW:** 你有什么想要跟其他的数学老师分享? + +**PF:** 如果数学教学机构决定要向学生教导数字推理、逻辑、分析、建模、几何、数据解释这些内容,那么它们应该承认,可以通过编程来实现这些目标。正如我上面所说的,我的教学方法是在尝试使传统枯燥的方法变得直观,我认为任何一位老师都可以做到这一点。他们只需要知道其中的本质做法,就可以使用代码来完成大量重复的工作了。 + +我的教学方法依赖于一些免费的图形软件,因此只需要知道在哪里找到这些软件包,以及如何使用这些软件包,就可以开始引导学生使用 21 世纪的技术来解决实际问题,将整个过程和结果可视化,并找到更多可以以此实现的模式。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/hacking-math + +作者:[Don Watkins][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/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/hackingmath +[2]: https://en.wikipedia.org/wiki/Seymour_Papert +[3]: https://en.wikipedia.org/wiki/Turtle_graphics +[4]: https://opensource.com/life/15/8/python-turtle-graphics +[5]: https://nostarch.com/mathadventures +[6]: https://en.wikipedia.org/wiki/Mindstorms_(book) +[7]: http://vpython.org/ +[8]: https://en.wikipedia.org/wiki/Mechatronics +[9]: https://processing.org/ + From 055b5416b49bfdf5136fe36c147e3e368a03f6db Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Sun, 3 Feb 2019 14:08:18 -0600 Subject: [PATCH 0952/4278] Translated passage for review tomjlw submitted a translated passage for review --- ... the Linux community and adopting snaps.md | 76 ------------------- ... the Linux community and adopting snaps.md | 72 ++++++++++++++++++ 2 files changed, 72 insertions(+), 76 deletions(-) delete mode 100644 sources/talk/20180206 Building Slack for the Linux community and adopting snaps.md create mode 100644 translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md diff --git a/sources/talk/20180206 Building Slack for the Linux community and adopting snaps.md b/sources/talk/20180206 Building Slack for the Linux community and adopting snaps.md deleted file mode 100644 index 17132a36c5..0000000000 --- a/sources/talk/20180206 Building Slack for the Linux community and adopting snaps.md +++ /dev/null @@ -1,76 +0,0 @@ -tomjlw is translating -Building Slack for the Linux community and adopting snaps -====== -![][1] - -Used by millions around the world, [Slack][2] is an enterprise software platform that allows teams and businesses of all sizes to communicate effectively. Slack works seamlessly with other software tools within a single integrated environment, providing an accessible archive of an organisation’s communications, information and projects. Although Slack has grown at a rapid rate in the 4 years since their inception, their desktop engineering team who work across Windows, MacOS and Linux consists of just 4 people currently. We spoke to Felix Rieseberg, Staff Software Engineer, who works on this team following the release of Slack’s first [snap last month][3] to discover more about the company’s attitude to the Linux community and why they decided to build a snap. - -[Install Slack snap][4] - -### Can you tell us about the Slack snap which has been published? - -We launched our first snap last month as a new way to distribute to our Linux community. In the enterprise space, we find that people tend to adopt new technology at a slower pace than consumers, so we will continue to offer a .deb package. - -### What level of interest do you see for Slack from the Linux community? - -I’m excited that interest for Slack is growing across all platforms, so it is hard for us to say whether the interest coming out of the Linux community is different from the one we’re generally seeing. However, it is important for us to meet users wherever they do their work. We have a dedicated QA engineer focusing entirely on Linux and we really do try hard to deliver the best possible experience. - -We generally find it is a little harder to build for Linux, than say Windows, as there is a less predictable base to work from – and this is an area where the Linux community truly shines. We have a fairly large number of users that are quite helpful when it comes to reporting bugs and hunting root causes down. - -### How did you find out about snaps? - -Martin Wimpress at Canonical reached out to me and explained the concept of snaps. Honestly, initially I was hesitant – even though I use Ubuntu – because it seemed like another standard to build and maintain. However, once understanding the benefits I was convinced it was a worthwhile investment. - -### What was the appeal of snaps that made you decide to invest in them? - -Without doubt, the biggest reason we decided to build the snap is the updating feature. We at Slack make heavy use of web technologies, which in turn allows us to offer a wide variety of features – like the integration of YouTube videos or Spotify playlists. Much like a browser, that means that we frequently need to update the application. - -On macOS and Windows, we already had a dedicated auto-updater that doesn’t require the user to even think about updates. We have found that any sort of interruption, even for an update, is an annoyance that we’d like to avoid. Therefore, the automatic updates via snaps seemed far more seamless and easy. - -### How does building snaps compare to other forms of packaging you produce? How easy was it to integrate with your existing infrastructure and process? - -As far as Linux is concerned, we have not tried other “new” packaging formats, but we’ll never say never. Snaps were an easy choice given that the majority of our Linux customers do use Ubuntu. The fact that snaps also run on other distributions was a decent bonus. I think it is really neat how Canonical is making snaps cross-distro rather than focusing on just Ubuntu. - -Building it was surprisingly easy: We have one unified build process that creates installers and packages – and our snap creation simply takes the .deb package and churns out a snap. For other technologies, we sometimes had to build in-house tools to support our buildchain, but the `snapcraft` tool turned out to be just the right thing. The team at Canonical were incredibly helpful to push it through as we did experience a few problems along the way. - -### How do you see the store changing the way users find and install your software? - -What is really unique about Slack is that people don’t just stumble upon it – they know about it from elsewhere and actively try to find it. Therefore, our levels of awareness are already high but having the snap available in the store, I hope, will make installation a lot easier for our users. - -We always try to do the best for our users. The more convinced we become that it is better than other installation options, the more we will recommend the snap to our users. - -### What are your expectations or already seen savings by using snaps instead of having to package for other distros? - -We expect the snap to offer more convenience for our users and ensure they enjoy using Slack more. From our side, the snap will save time on customer support as users won’t be stuck on previous versions which will naturally resolve a lot of issues. Having the snap is an additional bonus for us and something to build on, rather than displacing anything we already have. - -### What release channels (edge/beta/candidate/stable) in the store are you using or plan to use, if any? - -We used the edge channel exclusively in the development to share with the team at Canonical. Slack for Linux as a whole is still in beta, but long-term, having the options for channels is interesting and being able to release versions to interested customers a little earlier will certainly be beneficial. - -### How do you think packaging your software as a snap helps your users? Did you get any feedback from them? - -Installation and updating generally being easier will be the big benefit to our users. Long-term, the question is “Will users that installed the snap experience less problems than other customers?” I have a decent amount of hope that the built-in dependencies in snaps make it likely. - -### What advice or knowledge would you share with developers who are new to snaps? - -I would recommend starting with the Debian package to build your snap – that was shockingly easy. It also starts the scope smaller to avoid being overwhelmed. It is a fairly small time investment and probably worth it. Also if you can, try to find someone at Canonical to work with – they have amazing engineers. - -### Where do you see the biggest opportunity for development? - -We are taking it step by step currently – first get people on the snap, and build from there. People using it will already be more secure as they will benefit from the latest updates. - --------------------------------------------------------------------------------- - -via: https://insights.ubuntu.com/2018/02/06/building-slack-for-the-linux-community-and-adopting-snaps/ - -作者:[Sarah][a] -译者:[译者ID](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://insights.ubuntu.com/author/sarahfd/ -[1]:https://insights.ubuntu.com/wp-content/uploads/a115/Slack_linux_screenshot@2x-2.png -[2]:https://slack.com/ -[3]:https://insights.ubuntu.com/2018/01/18/canonical-brings-slack-to-the-snap-ecosystem/ -[4]:https://snapcraft.io/slack/ 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 new file mode 100644 index 0000000000..d3370fa550 --- /dev/null +++ b/translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md @@ -0,0 +1,72 @@ +为 Linux 社区采用 snaps 搭建 Slack +====== +![][1] + +作为一个被数以百万计用户使用的企业级软件平台,[Slack][2] 允许任意规模的团队和企业有效地沟通。Slack 通过在一个单一集成环境中与其它软件工具无缝衔接,为一个组织内的通讯、信息和项目提供了一个易于接触的档案馆。尽管自从诞生后 Slack 就在过去四年中快速成长,但是他们负责该平台跨 Windows、MacOS 和 Linux 运行的桌面工程师团队仅由四人组成。我们通过与在这个团队中负责追踪[上月首发的 Slack snap][3] 的主任工程师 Felix Rieseberg 交谈,来探索更多有关该公司对于 Linux 社区的态度以及他们决定搭建一个 snap 的原因。 + +[安装 Slack snap][4] + +### 你们能告诉我们更多关于已发布的 Slack snap 的信息吗? + +我们上月发布了我们的第一个 snap 作为我们为Linux 社区的一种新的发布形式。在企业界,我们发现者人们更倾向于以一种相对于个人消费较慢的速度来采用新科技, 因此我们将会在未来继续提供 .deb 形式的 snap。 + +### 你们觉得 Linux 社区会对 Slack 有多大的兴趣呢? + +在所有的平台上人们对 Slack 的兴趣都正在增长,这一点使我感到十分兴奋。因此这对于我们来说,很难说源自 Linux 社区的兴趣和我们大体上所见到的兴趣有什么区别。当然,不管用户们在什么平台上面工作,满足他们对我们都是很重要的。我们有一个专门负责 Linux 的测试工程师并且我们同时也尽全力提供最好的用户体验。只是我们发现总体相对于 Windows 来说,为 Linux 搭建 snap 略微有点难度,因为我们是在一个较难以预测的平台上工作——而这正是 Linux 社区之光照耀的领域。在汇报程序缺陷以及寻找程序崩溃原因方面,我们有相当多数极富帮助的用户。 + +### 你们是如何得知 snap 的? + +Canonical 公司的 Martin Wimpress 和我接触并向我解释了 snap 的概念。说实话尽管我也用 Ubuntu 但最初我还是迟疑的,因为它看起来像需要搭建与维护的另一套标准。尽管如此,一当我了解到其中的好处之后,我确信这是一笔有回报的投入。 + +### snap 的什么方面吸引了你们并使你们决定投入其中? + +毫无疑问,我们决定搭建 snap 最重要的原因是它的更新特性。在 Slack 上我们大量运用网页技术,这些技术反过来也使得我们提供大量的特性——比如将 YouTube 视频或者 Spotify 播放列表集成在 Slack 中。与浏览器十分相似,这意味着我们需要频繁更新应用。 + +在 MacOS 和 Windows 上,我们已经有了一个甚至无需用户考虑更新的专门的自动更新器。我们发现哪怕是为了更新,任何形式的中断都是一种我们需要避免的烦恼。因此通过 snap 自动化的更新就显得无缝和便捷得多。 + + +### 相比于其它形式的打包方式,搭建 snap 感觉如何? 将它与现有的设施和进程集成在一起有多简便呢? + +就 Linux 而言,我们尚未尝试其它新的打包方式,但我们迟早会的。鉴于我们的大多数用户都使用 Ubuntu,snap 是一个很简便的选项。同时 snap 在其它发行版上同样也可以使用,这也是一个巨大的加分项。Canonical 正将 snap 做到跨发行版而不是仅仅集中在 Ubuntu 上,这一点我认为是很好的。 + +搭建 snap 简单得出乎意料,我们有一个创建安装器和软件包的统一流程,我们的 snap 创建过程从一个 .deb 软件包炮制出一个 snap。对于其它技术而言,有时候我们不得不为了支持搭建链先造一个内部工具。但是 snapcraft 工具正是我们需要的东西。在整个过程中 Canonical 的团队不可思议般得有助,因为我们一路上确实碰到了一些问题。 + +### 你们觉得 snap 商店是如何改变用户们寻找、安装你们软件的方式的呢? + +Slack 真正的独特之处在于人们不仅仅是碰巧发现它,他们从别的地方知道它并积极地试图找到它。因此尽管我们已经有了相当高的觉悟,我希望对于我们的用户来说,在商店中可以获得 snap 能够让安装过程变得简单一点。 + +### 你们对用 snap 而不是为了其它发行版不得不再发行软件包有什么期待,或者有什么已经是你们可见的节省呢? + +我们希望 snap 可以给予我们的用户更多的便利并确保他们能够更加享受使用 Slack。在我们看来,鉴于用户们不必被困在之前的版本,这自然而然地解决了许多问题,因此 snap 可以让我们在客户支持方面节约时间。有 snap 对我们来说也是一个额外的加分项,因为我们能有一个可供搭建的平台而不是替换我们现有的东西。 + +### 如果存在的话,你们正使用或者准备使用边缘 (edge)、测试 (beta)、候选 (candidate)、稳定 (stable) 中的哪种发行频道? + +我们仅仅在开发中使用边缘 (edge) 频道以与 Canonical 的团队共享。为 Linux 打造的 Slack 总体任在测试 (beta) 频道中。但是长远来看,拥有不同频道的选项十分有意思,同时能够提早一点为感兴趣的客户发行版本也肯定是有好处的。 + +### 你们认为将软件打包成一个 snap 是如何能够帮助用户的?你们从用户那边得到了什么反馈吗? + +对我们的用户来说一个很大的好处是安装和更新总体来说都会变得简便一点。长远来看,问题在于“那些安装 snap 的用户是不是比其它用户少碰到一些困难?”,我十分期望 snap 自带的依赖关系能够使其变成可能。 + +### 你们有什么会和刚使用 snap 的新用户们分享的建议或知识呢? + +我会推荐从 Debian 软件包来着手搭建你们的 snap——那出乎意料得简单。这同样也缩小了开始的范围避免变得不堪重负。这只需要投入相当少的时间,并且很大可能是一笔值得的投入。同样如果你们可以的话,尽量试着找到 Canonical 的人员来协作——他们拥有了不起的工程师。 + +### 对于开发来说,你们在什么地方看到了最大的机遇? + +我们现在正一步步来,先是让人们用上 snap,再从那里开始搭建。正在使用 snap 的人们将会感到更加稳健因为他们将会得益于最新的更新。 + +-------------------------------------------------------------------------------- + +via: https://insights.ubuntu.com/2018/02/06/building-slack-for-the-linux-community-and-adopting-snaps/ + +作者:[Sarah][a] +译者:[tomjlw](https://github.com/tomjlw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://insights.ubuntu.com/author/sarahfd/ +[1]:https://insights.ubuntu.com/wp-content/uploads/a115/Slack_linux_screenshot@2x-2.png +[2]:https://slack.com/ +[3]:https://insights.ubuntu.com/2018/01/18/canonical-brings-slack-to-the-snap-ecosystem/ +[4]:https://snapcraft.io/slack/ From b2cd3ce41588204f3162dc731100962c00c3d7f5 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Sun, 3 Feb 2019 20:18:11 -0600 Subject: [PATCH 0953/4278] Fix typos --- ...uilding Slack for the Linux community and adopting snaps.md | 3 +-- 1 file changed, 1 insertion(+), 2 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 d3370fa550..ef97cf3485 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 @@ -8,7 +8,7 @@ ### 你们能告诉我们更多关于已发布的 Slack snap 的信息吗? -我们上月发布了我们的第一个 snap 作为我们为Linux 社区的一种新的发布形式。在企业界,我们发现者人们更倾向于以一种相对于个人消费较慢的速度来采用新科技, 因此我们将会在未来继续提供 .deb 形式的 snap。 +我们上月发布了我们的第一个 snap 作为我们为Linux 社区的一种新的发布形式。在企业界,我们发现人们更倾向于以一种相对于个人消费者较慢的速度来采用新科技, 因此我们将会在未来继续提供 .deb 形式的 snap。 ### 你们觉得 Linux 社区会对 Slack 有多大的兴趣呢? @@ -24,7 +24,6 @@ Canonical 公司的 Martin Wimpress 和我接触并向我解释了 snap 的概 在 MacOS 和 Windows 上,我们已经有了一个甚至无需用户考虑更新的专门的自动更新器。我们发现哪怕是为了更新,任何形式的中断都是一种我们需要避免的烦恼。因此通过 snap 自动化的更新就显得无缝和便捷得多。 - ### 相比于其它形式的打包方式,搭建 snap 感觉如何? 将它与现有的设施和进程集成在一起有多简便呢? 就 Linux 而言,我们尚未尝试其它新的打包方式,但我们迟早会的。鉴于我们的大多数用户都使用 Ubuntu,snap 是一个很简便的选项。同时 snap 在其它发行版上同样也可以使用,这也是一个巨大的加分项。Canonical 正将 snap 做到跨发行版而不是仅仅集中在 Ubuntu 上,这一点我认为是很好的。 From 1988614e5b649dae14dce20123994acbbec892f3 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Mon, 4 Feb 2019 12:04:51 +0800 Subject: [PATCH 0954/4278] Translated by qhwdw --- ...aboratory - Raspberry Pi- Lesson 4 OK04.md | 161 ---------------- ...aboratory - Raspberry Pi- Lesson 4 OK04.md | 173 ++++++++++++++++++ 2 files changed, 173 insertions(+), 161 deletions(-) delete mode 100644 sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md create mode 100644 translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md diff --git a/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md b/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md deleted file mode 100644 index ae96b8d5cf..0000000000 --- a/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md +++ /dev/null @@ -1,161 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: 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) - -Computer Laboratory – Raspberry Pi: Lesson 4 OK04 -====== - -The OK04 lesson builds on OK03 by teaching how to use the timer to flash the 'OK' or 'ACT' LED at precise intervals. It is assumed you have the code for the [Lesson 3: OK03][1] operating system as a basis. - -### 1 A New Device - -The timer is the only way the Pi can keep time. Most computers have a battery powered clock to keep time when off. - -So far, we've only looked at one piece of hardware on the Raspberry Pi, namely the GPIO Controller. I've simply told you what to do, and it happened. Now we're going to look at the timer, and I'm going to lead you through understanding how it works. - -Just like the GPIO Controller, the timer has an address. In this case, the timer is based at 2000300016. Reading the manual, we find the following table: - -Table 1.1 GPIO Controller Registers -| Address | Size / Bytes | Name | Description | Read or Write | -| -------- | ------------ | ---------------- | ---------------------------------------------------------- | ---------------- | -| 20003000 | 4 | Control / Status | Register used to control and clear timer channel comparator matches. | RW | -| 20003004 | 8 | Counter | A counter that increments at 1MHz. | R | -| 2000300C | 4 | Compare 0 | 0th Comparison register. | RW | -| 20003010 | 4 | Compare 1 | 1st Comparison register. | RW | -| 20003014 | 4 | Compare 2 | 2nd Comparison register. | RW | -| 20003018 | 4 | Compare 3 | 3rd Comparison register. | RW | - -![Flowchart of the system timer's operation][2] - -This table tells us a lot, but the descriptions in the manual of the various fields tell us the most. The manual explains that the timer fundamentally just increments the value in Counter by 1 every 1 micro second. Each time it does so, it compares the lowest 32 bits (4 bytes) of the counter's value with the 4 comparison registers, and if it matches any of them, it updates Control / Status to reflect which ones matched. - -For more information about bits, bytes, bit fields, and data sizes expand the box below. - -``` -A bit is a name for a single binary digit. As you may recall, a single binary digit is either a 1 or a 0. - -A byte is the name we give for a collection of 8 bits. Since each bit can be one of two values, there are 28 = 256 different possible values for a byte. We normally interpret a byte as a binary number between 0 and 255 inclusive. - -![Diagram of GPIO function select controller register 0.][3] - -A bit field is another way of interpreting binary. Rather than interpreting it as a number, binary can be interpreted as many different things. A bit field treats binary as a series of switches which are either on (1) or off (0). If we have a meaning for each of these little switches, we can use them to control things. We have actually already met bitfields with the GPIO controller, with the setting a pin on or off. The bit that was a 1 was the GPIO pin to actually turn on or off. Sometimes we need more options than just on or off, so we group several of the switches together, such as with the GPIO controller function settings (pictured), in which every group of 3 bits controls one GPIO pin function. -``` - -Our goal is to implement a function that we can call with an amount of time as an input that will wait for that amount of time and then return. Think for a moment about how we could do this, given what we have. - -I see there being two options: - - 1. Read a value from the counter, and then keep branching back into the same code until the counter is the amount of time to wait more than it was. - 2. Read a value from the counter, add the amount of time to wait, store this in one of the comparison registers and then keep branching back into the same code until the Control / Status register updates. - - -``` -Issues like these are called concurrency problems, and can be almost impossible to fix. -``` - -Both of these strategies would work fine, but in this tutorial we will only implement the first. The reason is because the comparison registers are more likely to go wrong, as during the time it takes to add the wait time and store it in the comparison register, the counter may have increased, and so it would not match. This could lead to very long unintentional delays if a 1 micro second wait is requested (or worse, a 0 microsecond wait). - -### 2 Implementation - -``` -Large Operating Systems normally use the Wait function as an opportunity to perform background tasks. -``` - -I will largely leave the challenge of creating the ideal wait method to you. I suggest you put all code related to the timer in a file called 'systemTimer.s' (for hopefully obvious reasons). The complicated part about this method, is that the counter is an 8 byte value, but each register only holds 4 bytes. Thus, the counter value will span two registers. - -The following code blocks are examples. - -``` -ldrd r0,r1,[r2,#4] -``` - -``` -ldrd regLow,regHigh,[src,#val] loads 8 bytes from the address given by the number in src plus val into regLow and regHigh . -``` - -An instruction you may find useful is the ldrd instruction above. It loads 8 bytes of memory across 2 registers. In this case, the 8 bytes of memory starting at the address in r2 would be copied into r0 and r1. What is slightly complicated about this arrangement is that r1 actually holds the highest 4 bytes. In other words, if the counter had a value of 999,999,999,99910 = 11101000110101001010010100001111111111112, r1 would contain 111010002 and r0 would contain 110101001010010100001111111111112. - -The most sensible way to implement this would be to compute the difference between the current counter value and the one from when the method started, and then to compare this with the requested amount of time to wait. Conveniently, unless you wish to support wait times that were 8 bytes, the value in r1 in the example above could be discarded, and only the low 4 bytes of the counter need be used. - -When waiting you should always be sure to use higher comparisons not equality comparisons, as if you try to wait for the gap between the time the method started and the time it ends to be exactly the amount requested, you could miss the value, and wait forever. - -If you cannot figure out how to code the wait function, expand the box below for a guide. - -``` -Borrowing the idea from the GPIO controller, the first function we should write should be to get the address of this system timer. An example of this is shown below: - -.globl GetSystemTimerBase -GetSystemTimerBase: -ldr r0,=0x20003000 -mov pc,lr - -Another function that will prove useful would be one that returns the current counter value in registers r0 and r1: - -.globl GetTimeStamp -GetTimeStamp: -push {lr} -bl GetSystemTimerBase -ldrd r0,r1,[r0,#4] -pop {pc} - -This function simply uses the GetSystemTimerBase function and loads in the counter value using ldrd like we have just learned. - -Now we actually want to code our wait method. First of all, we need to know the counter value when the method started, which we can now get using GetTimeStamp. - -delay .req r2 -mov delay,r0 -push {lr} -bl GetTimeStamp -start .req r3 -mov start,r0 - -This code copies our method's input, the amount of time to delay, into r2, and then calls GetTimeStamp, which we know will return the current counter value in r0 and r1. It then copies the lower 4 bytes of the counter's value to r3. - -Next we need to compute the difference between the current counter value and the reading we just took, and then keep doing so until the gap between them is at least the size of delay. - -loop$: - -bl GetTimeStamp -elapsed .req r1 -sub elapsed,r0,start -cmp elapsed,delay -.unreq elapsed -bls loop$ - -This code will wait until the requested amount of time has passed. It takes a reading from the counter, subtracts the initial value from this reading and then compares that to the requested delay. If the amount of time that has elapsed is less than the requested delay, it branches back to loop$. - -.unreq delay -.unreq start -pop {pc} - -This code finishes off the function by returning. -``` - -### 3 Another Blinking Light - -Once you have what you believe to be a working wait function, change 'main.s' to use it. Alter everywhere you wait to set the value of r0 to some big number (remember it is in microseconds) and then test it on the Raspberry Pi. If it does not function correctly please see our troubleshooting page. - -Once it is working, congratulations you have now mastered another device, and with it, time itself. In the next and final lesson in the OK series, [Lesson 5: OK05][4] we shall use all we have learned to flash out a pattern on the LED. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html - -作者:[Robert Mullins][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.cl.cam.ac.uk/~rdm34 -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.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 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 new file mode 100644 index 0000000000..69a56f3e72 --- /dev/null +++ b/translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: 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 +====== + +OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让 `OK` 或 `ACT` LED 灯按精确的时间间隔来闪烁。假设你已经有了 [课程 3:OK03][1] 的操作系统,我们将以它为基础来构建。 + +### 1、一个新设备 + +定时器是树莓派保持时间的唯一方法。大多数计算机都有一个电池供电的时钟,这样当计算机关机后仍然能保持时间。 + +到目前为止,我们仅看了树莓派硬件的一小部分,即 GPIO 控制器。我只是简单地告诉你做什么,然后它会发生什么事情。现在,我们继续看定时器,并继续带你去了解它的工作原理。 + +和 GPIO 控制器一样,定时器也有地址。在本案例中,定时器的基地址在 20003000~16~。阅读手册我们可以找到下面的表: + +表 1.1 GPIO 控制器寄存器 +| 地址 | 大小 / 字节 | 名字 | 描述 | 读或写 | +| -------- | ------------ | ---------------- | ---------------------------------------------------------- | ---------------- | +| 20003000 | 4 | Control / Status | 用于控制和清除定时器通道比较器匹配的寄存器 | RW | +| 20003004 | 8 | Counter | 按 1 MHz 的频率递增的计数器 | R | +| 2000300C | 4 | Compare 0 | 0 号比较器寄存器 | RW | +| 20003010 | 4 | Compare 1 | 1 号比较器寄存器 | RW | +| 20003014 | 4 | Compare 2 | 2 号比较器寄存器 | RW | +| 20003018 | 4 | Compare 3 | 3 号比较器寄存器 | RW | + +![Flowchart of the system timer's operation][2] + +这个表只告诉我们一部分内容,在手册中描述了更多的字段。手册上解释说,定时器本质上是按每微秒将计数器递增 1 的方式来运行。每次它是这样做的,它将计数器的低 32 位(4 字节)与 4 个比较器寄存器进行比较,如果匹配它们中的任何一个,它更新 `Control/Status` 以反映出其中有一个是匹配的。 + +关于bit、字节、位字段bit field、以及数据大小的更多内容如下: + +> +> 一个位是一个单个的二进制数的名称。你可能还记得,一个单个的二进制数即可能是一个 1,也可能是一个 0。 +> +> 一个字节是一个 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` 寄存器更新。 + + +``` +像这样存在被称为"并发问题"的问题,并且几乎无法解决。 +``` + +这两种策略都工作的很好,但在本教程中,我们将只实现第一个。原因是比较器寄存器更容易出错,因为在增加等待时间并保存它到比较器的寄存器期间,计数器可能已经增加了,并因此可能会不匹配。如果请求的是 1 微秒(或更糟糕的情况是 0 微秒)的等待,这样可能导致非常长的意外延迟。 + +### 2、实现 + +``` +大型的操作系统通常使用等待函数来抓住机会在后台执行任务。 +``` + +我将把这个创建完美的等待方法的挑战留给你。我建议你将所有与定时器相关的代码都放在一个名为 `systemTimer.s` 的文件中(理由很明显)。关于这个方法的复杂部分是,计数器是一个 8 字节值,而每个寄存器仅能保存 4 字节。所以,计数器值将分到 2 个寄存器中。 + +下列的代码块是一个示例。 + +```assembly +ldrd r0,r1,[r2,#4] +``` + +```assembly +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~。 + +实现它的更明智的方式应该是,去计算当前计数器值与来自方法启动后的那一个值的差,然后将它与要求的等待时间数量进行比较。除非恰好你希望的等待时间是支持 8 字节的,否则上面示例中寄存器 `r1` 中的值将会丢失,而计数器仅需要使用低位 4 字节。 + +当等待开始时,你应该总是确保使用大于比较,而不是使用等于比较,因为如果你尝试去等待一个时间,而这个时间正好等于方法开始的时间与结束的时间之差,那么你就错过这个值而永远等待下去。 + +如果你不明白如何编写等待函数的代码,可以参考下面的指南。 + +> +> 借鉴 GPIO 控制器的创意,第一个函数我们应该去写如何取得系统定时器的地址。示例如下: +> +> ```assembly +> .globl GetSystemTimerBase +> GetSystemTimerBase: +> ldr r0,=0x20003000 +> mov pc,lr +> ``` +> +> 另一个被证明非常有用的函数是在寄存器 `r0` 和 `r1` 中返回当前计数器值: +> +> ```assembly +> .globl GetTimeStamp +> GetTimeStamp: +> push {lr} +> bl GetSystemTimerBase +> ldrd r0,r1,[r0,#4] +> pop {pc} +> ``` +> +> 这个函数简单地使用了 `GetSystemTimerBase` 函数,并像我们前面学过的那样,使用 `ldrd` 去加载当前计数器值。 +> +> 现在,我们可以去写我们的等待方法的代码了。首先,在方法启动后,我们需要知道计数器值,当前计数器值我们现在已经可以使用 `GetTimeStamp` 来取得了。 +> +> ```assembly +> delay .req r2 +> mov delay,r0 +> push {lr} +> bl GetTimeStamp +> start .req r3 +> mov start,r0 +> ``` +> +> 这个代码复制我们的方法的输入,将延迟时间的数量放到寄存器 `r2` 中,然后调用 `GetTimeStamp`,这个函数将会在寄存器 `r0` 和 `r1` 中返回当前计数器值。接着复制计数器值的低位 4 字节到寄存器 `r3` 中。 +> +> 接下来,我们需要计算当前计数器值与读入的值的差,然后持续这样做,直到它们的差至少是延迟大小为止。 +> +> ```assembly +> loop$: +> +> bl GetTimeStamp +> elapsed .req r1 +> sub elapsed,r0,start +> cmp elapsed,delay +> .unreq elapsed +> bls loop$ +> ``` +> +> 这个代码将一直等待,一直到等待到传递给它的时间数量为止。它从计数器中读取数值,减去最初从计数器中读取的值,然后与要求的延迟时间进行比较。如果过去的时间数量小于要求的延迟,它切换到 `loop$`。 +> +> ```assembly +> .unreq delay +> .unreq start +> pop {pc} +> ``` +> +> 代码完成后,函数返回。 +> + + +### 3、另一个闪灯程序 + +你一旦明白了等待函数的工作原理,修改 `main.s` 去使用它。修改各处 `r0` 的等待设置值为某个很大的数量(记住它的单位是微秒),然后在树莓派上测试。如果函数不能正常工作,请查看我们的排错页面。 + +如果正常工作,恭喜你学会控制另一个设备了,会使用它,则时间由你控制。在下一节课程中,我们将完成 OK 系列课程的最后一节 [课程 5:OK05][4],我们将使用我们已经学习过的知识让 LED 按我们的模式进行闪烁。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [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 +[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 843ad984c4999fd0af75c6afdca1ff8c961a7acd Mon Sep 17 00:00:00 2001 From: Ezio Date: Mon, 4 Feb 2019 14:37:29 +0800 Subject: [PATCH 0955/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=B8=AD=20ezio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @oska874 --- ...20205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md index 9eb5bf6f93..62f0b67cca 100644 --- a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md +++ b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (oska874) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,6 +7,8 @@ [#]: 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 + Computer Laboratory – Raspberry Pi: Lesson 5 OK05 ====== From 2ce8b1d6cce2cb2038cec28c992bd7d4c1052fee Mon Sep 17 00:00:00 2001 From: Ezio Date: Mon, 4 Feb 2019 15:55:50 +0800 Subject: [PATCH 0956/4278] stage --- ...aboratory - Raspberry Pi- Lesson 5 OK05.md | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md index 62f0b67cca..3bf0ee9993 100644 --- a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md +++ b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @@ -9,23 +9,30 @@ translating by ezio -Computer Laboratory – Raspberry Pi: Lesson 5 OK05 +树莓派计算机实验室 课程 5 OK05 ====== The OK05 lesson builds on OK04 using it to flash the SOS Morse Code pattern (...---...). It is assumed you have the code for the [Lesson 4: OK04][1] operating system as a basis. -### 1 Data +OK05 课程构建于课程 OK04 的基础,使用更多代码方式烧写 SOS(...---...)。这假设你已经有了 [课程 4: OK04][1] 操作系统的代码基础。 + +### 1 数据 So far, all we've had to do with our operating system is provide instructions to be followed. Sometimes however, instructions are only half the story. Our operating systems may need data. +到目前为止,我们与操作系统有关的所有内容都提供了遵循的说明。然而有时候,说明只是一半。我们的操作系统可能需要数据 + +> Some early Operating Systems did only allow certain types of data in certain files, but this was generally found to be too restrictive. The modern way does make programs a lot more complicated however. +> 一些早期的操作系统确实只允许特定文件中的特定类型的数据,但是这通常被认为太严格了。现代方法确实使程序变得复杂的多。 -``` -Some early Operating Systems did only allow certain types of data in certain files, but this was generally found to be too restrictive. The modern way does make programs a lot more complicated however. -``` In general data is just values that are important. You are probably trained to think of data as being of a specific type, e.g. a text file contains text, an image file contains an image, etc. This is, in truth, just an idea. All data on a computer is just binary numbers, how we choose to interpret them is what counts. In this example we're going to store a light flashing sequence as data. At the end of 'main.s' copy the following code: +通常,只是数据的值很重要。你可能经过训练,认为数据是指定类型,比如,一个文本文件包含文章,一个图像文件包含一幅图片,等等。说实话,这只是一个理想罢了。计算机上的全部数据都是二进制数字,重要的是我们选择用什么来解释这些数据。在这个例子中,我们会将一个闪灯序列(译注:跑马灯程序?)作为数据保存下来。 + +在 `main.s` 结束处复制下面的代码: + ``` .section .data .align 2 @@ -33,26 +40,31 @@ pattern: .int 0b11111111101010100010001000101010 ``` -``` -.align num ensures the address of the next line is a multiple of 2num . -.int val outputs the number val . -``` +>`.align num` 保证下一行代码的地址是 `2^num` 的整数倍。 + +>`.int val` 输出数值 `val`。 To differentiate between data and code, we put all the data in the .data. I've included this on the operating system memory layout diagram here. I've just chosen to put the data after the end of the code. The reason for keeping our data and instructions separate is so that if we eventually implement some security on our operating system, we need to know what parts of the code can be executed, and what parts can't. +要区分数据和代码,我们将数据都放在 `.data` 区域。我已经将该区域包含在操作系统的内存布局图。我已经选择将数据放到代码后面。将我们的指令和数据分开保存的原因是,如果最后我们在自己的操作系统上实现一些安全措施,我们就需要知道代码的那些部分是可以执行的,而那些部分是不行的。 I've used two new commands here. .align and .int. .align ensures alignment of the following data to a specified power of 2. In this case I've used .align 2 which means that this data will definitely be placed at an address which is a multiple of 22 = 4. It is really important to do this, because the ldr instruction we used to read memory only works at addresses that are multiples of 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. -``` -One challenge with data is finding an efficient and useful representation. This method of storing the sequence as on and off units of time is easy to run, but would be difficult to edit, as the concept of a Morse - or . is lost. -``` +命令 `.int` 直接复制它后面的常量到输出。这意味着 `11111111101010100010001000101010`(二进制数) 将会被存放到输出,所以标签模式实际将标记这段数据作为模式。 + +> One challenge with data is finding an efficient and useful representation. This method of storing the sequence as on and off units of time is easy to run, but would be difficult to edit, as the concept of a Morse - or . is lost. +> 对数据的一个挑战是寻找一个高效和有用的展示形式。保存序列????? As I mentioned, data can mean whatever you want. In this case I've encoded the Morse Code SOS sequence, which is ...---... for those unfamiliar. I've used a 0 to represent a unit of time with the LED off, and a 1 to represent a unit of time with the LED on. That way, we can write some code which just displays a sequence in data like this one, and then all we have to do to make it display a different sequence is change the data. This is a very simple example of what operating systems must do all the time; interpret and display data. Copy the following lines before the loop$ label in 'main.s'. +如我提到的,数据可以意味这你想要的所有东西。在这里我编码了摩尔斯代码 SOS 序列,对于不熟悉的人,就是 `...---...`。我使用 0 表示一个时间单元的 LED 灭灯,而 1 表示一个时间单元的 LED 亮。 + ``` ptrn .req r4 ldr ptrn,=pattern From 0bb2736061f6a0296bd53d18721cc7ea4fa3f799 Mon Sep 17 00:00:00 2001 From: Ezio Date: Mon, 4 Feb 2019 17:02:23 +0800 Subject: [PATCH 0957/4278] =?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 @lujun 格式和原文有些出入。 另外中间少几个课程 lesson 3,4?有空补上吧,我这不好操作,就先翻译接下来的几篇了。 --- ...aboratory - Raspberry Pi- Lesson 5 OK05.md | 79 +++++++------------ 1 file changed, 30 insertions(+), 49 deletions(-) diff --git a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md index 3bf0ee9993..912d4c348c 100644 --- a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md +++ b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @@ -12,97 +12,78 @@ translating by ezio 树莓派计算机实验室 课程 5 OK05 ====== -The OK05 lesson builds on OK04 using it to flash the SOS Morse Code pattern (...---...). It is assumed you have the code for the [Lesson 4: OK04][1] operating system as a basis. - -OK05 课程构建于课程 OK04 的基础,使用更多代码方式烧写 SOS(...---...)。这假设你已经有了 [课程 4: OK04][1] 操作系统的代码基础。 +OK05 课程构建于课程 OK04 的基础,使用更多代码方式烧、保存写莫尔斯码的 SOS 序列(`...---...`)。这里假设你已经有了 [课程 4: OK04][1] 操作系统的代码基础。 ### 1 数据 -So far, all we've had to do with our operating system is provide instructions to be followed. Sometimes however, instructions are only half the story. Our operating systems may need data. 到目前为止,我们与操作系统有关的所有内容都提供了遵循的说明。然而有时候,说明只是一半。我们的操作系统可能需要数据 -> Some early Operating Systems did only allow certain types of data in certain files, but this was generally found to be too restrictive. The modern way does make programs a lot more complicated however. > 一些早期的操作系统确实只允许特定文件中的特定类型的数据,但是这通常被认为太严格了。现代方法确实使程序变得复杂的多。 - -In general data is just values that are important. You are probably trained to think of data as being of a specific type, e.g. a text file contains text, an image file contains an image, etc. This is, in truth, just an idea. All data on a computer is just binary numbers, how we choose to interpret them is what counts. In this example we're going to store a light flashing sequence as data. - -At the end of 'main.s' copy the following code: - -通常,只是数据的值很重要。你可能经过训练,认为数据是指定类型,比如,一个文本文件包含文章,一个图像文件包含一幅图片,等等。说实话,这只是一个理想罢了。计算机上的全部数据都是二进制数字,重要的是我们选择用什么来解释这些数据。在这个例子中,我们会将一个闪灯序列(译注:跑马灯程序?)作为数据保存下来。 +通常,只是数据的值很重要。你可能经过训练,认为数据是指定类型,比如,一个文本文件包含文章,一个图像文件包含一幅图片,等等。说实话,这只是一个理想罢了。计算机上的全部数据都是二进制数字,重要的是我们选择用什么来解释这些数据。在这个例子中,我们会将一个闪灯序列作为数据保存下来。 在 `main.s` 结束处复制下面的代码: ``` -.section .data -.align 2 -pattern: +.section .data %定义 .data 段 +.align 2 %对齐 +pattern: %定义整形变量 .int 0b11111111101010100010001000101010 ``` - >`.align num` 保证下一行代码的地址是 `2^num` 的整数倍。 >`.int val` 输出数值 `val`。 -To differentiate between data and code, we put all the data in the .data. I've included this on the operating system memory layout diagram here. I've just chosen to put the data after the end of the code. The reason for keeping our data and instructions separate is so that if we eventually implement some security on our operating system, we need to know what parts of the code can be executed, and what parts can't. 要区分数据和代码,我们将数据都放在 `.data` 区域。我已经将该区域包含在操作系统的内存布局图。我已经选择将数据放到代码后面。将我们的指令和数据分开保存的原因是,如果最后我们在自己的操作系统上实现一些安全措施,我们就需要知道代码的那些部分是可以执行的,而那些部分是不行的。 -I've used two new commands here. .align and .int. .align ensures alignment of the following data to a specified power of 2. In this case I've used .align 2 which means that this data will definitely be placed at an address which is a multiple of 22 = 4. It is really important to do this, because the ldr instruction we used to read memory only works at addresses that are multiples of 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` 直接复制它后面的常量到输出。这意味着 `11111111101010100010001000101010`(二进制数) 将会被存放到输出,所以标签模式实际将标记这段数据作为模式。 -> One challenge with data is finding an efficient and useful representation. This method of storing the sequence as on and off units of time is easy to run, but would be difficult to edit, as the concept of a Morse - or . is lost. -> 对数据的一个挑战是寻找一个高效和有用的展示形式。保存序列????? +> 关于数据的一个挑战是寻找一个高效和有用的展示形式。这种保存一个开、关的时间单元的序列的方式,运行起来很容易,但是将很难编辑,因为摩尔斯的原理 `-` 或 `.` 丢失了。 -As I mentioned, data can mean whatever you want. In this case I've encoded the Morse Code SOS sequence, which is ...---... for those unfamiliar. I've used a 0 to represent a unit of time with the LED off, and a 1 to represent a unit of time with the LED on. That way, we can write some code which just displays a sequence in data like this one, and then all we have to do to make it display a different sequence is change the data. This is a very simple example of what operating systems must do all the time; interpret and display data. +如我提到的,数据可以意味这你想要的所有东西。在这里我编码了摩尔斯代码 SOS 序列,对于不熟悉的人,就是 `...---...`。我使用 0 表示一个时间单元的 LED 灭灯,而 1 表示一个时间单元的 LED 亮。这样,我们可以像这样编写一些代码在数据中显示一个序列,然后要显示不同序列,我们所有需要做的就是修改这段数据。下面是一个非常简单的例子,操作系统必须一直执行这段程序,解释和展示数据。 -Copy the following lines before the loop$ label in 'main.s'. - -如我提到的,数据可以意味这你想要的所有东西。在这里我编码了摩尔斯代码 SOS 序列,对于不熟悉的人,就是 `...---...`。我使用 0 表示一个时间单元的 LED 灭灯,而 1 表示一个时间单元的 LED 亮。 +复制下面几行到 `main.s` 中的标记 `loop$` 之前。 ``` -ptrn .req r4 -ldr ptrn,=pattern -ldr ptrn,[ptrn] -seq .req r5 -mov seq,#0 +ptrn .req r4 %重命名 r4 为 ptrn +ldr ptrn,=pattern %加载 pattern 的地址到 ptrn +ldr ptrn,[ptrn] %加载地址 ptrn 所在内存的值 +seq .req r5 %重命名 r5 为 seq +mov seq,#0 %seq 赋值为 0 ``` -This code loads the pattern into r4, and loads 0 into r5. r5 will be our sequence position, so we can keep track of how much of the pattern we have displayed. +这段代码加载 `pattrern` 到寄存器 `r4`,并加载 0 到寄存器 `r5`。`r5` 将是我们的序列位置,所以我们可以追踪有多少 `pattern` 我们已经展示了。 -The following code puts a non-zero into r1 if and only if there is a 1 in the current part of the pattern. +下面的代码将非零值放入 `r1` ,如果仅仅是如果,这里有个 1 在当前位置的 `pattern`。 ``` -mov r1,#1 -lsl r1,seq -and r1,ptrn +mov r1,#1 %加载1到 r1 +lsl r1,seq %对r1 的值逻辑左移 seq 次 +and r1,ptrn %按位与 ``` -This code is useful for your calls to SetGpio, which must have a non-zero value to turn the LED off, and a value of zero to turn the LED on. +这段代码对你调用 `SetGpio` 很有用,它必须有一个非零值来关掉 LED,而一个0值会打开 LED。 -Now modify all of your code in 'main.s' so that each loop the code sets the LED based on the current sequence number, waits for 250000 micro seconds (or any other appropriate delay), and then increments the sequence number. When the sequence number reaches 32, it needs to go back to 0. See if you can implement this, and for an extra challenge, try to do it using only 1 instruction (solution in the download). +现在修改 `main.s` 中全部你的代码,这样代码中每次循环会根据当前的序列数设置 LED,等待 250000 毫秒(或者其他合适的延时),然后增加序列数。当这个序列数到达 32 就需要返回 0.看看你是否能实现这个功能,作为额外的挑战,也可以试着只使用一条指令。 -### 2 Time Flies When You're Having Fun... +### 2 Time Flies When You're Having Fun... 当你玩得开心时,过得很快 -You're now ready to test this on the Raspberry Pi. It should flash out a sequence of 3 short pulses, 3 long pulses and then 3 more short pulses. After a delay, the pattern should repeat. If it doesn't work please see our troubleshooting page. +你现在准备好在树莓派上实验。应该闪烁一串包含 3 个短脉冲,3 个长脉冲,然后 3 个更短脉冲的序列。在一次延时之后,这种模式应该重复。如果这部工作,请查看我们的问题页。 -Once it works, congratulations you have reached the end of the OK series of tutorials. +一旦它工作,祝贺你已经达到 OK 系列教程的结束。 -In this series we've learnt about assembly code, the GPIO controller and the System Timer. We've learnt about functions and the ABI, as well as several basic Operating System concepts, and also about data. +在这个谢列我们学习了汇编代码,GPIO 控制器和系统定时器。我们已经学习了函数和 ABI,以及几个基础的操作系统原理,和关于数据的知识。 -You're now ready to move onto one of the more advanced series. - - * The [Screen][2] series is next and teaches you how to use the screen with assembly code. - * The [Input][3] series teaches you how to use the keyboard and mouse. - - - -By now you already have enough information to make Operating Systems that interact with the GPIO in other ways. If you have any robot kits, you may want to try writing a robot operating system controlled with the GPIO pins! +你现在已经准备好下面几个更高级的课程的某一个。 + * [Screen][2] 系列是接下来的,会教你如何通过汇编代码使用屏幕。 + * [Input][3] 系列教授你如何使用键盘和鼠标。 + +到现在,你已经有了足够的信息来制作操作系统,用其它方法和 GPIO 交互。如果你有任何机器人工具,你可能会想尝试编写一个通过 GPIO 管教控制的机器人操作系统。 -------------------------------------------------------------------------------- @@ -110,7 +91,7 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html 作者:[Robert Mullins][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 8b43419548382f281665e68a8ffb5ae918c9e3dd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Feb 2019 17:23:18 +0800 Subject: [PATCH 0958/4278] PRF:20190119 Get started with Roland, a random selection tool for the command line.md @geekpi --- ...dom selection tool for the command line.md | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md index 8ec3401d39..b058abd499 100644 --- a/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md +++ b/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md @@ -1,16 +1,16 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Roland, a random selection tool for the command line) [#]: via: (https://opensource.com/article/19/1/productivity-tools-roland) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 Roland,一款命令行随机选择工具 +开始使用 Roland 吧,一款命令行随机选择工具 ====== -Roland 是我们在开源工具系列中的第七个工具,它将帮助你在 2019 年提高工作效率。 +> Roland 可以帮你做出艰难的决定,它是我们在开源工具系列中的第七个工具,将帮助你在 2019 年提高工作效率。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dice_tabletop_board_gaming_game.jpg?itok=y93eW7HN) @@ -22,13 +22,13 @@ Roland 是我们在开源工具系列中的第七个工具,它将帮助你在 当一周的工作结束后,我唯一想做的就是躺到沙发上打一个周末的游戏。但即使我的职业义务在工作日结束后停止了,但我仍然需要管理我的家庭。洗衣、宠物护理、确保我孩子有他所需要的东西,以及最重要的是:决定晚餐吃什么。 -像许多人一样,我经常受到[决策疲劳][1]的困扰,根据速度、准备难易以及(坦白地说)任何让我压力最小的方式都会导致不太健康的晚餐选择。 +像许多人一样,我经常受到[决策疲劳][1]的困扰,根据速度、准备难易程度以及(坦白地说)任何让我压力最小的方式都会导致不太健康的晚餐选择。 ![](https://opensource.com/sites/default/files/uploads/roland-1.png) -[Roland][2]让我计划饭菜变得容易。Roland 是一款专为桌面角色扮演游戏设计的 Perl 应用。它从怪物和雇佣者等物品列表中随机挑选。从本质上讲,Roland 在命令行做的事情与游戏大师在掷骰子时做的同样的事情,以便在游戏大师的《对玩家的坏事书》中的桌子上查找东西。 +[Roland][2] 让我计划饭菜变得容易。Roland 是一款专为桌面角色扮演游戏设计的 Perl 应用。它从怪物和雇佣者等项目列表中随机挑选。从本质上讲,Roland 在命令行做的事情就像游戏管理员在桌子上掷骰子,以便在《要对玩家做的坏事全书》中找个东西一样。 -通过微小的修改,Roland 可以做得更多。例如,只需添加一张桌子,我就可以让 Roland 帮我选择晚餐。 +通过微小的修改,Roland 可以做得更多。例如,只需添加一张表,我就可以让 Roland 帮我选择晚餐。 第一步是安装 Roland 及其依赖项。 @@ -41,36 +41,36 @@ cpan install Getopt::Long::Descriptive Moose \ cd oland ``` -接下来,创建一个名为 **dinner** 的 YAML 文档,并输入我们所有的用餐选项。 +接下来,创建一个名为 `dinner` 的 YAML 文档,并输入我们所有的用餐选项。 ``` type: list pick: 1 items: - - "frozen pizza" - - "chipotle black beans" - - "huevos rancheros" - - "nachos" - - "pork roast" - - "15 bean soup" - - "roast chicken" - - "pot roast" - - "grilled cheese sandwiches" + - "frozen pizza" +  - "chipotle black beans" +  - "huevos rancheros" +  - "nachos" +  - "pork roast" +  - "15 bean soup" +  - "roast chicken" +  - "pot roast" +  - "grilled cheese sandwiches" ``` -运行命令 **bin/roland dinner** 将读取文件并选择其中一项。 +运行命令 `bin/roland dinner` 将读取文件并选择其中一项。 ![](https://opensource.com/sites/default/files/uploads/roland-2.png) -我想提前计划一周,这样我可以提前购买所有食材。 **pick** 命令确定列表中要选择的物品数量,现在,**pick** 设置为 1。如果我想计划一周的晚餐菜单,我可以将 **pick: 1** 变成 **pick: 7**,它会提供一周的菜单。你还可以使用 **-m** 选项手动输入选择。 +我想提前计划一周,这样我可以提前购买所有食材。 `pick` 命令确定列表中要选择的物品数量,现在,`pick` 设置为 1。如果我想计划一周的晚餐菜单,我可以将 `pick: 1` 变成 `pick: 7`,它会提供一周的菜单。你还可以使用 `-m` 选项手动输入选择。 ![](https://opensource.com/sites/default/files/uploads/roland-3.png) -你也可以用 Roland 做些有趣的事情,比如用经典短语添加一个名为 **8ball** 的文件。 +你也可以用 Roland 做些有趣的事情,比如用经典短语添加一个名为 `8ball` 的文件。 ![](https://opensource.com/sites/default/files/uploads/roland-4.png) -你可以创建各种文件来帮助做出长时间工作后看起来非常难做的常见决策。即使你不用来做这个,你仍然可以用它来决定为今晚的游戏设置哪个狡猾的陷阱。 +你可以创建各种文件来帮助做出长时间工作后看起来非常难做的常见决策。即使你不用来做这个,你仍然可以用它来为今晚的游戏设置哪个狡猾的陷阱做个决定。 -------------------------------------------------------------------------------- @@ -80,7 +80,7 @@ via: https://opensource.com/article/19/1/productivity-tools-roland 作者:[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 e23db95c7a019265ca754b7f1ba553287506a7ed Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Feb 2019 17:23:55 +0800 Subject: [PATCH 0959/4278] PUB:20190119 Get started with Roland, a random selection tool for the command line.md @geekpi https://linux.cn/article-10507-1.html --- ...th Roland, a random selection tool for the command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190119 Get started with Roland, a random selection tool for the command line.md (98%) diff --git a/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/published/20190119 Get started with Roland, a random selection tool for the command line.md similarity index 98% rename from translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md rename to published/20190119 Get started with Roland, a random selection tool for the command line.md index b058abd499..5cba8db837 100644 --- a/translated/tech/20190119 Get started with Roland, a random selection tool for the command line.md +++ b/published/20190119 Get started with Roland, a random selection tool for the command line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10507-1.html) [#]: subject: (Get started with Roland, a random selection tool for the command line) [#]: via: (https://opensource.com/article/19/1/productivity-tools-roland) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From f52e22c9f8ebc62f85a48ae71ecbc45813ccb49a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Feb 2019 18:05:59 +0800 Subject: [PATCH 0960/4278] PRF:20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md @zhs852 --- ... Way To Manage Disk Partitions In Linux.md | 275 +++++++++--------- 1 file changed, 136 insertions(+), 139 deletions(-) diff --git a/translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md b/translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md index a165dbbdd0..9931d422e5 100644 --- a/translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md +++ b/translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md @@ -1,49 +1,49 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (fdisk – Easy Way To Manage Disk Partitions In Linux) [#]: via: (https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -fdisk – Linux 下管理磁盘分区的利器 +fdisk:Linux 下管理磁盘分区的利器 ====== 一块硬盘可以被划分成一个或多个逻辑磁盘,我们将其称作分区。我们对硬盘进行的划分信息被储存于建立在扇区 0 的分区表(MBR 或 GPT)中。 -Linux 需要至少一个分区来当作 root 文件系统,所以我们不能在没有分区的情况下安装 Linux 系统。当我们创建一个分区时,我们必须将它格式化为一个适合的文件系统,否则我们就没办法往里面储存文件了。 +Linux 需要至少一个分区来当作根文件系统,所以我们不能在没有分区的情况下安装 Linux 系统。当我们创建一个分区时,我们必须将它格式化为一个适合的文件系统,否则我们就没办法往里面储存文件了。 -要在 Linux 中完成分区的相关工作,我们需要一些工具。Linux 下有很多可用的相关工具,我们曾介绍过 **[Parted 命令][1]**。不过,今天我们的主角是 fdisk。 +要在 Linux 中完成分区的相关工作,我们需要一些工具。Linux 下有很多可用的相关工具,我们曾介绍过 [Parted 命令][1]。不过,今天我们的主角是 `fdisk`。 -人人都喜欢用 fdisk,它是 Linux 下管理磁盘分区的最佳利器之一。它可以操作最大 `2TB` 的分区。大量 Linux 管理员都喜欢使用这个工具,因为当下 LVM 和 SAN 的原因,并没有多少人会用到 2TB 以上的分区。并且这个工具被世界上许多的基础设施所使用。如果你还是想创建比 2TB 更大的分区,请使用 **Parted 命令** 或 **cfdisk 命令**。 +人人都喜欢用 `fdisk`,它是 Linux 下管理磁盘分区的最佳利器之一。它可以操作最大 2TB 的分区。大量 Linux 管理员都喜欢使用这个工具,因为当下 LVM 和 SAN 的原因,并没有多少人会用到 2TB 以上的分区。并且这个工具被世界上许多的基础设施所使用。如果你还是想创建比 2TB 更大的分区,请使用 `parted` 命令 或 `cfdisk` 命令。 对磁盘进行分区和创建文件系统是 Linux 管理员的日常。如果你在许多不同的环境中工作,你一定每天都会重复几次这项操作。 ### Linux 内核是如何理解硬盘的? -作为人类,我们可以很轻松地理解一些事情;但是电脑就不是这样了,它们需要合适的命名交流才能理解事情。 +作为人类,我们可以很轻松地理解一些事情;但是电脑就不是这样了,它们需要合适的命名才能理解这些。 -在 Linux 中,外围设备都位于 `/dev` 挂载点,内核以一下的方式理解硬盘: +在 Linux 中,外围设备都位于 `/dev` 挂载点,内核通过以下的方式理解硬盘: - * **`/dev/hdX[a-z]:`** IDE 硬盘被命名为 hdX - * **`/dev/sdX[a-z]:`** SCSI 硬盘被命名为 sdX - * **`/dev/xdX[a-z]:`** XT 硬盘被命名为 xdX - * **`/dev/vdX[a-z]:`** 虚拟硬盘被命名为 vdX - * **`/dev/fdN:`** 软盘被命名为 fdN - * **`/dev/scdN or /dev/srN:`** CD-ROM 被命名为 /dev/scdN 或 /dev/srN + * `/dev/hdX[a-z]:` IDE 硬盘被命名为 hdX + * `/dev/sdX[a-z]:` SCSI 硬盘被命名为 sdX + * `/dev/xdX[a-z]:` XT 硬盘被命名为 xdX + * `/dev/vdX[a-z]:` 虚拟硬盘被命名为 vdX + * `/dev/fdN:` 软盘被命名为 fdN + * `/dev/scdN or /dev/srN:` CD-ROM 被命名为 `/dev/scdN` 或 `/dev/srN` ### 什么是 fdisk 命令? -fdisk 的意思是 固定的磁盘Fixed Disk格式化磁盘Format Disk,它是命令行下允许用户对分区进行查看、创建、调整大小、删除、移动和复制的工具。它支持 MBR、Sun、SGI、BSD 分区表,但是它不支持 GUID 分区表(GPT)。它不是为操作大分区设计的。 +`fdisk` 的意思是 固定磁盘Fixed Disk格式化磁盘Format Disk,它是命令行下允许用户对分区进行查看、创建、调整大小、删除、移动和复制的工具。它支持 MBR、Sun、SGI、BSD 分区表,但是它不支持 GUID 分区表(GPT)。它不是为操作大分区设计的。 -fdisk 允许我们在每块硬盘上创建最多四个主分区。它们中的其中一个可以作为扩展分区,并下设多个逻辑分区。1-4 扇区作为主分区被保留,逻辑分区从扇区 5 开始。 +`fdisk` 允许我们在每块硬盘上创建最多四个主分区。它们中的其中一个可以作为扩展分区,并下设多个逻辑分区。1-4 扇区作为主分区被保留,逻辑分区从扇区 5 开始。 ![磁盘分区结构图][3] ### 如何在 Linux 下安装 fdisk? -fdisk 作为核心组件内置于 Linux 中,所以你不必手动安装它。 +`fdisk` 作为核心组件内置于 Linux 中,所以你不必手动安装它。 ### 如何用 fdisk 列出可用磁盘? @@ -52,36 +52,36 @@ fdisk 作为核心组件内置于 Linux 中,所以你不必手动安装它。 ```shell $ sudo 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 +Units: sectors of 1 * 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 +Device Boot Start End Sectors Size Id Type +/dev/sda1 * 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 +Units: sectors of 1 * 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 +Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes 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 +Units: sectors of 1 * 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 +Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes ``` @@ -93,19 +93,19 @@ I/O size (minimum/optimal): 512 bytes / 512 bytes ```shell $ sudo fdisk -l /dev/sda 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 +Units: sectors of 1 * 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 +Device Boot Start End Sectors Size Id Type +/dev/sda1 * 20973568 62914559 41940992 20G 83 Linux ``` ### 如何列出 fdisk 所有的可用操作? -在 fdisk 中敲击 `m`,它便会列出所有可用操作: +在 `fdisk` 中敲击 `m`,它便会列出所有可用操作: ```shell $ sudo fdisk /dev/sdc @@ -121,44 +121,44 @@ Command (m for help): m Help: - DOS (MBR) - a toggle a bootable flag - b edit nested BSD disklabel - c toggle the dos compatibility flag + DOS (MBR) + a toggle a bootable flag + b edit nested BSD disklabel + c toggle the dos compatibility flag - Generic - d delete a partition - F list free unpartitioned space - l list known partition types - n add a new partition - p print the partition table - t change a partition type - v verify the partition table - i print information about a partition + Generic + d delete a partition + F list free unpartitioned space + l list known partition types + n add a new partition + p print the partition table + t change a partition type + v verify the partition table + i print information about a partition - Misc - m print this menu - u change display/entry units - x extra functionality (experts only) + Misc + m print this menu + u change display/entry units + x extra functionality (experts only) - Script - I load disk layout from sfdisk script file - O dump disk layout to sfdisk script file + Script + I load disk layout from sfdisk script file + O dump disk layout to sfdisk script file - Save & Exit - w write table to disk and exit - q quit without saving changes + Save & Exit + w write table to disk and exit + q quit without saving changes - Create a new label - g create a new empty GPT partition table - G create a new empty SGI (IRIX) partition table - o create a new empty DOS partition table - s create a new empty Sun partition table + Create a new label + g create a new empty GPT partition table + G create a new empty SGI (IRIX) partition table + o create a new empty DOS partition table + s create a new empty Sun partition table ``` ### 如何使用 fdisk 列出分区类型? -在 fdisk 中敲击 `l`,它便会列出所有可用分区的类型: +在 `fdisk` 中敲击 `l`,它便会列出所有可用分区的类型: ```shell $ sudo fdisk /dev/sdc @@ -172,37 +172,37 @@ Created a new DOS disklabel with disk identifier 0x9ffd00db. Command (m for help): l - 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris - 1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- - 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- - 3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT- - 4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx - 5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data - 6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / . - 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility - 8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt - 9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access - a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O - b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor - c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment - e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs - f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT -10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/ -11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b -12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor -14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor -16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary -17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS -18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE -1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto -1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep -1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT + 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris + 1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- + 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- + 3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT- + 4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx + 5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data + 6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / . + 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility + 8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt + 9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access + a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O + b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor + c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment + e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs + f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT +10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/ +11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b +12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor +14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor +16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary +17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS +18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE +1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto +1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep +1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT ``` ### 如何使用 fdisk 创建一个磁盘分区? 如果你希望新建磁盘分区,请参考下面的步骤。比如我希望在 `/dev/sdc` 中新建四个分区(三个主分区和一个扩展分区),只需要执行下文的命令。 -首先,请在操作 “First sector” 的时候先按下 `Enter`,然后在 “Last sector” 中输入你希望创建分区的大小(可以在数字后面加 KB、MB、G 和 TB)。例如,你希望为这个分区扩容 1GB,就应该在 “Last sector” 中输入 `+1G`。当你创建三个分区之后,fdisk 默认会将分区类型设为扩展分区,如果你希望创建第四个主分区,请输入 `p` 来替代它的默认值 `e`。 +首先,请在操作 “First sector” 的时候先按下回车,然后在 “Last sector” 中输入你希望创建分区的大小(可以在数字后面加 KB、MB、G 和 TB)。例如,你希望为这个分区扩容 1GB,就应该在 “Last sector” 中输入 `+1G`。当你创建三个分区之后,`fdisk` 默认会将分区类型设为扩展分区,如果你希望创建第四个主分区,请输入 `p` 来替代它的默认值 `e`。 ```shell $ sudo fdisk /dev/sdc @@ -214,8 +214,8 @@ Be careful before using the write command. Command (m for help): n Partition type - p primary (0 primary, 0 extended, 4 free) - e extended (container for logical partitions) + p primary (0 primary, 0 extended, 4 free) + e extended (container for logical partitions) Select (default p): Enter Using default response p. @@ -227,14 +227,14 @@ Created a new partition 1 of type 'Linux' and of size 1 GiB. Command (m for help): p 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 +Units: sectors of 1 * 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 +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux Command (m for help): w The partition table has been altered. @@ -256,8 +256,8 @@ Be careful before using the write command. Command (m for help): n Partition type - p primary (3 primary, 0 extended, 1 free) - e extended (container for logical partitions) + p primary (3 primary, 0 extended, 1 free) + e extended (container for logical partitions) Select (default e): Enter Using default response e. @@ -269,17 +269,17 @@ Created a new partition 4 of type 'Extended' and of size 7 GiB. Command (m for help): p 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 +Units: sectors of 1 * 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/sdc2 2099200 4196351 2097152 1G 83 Linux -/dev/sdc3 4196352 6293503 2097152 1G 83 Linux -/dev/sdc4 6293504 20971519 14678016 7G 5 Extended +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux +/dev/sdc2 2099200 4196351 2097152 1G 83 Linux +/dev/sdc3 4196352 6293503 2097152 1G 83 Linux +/dev/sdc4 6293504 20971519 14678016 7G 5 Extended Command (m for help): w The partition table has been altered. @@ -303,11 +303,11 @@ Be careful before using the write command. Command (m for help): F Unpartitioned space /dev/sdc: 7 GiB, 7515144192 bytes, 14678016 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 +Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes - Start End Sectors Size -6293504 20971519 14678016 7G + Start End Sectors Size +6293504 20971519 14678016 7G Command (m for help): q ``` @@ -333,18 +333,18 @@ Created a new partition 5 of type 'Linux' and of size 1 GiB. Command (m for help): p 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 +Units: sectors of 1 * 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/sdc2 2099200 4196351 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 +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux +/dev/sdc2 2099200 4196351 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 Command (m for help): w The partition table has been altered. @@ -373,17 +373,17 @@ Partition 2 has been deleted. Command (m for help): p 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 +Units: sectors of 1 * 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 +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 Command (m for help): w The partition table has been altered. @@ -399,35 +399,33 @@ Syncing disks. ```shell $ sudo mkfs.ext4 /dev/sdc1 -or +或 $ sudo mkfs -t ext4 /dev/sdc1 -or +或 $ sudo mke2fs /dev/sdc1 mke2fs 1.43.5 (04-Aug-2017) Creating filesystem with 262144 4k blocks and 65536 inodes Filesystem UUID: c0a99b51-2b61-4f6a-b960-eb60915faab0 -Superblock backups stored on blocks: - 32768, 98304, 163840, 229376 +Superblock backups stored on blocks: + 32768, 98304, 163840, 229376 -Allocating group tables: done -Writing inode tables: done +Allocating group tables: done +Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done ``` 当你在分区上建立文件系统时,以下重要信息会同时被创建: - * **`Filesystem UUID:`** UUID 代表了通用且独一无二的识别符,UUID 在 Linux 中通常用来识别设备。它 128 位长的数字代表了 32 个十六进制数。 - * **`Superblock:`** Superblock 储存了文件系统的元数据。如果某个文件系统的 Superblock 被破坏,我们就无法挂载它了(也就是说无法访问其中的文件了)。 - * **`Inode:`** Inode 是类 Unix 系统中文件系统的数据结构,它储存了所有除名称以外的文件信息和数据。 - * **`Journal:`** 日志式文件系统包含了用来修复电脑意外关机产生下错误信息的日志(Journal)。 - - + * `Filesystem UUID:` UUID 代表了通用且独一无二的识别符,UUID 在 Linux 中通常用来识别设备。它 128 位长的数字代表了 32 个十六进制数。 + * `Superblock:` 超级块储存了文件系统的元数据。如果某个文件系统的超级块被破坏,我们就无法挂载它了(也就是说无法访问其中的文件了)。 + * `Inode:` Inode 是类 Unix 系统中文件系统的数据结构,它储存了所有除名称以外的文件信息和数据。 + * `Journal:` 日志式文件系统包含了用来修复电脑意外关机产生下错误信息的日志。 ### 如何在 Linux 中挂载分区? -在你创建完分区和文件系统之后,我们需要挂载它们以便使用。我们需要创建一个挂载点来挂载分区,使用 mkdir 来创建一个挂载点。 +在你创建完分区和文件系统之后,我们需要挂载它们以便使用。我们需要创建一个挂载点来挂载分区,使用 `mkdir` 来创建一个挂载点。 ```shell $ sudo mkdir -p /mnt/2g-new @@ -439,7 +437,7 @@ $ sudo mkdir -p /mnt/2g-new $ sudo mount /dev/sdc1 /mnt/2g-new ``` -如果你希望永久挂载某个分区,请将分区详情加入 fstab 文件。我们既可以输入设备名称,也可以输入 UUID。 +如果你希望永久挂载某个分区,请将分区详情加入 `fstab` 文件。我们既可以输入设备名称,也可以输入 UUID。 使用设备名称来进行永久挂载: @@ -449,8 +447,7 @@ $ sudo mount /dev/sdc1 /mnt/2g-new /dev/sdc1 /mnt/2g-new ext4 defaults 0 0 ``` -Permanent mount using UUID Value. To get a UUID of the partition use blkid command. -使用 UUID 来进行永久挂载(请使用 blkid 来获取 UUID): +使用 UUID 来进行永久挂载(请使用 `blkid` 来获取 UUID): ``` $ sudo blkid @@ -464,20 +461,20 @@ $ sudo blkid UUID=d17e3c31-e2c9-4f11-809c-94a549bc43b7 /mnt/2g-new ext4 defaults 0 0 ``` -使用 df 命令亦可: +使用 `df` 命令亦可: ``` $ df -h -Filesystem Size Used Avail Use% Mounted on -udev 969M 0 969M 0% /dev -tmpfs 200M 7.0M 193M 4% /run -/dev/sda1 20G 16G 3.0G 85% / -tmpfs 997M 0 997M 0% /dev/shm -tmpfs 5.0M 4.0K 5.0M 1% /run/lock -tmpfs 997M 0 997M 0% /sys/fs/cgroup -tmpfs 200M 28K 200M 1% /run/user/121 -tmpfs 200M 25M 176M 13% /run/user/1000 -/dev/sdc1 1008M 1.3M 956M 1% /mnt/2g-new +Filesystem Size Used Avail Use% Mounted on +udev 969M 0 969M 0% /dev +tmpfs 200M 7.0M 193M 4% /run +/dev/sda1 20G 16G 3.0G 85% / +tmpfs 997M 0 997M 0% /dev/shm +tmpfs 5.0M 4.0K 5.0M 1% /run/lock +tmpfs 997M 0 997M 0% /sys/fs/cgroup +tmpfs 200M 28K 200M 1% /run/user/121 +tmpfs 200M 25M 176M 13% /run/user/1000 +/dev/sdc1 1008M 1.3M 956M 1% /mnt/2g-new ``` -------------------------------------------------------------------------------- @@ -487,7 +484,7 @@ via: https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/ 作者:[Magesh Maruthamuthu][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 372acf87fc82a24b67fa8dc53de9613d39c8b888 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Feb 2019 18:07:17 +0800 Subject: [PATCH 0961/4278] PUB:20190128 fdisk - Easy Way To Manage Disk Partitions In Linux @zhs852 https://linux.cn/article-10508-1.html --- ...128 fdisk - Easy Way To Manage Disk Partitions In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md (99%) diff --git a/translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md b/published/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md similarity index 99% rename from translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md rename to published/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md index 9931d422e5..5ebe7d556c 100644 --- a/translated/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md +++ b/published/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10508-1.html) [#]: subject: (fdisk – Easy Way To Manage Disk Partitions In Linux) [#]: via: (https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From b3a3e954bb080a1be3e30322955d0b21ab95bfec Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Mon, 4 Feb 2019 20:48:15 +0800 Subject: [PATCH 0962/4278] translated --- ...To Transfer Files Between Linux Systems.md | 177 ------------------ ...To Transfer Files Between Linux Systems.md | 176 +++++++++++++++++ 2 files changed, 176 insertions(+), 177 deletions(-) delete mode 100644 sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md create mode 100644 translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md diff --git a/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md b/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md deleted file mode 100644 index e91412745b..0000000000 --- a/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md +++ /dev/null @@ -1,177 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (dianbanjiu ) -[#]: reviewer: ( ) -[#]: 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) – Easy And Secure Way To Transfer Files Between Linux Systems -====== - -Linux has native command to perform this task nicely using scp and rsync. However, we need to try new things. - -Also, we need to encourage the developers who is working new things with different concept and new technology. - -We also written few articles about these kind of topic, you can navigate those by clicking the below appropriate links. - -Those are **[OnionShare][1]** , **[Magic Wormhole][2]** , **[Transfer.sh][3]** and **ffsend**. - -### What’s Dcp? - -[dcp][4] copies files between hosts on a network using the peer-to-peer Dat network. - -dcp can be seen as an alternative to tools like scp, removing the need to configure SSH access between hosts. - -This lets you transfer files between two remote hosts, without you needing to worry about the specifics of how said hosts reach each other and regardless of whether hosts are behind NATs. - -dcp requires zero configuration and is secure, fast, and peer-to-peer. Also, this is not production-ready software. Use at your own risk. - -### What’s Dat Protocol? - -Dat is a peer-to-peer protocol. A community-driven project powering a next-generation Web. - -### How dcp works: - -dcp will create a dat archive for a specified set of files or directories and, using the generated public key, lets you download said archive from a second host. - -Any data shared over the network is encrypted using the public key of the archive, meaning data access is limited to those who have access to said key. - -### dcp Use cases: - - * Send files to multiple colleagues – just send the generated public key via chat and they can receive the files on their machine. - * Sync files between two physical computers on your local network, without needing to set up SSH access. - * Easily send files to a friend without needing to create a zip and upload it the cloud. - * Copy files to a remote server when you have shell access but not SSH, for example on a kubernetes pod. - * Share files between Linux/macOS and Windows, which isn’t exactly known for great SSH support. - - - -### How To Install NodeJS & npm in Linux? - -dcp package was written in JavaScript programming language so, we need to install NodeJS as a prerequisites to install dcp. Use the following command to install NodeJS in Linux. - -For **`Fedora`** system, use **[DNF Command][5]** to install NodeJS & npm. - -``` -$ sudo dnf install nodejs npm -``` - -For **`Debian/Ubuntu`** systems, use **[APT-GET Command][6]** or **[APT Command][7]** to install NodeJS & npm. - -``` -$ sudo apt install nodejs npm -``` - -For **`Arch Linux`** based systems, use **[Pacman Command][8]** to install NodeJS & npm. - -``` -$ sudo pacman -S nodejs npm -``` - -For **`RHEL/CentOS`** systems, use **[YUM Command][9]** to install NodeJS & npm. - -``` -$ sudo yum install epel-release -$ sudo yum install nodejs npm -``` - -For **`openSUSE Leap`** system, use **[Zypper Command][10]** to install NodeJS & npm. - -``` -$ sudo zypper nodejs6 -``` - -### How To Install dcp in Linux? - -Once you have installed the NodeJS, use the following npm command to install dcp. - -npm is a package manager for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js. - -``` -# npm i -g dat-cp -``` - -### How to Send Files Through dcp? - -Enter the files or folders which you want to transfer to remote server followed by the dcp command, And no need to mention the destination machine name. - -``` -# dcp [File Name Which You Want To Transfer] -``` - -It will generate a dat archive for the given file when you ran the dcp command. Once it’s done then it will geerate a public key at the bottom of the page. - -### How To Receive Files Through dcp? - -Enter the generated the public key on remote server to receive the files or folders. - -``` -# dcp [Public Key] -``` - -To recursively copy directories. - -``` -# dcp [Folder Name Which You Want To Transfer] -r -``` - -In the following example, we are going to transfer a single file. -![][12] - -Output for the above file transfer. -![][13] - -If you want to send more than one file, use the following format. -![][14] - -Output for the above file transfer. -![][15] - -To recursively copy directories. -![][16] - -Output for the above folder transfer. -![][17] - -It won’t allow you to download the files or folders in second time. It means once you downloaded the files or folders then immediately the link will be expired. -![][18] - -Navigate to man page to know about other options. - -``` -# dcp --help -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/ - -作者:[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/onionshare-secure-way-to-share-files-sharing-tool-linux/ -[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ -[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ -[4]: https://github.com/tom-james-watson/dat-cp -[5]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ -[6]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ -[7]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[8]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ -[9]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ -[10]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ -[11]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-1.png -[13]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-2.png -[14]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-3.jpg -[15]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-4.jpg -[16]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-6.jpg -[17]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-7.jpg -[18]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-5.jpg 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 new file mode 100644 index 0000000000..266f82a30c --- /dev/null +++ b/translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: (dianbanjiu ) +[#]: reviewer: ( ) +[#]: 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 系统之间传输文件的安全又容易的方式 +====== + +Linux 本就有 scp 和 rsync 可以完美地完成这个任务。然而我们今天还是想试点新东西。 + +同时我们也很鼓励那些使用不同的理论和新技术开发新东西的开发者。 + +我们也写过其他很多有关这个主题的文章,你可以点击下面的链接访问这些内容。 + +它们分别是 **[OnionShare][1]**,**[Magic Wormhole][2]**,**[Transfer.sh][3]** 和 **ffsend**。 + +### 什么是 Dcp? + +[dcp][4] 在不同主机之间使用对等网络复制文件。 + +dcp 被视作一个像是 scp 这样工具的替代品,无需在主机间进行 SSH 授权。 + +这可以让你在两个主机间传输文件时,无需操心所述主机之间互相访问的细节,以及这些主机是否使用了 NATs。 + +dcp 零配置、安全、快速、且是 P2P 传输。这并不是一个商用软件,使用产生的风险将由使用者自己承担。 + +### 什么是 Dat 协议 + +Dat 是一个 P2P 协议,是一个致力于下一代 Web 的社区驱动的项目。 + +### dcp 如何工作 + +dcp 将会为指定的文件或者文件夹创建一个 dat 归档,并生成一个公钥,使用这个公钥可以让其他人从另外一台主机上下载上面的文件。 + +使用网络共享的任何数据都使用归档的公钥加密,也就是说文件的接收权仅限于那些知道公钥的人。 + +### dcp 使用案例 + + * 向多个同事发送文件 —— 只需要告诉他们生成的公钥,然后他们就可以在他们的机器上收到对应的文件了。 + * 无需设置 SSH 授权就可以在你本地网络的两个不同物理机上同步文件。 + * 无需压缩文件并把文件上传到云端就可以轻松地发送文件。 + * 当你有 shell 授权而没有 SSH 授权时也可以复制文件到远程服务器上。 + * 在没有很好的 SSH 支持的 Linux/macOS 以及 Windows 系统之间分享文件。 + + + +### 如何在 Linux 上安装 NodeJS & npm? + +dcp 是用 JavaScript 写成的,所以在安装 dcp 前,需要先安装 NodeJS。在 Linux 上使用下面的命令安装 NodeJS。 + +**Fedora** 系统,使用 **[DNF 命令][5]** 安装 NodeJS & npm。 + +``` +$ sudo dnf install nodejs npm +``` + +**`Debian/Ubuntu`** 系统,使用 **[APT-GET 命令][6]** 或者 **[APT 命令][6]** 安装 NodeJS & npm。 + +``` +$ sudo apt install nodejs npm +``` + +**`Arch Linux`** 系统,使用 **[Pacman 命令][8]** 安装 NodeJS & npm。 + +``` +$ sudo pacman -S nodejs npm +``` + +**`RHEL/CentOS`** 系统,使用 **[YUM 命令][9]** 安装 NodeJS & npm。 + +``` +$ sudo yum install epel-release +$ sudo yum install nodejs npm +``` + +**`openSUSE Leap`** 系统,使用 **[Zypper 命令][10]** 安装 NodeJS & npm。 + +``` +$ sudo zypper nodejs6 +``` + +### 如何在 Linux 上安装 dcp? + +在安装好 NodeJS 后,使用下面的 npm 命令安装 dcp。 + +npm 是一个 JavaScript 的包管理。它是 JavaScript 的运行环境 Node.js 的默认包管理。 + +``` +# npm i -g dat-cp +``` +### 如何通过 dcp 发送文件? + +在 dcp 命令后跟你想要传输的文件或者文件夹。而且无需注明目标机器的名字。 + +``` +# dcp [File Name Which You Want To Transfer] +``` + +在你运行 dcp 命令时将会为传送的文件生成一个 dat 归档。一旦执行完成将会在页面底部生成一个公钥。 + +### 如何通过 dcp 接收文件 + +在远程服务器上输入公钥即可接收对应的文件或者文件夹。 + +``` +# dcp [Public Key] +``` + +以递归形式复制目录。 + +``` +# dcp [Folder Name Which You Want To Transfer] -r +``` + +下面这个例子我们将会传输单个文件。 +![][12] + +上述文件的输出。 +![][13] + +如果你想传输不止一个文件,使用下面的格式。 +![][14] + +上述文件的输出。 +![][15] + +递归复制文件夹。 +![][16] + +上述文件夹传输的输出。 +![][17] + +这种方式下你只能够下载一次文件或者文件夹,不可以多次下载。这也就意味着一旦你下载了这些文件或者文件夹,这个链接就会立即失效。 +![][18] + +也可以在手册页查看更多的相关选项。 + +``` +# dcp --help +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/ + +作者:[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/onionshare-secure-way-to-share-files-sharing-tool-linux/ +[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ +[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ +[4]: https://github.com/tom-james-watson/dat-cp +[5]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[6]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[7]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[8]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[9]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[10]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[11]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-1.png +[13]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-2.png +[14]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-3.jpg +[15]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-4.jpg +[16]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-6.jpg +[17]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-7.jpg +[18]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-5.jpg From ceb8777ebdeed01232a3869b0cad2c686a4b6b2a Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Mon, 4 Feb 2019 06:58:46 -0600 Subject: [PATCH 0963/4278] Applying for translating a passage Applying for translating a passage --- sources/tech/20171215 Top 5 Linux Music Players.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20171215 Top 5 Linux Music Players.md b/sources/tech/20171215 Top 5 Linux Music Players.md index 3725766d2f..a57ad29c52 100644 --- a/sources/tech/20171215 Top 5 Linux Music Players.md +++ b/sources/tech/20171215 Top 5 Linux Music Players.md @@ -1,3 +1,4 @@ +tomjlw is translating Top 5 Linux Music Players ====== @@ -114,7 +115,7 @@ Learn more about Linux through the free ["Introduction to Linux" ][22]course fro via: https://www.linux.com/learn/intro-to-linux/2017/12/top-5-linux-music-players 作者:[][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 c6711a05f27bcfb2e6a8a0d3ab1a3faf542755c5 Mon Sep 17 00:00:00 2001 From: acyanbird <2534930703@qq.com> Date: Mon, 4 Feb 2019 21:27:52 +0800 Subject: [PATCH 0964/4278] =?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 0965/4278] 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 0966/4278] 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 0967/4278] 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 0968/4278] 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 0969/4278] =?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 0970/4278] 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 0971/4278] 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 0972/4278] 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 0973/4278] 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 0974/4278] 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 0975/4278] 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 0976/4278] 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 0977/4278] 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 0978/4278] 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 0979/4278] =?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 0980/4278] 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 0981/4278] 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 0982/4278] 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 0983/4278] 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 0984/4278] 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 0985/4278] 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 0986/4278] 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 0987/4278] =?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 0988/4278] 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 0989/4278] =?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 0990/4278] 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 0991/4278] 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 0992/4278] 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 0993/4278] 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 0994/4278] 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 0995/4278] 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 0996/4278] 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 0997/4278] 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 0998/4278] 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 0999/4278] =?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 1000/4278] =?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 1001/4278] 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 1002/4278] 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 1003/4278] 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 1004/4278] 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 1005/4278] 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 1006/4278] 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 1007/4278] 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 1008/4278] 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 1009/4278] 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 1010/4278] 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 1011/4278] 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 1012/4278] 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 1013/4278] 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 1014/4278] 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 1015/4278] 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 1016/4278] 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 1017/4278] 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 1018/4278] 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 1019/4278] 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 1020/4278] 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 1021/4278] 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 1022/4278] 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 1023/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190207=2010?= =?UTF-8?q?=20Methods=20To=20Create=20A=20File=20In=20Linux=20sources/tech?= =?UTF-8?q?/20190207=2010=20Methods=20To=20Create=20A=20File=20In=20Linux.?= =?UTF-8?q?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 1024/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190208=203=20?= =?UTF-8?q?Ways=20to=20Install=20Deb=20Files=20on=20Ubuntu=20Linux=20sourc?= =?UTF-8?q?es/tech/20190208=203=20Ways=20to=20Install=20Deb=20Files=20on?= =?UTF-8?q?=20Ubuntu=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 1025/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190208=20How?= =?UTF-8?q?=20To=20Install=20And=20Use=20PuTTY=20On=20Linux=20sources/tech?= =?UTF-8?q?/20190208=20How=20To=20Install=20And=20Use=20PuTTY=20On=20Linux?= =?UTF-8?q?.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 1026/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190207=20How?= =?UTF-8?q?=20to=20determine=20how=20much=20memory=20is=20installed,=20use?= =?UTF-8?q?d=20on=20Linux=20systems=20sources/tech/20190207=20How=20to=20d?= =?UTF-8?q?etermine=20how=20much=20memory=20is=20installed,=20used=20on=20?= =?UTF-8?q?Linux=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 1027/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190208=20Whic?= =?UTF-8?q?h=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 1028/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190208=207=20?= =?UTF-8?q?steps=20for=20hunting=20down=20Python=20code=20bugs=20sources/t?= =?UTF-8?q?ech/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 1029/4278] =?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 1030/4278] =?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 1031/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=207=20?= =?UTF-8?q?predictions=20for=20artificial=20intelligence=20in=202019=20sou?= =?UTF-8?q?rces/talk/20190205=207=20predictions=20for=20artificial=20intel?= =?UTF-8?q?ligence=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 1032/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190206=20Gett?= =?UTF-8?q?ing=20started=20with=20Vim=20visual=20mode=20sources/tech/20190?= =?UTF-8?q?206=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 1033/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190206=204=20?= =?UTF-8?q?steps=20to=20becoming=20an=20awesome=20agile=20developer=20sour?= =?UTF-8?q?ces/talk/20190206=204=20steps=20to=20becoming=20an=20awesome=20?= =?UTF-8?q?agile=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 1034/4278] 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 1035/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190204=207=20?= =?UTF-8?q?Best=20VPN=20Services=20For=202019=20sources/tech/20190204=207?= =?UTF-8?q?=20Best=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 1036/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=20Inst?= =?UTF-8?q?alling=20Kali=20Linux=20on=20VirtualBox:=20Quickest=20&=20Safes?= =?UTF-8?q?t=20Way=20sources/tech/20190205=20Installing=20Kali=20Linux=20o?= =?UTF-8?q?n=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 1037/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=20DNS?= =?UTF-8?q?=20and=20Root=20Certificates=20sources/tech/20190205=20DNS=20an?= =?UTF-8?q?d=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 1038/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=20Inst?= =?UTF-8?q?all=20Apache,=20MySQL,=20PHP=20(LAMP)=20Stack=20On=20Ubuntu=201?= =?UTF-8?q?8.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 1039/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190204=20Top?= =?UTF-8?q?=205=20open=20source=20network=20monitoring=20tools=20sources/t?= =?UTF-8?q?ech/20190204=20Top=205=20open=20source=20network=20monitoring?= =?UTF-8?q?=20tools.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 1040/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190201=20Top?= =?UTF-8?q?=205=20Linux=20Distributions=20for=20New=20Users=20sources/tech?= =?UTF-8?q?/20190201=20Top=205=20Linux=20Distributions=20for=20New=20Users?= =?UTF-8?q?.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 1041/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190206=204=20?= =?UTF-8?q?cool=20new=20projects=20to=20try=20in=20COPR=20for=20February?= =?UTF-8?q?=202019=20sources/tech/20190206=204=20cool=20new=20projects=20t?= =?UTF-8?q?o=20try=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 1042/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190204=20Conf?= =?UTF-8?q?ig=20management=20is=20dead:=20Long=20live=20Config=20Managemen?= =?UTF-8?q?t=20Camp=20sources/talk/20190204=20Config=20management=20is=20d?= =?UTF-8?q?ead-=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 1043/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=2012?= =?UTF-8?q?=20Methods=20To=20Check=20The=20Hard=20Disk=20And=20Hard=20Driv?= =?UTF-8?q?e=20Partition=20On=20Linux=20sources/tech/20190205=2012=20Metho?= =?UTF-8?q?ds=20To=20Check=20The=20Hard=20Disk=20And=20Hard=20Drive=20Part?= =?UTF-8?q?ition=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 1044/4278] =?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 1045/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190131=204=20?= =?UTF-8?q?confusing=20open=20source=20license=20scenarios=20and=20how=20t?= =?UTF-8?q?o=20navigate=20them=20sources/talk/20190131=204=20confusing=20o?= =?UTF-8?q?pen=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 1046/4278] =?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 1047/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=20A=20?= =?UTF-8?q?small=20notebook=20for=20a=20system=20administrator=20sources/t?= =?UTF-8?q?ech/20190129=20A=20small=20notebook=20for=20a=20system=20admini?= =?UTF-8?q?strator.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 1048/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190130=20Oliv?= =?UTF-8?q?e=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 1049/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190131=20OOP?= =?UTF-8?q?=20Before=20OOP=20with=20Simula=20sources/talk/20190131=20OOP?= =?UTF-8?q?=20Before=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 1050/4278] 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 1051/4278] 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 1052/4278] =?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 1053/4278] 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 1054/4278] 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 1055/4278] 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 1056/4278] 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 1057/4278] 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 1058/4278] 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 1059/4278] 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 1060/4278] 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 1061/4278] 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 1062/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=205=20?= =?UTF-8?q?Streaming=20Audio=20Players=20for=20Linux=20sources/tech/201902?= =?UTF-8?q?05=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 1063/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190211=20Intr?= =?UTF-8?q?oducing=20kids=20to=20computational=20thinking=20with=20Python?= =?UTF-8?q?=20sources/talk/20190211=20Introducing=20kids=20to=20computatio?= =?UTF-8?q?nal=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 1064/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190211=20How?= =?UTF-8?q?=20To=20Remove/Delete=20The=20Empty=20Lines=20In=20A=20File=20I?= =?UTF-8?q?n=20Linux=20sources/tech/20190211=20How=20To=20Remove-Delete=20?= =?UTF-8?q?The=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 1065/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190211=20How?= =?UTF-8?q?=20does=20rootless=20Podman=20work=3F=20sources/tech/20190211?= =?UTF-8?q?=20How=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 1066/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190211=20What?= =?UTF-8?q?'s=20the=20right=20amount=20of=20swap=20space=20for=20a=20moder?= =?UTF-8?q?n=20Linux=20system=3F=20sources/tech/20190211=20What-s=20the=20?= =?UTF-8?q?right=20amount=20of=20swap=20space=20for=20a=20modern=20Linux?= =?UTF-8?q?=20system.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 1067/4278] 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 1068/4278] 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 1069/4278] 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 1070/4278] 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 1071/4278] 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 1072/4278] 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 1073/4278] 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 1074/4278] 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 1075/4278] 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 1076/4278] 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 1077/4278] 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 1078/4278] 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 1079/4278] 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 1080/4278] 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 1081/4278] 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 1082/4278] 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 1083/4278] 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 1084/4278] 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 1085/4278] 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 1086/4278] 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 1087/4278] 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 1088/4278] 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 1089/4278] 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 1090/4278] 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 1091/4278] 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 1092/4278] 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 1093/4278] 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 1094/4278] =?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 1095/4278] 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 1096/4278] 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 1097/4278] 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 1098/4278] 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 1099/4278] 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 1100/4278] 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 1101/4278] 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 1102/4278] 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 1103/4278] 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 1104/4278] 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 1105/4278] 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 1106/4278] 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 1107/4278] 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 1108/4278] 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 1109/4278] 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 1110/4278] 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 1111/4278] 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 1112/4278] =?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 1113/4278] 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 1114/4278] 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 1115/4278] 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 1116/4278] 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 1117/4278] 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 1118/4278] 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 1119/4278] 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 1120/4278] 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 1121/4278] 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 1122/4278] 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 1123/4278] 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 1124/4278] 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 1125/4278] 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 1126/4278] 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 1127/4278] 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 1128/4278] 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 1129/4278] 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 1130/4278] 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 1131/4278] 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 1132/4278] 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 1133/4278] 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 1134/4278] 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 1135/4278] 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 1136/4278] 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 1137/4278] 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 1138/4278] 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 1139/4278] 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 1140/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190217=20How?= =?UTF-8?q?=20to=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 1141/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190214=20Run?= =?UTF-8?q?=20Particular=20Commands=20Without=20Sudo=20Password=20In=20Lin?= =?UTF-8?q?ux=20sources/tech/20190214=20Run=20Particular=20Commands=20With?= =?UTF-8?q?out=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 1142/4278] =?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 1143/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190216=20How?= =?UTF-8?q?=20To=20Grant=20And=20Remove=20Sudo=20Privileges=20To=20Users?= =?UTF-8?q?=20On=20Ubuntu=20sources/tech/20190216=20How=20To=20Grant=20And?= =?UTF-8?q?=20Remove=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 1144/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190216=20Fina?= =?UTF-8?q?lCrypt=20=E2=80=93=20An=20Open=20Source=20File=20Encryption=20A?= =?UTF-8?q?pplication=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 1145/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190213=20How?= =?UTF-8?q?=20to=20build=20a=20WiFi=20picture=20frame=20with=20a=20Raspber?= =?UTF-8?q?ry=20Pi=20sources/tech/20190213=20How=20to=20build=20a=20WiFi?= =?UTF-8?q?=20picture=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 1146/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190217=20Inst?= =?UTF-8?q?all=20Android=208.1=20Oreo=20on=20Linux=20To=20Run=20Apps=20&?= =?UTF-8?q?=20Games=20sources/tech/20190217=20Install=20Android=208.1=20Or?= =?UTF-8?q?eo=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 1147/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190215=204=20?= =?UTF-8?q?Methods=20To=20Change=20The=20HostName=20In=20Linux=20sources/t?= =?UTF-8?q?ech/20190215=204=20Methods=20To=20Change=20The=20HostName=20In?= =?UTF-8?q?=20Linux.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 1148/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190214=20Top?= =?UTF-8?q?=205=20podcasts=20for=20Linux=20news=20and=20tips=20sources/tal?= =?UTF-8?q?k/20190214=20Top=205=20podcasts=20for=20Linux=20news=20and=20ti?= =?UTF-8?q?ps.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 1149/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190214=20Drin?= =?UTF-8?q?king=20coffee=20with=20AWK=20sources/tech/20190214=20Drinking?= =?UTF-8?q?=20coffee=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 1150/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190213=20How?= =?UTF-8?q?=20to=20use=20Linux=20Cockpit=20to=20manage=20system=20performa?= =?UTF-8?q?nce=20sources/tech/20190213=20How=20to=20use=20Linux=20Cockpit?= =?UTF-8?q?=20to=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 1151/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190212=20Ampe?= =?UTF-8?q?rsands=20and=20File=20Descriptors=20in=20Bash=20sources/tech/20?= =?UTF-8?q?190212=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 1152/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190212=20Two?= =?UTF-8?q?=20graphical=20tools=20for=20manipulating=20PDFs=20on=20the=20L?= =?UTF-8?q?inux=20desktop=20sources/tech/20190212=20Two=20graphical=20tool?= =?UTF-8?q?s=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 1153/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190212=20How?= =?UTF-8?q?=20To=20Check=20CPU,=20Memory=20And=20Swap=20Utilization=20Perc?= =?UTF-8?q?entage=20In=20Linux=3F=20sources/tech/20190212=20How=20To=20Che?= =?UTF-8?q?ck=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 1154/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190213=20How?= =?UTF-8?q?=20To=20Install,=20Configure=20And=20Use=20Fish=20Shell=20In=20?= =?UTF-8?q?Linux=3F=20sources/tech/20190213=20How=20To=20Install,=20Config?= =?UTF-8?q?ure=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 1155/4278] 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 1156/4278] 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 1157/4278] 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 1158/4278] 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 1159/4278] 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 1160/4278] 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 1161/4278] 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 1162/4278] 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 1163/4278] 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 1164/4278] 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 1165/4278] 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 1166/4278] 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 1167/4278] 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 1168/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190212=20Top?= =?UTF-8?q?=2010=20Best=20Linux=20Media=20Server=20Software=20sources/tech?= =?UTF-8?q?/20190212=20Top=2010=20Best=20Linux=20Media=20Server=20Software?= =?UTF-8?q?.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 1169/4278] 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 1170/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20How?= =?UTF-8?q?=20To=20Restore=20Sudo=20Privileges=20To=20A=20User=20sources/t?= =?UTF-8?q?ech/20190218=20How=20To=20Restore=20Sudo=20Privileges=20To=20A?= =?UTF-8?q?=20User.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 1171/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20Emoj?= =?UTF-8?q?i-Log:=20A=20new=20way=20to=20write=20Git=20commit=20messages?= =?UTF-8?q?=20sources/tech/20190218=20Emoji-Log-=20A=20new=20way=20to=20wr?= =?UTF-8?q?ite=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 1172/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190104=20Thre?= =?UTF-8?q?e=20Ways=20To=20Reset=20And=20Change=20Forgotten=20Root=20Passw?= =?UTF-8?q?ord=20on=20RHEL=207/CentOS=207=20Systems=20sources/tech/2019010?= =?UTF-8?q?4=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 1173/4278] 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 1174/4278] 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 1175/4278] 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 1176/4278] 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 1177/4278] 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 1178/4278] 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 1179/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=205=20?= =?UTF-8?q?Good=20Open=20Source=20Speech=20Recognition/Speech-to-Text=20Sy?= =?UTF-8?q?stems=20sources/tech/20190219=205=20Good=20Open=20Source=20Spee?= =?UTF-8?q?ch=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 1180/4278] =?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 1181/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20Logi?= =?UTF-8?q?cal=20&=20in=20Bash=20sources/tech/20190219=20Logical=20-=20in?= =?UTF-8?q?=20Bash.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 1182/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20How?= =?UTF-8?q?=20our=20non-profit=20works=20openly=20to=20make=20education=20?= =?UTF-8?q?accessible=20sources/talk/20190219=20How=20our=20non-profit=20w?= =?UTF-8?q?orks=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 1183/4278] =?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 1184/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20SPEE?= =?UTF-8?q?D=20TEST:=20x86=20vs.=20ARM=20for=20Web=20Crawling=20in=20Pytho?= =?UTF-8?q?n=20sources/tech/20190218=20SPEED=20TEST-=20x86=20vs.=20ARM=20f?= =?UTF-8?q?or=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 1185/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20How?= =?UTF-8?q?=20to=20List=20Installed=20Packages=20on=20Ubuntu=20and=20Debia?= =?UTF-8?q?n=20[Quick=20Tip]=20sources/tech/20190219=20How=20to=20List=20I?= =?UTF-8?q?nstalled=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 1186/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=203=20?= =?UTF-8?q?tools=20for=20viewing=20files=20at=20the=20command=20line=20sou?= =?UTF-8?q?rces/tech/20190219=203=20tools=20for=20viewing=20files=20at=20t?= =?UTF-8?q?he=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 1187/4278] 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 1188/4278] 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 1189/4278] 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 1190/4278] 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 1191/4278] 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 1192/4278] 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 1193/4278] 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 1194/4278] 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 1195/4278] 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 1196/4278] 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 1197/4278] =?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 1198/4278] 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 1199/4278] 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 1200/4278] 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 1201/4278] 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 1202/4278] 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 1203/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190131=2019?= =?UTF-8?q?=20days=20of=20productivity=20in=202019:=20The=20fails=20source?= =?UTF-8?q?s/tech/20190131=2019=20days=20of=20productivity=20in=202019-=20?= =?UTF-8?q?The=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 1204/4278] 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 1205/4278] 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 1206/4278] 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 1207/4278] 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 1208/4278] 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 1209/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=205=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 1210/4278] 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 1211/4278] 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 1212/4278] 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 1213/4278] 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 1214/4278] 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 1215/4278] 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 1216/4278] =?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 1217/4278] 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 1218/4278] 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 1219/4278] =?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 1220/4278] 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 1221/4278] 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 1222/4278] 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 1223/4278] 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 1224/4278] 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 1225/4278] 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 1226/4278] 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 1227/4278] 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 1228/4278] 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 1229/4278] 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 1230/4278] 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 1231/4278] 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 1232/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190115=20Linu?= =?UTF-8?q?x=20Desktop=20Setup=20=C2=B7=20HookRace=20Blog=20sources/tech/2?= =?UTF-8?q?0190115=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 1233/4278] 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 1234/4278] 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 1235/4278] 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 1236/4278] 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 1237/4278] 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 1238/4278] 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 1239/4278] 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 1240/4278] 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 1241/4278] 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 1242/4278] 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 1243/4278] 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 1244/4278] 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 1245/4278] 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 1246/4278] 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 1247/4278] 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 1248/4278] 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 1249/4278] 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 1250/4278] 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 1251/4278] 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 1252/4278] 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 1253/4278] 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 1254/4278] [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 1255/4278] 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 1256/4278] 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 1257/4278] 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 1258/4278] 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 1259/4278] 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 1260/4278] 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 1261/4278] =?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 1262/4278] 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 1263/4278] =?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 1264/4278] 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 1265/4278] 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 1266/4278] [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 1267/4278] [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 1268/4278] =?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 1269/4278] =?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 1270/4278] 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 1271/4278] =?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 1272/4278] [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 1273/4278] 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 1274/4278] 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 1275/4278] 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 1276/4278] 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 1277/4278] =?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 1278/4278] 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 1279/4278] 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 1280/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=2020181220=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 1281/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190223=20Rege?= =?UTF-8?q?x=20groups=20and=20numerals=20sources/tech/20190223=20Regex=20g?= =?UTF-8?q?roups=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 1282/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Auto?= =?UTF-8?q?mation=20evolution=20sources/tech/20190220=20Automation=20evolu?= =?UTF-8?q?tion.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 1283/4278] 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 1284/4278] 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 1285/4278] 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 1286/4278] 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 1287/4278] 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 1288/4278] 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 1289/4278] 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 1290/4278] 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 1291/4278] 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 1292/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190109=20Conf?= =?UTF-8?q?igure=20Anaconda=20on=20Emacs=20=E2=80=93=20iD=20sources/tech/2?= =?UTF-8?q?0190109=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 1293/4278] 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 1294/4278] 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 1295/4278] 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 1296/4278] 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 1297/4278] 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 1298/4278] 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 1299/4278] =?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 1300/4278] 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 1301/4278] 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 1302/4278] 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 1303/4278] 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 1304/4278] 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 1305/4278] 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 1306/4278] =?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 1307/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190221=20Bash?= =?UTF-8?q?-Insulter=20:=20A=20Script=20That=20Insults=20An=20User=20When?= =?UTF-8?q?=20Typing=20A=20Wrong=20Command=20sources/tech/20190221=20Bash-?= =?UTF-8?q?Insulter=20-=20A=20Script=20That=20Insults=20An=20User=20When?= =?UTF-8?q?=20Typing=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 1308/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190221=20Test?= =?UTF-8?q?ing=20Bash=20with=20BATS=20sources/tech/20190221=20Testing=20Ba?= =?UTF-8?q?sh=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 1309/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=204=20?= =?UTF-8?q?secrets=20management=20tools=20for=20Git=20encryption=20sources?= =?UTF-8?q?/tech/20190219=204=20secrets=20management=20tools=20for=20Git?= =?UTF-8?q?=20encryption.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 1310/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Do?= =?UTF-8?q?=20Linux=20distributions=20still=20matter=20with=20containers?= =?UTF-8?q?=3F=20sources/talk/20190220=20Do=20Linux=20distributions=20stil?= =?UTF-8?q?l=20matter=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 1311/4278] =?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 1312/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Infr?= =?UTF-8?q?astructure=20monitoring:=20Defense=20against=20surprise=20downt?= =?UTF-8?q?ime=20sources/tech/20190220=20Infrastructure=20monitoring-=20De?= =?UTF-8?q?fense=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 1313/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Set?= =?UTF-8?q?=20up=20two-factor=20authentication=20for=20SSH=20on=20Fedora?= =?UTF-8?q?=20sources/tech/20190220=20Set=20up=20two-factor=20authenticati?= =?UTF-8?q?on=20for=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 1314/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20An?= =?UTF-8?q?=20Automated=20Way=20To=20Install=20Essential=20Applications=20?= =?UTF-8?q?On=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 1315/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20Get?= =?UTF-8?q?=20started=20and=20organized=20with=20TiddlyWiki=20sources/tech?= =?UTF-8?q?/20190218=20Get=20started=20and=20organized=20with=20TiddlyWiki?= =?UTF-8?q?.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 1316/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20How?= =?UTF-8?q?=20Linux=20testing=20has=20changed=20and=20what=20matters=20tod?= =?UTF-8?q?ay=20sources/talk/20190219=20How=20Linux=20testing=20has=20chan?= =?UTF-8?q?ged=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 1317/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020160921=20lawy?= =?UTF-8?q?er=20The=20MIT=20License,=20Line=20by=20Line=20sources/talk/201?= =?UTF-8?q?60921=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 1318/4278] 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 1319/4278] 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 1320/4278] 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 1321/4278] 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 1322/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170721=20Fire?= =?UTF-8?q?fox=20and=20org-protocol=20URL=20Capture=20sources/tech/2017072?= =?UTF-8?q?1=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 1323/4278] 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 1324/4278] 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 1325/4278] 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 1326/4278] 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 1327/4278] 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 1328/4278] 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 1329/4278] 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 1330/4278] 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 1331/4278] 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 1332/4278] 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 1333/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170519=20zsh?= =?UTF-8?q?=20shell=20inside=20Emacs=20on=20Windows=20sources/tech/2017051?= =?UTF-8?q?9=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 1334/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170223=20Use?= =?UTF-8?q?=20Emacs=20to=20create=20OAuth=202.0=20UML=20sequence=20diagram?= =?UTF-8?q?s=20sources/tech/20170223=20Use=20Emacs=20to=20create=20OAuth?= =?UTF-8?q?=202.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 1335/4278] 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 1336/4278] 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 1337/4278] 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 1338/4278] 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 1339/4278] 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 1340/4278] 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 1341/4278] 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 1342/4278] 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 1343/4278] 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 1344/4278] =?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 1345/4278] 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 1346/4278] 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 1347/4278] 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 1348/4278] 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 1349/4278] =?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 1350/4278] 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 1351/4278] 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 1352/4278] 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 1353/4278] 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 1354/4278] 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 1355/4278] 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 1356/4278] 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 1357/4278] 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 1358/4278] 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 1359/4278] 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 1360/4278] 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 1361/4278] 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 1362/4278] =?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 1363/4278] 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 1364/4278] 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 1365/4278] 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 1366/4278] 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 1367/4278] 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 1368/4278] =?UTF-8?q?20190206=20=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E5=AE=8C=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 1369/4278] 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 1370/4278] 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 1371/4278] 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 1372/4278] 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 1373/4278] 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 1374/4278] 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 1375/4278] 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 1376/4278] 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 1377/4278] 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 1378/4278] 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 1379/4278] =?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 1380/4278] 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 1381/4278] 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 1382/4278] 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 1383/4278] 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 1384/4278] 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 1385/4278] 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 1386/4278] 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 1387/4278] 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 1388/4278] 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 1389/4278] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=2020190211=20Introducing=20kids=20to=20computational=20thinkin?= =?UTF-8?q?g=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 1390/4278] 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 1391/4278] 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 1392/4278] 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 1393/4278] 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 1394/4278] =?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 1395/4278] 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 1396/4278] 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 1397/4278] 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 1398/4278] 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 1399/4278] 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 1400/4278] 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 1401/4278] 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 1402/4278] 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 1403/4278] =?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 1404/4278] 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 1405/4278] 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 1406/4278] 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 1407/4278] 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 1408/4278] 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 1409/4278] 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 1410/4278] 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 1411/4278] 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 1412/4278] 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 1413/4278] 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 1414/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=205=20?= =?UTF-8?q?ways=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 1415/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=20Runn?= =?UTF-8?q?ing=20the=20=E2=80=98Real=20Debian=E2=80=99=20on=20Raspberry=20?= =?UTF-8?q?Pi=203+=20[For=20DIY=20Enthusiasts]=20sources/tech/20190305=20R?= =?UTF-8?q?unning=20the=20=E2=80=98Real=20Debian-=20on=20Raspberry=20Pi=20?= =?UTF-8?q?3-=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 1416/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=205=20?= =?UTF-8?q?Ways=20To=20Generate=20A=20Random/Strong=20Password=20In=20Linu?= =?UTF-8?q?x=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 1417/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190304=20Lear?= =?UTF-8?q?n=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 1418/4278] =?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 1419/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20How?= =?UTF-8?q?=20to=20use=20sudo=20access=20in=20winSCP=20sources/tech/201903?= =?UTF-8?q?01=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 1420/4278] 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 1421/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190304=20How?= =?UTF-8?q?=20to=20Install=20MongoDB=20on=20Ubuntu=20sources/tech/20190304?= =?UTF-8?q?=20How=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 1422/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190302=20How?= =?UTF-8?q?=20to=20buy=20a=20Raspberry=20Pi=20sources/tech/20190302=20How?= =?UTF-8?q?=20to=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 1423/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190303=20Mana?= =?UTF-8?q?ge=20Your=20Mirrors=20with=20ArchLinux=20Mirrorlist=20Manager?= =?UTF-8?q?=20sources/tech/20190303=20Manage=20Your=20Mirrors=20with=20Arc?= =?UTF-8?q?hLinux=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 1424/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20Miyo?= =?UTF-8?q?Linux:=20A=20Lightweight=20Distro=20with=20an=20Old-School=20Ap?= =?UTF-8?q?proach=20sources/tech/20190228=20MiyoLinux-=20A=20Lightweight?= =?UTF-8?q?=20Distro=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 1425/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190302=20Crea?= =?UTF-8?q?te=20a=20Custom=20System=20Tray=20Indicator=20For=20Your=20Task?= =?UTF-8?q?s=20on=20Linux=20sources/tech/20190302=20Create=20a=20Custom=20?= =?UTF-8?q?System=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 1426/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20What?= =?UTF-8?q?'s=20happening=20in=20the=20OpenStack=20community=3F=20sources/?= =?UTF-8?q?talk/20190301=20What-s=20happening=20in=20the=20OpenStack=20com?= =?UTF-8?q?munity.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 1427/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=203=20?= =?UTF-8?q?open=20source=20behavior-driven=20development=20tools=20sources?= =?UTF-8?q?/tech/20190228=203=20open=20source=20behavior-driven=20developm?= =?UTF-8?q?ent=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 1428/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20Conn?= =?UTF-8?q?ecting=20a=20VoIP=20phone=20directly=20to=20an=20Asterisk=20ser?= =?UTF-8?q?ver=20sources/tech/20190228=20Connecting=20a=20VoIP=20phone=20d?= =?UTF-8?q?irectly=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 1429/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Guid?= =?UTF-8?q?e=20to=20Install=20VMware=20Tools=20on=20Linux=20sources/tech/2?= =?UTF-8?q?0190301=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 1430/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20Why?= =?UTF-8?q?=20CLAs=20aren't=20good=20for=20open=20source=20sources/talk/20?= =?UTF-8?q?190228=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 1431/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Whic?= =?UTF-8?q?h=20Raspberry=20Pi=20should=20you=20choose=3F=20sources/tech/20?= =?UTF-8?q?190301=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 1432/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20IRC?= =?UTF-8?q?=20vs=20IRL:=20How=20to=20run=20a=20good=20IRC=20meeting=20sour?= =?UTF-8?q?ces/talk/20190228=20IRC=20vs=20IRL-=20How=20to=20run=20a=20good?= =?UTF-8?q?=20IRC=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 1433/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How?= =?UTF-8?q?=20To=20Find=20Available=20Network=20Interfaces=20On=20Linux=20?= =?UTF-8?q?sources/tech/20190227=20How=20To=20Find=20Available=20Network?= =?UTF-8?q?=20Interfaces=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 1434/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20A=20?= =?UTF-8?q?Brief=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 1435/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20All?= =?UTF-8?q?=20about=20{Curly=20Braces}=20in=20Bash=20sources/tech/20190226?= =?UTF-8?q?=20All=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 1436/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20Let?= =?UTF-8?q?=20your=20engineers=20choose=20the=20license:=20A=20guide=20sou?= =?UTF-8?q?rces/talk/20190227=20Let=20your=20engineers=20choose=20the=20li?= =?UTF-8?q?cense-=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 1437/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How?= =?UTF-8?q?=20To=20Check=20Password=20Complexity/Strength=20And=20Score=20?= =?UTF-8?q?In=20Linux=3F=20sources/tech/20190227=20How=20To=20Check=20Pass?= =?UTF-8?q?word=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 1438/4278] 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 1439/4278] 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 1440/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20Linu?= =?UTF-8?q?x=20security:=20Cmd=20provides=20visibility,=20control=20over?= =?UTF-8?q?=20user=20activity=20sources/tech/20190226=20Linux=20security-?= =?UTF-8?q?=20Cmd=20provides=20visibility,=20control=20over=20user=20activ?= =?UTF-8?q?ity.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 1441/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How?= =?UTF-8?q?=20to=20Display=20Weather=20Information=20in=20Ubuntu=2018.04?= =?UTF-8?q?=20sources/tech/20190227=20How=20to=20Display=20Weather=20Infor?= =?UTF-8?q?mation=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 1442/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190223=20No!?= =?UTF-8?q?=20Ubuntu=20is=20NOT=20Replacing=20Apt=20with=20Snap=20sources/?= =?UTF-8?q?talk/20190223=20No-=20Ubuntu=20is=20NOT=20Replacing=20Apt=20wit?= =?UTF-8?q?h=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 1443/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20Redu?= =?UTF-8?q?cing=20security=20risks=20with=20centralized=20logging=20source?= =?UTF-8?q?s/talk/20190226=20Reducing=20security=20risks=20with=20centrali?= =?UTF-8?q?zed=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 1444/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20How?= =?UTF-8?q?=20To=20SSH=20Into=20A=20Particular=20Directory=20On=20Linux=20?= =?UTF-8?q?sources/tech/20190226=20How=20To=20SSH=20Into=20A=20Particular?= =?UTF-8?q?=20Directory=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 1445/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20How?= =?UTF-8?q?=20To=20Identify=20That=20The=20Linux=20Server=20Is=20Integrate?= =?UTF-8?q?d=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 1446/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190222=20Deve?= =?UTF-8?q?loper=20happiness:=20What=20you=20need=20to=20know=20sources/ta?= =?UTF-8?q?lk/20190222=20Developer=20happiness-=20What=20you=20need=20to?= =?UTF-8?q?=20know.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 1447/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20Netb?= =?UTF-8?q?oot=20a=20Fedora=20Live=20CD=20sources/tech/20190225=20Netboot?= =?UTF-8?q?=20a=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 1448/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20How?= =?UTF-8?q?=20to=20Install=20VirtualBox=20on=20Ubuntu=20[Beginner=E2=80=99?= =?UTF-8?q?s=20Tutorial]=20sources/tech/20190225=20How=20to=20Install=20Vi?= =?UTF-8?q?rtualBox=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 1449/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20Teac?= =?UTF-8?q?hing=20scientists=20how=20to=20share=20code=20sources/talk/2019?= =?UTF-8?q?0225=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 1450/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=205=20?= =?UTF-8?q?Linux=20GUI=20Cloud=20Backup=20Tools=20sources/tech/20190205=20?= =?UTF-8?q?5=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 1451/4278] 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 1452/4278] 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 1453/4278] 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 1454/4278] 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 1455/4278] 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 1456/4278] 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 1457/4278] 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 1458/4278] =?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 1459/4278] 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 1460/4278] 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 1461/4278] 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 1462/4278] 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 1463/4278] 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 1464/4278] =?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 1465/4278] 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 1466/4278] 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 1467/4278] 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 1468/4278] 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 1469/4278] 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 1470/4278] 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 1471/4278] 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 1472/4278] 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 1473/4278] 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 1474/4278] 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 1475/4278] 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 1476/4278] 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 1477/4278] 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 1478/4278] 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 1479/4278] 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 1480/4278] 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 1481/4278] [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 1482/4278] 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 1483/4278] =?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 1484/4278] 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 1485/4278] 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 1486/4278] 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 1487/4278] 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 1488/4278] 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 1489/4278] 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 1490/4278] 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 1491/4278] 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 1492/4278] 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 1493/4278] 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 1494/4278] 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 1495/4278] 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 1496/4278] 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 1497/4278] 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 1498/4278] 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 1499/4278] 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 1500/4278] 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 1501/4278] 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 1502/4278] 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 1503/4278] 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 1504/4278] =?UTF-8?q?20180926=20=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E5=AE=8C=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 1505/4278] 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 1506/4278] 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 1507/4278] 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 1508/4278] 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 1509/4278] 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 1510/4278] 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 1511/4278] 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 1512/4278] 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 1513/4278] 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 1514/4278] 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 1515/4278] 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 1516/4278] 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 1517/4278] 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 1518/4278] 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 1519/4278] 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 1520/4278] 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 1521/4278] 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 1522/4278] 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 1523/4278] 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 1524/4278] 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 1525/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20Get?= =?UTF-8?q?=20started=20with=20Freeplane,=20an=20open=20source=20mind=20ma?= =?UTF-8?q?pping=20application=20sources/tech/20190125=20Get=20started=20w?= =?UTF-8?q?ith=20Freeplane,=20an=20open=20source=20mind=20mapping=20applic?= =?UTF-8?q?ation.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 1526/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190117=20Get?= =?UTF-8?q?=20started=20with=20CryptPad,=20an=20open=20source=20collaborat?= =?UTF-8?q?ive=20document=20editor=20sources/tech/20190117=20Get=20started?= =?UTF-8?q?=20with=20CryptPad,=20an=20open=20source=20collaborative=20docu?= =?UTF-8?q?ment=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 1527/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190116=20Get?= =?UTF-8?q?=20started=20with=20Cypht,=20an=20open=20source=20email=20clien?= =?UTF-8?q?t=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 1528/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190312=20Do?= =?UTF-8?q?=20advanced=20math=20with=20Mathematica=20on=20the=20Raspberry?= =?UTF-8?q?=20Pi=20sources/tech/20190312=20Do=20advanced=20math=20with=20M?= =?UTF-8?q?athematica=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 1529/4278] =?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 1530/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190303=20How?= =?UTF-8?q?=20to=20boot=20up=20a=20new=20Raspberry=20Pi=20sources/tech/201?= =?UTF-8?q?90303=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 1531/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=203=20?= =?UTF-8?q?popular=20programming=20languages=20you=20can=20learn=20with=20?= =?UTF-8?q?Raspberry=20Pi=20sources/tech/20190306=203=20popular=20programm?= =?UTF-8?q?ing=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 1532/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Buil?= =?UTF-8?q?ding=20the=20virtualization=20stack=20of=20the=20future=20with?= =?UTF-8?q?=20rust-vmm=20sources/tech/20190311=20Building=20the=20virtuali?= =?UTF-8?q?zation=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 1533/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20How?= =?UTF-8?q?=20to=20keep=20your=20Raspberry=20Pi=20updated=20sources/tech/2?= =?UTF-8?q?0190307=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 1534/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190308=20How?= =?UTF-8?q?=20to=20use=20your=20Raspberry=20Pi=20for=20entertainment=20sou?= =?UTF-8?q?rces/tech/20190308=20How=20to=20use=20your=20Raspberry=20Pi=20f?= =?UTF-8?q?or=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 1535/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190309=20Emul?= =?UTF-8?q?ators=20and=20Native=20Linux=20games=20on=20the=20Raspberry=20P?= =?UTF-8?q?i=20sources/tech/20190309=20Emulators=20and=20Native=20Linux=20?= =?UTF-8?q?games=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 1536/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190310=20Let'?= =?UTF-8?q?s=20get=20physical:=20How=20to=20use=20GPIO=20pins=20on=20the?= =?UTF-8?q?=20Raspberry=20Pi=20sources/tech/20190310=20Let-s=20get=20physi?= =?UTF-8?q?cal-=20How=20to=20use=20GPIO=20pins=20on=20the=20Raspberry=20Pi?= =?UTF-8?q?.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 1537/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Lear?= =?UTF-8?q?n=20about=20computer=20security=20with=20the=20Raspberry=20Pi?= =?UTF-8?q?=20and=20Kali=20Linux=20sources/tech/20190311=20Learn=20about?= =?UTF-8?q?=20computer=20security=20with=20the=20Raspberry=20Pi=20and=20Ka?= =?UTF-8?q?li=20Linux.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 1538/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Disc?= =?UTF-8?q?uss=20everything=20Fedora=20sources/talk/20190311=20Discuss=20e?= =?UTF-8?q?verything=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 1539/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190718=203=20?= =?UTF-8?q?Emacs=20modes=20for=20taking=20notes=20sources/tech/20190718=20?= =?UTF-8?q?3=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 1540/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=207=20?= =?UTF-8?q?resources=20for=20learning=20to=20use=20your=20Raspberry=20Pi?= =?UTF-8?q?=20sources/tech/20190311=207=20resources=20for=20learning=20to?= =?UTF-8?q?=20use=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 1541/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020181218=20Usin?= =?UTF-8?q?g=20Pygame=20to=20move=20your=20game=20character=20around=20sou?= =?UTF-8?q?rces/tech/20181218=20Using=20Pygame=20to=20move=20your=20game?= =?UTF-8?q?=20character=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 1542/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190309=20How?= =?UTF-8?q?=20To=20Fix=20=E2=80=9CNetwork=20Protocol=20Error=E2=80=9D=20On?= =?UTF-8?q?=20Mozilla=20Firefox=20sources/tech/20190309=20How=20To=20Fix?= =?UTF-8?q?=20-Network=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 1543/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171214=20Buil?= =?UTF-8?q?d=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 1544/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171215=20How?= =?UTF-8?q?=20to=20add=20a=20player=20to=20your=20Python=20game=20sources/?= =?UTF-8?q?tech/20171215=20How=20to=20add=20a=20player=20to=20your=20Pytho?= =?UTF-8?q?n=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 1545/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180725=20Put?= =?UTF-8?q?=20platforms=20in=20a=20Python=20game=20with=20Pygame=20sources?= =?UTF-8?q?/tech/20180725=20Put=20platforms=20in=20a=20Python=20game=20wit?= =?UTF-8?q?h=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 1546/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Gett?= =?UTF-8?q?ing=20started=20with=20the=20Geany=20text=20editor=20sources/te?= =?UTF-8?q?ch/20190306=20Getting=20started=20with=20the=20Geany=20text=20e?= =?UTF-8?q?ditor.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 1547/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190308=20Virt?= =?UTF-8?q?ual=20filesystems=20in=20Linux:=20Why=20we=20need=20them=20and?= =?UTF-8?q?=20how=20they=20work=20sources/tech/20190308=20Virtual=20filesy?= =?UTF-8?q?stems=20in=20Linux-=20Why=20we=20need=20them=20and=20how=20they?= =?UTF-8?q?=20work.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 1548/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Clus?= =?UTF-8?q?terShell=20=E2=80=93=20A=20Nifty=20Tool=20To=20Run=20Commands?= =?UTF-8?q?=20On=20Cluster=20Nodes=20In=20Parallel=20sources/tech/20190306?= =?UTF-8?q?=20ClusterShell=20-=20A=20Nifty=20Tool=20To=20Run=20Commands=20?= =?UTF-8?q?On=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 1549/4278] 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 1550/4278] 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 1551/4278] 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 1552/4278] 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 1553/4278] 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 1554/4278] 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 1555/4278] 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 1556/4278] 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 1557/4278] 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 1558/4278] =?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 1559/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190312=20Back?= =?UTF-8?q?Box=20Linux=20for=20Penetration=20Testing=20sources/tech/201903?= =?UTF-8?q?12=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 1560/4278] =?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 1561/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020160301=20How?= =?UTF-8?q?=20To=20Set=20Password=20Policies=20In=20Linux=20sources/tech/2?= =?UTF-8?q?0160301=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 1562/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20Smal?= =?UTF-8?q?l=20Scale=20Scrum=20vs.=20Large=20Scale=20Scrum=20sources/talk/?= =?UTF-8?q?20190307=20Small=20Scale=20Scrum=20vs.=20Large=20Scale=20Scrum.?= =?UTF-8?q?md?= 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 1563/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=2013?= =?UTF-8?q?=20open=20source=20backup=20solutions=20sources/tech/20190307?= =?UTF-8?q?=2013=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 1564/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20How?= =?UTF-8?q?=20to=20Restart=20a=20Network=20in=20Ubuntu=20[Beginner?= =?UTF-8?q?=E2=80=99s=20Tip]=20sources/tech/20190307=20How=20to=20Restart?= =?UTF-8?q?=20a=20Network=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 1565/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20How?= =?UTF-8?q?=20to=20pack=20an=20IT=20travel=20kit=20sources/talk/20190306?= =?UTF-8?q?=20How=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 1566/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Get?= =?UTF-8?q?=20cooking=20with=20GNOME=20Recipes=20on=20Fedora=20sources/tec?= =?UTF-8?q?h/20190306=20Get=20cooking=20with=20GNOME=20Recipes=20on=20Fedo?= =?UTF-8?q?ra.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 1567/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Bloc?= =?UTF-8?q?kchain=202.0:=20An=20Introduction=20[Part=201]=20sources/tech/2?= =?UTF-8?q?0190301=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 1568/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Bloc?= =?UTF-8?q?kchain=202.0:=20Revolutionizing=20The=20Financial=20System=20[P?= =?UTF-8?q?art=202]=20sources/tech/20190306=20Blockchain=202.0-=20Revoluti?= =?UTF-8?q?onizing=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 1569/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=20How?= =?UTF-8?q?=20rootless=20Buildah=20works:=20Building=20containers=20in=20u?= =?UTF-8?q?nprivileged=20environments=20sources/tech/20190305=20How=20root?= =?UTF-8?q?less=20Buildah=20works-=20Building=20containers=20in=20unprivil?= =?UTF-8?q?eged=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 1570/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Bloc?= =?UTF-8?q?kchain=202.0:=20Redefining=20Financial=20Services=20[Part=203]?= =?UTF-8?q?=20sources/tech/20190311=20Blockchain=202.0-=20Redefining=20Fin?= =?UTF-8?q?ancial=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 1571/4278] 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 1572/4278] 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 1573/4278] 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 1574/4278] 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 1575/4278] 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 1576/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=20A=20?= =?UTF-8?q?Look=20Back=20at=20the=20History=20of=20Firefox=20sources/talk/?= =?UTF-8?q?20190314=20A=20Look=20Back=20at=20the=20History=20of=20Firefox.?= =?UTF-8?q?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 1577/4278] 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 1578/4278] 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 1579/4278] =?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 1580/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190313=20Why?= =?UTF-8?q?=20is=20no=20one=20signing=20their=20emails=3F=20sources/talk/2?= =?UTF-8?q?0190313=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 1581/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171119=20Adva?= =?UTF-8?q?nced=20Techniques=20for=20Reducing=20Emacs=20Startup=20Time=20s?= =?UTF-8?q?ources/tech/20171119=20Advanced=20Techniques=20for=20Reducing?= =?UTF-8?q?=20Emacs=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 1582/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180826=20Be?= =?UTF-8?q?=20productive=20with=20Org-mode=20sources/tech/20180826=20Be=20?= =?UTF-8?q?productive=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 1583/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180330=20Asyn?= =?UTF-8?q?chronous=20rsync=20with=20Emacs,=20dired=20and=20tramp.=20sourc?= =?UTF-8?q?es/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 1584/4278] 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 1585/4278] 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 1586/4278] 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 1587/4278] =?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 1588/4278] 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 1589/4278] 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 1590/4278] 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 1591/4278] 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 1592/4278] 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 1593/4278] 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 1594/4278] 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 1595/4278] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=20How=20To=20Remove-Delete=20The=20Empty=20Lines=20In=20A=20Fi?= =?UTF-8?q?le=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 1596/4278] 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 1597/4278] 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 1598/4278] 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 1599/4278] 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 1600/4278] 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 1601/4278] 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 1602/4278] 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 1603/4278] 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 1604/4278] 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 1605/4278] 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 1606/4278] =?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 1607/4278] 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 1608/4278] 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 1609/4278] 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 1610/4278] 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 1611/4278] =?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 1612/4278] [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 1613/4278] 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 1614/4278] 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 1615/4278] 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 1616/4278] 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 1617/4278] 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 1618/4278] 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 1619/4278] 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 1620/4278] 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 1621/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How?= =?UTF-8?q?=20to=20create=20portable=20documents=20with=20CBZ=20and=20DjVu?= =?UTF-8?q?=20sources/tech/20190315=20How=20to=20create=20portable=20docum?= =?UTF-8?q?ents=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 1622/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20Swee?= =?UTF-8?q?t=20Home=203D:=20An=20open=20source=20tool=20to=20help=20you=20?= =?UTF-8?q?decide=20on=20your=20dream=20home=20sources/tech/20190315=20Swe?= =?UTF-8?q?et=20Home=203D-=20An=20open=20source=20tool=20to=20help=20you?= =?UTF-8?q?=20decide=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 1623/4278] 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 1624/4278] 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 1625/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=20Why?= =?UTF-8?q?=20feedback,=20not=20metrics,=20is=20critical=20to=20DevOps=20s?= =?UTF-8?q?ources/talk/20190314=20Why=20feedback,=20not=20metrics,=20is=20?= =?UTF-8?q?critical=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 1626/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190316=20Prog?= =?UTF-8?q?ram=20the=20real=20world=20using=20Rust=20on=20Raspberry=20Pi?= =?UTF-8?q?=20sources/tech/20190316=20Program=20the=20real=20world=20using?= =?UTF-8?q?=20Rust=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 1627/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=2014?= =?UTF-8?q?=20days=20of=20celebrating=20the=20Raspberry=20Pi=20sources/tec?= =?UTF-8?q?h/20190314=2014=20days=20of=20celebrating=20the=20Raspberry=20P?= =?UTF-8?q?i.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 1628/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How?= =?UTF-8?q?=20To=20Parse=20And=20Pretty=20Print=20JSON=20With=20Linux=20Co?= =?UTF-8?q?mmandline=20Tools=20sources/tech/20190315=20How=20To=20Parse=20?= =?UTF-8?q?And=20Pretty=20Print=20JSON=20With=20Linux=20Commandline=20Tool?= =?UTF-8?q?s.md?= 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 1629/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How?= =?UTF-8?q?=20To=20Navigate=20Inside=20A=20Directory/Folder=20In=20Linux?= =?UTF-8?q?=20Without=20CD=20Command=3F=20sources/tech/20190315=20How=20To?= =?UTF-8?q?=20Navigate=20Inside=20A=20Directory-Folder=20In=20Linux=20With?= =?UTF-8?q?out=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 1630/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170414=205=20?= =?UTF-8?q?projects=20for=20Raspberry=20Pi=20at=20home=20sources/tech/2017?= =?UTF-8?q?0414=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 1631/4278] =?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 1632/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Inst?= =?UTF-8?q?all=20MEAN.JS=20Stack=20In=20Ubuntu=2018.04=20LTS=20sources/tec?= =?UTF-8?q?h/20190318=20Install=20MEAN.JS=20Stack=20In=20Ubuntu=2018.04=20?= =?UTF-8?q?LTS.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 1633/4278] 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 1634/4278] 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 1635/4278] 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 1636/4278] 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 1637/4278] 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 1638/4278] =?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 1639/4278] =?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 1640/4278] 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 1641/4278] 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 1642/4278] 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 1643/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20How?= =?UTF-8?q?=20to=20host=20your=20own=20webfonts=20sources/tech/20190318=20?= =?UTF-8?q?How=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 1644/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Buil?= =?UTF-8?q?ding=20and=20augmenting=20libraries=20by=20calling=20Rust=20fro?= =?UTF-8?q?m=20JavaScript=20sources/tech/20190318=20Building=20and=20augme?= =?UTF-8?q?nting=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 1645/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=2010?= =?UTF-8?q?=20Python=20image=20manipulation=20tools=20sources/tech/2019031?= =?UTF-8?q?8=2010=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 1646/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Solu?= =?UTF-8?q?s=204=20=E2=80=98Fortitude=E2=80=99=20Released=20with=20Signifi?= =?UTF-8?q?cant=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 1647/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=203=20?= =?UTF-8?q?Ways=20To=20Check=20Whether=20A=20Port=20Is=20Open=20On=20The?= =?UTF-8?q?=20Remote=20Linux=20System=3F=20sources/tech/20190318=203=20Way?= =?UTF-8?q?s=20To=20Check=20Whether=20A=20Port=20Is=20Open=20On=20The=20Re?= =?UTF-8?q?mote=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 1648/4278] [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 1649/4278] 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 1650/4278] 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 1651/4278] 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 1652/4278] 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 1653/4278] 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 1654/4278] =?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 1655/4278] 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 1656/4278] 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 1657/4278] 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 1658/4278] 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 1659/4278] 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 1660/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Emac?= =?UTF-8?q?s=20for=20(even=20more=20of)=20the=20win=20sources/tech/2019030?= =?UTF-8?q?1=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 1661/4278] =?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 1662/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20How?= =?UTF-8?q?=20to=20set=20up=20a=20homelab=20from=20hardware=20to=20firewal?= =?UTF-8?q?l=20sources/tech/20190319=20How=20to=20set=20up=20a=20homelab?= =?UTF-8?q?=20from=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 1663/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20Bloc?= =?UTF-8?q?kchain=202.0:=20Blockchain=20In=20Real=20Estate=20[Part=204]=20?= =?UTF-8?q?sources/tech/20190319=20Blockchain=202.0-=20Blockchain=20In=20R?= =?UTF-8?q?eal=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 1664/4278] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20How?= =?UTF-8?q?=20To=20Set=20Up=20a=20Firewall=20with=20GUFW=20on=20Linux=20so?= =?UTF-8?q?urces/tech/20190319=20How=20To=20Set=20Up=20a=20Firewall=20with?= =?UTF-8?q?=20GUFW=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 1665/4278] 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 1666/4278] 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 支持使用 `